1 /* inteltool - dump all registers on an Intel CPU + chipset based system */
2 /* SPDX-License-Identifier: GPL-2.0-only */
7 #include <commonlib/helpers.h>
10 #define SUNRISE_LPC_BC 0xdc
12 static const io_register_t sunrise_lpc_cfg_registers
[] = {
40 static const io_register_t sunrise_espi_cfg_registers
[] = {
41 {0x00, 4, "ESPI_DID_VID"},
42 {0x04, 4, "ESPI_STS_CMD"},
43 {0x08, 4, "ESPI_CC_RID"},
44 {0x0C, 4, "ESPI_BIST_HTYPE_PLT_CLS"},
46 {0x34, 4, "ESPI_CAPP"},
47 {0x80, 4, "ESPI_IOD_IOE"},
48 {0x84, 4, "ESPI_LGIR1"},
49 {0x88, 4, "ESPI_LGIR2"},
50 {0x8C, 4, "ESPI_LGIR3"},
51 {0x90, 4, "ESPI_LGIR4"},
52 {0x94, 4, "ESPI_ULKMC"},
53 {0x98, 4, "ESPI_LGMR"},
54 {0xD0, 4, "ESPI_FS1"},
55 {0xD4, 4, "ESPI_FS2"},
56 {0xD8, 4, "ESPI_BDE"},
60 int print_lpc(struct pci_dev
*sb
, struct pci_access
*pacc
)
62 size_t i
, cfg_registers_size
= 0;
63 const io_register_t
*cfg_registers
;
64 struct pci_dev
*dev
= NULL
;
67 printf("\n========== LPC/eSPI =========\n\n");
69 switch (sb
->device_id
) {
70 case PCI_DEVICE_ID_INTEL_H110
:
71 case PCI_DEVICE_ID_INTEL_H170
:
72 case PCI_DEVICE_ID_INTEL_Z170
:
73 case PCI_DEVICE_ID_INTEL_Q170
:
74 case PCI_DEVICE_ID_INTEL_Q150
:
75 case PCI_DEVICE_ID_INTEL_B150
:
76 case PCI_DEVICE_ID_INTEL_C236
:
77 case PCI_DEVICE_ID_INTEL_C232
:
78 case PCI_DEVICE_ID_INTEL_QM170
:
79 case PCI_DEVICE_ID_INTEL_HM170
:
80 case PCI_DEVICE_ID_INTEL_CM236
:
81 case PCI_DEVICE_ID_INTEL_HM175
:
82 case PCI_DEVICE_ID_INTEL_QM175
:
83 case PCI_DEVICE_ID_INTEL_CM238
:
84 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE
:
85 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL
:
86 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL
:
87 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL
:
88 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL
:
89 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL
:
90 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL
:
91 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE
:
92 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM
:
93 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM
:
94 dev
= pci_get_dev(pacc
, sb
->domain
, sb
->bus
, sb
->dev
, 0);
96 printf("LPC/eSPI interface not found.\n");
99 bc
= pci_read_long(dev
, SUNRISE_LPC_BC
);
101 printf("Device 0:1f.0 is eSPI (BC.LPC_ESPI=1)\n\n");
102 cfg_registers
= sunrise_espi_cfg_registers
;
103 cfg_registers_size
= ARRAY_SIZE(sunrise_espi_cfg_registers
);
106 printf("Device 0:1f.0 is LPC (BC.LPC_ESPI=0)\n\n");
107 cfg_registers
= sunrise_lpc_cfg_registers
;
108 cfg_registers_size
= ARRAY_SIZE(sunrise_lpc_cfg_registers
);
113 printf("Error: Dumping LPC/eSPI on this southbridge is not (yet) supported.\n");
117 for (i
= 0; i
< cfg_registers_size
; i
++) {
118 switch (cfg_registers
[i
].size
) {
120 printf("0x%04x: 0x%08x (%s)\n",
121 cfg_registers
[i
].addr
,
122 pci_read_long(dev
, cfg_registers
[i
].addr
),
123 cfg_registers
[i
].name
);
126 printf("0x%04x: 0x%04x (%s)\n",
127 cfg_registers
[i
].addr
,
128 pci_read_word(dev
, cfg_registers
[i
].addr
),
129 cfg_registers
[i
].name
);
132 printf("0x%04x: 0x%02x (%s)\n",
133 cfg_registers
[i
].addr
,
134 pci_read_byte(dev
, cfg_registers
[i
].addr
),
135 cfg_registers
[i
].name
);
138 printf("Error: register size %d not implemented.\n",
139 cfg_registers
[i
].size
);