blob: d3b7d9ba13ad4905298cc642eb371cbf7e4b5e3b [file] [log] [blame]
Angel Pons0612b272020-04-05 15:46:56 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Andrey Petrov04a72c42017-03-01 15:51:57 -08002
Subrata Banik05e06cd2017-11-09 15:04:09 +05303#include <assert.h>
Andrey Petrov04a72c42017-03-01 15:51:57 -08004#include <commonlib/helpers.h>
5#include <console/console.h>
Kyösti Mälkki13f66502019-03-03 08:01:05 +02006#include <device/mmio.h>
Andrey Petrov04a72c42017-03-01 15:51:57 -08007#include <delay.h>
8#include <device/pci.h>
9#include <device/pci_ids.h>
10#include <device/pci_ops.h>
11#include <intelblocks/cse.h>
Tim Wawrzynczak09635f42021-06-18 10:08:47 -060012#include <security/vboot/misc.h>
13#include <security/vboot/vboot_common.h>
Subrata Banik05e06cd2017-11-09 15:04:09 +053014#include <soc/iomap.h>
Andrey Petrov04a72c42017-03-01 15:51:57 -080015#include <soc/pci_devs.h>
Sridhar Siricilla8e465452019-09-23 20:59:38 +053016#include <soc/me.h>
Andrey Petrov04a72c42017-03-01 15:51:57 -080017#include <string.h>
18#include <timer.h>
19
Subrata Banik5c08c732017-11-13 14:54:37 +053020#define MAX_HECI_MESSAGE_RETRY_COUNT 5
21
Andrey Petrov04a72c42017-03-01 15:51:57 -080022/* Wait up to 15 sec for HECI to get ready */
Subrata Banik03aef282021-09-28 18:10:24 +053023#define HECI_DELAY_READY_MS (15 * 1000)
Jonathan Neuschäfer5268b762018-02-12 12:24:25 +010024/* Wait up to 100 usec between circular buffer polls */
Subrata Banik03aef282021-09-28 18:10:24 +053025#define HECI_DELAY_US 100
Andrey Petrov04a72c42017-03-01 15:51:57 -080026/* Wait up to 5 sec for CSE to chew something we sent */
Subrata Banik03aef282021-09-28 18:10:24 +053027#define HECI_SEND_TIMEOUT_MS (5 * 1000)
Andrey Petrov04a72c42017-03-01 15:51:57 -080028/* Wait up to 5 sec for CSE to blurp a reply */
Subrata Banik03aef282021-09-28 18:10:24 +053029#define HECI_READ_TIMEOUT_MS (5 * 1000)
Subrata Banika219edb2021-09-25 15:02:37 +053030/* Wait up to 1 ms for CSE CIP */
Subrata Banik03aef282021-09-28 18:10:24 +053031#define HECI_CIP_TIMEOUT_US 1000
Subrata Banikf5765812021-09-30 13:37:10 +053032/* Wait up to 5 seconds for CSE to boot from RO(BP1) */
33#define CSE_DELAY_BOOT_TO_RO_MS (5 * 1000)
Andrey Petrov04a72c42017-03-01 15:51:57 -080034
35#define SLOT_SIZE sizeof(uint32_t)
36
37#define MMIO_CSE_CB_WW 0x00
38#define MMIO_HOST_CSR 0x04
39#define MMIO_CSE_CB_RW 0x08
40#define MMIO_CSE_CSR 0x0c
Subrata Banika219edb2021-09-25 15:02:37 +053041#define MMIO_CSE_DEVIDLE 0x800
42#define CSE_DEV_IDLE (1 << 2)
43#define CSE_DEV_CIP (1 << 0)
Andrey Petrov04a72c42017-03-01 15:51:57 -080044
45#define CSR_IE (1 << 0)
46#define CSR_IS (1 << 1)
47#define CSR_IG (1 << 2)
48#define CSR_READY (1 << 3)
49#define CSR_RESET (1 << 4)
50#define CSR_RP_START 8
51#define CSR_RP (((1 << 8) - 1) << CSR_RP_START)
52#define CSR_WP_START 16
53#define CSR_WP (((1 << 8) - 1) << CSR_WP_START)
54#define CSR_CBD_START 24
55#define CSR_CBD (((1 << 8) - 1) << CSR_CBD_START)
56
57#define MEI_HDR_IS_COMPLETE (1 << 31)
58#define MEI_HDR_LENGTH_START 16
59#define MEI_HDR_LENGTH_SIZE 9
60#define MEI_HDR_LENGTH (((1 << MEI_HDR_LENGTH_SIZE) - 1) \
61 << MEI_HDR_LENGTH_START)
62#define MEI_HDR_HOST_ADDR_START 8
63#define MEI_HDR_HOST_ADDR (((1 << 8) - 1) << MEI_HDR_HOST_ADDR_START)
64#define MEI_HDR_CSE_ADDR_START 0
65#define MEI_HDR_CSE_ADDR (((1 << 8) - 1) << MEI_HDR_CSE_ADDR_START)
66
Subrata Banik38abbda2021-09-30 13:15:50 +053067/* Get HECI BAR 0 from PCI configuration space */
68static uintptr_t get_cse_bar(void)
69{
70 uintptr_t bar;
71
72 bar = pci_read_config32(PCH_DEV_CSE, PCI_BASE_ADDRESS_0);
73 assert(bar != 0);
74 /*
75 * Bits 31-12 are the base address as per EDS for SPI,
76 * Don't care about 0-11 bit
77 */
78 return bar & ~PCI_BASE_ADDRESS_MEM_ATTR_MASK;
79}
Andrey Petrov04a72c42017-03-01 15:51:57 -080080
81/*
82 * Initialize the device with provided temporary BAR. If BAR is 0 use a
83 * default. This is intended for pre-mem usage only where BARs haven't been
84 * assigned yet and devices are not enabled.
85 */
86void heci_init(uintptr_t tempbar)
87{
Elyes HAOUAS68c851b2018-06-12 22:06:09 +020088#if defined(__SIMPLE_DEVICE__)
89 pci_devfn_t dev = PCH_DEV_CSE;
90#else
91 struct device *dev = PCH_DEV_CSE;
92#endif
Elyes HAOUAS2ec1c132020-04-29 09:57:05 +020093 u16 pcireg;
Andrey Petrov04a72c42017-03-01 15:51:57 -080094
95 /* Assume it is already initialized, nothing else to do */
Subrata Banik38abbda2021-09-30 13:15:50 +053096 if (get_cse_bar())
Andrey Petrov04a72c42017-03-01 15:51:57 -080097 return;
98
99 /* Use default pre-ram bar */
100 if (!tempbar)
101 tempbar = HECI1_BASE_ADDRESS;
102
103 /* Assign Resources to HECI1 */
104 /* Clear BIT 1-2 of Command Register */
Elyes HAOUAS2ec1c132020-04-29 09:57:05 +0200105 pcireg = pci_read_config16(dev, PCI_COMMAND);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800106 pcireg &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
Elyes HAOUAS2ec1c132020-04-29 09:57:05 +0200107 pci_write_config16(dev, PCI_COMMAND, pcireg);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800108
109 /* Program Temporary BAR for HECI1 */
110 pci_write_config32(dev, PCI_BASE_ADDRESS_0, tempbar);
111 pci_write_config32(dev, PCI_BASE_ADDRESS_1, 0x0);
112
113 /* Enable Bus Master and MMIO Space */
Elyes HAOUAS2ec1c132020-04-29 09:57:05 +0200114 pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
Subrata Banik05e06cd2017-11-09 15:04:09 +0530115}
116
Andrey Petrov04a72c42017-03-01 15:51:57 -0800117static uint32_t read_bar(uint32_t offset)
118{
Subrata Banik38abbda2021-09-30 13:15:50 +0530119 return read32p(get_cse_bar() + offset);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800120}
121
122static void write_bar(uint32_t offset, uint32_t val)
123{
Subrata Banik38abbda2021-09-30 13:15:50 +0530124 return write32p(get_cse_bar() + offset, val);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800125}
126
127static uint32_t read_cse_csr(void)
128{
129 return read_bar(MMIO_CSE_CSR);
130}
131
132static uint32_t read_host_csr(void)
133{
134 return read_bar(MMIO_HOST_CSR);
135}
136
137static void write_host_csr(uint32_t data)
138{
139 write_bar(MMIO_HOST_CSR, data);
140}
141
142static size_t filled_slots(uint32_t data)
143{
144 uint8_t wp, rp;
145 rp = data >> CSR_RP_START;
146 wp = data >> CSR_WP_START;
147 return (uint8_t) (wp - rp);
148}
149
150static size_t cse_filled_slots(void)
151{
152 return filled_slots(read_cse_csr());
153}
154
155static size_t host_empty_slots(void)
156{
157 uint32_t csr;
158 csr = read_host_csr();
159
160 return ((csr & CSR_CBD) >> CSR_CBD_START) - filled_slots(csr);
161}
162
163static void clear_int(void)
164{
165 uint32_t csr;
166 csr = read_host_csr();
167 csr |= CSR_IS;
168 write_host_csr(csr);
169}
170
171static uint32_t read_slot(void)
172{
173 return read_bar(MMIO_CSE_CB_RW);
174}
175
176static void write_slot(uint32_t val)
177{
178 write_bar(MMIO_CSE_CB_WW, val);
179}
180
181static int wait_write_slots(size_t cnt)
182{
183 struct stopwatch sw;
184
Subrata Banik03aef282021-09-28 18:10:24 +0530185 stopwatch_init_msecs_expire(&sw, HECI_SEND_TIMEOUT_MS);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800186 while (host_empty_slots() < cnt) {
Subrata Banik03aef282021-09-28 18:10:24 +0530187 udelay(HECI_DELAY_US);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800188 if (stopwatch_expired(&sw)) {
189 printk(BIOS_ERR, "HECI: timeout, buffer not drained\n");
190 return 0;
191 }
192 }
193 return 1;
194}
195
196static int wait_read_slots(size_t cnt)
197{
198 struct stopwatch sw;
199
Subrata Banik03aef282021-09-28 18:10:24 +0530200 stopwatch_init_msecs_expire(&sw, HECI_READ_TIMEOUT_MS);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800201 while (cse_filled_slots() < cnt) {
Subrata Banik03aef282021-09-28 18:10:24 +0530202 udelay(HECI_DELAY_US);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800203 if (stopwatch_expired(&sw)) {
204 printk(BIOS_ERR, "HECI: timed out reading answer!\n");
205 return 0;
206 }
207 }
208 return 1;
209}
210
211/* get number of full 4-byte slots */
212static size_t bytes_to_slots(size_t bytes)
213{
214 return ALIGN_UP(bytes, SLOT_SIZE) / SLOT_SIZE;
215}
216
217static int cse_ready(void)
218{
219 uint32_t csr;
220 csr = read_cse_csr();
221 return csr & CSR_READY;
222}
223
Sridhar Siricilla8e465452019-09-23 20:59:38 +0530224static bool cse_check_hfs1_com(int mode)
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530225{
226 union me_hfsts1 hfs1;
227 hfs1.data = me_read_config32(PCI_ME_HFSTS1);
Sridhar Siricilla8e465452019-09-23 20:59:38 +0530228 return hfs1.fields.operation_mode == mode;
229}
230
231bool cse_is_hfs1_cws_normal(void)
232{
233 union me_hfsts1 hfs1;
234 hfs1.data = me_read_config32(PCI_ME_HFSTS1);
235 if (hfs1.fields.working_state == ME_HFS1_CWS_NORMAL)
236 return true;
237 return false;
238}
239
240bool cse_is_hfs1_com_normal(void)
241{
242 return cse_check_hfs1_com(ME_HFS1_COM_NORMAL);
243}
244
245bool cse_is_hfs1_com_secover_mei_msg(void)
246{
247 return cse_check_hfs1_com(ME_HFS1_COM_SECOVER_MEI_MSG);
248}
249
250bool cse_is_hfs1_com_soft_temp_disable(void)
251{
252 return cse_check_hfs1_com(ME_HFS1_COM_SOFT_TEMP_DISABLE);
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530253}
254
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530255bool cse_is_hfs3_fw_sku_lite(void)
Sridhar Siricilla3465d272020-02-06 15:31:04 +0530256{
257 union me_hfsts3 hfs3;
258 hfs3.data = me_read_config32(PCI_ME_HFSTS3);
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530259 return hfs3.fields.fw_sku == ME_HFS3_FW_SKU_LITE;
Sridhar Siricilla3465d272020-02-06 15:31:04 +0530260}
261
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530262/* Makes the host ready to communicate with CSE */
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530263void cse_set_host_ready(void)
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530264{
265 uint32_t csr;
266 csr = read_host_csr();
267 csr &= ~CSR_RESET;
268 csr |= (CSR_IG | CSR_READY);
269 write_host_csr(csr);
270}
271
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530272/* Polls for ME mode ME_HFS1_COM_SECOVER_MEI_MSG for 15 seconds */
273uint8_t cse_wait_sec_override_mode(void)
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530274{
275 struct stopwatch sw;
Subrata Banik03aef282021-09-28 18:10:24 +0530276 stopwatch_init_msecs_expire(&sw, HECI_DELAY_READY_MS);
Sridhar Siricilla8e465452019-09-23 20:59:38 +0530277 while (!cse_is_hfs1_com_secover_mei_msg()) {
Subrata Banik03aef282021-09-28 18:10:24 +0530278 udelay(HECI_DELAY_US);
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530279 if (stopwatch_expired(&sw)) {
280 printk(BIOS_ERR, "HECI: Timed out waiting for SEC_OVERRIDE mode!\n");
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530281 return 0;
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530282 }
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530283 }
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530284 printk(BIOS_DEBUG, "HECI: CSE took %lu ms to enter security override mode\n",
285 stopwatch_duration_msecs(&sw));
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530286 return 1;
287}
288
Sridhar Siricilla09ea3712019-11-12 23:35:50 +0530289/*
290 * Polls for CSE's current operation mode 'Soft Temporary Disable'.
291 * The CSE enters the current operation mode when it boots from RO(BP1).
292 */
293uint8_t cse_wait_com_soft_temp_disable(void)
294{
295 struct stopwatch sw;
Subrata Banikf5765812021-09-30 13:37:10 +0530296 stopwatch_init_msecs_expire(&sw, CSE_DELAY_BOOT_TO_RO_MS);
Sridhar Siricilla09ea3712019-11-12 23:35:50 +0530297 while (!cse_is_hfs1_com_soft_temp_disable()) {
Subrata Banik03aef282021-09-28 18:10:24 +0530298 udelay(HECI_DELAY_US);
Sridhar Siricilla09ea3712019-11-12 23:35:50 +0530299 if (stopwatch_expired(&sw)) {
300 printk(BIOS_ERR, "HECI: Timed out waiting for CSE to boot from RO!\n");
301 return 0;
302 }
303 }
304 printk(BIOS_SPEW, "HECI: CSE took %lu ms to boot from RO\n",
305 stopwatch_duration_msecs(&sw));
306 return 1;
307}
308
Andrey Petrov04a72c42017-03-01 15:51:57 -0800309static int wait_heci_ready(void)
310{
311 struct stopwatch sw;
312
Subrata Banik03aef282021-09-28 18:10:24 +0530313 stopwatch_init_msecs_expire(&sw, HECI_DELAY_READY_MS);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800314 while (!cse_ready()) {
Subrata Banik03aef282021-09-28 18:10:24 +0530315 udelay(HECI_DELAY_US);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800316 if (stopwatch_expired(&sw))
317 return 0;
318 }
319
320 return 1;
321}
322
323static void host_gen_interrupt(void)
324{
325 uint32_t csr;
326 csr = read_host_csr();
327 csr |= CSR_IG;
328 write_host_csr(csr);
329}
330
331static size_t hdr_get_length(uint32_t hdr)
332{
333 return (hdr & MEI_HDR_LENGTH) >> MEI_HDR_LENGTH_START;
334}
335
336static int
337send_one_message(uint32_t hdr, const void *buff)
338{
339 size_t pend_len, pend_slots, remainder, i;
340 uint32_t tmp;
341 const uint32_t *p = buff;
342
343 /* Get space for the header */
344 if (!wait_write_slots(1))
345 return 0;
346
347 /* First, write header */
348 write_slot(hdr);
349
350 pend_len = hdr_get_length(hdr);
351 pend_slots = bytes_to_slots(pend_len);
352
353 if (!wait_write_slots(pend_slots))
354 return 0;
355
356 /* Write the body in whole slots */
357 i = 0;
358 while (i < ALIGN_DOWN(pend_len, SLOT_SIZE)) {
359 write_slot(*p++);
360 i += SLOT_SIZE;
361 }
362
363 remainder = pend_len % SLOT_SIZE;
364 /* Pad to 4 bytes not touching caller's buffer */
365 if (remainder) {
366 memcpy(&tmp, p, remainder);
367 write_slot(tmp);
368 }
369
370 host_gen_interrupt();
371
372 /* Make sure nothing bad happened during transmission */
373 if (!cse_ready())
374 return 0;
375
376 return pend_len;
377}
378
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530379/*
380 * Send message msg of size len to host from host_addr to cse_addr.
381 * Returns 1 on success and 0 otherwise.
382 * In case of error heci_reset() may be required.
383 */
384static int
Andrey Petrov04a72c42017-03-01 15:51:57 -0800385heci_send(const void *msg, size_t len, uint8_t host_addr, uint8_t client_addr)
386{
Subrata Banik5c08c732017-11-13 14:54:37 +0530387 uint8_t retry;
Andrey Petrov04a72c42017-03-01 15:51:57 -0800388 uint32_t csr, hdr;
Subrata Banik5c08c732017-11-13 14:54:37 +0530389 size_t sent, remaining, cb_size, max_length;
390 const uint8_t *p;
Andrey Petrov04a72c42017-03-01 15:51:57 -0800391
392 if (!msg || !len)
393 return 0;
394
395 clear_int();
396
Subrata Banik5c08c732017-11-13 14:54:37 +0530397 for (retry = 0; retry < MAX_HECI_MESSAGE_RETRY_COUNT; retry++) {
398 p = msg;
Andrey Petrov04a72c42017-03-01 15:51:57 -0800399
Subrata Banik5c08c732017-11-13 14:54:37 +0530400 if (!wait_heci_ready()) {
401 printk(BIOS_ERR, "HECI: not ready\n");
402 continue;
403 }
Andrey Petrov04a72c42017-03-01 15:51:57 -0800404
Subrata Banik4a722f52017-11-13 14:56:42 +0530405 csr = read_host_csr();
Subrata Banik5c08c732017-11-13 14:54:37 +0530406 cb_size = ((csr & CSR_CBD) >> CSR_CBD_START) * SLOT_SIZE;
407 /*
408 * Reserve one slot for the header. Limit max message
409 * length by 9 bits that are available in the header.
410 */
411 max_length = MIN(cb_size, (1 << MEI_HDR_LENGTH_SIZE) - 1)
412 - SLOT_SIZE;
413 remaining = len;
414
415 /*
416 * Fragment the message into smaller messages not exceeding
Jonathan Neuschäfer5268b762018-02-12 12:24:25 +0100417 * useful circular buffer length. Mark last message complete.
Subrata Banik5c08c732017-11-13 14:54:37 +0530418 */
419 do {
420 hdr = MIN(max_length, remaining)
421 << MEI_HDR_LENGTH_START;
422 hdr |= client_addr << MEI_HDR_CSE_ADDR_START;
423 hdr |= host_addr << MEI_HDR_HOST_ADDR_START;
424 hdr |= (MIN(max_length, remaining) == remaining) ?
Lee Leahy68ab0b52017-03-10 13:42:34 -0800425 MEI_HDR_IS_COMPLETE : 0;
Subrata Banik5c08c732017-11-13 14:54:37 +0530426 sent = send_one_message(hdr, p);
427 p += sent;
428 remaining -= sent;
429 } while (remaining > 0 && sent != 0);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800430
Subrata Banik5c08c732017-11-13 14:54:37 +0530431 if (!remaining)
432 return 1;
433 }
434 return 0;
Andrey Petrov04a72c42017-03-01 15:51:57 -0800435}
436
437static size_t
438recv_one_message(uint32_t *hdr, void *buff, size_t maxlen)
439{
440 uint32_t reg, *p = buff;
441 size_t recv_slots, recv_len, remainder, i;
442
443 /* first get the header */
444 if (!wait_read_slots(1))
445 return 0;
446
447 *hdr = read_slot();
448 recv_len = hdr_get_length(*hdr);
449
450 if (!recv_len)
451 printk(BIOS_WARNING, "HECI: message is zero-sized\n");
452
453 recv_slots = bytes_to_slots(recv_len);
454
455 i = 0;
456 if (recv_len > maxlen) {
457 printk(BIOS_ERR, "HECI: response is too big\n");
458 return 0;
459 }
460
461 /* wait for the rest of messages to arrive */
462 wait_read_slots(recv_slots);
463
464 /* fetch whole slots first */
465 while (i < ALIGN_DOWN(recv_len, SLOT_SIZE)) {
466 *p++ = read_slot();
467 i += SLOT_SIZE;
468 }
469
Subrata Banik5c08c732017-11-13 14:54:37 +0530470 /*
471 * If ME is not ready, something went wrong and
472 * we received junk
473 */
474 if (!cse_ready())
475 return 0;
476
Andrey Petrov04a72c42017-03-01 15:51:57 -0800477 remainder = recv_len % SLOT_SIZE;
478
479 if (remainder) {
480 reg = read_slot();
481 memcpy(p, &reg, remainder);
482 }
483
484 return recv_len;
485}
486
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530487/*
488 * Receive message into buff not exceeding maxlen. Message is considered
489 * successfully received if a 'complete' indication is read from ME side
490 * and there was enough space in the buffer to fit that message. maxlen
491 * is updated with size of message that was received. Returns 0 on failure
492 * and 1 on success.
493 * In case of error heci_reset() may be required.
494 */
495static int heci_receive(void *buff, size_t *maxlen)
Andrey Petrov04a72c42017-03-01 15:51:57 -0800496{
Subrata Banik5c08c732017-11-13 14:54:37 +0530497 uint8_t retry;
Andrey Petrov04a72c42017-03-01 15:51:57 -0800498 size_t left, received;
499 uint32_t hdr = 0;
Subrata Banik5c08c732017-11-13 14:54:37 +0530500 uint8_t *p;
Andrey Petrov04a72c42017-03-01 15:51:57 -0800501
502 if (!buff || !maxlen || !*maxlen)
503 return 0;
504
Andrey Petrov04a72c42017-03-01 15:51:57 -0800505 clear_int();
506
Subrata Banik5c08c732017-11-13 14:54:37 +0530507 for (retry = 0; retry < MAX_HECI_MESSAGE_RETRY_COUNT; retry++) {
508 p = buff;
509 left = *maxlen;
510
511 if (!wait_heci_ready()) {
512 printk(BIOS_ERR, "HECI: not ready\n");
513 continue;
514 }
515
516 /*
517 * Receive multiple packets until we meet one marked
518 * complete or we run out of space in caller-provided buffer.
519 */
520 do {
521 received = recv_one_message(&hdr, p, left);
Lijian Zhaoc50296d2017-12-15 19:10:18 -0800522 if (!received) {
Elyes HAOUAS3d450002018-08-09 18:55:58 +0200523 printk(BIOS_ERR, "HECI: Failed to receive!\n");
Lijian Zhaoc50296d2017-12-15 19:10:18 -0800524 return 0;
525 }
Subrata Banik5c08c732017-11-13 14:54:37 +0530526 left -= received;
527 p += received;
528 /* If we read out everything ping to send more */
529 if (!(hdr & MEI_HDR_IS_COMPLETE) && !cse_filled_slots())
530 host_gen_interrupt();
531 } while (received && !(hdr & MEI_HDR_IS_COMPLETE) && left > 0);
532
533 if ((hdr & MEI_HDR_IS_COMPLETE) && received) {
534 *maxlen = p - (uint8_t *) buff;
535 return 1;
536 }
Andrey Petrov04a72c42017-03-01 15:51:57 -0800537 }
Subrata Banik5c08c732017-11-13 14:54:37 +0530538 return 0;
Andrey Petrov04a72c42017-03-01 15:51:57 -0800539}
540
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530541int heci_send_receive(const void *snd_msg, size_t snd_sz, void *rcv_msg, size_t *rcv_sz,
542 uint8_t cse_addr)
Sridhar Siricillaa5208f52019-08-30 17:10:24 +0530543{
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530544 if (!heci_send(snd_msg, snd_sz, BIOS_HOST_ADDR, cse_addr)) {
Sridhar Siricillaa5208f52019-08-30 17:10:24 +0530545 printk(BIOS_ERR, "HECI: send Failed\n");
546 return 0;
547 }
548
549 if (rcv_msg != NULL) {
550 if (!heci_receive(rcv_msg, rcv_sz)) {
551 printk(BIOS_ERR, "HECI: receive Failed\n");
552 return 0;
553 }
554 }
555 return 1;
556}
557
Andrey Petrov04a72c42017-03-01 15:51:57 -0800558/*
559 * Attempt to reset the device. This is useful when host and ME are out
560 * of sync during transmission or ME didn't understand the message.
561 */
562int heci_reset(void)
563{
564 uint32_t csr;
565
Duncan Laurie15ca9032020-11-05 10:09:07 -0800566 /* Clear post code to prevent eventlog entry from unknown code. */
567 post_code(0);
568
Andrey Petrov04a72c42017-03-01 15:51:57 -0800569 /* Send reset request */
570 csr = read_host_csr();
Sridhar Siricillab9d075b2019-08-31 11:38:33 +0530571 csr |= (CSR_RESET | CSR_IG);
Andrey Petrov04a72c42017-03-01 15:51:57 -0800572 write_host_csr(csr);
573
574 if (wait_heci_ready()) {
575 /* Device is back on its imaginary feet, clear reset */
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530576 cse_set_host_ready();
Andrey Petrov04a72c42017-03-01 15:51:57 -0800577 return 1;
578 }
579
580 printk(BIOS_CRIT, "HECI: reset failed\n");
581
582 return 0;
583}
584
Sridhar Siricilla2cc66912019-08-31 11:20:34 +0530585bool is_cse_enabled(void)
586{
587 const struct device *cse_dev = pcidev_path_on_root(PCH_DEVFN_CSE);
588
589 if (!cse_dev || !cse_dev->enabled) {
590 printk(BIOS_WARNING, "HECI: No CSE device\n");
591 return false;
592 }
593
594 if (pci_read_config16(PCH_DEV_CSE, PCI_VENDOR_ID) == 0xFFFF) {
595 printk(BIOS_WARNING, "HECI: CSE device is hidden\n");
596 return false;
597 }
598
599 return true;
600}
601
602uint32_t me_read_config32(int offset)
603{
604 return pci_read_config32(PCH_DEV_CSE, offset);
605}
606
Sridhar Siricilla59c7cb7d2020-02-07 11:59:30 +0530607static bool cse_is_global_reset_allowed(void)
608{
609 /*
610 * Allow sending GLOBAL_RESET command only if:
611 * - CSE's current working state is Normal and current operation mode is Normal.
612 * - (or) CSE's current working state is normal and current operation mode can
613 * be Soft Temp Disable or Security Override Mode if CSE's Firmware SKU is
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530614 * Lite.
Sridhar Siricilla59c7cb7d2020-02-07 11:59:30 +0530615 */
616 if (!cse_is_hfs1_cws_normal())
617 return false;
618
619 if (cse_is_hfs1_com_normal())
620 return true;
621
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530622 if (cse_is_hfs3_fw_sku_lite()) {
Sridhar Siricilla59c7cb7d2020-02-07 11:59:30 +0530623 if (cse_is_hfs1_com_soft_temp_disable() || cse_is_hfs1_com_secover_mei_msg())
624 return true;
625 }
626 return false;
627}
628
Sridhar Siricillad415c202019-08-31 14:54:57 +0530629/*
Subrata Banikf463dc02020-09-14 19:04:03 +0530630 * Sends GLOBAL_RESET_REQ cmd to CSE with reset type GLOBAL_RESET.
631 * Returns 0 on failure and 1 on success.
Sridhar Siricillad415c202019-08-31 14:54:57 +0530632 */
Subrata Banikf463dc02020-09-14 19:04:03 +0530633static int cse_request_reset(enum rst_req_type rst_type)
Sridhar Siricillad415c202019-08-31 14:54:57 +0530634{
635 int status;
636 struct mkhi_hdr reply;
637 struct reset_message {
638 struct mkhi_hdr hdr;
639 uint8_t req_origin;
640 uint8_t reset_type;
641 } __packed;
642 struct reset_message msg = {
643 .hdr = {
644 .group_id = MKHI_GROUP_ID_CBM,
Sridhar Siricillae202e672020-01-07 23:36:40 +0530645 .command = MKHI_CBM_GLOBAL_RESET_REQ,
Sridhar Siricillad415c202019-08-31 14:54:57 +0530646 },
647 .req_origin = GR_ORIGIN_BIOS_POST,
648 .reset_type = rst_type
649 };
650 size_t reply_size;
651
Sridhar Siricillaf2eb6872019-12-05 19:54:16 +0530652 printk(BIOS_DEBUG, "HECI: Global Reset(Type:%d) Command\n", rst_type);
Sridhar Siricilla59c7cb7d2020-02-07 11:59:30 +0530653
Sridhar Siricillac2a2d2b2020-02-27 17:16:13 +0530654 if (!(rst_type == GLOBAL_RESET || rst_type == CSE_RESET_ONLY)) {
Sridhar Siricillaf2eb6872019-12-05 19:54:16 +0530655 printk(BIOS_ERR, "HECI: Unsupported reset type is requested\n");
656 return 0;
657 }
Sridhar Siricillad415c202019-08-31 14:54:57 +0530658
Subrata Banikf463dc02020-09-14 19:04:03 +0530659 if (!cse_is_global_reset_allowed() || !is_cse_enabled()) {
Sridhar Siricilla59c7cb7d2020-02-07 11:59:30 +0530660 printk(BIOS_ERR, "HECI: CSE does not meet required prerequisites\n");
661 return 0;
662 }
663
Sridhar Siricillad415c202019-08-31 14:54:57 +0530664 heci_reset();
665
666 reply_size = sizeof(reply);
667 memset(&reply, 0, reply_size);
668
Sridhar Siricillad415c202019-08-31 14:54:57 +0530669 if (rst_type == CSE_RESET_ONLY)
Sridhar Siricillaf2eb6872019-12-05 19:54:16 +0530670 status = heci_send(&msg, sizeof(msg), BIOS_HOST_ADDR, HECI_MKHI_ADDR);
Sridhar Siricillad415c202019-08-31 14:54:57 +0530671 else
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530672 status = heci_send_receive(&msg, sizeof(msg), &reply, &reply_size,
673 HECI_MKHI_ADDR);
Sridhar Siricillad415c202019-08-31 14:54:57 +0530674
Sridhar Siricillaf2eb6872019-12-05 19:54:16 +0530675 printk(BIOS_DEBUG, "HECI: Global Reset %s!\n", status ? "success" : "failure");
676 return status;
Sridhar Siricillad415c202019-08-31 14:54:57 +0530677}
678
Subrata Banikf463dc02020-09-14 19:04:03 +0530679int cse_request_global_reset(void)
680{
681 return cse_request_reset(GLOBAL_RESET);
682}
683
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530684static bool cse_is_hmrfpo_enable_allowed(void)
685{
686 /*
687 * Allow sending HMRFPO ENABLE command only if:
688 * - CSE's current working state is Normal and current operation mode is Normal
689 * - (or) cse's current working state is normal and current operation mode is
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530690 * Soft Temp Disable if CSE's Firmware SKU is Lite
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530691 */
692 if (!cse_is_hfs1_cws_normal())
693 return false;
694
695 if (cse_is_hfs1_com_normal())
696 return true;
697
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530698 if (cse_is_hfs3_fw_sku_lite() && cse_is_hfs1_com_soft_temp_disable())
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530699 return true;
700
701 return false;
702}
703
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530704/* Sends HMRFPO Enable command to CSE */
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530705int cse_hmrfpo_enable(void)
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530706{
707 struct hmrfpo_enable_msg {
708 struct mkhi_hdr hdr;
709 uint32_t nonce[2];
710 } __packed;
711
712 /* HMRFPO Enable message */
713 struct hmrfpo_enable_msg msg = {
714 .hdr = {
Sridhar Siricillae202e672020-01-07 23:36:40 +0530715 .group_id = MKHI_GROUP_ID_HMRFPO,
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530716 .command = MKHI_HMRFPO_ENABLE,
717 },
718 .nonce = {0},
719 };
720
721 /* HMRFPO Enable response */
722 struct hmrfpo_enable_resp {
723 struct mkhi_hdr hdr;
Sridhar Siricillae202e672020-01-07 23:36:40 +0530724 /* Base addr for factory data area, not relevant for client SKUs */
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530725 uint32_t fct_base;
Sridhar Siricillae202e672020-01-07 23:36:40 +0530726 /* Length of factory data area, not relevant for client SKUs */
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530727 uint32_t fct_limit;
728 uint8_t status;
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530729 uint8_t reserved[3];
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530730 } __packed;
731
732 struct hmrfpo_enable_resp resp;
733 size_t resp_size = sizeof(struct hmrfpo_enable_resp);
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530734
735 printk(BIOS_DEBUG, "HECI: Send HMRFPO Enable Command\n");
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530736
737 if (!cse_is_hmrfpo_enable_allowed()) {
738 printk(BIOS_ERR, "HECI: CSE does not meet required prerequisites\n");
739 return 0;
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530740 }
741
742 if (!heci_send_receive(&msg, sizeof(struct hmrfpo_enable_msg),
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530743 &resp, &resp_size, HECI_MKHI_ADDR))
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530744 return 0;
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530745
746 if (resp.hdr.result) {
747 printk(BIOS_ERR, "HECI: Resp Failed:%d\n", resp.hdr.result);
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530748 return 0;
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530749 }
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530750
Sridhar Siricillad16187e2019-11-27 16:02:47 +0530751 if (resp.status) {
752 printk(BIOS_ERR, "HECI: HMRFPO_Enable Failed (resp status: %d)\n", resp.status);
753 return 0;
754 }
755
756 return 1;
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530757}
758
759/*
760 * Sends HMRFPO Get Status command to CSE to get the HMRFPO status.
Sridhar Siricilla63be9182020-01-19 12:38:56 +0530761 * The status can be DISABLED/LOCKED/ENABLED
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530762 */
Sridhar Siricillaff072e62019-11-27 14:55:16 +0530763int cse_hmrfpo_get_status(void)
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530764{
765 struct hmrfpo_get_status_msg {
766 struct mkhi_hdr hdr;
767 } __packed;
768
769 struct hmrfpo_get_status_resp {
770 struct mkhi_hdr hdr;
771 uint8_t status;
Sridhar Siricilla63be9182020-01-19 12:38:56 +0530772 uint8_t reserved[3];
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530773 } __packed;
774
775 struct hmrfpo_get_status_msg msg = {
776 .hdr = {
Sridhar Siricillae202e672020-01-07 23:36:40 +0530777 .group_id = MKHI_GROUP_ID_HMRFPO,
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530778 .command = MKHI_HMRFPO_GET_STATUS,
779 },
780 };
781 struct hmrfpo_get_status_resp resp;
782 size_t resp_size = sizeof(struct hmrfpo_get_status_resp);
783
784 printk(BIOS_INFO, "HECI: Sending Get HMRFPO Status Command\n");
785
Sridhar Siricilla206905c2020-02-06 18:48:22 +0530786 if (!cse_is_hfs1_cws_normal()) {
787 printk(BIOS_ERR, "HECI: CSE's current working state is not Normal\n");
788 return -1;
789 }
790
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530791 if (!heci_send_receive(&msg, sizeof(struct hmrfpo_get_status_msg),
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530792 &resp, &resp_size, HECI_MKHI_ADDR)) {
Sridhar Siricillae30a0e62019-08-31 16:12:21 +0530793 printk(BIOS_ERR, "HECI: HMRFPO send/receive fail\n");
794 return -1;
795 }
796
797 if (resp.hdr.result) {
798 printk(BIOS_ERR, "HECI: HMRFPO Resp Failed:%d\n",
799 resp.hdr.result);
800 return -1;
801 }
802
803 return resp.status;
804}
805
Sridhar Siricilla24a974a2020-02-19 14:41:36 +0530806void print_me_fw_version(void *unused)
807{
808 struct version {
809 uint16_t minor;
810 uint16_t major;
811 uint16_t build;
812 uint16_t hotfix;
813 } __packed;
814
815 struct fw_ver_resp {
816 struct mkhi_hdr hdr;
817 struct version code;
818 struct version rec;
819 struct version fitc;
820 } __packed;
821
822 const struct mkhi_hdr fw_ver_msg = {
823 .group_id = MKHI_GROUP_ID_GEN,
824 .command = MKHI_GEN_GET_FW_VERSION,
825 };
826
827 struct fw_ver_resp resp;
828 size_t resp_size = sizeof(resp);
829
830 /* Ignore if UART debugging is disabled */
831 if (!CONFIG(CONSOLE_SERIAL))
832 return;
833
Wim Vervoorn8602fb72020-03-30 12:17:54 +0200834 /* Ignore if CSE is disabled */
835 if (!is_cse_enabled())
836 return;
837
Sridhar Siricilla24a974a2020-02-19 14:41:36 +0530838 /*
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530839 * Ignore if ME Firmware SKU type is Lite since
Sridhar Siricilla24a974a2020-02-19 14:41:36 +0530840 * print_boot_partition_info() logs RO(BP1) and RW(BP2) versions.
841 */
Sridhar Siricilla99dbca32020-05-12 21:05:04 +0530842 if (cse_is_hfs3_fw_sku_lite())
Sridhar Siricilla24a974a2020-02-19 14:41:36 +0530843 return;
844
845 /*
846 * Prerequisites:
847 * 1) HFSTS1 Current Working State is Normal
848 * 2) HFSTS1 Current Operation Mode is Normal
849 * 3) It's after DRAM INIT DONE message (taken care of by calling it
850 * during ramstage
851 */
852 if (!cse_is_hfs1_cws_normal() || !cse_is_hfs1_com_normal())
853 goto fail;
854
855 heci_reset();
856
Rizwan Qureshi957857d2021-08-30 16:43:57 +0530857 if (!heci_send_receive(&fw_ver_msg, sizeof(fw_ver_msg), &resp, &resp_size,
858 HECI_MKHI_ADDR))
Sridhar Siricilla24a974a2020-02-19 14:41:36 +0530859 goto fail;
860
861 if (resp.hdr.result)
862 goto fail;
863
864 printk(BIOS_DEBUG, "ME: Version: %d.%d.%d.%d\n", resp.code.major,
865 resp.code.minor, resp.code.hotfix, resp.code.build);
866 return;
867
868fail:
869 printk(BIOS_DEBUG, "ME: Version: Unavailable\n");
870}
871
Tim Wawrzynczak09635f42021-06-18 10:08:47 -0600872void cse_trigger_vboot_recovery(enum csme_failure_reason reason)
873{
874 printk(BIOS_DEBUG, "cse: CSE status registers: HFSTS1: 0x%x, HFSTS2: 0x%x "
875 "HFSTS3: 0x%x\n", me_read_config32(PCI_ME_HFSTS1),
876 me_read_config32(PCI_ME_HFSTS2), me_read_config32(PCI_ME_HFSTS3));
877
878 if (CONFIG(VBOOT)) {
879 struct vb2_context *ctx = vboot_get_context();
880 if (ctx == NULL)
881 goto failure;
882 vb2api_fail(ctx, VB2_RECOVERY_INTEL_CSE_LITE_SKU, reason);
883 vboot_save_data(ctx);
884 vboot_reboot();
885 }
886failure:
887 die("cse: Failed to trigger recovery mode(recovery subcode:%d)\n", reason);
888}
889
Subrata Banika219edb2021-09-25 15:02:37 +0530890static bool disable_cse_idle(void)
891{
892 struct stopwatch sw;
893 uint32_t dev_idle_ctrl = read_bar(MMIO_CSE_DEVIDLE);
894 dev_idle_ctrl &= ~CSE_DEV_IDLE;
895 write_bar(MMIO_CSE_DEVIDLE, dev_idle_ctrl);
896
Subrata Banik03aef282021-09-28 18:10:24 +0530897 stopwatch_init_usecs_expire(&sw, HECI_CIP_TIMEOUT_US);
Subrata Banika219edb2021-09-25 15:02:37 +0530898 do {
899 dev_idle_ctrl = read_bar(MMIO_CSE_DEVIDLE);
900 if ((dev_idle_ctrl & CSE_DEV_CIP) == CSE_DEV_CIP)
901 return true;
Subrata Banik03aef282021-09-28 18:10:24 +0530902 udelay(HECI_DELAY_US);
Subrata Banika219edb2021-09-25 15:02:37 +0530903 } while (!stopwatch_expired(&sw));
904
905 return false;
906}
907
908static void enable_cse_idle(void)
909{
910 uint32_t dev_idle_ctrl = read_bar(MMIO_CSE_DEVIDLE);
911 dev_idle_ctrl |= CSE_DEV_IDLE;
912 write_bar(MMIO_CSE_DEVIDLE, dev_idle_ctrl);
913}
914
915enum cse_device_state get_cse_device_state(void)
916{
917 uint32_t dev_idle_ctrl = read_bar(MMIO_CSE_DEVIDLE);
918 if ((dev_idle_ctrl & CSE_DEV_IDLE) == CSE_DEV_IDLE)
919 return DEV_IDLE;
920
921 return DEV_ACTIVE;
922}
923
924static enum cse_device_state ensure_cse_active(void)
925{
926 if (!disable_cse_idle())
927 return DEV_IDLE;
928 pci_or_config32(PCH_DEV_CSE, PCI_COMMAND, PCI_COMMAND_MEMORY |
929 PCI_COMMAND_MASTER);
930
931 return DEV_ACTIVE;
932}
933
934static void ensure_cse_idle(void)
935{
936 enable_cse_idle();
937
938 pci_and_config32(PCH_DEV_CSE, PCI_COMMAND, ~(PCI_COMMAND_MEMORY |
939 PCI_COMMAND_MASTER));
940}
941
942bool set_cse_device_state(enum cse_device_state requested_state)
943{
944 enum cse_device_state current_state = get_cse_device_state();
945
946 if (current_state == requested_state)
947 return true;
948
949 if (requested_state == DEV_ACTIVE)
950 return ensure_cse_active() == requested_state;
951 else
952 ensure_cse_idle();
953
954 return true;
955}
956
Andrey Petrov04a72c42017-03-01 15:51:57 -0800957#if ENV_RAMSTAGE
958
Andrey Petrov04a72c42017-03-01 15:51:57 -0800959static struct device_operations cse_ops = {
Subrata Banik38abbda2021-09-30 13:15:50 +0530960 .set_resources = pci_dev_set_resources,
Andrey Petrov04a72c42017-03-01 15:51:57 -0800961 .read_resources = pci_dev_read_resources,
962 .enable_resources = pci_dev_enable_resources,
963 .init = pci_dev_init,
Subrata Banik6bbc91a2017-12-07 14:55:51 +0530964 .ops_pci = &pci_dev_ops_pci,
Andrey Petrov04a72c42017-03-01 15:51:57 -0800965};
966
Hannah Williams63142152017-06-12 14:03:18 -0700967static const unsigned short pci_device_ids[] = {
968 PCI_DEVICE_ID_INTEL_APL_CSE0,
969 PCI_DEVICE_ID_INTEL_GLK_CSE0,
Andrey Petrov0405de92017-06-05 13:25:29 -0700970 PCI_DEVICE_ID_INTEL_CNL_CSE0,
Subrata Banikd0586d22017-11-27 13:28:41 +0530971 PCI_DEVICE_ID_INTEL_SKL_CSE0,
Maxim Polyakov571d07d2019-08-22 13:11:32 +0300972 PCI_DEVICE_ID_INTEL_LWB_CSE0,
973 PCI_DEVICE_ID_INTEL_LWB_CSE0_SUPER,
praveen hodagatta praneshe26c4a42018-09-20 03:49:45 +0800974 PCI_DEVICE_ID_INTEL_CNP_H_CSE0,
Aamir Bohra9eac0392018-06-30 12:07:04 +0530975 PCI_DEVICE_ID_INTEL_ICL_CSE0,
Ronak Kanabarda7ffb482019-02-05 01:51:13 +0530976 PCI_DEVICE_ID_INTEL_CMP_CSE0,
Gaggery Tsai12a651c2019-12-05 11:23:20 -0800977 PCI_DEVICE_ID_INTEL_CMP_H_CSE0,
Ravi Sarawadi6b5bf402019-10-21 22:25:04 -0700978 PCI_DEVICE_ID_INTEL_TGL_CSE0,
Jeremy Soller191a8d72021-08-10 14:06:51 -0600979 PCI_DEVICE_ID_INTEL_TGL_H_CSE0,
Tan, Lean Sheng26136092020-01-20 19:13:56 -0800980 PCI_DEVICE_ID_INTEL_MCC_CSE0,
981 PCI_DEVICE_ID_INTEL_MCC_CSE1,
982 PCI_DEVICE_ID_INTEL_MCC_CSE2,
983 PCI_DEVICE_ID_INTEL_MCC_CSE3,
Meera Ravindranath3f4af0d2020-02-12 16:01:22 +0530984 PCI_DEVICE_ID_INTEL_JSP_CSE0,
985 PCI_DEVICE_ID_INTEL_JSP_CSE1,
986 PCI_DEVICE_ID_INTEL_JSP_CSE2,
987 PCI_DEVICE_ID_INTEL_JSP_CSE3,
Subrata Banikf672f7f2020-08-03 14:29:25 +0530988 PCI_DEVICE_ID_INTEL_ADP_P_CSE0,
989 PCI_DEVICE_ID_INTEL_ADP_P_CSE1,
990 PCI_DEVICE_ID_INTEL_ADP_P_CSE2,
991 PCI_DEVICE_ID_INTEL_ADP_P_CSE3,
992 PCI_DEVICE_ID_INTEL_ADP_S_CSE0,
993 PCI_DEVICE_ID_INTEL_ADP_S_CSE1,
994 PCI_DEVICE_ID_INTEL_ADP_S_CSE2,
995 PCI_DEVICE_ID_INTEL_ADP_S_CSE3,
Varshit Pandyaf4d98fdd22021-01-17 18:39:29 +0530996 PCI_DEVICE_ID_INTEL_ADP_M_CSE0,
997 PCI_DEVICE_ID_INTEL_ADP_M_CSE1,
998 PCI_DEVICE_ID_INTEL_ADP_M_CSE2,
999 PCI_DEVICE_ID_INTEL_ADP_M_CSE3,
Hannah Williams63142152017-06-12 14:03:18 -07001000 0,
1001};
1002
Andrey Petrov04a72c42017-03-01 15:51:57 -08001003static const struct pci_driver cse_driver __pci_driver = {
1004 .ops = &cse_ops,
1005 .vendor = PCI_VENDOR_ID_INTEL,
1006 /* SoC/chipset needs to provide PCI device ID */
Andrey Petrov0405de92017-06-05 13:25:29 -07001007 .devices = pci_device_ids
Andrey Petrov04a72c42017-03-01 15:51:57 -08001008};
1009
1010#endif