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. |
| 26 | * Therefore, no values will be listed in this enum except for the default |
| 27 | * invalid type. |
| 28 | * |
| 29 | * Range: |
| 30 | * A 4-byte field should be sufficient. |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 31 | */ |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 32 | enum ChipType_t : uint32_t |
| 33 | { |
| 34 | CHIP_TYPE_INVALID = 0, ///< invalid/unsupported type |
| 35 | }; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 36 | |
| 37 | /** |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 38 | * Different chips will contain different types of registers. Also, a single |
| 39 | * chip may also support multiple types of registers. These enum values are |
| 40 | * used to communicate to the user application which type of register access is |
| 41 | * needed. |
| 42 | * |
| 43 | * Values: |
| 44 | * The supported register types are listed in this enum. |
| 45 | * |
| 46 | * Range: |
| 47 | * Power Systems only have a couple different types that would be accessed by |
| 48 | * the isolator. The minimum 1-byte field should be sufficient. |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 49 | */ |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 50 | enum RegisterType_t : uint8_t |
| 51 | { |
| 52 | REG_TYPE_INVALID = 0, ///< invalid/unsupported type |
| 53 | REG_TYPE_SCOM = 1, ///< Power Systems SCOM register. |
| 54 | REG_TYPE_ID_SCOM = 2, ///< Power Systems Indirect SCOM register. |
| 55 | }; |
| 56 | |
| 57 | /** |
| 58 | * Each register within a chip must have a unique ID. These IDs (combined with |
| 59 | * other information) will be passed back to the user application to identify |
| 60 | * all of the active errors reported by this chip. Note that some registers will |
| 61 | * have multiple instances within a chip. An ID will be used for all instances |
| 62 | * of a register. See enum RegisterInstance_t for details on the register |
| 63 | * instance value. |
| 64 | * |
| 65 | * Values: |
| 66 | * The isolator does not need to know the possible values because the values |
| 67 | * are passed from the Chip Data Files to the user application. Therefore, no |
| 68 | * values will be listed in this enum except for the default invalid type. |
| 69 | * |
| 70 | * Range: |
| 71 | * A 2-byte field should be sufficient to support up to 65535 registers on a |
| 72 | * chip. |
| 73 | */ |
| 74 | enum RegisterId_t : uint16_t |
| 75 | { |
| 76 | REG_ID_INVALID = 0, ///< invalid/unsupported type |
| 77 | }; |
| 78 | |
| 79 | /** |
| 80 | * A chip could contain more than one instance of a register. For example, a |
| 81 | * register could exist for each instance of a core on a processor chip. |
| 82 | * This field will be used to differeniate multiple instances of a register in |
| 83 | * order to avoid repeating common information for every instance. |
| 84 | * |
| 85 | * Values: |
| 86 | * Not all registers will have multiple instances. So the default instance |
| 87 | * value is 0, which always indicates the first (or only) logical instance. |
| 88 | * Then a value of 1-255 can be used for each subsequent instance. |
| 89 | * |
| 90 | * Range: |
| 91 | * The 1-byte field should be sufficient. |
| 92 | */ |
| 93 | enum RegisterInstance_t : uint8_t |
| 94 | { |
| 95 | REG_INST_DEFAULT = 0, ///< indicates the first (or only) logical instance |
| 96 | }; |
| 97 | |
| 98 | /** |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 99 | * This is used to defined a bit field for a register. It is mainly used in the |
| 100 | * Signature class to indicate which bit on a register had an active attention. |
| 101 | * |
| 102 | * Values: |
| 103 | * The widest supported register is only 64-bits (value 0-63). |
| 104 | * |
| 105 | * Range: |
| 106 | * Only the minimum 1-byte field is necessary. |
| 107 | */ |
| 108 | typedef uint8_t RegisterBit_t; |
| 109 | |
| 110 | /** |
Zane Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 111 | * The hardware address of a register (right justified). |
| 112 | * |
| 113 | * Values: |
| 114 | * Currently only supporting 1, 2, 4, or 8 byte addresses. |
| 115 | * |
| 116 | * Range: |
| 117 | * The maximum supported address requires an 8-byte field. |
| 118 | */ |
| 119 | enum RegisterAddress_t : uint64_t |
| 120 | { |
| 121 | REG_ADDR_INVALID = 0, ///< invalid/unsupported address |
| 122 | }; |
| 123 | |
| 124 | /** |
| 125 | * The hardware access level of a register. |
| 126 | * |
| 127 | * Values: |
| 128 | * The supported access levels are listed in this enum. |
| 129 | * |
| 130 | * Range: |
| 131 | * Only the minimum 1-byte field is necessary. |
| 132 | */ |
| 133 | enum RegisterAccessLevel_t : uint8_t |
| 134 | { |
| 135 | REG_ACCESS_NONE = 0x0, ///< No access |
| 136 | REG_ACCESS_RO = 0x1, ///< Read-only access |
| 137 | REG_ACCESS_WO = 0x2, ///< Write-only access |
| 138 | REG_ACCESS_RW = 0x3, ///< Read/Write access |
| 139 | }; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 140 | |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 141 | /** |
| 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: |
| 151 | * Only the minimum 1-byte field is necessary. |
| 152 | */ |
| 153 | enum AttentionType_t : uint8_t |
| 154 | { |
Zane Shelley | 7c8faa1 | 2019-10-28 22:26:28 -0500 | [diff] [blame] | 155 | // clang-format off |
| 156 | |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 157 | /** 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 Shelley | 7c8faa1 | 2019-10-28 22:26:28 -0500 | [diff] [blame] | 174 | |
| 175 | // clang-format on |
Zane Shelley | 93b61ad | 2019-10-16 20:41:03 -0500 | [diff] [blame] | 176 | }; |
| 177 | |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 178 | } // end namespace libhei |