Branch data Line data Source code
1 : : // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
2 : : /* Copyright 2013-2019 IBM Corp. */
3 : :
4 : : #ifndef __SPIRA_H
5 : : #define __SPIRA_H
6 : :
7 : : #include "hdif.h"
8 : :
9 : : /*
10 : : * The SPIRA-H and SPIRA-S structures
11 : : *
12 : : * SPIRA-H is built in the primary hypervisor (skiboot) lid, pointed to by
13 : : * the NACA and provides details to the boot firmware.
14 : : *
15 : : * SPIRA-S is built at IPL time by the boot firmware at the host data area
16 : : * location specified in SPIRA-H, and thus must be parsed.
17 : : */
18 : :
19 : : struct spira_ntuple {
20 : : __be64 addr;
21 : : __be16 alloc_cnt;
22 : : __be16 act_cnt;
23 : : __be32 alloc_len;
24 : : __be32 act_len;
25 : : __be32 tce_off;
26 : : __be64 padding;
27 : : } __packed;
28 : :
29 : : /* SPIRA-H signature */
30 : : #define SPIRAH_HDIF_SIG "SPIRAH"
31 : :
32 : : /* First version of the secure boot compliant design. */
33 : : #define SPIRAH_VERSION 0x50
34 : :
35 : : /* N-tuples in SPIRAH */
36 : : #define SPIRAH_NTUPLES_COUNT 0x6
37 : :
38 : : struct spirah_ntuples {
39 : : struct HDIF_array_hdr array_hdr; /* 0x030 */
40 : : struct spira_ntuple hs_data_area; /* 0x040 */
41 : : struct spira_ntuple proc_init; /* 0x060 */
42 : : struct spira_ntuple cpu_ctrl; /* 0x080 */
43 : : struct spira_ntuple mdump_src; /* 0x0a0 */
44 : : struct spira_ntuple mdump_dst; /* 0x0c0 */
45 : : struct spira_ntuple mdump_res; /* 0x0e0 */
46 : : struct spira_ntuple proc_dump_area; /* 0x100 */
47 : : };
48 : :
49 : : struct spirah {
50 : : struct HDIF_common_hdr hdr;
51 : : struct HDIF_idata_ptr ntuples_ptr;
52 : : __be64 pad;
53 : : struct spirah_ntuples ntuples;
54 : : u8 reserved[0xE0];
55 : : } __packed __align(0x100);
56 : :
57 : : extern struct spirah spirah;
58 : :
59 : : /* SPIRA-S signature */
60 : : #define SPIRAS_HDIF_SIG "SPIRAS"
61 : :
62 : : /* First version on 810 release */
63 : : #define SPIRAS_VERSION_P8 0x40
64 : : #define SPIRAS_VERSION_P9 0x50
65 : :
66 : : /* N-tuples in SPIRAS */
67 : : #define SPIRAS_NTUPLES_COUNT 0x10
68 : :
69 : : struct spiras_ntuples {
70 : : struct HDIF_array_hdr array_hdr; /* 0x030 */
71 : : struct spira_ntuple sp_subsys; /* 0x040 */
72 : : struct spira_ntuple ipl_parms; /* 0x060 */
73 : : struct spira_ntuple nt_enclosure_vpd; /* 0x080 */
74 : : struct spira_ntuple slca; /* 0x0a0 */
75 : : struct spira_ntuple backplane_vpd; /* 0x0c0 */
76 : : struct spira_ntuple system_vpd; /* 0x0e0 */
77 : : struct spira_ntuple clock_vpd; /* 0x100 */
78 : : struct spira_ntuple anchor_vpd; /* 0x120 */
79 : : struct spira_ntuple op_panel_vpd; /* 0x140 */
80 : : struct spira_ntuple misc_cec_fru_vpd; /* 0x160 */
81 : : struct spira_ntuple ms_vpd; /* 0x180 */
82 : : struct spira_ntuple cec_iohub_fru; /* 0x1a0 */
83 : : struct spira_ntuple pcia; /* 0x1c0 */
84 : : struct spira_ntuple proc_chip; /* 0x1e0 */
85 : : struct spira_ntuple hs_data; /* 0x200 */
86 : : struct spira_ntuple hbrt_data; /* 0x220 */
87 : : struct spira_ntuple ipmi_sensor; /* 0x240 */
88 : : struct spira_ntuple node_stb_data; /* 0x260 */
89 : : };
90 : :
91 : : struct spiras {
92 : : struct HDIF_common_hdr hdr;
93 : : struct HDIF_idata_ptr ntuples_ptr;
94 : : __be64 pad;
95 : : struct spiras_ntuples ntuples;
96 : : u8 reserved[0x180];
97 : : } __packed __align(0x100);
98 : :
99 : : extern struct spiras *skiboot_constant_addr spiras;
100 : :
101 : : /* This macro can be used to check the validity of a pointer returned
102 : : * by one of the HDIF API functions. It returns true if the pointer
103 : : * appears valid. If it's not valid and not NULL, it will print some
104 : : * error in the log as well.
105 : : */
106 : : #define CHECK_SPPTR(_ptr) spira_check_ptr(_ptr, __FILE__, __LINE__)
107 : :
108 : : #define get_hdif(ntuple, id) __get_hdif((ntuple), (id), __FILE__, __LINE__)
109 : :
110 : : extern struct HDIF_common_hdr *__get_hdif(struct spira_ntuple *n,
111 : : const char id[],
112 : : const char *file, int line);
113 : :
114 : : #define for_each_ntuple_idx(_ntuples, _p, _idx, _id) \
115 : : for (_p = get_hdif((_ntuples), _id ""), _idx = 0; \
116 : : _p && _idx < be16_to_cpu((_ntuples)->act_cnt); \
117 : : _p = (void *)_p + be32_to_cpu((_ntuples)->alloc_len), _idx++)
118 : :
119 : : #define for_each_ntuple(_ntuples, _p, _id) \
120 : : for (_p = get_hdif((_ntuples), _id ""); \
121 : : _p && (void *)_p < ntuple_addr(_ntuples) \
122 : : + (be16_to_cpu((_ntuples)->act_cnt) * \
123 : : be32_to_cpu((_ntuples)->alloc_len)); \
124 : : _p = (void *)_p + be32_to_cpu((_ntuples)->alloc_len))
125 : :
126 : : #define for_each_pcia(s, p) for_each_ntuple(&(s)->ntuples.pcia, p, SPPCIA_HDIF_SIG)
127 : :
128 : : /* We override these for testing. */
129 : : #ifndef ntuple_addr
130 : : #define ntuple_addr(_ntuples) ((void *)BE64_TO_CPU((_ntuples)->addr))
131 : : #endif
132 : :
133 : : #ifndef spira_check_ptr
134 : : extern bool spira_check_ptr(const void *ptr, const char *file,
135 : : unsigned int line);
136 : : #endif
137 : :
138 : : struct proc_init_data {
139 : : struct HDIF_common_hdr hdr;
140 : : struct HDIF_idata_ptr regs_ptr;
141 : : struct {
142 : : __be64 nia;
143 : : __be64 msr;
144 : : __be64 nia_charm_time;
145 : : __be64 msr_charm_time;
146 : : } regs;
147 : : } __packed __align(0x10);
148 : :
149 : : /*
150 : : * The FRU ID structure is used in several tuples, so we
151 : : * define it generically here
152 : : */
153 : : struct spira_fru_id {
154 : : __be16 slca_index;
155 : : __be16 rsrc_id; /* formerly VPD port number */
156 : : } __packed;
157 : :
158 : : /*
159 : : * The FRU operational status structure is used in several
160 : : * tuples, so we define it generically here
161 : : */
162 : : struct spira_fru_op_status {
163 : : uint8_t flags;
164 : : #define FRU_OP_STATUS_FLAG_USED 0x02 /* If 0 -> not used (redundant) */
165 : : #define FRU_OP_STATUS_FLAG_FUNCTIONAL 0x01 /* If 0 -> non-functional */
166 : : uint8_t reserved[3];
167 : : } __packed;
168 : :
169 : : /*
170 : : * Move VPD related stuff to another file ...
171 : : */
172 : : #define VPD_ID(_a, _b) ((_a) << 8 | (_b))
173 : :
174 : : /*
175 : : * Service Processor Subsystem Structure
176 : : *
177 : : * This structure contains several internal data blocks
178 : : * describing the service processor(s) in the system
179 : : */
180 : :
181 : : #define SPSS_HDIF_SIG "SPINFO"
182 : :
183 : : /* Idata index 0 : FRU ID Data */
184 : : #define SPSS_IDATA_FRU_ID 0
185 : :
186 : : /* Idata index 1 : Keyword VPD for the FSP instance */
187 : : #define SPSS_IDATA_KEYWORD_VPD 1
188 : :
189 : : /* Idata index 2 : SP Implementation */
190 : : #define SPSS_IDATA_SP_IMPL 2
191 : :
192 : : struct spss_sp_impl {
193 : : __be16 hw_version;
194 : : __be16 sw_version;
195 : : __be16 func_flags;
196 : : #define SPSS_SP_IMPL_FLAGS_INSTALLED 0x8000
197 : : #define SPSS_SP_IMPL_FLAGS_FUNCTIONAL 0x4000
198 : : #define SPSS_SP_IMPL_FLAGS_PRIMARY 0x2000
199 : : u8 chip_version;
200 : : u8 reserved;
201 : : u8 sp_family[64];
202 : : } __packed;
203 : :
204 : : /* Idata index 3 is deprecated */
205 : :
206 : : /* Idata index 4 : SP Memory Locator */
207 : : #define SPSS_IDATA_SP_MEMLOC 4
208 : :
209 : : /* Idata index 5 : SP I/O path array */
210 : : #define SPSS_IDATA_SP_IOPATH 5
211 : :
212 : : /* An HDIF array of IO path */
213 : : struct spss_iopath {
214 : : __be16 iopath_type;
215 : : #define SPSS_IOPATH_TYPE_IOHUB_PHB 0x0001
216 : : #define SPSS_IOPATH_TYPE_PSI 0x0002
217 : : #define SPSS_IOPATH_TYPE_LPC 0x0003
218 : : union {
219 : : struct {
220 : : __be16 iohub_chip_inst;
221 : : __be16 iohub_chip_port;
222 : : __be16 phb_id;
223 : : } __packed iohub_phb;
224 : :
225 : : struct {
226 : : __be16 link_status;
227 : : #define SPSS_IO_PATH_PSI_LINK_BAD_FRU 0x0000
228 : : #define SPSS_IO_PATH_PSI_LINK_CURRENT 0x0001
229 : : #define SPSS_IO_PATH_PSI_LINK_BACKUP 0x0002
230 : : u8 ml2_version;
231 : : u8 reserved;
232 : : __be16 slca_count;
233 : : u8 slca_idx[16];
234 : : __be32 proc_chip_id;
235 : : __be32 reserved2;
236 : : __be64 gxhb_base;
237 : : } __packed psi;
238 : :
239 : : struct { /* only populated after version 0x30 */
240 : : __be16 link_status;
241 : : #define LPC_STATUS_STUFFED 0x0000
242 : : #define LPC_STATUS_ACTIVE 0x0001
243 : : uint8_t ml2_version;
244 : : uint8_t reserved[3];
245 : : __be32 chip_id;
246 : :
247 : : __be32 io_bar;
248 : : __be32 memory_bar;
249 : : __be32 firmware_bar;
250 : : __be32 internal_bar;
251 : :
252 : : __be32 mctp_base;
253 : :
254 : : __be64 uart_base;
255 : : __be32 uart_size;
256 : : __be32 uart_clk; /* UART baud clock in Hz */
257 : : __be32 uart_baud; /* UART baud rate */
258 : :
259 : : uint8_t uart_int_number;
260 : : uint8_t uart_int_type;
261 : : #define UART_INT_LVL_LOW 0x1
262 : : #define UART_INT_RISING 0x2
263 : : #define UART_INT_LVL_HIGH 0x3
264 : : uint8_t uart_valid;
265 : : uint8_t reserved3;
266 : :
267 : : __be64 bt_base;
268 : : __be32 bt_size;
269 : : uint8_t bt_sms_int_num;
270 : : uint8_t bt_bmc_response_int_num;
271 : : uint8_t reserved4[2];
272 : :
273 : : __be16 kcs_data_reg_addr;
274 : : __be16 kcs_status_reg_addr;
275 : : uint8_t kcs_int_number;
276 : :
277 : : __be64 uart2_base;
278 : : __be32 uart2_size;
279 : : __be32 uart2_clk; /* UART baud clock in Hz */
280 : : __be32 uart2_baud; /* UART baud rate */
281 : : uint8_t uart2_int_number;
282 : : uint8_t uart2_int_type;
283 : : uint8_t uart2_valid;
284 : : uint8_t reserved5;
285 : : } __packed lpc;
286 : : };
287 : : } __packed;
288 : :
289 : : /*
290 : : * IPL Parms structure
291 : : *
292 : : */
293 : :
294 : : /* Idata index 0: System Parameters */
295 : : #define IPLPARAMS_SYSPARAMS 0
296 : :
297 : : struct iplparams_sysparams {
298 : : char sys_model[4];
299 : : char cpu_feature_code[4];
300 : : __be32 effective_pvr;
301 : : __be32 system_type;
302 : : uint8_t num_lpar_oct[8];
303 : : __be32 abc_bus_speed;
304 : : __be32 wxyz_bus_speed;
305 : : __be32 sys_eco_mode;
306 : : #define SYS_ATTR_MULTIPLE_TPM PPC_BIT32(0)
307 : : #define SYS_ATTR_RISK_LEVEL PPC_BIT32(3)
308 : : #define SYS_ATTR_MPIPL_SUPPORTED PPC_BIT32(5)
309 : : __be32 sys_attributes;
310 : : __be32 mem_scrubbing;
311 : : __be16 cur_spl_value;
312 : : uint8_t pump_mode; /* Reserved */
313 : : uint8_t use_pore_sleep;
314 : : __be32 pore_image_size; /* Reserved */
315 : : uint8_t vtpm_enabled;
316 : : uint8_t hw_page_table_size; /* >= 0x59 */
317 : : __be16 hv_disp_wheel; /* >= 0x58 */
318 : : __be32 nest_freq_mhz; /* >= 0x5b */
319 : : uint8_t split_core_mode; /* >= 0x5c */
320 : : uint8_t reserved[1];
321 : : #define KEY_CLEAR_ALL PPC_BIT16(0)
322 : : #define KEY_CLEAR_OS_KEYS PPC_BIT16(1)
323 : : #define KEY_CLEAR_MFG PPC_BIT16(7)
324 : : __be16 host_fw_key_clear;
325 : : uint8_t sys_vendor[64]; /* >= 0x5f */
326 : : #define SEC_CONTAINER_SIG_CHECKING PPC_BIT16(0)
327 : : #define SEC_HASHES_EXTENDED_TO_TPM PPC_BIT16(1)
328 : : #define PHYSICAL_PRESENCE_ASSERTED PPC_BIT16(3)
329 : : __be16 sys_sec_setting; /* >= 0x60 */
330 : : __be16 tpm_config_bit; /* >= 0x60 */
331 : : __be16 tpm_drawer; /* >= 0x60 */
332 : : __be16 hw_key_hash_size; /* >= 0x60 */
333 : : #define SYSPARAMS_HW_KEY_HASH_MAX 64
334 : : uint8_t hw_key_hash[SYSPARAMS_HW_KEY_HASH_MAX]; /* >= 0x60 */
335 : : uint8_t sys_family_str[64]; /* vendor,name */
336 : : uint8_t sys_type_str[64]; /* vendor,type */
337 : : } __packed;
338 : :
339 : : /* Idata index 1: IPL parameters */
340 : : #define IPLPARAMS_IPLPARAMS 1
341 : :
342 : : struct iplparams_iplparams {
343 : : uint8_t reserved;
344 : : uint8_t hv_ipl_dest;
345 : : uint8_t ipl_side;
346 : : #define IPLPARAMS_CEC_FW_IPL_SIDE_TEMP 0x10
347 : : #define IPLPARAMS_FSP_FW_IPL_SIDE_TEMP 0x01
348 : : uint8_t ipl_speed;
349 : : __be16 cec_ipl_attrib;
350 : : #define IPLPARAMS_ATTRIB_MEM_PRESERVE PPC_BIT16(2)
351 : : uint8_t cec_ipl_maj_type;
352 : : #define IPLPARAMS_MAJ_TYPE_REIPL 0x1
353 : : uint8_t cec_ipl_min_type;
354 : : #define IPLPARAMS_MIN_TYPE_POST_DUMP 0xc
355 : : #define IPLPARAMS_MIN_TYPE_PLAT_REBOOT 0xd
356 : : uint8_t os_ipl_mode;
357 : : uint8_t keylock_pos;
358 : : uint8_t lmb_size;
359 : : uint8_t deprecated;
360 : : __be32 max_hsl_opticonnect;
361 : : __be32 other_attrib;
362 : : #define IPLPARAMS_OATTR_RST_PCI_BUSNO 0x08000000
363 : : #define IPLPARAMS_OATTR_CLEAR_NVRAM 0x04000000
364 : : #define IPLPARAMS_OATRR_LIGHT_PATH 0x00000004
365 : : __be16 huge_page_count;
366 : : uint8_t huge_page_size;
367 : : #define IPLPARAMS_HUGE_PG_SIZE_16G 0
368 : : uint8_t num_vlan_switches;
369 : : __be32 reserved2;
370 : : __be32 enlarge_io; /* >= 0x5a */
371 : : uint8_t core_config;
372 : : #define IPLPARAMS_CORE_NORMAL 0x00
373 : : #define IPLPARAMS_CORE_FUSE 0x01
374 : : } __packed;
375 : :
376 : : /* Idata index 4: Platform Dump Descriptor */
377 : : #define IPLPARAMS_PLATFORM_DUMP 4
378 : :
379 : : struct iplparams_dump {
380 : : __be16 flags;
381 : : uint8_t reserved1;
382 : : uint8_t policy;
383 : : #define HYP_DUMP_POLICY_NORMAL 0x00
384 : : __be32 dump_id;
385 : : __be64 reserved2;
386 : : __be64 act_dump_sz;
387 : : __be32 max_hw_dump_sz;
388 : : __be32 act_hw_dump_sz;
389 : : __be32 max_sp_dump_sz;
390 : : __be32 plid;
391 : : } __packed;
392 : :
393 : : /* Idata index 8: serial ports */
394 : : #define IPLPARMS_IDATA_SERIAL 8
395 : :
396 : : /* An HDIF array of serial descriptions */
397 : : struct iplparms_serial {
398 : : uint8_t loc_code[LOC_CODE_SIZE];
399 : : __be16 rsrc_id;
400 : : __be16 flags;
401 : : #define PLPARMS_SERIAL_FLAGS_CALLHOME 0x8000
402 : : } __packed;
403 : :
404 : : /* Idata index 9: FW features */
405 : : #define IPLPARAMS_FEATURES 9
406 : : struct iplparams_feature {
407 : : char name[64];
408 : : __be64 flags;
409 : : } __packed;
410 : :
411 : : /*
412 : : * Chip TOD structure
413 : : *
414 : : * This is an array of 32 entries (I assume per possible chip)
415 : : */
416 : :
417 : : /* Idata index 0: Chip ID data (array) */
418 : : #define CHIPTOD_IDATA_CHIPID 0
419 : :
420 : : struct chiptod_chipid {
421 : : __be32 chip_id;
422 : : __be32 flags;
423 : : #define CHIPTOD_ID_FLAGS_PRIMARY 0x02
424 : : #define CHIPTOD_ID_FLAGS_SECONDARY 0x01
425 : : #define CHIPTOD_ID_FLAGS_STATUS_MASK 0x0c
426 : : #define CHIPTOD_ID_FLAGS_STATUS_OK 0x04
427 : : #define CHIPTOD_ID_FLAGS_STATUS_NOK 0x08
428 : : } __packed;
429 : :
430 : : /* Idata index 0: Chip Initialization data */
431 : : #define CHIPTOD_IDATA_CHIPINIT 1
432 : :
433 : : struct chiptod_chipinit {
434 : : __be32 ctrl_reg_internal;
435 : : __be32 tod_ctrl_reg;
436 : : } __packed;
437 : :
438 : : /*
439 : : * MS VPD - Memory Description Tree
440 : : *
441 : : * One such structure pointing to the various memory arrays
442 : : * along with other infos about the BCRs, Page Mover, XSCOM,...
443 : : */
444 : : #define MSVPD_HDIF_SIG "MS VPD"
445 : :
446 : : /* Idata index 0: Mainstore address config */
447 : : #define MSVPD_IDATA_MS_ADDR_CONFIG 0
448 : :
449 : : /* Mainstore Address Configuration */
450 : : struct msvpd_ms_addr_config {
451 : : __be64 max_configured_ms_address;
452 : : __be64 max_possible_ms_address;
453 : : __be32 deprecated;
454 : : __be64 mirrorable_memory_starting_address;
455 : : __be64 hrmor_stash_loc_address;
456 : : } __packed;
457 : :
458 : : /* Idata index 1: Total configured mainstore */
459 : : #define MSVPD_IDATA_TOTAL_CONFIG_MS 1
460 : :
461 : : struct msvpd_total_config_ms {
462 : : __be64 total_in_mb;
463 : : } __packed;
464 : :
465 : : /* Idata index 2: Page mover and sync structure */
466 : : #define MSVPD_IDATA_PMOVER_SYNCHRO 2
467 : :
468 : : struct msvpd_pmover_bsr_synchro {
469 : : __be32 flags;
470 : : #define MSVPD_PMS_FLAG_HWLOCK_EN 0x80000000
471 : : #define MSVPD_PMS_FLAG_PMOVER_EN 0x40000000
472 : : #define MSVPD_PMS_FLAG_BSR_EN 0x20000000
473 : : #define MSVPD_PMS_FLAG_XSCOMBASE_VALID 0x10000000
474 : : __be32 hwlocks_per_page;
475 : : __be64 hwlock_addr;
476 : : __be64 pmover_addr;
477 : : __be64 bsr_addr;
478 : : __be64 xscom_addr;
479 : : } __packed;
480 : :
481 : : /* Idata index 3: Memory Trace Array */
482 : : #define MSVPD_IDATA_TRACE_AREAS 3
483 : : struct msvpd_trace {
484 : : __be64 start, end;
485 : : char reserved[16];
486 : : };
487 : :
488 : : /* Idata index 4: UE Address Array */
489 : :
490 : : /* Idata index 5: Hostboot reserved memory address range */
491 : : #define MSVPD_IDATA_HB_RESERVED_MEM 5
492 : : #define HB_RESERVE_MEM_LABEL_SIZE 64
493 : : struct msvpd_hb_reserved_mem {
494 : : #define MSVPD_HBRMEM_RANGE_TYPE PPC_BITMASK32(0,7)
495 : : #define HBRMEM_CONTAINER_VERIFICATION_CODE 0x3
496 : : __be32 type_instance;
497 : : __be64 start_addr;
498 : : __be64 end_addr;
499 : : __be32 label_size;
500 : : uint8_t label[HB_RESERVE_MEM_LABEL_SIZE];
501 : : uint8_t rw_perms;
502 : : #define HB_RESERVE_READABLE 0x80
503 : : #define HB_RESERVE_WRITEABLE 0x40
504 : : uint8_t reserved[7];
505 : : } __packed;
506 : :
507 : : /* Child index 0: MS area child structure */
508 : : #define MSVPD_CHILD_MS_AREAS 0
509 : :
510 : : /*
511 : : * CEC I/O Hub FRU
512 : : *
513 : : * This is an array of CEC Hub FRU HDIF structures
514 : : *
515 : : * Each of these has some idata pointers to generic info about the
516 : : * hub and a possible child pointer for daughter card.
517 : : *
518 : : * Actual ports are in the SLCA and need to be cross referenced
519 : : *
520 : : * Note that slots meant for the addition of GX+ adapters that
521 : : * are currently unpopulated but support hotplug will have a
522 : : * minimum "placeholder" entry, which will be fully populated
523 : : * when the array is rebuild during concurrent maintenance.
524 : : * This "placeholder" is called a "reservation".
525 : : *
526 : : * WARNING: The array rebuild by concurrent maintenance is not
527 : : * guaranteed to be in the same order as the IPL array, not is
528 : : * the order stable between concurrent maintenance operations.
529 : : *
530 : : * There's also a child pointer to daughter card structures but
531 : : * we aren't going to handle that just yet.
532 : : */
533 : : #define CECHUB_FRU_HDIF_SIG "IO HUB"
534 : : #define IOKID_FRU_HDIF_SIG "IO KID"
535 : : #define IOSLOT_FRU_HDIF_SIG "IOSLOT"
536 : :
537 : : /* Idata index 0: FRU ID data
538 : : *
539 : : * This is a generic struct spira_fru_id defined above
540 : : */
541 : : #define CECHUB_FRU_ID_DATA 0
542 : :
543 : : /* Idata index 1: ASCII Keyword VPD */
544 : : #define CECHUB_ASCII_KEYWORD_VPD 1
545 : :
546 : : /* Idata index 2: Hub FRU ID data area */
547 : : #define CECHUB_FRU_ID_DATA_AREA 2
548 : :
549 : : struct cechub_hub_fru_id {
550 : : __be32 card_type;
551 : : #define CECHUB_FRU_TYPE_IOHUB_RSRV 0
552 : : #define CECHUB_FRU_TYPE_IOHUB_CARD 1
553 : : #define CECHUB_FRU_TYPE_CPU_CARD 2
554 : : #define CECHUB_FRU_TYPE_CEC_BKPLANE 3
555 : : #define CECHUB_FRU_TYPE_BKPLANE_EXT 4
556 : : __be32 unused;
557 : : __be16 total_chips;
558 : : uint8_t flags;
559 : : #define CECHUB_FRU_FLAG_HEADLESS 0x80 /* not connected to CPU */
560 : : #define CECHUB_FRU_FLAG_PASSTHROUGH 0x40 /* connected to passhtrough
561 : : port of another hub */
562 : : uint8_t reserved;
563 : : __be16 parent_hub_id; /* chip instance number of the
564 : : hub that contains the passthrough
565 : : port this one is connected to */
566 : : __be16 reserved2;
567 : : } __packed;
568 : :
569 : :
570 : : /* Idata index 3: IO HUB array */
571 : :
572 : : #define CECHUB_FRU_IO_HUBS 3
573 : :
574 : : /* This is an HDIF array of IO Hub structures */
575 : : struct cechub_io_hub {
576 : : __be64 fmtc_address;
577 : : __be32 fmtc_tce_size;
578 : : __be16 hub_num; /* unique hub number (I/O Hub ID) */
579 : : uint8_t flags;
580 : : #define CECHUB_HUB_FLAG_STATE_MASK 0xc0
581 : : #define CECHUB_HUB_FLAG_STATE_OK 0x00
582 : : #define CECHUB_HUB_FLAG_STATE_FAILURES 0x40
583 : : #define CECHUB_HUB_FLAG_STATE_NOT_INST 0x80
584 : : #define CECHUB_HUB_FLAG_STATE_UNUSABLE 0xc0
585 : : #define CECHUB_HUB_FLAG_MASTER_HUB 0x20 /* HDAT < v9.x only */
586 : : #define CECHUB_HUB_FLAG_GARD_MASK_VALID 0x08 /* HDAT < v9.x only */
587 : : #define CECHUB_HUB_FLAG_SWITCH_MASK_PDT 0x04 /* HDAT < v9.x only */
588 : : #define CECHUB_HUB_FLAG_FAB_BR0_PDT 0x02 /* HDAT < v9.x only */
589 : : #define CECHUB_HUB_FLAG_FAB_BR1_PDT 0x01 /* HDAT < v9.x only */
590 : : uint8_t nr_ports; /* HDAT < v9.x only */
591 : : uint8_t fab_br0_pdt; /* p5ioc2 PCI-X or P8 PHB3's */
592 : : #define CECHUB_HUB_FAB_BR0_PDT_PHB0 0x80
593 : : #define CECHUB_HUB_FAB_BR0_PDT_PHB1 0x40
594 : : #define CECHUB_HUB_FAB_BR0_PDT_PHB2 0x20
595 : : #define CECHUB_HUB_FAB_BR0_PDT_PHB3 0x10
596 : : #define CECHUB_HUB_FAB_BR0_PDT_PHB4 0x08
597 : : #define CECHUB_HUB_FAB_BR0_PDT_PHB5 0x04
598 : : uint8_t fab_br1_pdt; /* p5ioc2 & p7ioc PCI-E */
599 : : #define CECHUB_HUB_FAB_BR1_PDT_PHB0 0x80
600 : : #define CECHUB_HUB_FAB_BR1_PDT_PHB1 0x40
601 : : #define CECHUB_HUB_FAB_BR1_PDT_PHB2 0x20
602 : : #define CECHUB_HUB_FAB_BR1_PDT_PHB3 0x10
603 : : #define CECHUB_HUB_FAB_BR1_PDT_PHB4 0x08 /* p7ioc only */
604 : : #define CECHUB_HUB_FAB_BR1_PDT_PHB5 0x04 /* p7ioc only */
605 : : __be16 iohub_id; /* the type of hub */
606 : : #define CECHUB_HUB_MURANO 0x20ef /* Murano from spec */
607 : : #define CECHUB_HUB_MURANO_SEGU 0x0001 /* Murano+Seguso from spec */
608 : : #define CECHUB_HUB_VENICE_WYATT 0x0010 /* Venice+Wyatt from spec */
609 : : #define CECHUB_HUB_NIMBUS_SFORAZ 0x0020 /* Nimbus+sforaz from spec */
610 : : #define CECHUB_HUB_NIMBUS_MONZA 0x0021 /* Nimbus+monza from spec */
611 : : #define CECHUB_HUB_NIMBUS_LAGRANGE 0x0022 /* Nimbus+lagrange from spec */
612 : : #define CECHUB_HUB_CUMULUS_DUOMO 0x0030 /* cumulus+duomo from spec */
613 : : #define CECHUB_HUB_AXONE_HOPPER 0x0040 /* axone+hopper */
614 : : #define CECHUB_HUB_RAINIER 0x0050
615 : : #define CECHUB_HUB_DENALI 0x0051
616 : : #define CECHUB_HUB_EVEREST 0x0052
617 : : __be32 ec_level;
618 : : __be32 aff_dom2; /* HDAT < v9.x only */
619 : : __be32 aff_dom3; /* HDAT < v9.x only */
620 : : __be64 reserved;
621 : : __be32 proc_chip_id;
622 : :
623 : : union {
624 : : /* HDAT < v9.x */
625 : : struct {
626 : : __be32 gx_index; /* GX bus index on cpu */
627 : : __be32 buid_ext; /* BUID Extension */
628 : : __be32 xscom_chip_id; /* TORRENT ONLY */
629 : : };
630 : : /* HDAT >= v9.x */
631 : : struct {
632 : : __be32 reserved1;
633 : : __be32 reserved2;
634 : : __be16 reserved3;
635 : : __be16 hw_topology;
636 : : };
637 : : };
638 : : __be32 mrid;
639 : : __be32 mem_map_vers;
640 : : union {
641 : : /* HDAT < v9.x */
642 : : struct {
643 : : __be64 gx_ctrl_bar0;
644 : : __be64 gx_ctrl_bar1;
645 : : __be64 gx_ctrl_bar2;
646 : : __be64 gx_ctrl_bar3;
647 : : __be64 gx_ctrl_bar4;
648 : : __be32 sw_mask_pdt;
649 : : __be16 gard_mask;
650 : : __be16 gx_bus_speed; /* Version 0x58 */
651 : : };
652 : :
653 : : /* HDAT >= v9.x, HDIF version 0x6A adds phb_lane_eq with four
654 : : * words per PHB (4 PHBs).
655 : : *
656 : : * HDAT >= 10.x, HDIF version 0x7A adds space for another
657 : : * two PHBs (6 total) and the gen4 EQ values.
658 : : *
659 : : * HDAT >= 10.5x, HDIF version 0x8B adds space for the
660 : : * gen5 EQ values.
661 : : */
662 : : struct {
663 : : /* Gen 3 PHB eq values, 6 PHBs */
664 : : __be64 phb_lane_eq[6][4];
665 : :
666 : : /* Gen 4 PHB eq values */
667 : : __be64 phb4_lane_eq[6][4];
668 : :
669 : : /* Gen 5 PHB eq values */
670 : : __be64 phb5_lane_eq[6][4];
671 : : };
672 : : };
673 : : } __packed;
674 : :
675 : : /* We support structures as small as 0x68 bytes */
676 : : #define CECHUB_IOHUB_MIN_SIZE 0x68
677 : :
678 : : /* Child index 0: IO Daugther Card */
679 : : #define CECHUB_CHILD_IO_KIDS 0
680 : :
681 : : /* Child index 1: PCIe Slot Mapping Information */
682 : : #define CECHUB_CHILD_IOSLOTS 1
683 : :
684 : : #define IOSLOT_IDATA_SLOTMAP 0
685 : :
686 : : struct slot_map_entry {
687 : : __be16 entry_id;
688 : : __be16 parent_id;
689 : : uint8_t phb_index; /* only valid for ROOT and SWITCH_UP */
690 : :
691 : : uint8_t type;
692 : : #define SLOT_TYPE_ROOT_COMPLEX 0x0
693 : : #define SLOT_TYPE_SWITCH_UP 0x1
694 : : #define SLOT_TYPE_SWITCH_DOWN 0x2
695 : : #define SLOT_TYPE_BUILTIN 0x3
696 : :
697 : : uint8_t lane_swapped;
698 : : uint8_t reserved;
699 : : __be16 lane_mask;
700 : : __be16 lane_reverse;
701 : :
702 : : /* what can I do with this? reference something under/vpd/ ? */
703 : : __be16 slca_idx;
704 : :
705 : : __be16 mrw_slot_id;
706 : :
707 : : __be32 features;
708 : : #define SLOT_FEAT_SLOT 0x1
709 : :
710 : : uint8_t up_port;
711 : : uint8_t down_port; /* the switch port this device is attached to */
712 : :
713 : : __be32 vendor_id;
714 : : __be32 device_id;
715 : : __be32 sub_vendor_id;
716 : : __be32 sub_device_id;
717 : : char name[8];
718 : : } __packed;
719 : :
720 : : #define IOSLOT_IDATA_DETAILS 1
721 : :
722 : : struct slot_map_details {
723 : : __be16 entry;
724 : :
725 : : /* Phyp junk, ignore */
726 : : uint8_t mgc_load_source;
727 : : uint8_t hddw_order;
728 : : __be16 mmio_size_32; /* In MB */
729 : : __be16 mmio_size_64;
730 : : __be16 dma_size_32;
731 : : __be16 dma_size_64;
732 : :
733 : : uint8_t power_ctrl_type; /* slot power control source */
734 : : #define SLOT_PWR_NONE 0x0
735 : : #define SLOT_PWR_I2C 0x1
736 : :
737 : : uint8_t presence_det_type; /* slot presence detect source */
738 : : #define SLOT_PRESENCE_NONE 0x0
739 : : #define SLOT_PRESENCE_PCI 0x1
740 : : #define SLOT_PRESENCE_I2C 0x2
741 : :
742 : : uint8_t perst_ctl_type; /* slot PERST source */
743 : : #define SLOT_PERST_NONE 0x0
744 : : #define SLOT_PERST_PHB_OR_SW 0x1
745 : : #define SLOT_PERST_SW_GPIO 0x2
746 : : uint8_t perst_gpio;
747 : :
748 : : __be16 max_power; /* in W? */
749 : :
750 : : __be32 slot_caps;
751 : : #define SLOT_CAP_LSI 0x01 /* phyp junk? */
752 : : #define SLOT_CAP_CAPI 0x02
753 : : #define SLOT_CAP_CCARD 0x04
754 : : #define SLOT_CAP_HOTPLUG 0x08
755 : : #define SLOT_CAP_SRIOV 0x10 /* phyp junk */
756 : : #define SLOT_CAP_ELLOCO 0x20 /* why is this seperate from the nvlink cap? */
757 : : #define SLOT_CAP_NVLINK 0x30
758 : :
759 : : __be16 reserved1;
760 : :
761 : : /* I2C Link IDs */
762 : : __be32 i2c_power_ctl;
763 : : __be32 i2c_pgood;
764 : : __be32 i2c_cable_card; /* opencapi presence detect? */
765 : : __be32 i2c_mex_fpga;
766 : : };
767 : :
768 : : /*
769 : : * IO KID is a dauther card structure
770 : : */
771 : : #define IOKID_FRU_ID_DATA 0
772 : : #define IOKID_KW_VPD 1
773 : :
774 : : /*
775 : : * CPU Controls Legacy Structure
776 : : */
777 : : struct cpu_ctl_legacy {
778 : : __be64 addr;
779 : : __be64 size;
780 : : } __packed;
781 : :
782 : : /*
783 : : * CPU Control Legacy table
784 : : *
785 : : * Format of this table is defined in FIPS PHYP Attn spec.
786 : : */
787 : : struct cpu_ctl_legacy_table {
788 : : struct cpu_ctl_legacy spat;
789 : : struct cpu_ctl_legacy sp_attn_area1;
790 : : struct cpu_ctl_legacy sp_attn_area2;
791 : : struct cpu_ctl_legacy hsr_area;
792 : : struct cpu_ctl_legacy reserved[12];
793 : : } __packed;
794 : :
795 : : /*
796 : : * CPU Controls Header Structure
797 : : */
798 : : #define CPU_CTL_HDIF_SIG "CPUCTL"
799 : : struct cpu_ctl_init_data {
800 : : struct HDIF_common_hdr hdr;
801 : : struct HDIF_idata_ptr cpu_ctl;
802 : : uint8_t reserved[8];
803 : : struct cpu_ctl_legacy_table cpu_ctl_lt;
804 : : } __packed __align(0x10);
805 : :
806 : : /*
807 : : * Slot Location Code Array (aka SLCA)
808 : : *
809 : : * This is a pile of location codes referenced by various other
810 : : * structures such as the IO Hubs for things on the CEC. Not
811 : : * everything in there is a physical port. The SLCA is actually
812 : : * a tree which represent the topology of the system.
813 : : *
814 : : * The tree works as follow: A parent has a pointer to the first
815 : : * child. A child has a pointer to its parent. Siblings are
816 : : * consecutive entries.
817 : : *
818 : : * Note: If we ever support concurrent maintenance... this is
819 : : * completely rebuilt, invalidating all indices, though other
820 : : * structures that may reference SLCA by index will be rebuilt
821 : : * as well.
822 : : *
823 : : * Note that a lot of that stuff is based on VPD documentation
824 : : * such as the identification keywords. I will list the ones
825 : : * I manage to figure out without the doc separately.
826 : : */
827 : : #define SLCA_HDIF_SIG "SLCA "
828 : :
829 : : /* Idata index 0 : SLCA root pointer
830 : : *
831 : : * The SLCA array is an HDIF array of all the entries. The tree
832 : : * structure is based on indices inside the entries and order of
833 : : * the entries
834 : : */
835 : : #define SLCA_IDATA_ARRAY 0
836 : :
837 : : #define SLCA_ROOT_INDEX 0
838 : :
839 : : /* Note: An "index" (or idx) is always an index into the SLCA array
840 : : * and "id" is a reference to some other object.
841 : : */
842 : : struct slca_entry {
843 : : __be16 my_index; /* redundant, useful */
844 : : __be16 rsrc_id; /* formerly VPD port number */
845 : : uint8_t fru_id[2]; /* ASCII VPD ID */
846 : : #define SLCA_ROOT_VPD_ID VPD_ID('V','V')
847 : : #define SLCA_SYSTEM_VPD_ID VPD_ID('S','V')
848 : : #define SLCA_SAI_INDICATOR_ID VPD_ID('S','A')
849 : : __be16 parent_index; /* Parent entry index */
850 : : uint8_t flags;
851 : : #define SLCA_FLAG_NON_FUNCTIONAL 0x02 /* For redundant entries */
852 : : #define SLCA_FLAG_IMBEDDED 0x01 /* not set => pluggable */
853 : : uint8_t old_nr_child; /* Legacy: Nr of children */
854 : : __be16 child_index; /* First child index */
855 : : __be16 child_rsrc_id; /* Resource ID of first child */
856 : : uint8_t loc_code_allen; /* Alloc len of loc code */
857 : : uint8_t loc_code_len; /* Loc code len */
858 : : uint8_t loc_code[LOC_CODE_SIZE]; /* NULL terminated (thus max 79 chr) */
859 : : __be16 first_dup_idx; /* First redundant resource index */
860 : : uint8_t nr_dups; /* Number of redundant entries */
861 : : uint8_t reserved;
862 : : __be16 nr_child; /* New version */
863 : : uint8_t install_indic; /* Installed indicator */
864 : : #define SLCA_INSTALL_NO_HW_PDT 1 /* No HW presence detect */
865 : : #define SLCA_INSTALL_INSTALLED 2
866 : : #define SLCA_INSTALL_NOT_INSTALLED 3
867 : : uint8_t vpd_collected;
868 : : #define SLCA_VPD_COLLECTED 2
869 : : #define SLCA_VPD_NOT_COLLECTED 3
870 : : } __packed;
871 : :
872 : : /*
873 : : * System VPD
874 : : */
875 : : #define SYSVPD_HDIF_SIG "SYSVPD"
876 : :
877 : : /* Idata index 0 : FRU ID Data */
878 : : #define SYSVPD_IDATA_FRU_ID 0
879 : :
880 : : /* Idata index 1 : Keyword VPD */
881 : : #define SYSVPD_IDATA_KW_VPD 1
882 : :
883 : : /* Idata index 2 : Operational status */
884 : : #define SYSVPD_IDATA_OP_STATUS 2
885 : :
886 : : /*
887 : : * FRU keyword VPD structure
888 : : */
889 : : #define FRUVPD_HDIF_SIG "FRUVPD"
890 : :
891 : : /* Idata index 0 : FRU ID Data */
892 : : #define FRUVPD_IDATA_FRU_ID 0
893 : :
894 : : /* Idata index 1 : Keyword VPD */
895 : : #define FRUVPD_IDATA_KW_VPD 1
896 : :
897 : : /* Idata index 2 : Operational status */
898 : : #define FRUVPD_IDATA_OP_STATUS 2
899 : :
900 : :
901 : : /*
902 : : * SPPCIA structure. The SPIRA contain an array of these, one
903 : : * per processor core
904 : : */
905 : : #define SPPCIA_HDIF_SIG "SPPCIA"
906 : :
907 : : /* Idata index 0 : Core unique data */
908 : : #define SPPCIA_IDATA_CORE_UNIQUE 0
909 : :
910 : : struct sppcia_core_unique {
911 : : __be32 reserved;
912 : : __be32 proc_fru_id;
913 : : __be32 hw_proc_id;
914 : : #define CPU_ID_VERIFY_MASK 0xC0000000
915 : : #define CPU_ID_VERIFY_SHIFT 30
916 : : #define CPU_ID_VERIFY_USABLE_NO_FAILURES 0
917 : : #define CPU_ID_VERIFY_USABLE_FAILURES 1
918 : : #define CPU_ID_VERIFY_NOT_INSTALLED 2
919 : : #define CPU_ID_VERIFY_UNUSABLE 3
920 : : #define CPU_ID_SECONDARY_THREAD 0x20000000
921 : : #define CPU_ID_PCIA_RESERVED 0x10000000
922 : : #define CPU_ID_NUM_SECONDARY_THREAD_MASK 0x00FF0000
923 : : #define CPU_ID_NUM_SECONDARY_THREAD_SHIFT 16
924 : : __be32 verif_exist_flags;
925 : : __be32 chip_ec_level;
926 : : __be32 proc_chip_id;
927 : : __be32 reserved2;
928 : : __be32 reserved3;
929 : : __be32 reserved4;
930 : : __be32 hw_module_id;
931 : : __be64 reserved5;
932 : : __be32 reserved6;
933 : : __be32 reserved7;
934 : : __be32 reserved8;
935 : : __be32 ccm_node_id;
936 : : __be32 hw_card_id;
937 : : __be32 internal_drawer_node_id;
938 : : __be32 drawer_book_octant_blade_id;
939 : : __be32 memory_interleaving_scope;
940 : : __be32 lco_target;
941 : : __be32 reserved9;
942 : : } __packed;
943 : :
944 : : /* Idata index 1 : CPU Time base structure */
945 : : #define SPPCIA_IDATA_TIMEBASE 1
946 : :
947 : : struct sppcia_cpu_timebase {
948 : : __be32 cycle_time;
949 : : __be32 time_base;
950 : : __be32 actual_clock_speed;
951 : : __be32 memory_bus_frequency;
952 : : } __packed;
953 : :
954 : : /* Idata index 2 : CPU Cache Size Structure */
955 : : #define SPPCIA_IDATA_CPU_CACHE 2
956 : :
957 : : struct sppcia_cpu_cache {
958 : : __be32 icache_size_kb;
959 : : __be32 icache_line_size;
960 : : __be32 l1_dcache_size_kb;
961 : : __be32 l1_dcache_line_size;
962 : : __be32 l2_dcache_size_kb;
963 : : __be32 l2_line_size;
964 : : __be32 l3_dcache_size_kb;
965 : : __be32 l3_line_size;
966 : : __be32 dcache_block_size;
967 : : __be32 icache_block_size;
968 : : __be32 dcache_assoc_sets;
969 : : __be32 icache_assoc_sets;
970 : : __be32 dtlb_entries;
971 : : __be32 dtlb_assoc_sets;
972 : : __be32 itlb_entries;
973 : : __be32 itlb_assoc_sets;
974 : : __be32 reservation_size;
975 : : __be32 l2_cache_assoc_sets;
976 : : __be32 l35_dcache_size_kb;
977 : : __be32 l35_cache_line_size;
978 : : } __packed;
979 : :
980 : :
981 : : /* Idata index 3 : Thread Array Data
982 : : *
983 : : * HDIF array of
984 : : */
985 : : #define SPPCIA_IDATA_THREAD_ARRAY 3
986 : :
987 : : struct sppcia_cpu_thread {
988 : : __be32 proc_int_line;
989 : : __be32 phys_thread_id;
990 : : __be64 ibase;
991 : : __be32 pir;
992 : : } __packed;
993 : :
994 : : /* Idata index 4 : CPU Attributes */
995 : : #define SPPCIA_IDATA_CPU_ATTR 4
996 : :
997 : : struct sppcia_cpu_attr {
998 : : #define CPU_ATTR_UNIFIED_PL1 0x80
999 : : #define CPU_ATTR_SPLIT_TLB 0x40
1000 : : #define CPU_ATTR_TLBIA 0x20
1001 : : #define CPU_ATTR_PERF_MONITOR 0x10
1002 : : #define CPU_ATTR_EXTERN_CONT 0x02
1003 : : __be32 attr;
1004 : : } __packed;
1005 : :
1006 : : /*
1007 : : * Processor Chip Related Data. The SPIRA contain an array of these, one
1008 : : * per chip
1009 : : */
1010 : : #define SPPCRD_HDIF_SIG "SPPCRD"
1011 : :
1012 : : /* Idata index 0 : Chip info */
1013 : : #define SPPCRD_IDATA_CHIP_INFO 0
1014 : :
1015 : : struct sppcrd_chip_info {
1016 : : __be32 proc_chip_id;
1017 : : __be32 verif_exist_flags;
1018 : : #define CHIP_VERIFY_MASK 0xC0000000
1019 : : #define CHIP_VERIFY_SHIFT 30
1020 : : #define CHIP_VERIFY_USABLE_NO_FAILURES 0
1021 : : #define CHIP_VERIFY_USABLE_FAILURES 1
1022 : : #define CHIP_VERIFY_NOT_INSTALLED 2
1023 : : #define CHIP_VERIFY_UNUSABLE 3
1024 : : #define CHIP_VERIFY_MASTER_PROC PPC_BIT32(4)
1025 : : __be32 nx_state;
1026 : : __be32 pore_state;
1027 : : __be32 xscom_id;
1028 : : /* Version 0xA */
1029 : : __be32 reserved;
1030 : : __be32 dbob_id;
1031 : : __be32 occ_state;
1032 : : /* Version 0xC - none of these are used */
1033 : : __be32 processor_fru_id;
1034 : : __be32 chip_ec_level;
1035 : : __be32 hw_module_id;
1036 : : __be32 hw_card_id;
1037 : : __be32 internal_drawer_nid;
1038 : : __be32 ccm_nid;
1039 : : /* Version 0xD */
1040 : : __be32 capp0_func_state;
1041 : : /* Version 0xE */
1042 : : __be32 capp1_func_state;
1043 : : /* *possibly* from Version 0x20 - check spec */
1044 : : __be32 stop_levels;
1045 : : /* From latest version (possibly 0x21 and later) */
1046 : : __be32 sw_xstop_fir_scom;
1047 : : uint8_t sw_xstop_fir_bitpos;
1048 : : /* Latest version for P10 */
1049 : : #define CHIP_MAX_TOPOLOGY_ENTRIES 32
1050 : : uint8_t topology_id_table[CHIP_MAX_TOPOLOGY_ENTRIES];
1051 : : uint8_t primary_topology_loc; /* Index in topology_id_table */
1052 : : __be32 abc_bus_speed; /* SMP A */
1053 : : __be32 wxyz_bus_speed; /* SMP X */
1054 : : uint8_t fab_topology_id;/* topology id associated with the chip. */
1055 : : } __packed;
1056 : :
1057 : : /* Idata index 1 : Chip TOD */
1058 : : #define SPPCRD_IDATA_CHIP_TOD 1
1059 : :
1060 : : struct sppcrd_chip_tod {
1061 : : __be32 flags;
1062 : : /* CHIPTOD_ID_... values */
1063 : : __be32 ctrl_reg_internal;
1064 : : __be32 tod_ctrl_reg;
1065 : : } __packed;
1066 : :
1067 : : /* Idata index 2 : FRU ID */
1068 : : #define SPPCRD_IDATA_FRU_ID 2
1069 : :
1070 : : /* Idata index 3 : ASCII Keyword data */
1071 : : #define SPPCRD_IDATA_KW_VPD 3
1072 : :
1073 : : /* Idata index 4 : Module VPD */
1074 : : #define SPPCRD_IDATA_MODULE_VPD 4
1075 : :
1076 : : /* Idata index 5 : Chip attached I2C devices */
1077 : : #define SPPCRD_IDATA_HOST_I2C 5
1078 : :
1079 : : /* Idata index 5 : Chip attached I2C devices */
1080 : : #define SPPCRD_IDATA_PNOR 6
1081 : :
1082 : : /* Idata index 6 : OpenCAPI/NVlink info */
1083 : : #define SPPCRD_IDATA_SMP_LINK 7
1084 : : struct sppcrd_smp_link {
1085 : : __be32 link_id;
1086 : : __be32 usage;
1087 : : #define SMP_LINK_USE_NONE 0
1088 : : #define SMP_LINK_USE_GPU 1
1089 : : #define SMP_LINK_USE_OPENCAPI 2
1090 : : #define SMP_LINK_USE_INTERPOSER 3
1091 : : #define SMP_LINK_USE_DRAWER 4
1092 : : #define SMP_LINK_USE_D2D 5 /* GPU to GPU */
1093 : : __be32 brick_id;
1094 : : __be32 lane_mask;
1095 : :
1096 : : /* bonded pci slots (mostly a NVLink thing) */
1097 : : __be16 pci_slot_idx;
1098 : : __be16 pci_sideband_slot_idx;
1099 : :
1100 : : __be16 slca_idx; /* SLCA index of the *external* port */
1101 : : __be16 opt_id;
1102 : :
1103 : : /* nvlink/ocapi detection devices */
1104 : : __be32 i2c_link_cable;
1105 : : __be32 i2c_presence;
1106 : : __be32 i2c_micro;
1107 : : uint8_t link_speed;
1108 : : uint8_t occ_flag_bit;
1109 : : __be16 gpu_slca;
1110 : : } __packed;
1111 : :
1112 : : /* Idata index 8 : chip EC Level array */
1113 : : #define SPPCRD_IDATA_EC_LEVEL 8
1114 : :
1115 : : struct sppcrd_ecid {
1116 : : __be32 chip_id;
1117 : : __be32 ec_level;
1118 : : __be64 low; /* Processor ECID bit 0-63 */
1119 : : __be64 high; /* Processor ECID bit 64-127 */
1120 : : } __packed;
1121 : :
1122 : : /*
1123 : : * Host Services Data.
1124 : : */
1125 : : #define HSERV_HDIF_SIG "HOSTSR"
1126 : :
1127 : : /* Idata index 0 : System attribute data */
1128 : : #define HSERV_IDATA_SYS_ATTR 0
1129 : :
1130 : : /* IPMI sensors mapping data */
1131 : : #define IPMI_SENSORS_HDIF_SIG "FRUSE "
1132 : :
1133 : : /* Idata index 0 : Sensor mapping data */
1134 : : #define IPMI_SENSORS_IDATA_SENSORS 0
1135 : :
1136 : : struct ipmi_sensors_data {
1137 : : __be32 slca_index;
1138 : : uint8_t type;
1139 : : uint8_t id;
1140 : : uint8_t entity_id;
1141 : : uint8_t reserved;
1142 : : } __packed;
1143 : :
1144 : : struct ipmi_sensors {
1145 : : __be32 count;
1146 : : struct ipmi_sensors_data data[];
1147 : : } __packed;
1148 : :
1149 : : /* Idata index 1 : LED - sensors ID mapping data */
1150 : : #define IPMI_SENSORS_IDATA_LED 1
1151 : :
1152 : : /*
1153 : : * Node Secure and Trusted Boot Related Data
1154 : : */
1155 : : #define STB_HDIF_SIG "TPMREL"
1156 : :
1157 : : /*
1158 : : * Idata index 0 : Secure Boot and TPM Instance Info
1159 : : *
1160 : : * There can be multiple entries with each entry corresponding to
1161 : : * a master processor that has a TPM device
1162 : : */
1163 : : #define TPMREL_IDATA_SECUREBOOT_TPM_INFO 0
1164 : :
1165 : : struct secureboot_tpm_info {
1166 : : __be32 chip_id;
1167 : : __be32 dbob_id;
1168 : : uint8_t locality1;
1169 : : uint8_t locality2;
1170 : : uint8_t locality3;
1171 : : uint8_t locality4;
1172 : : #define TPM_PRESENT_AND_FUNCTIONAL 0x01
1173 : : #define TPM_PRESENT_AND_NOT_FUNCTIONAL 0x02
1174 : : #define TPM_NOT_PRESENT 0x03
1175 : : uint8_t tpm_status;
1176 : : uint8_t reserved[3];
1177 : : /* zero indicates no tpm log data */
1178 : : __be32 srtm_log_offset;
1179 : : __be32 srtm_log_size;
1180 : : /* zero indicates no tpm log data */
1181 : : __be32 drtm_log_offset;
1182 : : __be32 drtm_log_size;
1183 : : } __packed;
1184 : :
1185 : : /* Idata index 2: Hash and Verification Function Offsets Array */
1186 : : #define TPMREL_IDATA_HASH_VERIF_OFFSETS 2
1187 : :
1188 : : struct hash_and_verification {
1189 : : #define TPMREL_HV_SHA512 0x00
1190 : : #define TPMREL_HV_VERIFY 0x01
1191 : : __be32 type;
1192 : : __be32 version;
1193 : : __be32 dbob_id;
1194 : : __be32 offset;
1195 : : } __packed;
1196 : :
1197 : 6 : static inline const char *cpu_state(u32 flags)
1198 : : {
1199 : 6 : switch ((flags & CPU_ID_VERIFY_MASK) >> CPU_ID_VERIFY_SHIFT) {
1200 : 6 : case CPU_ID_VERIFY_USABLE_NO_FAILURES:
1201 : 6 : return "OK";
1202 : 0 : case CPU_ID_VERIFY_USABLE_FAILURES:
1203 : 0 : return "FAILURES";
1204 : 0 : case CPU_ID_VERIFY_NOT_INSTALLED:
1205 : 0 : return "NOT-INSTALLED";
1206 : 0 : case CPU_ID_VERIFY_UNUSABLE:
1207 : 0 : return "UNUSABLE";
1208 : : }
1209 : 0 : return "**UNKNOWN**";
1210 : : }
1211 : : #endif /* __SPIRA_H */
|