Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 1 | /** |
| 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 | |
| 12 | namespace libhei |
| 13 | { |
| 14 | |
| 15 | /** |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 16 | * 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 Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 26 | * |
| 27 | * Range: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 28 | * This is defined as a 4-byte field in the Chip Data Files. |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 29 | */ |
Zane Shelley | 8c093d8 | 2020-05-04 22:06:52 -0500 | [diff] [blame] | 30 | using ChipType_t = uint32_t; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 31 | |
| 32 | /** |
Zane Shelley | 6722b5b | 2020-05-12 22:09:04 -0500 | [diff] [blame] | 33 | * 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 | */ |
| 48 | using NodeId_t = uint16_t; |
| 49 | |
| 50 | /** |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 51 | * 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 Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 60 | * This is defined as the minimum 1-byte field in the Chip Data Files. |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 61 | */ |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 62 | enum RegisterType_t : uint8_t |
| 63 | { |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 64 | REG_TYPE_SCOM = 0x01, ///< Power Systems SCOM register. |
| 65 | REG_TYPE_ID_SCOM = 0x02, ///< Power Systems Indirect SCOM register. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 66 | }; |
| 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 Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 71 | * 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 Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 75 | * |
| 76 | * Values: |
| 77 | * The isolator does not need to know the possible values because the values |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 78 | * are passed from the Chip Data Files to the user application. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 79 | * |
| 80 | * Range: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 81 | * 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 Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 83 | */ |
Zane Shelley | b9a8e76 | 2020-05-11 21:41:32 -0500 | [diff] [blame] | 84 | // IMPORTANT: typedef or using only creates an alias which is not a new type. |
| 85 | // Need to defined this as an enum so that template specialization will detect a |
| 86 | // new variable type. See note aboved for details. |
| 87 | enum RegisterId_t : uint32_t; |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 88 | |
| 89 | /** |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 90 | * A chip could contain more than one instance of a register or node. For |
| 91 | * example, a register could exist for each instance of a core on a processor |
| 92 | * chip. This field will be used to differeniate multiple instances of a |
| 93 | * register in order to avoid repeating common information for every instance. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 94 | * |
| 95 | * Values: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 96 | * Not all registers or nodes will have multiple instances. So the default |
| 97 | * instance value is 0, which always indicates the first (or only) logical |
| 98 | * instance. Then a value of 1-255 can be used for each subsequent instance. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 99 | * |
| 100 | * Range: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 101 | * This is defined as a 1-byte field in the Chip Data Files. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 102 | */ |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 103 | using Instance_t = uint8_t; |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 104 | |
| 105 | /** |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 106 | * This is used to defined a bit field for a register or node. |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 107 | * |
| 108 | * Values: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 109 | * The widest supported register type is only 64-bits (value 0-63). |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 110 | * |
| 111 | * Range: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 112 | * This is defined as a 1-byte field in the Chip Data Files. |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 113 | */ |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 114 | using BitPosition_t = uint8_t; |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 115 | |
| 116 | /** |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 117 | * The hardware address of a register (right justified). |
| 118 | * |
| 119 | * Values: |
| 120 | * Currently only supporting 1, 2, 4, or 8 byte addresses. |
| 121 | * |
| 122 | * Range: |
| 123 | * The maximum supported address requires an 8-byte field. |
| 124 | */ |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 125 | using RegisterAddress_t = uint64_t; |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 126 | |
| 127 | /** |
Zane Shelley | 7667b71 | 2020-05-11 20:45:40 -0500 | [diff] [blame] | 128 | * The hardware register attribute flags. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 129 | * |
| 130 | * Values: |
Zane Shelley | 7667b71 | 2020-05-11 20:45:40 -0500 | [diff] [blame] | 131 | * Each bit within this field represents an attribute flag. If the bit is 0, |
| 132 | * the flag is disabled. If the bit is 1, the flag is enabled. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 133 | * |
| 134 | * Range: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 135 | * This is defined as a 1-byte field in the Chip Data Files. |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 136 | */ |
Zane Shelley | 7667b71 | 2020-05-11 20:45:40 -0500 | [diff] [blame] | 137 | enum RegisterAttributeFlags_t : uint8_t |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 138 | { |
Zane Shelley | 7667b71 | 2020-05-11 20:45:40 -0500 | [diff] [blame] | 139 | REG_ATTR_ACCESS_READ = 0x80, ///< Register read access access |
| 140 | REG_ATTR_ACCESS_WRITE = 0x40, ///< Register write access access |
| 141 | REG_ATTR_RESERVED = 0x3f, ///< Reserved/unused bits |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 142 | }; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 143 | |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 144 | /** |
| 145 | * The Chip Data Files will contain action, rules, etc. based on the supported |
| 146 | * attention types listed in this enum. The user application must use the |
| 147 | * values defined in this enum in order to maintain consistency across all |
| 148 | * chips. |
| 149 | * |
| 150 | * Values: |
| 151 | * The supported attention types are listed in this enum. |
| 152 | * |
| 153 | * Range: |
Zane Shelley | 13b182b | 2020-05-07 20:23:45 -0500 | [diff] [blame] | 154 | * This is defined as a 1-byte field in the Chip Data Files. |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 155 | */ |
| 156 | enum AttentionType_t : uint8_t |
| 157 | { |
Zane Shelley | 7c8faa1 | 2019-10-28 22:26:28 -0500 | [diff] [blame] | 158 | // clang-format off |
| 159 | |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 160 | /** System checkstop hardware attention. Unrecoverable, fatal error. */ |
| 161 | ATTN_TYPE_CHECKSTOP = 1, |
| 162 | |
| 163 | /** Unit checkstop hardware attention. A unit within the system is no longer |
| 164 | * usable but the rest of the system should be able to recover. */ |
| 165 | ATTN_TYPE_UNIT_CS = 2, |
| 166 | |
| 167 | /** Recoverable hardware attention. The system should be able to continue |
| 168 | * uninterrupted, possible degraded functionality. */ |
| 169 | ATTN_TYPE_RECOVERABLE = 3, |
| 170 | |
| 171 | /** Software or hardware event requiring action by the service processor |
| 172 | * firmware. */ |
| 173 | ATTN_TYPE_SP_ATTN = 4, |
| 174 | |
| 175 | /** Software or hardware event requiring action by the host firmware. */ |
| 176 | ATTN_TYPE_HOST_ATTN = 5, |
Zane Shelley | 7c8faa1 | 2019-10-28 22:26:28 -0500 | [diff] [blame] | 177 | |
| 178 | // clang-format on |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 179 | }; |
| 180 | |
Zane Shelley | 2e38ae5 | 2020-11-05 22:21:30 -0600 | [diff] [blame] | 181 | /** |
| 182 | * Each Chip Data File will begin with a keyword signafying it is a Chip Data |
| 183 | * File. |
| 184 | */ |
| 185 | using FileKeyword_t = uint64_t; |
| 186 | |
| 187 | constexpr FileKeyword_t KW_CHIPDATA = 0x4348495044415441; // "CHIPDATA" ASCII |
| 188 | |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 189 | } // end namespace libhei |