1 /* inteltool - dump all registers on an Intel CPU + chipset based system */
2 /* SPDX-License-Identifier: GPL-2.0-only */
13 #include "inteltool.h"
17 #include <machine/sysarch.h>
20 #define MAX_PCR_PORTS 8 /* how often may `--pcr` be specified */
27 * http://pci-ids.ucw.cz/read/PC/8086
28 * http://en.wikipedia.org/wiki/Intel_Tick-Tock
29 * http://en.wikipedia.org/wiki/List_of_Intel_chipsets
30 * http://en.wikipedia.org/wiki/Intel_Xeon_chipsets
33 uint16_t vendor_id
, device_id
;
35 } supported_chips_list
[] = {
36 /* Host bridges/DRAM controllers (Northbridges) */
37 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82443LX
, "443LX" },
38 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82443BX
, "443BX" },
39 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82443BX_NO_AGP
, "443BX without AGP" },
40 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82810
, "810" },
41 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82810_DC
, "810-DC100" },
42 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82810E_DC
, "810E DC-133" },
43 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82830M
, "830M" },
44 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82845
, "845" },
45 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82865
, "865" },
46 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82915
, "915G/P/GV/GL/PL/910GL" },
47 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82945P
, "945P" },
48 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82945GM
, "945GM" },
49 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82945GSE
, "945GSE" },
50 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82946
, "946GZ/PL" },
51 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82965PM
, "965PM" },
52 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82Q965
, "Q963/82Q965" },
53 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82975X
, "975X" },
54 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82G33
, "P35/G33/G31/P31" },
55 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82Q33
, "Q33" },
56 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82Q35
, "Q35" },
57 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82X38
, "X38/X48" },
58 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_32X0
, "3200/3210" },
59 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82XX4X
,
60 "GL40/GS40/GM45/GS45/PM45" },
61 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82Q45
, "Q45/Q43" },
62 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82G45
, "G45/G43/P45/P43" },
63 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82G41
, "G41" },
64 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82B43
, "B43 (Base)" },
65 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82B43_2
, "B43 (Soft)" },
66 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82X58
, "X58" },
67 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_I5000P
,
68 "Intel i5000P Memory Controller Hub" },
69 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_I5000X
,
70 "Intel i5000X Memory Controller Hub" },
71 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_I5000Z
,
72 "Intel i5000Z Memory Controller Hub" },
73 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_I5000V
,
74 "Intel i5000V Memory Controller Hub" },
75 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SCH_POULSBO
, "SCH Poulsbo" },
76 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ATOM_DXXX
,
77 "Atom D400/500 Series" },
78 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ATOM_NXXX
, "Atom N400 Series" },
79 /* Host bridges /DRAM controllers integrated in CPUs */
80 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_0TH_GEN
,
81 "0th generation (Nehalem family) Core Processor" },
82 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_1ST_GEN
,
83 "1st generation (Westmere family) Core Processor" },
84 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_2ND_GEN_D
,
85 "2nd generation (Sandy Bridge family) Core Processor (Desktop)" },
86 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_2ND_GEN_M
,
87 "2nd generation (Sandy Bridge family) Core Processor (Mobile)" },
88 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_2ND_GEN_E3
,
89 "2nd generation (Sandy Bridge family) Core Processor (Xeon E3)" },
90 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_3RD_GEN_D
,
91 "3rd generation (Ivy Bridge family) Core Processor (Desktop)" },
92 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_3RD_GEN_M
,
93 "3rd generation (Ivy Bridge family) Core Processor (Mobile)" },
94 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_3RD_GEN_E3
,
95 "3rd generation (Ivy Bridge family) Core Processor (Xeon E3 v2)" },
96 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_3RD_GEN_015c
,
97 "3rd generation (Ivy Bridge family) Core Processor" },
98 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_4TH_GEN_D
,
99 "4th generation (Haswell family) Core Processor (Desktop)" },
100 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_4TH_GEN_M
,
101 "4th generation (Haswell family) Core Processor (Mobile)" },
102 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_4TH_GEN_E3
,
103 "4th generation (Haswell family) Core Processor (Xeon E3 v3)" },
104 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_4TH_GEN_U
,
105 "4th generation (Haswell family) Core Processor ULT" },
106 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_5TH_GEN_U
,
107 "5th generation (Broadwell family) Core Processor ULT" },
108 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_6TH_GEN_M
,
109 "6th generation (Skylake-H family) Core Processor (Mobile)" },
110 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_6TH_GEN_WST
,
111 "6th generation (Skylake-S/H family) Core Processor (Workstation)" },
112 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_6TH_GEN_D
,
113 "6th generation (Skylake-S family) Core Processor (Desktop)" },
114 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_6TH_GEN_D2
,
115 "6th generation (Skylake-S family) Core Processor (Desktop)" },
116 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_6TH_GEN_E
,
117 "6th generation (Skylake family) Core Processor Xeon E (Server)" },
118 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_6TH_GEN_U
,
119 "6th generation (Skylake family) Core Processor (Mobile)" },
120 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_6TH_GEN_Y
,
121 "6th generation (Skylake family) Core Processor (Mobile)" },
122 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_BAYTRAIL
, "Bay Trail" },
123 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_7TH_GEN_U
,
124 "7th generation (Kaby Lake family) Core Processor (Mobile)" },
125 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_7TH_GEN_Y
,
126 "7th generation (Kaby Lake family) Core Processor (Mobile)" },
127 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_7TH_GEN_U_Q
,
128 "7th generation (Kaby Lake family) Core Processor (Mobile)" },
129 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_7TH_GEN_E3
,
130 "7th generation (Kaby Lake family) Core Processor Xeon E3-1200" },
131 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_8TH_GEN_U_1
,
132 "8th generation (Coffee Lake family) Core Processor (Mobile)" },
133 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_8TH_GEN_U_2
,
134 "8th generation (Whiskey Lake family) Core Processor (Mobile)" },
135 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CORE_10TH_GEN_U
,
136 "10th generation (Icelake family) Core Processor (Mobile)" },
137 /* Southbridges (LPC controllers) */
138 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_82371XX
, "371AB/EB/MB" },
139 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH10
, "ICH10" },
140 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH10DO
, "ICH10DO" },
141 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH10R
, "ICH10R" },
142 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH9DH
, "ICH9DH" },
143 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH9DO
, "ICH9DO" },
144 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH9R
, "ICH9R" },
145 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH9
, "ICH9" },
146 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH9M
, "ICH9M" },
147 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH9ME
, "ICH9M-E" },
148 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH8M
, "ICH8-M" },
149 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH8ME
, "ICH8M-E" },
150 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH8
, "ICH8" },
151 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_NM10
, "NM10" },
152 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH7MDH
, "ICH7-M DH" },
153 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH7M
, "ICH7-M" },
154 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH7
, "ICH7" },
155 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH7DH
, "ICH7DH" },
156 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH6
, "ICH6" },
157 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH5
, "ICH5" },
158 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH4M
, "ICH4-M" },
159 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH4
, "ICH4" },
160 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH2
, "ICH2" },
161 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH0
, "ICH0" },
162 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICH
, "ICH" },
163 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_I63XX
, "631xESB/632xESB/3100" },
164 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SCH_POULSBO_LPC
, "SCH Poulsbo" },
165 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_3400_DESKTOP
, "3400 Desktop" },
166 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_3400_MOBILE
, "3400 Mobile" },
167 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_P55
, "P55" },
168 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_PM55
, "PM55" },
169 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H55
, "H55" },
170 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QM57
, "QM57" },
171 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H57
, "H57" },
172 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM55
, "HM55" },
173 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q57
, "Q57" },
174 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM57
, "HM57" },
175 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF
,
177 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B55_A
, "B55" },
178 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QS57
, "QS57" },
179 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_3400
, "3400" },
180 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_3420
, "3420" },
181 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_3450
, "3450" },
182 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B55_B
, "B55" },
183 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Z68
, "Z68" },
184 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_P67
, "P67" },
185 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UM67
, "UM67" },
186 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM65
, "HM65" },
187 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H67
, "H67" },
188 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM67
, "HM67" },
189 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q65
, "Q65" },
190 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QS67
, "QS67" },
191 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q67
, "Q67" },
192 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QM67
, "QM67" },
193 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B65
, "B65" },
194 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C202
, "C202" },
195 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C204
, "C204" },
196 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C206
, "C206" },
197 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H61
, "H61" },
198 { PCI_VENDOR_ID_INTEL
, 0x1d40, "X79" },
199 { PCI_VENDOR_ID_INTEL
, 0x1d41, "X79" },
200 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Z77
, "Z77" },
201 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Z75
, "Z75" },
202 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q77
, "Q77" },
203 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q75
, "Q75" },
204 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B75
, "B75" },
205 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H77
, "H77" },
206 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C216
, "C216" },
207 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QM77
, "QM77" },
208 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QS77
, "QS77" },
209 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM77
, "HM77" },
210 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UM77
, "UM77" },
211 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM76
, "HM76" },
212 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM75
, "HM75" },
213 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM70
, "HM70" },
214 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_NM70
, "NM70" },
215 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_ICELAKE_LP_U
,
217 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL
,
218 "Lynx Point Low Power Full Featured Engineering Sample" },
219 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM
,
220 "Lynx Point Low Power Premium SKU" },
221 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE
,
222 "Lynx Point Low Power Base SKU" },
223 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM
,
224 "Wildcat Point Low Power Premium SKU" },
225 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP
,
226 "Wildcat Point Low Power Base SKU" },
227 { PCI_VENDOR_ID_INTEL
, 0x2310, "DH89xxCC" },
228 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC
, "Bay Trail" },
229 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_PRE
,
230 "Sunrise Point Desktop Engineering Sample" },
231 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE
,
232 "Sunrise Point-LP Engineering Sample" },
233 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL
,
234 "Sunrise Point-LP U Base/Skylake" },
235 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL
,
236 "Sunrise Point-LP Y Premium/Skylake" },
237 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL
,
238 "Sunrise Point-LP U Premium/Skylake" },
239 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL
,
240 "Sunrise Point-LP U Base/Kabylake" },
241 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL
,
242 "Sunrise Point-LP Y Premium/Kabylake" },
243 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL
,
244 "Sunrise Point-LP U Premium/Kabylake" },
245 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE
,
246 "Sunrise Point-LP U iHDCP 2.2 Base/Kabylake" },
247 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM
,
248 "Sunrise Point-LP U iHDCP 2.2 Premium/Kabylake" },
249 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM
,
250 "Sunrise Point-LP Y iHDCP 2.2 Premium/Kabylake" },
251 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CANNONPOINT_LP_U_PREM
,
252 "Cannon Point-LP U Premium/CoffeeLake/Whiskeylake" },
253 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H110
, "H110" },
254 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H170
, "H170" },
255 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Z170
, "Z170" },
256 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q170
, "Q170" },
257 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q150
, "Q150" },
258 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B150
, "B150" },
259 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C236
, "C236" },
260 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C232
, "C232" },
261 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QM170
, "QM170" },
262 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM170
, "HM170" },
263 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CM236
, "CM236" },
264 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM175
, "HM175" },
265 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QM175
, "QM175" },
266 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CM238
, "CM238" },
267 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C621
, "C621" },
268 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C622
, "C622" },
269 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C624
, "C624" },
270 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C625
, "C625" },
271 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C626
, "C626" },
272 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C627
, "C627" },
273 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C628
, "C628" },
274 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C629
, "C629" },
275 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C624_SUPER
, "C624 Super SKU" },
276 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C627_SUPER_1
, "C627 Super SKU" },
277 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C621_SUPER
, "C621 Super SKU" },
278 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C627_SUPER_2
, "C627 Super SKU" },
279 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C628_SUPER
, "C628 Super SKU" },
280 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H310
, "H310" },
281 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H370
, "H370" },
282 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Z390
, "Z390" },
283 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q370
, "Q370" },
284 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B360
, "B360" },
285 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C246
, "C246" },
286 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C242
, "C242" },
287 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QM370
, "QM370" },
288 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM370
, "HM370" },
289 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_CM246
, "CM246" },
290 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C8_MOBILE
, "C8 Mobile"},
291 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C8_DESKTOP
, "C8 Desktop"},
292 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Z87
, "Z87"},
293 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Z85
, "Z85"},
294 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM86
, "HM86"},
295 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H87
, "H87"},
296 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HM87
, "HM87"},
297 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q85
, "Q85"},
298 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q87
, "Q87"},
299 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_QM87
, "QM87"},
300 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B85
, "B85"},
301 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C222
, "C222"},
302 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C224
, "C224"},
303 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_C226
, "C226"},
304 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_H81
, "H81"},
305 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_APL_LPC
, "Apollo Lake" },
306 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_DNV_LPC
, "Denverton" },
308 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_G35_EXPRESS
,
309 "Intel(R) G35 Express Chipset Family" },
310 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_G35_EXPRESS_1
,
311 "Intel(R) G35 Express Chipset Family" },
312 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_965_EXPRESS
,
313 "Mobile Intel(R) 965 Express Chipset Family" },
314 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_965_EXPRESS_1
,
315 "Mobile Intel(R) 965 Express Chipset Family" },
316 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_965_EXPRESS_2
,
317 "Mobile Intel(R) 965 Express Chipset Family" },
318 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_965_EXPRESS_3
,
319 "Mobile Intel(R) 965 Express Chipset Family" },
320 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_4_SERIES
,
321 "Mobile Intel(R) 4 Series Express Chipset Family" },
322 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_4_SERIES_1
,
323 "Mobile Intel(R) 4 Series Express Chipset Family" },
324 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_G45
,
325 "Intel(R) G45/G43 Express Chipset Family" },
326 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_G45_1
,
327 "Intel(R) G45/G43 Express Chipset Family" },
328 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q45
,
329 "Intel(R) Q45/Q43 Express Chipset Family" },
330 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_Q45_1
,
331 "Intel(R) Q45/Q43 Express Chipset Family" },
332 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_G41
,
333 "Intel(R) G41 Express Chipset Family" },
334 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_G41_1
,
335 "Intel(R) G41 Express Chipset Family" },
336 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B43
,
337 "Intel(R) B43 Express Chipset Family" },
338 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B43_1
,
339 "Intel(R) B43 Express Chipset Family" },
340 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B43_2
,
341 "Intel(R) B43 Express Chipset Family" },
342 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_B43_3
,
343 "Intel(R) B43 Express Chipset Family" },
344 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_GRAPHICS
,
345 "Intel(R) HD Graphics" },
346 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_GRAPHICS_1
,
347 "Intel(R) HD Graphics" },
348 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_GRAPHICS_2
,
349 "Intel(R) HD Graphics" },
350 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_2000
,
351 "Intel(R) HD 2000 Graphics" },
352 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_2000_1
,
353 "Intel(R) HD 2000 Graphics" },
354 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_3000
,
355 "Intel(R) HD 3000 Graphics" },
356 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_3000_1
,
357 "Intel(R) HD 3000 Graphics" },
358 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_3000_2
,
359 "Intel(R) HD 3000 Graphics" },
360 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_3000_3
,
361 "Intel(R) HD 3000 Graphics" },
362 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_3000_4
,
363 "Intel(R) HD 3000 Graphics" },
364 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_3000_5
,
365 "Intel(R) HD 3000 Graphics" },
366 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_2500
,
367 "Intel(R) HD 2500 Graphics" },
368 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_2500_1
,
369 "Intel(R) HD 2500 Graphics" },
370 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_2500_2
,
371 "Intel(R) HD 2500 Graphics" },
372 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_4000
,
373 "Intel(R) HD 4000 Graphics" },
374 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_4000_1
,
375 "Intel(R) HD 4000 Graphics" },
376 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_4000_2
,
377 "Intel(R) HD 4000 Graphics" },
378 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_4400
,
379 "Intel(R) HD 4400 Graphics" },
380 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_4600
,
381 "Intel(R) HD 4600 Graphics" },
382 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_4600_1
,
383 "Intel(R) HD 4600 Graphics" },
384 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_5000
,
385 "Intel(R) HD 5000 Graphics" },
386 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_5000_1
,
387 "Intel(R) HD 5000 Graphics" },
388 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_5000_2
,
389 "Intel(R) HD 5000 Graphics" },
390 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_510
,
391 "Intel(R) HD Graphics 510" },
392 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_515
,
393 "Intel(R) HD Graphics 515" },
394 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_520
,
395 "Intel(R) HD Graphics 520" },
396 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_530_1
,
397 "Intel(R) HD Graphics 530" },
398 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_HD_530_2
,
399 "Intel(R) HD Graphics 530" },
400 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_615_1
,
401 "Intel(R) UHD Graphics 615" },
402 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_615_2
,
403 "Intel(R) UHD Graphics 615" },
404 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_617
,
405 "Intel(R) UHD Graphics 617" },
406 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_620_1
,
407 "Intel(R) UHD Graphics 620" },
408 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_620_2
,
409 "Intel(R) UHD Graphics 620" },
410 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_620_3
,
411 "Intel(R) UHD Graphics 620" },
412 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_630_1
,
413 "Intel(R) UHD Graphics 630" },
414 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_630_2
,
415 "Intel(R) UHD Graphics 630" },
416 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_630_3
,
417 "Intel(R) UHD Graphics 630" },
418 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_630_4
,
419 "Intel(R) UHD Graphics 630" },
420 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_630_5
,
421 "Intel(R) UHD Graphics 630" },
422 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_630_6
,
423 "Intel(R) UHD Graphics 630" },
424 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_630_7
,
425 "Intel(R) UHD Graphics 630" },
426 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_UHD_640
,
427 "Intel(R) UHD Graphics 640" },
428 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_IRIS_540
,
429 "Intel(R) Iris Graphics 540" },
430 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_IRIS_550
,
431 "Intel(R) Iris Graphics 550" },
432 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_IRIS_PRO_580
,
433 "Intel(R) Iris Pro Graphics 580" },
434 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_IRIS_PLUS_650
,
435 "Intel(R) Iris Plus Graphics 650" },
436 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_IRIS_PLUS_655
,
437 "Intel(R) Iris Plus Graphics 655" },
438 { PCI_VENDOR_ID_INTEL
, PCI_DEVICE_ID_INTEL_IRIS_PLUS_G7
,
439 "Intel(R) Iris Plus Graphics G7" },
445 void *map_physical(uint64_t phys_addr
, size_t len
)
449 virt_addr
= mmap(0, len
, PROT_WRITE
| PROT_READ
, MAP_SHARED
,
450 fd_mem
, (off_t
) phys_addr
);
452 if (virt_addr
== MAP_FAILED
) {
453 printf("Error mapping physical memory 0x%08" PRIx64
"[0x%zx]\n",
461 void unmap_physical(void *virt_addr
, size_t len
)
463 munmap(virt_addr
, len
);
467 static void print_version(void)
469 printf("inteltool v%s -- ", INTELTOOL_VERSION
);
470 printf("Copyright (C) 2008 coresystems GmbH\n\n");
472 "This program is free software: you can redistribute it and/or modify\n"
473 "it under the terms of the GNU General Public License as published by\n"
474 "the Free Software Foundation, version 2 of the License.\n\n"
475 "This program is distributed in the hope that it will be useful,\n"
476 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
477 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
478 "GNU General Public License for more details.\n\n");
481 static void print_usage(const char *name
)
483 printf("usage: %s [-vh?gGrplmedPMaAsfSRx]\n", name
);
485 " -v | --version: print the version\n"
486 " -h | --help: print this help\n\n"
487 " -s | --spi: dump southbridge spi and bios_cntrl registers\n"
488 " -f | --gfx: dump graphics registers (UNSAFE: may hang system!)\n"
489 " -R | --ahci: dump AHCI registers\n"
490 " -g | --gpio: dump southbridge GPIO registers\n"
491 " -G | --gpio-diffs: show GPIO differences from defaults\n"
492 " -r | --rcba: dump southbridge RCBA registers\n"
493 " -p | --pmbase: dump southbridge Power Management registers\n\n"
494 " -l | --lpc: dump southbridge LPC/eSPI Interface registers\n\n"
495 " -m | --mchbar: dump northbridge Memory Controller registers\n"
496 " -S FILE | --spd=FILE: create a file storing current timings (implies -m)\n"
497 " -e | --epbar: dump northbridge EPBAR registers\n"
498 " -d | --dmibar: dump northbridge DMIBAR registers\n"
499 " -P | --pciexpress: dump northbridge PCIEXBAR registers\n\n"
500 " -M | --msrs: dump CPU MSRs\n"
501 " -A | --ambs: dump AMB registers\n"
502 " -x | --sgx: dump SGX status\n"
503 " -a | --all: dump all known (safe) registers\n"
504 " --pcr=PORT_ID: dump all registers of a PCR port\n"
505 " (may be specified max %d times)\n"
506 "\n", MAX_PCR_PORTS
);
510 static void print_system_info(struct pci_dev
*nb
, struct pci_dev
*sb
, struct pci_dev
*gfx
)
513 char *sbname
= "unknown", *nbname
= "unknown", *gfxname
= "unknown";
517 /* Determine names */
518 for (i
= 0; i
< ARRAY_SIZE(supported_chips_list
); i
++) {
519 if (nb
->device_id
== supported_chips_list
[i
].device_id
)
520 nbname
= supported_chips_list
[i
].name
;
522 for (i
= 0; i
< ARRAY_SIZE(supported_chips_list
); i
++) {
523 if (sb
->device_id
== supported_chips_list
[i
].device_id
)
524 sbname
= supported_chips_list
[i
].name
;
527 for (i
= 0; i
< ARRAY_SIZE(supported_chips_list
); i
++)
528 if (gfx
->device_id
== supported_chips_list
[i
].device_id
)
529 gfxname
= supported_chips_list
[i
].name
;
532 /* Intel has suggested applications to display the family of a CPU as
533 * the sum of the "Family" and the "Extended Family" fields shown
534 * above, and the model as the sum of the "Model" and the 4-bit
535 * left-shifted "Extended Model" fields.
536 * http://download.intel.com/design/processor/applnots/24161832.pdf
538 printf("CPU: ID 0x%x, Processor Type 0x%x, Family 0x%x, Model 0x%x, Stepping 0x%x\n",
539 id
, (id
>> 12) & 0x3, ((id
>> 8) & 0xf) + ((id
>> 20) & 0xff),
540 ((id
>> 12) & 0xf0) + ((id
>> 4) & 0xf), (id
& 0xf));
542 printf("Northbridge: %04x:%04x (%s)\n",
543 nb
->vendor_id
, nb
->device_id
, nbname
);
545 printf("Southbridge: %04x:%04x (%s)\n",
546 sb
->vendor_id
, sb
->device_id
, sbname
);
549 printf("IGD: %04x:%04x (%s)\n",
550 gfx
->vendor_id
, gfx
->device_id
, gfxname
);
553 int main(int argc
, char *argv
[])
555 struct pci_access
*pacc
;
556 struct pci_dev
*sb
= NULL
, *nb
, *gfx
= NULL
, *ahci
= NULL
, *dev
;
557 const char *dump_spd_file
= NULL
;
558 int opt
, option_index
= 0;
560 int dump_gpios
= 0, dump_mchbar
= 0, dump_rcba
= 0;
561 int dump_pmbase
= 0, dump_epbar
= 0, dump_dmibar
= 0;
562 int dump_pciexbar
= 0, dump_coremsrs
= 0, dump_ambs
= 0;
563 int dump_spi
= 0, dump_gfx
= 0, dump_ahci
= 0, dump_sgx
= 0;
565 int show_gpio_diffs
= 0;
566 size_t pcr_count
= 0;
567 uint8_t dump_pcr
[MAX_PCR_PORTS
];
569 static struct option long_options
[] = {
570 {"version", 0, 0, 'v'},
572 {"gpios", 0, 0, 'g'},
573 {"gpio-diffs", 0, 0, 'G'},
574 {"mchbar", 0, 0, 'm'},
576 {"pmbase", 0, 0, 'p'},
578 {"epbar", 0, 0, 'e'},
579 {"dmibar", 0, 0, 'd'},
580 {"pciexpress", 0, 0, 'P'},
589 {"pcr", required_argument
, 0, LONG_OPT_PCR
},
593 while ((opt
= getopt_long(argc
, argv
, "vh?gGrplmedPMaAsfRS:x",
594 long_options
, &option_index
)) != EOF
) {
601 dump_spd_file
= optarg
;
666 if (pcr_count
< MAX_PCR_PORTS
) {
668 const unsigned long int pcr
=
669 strtoul(optarg
, NULL
, 0);
670 if (strlen(optarg
) == 0 || errno
) {
671 print_usage(argv
[0]);
674 dump_pcr
[pcr_count
++] = (uint8_t)pcr
;
676 print_usage(argv
[0]);
683 print_usage(argv
[0]);
689 #if defined(__FreeBSD__)
690 if (open("/dev/io", O_RDWR
) < 0) {
692 #elif defined(__NetBSD__)
697 if (x86_64_iopl(3)) {
704 printf("You need to be root.\n");
709 if ((fd_mem
= open("/dev/mem", O_RDWR
)) < 0) {
710 perror("Can not open /dev/mem");
716 pacc
->method
= PCI_ACCESS_I386_TYPE1
;
720 /* Find the required devices */
721 for (dev
= pacc
->devices
; dev
; dev
= dev
->next
) {
722 pci_fill_info(dev
, PCI_FILL_CLASS
);
723 /* The ISA/LPC bridge can be 0x1f, 0x07, or 0x04 so we probe. */
724 if (dev
->device_class
== 0x0601) { /* ISA/LPC bridge */
728 fprintf(stderr
, "Multiple devices with class ID"
729 " 0x0601, using %02x%02x:%02x.%02x\n",
730 sb
->domain
, sb
->bus
, sb
->dev
, sb
->func
);
737 printf("No southbridge found.\n");
741 pci_fill_info(sb
, PCI_FILL_IDENT
| PCI_FILL_BASES
| PCI_FILL_CLASS
);
743 if (sb
->vendor_id
!= PCI_VENDOR_ID_INTEL
) {
744 printf("Not an Intel(R) southbridge.\n");
748 nb
= pci_get_dev(pacc
, 0, 0, 0x00, 0);
750 printf("No northbridge found.\n");
754 pci_fill_info(nb
, PCI_FILL_IDENT
| PCI_FILL_BASES
| PCI_FILL_CLASS
);
756 if (nb
->vendor_id
!= PCI_VENDOR_ID_INTEL
) {
757 printf("Not an Intel(R) northbridge.\n");
761 gfx
= pci_get_dev(pacc
, 0, 0, 0x02, 0);
764 pci_fill_info(gfx
, PCI_FILL_IDENT
| PCI_FILL_BASES
|
767 if (gfx
->vendor_id
!= PCI_VENDOR_ID_INTEL
)
771 if (sb
->device_id
== PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC
) {
772 ahci
= pci_get_dev(pacc
, 0, 0, 0x13, 0);
774 ahci
= pci_get_dev(pacc
, 0, 0, 0x1f, 2);
776 pci_fill_info(ahci
, PCI_FILL_CLASS
);
777 if (ahci
->device_class
!= PCI_CLASS_STORAGE_SATA
)
778 ahci
= pci_get_dev(pacc
, 0, 0, 0x17, 0);
783 pci_fill_info(ahci
, PCI_FILL_IDENT
| PCI_FILL_BASES
|
786 if (ahci
->vendor_id
!= PCI_VENDOR_ID_INTEL
||
787 ahci
->device_class
!= PCI_CLASS_STORAGE_SATA
)
791 print_system_info(nb
, sb
, gfx
);
793 /* Now do the deed */
795 print_gpios(sb
, 1, show_gpio_diffs
);
797 } else if (show_gpio_diffs
) {
798 print_gpios(sb
, 0, show_gpio_diffs
);
808 print_pmbase(sb
, pacc
);
818 print_mchbar(nb
, pacc
, dump_spd_file
);
838 print_intel_core_msrs();
843 print_ambs(nb
, pacc
);
858 print_pcr_ports(sb
, dump_pcr
, pcr_count
);
867 /* `sb` wasn't allocated by pci_get_dev() */