blob: 3f88a4df3ad2161e9939d3f5166d800851653e85 [file] [log] [blame]
Zane Shelleyb406de42019-09-09 16:10:38 -05001/**
2 * @file hei_types.hpp
3 *
4 * This file contains simple types/enums used throughout all of the isolator
5 * code.
6 */
7
8#pragma once
9
10#include <stdint.h>
11
12namespace libhei
13{
14
15/**
Zane Shelley0d4f5622019-10-14 13:02:30 -050016 * A value representing the type of chip that is being accessed. A unique value
17 * will exist for each Chip Data File. During isolation, the user application
18 * will pass these values to the isolator along with pointers to the user
19 * application's chip objects. This tells the isolator which Chip Data File to
20 * reference for each chip.
21 *
22 * Values:
23 * The values are determined by the chip manufacturer. The isolator does not
24 * need to know the possible values because the user application controls
25 * both the Chip Data Files and the input into the isolation function.
Zane Shelley0d4f5622019-10-14 13:02:30 -050026 *
27 * Range:
Zane Shelley13b182b2020-05-07 20:23:45 -050028 * This is defined as a 4-byte field in the Chip Data Files.
Zane Shelleyb406de42019-09-09 16:10:38 -050029 */
Zane Shelley8c093d82020-05-04 22:06:52 -050030using ChipType_t = uint32_t;
Zane Shelleyb406de42019-09-09 16:10:38 -050031
32/**
Zane Shelley6722b5b2020-05-12 22:09:04 -050033 * Each isolation node within a chip must have a unique ID. These IDs (combined
34 * with other information) will be passed back to the user application to
35 * identify all of the active errors reported by this chip. Note that some
36 * isolation nodes will have multiple instances within a chip. An ID will be
37 * used for all instances of a node. See enum Instance_t for details on the
38 * instance value.
39 *
40 * Values:
41 * The isolator does not need to know the possible values because the values
42 * are passed from the Chip Data Files to the user application.
43 *
44 * Range:
45 * This is a 2-byte field, which should be sufficient to support all the
46 * isolation nodes on a typical chip.
47 */
48using NodeId_t = uint16_t;
49
50/**
Zane Shelley0d4f5622019-10-14 13:02:30 -050051 * Different chips will contain different types of registers. Also, a single
52 * chip may also support multiple types of registers. These enum values are
53 * used to communicate to the user application which type of register access is
54 * needed.
55 *
56 * Values:
57 * The supported register types are listed in this enum.
58 *
59 * Range:
Zane Shelley13b182b2020-05-07 20:23:45 -050060 * This is defined as the minimum 1-byte field in the Chip Data Files.
Zane Shelleyb406de42019-09-09 16:10:38 -050061 */
Zane Shelley0d4f5622019-10-14 13:02:30 -050062enum RegisterType_t : uint8_t
63{
Zane Shelley13b182b2020-05-07 20:23:45 -050064 REG_TYPE_SCOM = 0x01, ///< Power Systems SCOM register.
65 REG_TYPE_ID_SCOM = 0x02, ///< Power Systems Indirect SCOM register.
Zane Shelley0d4f5622019-10-14 13:02:30 -050066};
67
68/**
69 * Each register within a chip must have a unique ID. These IDs (combined with
70 * other information) will be passed back to the user application to identify
Zane Shelley13b182b2020-05-07 20:23:45 -050071 * register contents captured for debugging purposes. Note that some registers
72 * will have multiple instances within a chip. An ID will be used for all
73 * instances of a register. See Instance_t for details on the register instance
74 * value.
Zane Shelley0d4f5622019-10-14 13:02:30 -050075 *
76 * Values:
77 * The isolator does not need to know the possible values because the values
Zane Shelley13b182b2020-05-07 20:23:45 -050078 * are passed from the Chip Data Files to the user application.
Zane Shelley0d4f5622019-10-14 13:02:30 -050079 *
80 * Range:
Zane Shelley13b182b2020-05-07 20:23:45 -050081 * This is defined as a 3-byte field in the Chip Data Files, which should be
82 * sufficient to support all the registers on a typical chip.
Zane Shelley0d4f5622019-10-14 13:02:30 -050083 */
Zane Shelley13b182b2020-05-07 20:23:45 -050084using RegisterId_t = uint32_t; // IMPORTANT: see range note above.
Zane Shelley0d4f5622019-10-14 13:02:30 -050085
86/**
Zane Shelley13b182b2020-05-07 20:23:45 -050087 * A chip could contain more than one instance of a register or node. For
88 * example, a register could exist for each instance of a core on a processor
89 * chip. This field will be used to differeniate multiple instances of a
90 * register in order to avoid repeating common information for every instance.
Zane Shelley0d4f5622019-10-14 13:02:30 -050091 *
92 * Values:
Zane Shelley13b182b2020-05-07 20:23:45 -050093 * Not all registers or nodes will have multiple instances. So the default
94 * instance value is 0, which always indicates the first (or only) logical
95 * instance. Then a value of 1-255 can be used for each subsequent instance.
Zane Shelley0d4f5622019-10-14 13:02:30 -050096 *
97 * Range:
Zane Shelley13b182b2020-05-07 20:23:45 -050098 * This is defined as a 1-byte field in the Chip Data Files.
Zane Shelley0d4f5622019-10-14 13:02:30 -050099 */
Zane Shelley13b182b2020-05-07 20:23:45 -0500100using Instance_t = uint8_t;
Zane Shelley0d4f5622019-10-14 13:02:30 -0500101
102/**
Zane Shelley13b182b2020-05-07 20:23:45 -0500103 * This is used to defined a bit field for a register or node.
Zane Shelley93b61ad2019-10-16 20:41:03 -0500104 *
105 * Values:
Zane Shelley13b182b2020-05-07 20:23:45 -0500106 * The widest supported register type is only 64-bits (value 0-63).
Zane Shelley93b61ad2019-10-16 20:41:03 -0500107 *
108 * Range:
Zane Shelley13b182b2020-05-07 20:23:45 -0500109 * This is defined as a 1-byte field in the Chip Data Files.
Zane Shelley93b61ad2019-10-16 20:41:03 -0500110 */
Zane Shelley13b182b2020-05-07 20:23:45 -0500111using BitPosition_t = uint8_t;
Zane Shelley93b61ad2019-10-16 20:41:03 -0500112
113/**
Zane Shelley0d4f5622019-10-14 13:02:30 -0500114 * The hardware address of a register (right justified).
115 *
116 * Values:
117 * Currently only supporting 1, 2, 4, or 8 byte addresses.
118 *
119 * Range:
120 * The maximum supported address requires an 8-byte field.
121 */
Zane Shelley13b182b2020-05-07 20:23:45 -0500122using RegisterAddress_t = uint64_t;
Zane Shelley0d4f5622019-10-14 13:02:30 -0500123
124/**
Zane Shelley7667b712020-05-11 20:45:40 -0500125 * The hardware register attribute flags.
Zane Shelley0d4f5622019-10-14 13:02:30 -0500126 *
127 * Values:
Zane Shelley7667b712020-05-11 20:45:40 -0500128 * Each bit within this field represents an attribute flag. If the bit is 0,
129 * the flag is disabled. If the bit is 1, the flag is enabled.
Zane Shelley0d4f5622019-10-14 13:02:30 -0500130 *
131 * Range:
Zane Shelley13b182b2020-05-07 20:23:45 -0500132 * This is defined as a 1-byte field in the Chip Data Files.
Zane Shelley0d4f5622019-10-14 13:02:30 -0500133 */
Zane Shelley7667b712020-05-11 20:45:40 -0500134enum RegisterAttributeFlags_t : uint8_t
Zane Shelley0d4f5622019-10-14 13:02:30 -0500135{
Zane Shelley7667b712020-05-11 20:45:40 -0500136 REG_ATTR_ACCESS_READ = 0x80, ///< Register read access access
137 REG_ATTR_ACCESS_WRITE = 0x40, ///< Register write access access
138 REG_ATTR_RESERVED = 0x3f, ///< Reserved/unused bits
Zane Shelley0d4f5622019-10-14 13:02:30 -0500139};
Zane Shelleyb406de42019-09-09 16:10:38 -0500140
Zane Shelley93b61ad2019-10-16 20:41:03 -0500141/**
142 * The Chip Data Files will contain action, rules, etc. based on the supported
143 * attention types listed in this enum. The user application must use the
144 * values defined in this enum in order to maintain consistency across all
145 * chips.
146 *
147 * Values:
148 * The supported attention types are listed in this enum.
149 *
150 * Range:
Zane Shelley13b182b2020-05-07 20:23:45 -0500151 * This is defined as a 1-byte field in the Chip Data Files.
Zane Shelley93b61ad2019-10-16 20:41:03 -0500152 */
153enum AttentionType_t : uint8_t
154{
Zane Shelley7c8faa12019-10-28 22:26:28 -0500155 // clang-format off
156
Zane Shelley93b61ad2019-10-16 20:41:03 -0500157 /** System checkstop hardware attention. Unrecoverable, fatal error. */
158 ATTN_TYPE_CHECKSTOP = 1,
159
160 /** Unit checkstop hardware attention. A unit within the system is no longer
161 * usable but the rest of the system should be able to recover. */
162 ATTN_TYPE_UNIT_CS = 2,
163
164 /** Recoverable hardware attention. The system should be able to continue
165 * uninterrupted, possible degraded functionality. */
166 ATTN_TYPE_RECOVERABLE = 3,
167
168 /** Software or hardware event requiring action by the service processor
169 * firmware. */
170 ATTN_TYPE_SP_ATTN = 4,
171
172 /** Software or hardware event requiring action by the host firmware. */
173 ATTN_TYPE_HOST_ATTN = 5,
Zane Shelley7c8faa12019-10-28 22:26:28 -0500174
175 // clang-format on
Zane Shelley93b61ad2019-10-16 20:41:03 -0500176};
177
Zane Shelleyb406de42019-09-09 16:10:38 -0500178} // end namespace libhei