blob: 7cb853a04d209bd8ebfb945c8e1fb36e46b82fcc [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:
28 * A 4-byte field should be sufficient.
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 Shelley0d4f5622019-10-14 13:02:30 -050033 * Different chips will contain different types of registers. Also, a single
34 * chip may also support multiple types of registers. These enum values are
35 * used to communicate to the user application which type of register access is
36 * needed.
37 *
38 * Values:
39 * The supported register types are listed in this enum.
40 *
41 * Range:
42 * Power Systems only have a couple different types that would be accessed by
43 * the isolator. The minimum 1-byte field should be sufficient.
Zane Shelleyb406de42019-09-09 16:10:38 -050044 */
Zane Shelley0d4f5622019-10-14 13:02:30 -050045enum RegisterType_t : uint8_t
46{
47 REG_TYPE_INVALID = 0, ///< invalid/unsupported type
48 REG_TYPE_SCOM = 1, ///< Power Systems SCOM register.
49 REG_TYPE_ID_SCOM = 2, ///< Power Systems Indirect SCOM register.
50};
51
52/**
53 * Each register within a chip must have a unique ID. These IDs (combined with
54 * other information) will be passed back to the user application to identify
55 * all of the active errors reported by this chip. Note that some registers will
56 * have multiple instances within a chip. An ID will be used for all instances
57 * of a register. See enum RegisterInstance_t for details on the register
58 * instance value.
59 *
60 * Values:
61 * The isolator does not need to know the possible values because the values
62 * are passed from the Chip Data Files to the user application. Therefore, no
63 * values will be listed in this enum except for the default invalid type.
64 *
65 * Range:
66 * A 2-byte field should be sufficient to support up to 65535 registers on a
67 * chip.
68 */
69enum RegisterId_t : uint16_t
70{
71 REG_ID_INVALID = 0, ///< invalid/unsupported type
72};
73
74/**
75 * A chip could contain more than one instance of a register. For example, a
76 * register could exist for each instance of a core on a processor chip.
77 * This field will be used to differeniate multiple instances of a register in
78 * order to avoid repeating common information for every instance.
79 *
80 * Values:
81 * Not all registers will have multiple instances. So the default instance
82 * value is 0, which always indicates the first (or only) logical instance.
83 * Then a value of 1-255 can be used for each subsequent instance.
84 *
85 * Range:
86 * The 1-byte field should be sufficient.
87 */
88enum RegisterInstance_t : uint8_t
89{
90 REG_INST_DEFAULT = 0, ///< indicates the first (or only) logical instance
91};
92
93/**
Zane Shelley93b61ad2019-10-16 20:41:03 -050094 * This is used to defined a bit field for a register. It is mainly used in the
95 * Signature class to indicate which bit on a register had an active attention.
96 *
97 * Values:
98 * The widest supported register is only 64-bits (value 0-63).
99 *
100 * Range:
101 * Only the minimum 1-byte field is necessary.
102 */
103typedef uint8_t RegisterBit_t;
104
105/**
Zane Shelley0d4f5622019-10-14 13:02:30 -0500106 * The hardware address of a register (right justified).
107 *
108 * Values:
109 * Currently only supporting 1, 2, 4, or 8 byte addresses.
110 *
111 * Range:
112 * The maximum supported address requires an 8-byte field.
113 */
114enum RegisterAddress_t : uint64_t
115{
116 REG_ADDR_INVALID = 0, ///< invalid/unsupported address
117};
118
119/**
120 * The hardware access level of a register.
121 *
122 * Values:
123 * The supported access levels are listed in this enum.
124 *
125 * Range:
126 * Only the minimum 1-byte field is necessary.
127 */
128enum RegisterAccessLevel_t : uint8_t
129{
130 REG_ACCESS_NONE = 0x0, ///< No access
131 REG_ACCESS_RO = 0x1, ///< Read-only access
132 REG_ACCESS_WO = 0x2, ///< Write-only access
133 REG_ACCESS_RW = 0x3, ///< Read/Write access
134};
Zane Shelleyb406de42019-09-09 16:10:38 -0500135
Zane Shelley93b61ad2019-10-16 20:41:03 -0500136/**
137 * The Chip Data Files will contain action, rules, etc. based on the supported
138 * attention types listed in this enum. The user application must use the
139 * values defined in this enum in order to maintain consistency across all
140 * chips.
141 *
142 * Values:
143 * The supported attention types are listed in this enum.
144 *
145 * Range:
146 * Only the minimum 1-byte field is necessary.
147 */
148enum AttentionType_t : uint8_t
149{
Zane Shelley7c8faa12019-10-28 22:26:28 -0500150 // clang-format off
151
Zane Shelley93b61ad2019-10-16 20:41:03 -0500152 /** System checkstop hardware attention. Unrecoverable, fatal error. */
153 ATTN_TYPE_CHECKSTOP = 1,
154
155 /** Unit checkstop hardware attention. A unit within the system is no longer
156 * usable but the rest of the system should be able to recover. */
157 ATTN_TYPE_UNIT_CS = 2,
158
159 /** Recoverable hardware attention. The system should be able to continue
160 * uninterrupted, possible degraded functionality. */
161 ATTN_TYPE_RECOVERABLE = 3,
162
163 /** Software or hardware event requiring action by the service processor
164 * firmware. */
165 ATTN_TYPE_SP_ATTN = 4,
166
167 /** Software or hardware event requiring action by the host firmware. */
168 ATTN_TYPE_HOST_ATTN = 5,
Zane Shelley7c8faa12019-10-28 22:26:28 -0500169
170 // clang-format on
Zane Shelley93b61ad2019-10-16 20:41:03 -0500171};
172
Zane Shelleyb406de42019-09-09 16:10:38 -0500173} // end namespace libhei