blob: deb2eac9ee254e05d3c0c4451aa2ba747409b05c [file] [log] [blame]
Philipp Deppenwiesed8fe4432016-03-18 00:52:54 +01001/*
2 * intelmetool
3 *
4 * Copyright (C) 2008-2010 by coresystems GmbH
5 * Copyright (C) 2009 Carl-Daniel Hailfinger
6 * Copyright (C) 2015 Damien Zammit
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#define ME_NOT_PRESENT 0
19#define ME_FOUND_NOTHING 1
20#define ME_FOUND_SOMETHING_NOT_SURE 2
21#define ME_CAN_DISABLE_IF_PRESENT 3
22#define ME_PRESENT_CAN_DISABLE 4
23#define ME_PRESENT_CANNOT_DISABLE 5
24
25#define INTELMETOOL_VERSION "1.0"
26
27#if defined(__GLIBC__)
28#include <sys/io.h>
29#endif
30#if (defined(__MACH__) && defined(__APPLE__))
31/* DirectHW is available here: http://www.coreboot.org/DirectHW */
32#define __DARWIN__
33#include <DirectHW/DirectHW.h>
34#endif
35#ifdef __NetBSD__
36#include <pciutils/pci.h>
37#else
38#include <pci/pci.h>
39#endif
40
41#define CNRM "\x1B[0m"
42#define CRED "\x1B[31m"
43#define CGRN "\x1B[32m"
44#define CYEL "\x1B[33m"
45#define CBLU "\x1B[34m"
46#define CMAG "\x1B[35m"
47#define CCYN "\x1B[36m"
48#define CWHT "\x1B[37m"
49#define RESET "\033[0m"
50
51extern int debug;
52
53// Definitely has ME and can be disabled
54#define PCI_DEVICE_ID_INTEL_ICH8ME 0x2811
55#define PCI_DEVICE_ID_INTEL_ICH9ME 0x2917
56#define PCI_DEVICE_ID_INTEL_ICH9M 0x2919
57
58#define PCI_DEV_HAS_ME_DISABLE(x) ( \
59 ( (x) == PCI_DEVICE_ID_INTEL_ICH8ME ) || \
60 ( (x) == PCI_DEVICE_ID_INTEL_ICH9ME ) || \
61 ( (x) == PCI_DEVICE_ID_INTEL_ICH9M ))
62
63// Definitely has ME and is very difficult to remove
64#define PCI_DEVICE_ID_INTEL_ICH10R 0x3a16
65#define PCI_DEVICE_ID_INTEL_3400_DESKTOP 0x3b00
66#define PCI_DEVICE_ID_INTEL_3400_MOBILE 0x3b01
67#define PCI_DEVICE_ID_INTEL_P55 0x3b02
68#define PCI_DEVICE_ID_INTEL_PM55 0x3b03
69#define PCI_DEVICE_ID_INTEL_H55 0x3b06
70#define PCI_DEVICE_ID_INTEL_QM57 0x3b07
71#define PCI_DEVICE_ID_INTEL_H57 0x3b08
72#define PCI_DEVICE_ID_INTEL_HM55 0x3b09
73#define PCI_DEVICE_ID_INTEL_Q57 0x3b0a
74#define PCI_DEVICE_ID_INTEL_HM57 0x3b0b
75#define PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF 0x3b0d
76#define PCI_DEVICE_ID_INTEL_B55_A 0x3b0e
77#define PCI_DEVICE_ID_INTEL_QS57 0x3b0f
78#define PCI_DEVICE_ID_INTEL_3400 0x3b12
79#define PCI_DEVICE_ID_INTEL_3420 0x3b14
80#define PCI_DEVICE_ID_INTEL_3450 0x3b16
81#define PCI_DEVICE_ID_INTEL_B55_B 0x3b1e
82#define PCI_DEVICE_ID_INTEL_Z68 0x1c44
83#define PCI_DEVICE_ID_INTEL_P67 0x1c46
84#define PCI_DEVICE_ID_INTEL_UM67 0x1c47
85#define PCI_DEVICE_ID_INTEL_HM65 0x1c49
86#define PCI_DEVICE_ID_INTEL_H67 0x1c4a
87#define PCI_DEVICE_ID_INTEL_HM67 0x1c4b
88#define PCI_DEVICE_ID_INTEL_Q65 0x1c4c
89#define PCI_DEVICE_ID_INTEL_QS67 0x1c4d
90#define PCI_DEVICE_ID_INTEL_Q67 0x1c4e
91#define PCI_DEVICE_ID_INTEL_QM67 0x1c4f
92#define PCI_DEVICE_ID_INTEL_B65 0x1c50
93#define PCI_DEVICE_ID_INTEL_C202 0x1c52
94#define PCI_DEVICE_ID_INTEL_C204 0x1c54
95#define PCI_DEVICE_ID_INTEL_C206 0x1c56
96#define PCI_DEVICE_ID_INTEL_H61 0x1c5c
97#define PCI_DEVICE_ID_INTEL_Z77 0x1e44
98#define PCI_DEVICE_ID_INTEL_Z75 0x1e46
99#define PCI_DEVICE_ID_INTEL_Q77 0x1e47
100#define PCI_DEVICE_ID_INTEL_Q75 0x1e48
101#define PCI_DEVICE_ID_INTEL_B75 0x1e49
102#define PCI_DEVICE_ID_INTEL_H77 0x1e4a
103#define PCI_DEVICE_ID_INTEL_C216 0x1e53
104#define PCI_DEVICE_ID_INTEL_QM77 0x1e55
105#define PCI_DEVICE_ID_INTEL_QS77 0x1e56
106#define PCI_DEVICE_ID_INTEL_HM77 0x1e57
107#define PCI_DEVICE_ID_INTEL_UM77 0x1e58
108#define PCI_DEVICE_ID_INTEL_HM76 0x1e59
109#define PCI_DEVICE_ID_INTEL_HM75 0x1e5d
110#define PCI_DEVICE_ID_INTEL_HM70 0x1e5e
111#define PCI_DEVICE_ID_INTEL_NM70 0x1e5f
112#define PCI_DEVICE_ID_INTEL_QM87 0x8c4f
113#define PCI_DEVICE_ID_INTEL_DH89XXCC 0x2310
114#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL 0x9c41
115#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM 0x9c43
116#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE 0x9c45
Huan Truong8c247a22017-03-05 03:28:46 -0600117#define PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP 0x9cc5
Omar Pakkera03609b42016-06-02 21:06:54 +0200118#define PCI_DEVICE_ID_INTEL_X99 0x8d47
Philipp Deppenwiesed8fe4432016-03-18 00:52:54 +0100119
120#define PCI_DEV_HAS_ME_DIFFICULT(x) ( \
121 ( (x) == PCI_DEVICE_ID_INTEL_ICH10R ) || \
122 ( (x) == PCI_DEVICE_ID_INTEL_3400_DESKTOP ) || \
123 ( (x) == PCI_DEVICE_ID_INTEL_3400_MOBILE ) || \
124 ( (x) == PCI_DEVICE_ID_INTEL_P55 ) || \
125 ( (x) == PCI_DEVICE_ID_INTEL_PM55 ) || \
126 ( (x) == PCI_DEVICE_ID_INTEL_H55 ) || \
127 ( (x) == PCI_DEVICE_ID_INTEL_QM57 ) || \
128 ( (x) == PCI_DEVICE_ID_INTEL_H57 ) || \
129 ( (x) == PCI_DEVICE_ID_INTEL_HM55 ) || \
130 ( (x) == PCI_DEVICE_ID_INTEL_Q57 ) || \
131 ( (x) == PCI_DEVICE_ID_INTEL_HM57 ) || \
132 ( (x) == PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF ) || \
133 ( (x) == PCI_DEVICE_ID_INTEL_B55_A ) || \
134 ( (x) == PCI_DEVICE_ID_INTEL_QS57 ) || \
135 ( (x) == PCI_DEVICE_ID_INTEL_3400 ) || \
136 ( (x) == PCI_DEVICE_ID_INTEL_3420 ) || \
137 ( (x) == PCI_DEVICE_ID_INTEL_3450 ) || \
138 ( (x) == PCI_DEVICE_ID_INTEL_B55_B ) || \
139 ( (x) == PCI_DEVICE_ID_INTEL_Z68 ) || \
140 ( (x) == PCI_DEVICE_ID_INTEL_P67 ) || \
141 ( (x) == PCI_DEVICE_ID_INTEL_UM67 ) || \
142 ( (x) == PCI_DEVICE_ID_INTEL_HM65 ) || \
143 ( (x) == PCI_DEVICE_ID_INTEL_H67 ) || \
144 ( (x) == PCI_DEVICE_ID_INTEL_HM67 ) || \
145 ( (x) == PCI_DEVICE_ID_INTEL_Q65 ) || \
146 ( (x) == PCI_DEVICE_ID_INTEL_QS67 ) || \
147 ( (x) == PCI_DEVICE_ID_INTEL_Q67 ) || \
148 ( (x) == PCI_DEVICE_ID_INTEL_QM67 ) || \
149 ( (x) == PCI_DEVICE_ID_INTEL_B65 ) || \
150 ( (x) == PCI_DEVICE_ID_INTEL_C202 ) || \
151 ( (x) == PCI_DEVICE_ID_INTEL_C204 ) || \
152 ( (x) == PCI_DEVICE_ID_INTEL_C206 ) || \
153 ( (x) == PCI_DEVICE_ID_INTEL_H61 ) || \
154 ( (x) == PCI_DEVICE_ID_INTEL_Z77 ) || \
155 ( (x) == PCI_DEVICE_ID_INTEL_Z75 ) || \
156 ( (x) == PCI_DEVICE_ID_INTEL_Q77 ) || \
157 ( (x) == PCI_DEVICE_ID_INTEL_Q75 ) || \
158 ( (x) == PCI_DEVICE_ID_INTEL_B75 ) || \
159 ( (x) == PCI_DEVICE_ID_INTEL_H77 ) || \
160 ( (x) == PCI_DEVICE_ID_INTEL_C216 ) || \
161 ( (x) == PCI_DEVICE_ID_INTEL_QM77 ) || \
162 ( (x) == PCI_DEVICE_ID_INTEL_QS77 ) || \
163 ( (x) == PCI_DEVICE_ID_INTEL_HM77 ) || \
164 ( (x) == PCI_DEVICE_ID_INTEL_UM77 ) || \
165 ( (x) == PCI_DEVICE_ID_INTEL_HM76 ) || \
166 ( (x) == PCI_DEVICE_ID_INTEL_HM75 ) || \
167 ( (x) == PCI_DEVICE_ID_INTEL_HM70 ) || \
168 ( (x) == PCI_DEVICE_ID_INTEL_NM70 ) || \
169 ( (x) == PCI_DEVICE_ID_INTEL_QM87 ) || \
170 ( (x) == PCI_DEVICE_ID_INTEL_DH89XXCC ) || \
Huan Truong8c247a22017-03-05 03:28:46 -0600171 ( (x) == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL ) || \
172 ( (x) == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM ) || \
173 ( (x) == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE ) || \
174 ( (x) == PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP ) || \
175 ( (x) == PCI_DEVICE_ID_INTEL_X99 ))
Philipp Deppenwiesed8fe4432016-03-18 00:52:54 +0100176
177// Not sure if ME present, but should be able to disable it easily
178#define PCI_DEVICE_ID_INTEL_ICH8 0x2810
179#define PCI_DEVICE_ID_INTEL_ICH8M 0x2815
180#define PCI_DEVICE_ID_INTEL_ICH9DH 0x2912
181#define PCI_DEVICE_ID_INTEL_ICH9DO 0x2914
182#define PCI_DEVICE_ID_INTEL_ICH9R 0x2916
183#define PCI_DEVICE_ID_INTEL_ICH9 0x2918
184
185#define PCI_DEV_CAN_DISABLE_ME_IF_PRESENT(x) ( \
186 ( (x) == PCI_DEVICE_ID_INTEL_ICH8 ) || \
187 ( (x) == PCI_DEVICE_ID_INTEL_ICH8M ) || \
188 ( (x) == PCI_DEVICE_ID_INTEL_ICH9DH ) || \
189 ( (x) == PCI_DEVICE_ID_INTEL_ICH9DO ) || \
190 ( (x) == PCI_DEVICE_ID_INTEL_ICH9R ) || \
191 ( (x) == PCI_DEVICE_ID_INTEL_ICH9 ))
192
193// Not sure at all
194#define PCI_DEVICE_ID_INTEL_SCH_POULSBO_LPC 0x8119
195#define PCI_DEVICE_ID_INTEL_SCH_POULSBO 0x8100
196
197#define PCI_DEV_ME_NOT_SURE(x) ( \
198 ( (x) == PCI_DEVICE_ID_INTEL_SCH_POULSBO_LPC ) || \
199 ( (x) == PCI_DEVICE_ID_INTEL_SCH_POULSBO))
200
201#define PCI_DEVICE_ID_INTEL_COUGARPOINT_1 0x1C3A /* Cougar Point */
202#define PCI_DEVICE_ID_INTEL_PATSBURG_1 0x1D3A /* C600/X79 Patsburg */
203#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_1 0x1CBA /* Panther Point */
204#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_2 0x1DBA /* Panther Point */
205#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_3 0x1E3A /* Panther Point */
206#define PCI_DEVICE_ID_INTEL_CAVECREEK 0x2364 /* Cave Creek */
207#define PCI_DEVICE_ID_INTEL_BEARLAKE_1 0x28B4 /* Bearlake */
208#define PCI_DEVICE_ID_INTEL_BEARLAKE_2 0x28C4 /* Bearlake */
209#define PCI_DEVICE_ID_INTEL_BEARLAKE_3 0x28D4 /* Bearlake */
210#define PCI_DEVICE_ID_INTEL_BEARLAKE_4 0x28E4 /* Bearlake */
211#define PCI_DEVICE_ID_INTEL_BEARLAKE_5 0x28F4 /* Bearlake */
212#define PCI_DEVICE_ID_INTEL_82946GZ 0x2974 /* 82946GZ/GL */
213#define PCI_DEVICE_ID_INTEL_82G35 0x2984 /* 82G35 Express */
214#define PCI_DEVICE_ID_INTEL_82Q963 0x2994 /* 82Q963/Q965 */
215#define PCI_DEVICE_ID_INTEL_82P965 0x29A4 /* 82P965/G965 */
216#define PCI_DEVICE_ID_INTEL_82Q35 0x29B4 /* 82Q35 Express */
217#define PCI_DEVICE_ID_INTEL_82G33 0x29C4 /* 82G33/G31/P35/P31 Express */
218#define PCI_DEVICE_ID_INTEL_82Q33 0x29D4 /* 82Q33 Express */
219#define PCI_DEVICE_ID_INTEL_82X38 0x29E4 /* 82X38/X48 Express */
220#define PCI_DEVICE_ID_INTEL_3200 0x29F4 /* 3200/3210 Server */
221#define PCI_DEVICE_ID_INTEL_PM965 0x2A04 /* Mobile PM965/GM965 */
222#define PCI_DEVICE_ID_INTEL_GME965 0x2A14 /* Mobile GME965/GLE960 */
223#define PCI_DEVICE_ID_INTEL_CANTIGA_1 0x2A44 /* Cantiga */
224#define PCI_DEVICE_ID_INTEL_CANTIGA_2 0x2a50 /* Cantiga */
225#define PCI_DEVICE_ID_INTEL_CANTIGA_3 0x2A54 /* Cantiga */
226#define PCI_DEVICE_ID_INTEL_CANTIGA_4 0x2A64 /* Cantiga */
227#define PCI_DEVICE_ID_INTEL_CANTIGA_5 0x2A74 /* Cantiga */
228#define PCI_DEVICE_ID_INTEL_EAGLELAKE_1 0x2E04 /* Eaglelake */
229#define PCI_DEVICE_ID_INTEL_EAGLELAKE_2 0x2E14 /* Eaglelake */
230#define PCI_DEVICE_ID_INTEL_EAGLELAKE_3 0x2E24 /* Eaglelake */
231#define PCI_DEVICE_ID_INTEL_EAGLELAKE_4 0x2E34 /* Eaglelake */
232#define PCI_DEVICE_ID_INTEL_CALPELLA_1 0x3B64 /* Calpella */
233#define PCI_DEVICE_ID_INTEL_CALPELLA_2 0x3B65 /* Calpella */
234#define PCI_DEVICE_ID_INTEL_LYNXPOINT_1 0x8C3A /* Lynx Point H */
235#define PCI_DEVICE_ID_INTEL_LYNXPOINT_2 0x8CBA /* Lynx Point H Refresh */
236#define PCI_DEVICE_ID_INTEL_LYNXPOINT_3 0x8D3A /* Lynx Point - Wellsburg */
237#define PCI_DEVICE_ID_INTEL_LYNXPOINT_4 0x9C3A /* Lynx Point LP */
238#define PCI_DEVICE_ID_INTEL_WILDCAT_1 0x9CBA /* Wildcat Point LP */
239#define PCI_DEVICE_ID_INTEL_WILDCAT_2 0x9CBB /* Wildcat Point LP 2 */
240
241#define PCI_DEV_HAS_SUPPORTED_ME(x) ( \
242 ( (x) == PCI_DEVICE_ID_INTEL_COUGARPOINT_1 ) || \
243 ( (x) == PCI_DEVICE_ID_INTEL_PATSBURG_1 ) || \
244 ( (x) == PCI_DEVICE_ID_INTEL_PANTHERPOINT_1 ) || \
245 ( (x) == PCI_DEVICE_ID_INTEL_PANTHERPOINT_2 ) || \
246 ( (x) == PCI_DEVICE_ID_INTEL_PANTHERPOINT_3 ) || \
247 ( (x) == PCI_DEVICE_ID_INTEL_CAVECREEK ) || \
248 ( (x) == PCI_DEVICE_ID_INTEL_BEARLAKE_1 ) || \
249 ( (x) == PCI_DEVICE_ID_INTEL_BEARLAKE_2 ) || \
250 ( (x) == PCI_DEVICE_ID_INTEL_BEARLAKE_3 ) || \
251 ( (x) == PCI_DEVICE_ID_INTEL_BEARLAKE_4 ) || \
252 ( (x) == PCI_DEVICE_ID_INTEL_BEARLAKE_5 ) || \
253 ( (x) == PCI_DEVICE_ID_INTEL_82946GZ ) || \
254 ( (x) == PCI_DEVICE_ID_INTEL_82G35 ) || \
255 ( (x) == PCI_DEVICE_ID_INTEL_82Q963 ) || \
256 ( (x) == PCI_DEVICE_ID_INTEL_82P965 ) || \
257 ( (x) == PCI_DEVICE_ID_INTEL_82Q35 ) || \
258 ( (x) == PCI_DEVICE_ID_INTEL_82G33 ) || \
259 ( (x) == PCI_DEVICE_ID_INTEL_82Q33 ) || \
260 ( (x) == PCI_DEVICE_ID_INTEL_82X38 ) || \
261 ( (x) == PCI_DEVICE_ID_INTEL_3200 ) || \
262 ( (x) == PCI_DEVICE_ID_INTEL_PM965 ) || \
263 ( (x) == PCI_DEVICE_ID_INTEL_GME965 ) || \
264 ( (x) == PCI_DEVICE_ID_INTEL_CANTIGA_1 ) || \
265 ( (x) == PCI_DEVICE_ID_INTEL_CANTIGA_2 ) || \
266 ( (x) == PCI_DEVICE_ID_INTEL_CANTIGA_3 ) || \
267 ( (x) == PCI_DEVICE_ID_INTEL_CANTIGA_4 ) || \
268 ( (x) == PCI_DEVICE_ID_INTEL_CANTIGA_5 ) || \
269 ( (x) == PCI_DEVICE_ID_INTEL_EAGLELAKE_1 ) || \
270 ( (x) == PCI_DEVICE_ID_INTEL_EAGLELAKE_2 ) || \
271 ( (x) == PCI_DEVICE_ID_INTEL_EAGLELAKE_3 ) || \
272 ( (x) == PCI_DEVICE_ID_INTEL_EAGLELAKE_4 ) || \
273 ( (x) == PCI_DEVICE_ID_INTEL_CALPELLA_1 ) || \
274 ( (x) == PCI_DEVICE_ID_INTEL_CALPELLA_2 ) || \
275 ( (x) == PCI_DEVICE_ID_INTEL_LYNXPOINT_1 ) || \
276 ( (x) == PCI_DEVICE_ID_INTEL_LYNXPOINT_2 ) || \
277 ( (x) == PCI_DEVICE_ID_INTEL_LYNXPOINT_3 ) || \
278 ( (x) == PCI_DEVICE_ID_INTEL_LYNXPOINT_4 ) || \
279 ( (x) == PCI_DEVICE_ID_INTEL_WILDCAT_1 ) || \
280 ( (x) == PCI_DEVICE_ID_INTEL_WILDCAT_2))