1
2
3
4
5
6
7
8#ifndef HL_BOOT_IF_H
9#define HL_BOOT_IF_H
10
11#define LKD_HARD_RESET_MAGIC 0xED7BD694
12#define HL_POWER9_HOST_MAGIC 0x1DA30009
13
14#define BOOT_FIT_SRAM_OFFSET 0x200000
15
16#define VERSION_MAX_LEN 128
17
18enum cpu_boot_err {
19 CPU_BOOT_ERR_DRAM_INIT_FAIL = 0,
20 CPU_BOOT_ERR_FIT_CORRUPTED = 1,
21 CPU_BOOT_ERR_TS_INIT_FAIL = 2,
22 CPU_BOOT_ERR_DRAM_SKIPPED = 3,
23 CPU_BOOT_ERR_BMC_WAIT_SKIPPED = 4,
24 CPU_BOOT_ERR_NIC_DATA_NOT_RDY = 5,
25 CPU_BOOT_ERR_NIC_FW_FAIL = 6,
26 CPU_BOOT_ERR_SECURITY_NOT_RDY = 7,
27 CPU_BOOT_ERR_SECURITY_FAIL = 8,
28 CPU_BOOT_ERR_EFUSE_FAIL = 9,
29 CPU_BOOT_ERR_PRI_IMG_VER_FAIL = 10,
30 CPU_BOOT_ERR_SEC_IMG_VER_FAIL = 11,
31 CPU_BOOT_ERR_PLL_FAIL = 12,
32 CPU_BOOT_ERR_DEVICE_UNUSABLE_FAIL = 13,
33 CPU_BOOT_ERR_BOOT_FW_CRIT_ERR = 18,
34 CPU_BOOT_ERR_BINNING_FAIL = 19,
35 CPU_BOOT_ERR_TPM_FAIL = 20,
36 CPU_BOOT_ERR_TMP_THRESH_INIT_FAIL = 21,
37 CPU_BOOT_ERR_ENABLED = 31,
38 CPU_BOOT_ERR_SCND_EN = 63,
39 CPU_BOOT_ERR_LAST = 64
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#define CPU_BOOT_ERR0_DRAM_INIT_FAIL (1 << CPU_BOOT_ERR_DRAM_INIT_FAIL)
125#define CPU_BOOT_ERR0_FIT_CORRUPTED (1 << CPU_BOOT_ERR_FIT_CORRUPTED)
126#define CPU_BOOT_ERR0_TS_INIT_FAIL (1 << CPU_BOOT_ERR_TS_INIT_FAIL)
127#define CPU_BOOT_ERR0_DRAM_SKIPPED (1 << CPU_BOOT_ERR_DRAM_SKIPPED)
128#define CPU_BOOT_ERR0_BMC_WAIT_SKIPPED (1 << CPU_BOOT_ERR_BMC_WAIT_SKIPPED)
129#define CPU_BOOT_ERR0_NIC_DATA_NOT_RDY (1 << CPU_BOOT_ERR_NIC_DATA_NOT_RDY)
130#define CPU_BOOT_ERR0_NIC_FW_FAIL (1 << CPU_BOOT_ERR_NIC_FW_FAIL)
131#define CPU_BOOT_ERR0_SECURITY_NOT_RDY (1 << CPU_BOOT_ERR_SECURITY_NOT_RDY)
132#define CPU_BOOT_ERR0_SECURITY_FAIL (1 << CPU_BOOT_ERR_SECURITY_FAIL)
133#define CPU_BOOT_ERR0_EFUSE_FAIL (1 << CPU_BOOT_ERR_EFUSE_FAIL)
134#define CPU_BOOT_ERR0_PRI_IMG_VER_FAIL (1 << CPU_BOOT_ERR_PRI_IMG_VER_FAIL)
135#define CPU_BOOT_ERR0_SEC_IMG_VER_FAIL (1 << CPU_BOOT_ERR_SEC_IMG_VER_FAIL)
136#define CPU_BOOT_ERR0_PLL_FAIL (1 << CPU_BOOT_ERR_PLL_FAIL)
137#define CPU_BOOT_ERR0_DEVICE_UNUSABLE_FAIL (1 << CPU_BOOT_ERR_DEVICE_UNUSABLE_FAIL)
138#define CPU_BOOT_ERR0_BOOT_FW_CRIT_ERR (1 << CPU_BOOT_ERR_BOOT_FW_CRIT_ERR)
139#define CPU_BOOT_ERR0_BINNING_FAIL (1 << CPU_BOOT_ERR_BINNING_FAIL)
140#define CPU_BOOT_ERR0_TPM_FAIL (1 << CPU_BOOT_ERR_TPM_FAIL)
141#define CPU_BOOT_ERR0_TMP_THRESH_INIT_FAIL (1 << CPU_BOOT_ERR_TMP_THRESH_INIT_FAIL)
142#define CPU_BOOT_ERR0_ENABLED (1 << CPU_BOOT_ERR_ENABLED)
143#define CPU_BOOT_ERR1_ENABLED (1 << CPU_BOOT_ERR_ENABLED)
144
145enum cpu_boot_dev_sts {
146 CPU_BOOT_DEV_STS_SECURITY_EN = 0,
147 CPU_BOOT_DEV_STS_DEBUG_EN = 1,
148 CPU_BOOT_DEV_STS_WATCHDOG_EN = 2,
149 CPU_BOOT_DEV_STS_DRAM_INIT_EN = 3,
150 CPU_BOOT_DEV_STS_BMC_WAIT_EN = 4,
151 CPU_BOOT_DEV_STS_E2E_CRED_EN = 5,
152 CPU_BOOT_DEV_STS_HBM_CRED_EN = 6,
153 CPU_BOOT_DEV_STS_RL_EN = 7,
154 CPU_BOOT_DEV_STS_SRAM_SCR_EN = 8,
155 CPU_BOOT_DEV_STS_DRAM_SCR_EN = 9,
156 CPU_BOOT_DEV_STS_FW_HARD_RST_EN = 10,
157 CPU_BOOT_DEV_STS_PLL_INFO_EN = 11,
158 CPU_BOOT_DEV_STS_SP_SRAM_EN = 12,
159 CPU_BOOT_DEV_STS_CLK_GATE_EN = 13,
160 CPU_BOOT_DEV_STS_HBM_ECC_EN = 14,
161 CPU_BOOT_DEV_STS_PKT_PI_ACK_EN = 15,
162 CPU_BOOT_DEV_STS_FW_LD_COM_EN = 16,
163 CPU_BOOT_DEV_STS_FW_IATU_CONF_EN = 17,
164 CPU_BOOT_DEV_STS_FW_NIC_MAC_EN = 18,
165 CPU_BOOT_DEV_STS_DYN_PLL_EN = 19,
166 CPU_BOOT_DEV_STS_GIC_PRIVILEGED_EN = 20,
167 CPU_BOOT_DEV_STS_EQ_INDEX_EN = 21,
168 CPU_BOOT_DEV_STS_MULTI_IRQ_POLL_EN = 22,
169 CPU_BOOT_DEV_STS_FW_NIC_STAT_XPCS91_EN = 23,
170 CPU_BOOT_DEV_STS_FW_NIC_STAT_EXT_EN = 24,
171 CPU_BOOT_DEV_STS_IS_IDLE_CHECK_EN = 25,
172 CPU_BOOT_DEV_STS_MAP_HWMON_EN = 26,
173 CPU_BOOT_DEV_STS_ENABLED = 31,
174 CPU_BOOT_DEV_STS_SCND_EN = 63,
175 CPU_BOOT_DEV_STS_LAST = 64
176};
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319#define CPU_BOOT_DEV_STS0_SECURITY_EN (1 << CPU_BOOT_DEV_STS_SECURITY_EN)
320#define CPU_BOOT_DEV_STS0_DEBUG_EN (1 << CPU_BOOT_DEV_STS_DEBUG_EN)
321#define CPU_BOOT_DEV_STS0_WATCHDOG_EN (1 << CPU_BOOT_DEV_STS_WATCHDOG_EN)
322#define CPU_BOOT_DEV_STS0_DRAM_INIT_EN (1 << CPU_BOOT_DEV_STS_DRAM_INIT_EN)
323#define CPU_BOOT_DEV_STS0_BMC_WAIT_EN (1 << CPU_BOOT_DEV_STS_BMC_WAIT_EN)
324#define CPU_BOOT_DEV_STS0_E2E_CRED_EN (1 << CPU_BOOT_DEV_STS_E2E_CRED_EN)
325#define CPU_BOOT_DEV_STS0_HBM_CRED_EN (1 << CPU_BOOT_DEV_STS_HBM_CRED_EN)
326#define CPU_BOOT_DEV_STS0_RL_EN (1 << CPU_BOOT_DEV_STS_RL_EN)
327#define CPU_BOOT_DEV_STS0_SRAM_SCR_EN (1 << CPU_BOOT_DEV_STS_SRAM_SCR_EN)
328#define CPU_BOOT_DEV_STS0_DRAM_SCR_EN (1 << CPU_BOOT_DEV_STS_DRAM_SCR_EN)
329#define CPU_BOOT_DEV_STS0_FW_HARD_RST_EN (1 << CPU_BOOT_DEV_STS_FW_HARD_RST_EN)
330#define CPU_BOOT_DEV_STS0_PLL_INFO_EN (1 << CPU_BOOT_DEV_STS_PLL_INFO_EN)
331#define CPU_BOOT_DEV_STS0_SP_SRAM_EN (1 << CPU_BOOT_DEV_STS_SP_SRAM_EN)
332#define CPU_BOOT_DEV_STS0_CLK_GATE_EN (1 << CPU_BOOT_DEV_STS_CLK_GATE_EN)
333#define CPU_BOOT_DEV_STS0_HBM_ECC_EN (1 << CPU_BOOT_DEV_STS_HBM_ECC_EN)
334#define CPU_BOOT_DEV_STS0_PKT_PI_ACK_EN (1 << CPU_BOOT_DEV_STS_PKT_PI_ACK_EN)
335#define CPU_BOOT_DEV_STS0_FW_LD_COM_EN (1 << CPU_BOOT_DEV_STS_FW_LD_COM_EN)
336#define CPU_BOOT_DEV_STS0_FW_IATU_CONF_EN (1 << CPU_BOOT_DEV_STS_FW_IATU_CONF_EN)
337#define CPU_BOOT_DEV_STS0_FW_NIC_MAC_EN (1 << CPU_BOOT_DEV_STS_FW_NIC_MAC_EN)
338#define CPU_BOOT_DEV_STS0_DYN_PLL_EN (1 << CPU_BOOT_DEV_STS_DYN_PLL_EN)
339#define CPU_BOOT_DEV_STS0_GIC_PRIVILEGED_EN (1 << CPU_BOOT_DEV_STS_GIC_PRIVILEGED_EN)
340#define CPU_BOOT_DEV_STS0_EQ_INDEX_EN (1 << CPU_BOOT_DEV_STS_EQ_INDEX_EN)
341#define CPU_BOOT_DEV_STS0_MULTI_IRQ_POLL_EN (1 << CPU_BOOT_DEV_STS_MULTI_IRQ_POLL_EN)
342#define CPU_BOOT_DEV_STS0_FW_NIC_STAT_XPCS91_EN (1 << CPU_BOOT_DEV_STS_FW_NIC_STAT_XPCS91_EN)
343#define CPU_BOOT_DEV_STS0_FW_NIC_STAT_EXT_EN (1 << CPU_BOOT_DEV_STS_FW_NIC_STAT_EXT_EN)
344#define CPU_BOOT_DEV_STS0_IS_IDLE_CHECK_EN (1 << CPU_BOOT_DEV_STS_IS_IDLE_CHECK_EN)
345#define CPU_BOOT_DEV_STS0_MAP_HWMON_EN (1 << CPU_BOOT_DEV_STS_MAP_HWMON_EN)
346#define CPU_BOOT_DEV_STS0_ENABLED (1 << CPU_BOOT_DEV_STS_ENABLED)
347#define CPU_BOOT_DEV_STS1_ENABLED (1 << CPU_BOOT_DEV_STS_ENABLED)
348
349enum cpu_boot_status {
350 CPU_BOOT_STATUS_NA = 0,
351 CPU_BOOT_STATUS_IN_WFE = 1,
352 CPU_BOOT_STATUS_DRAM_RDY = 2,
353 CPU_BOOT_STATUS_SRAM_AVAIL = 3,
354 CPU_BOOT_STATUS_IN_BTL = 4,
355 CPU_BOOT_STATUS_IN_PREBOOT = 5,
356 CPU_BOOT_STATUS_IN_SPL,
357 CPU_BOOT_STATUS_IN_UBOOT = 7,
358 CPU_BOOT_STATUS_DRAM_INIT_FAIL,
359 CPU_BOOT_STATUS_FIT_CORRUPTED,
360
361 CPU_BOOT_STATUS_UBOOT_NOT_READY = 10,
362
363 CPU_BOOT_STATUS_NIC_FW_RDY = 11,
364 CPU_BOOT_STATUS_TS_INIT_FAIL,
365 CPU_BOOT_STATUS_DRAM_SKIPPED,
366 CPU_BOOT_STATUS_BMC_WAITING_SKIPPED,
367
368 CPU_BOOT_STATUS_READY_TO_BOOT = 15,
369
370 CPU_BOOT_STATUS_WAITING_FOR_BOOT_FIT = 16,
371
372 CPU_BOOT_STATUS_SECURITY_READY = 17,
373};
374
375enum kmd_msg {
376 KMD_MSG_NA = 0,
377 KMD_MSG_GOTO_WFE,
378 KMD_MSG_FIT_RDY,
379 KMD_MSG_SKIP_BMC,
380 RESERVED,
381 KMD_MSG_RST_DEV,
382 KMD_MSG_LAST
383};
384
385enum cpu_msg_status {
386 CPU_MSG_CLR = 0,
387 CPU_MSG_OK,
388 CPU_MSG_ERR,
389};
390
391
392struct cpu_dyn_regs {
393 __le32 cpu_pq_base_addr_low;
394 __le32 cpu_pq_base_addr_high;
395 __le32 cpu_pq_length;
396 __le32 cpu_pq_init_status;
397 __le32 cpu_eq_base_addr_low;
398 __le32 cpu_eq_base_addr_high;
399 __le32 cpu_eq_length;
400 __le32 cpu_eq_ci;
401 __le32 cpu_cq_base_addr_low;
402 __le32 cpu_cq_base_addr_high;
403 __le32 cpu_cq_length;
404 __le32 cpu_pf_pq_pi;
405 __le32 cpu_boot_dev_sts0;
406 __le32 cpu_boot_dev_sts1;
407 __le32 cpu_boot_err0;
408 __le32 cpu_boot_err1;
409 __le32 cpu_boot_status;
410 __le32 fw_upd_sts;
411 __le32 fw_upd_cmd;
412 __le32 fw_upd_pending_sts;
413 __le32 fuse_ver_offset;
414 __le32 preboot_ver_offset;
415 __le32 uboot_ver_offset;
416 __le32 hw_state;
417 __le32 kmd_msg_to_cpu;
418 __le32 cpu_cmd_status_to_host;
419 __le32 gic_host_pi_upd_irq;
420 __le32 gic_tpc_qm_irq_ctrl;
421 __le32 gic_mme_qm_irq_ctrl;
422 __le32 gic_dma_qm_irq_ctrl;
423 __le32 gic_nic_qm_irq_ctrl;
424 __le32 gic_dma_core_irq_ctrl;
425 __le32 gic_host_halt_irq;
426 __le32 gic_host_ints_irq;
427 __le32 gic_host_soft_rst_irq;
428 __le32 gic_rot_qm_irq_ctrl;
429 __le32 reserved1[22];
430};
431
432
433
434#define HL_COMMS_DESC_MAGIC 0x4843444D
435#define HL_COMMS_DESC_VER 1
436
437
438#define HL_COMMS_MSG_MAGIC_VALUE 0x48434D00
439#define HL_COMMS_MSG_MAGIC_MASK 0xFFFFFF00
440#define HL_COMMS_MSG_MAGIC_VER_MASK 0xFF
441
442#define HL_COMMS_MSG_MAGIC_VER(ver) (HL_COMMS_MSG_MAGIC_VALUE | \
443 ((ver) & HL_COMMS_MSG_MAGIC_VER_MASK))
444#define HL_COMMS_MSG_MAGIC_V0 HL_COMMS_DESC_MAGIC
445#define HL_COMMS_MSG_MAGIC_V1 HL_COMMS_MSG_MAGIC_VER(1)
446
447#define HL_COMMS_MSG_MAGIC HL_COMMS_MSG_MAGIC_V1
448
449#define HL_COMMS_MSG_MAGIC_VALIDATE_MAGIC(magic) \
450 (((magic) & HL_COMMS_MSG_MAGIC_MASK) == \
451 HL_COMMS_MSG_MAGIC_VALUE)
452
453#define HL_COMMS_MSG_MAGIC_VALIDATE_VERSION(magic, ver) \
454 (((magic) & HL_COMMS_MSG_MAGIC_VER_MASK) >= \
455 ((ver) & HL_COMMS_MSG_MAGIC_VER_MASK))
456
457#define HL_COMMS_MSG_MAGIC_VALIDATE(magic, ver) \
458 (HL_COMMS_MSG_MAGIC_VALIDATE_MAGIC((magic)) && \
459 HL_COMMS_MSG_MAGIC_VALIDATE_VERSION((magic), (ver)))
460
461enum comms_msg_type {
462 HL_COMMS_DESC_TYPE = 0,
463 HL_COMMS_RESET_CAUSE_TYPE = 1,
464 HL_COMMS_FW_CFG_SKIP_TYPE = 2,
465 HL_COMMS_BINNING_CONF_TYPE = 3,
466};
467
468
469
470struct comms_desc_header {
471 __le32 magic;
472 __le32 crc32;
473 __le16 size;
474 __u8 version;
475 __u8 reserved[5];
476};
477
478
479struct comms_msg_header {
480 __le32 magic;
481 __le32 crc32;
482 __le16 size;
483 __u8 version;
484 __u8 type;
485 __u8 reserved[4];
486};
487
488
489struct lkd_fw_comms_desc {
490 struct comms_desc_header header;
491 struct cpu_dyn_regs cpu_dyn_regs;
492 char fuse_ver[VERSION_MAX_LEN];
493 char cur_fw_ver[VERSION_MAX_LEN];
494
495 char reserved0[VERSION_MAX_LEN];
496 __le64 img_addr;
497};
498
499enum comms_reset_cause {
500 HL_RESET_CAUSE_UNKNOWN = 0,
501 HL_RESET_CAUSE_HEARTBEAT = 1,
502 HL_RESET_CAUSE_TDR = 2,
503};
504
505
506#define lkd_msg_comms lkd_fw_comms_msg
507
508
509struct lkd_fw_comms_msg {
510 struct comms_msg_header header;
511
512 union {
513 struct {
514 struct cpu_dyn_regs cpu_dyn_regs;
515 char fuse_ver[VERSION_MAX_LEN];
516 char cur_fw_ver[VERSION_MAX_LEN];
517
518 char reserved0[VERSION_MAX_LEN];
519
520 __le64 img_addr;
521 };
522 struct {
523 __u8 reset_cause;
524 };
525 struct {
526 __u8 fw_cfg_skip;
527 };
528 };
529};
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576enum comms_cmd {
577 COMMS_NOOP = 0,
578 COMMS_CLR_STS = 1,
579 COMMS_RST_STATE = 2,
580 COMMS_PREP_DESC = 3,
581 COMMS_DATA_RDY = 4,
582 COMMS_EXEC = 5,
583 COMMS_RST_DEV = 6,
584 COMMS_GOTO_WFE = 7,
585 COMMS_SKIP_BMC = 8,
586 COMMS_PREP_DESC_ELBI = 10,
587 COMMS_INVLD_LAST
588};
589
590#define COMMS_COMMAND_SIZE_SHIFT 0
591#define COMMS_COMMAND_SIZE_MASK 0x1FFFFFF
592#define COMMS_COMMAND_CMD_SHIFT 27
593#define COMMS_COMMAND_CMD_MASK 0xF8000000
594
595
596
597
598
599
600struct comms_command {
601 union {
602 struct {
603 u32 size :25;
604 u32 reserved :2;
605 enum comms_cmd cmd :5;
606 };
607 __le32 val;
608 };
609};
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628enum comms_sts {
629 COMMS_STS_NOOP = 0,
630 COMMS_STS_ACK = 1,
631 COMMS_STS_OK = 2,
632 COMMS_STS_ERR = 3,
633 COMMS_STS_VALID_ERR = 4,
634 COMMS_STS_TIMEOUT_ERR = 5,
635 COMMS_STS_INVLD_LAST
636};
637
638
639enum comms_ram_types {
640 COMMS_SRAM = 0,
641 COMMS_DRAM = 1,
642};
643
644#define COMMS_STATUS_OFFSET_SHIFT 0
645#define COMMS_STATUS_OFFSET_MASK 0x03FFFFFF
646#define COMMS_STATUS_OFFSET_ALIGN_SHIFT 2
647#define COMMS_STATUS_RAM_TYPE_SHIFT 26
648#define COMMS_STATUS_RAM_TYPE_MASK 0x0C000000
649#define COMMS_STATUS_STATUS_SHIFT 28
650#define COMMS_STATUS_STATUS_MASK 0xF0000000
651
652
653
654
655
656
657
658
659
660
661
662
663struct comms_status {
664 union {
665 struct {
666 u32 offset :26;
667 enum comms_ram_types ram_type :2;
668 enum comms_sts status :4;
669 };
670 __le32 val;
671 };
672};
673
674#endif
675