This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpldm_types.h
196 lines (185 loc) · 3.98 KB
/
pldm_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#ifndef PLDM_TYPES_H
#define PLDM_TYPES_H
#include <stdint.h>
/** @brief PLDM Types
*/
enum pldm_supported_types {
PLDM_BASE = 0x00,
PLDM_SMBIOS = 0x01,
PLDM_PLATFORM = 0x02,
PLDM_BIOS = 0x03,
PLDM_FRU = 0x04,
PLDM_FWUP = 0x05,
PLDM_RDE = 0x06,
PLDM_OEM = 0x3F,
};
typedef union {
uint8_t byte;
struct {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
} __attribute__((packed)) bits;
} bitfield8_t;
/** @struct pldm_version
*
*
*/
typedef struct pldm_version {
uint8_t major;
uint8_t minor;
uint8_t update;
uint8_t alpha;
} __attribute__((packed)) ver32_t;
typedef uint8_t bool8_t;
typedef union {
uint16_t value;
struct {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
} __attribute__((packed)) bits;
} bitfield16_t;
typedef union {
uint32_t value;
struct {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
uint8_t bit16 : 1;
uint8_t bit17 : 1;
uint8_t bit18 : 1;
uint8_t bit19 : 1;
uint8_t bit20 : 1;
uint8_t bit21 : 1;
uint8_t bit22 : 1;
uint8_t bit23 : 1;
uint8_t bit24 : 1;
uint8_t bit25 : 1;
uint8_t bit26 : 1;
uint8_t bit27 : 1;
uint8_t bit28 : 1;
uint8_t bit29 : 1;
uint8_t bit30 : 1;
uint8_t bit31 : 1;
} __attribute__((packed)) bits;
} bitfield32_t;
typedef union {
uint64_t value;
struct {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
uint8_t bit8 : 1;
uint8_t bit9 : 1;
uint8_t bit10 : 1;
uint8_t bit11 : 1;
uint8_t bit12 : 1;
uint8_t bit13 : 1;
uint8_t bit14 : 1;
uint8_t bit15 : 1;
uint8_t bit16 : 1;
uint8_t bit17 : 1;
uint8_t bit18 : 1;
uint8_t bit19 : 1;
uint8_t bit20 : 1;
uint8_t bit21 : 1;
uint8_t bit22 : 1;
uint8_t bit23 : 1;
uint8_t bit24 : 1;
uint8_t bit25 : 1;
uint8_t bit26 : 1;
uint8_t bit27 : 1;
uint8_t bit28 : 1;
uint8_t bit29 : 1;
uint8_t bit30 : 1;
uint8_t bit31 : 1;
uint8_t bit32 : 1;
uint8_t bit33 : 1;
uint8_t bit34 : 1;
uint8_t bit35 : 1;
uint8_t bit36 : 1;
uint8_t bit37 : 1;
uint8_t bit38 : 1;
uint8_t bit39 : 1;
uint8_t bit40 : 1;
uint8_t bit41 : 1;
uint8_t bit42 : 1;
uint8_t bit43 : 1;
uint8_t bit44 : 1;
uint8_t bit45 : 1;
uint8_t bit46 : 1;
uint8_t bit47 : 1;
uint8_t bit48 : 1;
uint8_t bit49 : 1;
uint8_t bit50 : 1;
uint8_t bit51 : 1;
uint8_t bit52 : 1;
uint8_t bit53 : 1;
uint8_t bit54 : 1;
uint8_t bit55 : 1;
uint8_t bit56 : 1;
uint8_t bit57 : 1;
uint8_t bit58 : 1;
uint8_t bit59 : 1;
uint8_t bit60 : 1;
uint8_t bit61 : 1;
uint8_t bit62 : 1;
uint8_t bit63 : 1;
} __attribute__((packed)) bits;
} bitfield64_t;
typedef float real32_t;
typedef struct {
#if defined(__LITTLE_ENDIAN_BITFIELD)
uint8_t utc_resolution : 4; /* bit 7:4 UTC & time resolution */
uint8_t time_resolution : 4; /* bit 3:0 UTC & time resolution */
#else
uint8_t time_resolution : 4; /* bit 3:0 UTC & time resolution */
uint8_t utc_resolution : 4; /* bit 7:4 UTC & time resolution */
#endif
uint16_t year; /* year without any offset */
uint8_t month; /* 1..12 */
uint8_t day; /* 1..31 */
uint8_t hour; /* 0..23 */
uint8_t minute; /* 0..59 */
uint8_t second; /* 0..59 */
uint32_t microsecond : 24; /* 24 bit value starting from 0*/
int16_t utc_offset; /* offset in minutes signed int16 */
} __attribute__((packed)) timestamp104_t;
#endif /* PLDM_TYPES_H */