blob: d7b600adae3c0bd167fdeedf741c116a9c2ee2b9 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
3/*
4 * This is a ramstage driver for the Intel Management Engine found in the
5 * 6-series chipset. It handles the required boot-time messages over the
6 * MMIO-based Management Engine Interface to tell the ME that the BIOS is
7 * finished with POST. Additional messages are defined for debug but are
8 * not used unless the console loglevel is high enough.
9 */
10
Furquan Shaikh76cedd22020-05-02 10:24:23 -070011#include <acpi/acpi.h>
Kyösti Mälkki13f66502019-03-03 08:01:05 +020012#include <device/mmio.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020013#include <device/pci_ops.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050014#include <console/console.h>
Stefan Reinauer24d1d4b2013-03-21 11:51:41 -070015#include <device/device.h>
16#include <device/pci.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050017#include <device/pci_ids.h>
18#include <device/pci_def.h>
19#include <string.h>
20#include <delay.h>
21#include <elog.h>
Elyes HAOUAS400f9ca2019-06-23 07:01:22 +020022#include <stdlib.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050023
Kyösti Mälkki12b121c2019-08-18 16:33:39 +030024#include "chip.h"
Aaron Durbin76c37002012-10-30 09:03:43 -050025#include "me.h"
26#include "pch.h"
27
Aaron Durbin76c37002012-10-30 09:03:43 -050028#include <vendorcode/google/chromeos/chromeos.h>
Aaron Durbin76c37002012-10-30 09:03:43 -050029
Aaron Durbin76c37002012-10-30 09:03:43 -050030/* Path that the BIOS should take based on ME state */
Angel Pons10274d82021-02-23 14:19:28 +010031static const char *const me_bios_path_values[] = {
Aaron Durbin76c37002012-10-30 09:03:43 -050032 [ME_NORMAL_BIOS_PATH] = "Normal",
33 [ME_S3WAKE_BIOS_PATH] = "S3 Wake",
34 [ME_ERROR_BIOS_PATH] = "Error",
35 [ME_RECOVERY_BIOS_PATH] = "Recovery",
36 [ME_DISABLE_BIOS_PATH] = "Disable",
37 [ME_FIRMWARE_UPDATE_BIOS_PATH] = "Firmware Update",
38};
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +010039static int intel_me_read_mbp(me_bios_payload *mbp_data, struct device *dev);
Aaron Durbin76c37002012-10-30 09:03:43 -050040
41/* MMIO base address for MEI interface */
Angel Ponsa3492d72021-02-23 14:12:25 +010042static u8 *mei_base_address;
Aaron Durbin76c37002012-10-30 09:03:43 -050043
Aaron Durbin76c37002012-10-30 09:03:43 -050044static void mei_dump(void *ptr, int dword, int offset, const char *type)
45{
46 struct mei_csr *csr;
47
Kyösti Mälkkic86fc8e2019-11-06 06:32:27 +020048 if (!CONFIG(DEBUG_INTEL_ME))
49 return;
50
Aaron Durbin76c37002012-10-30 09:03:43 -050051 printk(BIOS_SPEW, "%-9s[%02x] : ", type, offset);
52
53 switch (offset) {
54 case MEI_H_CSR:
55 case MEI_ME_CSR_HA:
56 csr = ptr;
57 if (!csr) {
58 printk(BIOS_SPEW, "ERROR: 0x%08x\n", dword);
59 break;
60 }
61 printk(BIOS_SPEW, "cbd=%u cbrp=%02u cbwp=%02u ready=%u "
62 "reset=%u ig=%u is=%u ie=%u\n", csr->buffer_depth,
63 csr->buffer_read_ptr, csr->buffer_write_ptr,
64 csr->ready, csr->reset, csr->interrupt_generate,
65 csr->interrupt_status, csr->interrupt_enable);
66 break;
67 case MEI_ME_CB_RW:
68 case MEI_H_CB_WW:
69 printk(BIOS_SPEW, "CB: 0x%08x\n", dword);
70 break;
71 default:
72 printk(BIOS_SPEW, "0x%08x\n", offset);
73 break;
74 }
75}
Aaron Durbin76c37002012-10-30 09:03:43 -050076
77/*
78 * ME/MEI access helpers using memcpy to avoid aliasing.
79 */
80
81static inline void mei_read_dword_ptr(void *ptr, int offset)
82{
Angel Ponsa3492d72021-02-23 14:12:25 +010083 u32 dword = read32(mei_base_address + offset);
Aaron Durbin76c37002012-10-30 09:03:43 -050084 memcpy(ptr, &dword, sizeof(dword));
85 mei_dump(ptr, dword, offset, "READ");
86}
87
88static inline void mei_write_dword_ptr(void *ptr, int offset)
89{
90 u32 dword = 0;
91 memcpy(&dword, ptr, sizeof(dword));
Angel Ponsa3492d72021-02-23 14:12:25 +010092 write32(mei_base_address + offset, dword);
Aaron Durbin76c37002012-10-30 09:03:43 -050093 mei_dump(ptr, dword, offset, "WRITE");
94}
95
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +010096static inline void pci_read_dword_ptr(struct device *dev, void *ptr, int offset)
Aaron Durbin76c37002012-10-30 09:03:43 -050097{
98 u32 dword = pci_read_config32(dev, offset);
99 memcpy(ptr, &dword, sizeof(dword));
100 mei_dump(ptr, dword, offset, "PCI READ");
101}
Aaron Durbin76c37002012-10-30 09:03:43 -0500102
103static inline void read_host_csr(struct mei_csr *csr)
104{
105 mei_read_dword_ptr(csr, MEI_H_CSR);
106}
107
108static inline void write_host_csr(struct mei_csr *csr)
109{
110 mei_write_dword_ptr(csr, MEI_H_CSR);
111}
112
113static inline void read_me_csr(struct mei_csr *csr)
114{
115 mei_read_dword_ptr(csr, MEI_ME_CSR_HA);
116}
117
118static inline void write_cb(u32 dword)
119{
Angel Ponsa3492d72021-02-23 14:12:25 +0100120 write32(mei_base_address + MEI_H_CB_WW, dword);
Aaron Durbin76c37002012-10-30 09:03:43 -0500121 mei_dump(NULL, dword, MEI_H_CB_WW, "WRITE");
122}
123
124static inline u32 read_cb(void)
125{
Angel Ponsa3492d72021-02-23 14:12:25 +0100126 u32 dword = read32(mei_base_address + MEI_ME_CB_RW);
Aaron Durbin76c37002012-10-30 09:03:43 -0500127 mei_dump(NULL, dword, MEI_ME_CB_RW, "READ");
128 return dword;
129}
130
131/* Wait for ME ready bit to be asserted */
132static int mei_wait_for_me_ready(void)
133{
134 struct mei_csr me;
Martin Rothff744bf2019-10-23 21:46:03 -0600135 unsigned int try = ME_RETRY;
Aaron Durbin76c37002012-10-30 09:03:43 -0500136
137 while (try--) {
138 read_me_csr(&me);
139 if (me.ready)
140 return 0;
141 udelay(ME_DELAY);
142 }
143
144 printk(BIOS_ERR, "ME: failed to become ready\n");
145 return -1;
146}
147
148static void mei_reset(void)
149{
150 struct mei_csr host;
151
152 if (mei_wait_for_me_ready() < 0)
153 return;
154
155 /* Reset host and ME circular buffers for next message */
156 read_host_csr(&host);
157 host.reset = 1;
158 host.interrupt_generate = 1;
159 write_host_csr(&host);
160
161 if (mei_wait_for_me_ready() < 0)
162 return;
163
164 /* Re-init and indicate host is ready */
165 read_host_csr(&host);
166 host.interrupt_generate = 1;
167 host.ready = 1;
168 host.reset = 0;
169 write_host_csr(&host);
170}
171
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700172static int mei_send_packet(struct mei_header *mei, void *req_data)
Aaron Durbin76c37002012-10-30 09:03:43 -0500173{
174 struct mei_csr host;
Martin Rothff744bf2019-10-23 21:46:03 -0600175 unsigned int ndata, n;
Aaron Durbin76c37002012-10-30 09:03:43 -0500176 u32 *data;
177
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700178 /* Number of dwords to write */
Aaron Durbin76c37002012-10-30 09:03:43 -0500179 ndata = mei->length >> 2;
180
181 /* Pad non-dword aligned request message length */
182 if (mei->length & 3)
183 ndata++;
184 if (!ndata) {
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700185 printk(BIOS_DEBUG, "ME: request has no data\n");
Aaron Durbin76c37002012-10-30 09:03:43 -0500186 return -1;
187 }
188 ndata++; /* Add MEI header */
189
190 /*
191 * Make sure there is still room left in the circular buffer.
192 * Reset the buffer pointers if the requested message will not fit.
193 */
194 read_host_csr(&host);
195 if ((host.buffer_depth - host.buffer_write_ptr) < ndata) {
196 printk(BIOS_ERR, "ME: circular buffer full, resetting...\n");
197 mei_reset();
198 read_host_csr(&host);
199 }
200
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700201 /* Ensure the requested length will fit in the circular buffer. */
Aaron Durbin76c37002012-10-30 09:03:43 -0500202 if ((host.buffer_depth - host.buffer_write_ptr) < ndata) {
203 printk(BIOS_ERR, "ME: message (%u) too large for buffer (%u)\n",
204 ndata + 2, host.buffer_depth);
205 return -1;
206 }
207
208 /* Write MEI header */
209 mei_write_dword_ptr(mei, MEI_H_CB_WW);
210 ndata--;
211
Aaron Durbin76c37002012-10-30 09:03:43 -0500212 /* Write message data */
213 data = req_data;
214 for (n = 0; n < ndata; ++n)
215 write_cb(*data++);
216
217 /* Generate interrupt to the ME */
218 read_host_csr(&host);
219 host.interrupt_generate = 1;
220 write_host_csr(&host);
221
222 /* Make sure ME is ready after sending request data */
223 return mei_wait_for_me_ready();
224}
225
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700226static int mei_send_data(u8 me_address, u8 host_address,
227 void *req_data, int req_bytes)
228{
229 struct mei_header header = {
230 .client_address = me_address,
231 .host_address = host_address,
232 };
233 struct mei_csr host;
234 int current = 0;
235 u8 *req_ptr = req_data;
236
237 while (!header.is_complete) {
238 int remain = req_bytes - current;
239 int buf_len;
240
241 read_host_csr(&host);
242 buf_len = host.buffer_depth - host.buffer_write_ptr;
243
244 if (buf_len > remain) {
245 /* Send all remaining data as final message */
246 header.length = req_bytes - current;
247 header.is_complete = 1;
248 } else {
249 /* Send as much data as the buffer can hold */
250 header.length = buf_len;
251 }
252
253 mei_send_packet(&header, req_ptr);
254
255 req_ptr += header.length;
256 current += header.length;
257 }
258
259 return 0;
260}
261
262static int mei_send_header(u8 me_address, u8 host_address,
263 void *header, int header_len, int complete)
264{
265 struct mei_header mei = {
266 .client_address = me_address,
267 .host_address = host_address,
268 .length = header_len,
269 .is_complete = complete,
270 };
271 return mei_send_packet(&mei, header);
272}
273
274static int mei_recv_msg(void *header, int header_bytes,
Aaron Durbin76c37002012-10-30 09:03:43 -0500275 void *rsp_data, int rsp_bytes)
276{
277 struct mei_header mei_rsp;
Aaron Durbin76c37002012-10-30 09:03:43 -0500278 struct mei_csr me, host;
Martin Rothff744bf2019-10-23 21:46:03 -0600279 unsigned int ndata, n;
280 unsigned int expected;
Aaron Durbin76c37002012-10-30 09:03:43 -0500281 u32 *data;
282
283 /* Total number of dwords to read from circular buffer */
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700284 expected = (rsp_bytes + sizeof(mei_rsp) + header_bytes) >> 2;
Aaron Durbin76c37002012-10-30 09:03:43 -0500285 if (rsp_bytes & 3)
286 expected++;
287
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700288 if (mei_wait_for_me_ready() < 0)
289 return -1;
290
Aaron Durbin76c37002012-10-30 09:03:43 -0500291 /*
292 * The interrupt status bit does not appear to indicate that the
293 * message has actually been received. Instead we wait until the
294 * expected number of dwords are present in the circular buffer.
295 */
296 for (n = ME_RETRY; n; --n) {
297 read_me_csr(&me);
298 if ((me.buffer_write_ptr - me.buffer_read_ptr) >= expected)
299 break;
300 udelay(ME_DELAY);
301 }
302 if (!n) {
303 printk(BIOS_ERR, "ME: timeout waiting for data: expected "
304 "%u, available %u\n", expected,
305 me.buffer_write_ptr - me.buffer_read_ptr);
306 return -1;
307 }
308
309 /* Read and verify MEI response header from the ME */
310 mei_read_dword_ptr(&mei_rsp, MEI_ME_CB_RW);
311 if (!mei_rsp.is_complete) {
312 printk(BIOS_ERR, "ME: response is not complete\n");
313 return -1;
314 }
315
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700316 /* Handle non-dword responses and expect at least the header */
Aaron Durbin76c37002012-10-30 09:03:43 -0500317 ndata = mei_rsp.length >> 2;
318 if (mei_rsp.length & 3)
319 ndata++;
320 if (ndata != (expected - 1)) {
321 printk(BIOS_ERR, "ME: response is missing data %d != %d\n",
322 ndata, (expected - 1));
323 return -1;
324 }
325
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700326 /* Read response header from the ME */
327 data = header;
328 for (n = 0; n < (header_bytes >> 2); ++n)
329 *data++ = read_cb();
330 ndata -= header_bytes >> 2;
Aaron Durbin76c37002012-10-30 09:03:43 -0500331
332 /* Make sure caller passed a buffer with enough space */
333 if (ndata != (rsp_bytes >> 2)) {
334 printk(BIOS_ERR, "ME: not enough room in response buffer: "
335 "%u != %u\n", ndata, rsp_bytes >> 2);
336 return -1;
337 }
338
339 /* Read response data from the circular buffer */
340 data = rsp_data;
341 for (n = 0; n < ndata; ++n)
342 *data++ = read_cb();
343
344 /* Tell the ME that we have consumed the response */
345 read_host_csr(&host);
346 host.interrupt_status = 1;
347 host.interrupt_generate = 1;
348 write_host_csr(&host);
349
350 return mei_wait_for_me_ready();
351}
352
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700353static inline int mei_sendrecv_mkhi(struct mkhi_header *mkhi,
354 void *req_data, int req_bytes,
355 void *rsp_data, int rsp_bytes)
Aaron Durbin76c37002012-10-30 09:03:43 -0500356{
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700357 struct mkhi_header mkhi_rsp;
358
359 /* Send header */
360 if (mei_send_header(MEI_ADDRESS_MKHI, MEI_HOST_ADDRESS,
361 mkhi, sizeof(*mkhi), req_bytes ? 0 : 1) < 0)
Aaron Durbin76c37002012-10-30 09:03:43 -0500362 return -1;
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700363
364 /* Send data if available */
365 if (req_bytes && mei_send_data(MEI_ADDRESS_MKHI, MEI_HOST_ADDRESS,
366 req_data, req_bytes) < 0)
Aaron Durbin76c37002012-10-30 09:03:43 -0500367 return -1;
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700368
369 /* Return now if no response expected */
370 if (!rsp_bytes)
371 return 0;
372
373 /* Read header and data */
374 if (mei_recv_msg(&mkhi_rsp, sizeof(mkhi_rsp),
375 rsp_data, rsp_bytes) < 0)
376 return -1;
377
378 if (!mkhi_rsp.is_response ||
379 mkhi->group_id != mkhi_rsp.group_id ||
380 mkhi->command != mkhi_rsp.command) {
381 printk(BIOS_ERR, "ME: invalid response, group %u ?= %u,"
382 "command %u ?= %u, is_response %u\n", mkhi->group_id,
383 mkhi_rsp.group_id, mkhi->command, mkhi_rsp.command,
384 mkhi_rsp.is_response);
385 return -1;
386 }
387
Aaron Durbin76c37002012-10-30 09:03:43 -0500388 return 0;
389}
Duncan Laurie0dc0d132013-08-08 15:31:51 -0700390
Duncan Laurie3d299c42013-07-19 08:48:05 -0700391/*
392 * mbp give up routine. This path is taken if hfs.mpb_rdy is 0 or the read
393 * state machine on the BIOS end doesn't match the ME's state machine.
394 */
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +0100395static void intel_me_mbp_give_up(struct device *dev)
Duncan Laurie3d299c42013-07-19 08:48:05 -0700396{
397 struct mei_csr csr;
398
399 pci_write_config32(dev, PCI_ME_H_GS2, PCI_ME_MBP_GIVE_UP);
400
401 read_host_csr(&csr);
402 csr.reset = 1;
403 csr.interrupt_generate = 1;
404 write_host_csr(&csr);
405}
406
407/*
408 * mbp clear routine. This will wait for the ME to indicate that
409 * the MBP has been read and cleared.
410 */
Angel Pons10274d82021-02-23 14:19:28 +0100411static void intel_me_mbp_clear(struct device *dev)
Duncan Laurie3d299c42013-07-19 08:48:05 -0700412{
413 int count;
414 struct me_hfs2 hfs2;
415
416 /* Wait for the mbp_cleared indicator */
417 for (count = ME_RETRY; count > 0; --count) {
418 pci_read_dword_ptr(dev, &hfs2, PCI_ME_HFS2);
419 if (hfs2.mbp_cleared)
420 break;
421 udelay(ME_DELAY);
422 }
423
424 if (count == 0) {
425 printk(BIOS_WARNING, "ME: Timeout waiting for mbp_cleared\n");
426 intel_me_mbp_give_up(dev);
427 } else {
428 printk(BIOS_INFO, "ME: MBP cleared\n");
429 }
430}
431
Angel Pons10274d82021-02-23 14:19:28 +0100432static void me_print_fw_version(mbp_fw_version_name *vers_name)
Aaron Durbin76c37002012-10-30 09:03:43 -0500433{
Aaron Durbinbe985242012-12-12 12:40:33 -0600434 if (!vers_name) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500435 printk(BIOS_ERR, "ME: mbp missing version report\n");
436 return;
437 }
438
439 printk(BIOS_DEBUG, "ME: found version %d.%d.%d.%d\n",
440 vers_name->major_version, vers_name->minor_version,
441 vers_name->hotfix_version, vers_name->build_version);
442}
443
Edward O'Callaghan7bf4f482014-06-17 15:12:09 +1000444static inline void print_cap(const char *name, int state)
445{
446 printk(BIOS_DEBUG, "ME Capability: %-41s : %sabled\n",
447 name, state ? " en" : "dis");
448}
449
Aaron Durbin76c37002012-10-30 09:03:43 -0500450/* Get ME Firmware Capabilities */
Aaron Durbinbe985242012-12-12 12:40:33 -0600451static int mkhi_get_fwcaps(mbp_mefwcaps *cap)
Aaron Durbin76c37002012-10-30 09:03:43 -0500452{
453 u32 rule_id = 0;
454 struct me_fwcaps cap_msg;
455 struct mkhi_header mkhi = {
456 .group_id = MKHI_GROUP_ID_FWCAPS,
457 .command = MKHI_FWCAPS_GET_RULE,
458 };
Aaron Durbin76c37002012-10-30 09:03:43 -0500459
460 /* Send request and wait for response */
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700461 if (mei_sendrecv_mkhi(&mkhi, &rule_id, sizeof(u32),
462 &cap_msg, sizeof(cap_msg)) < 0) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500463 printk(BIOS_ERR, "ME: GET FWCAPS message failed\n");
464 return -1;
Elyes HAOUASba28e8d2016-08-31 19:22:16 +0200465 }
Aaron Durbin76c37002012-10-30 09:03:43 -0500466 *cap = cap_msg.caps_sku;
467 return 0;
468}
469
470/* Get ME Firmware Capabilities */
Angel Pons10274d82021-02-23 14:19:28 +0100471static void me_print_fwcaps(mbp_mefwcaps *cap)
Aaron Durbin76c37002012-10-30 09:03:43 -0500472{
Aaron Durbinbe985242012-12-12 12:40:33 -0600473 mbp_mefwcaps local_caps;
474 if (!cap) {
475 cap = &local_caps;
Aaron Durbin76c37002012-10-30 09:03:43 -0500476 printk(BIOS_ERR, "ME: mbp missing fwcaps report\n");
477 if (mkhi_get_fwcaps(cap))
478 return;
479 }
480
481 print_cap("Full Network manageability", cap->full_net);
482 print_cap("Regular Network manageability", cap->std_net);
483 print_cap("Manageability", cap->manageability);
Aaron Durbin76c37002012-10-30 09:03:43 -0500484 print_cap("IntelR Anti-Theft (AT)", cap->intel_at);
485 print_cap("IntelR Capability Licensing Service (CLS)", cap->intel_cls);
486 print_cap("IntelR Power Sharing Technology (MPC)", cap->intel_mpc);
487 print_cap("ICC Over Clocking", cap->icc_over_clocking);
Edward O'Callaghan7bf4f482014-06-17 15:12:09 +1000488 print_cap("Protected Audio Video Path (PAVP)", cap->pavp);
Aaron Durbin76c37002012-10-30 09:03:43 -0500489 print_cap("IPV6", cap->ipv6);
490 print_cap("KVM Remote Control (KVM)", cap->kvm);
491 print_cap("Outbreak Containment Heuristic (OCH)", cap->och);
492 print_cap("Virtual LAN (VLAN)", cap->vlan);
493 print_cap("TLS", cap->tls);
494 print_cap("Wireless LAN (WLAN)", cap->wlan);
495}
Aaron Durbin76c37002012-10-30 09:03:43 -0500496
Aaron Durbin76c37002012-10-30 09:03:43 -0500497/* Send END OF POST message to the ME */
Angel Pons10274d82021-02-23 14:19:28 +0100498static int mkhi_end_of_post(void)
Aaron Durbin76c37002012-10-30 09:03:43 -0500499{
500 struct mkhi_header mkhi = {
501 .group_id = MKHI_GROUP_ID_GEN,
502 .command = MKHI_END_OF_POST,
503 };
Aaron Durbin76c37002012-10-30 09:03:43 -0500504 u32 eop_ack;
505
506 /* Send request and wait for response */
Angel Pons08e8cab2020-06-18 15:20:37 +0200507 printk(BIOS_NOTICE, "ME: %s\n", __func__);
Duncan Laurie2017b4a2013-08-08 15:07:12 -0700508 if (mei_sendrecv_mkhi(&mkhi, NULL, 0, &eop_ack, sizeof(eop_ack)) < 0) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500509 printk(BIOS_ERR, "ME: END OF POST message failed\n");
510 return -1;
511 }
512
513 printk(BIOS_INFO, "ME: END OF POST message successful (%d)\n", eop_ack);
514 return 0;
515}
516
Angel Pons10274d82021-02-23 14:19:28 +0100517void intel_me_finalize(struct device *dev)
Duncan Laurieaf980622013-07-18 23:02:18 -0700518{
519 struct me_hfs hfs;
520 u32 reg32;
521
Angel Pons10274d82021-02-23 14:19:28 +0100522 reg32 = pci_read_config32(dev, PCI_BASE_ADDRESS_0);
Angel Ponsa3492d72021-02-23 14:12:25 +0100523 mei_base_address = (u8 *)(uintptr_t)(reg32 & ~PCI_BASE_ADDRESS_MEM_ATTR_MASK);
Duncan Laurieaf980622013-07-18 23:02:18 -0700524
525 /* S3 path will have hidden this device already */
Angel Ponsa3492d72021-02-23 14:12:25 +0100526 if (!mei_base_address || mei_base_address == (u8 *)0xfffffff0)
Duncan Laurieaf980622013-07-18 23:02:18 -0700527 return;
528
Duncan Laurie3d299c42013-07-19 08:48:05 -0700529 /* Wait for ME MBP Cleared indicator */
Angel Pons10274d82021-02-23 14:19:28 +0100530 intel_me_mbp_clear(dev);
Duncan Laurie3d299c42013-07-19 08:48:05 -0700531
Duncan Laurieaf980622013-07-18 23:02:18 -0700532 /* Make sure ME is in a mode that expects EOP */
Angel Pons10274d82021-02-23 14:19:28 +0100533 reg32 = pci_read_config32(dev, PCI_ME_HFS);
Duncan Laurieaf980622013-07-18 23:02:18 -0700534 memcpy(&hfs, &reg32, sizeof(u32));
535
536 /* Abort and leave device alone if not normal mode */
537 if (hfs.fpt_bad ||
538 hfs.working_state != ME_HFS_CWS_NORMAL ||
539 hfs.operation_mode != ME_HFS_MODE_NORMAL)
540 return;
541
542 /* Try to send EOP command so ME stops accepting other commands */
543 mkhi_end_of_post();
544
545 /* Make sure IO is disabled */
Angel Pons10274d82021-02-23 14:19:28 +0100546 pci_and_config16(dev, PCI_COMMAND,
Angel Ponsbf9bc502020-06-08 00:12:43 +0200547 ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO));
Duncan Laurieaf980622013-07-18 23:02:18 -0700548
549 /* Hide the PCI device */
550 RCBA32_OR(FD2, PCH_DISABLE_MEI1);
551}
552
Edward O'Callaghan97ccefd2015-01-07 15:53:00 +1100553static inline int mei_sendrecv_icc(struct icc_header *icc,
554 void *req_data, int req_bytes,
555 void *rsp_data, int rsp_bytes)
556{
557 struct icc_header icc_rsp;
558
559 /* Send header */
560 if (mei_send_header(MEI_ADDRESS_ICC, MEI_HOST_ADDRESS,
561 icc, sizeof(*icc), req_bytes ? 0 : 1) < 0)
562 return -1;
563
564 /* Send data if available */
565 if (req_bytes && mei_send_data(MEI_ADDRESS_ICC, MEI_HOST_ADDRESS,
566 req_data, req_bytes) < 0)
567 return -1;
568
569 /* Read header and data, if needed */
570 if (rsp_bytes && mei_recv_msg(&icc_rsp, sizeof(icc_rsp),
571 rsp_data, rsp_bytes) < 0)
572 return -1;
573
574 return 0;
575}
576
Duncan Laurie0dc0d132013-08-08 15:31:51 -0700577static int me_icc_set_clock_enables(u32 mask)
578{
579 struct icc_clock_enables_msg clk = {
580 .clock_enables = 0, /* Turn off specified clocks */
581 .clock_mask = mask,
582 .no_response = 1, /* Do not expect response */
583 };
584 struct icc_header icc = {
585 .api_version = ICC_API_VERSION_LYNXPOINT,
586 .icc_command = ICC_SET_CLOCK_ENABLES,
587 .length = sizeof(clk),
588 };
589
590 /* Send request and wait for response */
591 if (mei_sendrecv_icc(&icc, &clk, sizeof(clk), NULL, 0) < 0) {
592 printk(BIOS_ERR, "ME: ICC SET CLOCK ENABLES message failed\n");
593 return -1;
Duncan Laurie0dc0d132013-08-08 15:31:51 -0700594 }
595
Elyes HAOUAS54f94242018-10-25 10:57:39 +0200596 printk(BIOS_INFO, "ME: ICC SET CLOCK ENABLES 0x%08x\n", mask);
Duncan Laurie0dc0d132013-08-08 15:31:51 -0700597 return 0;
598}
599
Aaron Durbin76c37002012-10-30 09:03:43 -0500600/* Determine the path that we should take based on ME status */
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +0100601static me_bios_path intel_me_path(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500602{
603 me_bios_path path = ME_DISABLE_BIOS_PATH;
604 struct me_hfs hfs;
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500605 struct me_hfs2 hfs2;
Aaron Durbin76c37002012-10-30 09:03:43 -0500606
Aaron Durbin76c37002012-10-30 09:03:43 -0500607 pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS);
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500608 pci_read_dword_ptr(dev, &hfs2, PCI_ME_HFS2);
Aaron Durbin76c37002012-10-30 09:03:43 -0500609
610 /* Check and dump status */
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500611 intel_me_status(&hfs, &hfs2);
Aaron Durbin76c37002012-10-30 09:03:43 -0500612
613 /* Check Current Working State */
614 switch (hfs.working_state) {
615 case ME_HFS_CWS_NORMAL:
616 path = ME_NORMAL_BIOS_PATH;
617 break;
618 case ME_HFS_CWS_REC:
619 path = ME_RECOVERY_BIOS_PATH;
620 break;
621 default:
622 path = ME_DISABLE_BIOS_PATH;
623 break;
624 }
625
626 /* Check Current Operation Mode */
627 switch (hfs.operation_mode) {
628 case ME_HFS_MODE_NORMAL:
629 break;
630 case ME_HFS_MODE_DEBUG:
631 case ME_HFS_MODE_DIS:
632 case ME_HFS_MODE_OVER_JMPR:
633 case ME_HFS_MODE_OVER_MEI:
634 default:
635 path = ME_DISABLE_BIOS_PATH;
636 break;
637 }
638
639 /* Check for any error code and valid firmware and MBP */
640 if (hfs.error_code || hfs.fpt_bad)
641 path = ME_ERROR_BIOS_PATH;
642
643 /* Check if the MBP is ready */
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500644 if (!hfs2.mbp_rdy) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500645 printk(BIOS_CRIT, "%s: mbp is not ready!\n",
Angel Pons08e8cab2020-06-18 15:20:37 +0200646 __func__);
Aaron Durbin76c37002012-10-30 09:03:43 -0500647 path = ME_ERROR_BIOS_PATH;
648 }
649
Kyösti Mälkkibe5317f2019-11-06 12:07:21 +0200650 if (CONFIG(ELOG) && path != ME_NORMAL_BIOS_PATH) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500651 struct elog_event_data_me_extended data = {
652 .current_working_state = hfs.working_state,
653 .operation_state = hfs.operation_state,
654 .operation_mode = hfs.operation_mode,
655 .error_code = hfs.error_code,
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500656 .progress_code = hfs2.progress_code,
657 .current_pmevent = hfs2.current_pmevent,
658 .current_state = hfs2.current_state,
Aaron Durbin76c37002012-10-30 09:03:43 -0500659 };
660 elog_add_event_byte(ELOG_TYPE_MANAGEMENT_ENGINE, path);
661 elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT,
662 &data, sizeof(data));
663 }
Aaron Durbin76c37002012-10-30 09:03:43 -0500664
665 return path;
666}
667
668/* Prepare ME for MEI messages */
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +0100669static int intel_mei_setup(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500670{
671 struct resource *res;
672 struct mei_csr host;
Aaron Durbin76c37002012-10-30 09:03:43 -0500673
674 /* Find the MMIO base for the ME interface */
675 res = find_resource(dev, PCI_BASE_ADDRESS_0);
676 if (!res || res->base == 0 || res->size == 0) {
677 printk(BIOS_DEBUG, "ME: MEI resource not present!\n");
678 return -1;
679 }
Angel Ponsd32b5142021-02-23 14:23:49 +0100680 mei_base_address = res2mmio(res, 0, 0);
Aaron Durbin76c37002012-10-30 09:03:43 -0500681
682 /* Ensure Memory and Bus Master bits are set */
Angel Ponsd5d4fbc2020-05-31 01:03:59 +0200683 pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
Aaron Durbin76c37002012-10-30 09:03:43 -0500684
685 /* Clean up status for next message */
686 read_host_csr(&host);
687 host.interrupt_generate = 1;
688 host.ready = 1;
689 host.reset = 0;
690 write_host_csr(&host);
691
692 return 0;
693}
694
695/* Read the Extend register hash of ME firmware */
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +0100696static int intel_me_extend_valid(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500697{
698 struct me_heres status;
699 u32 extend[8] = {0};
700 int i, count = 0;
701
702 pci_read_dword_ptr(dev, &status, PCI_ME_HERES);
703 if (!status.extend_feature_present) {
704 printk(BIOS_ERR, "ME: Extend Feature not present\n");
705 return -1;
706 }
707
708 if (!status.extend_reg_valid) {
709 printk(BIOS_ERR, "ME: Extend Register not valid\n");
710 return -1;
711 }
712
713 switch (status.extend_reg_algorithm) {
714 case PCI_ME_EXT_SHA1:
715 count = 5;
716 printk(BIOS_DEBUG, "ME: Extend SHA-1: ");
717 break;
718 case PCI_ME_EXT_SHA256:
719 count = 8;
720 printk(BIOS_DEBUG, "ME: Extend SHA-256: ");
721 break;
722 default:
723 printk(BIOS_ERR, "ME: Extend Algorithm %d unknown\n",
724 status.extend_reg_algorithm);
725 return -1;
726 }
727
728 for (i = 0; i < count; ++i) {
729 extend[i] = pci_read_config32(dev, PCI_ME_HER(i));
730 printk(BIOS_DEBUG, "%08x", extend[i]);
731 }
732 printk(BIOS_DEBUG, "\n");
733
Aaron Durbin76c37002012-10-30 09:03:43 -0500734 /* Save hash in NVS for the OS to verify */
Kyösti Mälkki26e0f4c2020-12-19 19:10:45 +0200735 if (CONFIG(CHROMEOS))
736 chromeos_set_me_hash(extend, count);
Aaron Durbin76c37002012-10-30 09:03:43 -0500737
738 return 0;
739}
740
Aaron Durbin76c37002012-10-30 09:03:43 -0500741/* Check whether ME is present and do basic init */
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +0100742static void intel_me_init(struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500743{
Duncan Laurie0dc0d132013-08-08 15:31:51 -0700744 struct southbridge_intel_lynxpoint_config *config = dev->chip_info;
Aaron Durbin76c37002012-10-30 09:03:43 -0500745 me_bios_path path = intel_me_path(dev);
746 me_bios_payload mbp_data;
747
748 /* Do initial setup and determine the BIOS path */
749 printk(BIOS_NOTICE, "ME: BIOS path: %s\n", me_bios_path_values[path]);
750
Duncan Laurie8056dc62013-07-22 08:47:43 -0700751 if (path == ME_NORMAL_BIOS_PATH) {
Aaron Durbin76c37002012-10-30 09:03:43 -0500752 /* Validate the extend register */
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500753 intel_me_extend_valid(dev);
754 }
Aaron Durbin76c37002012-10-30 09:03:43 -0500755
Aaron Durbinbe985242012-12-12 12:40:33 -0600756 memset(&mbp_data, 0, sizeof(mbp_data));
757
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500758 /*
759 * According to the ME9 BWG, BIOS is required to fetch MBP data in
760 * all boot flows except S3 Resume.
761 */
Aaron Durbin76c37002012-10-30 09:03:43 -0500762
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500763 /* Prepare MEI MMIO interface */
764 if (intel_mei_setup(dev) < 0)
765 return;
Aaron Durbin76c37002012-10-30 09:03:43 -0500766
Duncan Laurie144f7b22013-05-01 11:27:58 -0700767 if (intel_me_read_mbp(&mbp_data, dev))
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500768 return;
Aaron Durbin76c37002012-10-30 09:03:43 -0500769
Kyösti Mälkkic86fc8e2019-11-06 06:32:27 +0200770 if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG) {
771 me_print_fw_version(mbp_data.fw_version_name);
Duncan Laurie144f7b22013-05-01 11:27:58 -0700772
Kyösti Mälkkic86fc8e2019-11-06 06:32:27 +0200773 if (CONFIG(DEBUG_INTEL_ME))
774 me_print_fwcaps(mbp_data.fw_capabilities);
775
776 if (mbp_data.plat_time) {
777 printk(BIOS_DEBUG, "ME: Wake Event to ME Reset: %u ms\n",
778 mbp_data.plat_time->wake_event_mrst_time_ms);
779 printk(BIOS_DEBUG, "ME: ME Reset to Platform Reset: %u ms\n",
780 mbp_data.plat_time->mrst_pltrst_time_ms);
781 printk(BIOS_DEBUG, "ME: Platform Reset to CPU Reset: %u ms\n",
782 mbp_data.plat_time->pltrst_cpurst_time_ms);
783 }
Duncan Laurie144f7b22013-05-01 11:27:58 -0700784 }
Aaron Durbin76c37002012-10-30 09:03:43 -0500785
Duncan Laurie0dc0d132013-08-08 15:31:51 -0700786 /* Set clock enables according to devicetree */
787 if (config && config->icc_clock_disable)
788 me_icc_set_clock_enables(config->icc_clock_disable);
789
Duncan Laurieaf980622013-07-18 23:02:18 -0700790 /*
Angel Pons10274d82021-02-23 14:19:28 +0100791 * Leave the ME unlocked. It will be locked later.
Duncan Laurieaf980622013-07-18 23:02:18 -0700792 */
Aaron Durbin76c37002012-10-30 09:03:43 -0500793}
794
Elyes HAOUAS1dcd8db2018-12-05 10:59:42 +0100795static void intel_me_enable(struct device *dev)
Duncan Laurie8056dc62013-07-22 08:47:43 -0700796{
Duncan Laurie8056dc62013-07-22 08:47:43 -0700797 /* Avoid talking to the device in S3 path */
Kyösti Mälkkic3ed8862014-06-19 19:50:51 +0300798 if (acpi_is_wakeup_s3()) {
Duncan Laurie8056dc62013-07-22 08:47:43 -0700799 dev->enabled = 0;
800 pch_disable_devfn(dev);
801 }
Duncan Laurie8056dc62013-07-22 08:47:43 -0700802}
803
Aaron Durbin76c37002012-10-30 09:03:43 -0500804static struct device_operations device_ops = {
805 .read_resources = pci_dev_read_resources,
806 .set_resources = pci_dev_set_resources,
807 .enable_resources = pci_dev_enable_resources,
Duncan Laurie8056dc62013-07-22 08:47:43 -0700808 .enable = intel_me_enable,
Aaron Durbin76c37002012-10-30 09:03:43 -0500809 .init = intel_me_init,
Angel Pons10274d82021-02-23 14:19:28 +0100810 .final = intel_me_finalize,
Angel Pons1fc0edd2020-05-31 00:03:28 +0200811 .ops_pci = &pci_dev_ops_pci,
Aaron Durbin76c37002012-10-30 09:03:43 -0500812};
813
Duncan Laurie26e7dd72012-12-19 09:12:31 -0800814static const unsigned short pci_device_ids[] = {
Felix Singer4ea08f92020-11-20 12:56:44 +0000815 PCI_DEVICE_ID_INTEL_LPT_H_MEI,
816 PCI_DEVICE_ID_INTEL_LPT_LP_MEI,
Duncan Laurie26e7dd72012-12-19 09:12:31 -0800817 0
818};
819
Aaron Durbin76c37002012-10-30 09:03:43 -0500820static const struct pci_driver intel_me __pci_driver = {
Angel Ponsb4b4e322020-06-21 12:47:13 +0200821 .ops = &device_ops,
822 .vendor = PCI_VENDOR_ID_INTEL,
823 .devices = pci_device_ids,
Aaron Durbin76c37002012-10-30 09:03:43 -0500824};
825
826/******************************************************************************
827 * */
828static u32 me_to_host_words_pending(void)
829{
830 struct mei_csr me;
831 read_me_csr(&me);
832 if (!me.ready)
833 return 0;
834 return (me.buffer_write_ptr - me.buffer_read_ptr) &
835 (me.buffer_depth - 1);
836}
837
Aaron Durbinbe985242012-12-12 12:40:33 -0600838struct mbp_payload {
839 mbp_header header;
840 u32 data[0];
841};
842
Aaron Durbin76c37002012-10-30 09:03:43 -0500843/*
844 * mbp seems to be following its own flow, let's retrieve it in a dedicated
845 * function.
846 */
Angel Pons10274d82021-02-23 14:19:28 +0100847static int intel_me_read_mbp(me_bios_payload *mbp_data, struct device *dev)
Aaron Durbin76c37002012-10-30 09:03:43 -0500848{
849 mbp_header mbp_hdr;
Aaron Durbin76c37002012-10-30 09:03:43 -0500850 u32 me2host_pending;
Aaron Durbin76c37002012-10-30 09:03:43 -0500851 struct mei_csr host;
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500852 struct me_hfs2 hfs2;
Aaron Durbinbe985242012-12-12 12:40:33 -0600853 struct mbp_payload *mbp;
854 int i;
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500855
856 pci_read_dword_ptr(dev, &hfs2, PCI_ME_HFS2);
857
858 if (!hfs2.mbp_rdy) {
859 printk(BIOS_ERR, "ME: MBP not ready\n");
860 goto mbp_failure;
861 }
Aaron Durbin76c37002012-10-30 09:03:43 -0500862
863 me2host_pending = me_to_host_words_pending();
864 if (!me2host_pending) {
865 printk(BIOS_ERR, "ME: no mbp data!\n");
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500866 goto mbp_failure;
Aaron Durbin76c37002012-10-30 09:03:43 -0500867 }
868
869 /* we know for sure that at least the header is there */
870 mei_read_dword_ptr(&mbp_hdr, MEI_ME_CB_RW);
871
872 if ((mbp_hdr.num_entries > (mbp_hdr.mbp_size / 2)) ||
873 (me2host_pending < mbp_hdr.mbp_size)) {
874 printk(BIOS_ERR, "ME: mbp of %d entries, total size %d words"
875 " buffer contains %d words\n",
876 mbp_hdr.num_entries, mbp_hdr.mbp_size,
877 me2host_pending);
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500878 goto mbp_failure;
Aaron Durbin76c37002012-10-30 09:03:43 -0500879 }
Aaron Durbinbe985242012-12-12 12:40:33 -0600880 mbp = malloc(mbp_hdr.mbp_size * sizeof(u32));
881 if (!mbp)
882 goto mbp_failure;
Aaron Durbin76c37002012-10-30 09:03:43 -0500883
Aaron Durbinbe985242012-12-12 12:40:33 -0600884 mbp->header = mbp_hdr;
Aaron Durbin76c37002012-10-30 09:03:43 -0500885 me2host_pending--;
Aaron Durbin76c37002012-10-30 09:03:43 -0500886
Aaron Durbinbe985242012-12-12 12:40:33 -0600887 i = 0;
888 while (i != me2host_pending) {
889 mei_read_dword_ptr(&mbp->data[i], MEI_ME_CB_RW);
890 i++;
Aaron Durbin76c37002012-10-30 09:03:43 -0500891 }
892
Aaron Durbinbe985242012-12-12 12:40:33 -0600893 /* Signal to the ME that the host has finished reading the MBP. */
Aaron Durbin76c37002012-10-30 09:03:43 -0500894 read_host_csr(&host);
895 host.interrupt_generate = 1;
896 write_host_csr(&host);
897
Aaron Durbinbe985242012-12-12 12:40:33 -0600898 /* Dump out the MBP contents. */
Kyösti Mälkkic86fc8e2019-11-06 06:32:27 +0200899 if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG) {
900 printk(BIOS_INFO, "ME MBP: Header: items: %d, size dw: %d\n",
901 mbp->header.num_entries, mbp->header.mbp_size);
902 if (CONFIG(DEBUG_INTEL_ME)) {
903 for (i = 0; i < mbp->header.mbp_size - 1; i++) {
904 printk(BIOS_INFO, "ME MBP: %04x: 0x%08x\n", i, mbp->data[i]);
905 }
906 }
Aaron Durbinbe985242012-12-12 12:40:33 -0600907 }
Aaron Durbinbe985242012-12-12 12:40:33 -0600908
909 #define ASSIGN_FIELD_PTR(field_,val_) \
910 { \
911 mbp_data->field_ = (typeof(mbp_data->field_))(void *)val_; \
912 break; \
913 }
914 /* Setup the pointers in the me_bios_payload structure. */
915 for (i = 0; i < mbp->header.mbp_size - 1;) {
916 mbp_item_header *item = (void *)&mbp->data[i];
917
Elyes HAOUASf9de5a42018-05-03 17:21:02 +0200918 switch (MBP_MAKE_IDENT(item->app_id, item->item_id)) {
Aaron Durbinbe985242012-12-12 12:40:33 -0600919 case MBP_IDENT(KERNEL, FW_VER):
920 ASSIGN_FIELD_PTR(fw_version_name, &mbp->data[i+1]);
921
922 case MBP_IDENT(ICC, PROFILE):
923 ASSIGN_FIELD_PTR(icc_profile, &mbp->data[i+1]);
924
925 case MBP_IDENT(INTEL_AT, STATE):
926 ASSIGN_FIELD_PTR(at_state, &mbp->data[i+1]);
927
928 case MBP_IDENT(KERNEL, FW_CAP):
929 ASSIGN_FIELD_PTR(fw_capabilities, &mbp->data[i+1]);
930
931 case MBP_IDENT(KERNEL, ROM_BIST):
932 ASSIGN_FIELD_PTR(rom_bist_data, &mbp->data[i+1]);
933
934 case MBP_IDENT(KERNEL, PLAT_KEY):
935 ASSIGN_FIELD_PTR(platform_key, &mbp->data[i+1]);
936
937 case MBP_IDENT(KERNEL, FW_TYPE):
938 ASSIGN_FIELD_PTR(fw_plat_type, &mbp->data[i+1]);
939
940 case MBP_IDENT(KERNEL, MFS_FAILURE):
941 ASSIGN_FIELD_PTR(mfsintegrity, &mbp->data[i+1]);
942
Duncan Laurie144f7b22013-05-01 11:27:58 -0700943 case MBP_IDENT(KERNEL, PLAT_TIME):
944 ASSIGN_FIELD_PTR(plat_time, &mbp->data[i+1]);
945
946 case MBP_IDENT(NFC, SUPPORT_DATA):
947 ASSIGN_FIELD_PTR(nfc_data, &mbp->data[i+1]);
948
Aaron Durbinbe985242012-12-12 12:40:33 -0600949 default:
Duncan Laurie0b3cd362013-08-08 15:40:01 -0700950 printk(BIOS_ERR, "ME MBP: unknown item 0x%x @ "
951 "dw offset 0x%x\n", mbp->data[i], i);
Aaron Durbinbe985242012-12-12 12:40:33 -0600952 break;
953 }
954 i += item->length;
955 }
956 #undef ASSIGN_FIELD_PTR
957
Aaron Durbin76c37002012-10-30 09:03:43 -0500958 return 0;
Aaron Durbin9aa031e2012-11-02 09:16:46 -0500959
960mbp_failure:
961 intel_me_mbp_give_up(dev);
962 return -1;
Aaron Durbin76c37002012-10-30 09:03:43 -0500963}