Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 The Chromium OS Authors. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * This is a ramstage driver for the Intel Management Engine found in the |
| 19 | * 6-series chipset. It handles the required boot-time messages over the |
| 20 | * MMIO-based Management Engine Interface to tell the ME that the BIOS is |
| 21 | * finished with POST. Additional messages are defined for debug but are |
| 22 | * not used unless the console loglevel is high enough. |
| 23 | */ |
| 24 | |
| 25 | #include <arch/acpi.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 26 | #include <arch/io.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame^] | 27 | #include <device/pci_ops.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 28 | #include <console/console.h> |
Stefan Reinauer | 24d1d4b | 2013-03-21 11:51:41 -0700 | [diff] [blame] | 29 | #include <device/device.h> |
| 30 | #include <device/pci.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 31 | #include <device/pci_ids.h> |
| 32 | #include <device/pci_def.h> |
| 33 | #include <string.h> |
| 34 | #include <delay.h> |
| 35 | #include <elog.h> |
Patrick Georgi | 546953c | 2014-11-29 10:38:17 +0100 | [diff] [blame] | 36 | #include <halt.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 37 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 38 | #include "me.h" |
| 39 | #include "pch.h" |
| 40 | |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 41 | #if IS_ENABLED(CONFIG_CHROMEOS) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 42 | #include <vendorcode/google/chromeos/chromeos.h> |
| 43 | #include <vendorcode/google/chromeos/gnvs.h> |
| 44 | #endif |
| 45 | |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 46 | #ifndef __SMM__ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 47 | /* Path that the BIOS should take based on ME state */ |
| 48 | static const char *me_bios_path_values[] = { |
| 49 | [ME_NORMAL_BIOS_PATH] = "Normal", |
| 50 | [ME_S3WAKE_BIOS_PATH] = "S3 Wake", |
| 51 | [ME_ERROR_BIOS_PATH] = "Error", |
| 52 | [ME_RECOVERY_BIOS_PATH] = "Recovery", |
| 53 | [ME_DISABLE_BIOS_PATH] = "Disable", |
| 54 | [ME_FIRMWARE_UPDATE_BIOS_PATH] = "Firmware Update", |
| 55 | }; |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 56 | static int intel_me_read_mbp(me_bios_payload *mbp_data, struct device *dev); |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 57 | #endif |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 58 | |
| 59 | /* MMIO base address for MEI interface */ |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 60 | static u32 *mei_base_address; |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 61 | #ifdef __SIMPLE_DEVICE__ |
| 62 | void intel_me_mbp_clear(pci_devfn_t dev); |
| 63 | #else |
| 64 | void intel_me_mbp_clear(struct device *dev); |
| 65 | #endif |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 66 | |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 67 | #if IS_ENABLED(CONFIG_DEBUG_INTEL_ME) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 68 | static void mei_dump(void *ptr, int dword, int offset, const char *type) |
| 69 | { |
| 70 | struct mei_csr *csr; |
| 71 | |
| 72 | printk(BIOS_SPEW, "%-9s[%02x] : ", type, offset); |
| 73 | |
| 74 | switch (offset) { |
| 75 | case MEI_H_CSR: |
| 76 | case MEI_ME_CSR_HA: |
| 77 | csr = ptr; |
| 78 | if (!csr) { |
| 79 | printk(BIOS_SPEW, "ERROR: 0x%08x\n", dword); |
| 80 | break; |
| 81 | } |
| 82 | printk(BIOS_SPEW, "cbd=%u cbrp=%02u cbwp=%02u ready=%u " |
| 83 | "reset=%u ig=%u is=%u ie=%u\n", csr->buffer_depth, |
| 84 | csr->buffer_read_ptr, csr->buffer_write_ptr, |
| 85 | csr->ready, csr->reset, csr->interrupt_generate, |
| 86 | csr->interrupt_status, csr->interrupt_enable); |
| 87 | break; |
| 88 | case MEI_ME_CB_RW: |
| 89 | case MEI_H_CB_WW: |
| 90 | printk(BIOS_SPEW, "CB: 0x%08x\n", dword); |
| 91 | break; |
| 92 | default: |
| 93 | printk(BIOS_SPEW, "0x%08x\n", offset); |
| 94 | break; |
| 95 | } |
| 96 | } |
| 97 | #else |
| 98 | # define mei_dump(ptr,dword,offset,type) do {} while (0) |
| 99 | #endif |
| 100 | |
| 101 | /* |
| 102 | * ME/MEI access helpers using memcpy to avoid aliasing. |
| 103 | */ |
| 104 | |
| 105 | static inline void mei_read_dword_ptr(void *ptr, int offset) |
| 106 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 107 | u32 dword = read32(mei_base_address + (offset/sizeof(u32))); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 108 | memcpy(ptr, &dword, sizeof(dword)); |
| 109 | mei_dump(ptr, dword, offset, "READ"); |
| 110 | } |
| 111 | |
| 112 | static inline void mei_write_dword_ptr(void *ptr, int offset) |
| 113 | { |
| 114 | u32 dword = 0; |
| 115 | memcpy(&dword, ptr, sizeof(dword)); |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 116 | write32(mei_base_address + (offset/sizeof(u32)), dword); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 117 | mei_dump(ptr, dword, offset, "WRITE"); |
| 118 | } |
| 119 | |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 120 | #ifdef __SIMPLE_DEVICE__ |
| 121 | static inline void pci_read_dword_ptr(pci_devfn_t dev, void *ptr, int offset) |
| 122 | #else |
| 123 | static inline void pci_read_dword_ptr(struct device *dev, void *ptr, int offset) |
| 124 | #endif |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 125 | { |
| 126 | u32 dword = pci_read_config32(dev, offset); |
| 127 | memcpy(ptr, &dword, sizeof(dword)); |
| 128 | mei_dump(ptr, dword, offset, "PCI READ"); |
| 129 | } |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 130 | |
| 131 | static inline void read_host_csr(struct mei_csr *csr) |
| 132 | { |
| 133 | mei_read_dword_ptr(csr, MEI_H_CSR); |
| 134 | } |
| 135 | |
| 136 | static inline void write_host_csr(struct mei_csr *csr) |
| 137 | { |
| 138 | mei_write_dword_ptr(csr, MEI_H_CSR); |
| 139 | } |
| 140 | |
| 141 | static inline void read_me_csr(struct mei_csr *csr) |
| 142 | { |
| 143 | mei_read_dword_ptr(csr, MEI_ME_CSR_HA); |
| 144 | } |
| 145 | |
| 146 | static inline void write_cb(u32 dword) |
| 147 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 148 | write32(mei_base_address + (MEI_H_CB_WW/sizeof(u32)), dword); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 149 | mei_dump(NULL, dword, MEI_H_CB_WW, "WRITE"); |
| 150 | } |
| 151 | |
| 152 | static inline u32 read_cb(void) |
| 153 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 154 | u32 dword = read32(mei_base_address + (MEI_ME_CB_RW/sizeof(u32))); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 155 | mei_dump(NULL, dword, MEI_ME_CB_RW, "READ"); |
| 156 | return dword; |
| 157 | } |
| 158 | |
| 159 | /* Wait for ME ready bit to be asserted */ |
| 160 | static int mei_wait_for_me_ready(void) |
| 161 | { |
| 162 | struct mei_csr me; |
| 163 | unsigned try = ME_RETRY; |
| 164 | |
| 165 | while (try--) { |
| 166 | read_me_csr(&me); |
| 167 | if (me.ready) |
| 168 | return 0; |
| 169 | udelay(ME_DELAY); |
| 170 | } |
| 171 | |
| 172 | printk(BIOS_ERR, "ME: failed to become ready\n"); |
| 173 | return -1; |
| 174 | } |
| 175 | |
| 176 | static void mei_reset(void) |
| 177 | { |
| 178 | struct mei_csr host; |
| 179 | |
| 180 | if (mei_wait_for_me_ready() < 0) |
| 181 | return; |
| 182 | |
| 183 | /* Reset host and ME circular buffers for next message */ |
| 184 | read_host_csr(&host); |
| 185 | host.reset = 1; |
| 186 | host.interrupt_generate = 1; |
| 187 | write_host_csr(&host); |
| 188 | |
| 189 | if (mei_wait_for_me_ready() < 0) |
| 190 | return; |
| 191 | |
| 192 | /* Re-init and indicate host is ready */ |
| 193 | read_host_csr(&host); |
| 194 | host.interrupt_generate = 1; |
| 195 | host.ready = 1; |
| 196 | host.reset = 0; |
| 197 | write_host_csr(&host); |
| 198 | } |
| 199 | |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 200 | static int mei_send_packet(struct mei_header *mei, void *req_data) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 201 | { |
| 202 | struct mei_csr host; |
| 203 | unsigned ndata, n; |
| 204 | u32 *data; |
| 205 | |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 206 | /* Number of dwords to write */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 207 | ndata = mei->length >> 2; |
| 208 | |
| 209 | /* Pad non-dword aligned request message length */ |
| 210 | if (mei->length & 3) |
| 211 | ndata++; |
| 212 | if (!ndata) { |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 213 | printk(BIOS_DEBUG, "ME: request has no data\n"); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 214 | return -1; |
| 215 | } |
| 216 | ndata++; /* Add MEI header */ |
| 217 | |
| 218 | /* |
| 219 | * Make sure there is still room left in the circular buffer. |
| 220 | * Reset the buffer pointers if the requested message will not fit. |
| 221 | */ |
| 222 | read_host_csr(&host); |
| 223 | if ((host.buffer_depth - host.buffer_write_ptr) < ndata) { |
| 224 | printk(BIOS_ERR, "ME: circular buffer full, resetting...\n"); |
| 225 | mei_reset(); |
| 226 | read_host_csr(&host); |
| 227 | } |
| 228 | |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 229 | /* Ensure the requested length will fit in the circular buffer. */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 230 | if ((host.buffer_depth - host.buffer_write_ptr) < ndata) { |
| 231 | printk(BIOS_ERR, "ME: message (%u) too large for buffer (%u)\n", |
| 232 | ndata + 2, host.buffer_depth); |
| 233 | return -1; |
| 234 | } |
| 235 | |
| 236 | /* Write MEI header */ |
| 237 | mei_write_dword_ptr(mei, MEI_H_CB_WW); |
| 238 | ndata--; |
| 239 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 240 | /* Write message data */ |
| 241 | data = req_data; |
| 242 | for (n = 0; n < ndata; ++n) |
| 243 | write_cb(*data++); |
| 244 | |
| 245 | /* Generate interrupt to the ME */ |
| 246 | read_host_csr(&host); |
| 247 | host.interrupt_generate = 1; |
| 248 | write_host_csr(&host); |
| 249 | |
| 250 | /* Make sure ME is ready after sending request data */ |
| 251 | return mei_wait_for_me_ready(); |
| 252 | } |
| 253 | |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 254 | static int mei_send_data(u8 me_address, u8 host_address, |
| 255 | void *req_data, int req_bytes) |
| 256 | { |
| 257 | struct mei_header header = { |
| 258 | .client_address = me_address, |
| 259 | .host_address = host_address, |
| 260 | }; |
| 261 | struct mei_csr host; |
| 262 | int current = 0; |
| 263 | u8 *req_ptr = req_data; |
| 264 | |
| 265 | while (!header.is_complete) { |
| 266 | int remain = req_bytes - current; |
| 267 | int buf_len; |
| 268 | |
| 269 | read_host_csr(&host); |
| 270 | buf_len = host.buffer_depth - host.buffer_write_ptr; |
| 271 | |
| 272 | if (buf_len > remain) { |
| 273 | /* Send all remaining data as final message */ |
| 274 | header.length = req_bytes - current; |
| 275 | header.is_complete = 1; |
| 276 | } else { |
| 277 | /* Send as much data as the buffer can hold */ |
| 278 | header.length = buf_len; |
| 279 | } |
| 280 | |
| 281 | mei_send_packet(&header, req_ptr); |
| 282 | |
| 283 | req_ptr += header.length; |
| 284 | current += header.length; |
| 285 | } |
| 286 | |
| 287 | return 0; |
| 288 | } |
| 289 | |
| 290 | static int mei_send_header(u8 me_address, u8 host_address, |
| 291 | void *header, int header_len, int complete) |
| 292 | { |
| 293 | struct mei_header mei = { |
| 294 | .client_address = me_address, |
| 295 | .host_address = host_address, |
| 296 | .length = header_len, |
| 297 | .is_complete = complete, |
| 298 | }; |
| 299 | return mei_send_packet(&mei, header); |
| 300 | } |
| 301 | |
| 302 | static int mei_recv_msg(void *header, int header_bytes, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 303 | void *rsp_data, int rsp_bytes) |
| 304 | { |
| 305 | struct mei_header mei_rsp; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 306 | struct mei_csr me, host; |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 307 | unsigned ndata, n; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 308 | unsigned expected; |
| 309 | u32 *data; |
| 310 | |
| 311 | /* Total number of dwords to read from circular buffer */ |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 312 | expected = (rsp_bytes + sizeof(mei_rsp) + header_bytes) >> 2; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 313 | if (rsp_bytes & 3) |
| 314 | expected++; |
| 315 | |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 316 | if (mei_wait_for_me_ready() < 0) |
| 317 | return -1; |
| 318 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 319 | /* |
| 320 | * The interrupt status bit does not appear to indicate that the |
| 321 | * message has actually been received. Instead we wait until the |
| 322 | * expected number of dwords are present in the circular buffer. |
| 323 | */ |
| 324 | for (n = ME_RETRY; n; --n) { |
| 325 | read_me_csr(&me); |
| 326 | if ((me.buffer_write_ptr - me.buffer_read_ptr) >= expected) |
| 327 | break; |
| 328 | udelay(ME_DELAY); |
| 329 | } |
| 330 | if (!n) { |
| 331 | printk(BIOS_ERR, "ME: timeout waiting for data: expected " |
| 332 | "%u, available %u\n", expected, |
| 333 | me.buffer_write_ptr - me.buffer_read_ptr); |
| 334 | return -1; |
| 335 | } |
| 336 | |
| 337 | /* Read and verify MEI response header from the ME */ |
| 338 | mei_read_dword_ptr(&mei_rsp, MEI_ME_CB_RW); |
| 339 | if (!mei_rsp.is_complete) { |
| 340 | printk(BIOS_ERR, "ME: response is not complete\n"); |
| 341 | return -1; |
| 342 | } |
| 343 | |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 344 | /* Handle non-dword responses and expect at least the header */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 345 | ndata = mei_rsp.length >> 2; |
| 346 | if (mei_rsp.length & 3) |
| 347 | ndata++; |
| 348 | if (ndata != (expected - 1)) { |
| 349 | printk(BIOS_ERR, "ME: response is missing data %d != %d\n", |
| 350 | ndata, (expected - 1)); |
| 351 | return -1; |
| 352 | } |
| 353 | |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 354 | /* Read response header from the ME */ |
| 355 | data = header; |
| 356 | for (n = 0; n < (header_bytes >> 2); ++n) |
| 357 | *data++ = read_cb(); |
| 358 | ndata -= header_bytes >> 2; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 359 | |
| 360 | /* Make sure caller passed a buffer with enough space */ |
| 361 | if (ndata != (rsp_bytes >> 2)) { |
| 362 | printk(BIOS_ERR, "ME: not enough room in response buffer: " |
| 363 | "%u != %u\n", ndata, rsp_bytes >> 2); |
| 364 | return -1; |
| 365 | } |
| 366 | |
| 367 | /* Read response data from the circular buffer */ |
| 368 | data = rsp_data; |
| 369 | for (n = 0; n < ndata; ++n) |
| 370 | *data++ = read_cb(); |
| 371 | |
| 372 | /* Tell the ME that we have consumed the response */ |
| 373 | read_host_csr(&host); |
| 374 | host.interrupt_status = 1; |
| 375 | host.interrupt_generate = 1; |
| 376 | write_host_csr(&host); |
| 377 | |
| 378 | return mei_wait_for_me_ready(); |
| 379 | } |
| 380 | |
Edward O'Callaghan | 97ccefd | 2015-01-07 15:53:00 +1100 | [diff] [blame] | 381 | #if IS_ENABLED (CONFIG_DEBUG_INTEL_ME) || defined(__SMM__) |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 382 | static inline int mei_sendrecv_mkhi(struct mkhi_header *mkhi, |
| 383 | void *req_data, int req_bytes, |
| 384 | void *rsp_data, int rsp_bytes) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 385 | { |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 386 | struct mkhi_header mkhi_rsp; |
| 387 | |
| 388 | /* Send header */ |
| 389 | if (mei_send_header(MEI_ADDRESS_MKHI, MEI_HOST_ADDRESS, |
| 390 | mkhi, sizeof(*mkhi), req_bytes ? 0 : 1) < 0) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 391 | return -1; |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 392 | |
| 393 | /* Send data if available */ |
| 394 | if (req_bytes && mei_send_data(MEI_ADDRESS_MKHI, MEI_HOST_ADDRESS, |
| 395 | req_data, req_bytes) < 0) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 396 | return -1; |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 397 | |
| 398 | /* Return now if no response expected */ |
| 399 | if (!rsp_bytes) |
| 400 | return 0; |
| 401 | |
| 402 | /* Read header and data */ |
| 403 | if (mei_recv_msg(&mkhi_rsp, sizeof(mkhi_rsp), |
| 404 | rsp_data, rsp_bytes) < 0) |
| 405 | return -1; |
| 406 | |
| 407 | if (!mkhi_rsp.is_response || |
| 408 | mkhi->group_id != mkhi_rsp.group_id || |
| 409 | mkhi->command != mkhi_rsp.command) { |
| 410 | printk(BIOS_ERR, "ME: invalid response, group %u ?= %u," |
| 411 | "command %u ?= %u, is_response %u\n", mkhi->group_id, |
| 412 | mkhi_rsp.group_id, mkhi->command, mkhi_rsp.command, |
| 413 | mkhi_rsp.is_response); |
| 414 | return -1; |
| 415 | } |
| 416 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 417 | return 0; |
| 418 | } |
Edward O'Callaghan | 97ccefd | 2015-01-07 15:53:00 +1100 | [diff] [blame] | 419 | #endif /* CONFIG_DEBUG_INTEL_ME || __SMM__ */ |
Duncan Laurie | 0dc0d13 | 2013-08-08 15:31:51 -0700 | [diff] [blame] | 420 | |
Duncan Laurie | 3d299c4 | 2013-07-19 08:48:05 -0700 | [diff] [blame] | 421 | /* |
| 422 | * mbp give up routine. This path is taken if hfs.mpb_rdy is 0 or the read |
| 423 | * state machine on the BIOS end doesn't match the ME's state machine. |
| 424 | */ |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 425 | #ifdef __SIMPLE_DEVICE__ |
| 426 | static void intel_me_mbp_give_up(pci_devfn_t dev) |
| 427 | #else |
| 428 | static void intel_me_mbp_give_up(struct device *dev) |
| 429 | #endif |
Duncan Laurie | 3d299c4 | 2013-07-19 08:48:05 -0700 | [diff] [blame] | 430 | { |
| 431 | struct mei_csr csr; |
| 432 | |
| 433 | pci_write_config32(dev, PCI_ME_H_GS2, PCI_ME_MBP_GIVE_UP); |
| 434 | |
| 435 | read_host_csr(&csr); |
| 436 | csr.reset = 1; |
| 437 | csr.interrupt_generate = 1; |
| 438 | write_host_csr(&csr); |
| 439 | } |
| 440 | |
| 441 | /* |
| 442 | * mbp clear routine. This will wait for the ME to indicate that |
| 443 | * the MBP has been read and cleared. |
| 444 | */ |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 445 | #ifdef __SIMPLE_DEVICE__ |
| 446 | void intel_me_mbp_clear(pci_devfn_t dev) |
| 447 | #else |
| 448 | void intel_me_mbp_clear(struct device *dev) |
| 449 | #endif |
Duncan Laurie | 3d299c4 | 2013-07-19 08:48:05 -0700 | [diff] [blame] | 450 | { |
| 451 | int count; |
| 452 | struct me_hfs2 hfs2; |
| 453 | |
| 454 | /* Wait for the mbp_cleared indicator */ |
| 455 | for (count = ME_RETRY; count > 0; --count) { |
| 456 | pci_read_dword_ptr(dev, &hfs2, PCI_ME_HFS2); |
| 457 | if (hfs2.mbp_cleared) |
| 458 | break; |
| 459 | udelay(ME_DELAY); |
| 460 | } |
| 461 | |
| 462 | if (count == 0) { |
| 463 | printk(BIOS_WARNING, "ME: Timeout waiting for mbp_cleared\n"); |
| 464 | intel_me_mbp_give_up(dev); |
| 465 | } else { |
| 466 | printk(BIOS_INFO, "ME: MBP cleared\n"); |
| 467 | } |
| 468 | } |
| 469 | |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 470 | #if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG) && !defined(__SMM__) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 471 | static void me_print_fw_version(mbp_fw_version_name *vers_name) |
| 472 | { |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 473 | if (!vers_name) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 474 | printk(BIOS_ERR, "ME: mbp missing version report\n"); |
| 475 | return; |
| 476 | } |
| 477 | |
| 478 | printk(BIOS_DEBUG, "ME: found version %d.%d.%d.%d\n", |
| 479 | vers_name->major_version, vers_name->minor_version, |
| 480 | vers_name->hotfix_version, vers_name->build_version); |
| 481 | } |
| 482 | |
Edward O'Callaghan | 7bf4f48 | 2014-06-17 15:12:09 +1000 | [diff] [blame] | 483 | #if IS_ENABLED (CONFIG_DEBUG_INTEL_ME) |
| 484 | static inline void print_cap(const char *name, int state) |
| 485 | { |
| 486 | printk(BIOS_DEBUG, "ME Capability: %-41s : %sabled\n", |
| 487 | name, state ? " en" : "dis"); |
| 488 | } |
| 489 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 490 | /* Get ME Firmware Capabilities */ |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 491 | static int mkhi_get_fwcaps(mbp_mefwcaps *cap) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 492 | { |
| 493 | u32 rule_id = 0; |
| 494 | struct me_fwcaps cap_msg; |
| 495 | struct mkhi_header mkhi = { |
| 496 | .group_id = MKHI_GROUP_ID_FWCAPS, |
| 497 | .command = MKHI_FWCAPS_GET_RULE, |
| 498 | }; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 499 | |
| 500 | /* Send request and wait for response */ |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 501 | if (mei_sendrecv_mkhi(&mkhi, &rule_id, sizeof(u32), |
| 502 | &cap_msg, sizeof(cap_msg)) < 0) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 503 | printk(BIOS_ERR, "ME: GET FWCAPS message failed\n"); |
| 504 | return -1; |
Elyes HAOUAS | ba28e8d | 2016-08-31 19:22:16 +0200 | [diff] [blame] | 505 | } |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 506 | *cap = cap_msg.caps_sku; |
| 507 | return 0; |
| 508 | } |
| 509 | |
| 510 | /* Get ME Firmware Capabilities */ |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 511 | static void me_print_fwcaps(mbp_mefwcaps *cap) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 512 | { |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 513 | mbp_mefwcaps local_caps; |
| 514 | if (!cap) { |
| 515 | cap = &local_caps; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 516 | printk(BIOS_ERR, "ME: mbp missing fwcaps report\n"); |
| 517 | if (mkhi_get_fwcaps(cap)) |
| 518 | return; |
| 519 | } |
| 520 | |
| 521 | print_cap("Full Network manageability", cap->full_net); |
| 522 | print_cap("Regular Network manageability", cap->std_net); |
| 523 | print_cap("Manageability", cap->manageability); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 524 | print_cap("IntelR Anti-Theft (AT)", cap->intel_at); |
| 525 | print_cap("IntelR Capability Licensing Service (CLS)", cap->intel_cls); |
| 526 | print_cap("IntelR Power Sharing Technology (MPC)", cap->intel_mpc); |
| 527 | print_cap("ICC Over Clocking", cap->icc_over_clocking); |
Edward O'Callaghan | 7bf4f48 | 2014-06-17 15:12:09 +1000 | [diff] [blame] | 528 | print_cap("Protected Audio Video Path (PAVP)", cap->pavp); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 529 | print_cap("IPV6", cap->ipv6); |
| 530 | print_cap("KVM Remote Control (KVM)", cap->kvm); |
| 531 | print_cap("Outbreak Containment Heuristic (OCH)", cap->och); |
| 532 | print_cap("Virtual LAN (VLAN)", cap->vlan); |
| 533 | print_cap("TLS", cap->tls); |
| 534 | print_cap("Wireless LAN (WLAN)", cap->wlan); |
| 535 | } |
Edward O'Callaghan | 7bf4f48 | 2014-06-17 15:12:09 +1000 | [diff] [blame] | 536 | #endif /* CONFIG_DEBUG_INTEL_ME */ |
Duncan Laurie | 0b3cd36 | 2013-08-08 15:40:01 -0700 | [diff] [blame] | 537 | #endif |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 538 | |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 539 | #if IS_ENABLED(CONFIG_CHROMEOS) && 0 /* DISABLED */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 540 | /* Tell ME to issue a global reset */ |
| 541 | static int mkhi_global_reset(void) |
| 542 | { |
| 543 | struct me_global_reset reset = { |
| 544 | .request_origin = GLOBAL_RESET_BIOS_POST, |
| 545 | .reset_type = CBM_RR_GLOBAL_RESET, |
| 546 | }; |
| 547 | struct mkhi_header mkhi = { |
| 548 | .group_id = MKHI_GROUP_ID_CBM, |
| 549 | .command = MKHI_GLOBAL_RESET, |
| 550 | }; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 551 | |
| 552 | /* Send request and wait for response */ |
| 553 | printk(BIOS_NOTICE, "ME: %s\n", __FUNCTION__); |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 554 | if (mei_sendrecv_mkhi(&mkhi, &reset, sizeof(reset), NULL, 0) < 0) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 555 | /* No response means reset will happen shortly... */ |
Patrick Georgi | 546953c | 2014-11-29 10:38:17 +0100 | [diff] [blame] | 556 | halt(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 557 | } |
| 558 | |
| 559 | /* If the ME responded it rejected the reset request */ |
| 560 | printk(BIOS_ERR, "ME: Global Reset failed\n"); |
| 561 | return -1; |
| 562 | } |
| 563 | #endif |
| 564 | |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 565 | #ifdef __SMM__ |
| 566 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 567 | /* Send END OF POST message to the ME */ |
| 568 | static int mkhi_end_of_post(void) |
| 569 | { |
| 570 | struct mkhi_header mkhi = { |
| 571 | .group_id = MKHI_GROUP_ID_GEN, |
| 572 | .command = MKHI_END_OF_POST, |
| 573 | }; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 574 | u32 eop_ack; |
| 575 | |
| 576 | /* Send request and wait for response */ |
| 577 | printk(BIOS_NOTICE, "ME: %s\n", __FUNCTION__); |
Duncan Laurie | 2017b4a | 2013-08-08 15:07:12 -0700 | [diff] [blame] | 578 | if (mei_sendrecv_mkhi(&mkhi, NULL, 0, &eop_ack, sizeof(eop_ack)) < 0) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 579 | printk(BIOS_ERR, "ME: END OF POST message failed\n"); |
| 580 | return -1; |
| 581 | } |
| 582 | |
| 583 | printk(BIOS_INFO, "ME: END OF POST message successful (%d)\n", eop_ack); |
| 584 | return 0; |
| 585 | } |
| 586 | |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 587 | void intel_me_finalize_smm(void) |
| 588 | { |
| 589 | struct me_hfs hfs; |
| 590 | u32 reg32; |
| 591 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 592 | mei_base_address = (u32 *) |
| 593 | (pci_read_config32(PCH_ME_DEV, PCI_BASE_ADDRESS_0) & ~0xf); |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 594 | |
| 595 | /* S3 path will have hidden this device already */ |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 596 | if (!mei_base_address || mei_base_address == (u32 *)0xfffffff0) |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 597 | return; |
| 598 | |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 599 | #if IS_ENABLED(CONFIG_ME_MBP_CLEAR_LATE) |
Duncan Laurie | 3d299c4 | 2013-07-19 08:48:05 -0700 | [diff] [blame] | 600 | /* Wait for ME MBP Cleared indicator */ |
| 601 | intel_me_mbp_clear(PCH_ME_DEV); |
| 602 | #endif |
| 603 | |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 604 | /* Make sure ME is in a mode that expects EOP */ |
| 605 | reg32 = pci_read_config32(PCH_ME_DEV, PCI_ME_HFS); |
| 606 | memcpy(&hfs, ®32, sizeof(u32)); |
| 607 | |
| 608 | /* Abort and leave device alone if not normal mode */ |
| 609 | if (hfs.fpt_bad || |
| 610 | hfs.working_state != ME_HFS_CWS_NORMAL || |
| 611 | hfs.operation_mode != ME_HFS_MODE_NORMAL) |
| 612 | return; |
| 613 | |
| 614 | /* Try to send EOP command so ME stops accepting other commands */ |
| 615 | mkhi_end_of_post(); |
| 616 | |
| 617 | /* Make sure IO is disabled */ |
| 618 | reg32 = pci_read_config32(PCH_ME_DEV, PCI_COMMAND); |
| 619 | reg32 &= ~(PCI_COMMAND_MASTER | |
| 620 | PCI_COMMAND_MEMORY | PCI_COMMAND_IO); |
| 621 | pci_write_config32(PCH_ME_DEV, PCI_COMMAND, reg32); |
| 622 | |
| 623 | /* Hide the PCI device */ |
| 624 | RCBA32_OR(FD2, PCH_DISABLE_MEI1); |
| 625 | } |
| 626 | |
| 627 | #else /* !__SMM__ */ |
| 628 | |
Edward O'Callaghan | 97ccefd | 2015-01-07 15:53:00 +1100 | [diff] [blame] | 629 | static inline int mei_sendrecv_icc(struct icc_header *icc, |
| 630 | void *req_data, int req_bytes, |
| 631 | void *rsp_data, int rsp_bytes) |
| 632 | { |
| 633 | struct icc_header icc_rsp; |
| 634 | |
| 635 | /* Send header */ |
| 636 | if (mei_send_header(MEI_ADDRESS_ICC, MEI_HOST_ADDRESS, |
| 637 | icc, sizeof(*icc), req_bytes ? 0 : 1) < 0) |
| 638 | return -1; |
| 639 | |
| 640 | /* Send data if available */ |
| 641 | if (req_bytes && mei_send_data(MEI_ADDRESS_ICC, MEI_HOST_ADDRESS, |
| 642 | req_data, req_bytes) < 0) |
| 643 | return -1; |
| 644 | |
| 645 | /* Read header and data, if needed */ |
| 646 | if (rsp_bytes && mei_recv_msg(&icc_rsp, sizeof(icc_rsp), |
| 647 | rsp_data, rsp_bytes) < 0) |
| 648 | return -1; |
| 649 | |
| 650 | return 0; |
| 651 | } |
| 652 | |
Duncan Laurie | 0dc0d13 | 2013-08-08 15:31:51 -0700 | [diff] [blame] | 653 | static int me_icc_set_clock_enables(u32 mask) |
| 654 | { |
| 655 | struct icc_clock_enables_msg clk = { |
| 656 | .clock_enables = 0, /* Turn off specified clocks */ |
| 657 | .clock_mask = mask, |
| 658 | .no_response = 1, /* Do not expect response */ |
| 659 | }; |
| 660 | struct icc_header icc = { |
| 661 | .api_version = ICC_API_VERSION_LYNXPOINT, |
| 662 | .icc_command = ICC_SET_CLOCK_ENABLES, |
| 663 | .length = sizeof(clk), |
| 664 | }; |
| 665 | |
| 666 | /* Send request and wait for response */ |
| 667 | if (mei_sendrecv_icc(&icc, &clk, sizeof(clk), NULL, 0) < 0) { |
| 668 | printk(BIOS_ERR, "ME: ICC SET CLOCK ENABLES message failed\n"); |
| 669 | return -1; |
Duncan Laurie | 0dc0d13 | 2013-08-08 15:31:51 -0700 | [diff] [blame] | 670 | } |
| 671 | |
Elyes HAOUAS | 54f9424 | 2018-10-25 10:57:39 +0200 | [diff] [blame] | 672 | printk(BIOS_INFO, "ME: ICC SET CLOCK ENABLES 0x%08x\n", mask); |
Duncan Laurie | 0dc0d13 | 2013-08-08 15:31:51 -0700 | [diff] [blame] | 673 | return 0; |
| 674 | } |
| 675 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 676 | /* Determine the path that we should take based on ME status */ |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 677 | static me_bios_path intel_me_path(struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 678 | { |
| 679 | me_bios_path path = ME_DISABLE_BIOS_PATH; |
| 680 | struct me_hfs hfs; |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 681 | struct me_hfs2 hfs2; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 682 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 683 | pci_read_dword_ptr(dev, &hfs, PCI_ME_HFS); |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 684 | pci_read_dword_ptr(dev, &hfs2, PCI_ME_HFS2); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 685 | |
| 686 | /* Check and dump status */ |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 687 | intel_me_status(&hfs, &hfs2); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 688 | |
| 689 | /* Check Current Working State */ |
| 690 | switch (hfs.working_state) { |
| 691 | case ME_HFS_CWS_NORMAL: |
| 692 | path = ME_NORMAL_BIOS_PATH; |
| 693 | break; |
| 694 | case ME_HFS_CWS_REC: |
| 695 | path = ME_RECOVERY_BIOS_PATH; |
| 696 | break; |
| 697 | default: |
| 698 | path = ME_DISABLE_BIOS_PATH; |
| 699 | break; |
| 700 | } |
| 701 | |
| 702 | /* Check Current Operation Mode */ |
| 703 | switch (hfs.operation_mode) { |
| 704 | case ME_HFS_MODE_NORMAL: |
| 705 | break; |
| 706 | case ME_HFS_MODE_DEBUG: |
| 707 | case ME_HFS_MODE_DIS: |
| 708 | case ME_HFS_MODE_OVER_JMPR: |
| 709 | case ME_HFS_MODE_OVER_MEI: |
| 710 | default: |
| 711 | path = ME_DISABLE_BIOS_PATH; |
| 712 | break; |
| 713 | } |
| 714 | |
| 715 | /* Check for any error code and valid firmware and MBP */ |
| 716 | if (hfs.error_code || hfs.fpt_bad) |
| 717 | path = ME_ERROR_BIOS_PATH; |
| 718 | |
| 719 | /* Check if the MBP is ready */ |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 720 | if (!hfs2.mbp_rdy) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 721 | printk(BIOS_CRIT, "%s: mbp is not ready!\n", |
| 722 | __FUNCTION__); |
| 723 | path = ME_ERROR_BIOS_PATH; |
| 724 | } |
| 725 | |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 726 | #if IS_ENABLED(CONFIG_ELOG) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 727 | if (path != ME_NORMAL_BIOS_PATH) { |
| 728 | struct elog_event_data_me_extended data = { |
| 729 | .current_working_state = hfs.working_state, |
| 730 | .operation_state = hfs.operation_state, |
| 731 | .operation_mode = hfs.operation_mode, |
| 732 | .error_code = hfs.error_code, |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 733 | .progress_code = hfs2.progress_code, |
| 734 | .current_pmevent = hfs2.current_pmevent, |
| 735 | .current_state = hfs2.current_state, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 736 | }; |
| 737 | elog_add_event_byte(ELOG_TYPE_MANAGEMENT_ENGINE, path); |
| 738 | elog_add_event_raw(ELOG_TYPE_MANAGEMENT_ENGINE_EXT, |
| 739 | &data, sizeof(data)); |
| 740 | } |
| 741 | #endif |
| 742 | |
| 743 | return path; |
| 744 | } |
| 745 | |
| 746 | /* Prepare ME for MEI messages */ |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 747 | static int intel_mei_setup(struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 748 | { |
| 749 | struct resource *res; |
| 750 | struct mei_csr host; |
| 751 | u32 reg32; |
| 752 | |
| 753 | /* Find the MMIO base for the ME interface */ |
| 754 | res = find_resource(dev, PCI_BASE_ADDRESS_0); |
| 755 | if (!res || res->base == 0 || res->size == 0) { |
| 756 | printk(BIOS_DEBUG, "ME: MEI resource not present!\n"); |
| 757 | return -1; |
| 758 | } |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 759 | mei_base_address = (u32 *)(uintptr_t)res->base; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 760 | |
| 761 | /* Ensure Memory and Bus Master bits are set */ |
| 762 | reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 763 | reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; |
| 764 | pci_write_config32(dev, PCI_COMMAND, reg32); |
| 765 | |
| 766 | /* Clean up status for next message */ |
| 767 | read_host_csr(&host); |
| 768 | host.interrupt_generate = 1; |
| 769 | host.ready = 1; |
| 770 | host.reset = 0; |
| 771 | write_host_csr(&host); |
| 772 | |
| 773 | return 0; |
| 774 | } |
| 775 | |
| 776 | /* Read the Extend register hash of ME firmware */ |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 777 | static int intel_me_extend_valid(struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 778 | { |
| 779 | struct me_heres status; |
| 780 | u32 extend[8] = {0}; |
| 781 | int i, count = 0; |
| 782 | |
| 783 | pci_read_dword_ptr(dev, &status, PCI_ME_HERES); |
| 784 | if (!status.extend_feature_present) { |
| 785 | printk(BIOS_ERR, "ME: Extend Feature not present\n"); |
| 786 | return -1; |
| 787 | } |
| 788 | |
| 789 | if (!status.extend_reg_valid) { |
| 790 | printk(BIOS_ERR, "ME: Extend Register not valid\n"); |
| 791 | return -1; |
| 792 | } |
| 793 | |
| 794 | switch (status.extend_reg_algorithm) { |
| 795 | case PCI_ME_EXT_SHA1: |
| 796 | count = 5; |
| 797 | printk(BIOS_DEBUG, "ME: Extend SHA-1: "); |
| 798 | break; |
| 799 | case PCI_ME_EXT_SHA256: |
| 800 | count = 8; |
| 801 | printk(BIOS_DEBUG, "ME: Extend SHA-256: "); |
| 802 | break; |
| 803 | default: |
| 804 | printk(BIOS_ERR, "ME: Extend Algorithm %d unknown\n", |
| 805 | status.extend_reg_algorithm); |
| 806 | return -1; |
| 807 | } |
| 808 | |
| 809 | for (i = 0; i < count; ++i) { |
| 810 | extend[i] = pci_read_config32(dev, PCI_ME_HER(i)); |
| 811 | printk(BIOS_DEBUG, "%08x", extend[i]); |
| 812 | } |
| 813 | printk(BIOS_DEBUG, "\n"); |
| 814 | |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 815 | #if IS_ENABLED(CONFIG_CHROMEOS) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 816 | /* Save hash in NVS for the OS to verify */ |
| 817 | chromeos_set_me_hash(extend, count); |
| 818 | #endif |
| 819 | |
| 820 | return 0; |
| 821 | } |
| 822 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 823 | /* Check whether ME is present and do basic init */ |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 824 | static void intel_me_init(struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 825 | { |
Duncan Laurie | 0dc0d13 | 2013-08-08 15:31:51 -0700 | [diff] [blame] | 826 | struct southbridge_intel_lynxpoint_config *config = dev->chip_info; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 827 | me_bios_path path = intel_me_path(dev); |
| 828 | me_bios_payload mbp_data; |
| 829 | |
| 830 | /* Do initial setup and determine the BIOS path */ |
| 831 | printk(BIOS_NOTICE, "ME: BIOS path: %s\n", me_bios_path_values[path]); |
| 832 | |
Duncan Laurie | 8056dc6 | 2013-07-22 08:47:43 -0700 | [diff] [blame] | 833 | if (path == ME_NORMAL_BIOS_PATH) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 834 | /* Validate the extend register */ |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 835 | intel_me_extend_valid(dev); |
| 836 | } |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 837 | |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 838 | memset(&mbp_data, 0, sizeof(mbp_data)); |
| 839 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 840 | /* |
| 841 | * According to the ME9 BWG, BIOS is required to fetch MBP data in |
| 842 | * all boot flows except S3 Resume. |
| 843 | */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 844 | |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 845 | /* Prepare MEI MMIO interface */ |
| 846 | if (intel_mei_setup(dev) < 0) |
| 847 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 848 | |
Duncan Laurie | 144f7b2 | 2013-05-01 11:27:58 -0700 | [diff] [blame] | 849 | if (intel_me_read_mbp(&mbp_data, dev)) |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 850 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 851 | |
| 852 | #if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG) |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 853 | me_print_fw_version(mbp_data.fw_version_name); |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 854 | #if IS_ENABLED(CONFIG_DEBUG_INTEL_ME) |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 855 | me_print_fwcaps(mbp_data.fw_capabilities); |
Duncan Laurie | 0b3cd36 | 2013-08-08 15:40:01 -0700 | [diff] [blame] | 856 | #endif |
Duncan Laurie | 144f7b2 | 2013-05-01 11:27:58 -0700 | [diff] [blame] | 857 | |
| 858 | if (mbp_data.plat_time) { |
| 859 | printk(BIOS_DEBUG, "ME: Wake Event to ME Reset: %u ms\n", |
| 860 | mbp_data.plat_time->wake_event_mrst_time_ms); |
| 861 | printk(BIOS_DEBUG, "ME: ME Reset to Platform Reset: %u ms\n", |
| 862 | mbp_data.plat_time->mrst_pltrst_time_ms); |
| 863 | printk(BIOS_DEBUG, "ME: Platform Reset to CPU Reset: %u ms\n", |
| 864 | mbp_data.plat_time->pltrst_cpurst_time_ms); |
| 865 | } |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 866 | #endif |
| 867 | |
Duncan Laurie | 0dc0d13 | 2013-08-08 15:31:51 -0700 | [diff] [blame] | 868 | /* Set clock enables according to devicetree */ |
| 869 | if (config && config->icc_clock_disable) |
| 870 | me_icc_set_clock_enables(config->icc_clock_disable); |
| 871 | |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 872 | /* |
| 873 | * Leave the ME unlocked. It will be locked via SMI command later. |
| 874 | */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 875 | } |
| 876 | |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 877 | static void set_subsystem(struct device *dev, unsigned int vendor, |
| 878 | unsigned int device) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 879 | { |
| 880 | if (!vendor || !device) { |
| 881 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 882 | pci_read_config32(dev, PCI_VENDOR_ID)); |
| 883 | } else { |
| 884 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 885 | ((device & 0xffff) << 16) | (vendor & 0xffff)); |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | static struct pci_operations pci_ops = { |
| 890 | .set_subsystem = set_subsystem, |
| 891 | }; |
| 892 | |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 893 | static void intel_me_enable(struct device *dev) |
Duncan Laurie | 8056dc6 | 2013-07-22 08:47:43 -0700 | [diff] [blame] | 894 | { |
Duncan Laurie | 8056dc6 | 2013-07-22 08:47:43 -0700 | [diff] [blame] | 895 | /* Avoid talking to the device in S3 path */ |
Kyösti Mälkki | c3ed886 | 2014-06-19 19:50:51 +0300 | [diff] [blame] | 896 | if (acpi_is_wakeup_s3()) { |
Duncan Laurie | 8056dc6 | 2013-07-22 08:47:43 -0700 | [diff] [blame] | 897 | dev->enabled = 0; |
| 898 | pch_disable_devfn(dev); |
| 899 | } |
Duncan Laurie | 8056dc6 | 2013-07-22 08:47:43 -0700 | [diff] [blame] | 900 | } |
| 901 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 902 | static struct device_operations device_ops = { |
| 903 | .read_resources = pci_dev_read_resources, |
| 904 | .set_resources = pci_dev_set_resources, |
| 905 | .enable_resources = pci_dev_enable_resources, |
Duncan Laurie | 8056dc6 | 2013-07-22 08:47:43 -0700 | [diff] [blame] | 906 | .enable = intel_me_enable, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 907 | .init = intel_me_init, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 908 | .ops_pci = &pci_ops, |
| 909 | }; |
| 910 | |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 911 | static const unsigned short pci_device_ids[] = { |
| 912 | 0x8c3a, /* Mobile */ |
| 913 | 0x9c3a, /* Low Power */ |
| 914 | 0 |
| 915 | }; |
| 916 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 917 | static const struct pci_driver intel_me __pci_driver = { |
| 918 | .ops = &device_ops, |
| 919 | .vendor = PCI_VENDOR_ID_INTEL, |
Duncan Laurie | 26e7dd7 | 2012-12-19 09:12:31 -0800 | [diff] [blame] | 920 | .devices= pci_device_ids, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 921 | }; |
| 922 | |
| 923 | /****************************************************************************** |
| 924 | * */ |
| 925 | static u32 me_to_host_words_pending(void) |
| 926 | { |
| 927 | struct mei_csr me; |
| 928 | read_me_csr(&me); |
| 929 | if (!me.ready) |
| 930 | return 0; |
| 931 | return (me.buffer_write_ptr - me.buffer_read_ptr) & |
| 932 | (me.buffer_depth - 1); |
| 933 | } |
| 934 | |
| 935 | #if 0 |
| 936 | /* This function is not yet being used, keep it in for the future. */ |
| 937 | static u32 host_to_me_words_room(void) |
| 938 | { |
| 939 | struct mei_csr csr; |
| 940 | |
| 941 | read_me_csr(&csr); |
| 942 | if (!csr.ready) |
| 943 | return 0; |
| 944 | |
| 945 | read_host_csr(&csr); |
| 946 | return (csr.buffer_read_ptr - csr.buffer_write_ptr - 1) & |
| 947 | (csr.buffer_depth - 1); |
| 948 | } |
| 949 | #endif |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 950 | |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 951 | struct mbp_payload { |
| 952 | mbp_header header; |
| 953 | u32 data[0]; |
| 954 | }; |
| 955 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 956 | /* |
| 957 | * mbp seems to be following its own flow, let's retrieve it in a dedicated |
| 958 | * function. |
| 959 | */ |
Elyes HAOUAS | 1dcd8db | 2018-12-05 10:59:42 +0100 | [diff] [blame] | 960 | static int intel_me_read_mbp(me_bios_payload *mbp_data, struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 961 | { |
| 962 | mbp_header mbp_hdr; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 963 | u32 me2host_pending; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 964 | struct mei_csr host; |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 965 | struct me_hfs2 hfs2; |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 966 | struct mbp_payload *mbp; |
| 967 | int i; |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 968 | |
| 969 | pci_read_dword_ptr(dev, &hfs2, PCI_ME_HFS2); |
| 970 | |
| 971 | if (!hfs2.mbp_rdy) { |
| 972 | printk(BIOS_ERR, "ME: MBP not ready\n"); |
| 973 | goto mbp_failure; |
| 974 | } |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 975 | |
| 976 | me2host_pending = me_to_host_words_pending(); |
| 977 | if (!me2host_pending) { |
| 978 | printk(BIOS_ERR, "ME: no mbp data!\n"); |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 979 | goto mbp_failure; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 980 | } |
| 981 | |
| 982 | /* we know for sure that at least the header is there */ |
| 983 | mei_read_dword_ptr(&mbp_hdr, MEI_ME_CB_RW); |
| 984 | |
| 985 | if ((mbp_hdr.num_entries > (mbp_hdr.mbp_size / 2)) || |
| 986 | (me2host_pending < mbp_hdr.mbp_size)) { |
| 987 | printk(BIOS_ERR, "ME: mbp of %d entries, total size %d words" |
| 988 | " buffer contains %d words\n", |
| 989 | mbp_hdr.num_entries, mbp_hdr.mbp_size, |
| 990 | me2host_pending); |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 991 | goto mbp_failure; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 992 | } |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 993 | mbp = malloc(mbp_hdr.mbp_size * sizeof(u32)); |
| 994 | if (!mbp) |
| 995 | goto mbp_failure; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 996 | |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 997 | mbp->header = mbp_hdr; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 998 | me2host_pending--; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 999 | |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1000 | i = 0; |
| 1001 | while (i != me2host_pending) { |
| 1002 | mei_read_dword_ptr(&mbp->data[i], MEI_ME_CB_RW); |
| 1003 | i++; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1004 | } |
| 1005 | |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1006 | /* Signal to the ME that the host has finished reading the MBP. */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1007 | read_host_csr(&host); |
| 1008 | host.interrupt_generate = 1; |
| 1009 | write_host_csr(&host); |
| 1010 | |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 1011 | #if !IS_ENABLED(CONFIG_ME_MBP_CLEAR_LATE) |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1012 | /* Wait for the mbp_cleared indicator. */ |
Duncan Laurie | 3d299c4 | 2013-07-19 08:48:05 -0700 | [diff] [blame] | 1013 | intel_me_mbp_clear(dev); |
| 1014 | #endif |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1015 | |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1016 | /* Dump out the MBP contents. */ |
| 1017 | #if (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= BIOS_DEBUG) |
| 1018 | printk(BIOS_INFO, "ME MBP: Header: items: %d, size dw: %d\n", |
| 1019 | mbp->header.num_entries, mbp->header.mbp_size); |
Martin Roth | 7a1a3ad | 2017-06-24 21:29:38 -0600 | [diff] [blame] | 1020 | #if IS_ENABLED(CONFIG_DEBUG_INTEL_ME) |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1021 | for (i = 0; i < mbp->header.mbp_size - 1; i++) { |
| 1022 | printk(BIOS_INFO, "ME MBP: %04x: 0x%08x\n", i, mbp->data[i]); |
| 1023 | } |
| 1024 | #endif |
Duncan Laurie | 0b3cd36 | 2013-08-08 15:40:01 -0700 | [diff] [blame] | 1025 | #endif |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1026 | |
| 1027 | #define ASSIGN_FIELD_PTR(field_,val_) \ |
| 1028 | { \ |
| 1029 | mbp_data->field_ = (typeof(mbp_data->field_))(void *)val_; \ |
| 1030 | break; \ |
| 1031 | } |
| 1032 | /* Setup the pointers in the me_bios_payload structure. */ |
| 1033 | for (i = 0; i < mbp->header.mbp_size - 1;) { |
| 1034 | mbp_item_header *item = (void *)&mbp->data[i]; |
| 1035 | |
Elyes HAOUAS | f9de5a4 | 2018-05-03 17:21:02 +0200 | [diff] [blame] | 1036 | switch (MBP_MAKE_IDENT(item->app_id, item->item_id)) { |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1037 | case MBP_IDENT(KERNEL, FW_VER): |
| 1038 | ASSIGN_FIELD_PTR(fw_version_name, &mbp->data[i+1]); |
| 1039 | |
| 1040 | case MBP_IDENT(ICC, PROFILE): |
| 1041 | ASSIGN_FIELD_PTR(icc_profile, &mbp->data[i+1]); |
| 1042 | |
| 1043 | case MBP_IDENT(INTEL_AT, STATE): |
| 1044 | ASSIGN_FIELD_PTR(at_state, &mbp->data[i+1]); |
| 1045 | |
| 1046 | case MBP_IDENT(KERNEL, FW_CAP): |
| 1047 | ASSIGN_FIELD_PTR(fw_capabilities, &mbp->data[i+1]); |
| 1048 | |
| 1049 | case MBP_IDENT(KERNEL, ROM_BIST): |
| 1050 | ASSIGN_FIELD_PTR(rom_bist_data, &mbp->data[i+1]); |
| 1051 | |
| 1052 | case MBP_IDENT(KERNEL, PLAT_KEY): |
| 1053 | ASSIGN_FIELD_PTR(platform_key, &mbp->data[i+1]); |
| 1054 | |
| 1055 | case MBP_IDENT(KERNEL, FW_TYPE): |
| 1056 | ASSIGN_FIELD_PTR(fw_plat_type, &mbp->data[i+1]); |
| 1057 | |
| 1058 | case MBP_IDENT(KERNEL, MFS_FAILURE): |
| 1059 | ASSIGN_FIELD_PTR(mfsintegrity, &mbp->data[i+1]); |
| 1060 | |
Duncan Laurie | 144f7b2 | 2013-05-01 11:27:58 -0700 | [diff] [blame] | 1061 | case MBP_IDENT(KERNEL, PLAT_TIME): |
| 1062 | ASSIGN_FIELD_PTR(plat_time, &mbp->data[i+1]); |
| 1063 | |
| 1064 | case MBP_IDENT(NFC, SUPPORT_DATA): |
| 1065 | ASSIGN_FIELD_PTR(nfc_data, &mbp->data[i+1]); |
| 1066 | |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1067 | default: |
Duncan Laurie | 0b3cd36 | 2013-08-08 15:40:01 -0700 | [diff] [blame] | 1068 | printk(BIOS_ERR, "ME MBP: unknown item 0x%x @ " |
| 1069 | "dw offset 0x%x\n", mbp->data[i], i); |
Aaron Durbin | be98524 | 2012-12-12 12:40:33 -0600 | [diff] [blame] | 1070 | break; |
| 1071 | } |
| 1072 | i += item->length; |
| 1073 | } |
| 1074 | #undef ASSIGN_FIELD_PTR |
| 1075 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1076 | return 0; |
Aaron Durbin | 9aa031e | 2012-11-02 09:16:46 -0500 | [diff] [blame] | 1077 | |
| 1078 | mbp_failure: |
| 1079 | intel_me_mbp_give_up(dev); |
| 1080 | return -1; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1081 | } |
Duncan Laurie | af98062 | 2013-07-18 23:02:18 -0700 | [diff] [blame] | 1082 | |
| 1083 | #endif /* !__SMM__ */ |