blob: 64a315d30e833e406a2e2be0f7f7b35ca5fb5fce [file] [log] [blame]
Duncan Lauriec88c54c2014-04-30 16:36:13 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 * Copyright (C) 2014 Google Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of 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.
Duncan Lauriec88c54c2014-04-30 16:36:13 -070015 */
16
17#include <delay.h>
18#include <types.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070019#include <arch/io.h>
20#include <console/console.h>
21#include <cpu/x86/cache.h>
22#include <device/pci_def.h>
23#include <cpu/x86/smm.h>
24#include <spi-generic.h>
25#include <elog.h>
Patrick Georgi546953c2014-11-29 10:38:17 +010026#include <halt.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070027#include <pc80/mc146818rtc.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070028#include <soc/lpc.h>
29#include <soc/nvs.h>
30#include <soc/pci_devs.h>
31#include <soc/pm.h>
32#include <soc/rcba.h>
33#include <soc/smm.h>
34#include <soc/xhci.h>
Duncan Laurief3e0a132015-01-14 17:33:00 -080035#include <drivers/intel/gma/i915_reg.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070036
37static u8 smm_initialized = 0;
38
39/*
40 * GNVS needs to be updated by an 0xEA PM Trap (B2) after it has been located
41 * by coreboot.
42 */
43static global_nvs_t *gnvs;
44global_nvs_t *smm_get_gnvs(void)
45{
46 return gnvs;
47}
48
49int southbridge_io_trap_handler(int smif)
50{
51 switch (smif) {
52 case 0x32:
53 printk(BIOS_DEBUG, "OS Init\n");
54 /* gnvs->smif:
55 * On success, the IO Trap Handler returns 0
56 * On failure, the IO Trap Handler returns a value != 0
57 */
58 gnvs->smif = 0;
59 return 1; /* IO trap handled */
60 }
61
62 /* Not handled */
63 return 0;
64}
65
66/**
67 * @brief Set the EOS bit
68 */
69void southbridge_smi_set_eos(void)
70{
71 enable_smi(EOS);
72}
73
74static void busmaster_disable_on_bus(int bus)
75{
Lee Leahy26b7cd02017-03-16 18:47:55 -070076 int slot, func;
77 unsigned int val;
78 unsigned char hdr;
Duncan Lauriec88c54c2014-04-30 16:36:13 -070079
Lee Leahy26b7cd02017-03-16 18:47:55 -070080 for (slot = 0; slot < 0x20; slot++) {
81 for (func = 0; func < 8; func++) {
82 u32 reg32;
Elyes HAOUAS68c851b2018-06-12 22:06:09 +020083#if defined(__SIMPLE_DEVICE__)
84 pci_devfn_t dev = PCI_DEV(bus, slot, func);
85#else
86 struct device *dev = PCI_DEV(bus, slot, func);
87#endif
Duncan Lauriec88c54c2014-04-30 16:36:13 -070088
Lee Leahy26b7cd02017-03-16 18:47:55 -070089 val = pci_read_config32(dev, PCI_VENDOR_ID);
Duncan Lauriec88c54c2014-04-30 16:36:13 -070090
Lee Leahy26b7cd02017-03-16 18:47:55 -070091 if (val == 0xffffffff || val == 0x00000000 ||
92 val == 0x0000ffff || val == 0xffff0000)
93 continue;
Duncan Lauriec88c54c2014-04-30 16:36:13 -070094
Lee Leahy26b7cd02017-03-16 18:47:55 -070095 /* Disable Bus Mastering for this one device */
96 reg32 = pci_read_config32(dev, PCI_COMMAND);
97 reg32 &= ~PCI_COMMAND_MASTER;
98 pci_write_config32(dev, PCI_COMMAND, reg32);
Duncan Lauriec88c54c2014-04-30 16:36:13 -070099
Lee Leahy26b7cd02017-03-16 18:47:55 -0700100 /* If this is a bridge, then follow it. */
101 hdr = pci_read_config8(dev, PCI_HEADER_TYPE);
102 hdr &= 0x7f;
103 if (hdr == PCI_HEADER_TYPE_BRIDGE ||
104 hdr == PCI_HEADER_TYPE_CARDBUS) {
105 unsigned int buses;
106 buses = pci_read_config32(dev, PCI_PRIMARY_BUS);
107 busmaster_disable_on_bus((buses >> 8) & 0xff);
108 }
109 }
110 }
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700111}
112
Duncan Laurief3e0a132015-01-14 17:33:00 -0800113/*
114 * Turn off the backlight if it is on, and wait for the specified
115 * backlight off delay. This will allow panel power timings to meet
116 * spec and prevent brief garbage on the screen when turned off
117 * during firmware with power button triggered SMI.
118 */
119static void backlight_off(void)
120{
121 void *reg_base;
122 uint32_t pp_ctrl;
123 uint32_t bl_off_delay;
124
Lee Leahy6ef51922017-03-17 10:56:08 -0700125 reg_base = (void *)((uintptr_t)pci_read_config32(SA_DEV_IGD,
126 PCI_BASE_ADDRESS_0) & ~0xf);
Duncan Laurief3e0a132015-01-14 17:33:00 -0800127
128 /* Check if backlight is enabled */
129 pp_ctrl = read32(reg_base + PCH_PP_CONTROL);
130 if (!(pp_ctrl & EDP_BLC_ENABLE))
131 return;
132
133 /* Enable writes to this register */
134 pp_ctrl &= ~PANEL_UNLOCK_MASK;
135 pp_ctrl |= PANEL_UNLOCK_REGS;
136
137 /* Turn off backlight */
138 pp_ctrl &= ~EDP_BLC_ENABLE;
139
140 write32(reg_base + PCH_PP_CONTROL, pp_ctrl);
141 read32(reg_base + PCH_PP_CONTROL);
142
143 /* Read backlight off delay in 100us units */
144 bl_off_delay = read32(reg_base + PCH_PP_OFF_DELAYS);
145 bl_off_delay &= PANEL_LIGHT_OFF_DELAY_MASK;
146 bl_off_delay *= 100;
147
148 /* Wait for backlight to turn off */
149 udelay(bl_off_delay);
150
151 printk(BIOS_INFO, "Backlight turned off\n");
152}
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700153
154static void southbridge_smi_sleep(void)
155{
156 u8 reg8;
157 u32 reg32;
158 u8 slp_typ;
159 u8 s5pwr = CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL;
160
161 /* save and recover RTC port values */
162 u8 tmp70, tmp72;
163 tmp70 = inb(0x70);
164 tmp72 = inb(0x72);
165 get_option(&s5pwr, "power_on_after_fail");
166 outb(tmp70, 0x70);
167 outb(tmp72, 0x72);
168
169 /* First, disable further SMIs */
170 disable_smi(SLP_SMI_EN);
171
172 /* Figure out SLP_TYP */
173 reg32 = inl(ACPI_BASE_ADDRESS + PM1_CNT);
174 printk(BIOS_SPEW, "SMI#: SLP = 0x%08x\n", reg32);
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500175 slp_typ = acpi_sleep_from_pm1(reg32);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700176
177 /* Do any mainboard sleep handling */
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500178 mainboard_smi_sleep(slp_typ);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700179
180 /* USB sleep preparations */
181 usb_xhci_sleep_prepare(PCH_DEV_XHCI, slp_typ);
182
Martin Rothe6ff1592017-06-24 21:34:29 -0600183#if IS_ENABLED(CONFIG_ELOG_GSMI)
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700184 /* Log S3, S4, and S5 entry */
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500185 if (slp_typ >= ACPI_S3)
186 elog_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700187#endif
188
Duncan Lauried775dda2014-10-25 01:49:32 -0700189 /* Clear pending GPE events */
190 clear_gpe_status();
191
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700192 /* Next, do the deed.
193 */
194
195 switch (slp_typ) {
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500196 case ACPI_S0:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700197 printk(BIOS_DEBUG, "SMI#: Entering S0 (On)\n");
198 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500199 case ACPI_S1:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700200 printk(BIOS_DEBUG, "SMI#: Entering S1 (Assert STPCLK#)\n");
201 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500202 case ACPI_S3:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700203 printk(BIOS_DEBUG, "SMI#: Entering S3 (Suspend-To-RAM)\n");
204
205 /* Invalidate the cache before going to S3 */
206 wbinvd();
207 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500208 case ACPI_S4:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700209 printk(BIOS_DEBUG, "SMI#: Entering S4 (Suspend-To-Disk)\n");
210 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500211 case ACPI_S5:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700212 printk(BIOS_DEBUG, "SMI#: Entering S5 (Soft Power off)\n");
213
Duncan Laurief3e0a132015-01-14 17:33:00 -0800214 /* Turn off backlight if needed */
215 backlight_off();
216
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700217 /* Disable all GPE */
218 disable_all_gpe();
219
220 /* Always set the flag in case CMOS was changed on runtime. For
221 * "KEEP", switch to "OFF" - KEEP is software emulated
222 */
223 reg8 = pci_read_config8(PCH_DEV_LPC, GEN_PMCON_3);
224 if (s5pwr == MAINBOARD_POWER_ON)
225 reg8 &= ~1;
226 else
227 reg8 |= 1;
228 pci_write_config8(PCH_DEV_LPC, GEN_PMCON_3, reg8);
229
230 /* also iterates over all bridges on bus 0 */
231 busmaster_disable_on_bus(0);
232 break;
233 default:
234 printk(BIOS_DEBUG, "SMI#: ERROR: SLP_TYP reserved\n");
235 break;
236 }
237
238 /*
239 * Write back to the SLP register to cause the originally intended
240 * event again. We need to set BIT13 (SLP_EN) though to make the
241 * sleep happen.
242 */
243 enable_pm1_control(SLP_EN);
244
245 /* Make sure to stop executing code here for S3/S4/S5 */
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500246 if (slp_typ >= ACPI_S3)
Patrick Georgi546953c2014-11-29 10:38:17 +0100247 halt();
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700248
249 /*
250 * In most sleep states, the code flow of this function ends at
251 * the line above. However, if we entered sleep state S1 and wake
252 * up again, we will continue to execute code in this function.
253 */
254 reg32 = inl(ACPI_BASE_ADDRESS + PM1_CNT);
255 if (reg32 & SCI_EN) {
256 /* The OS is not an ACPI OS, so we set the state to S0 */
257 disable_pm1_control(SLP_EN | SLP_TYP);
258 }
259}
260
261/*
262 * Look for Synchronous IO SMI and use save state from that
263 * core in case we are not running on the same core that
264 * initiated the IO transaction.
265 */
266static em64t101_smm_state_save_area_t *smi_apmc_find_state_save(u8 cmd)
267{
268 em64t101_smm_state_save_area_t *state;
269 int node;
270
271 /* Check all nodes looking for the one that issued the IO */
272 for (node = 0; node < CONFIG_MAX_CPUS; node++) {
273 state = smm_get_save_state(node);
274
275 /* Check for Synchronous IO (bit0==1) */
276 if (!(state->io_misc_info & (1 << 0)))
277 continue;
278
279 /* Make sure it was a write (bit4==0) */
280 if (state->io_misc_info & (1 << 4))
281 continue;
282
283 /* Check for APMC IO port */
284 if (((state->io_misc_info >> 16) & 0xff) != APM_CNT)
285 continue;
286
287 /* Check AX against the requested command */
288 if ((state->rax & 0xff) != cmd)
289 continue;
290
291 return state;
292 }
293
294 return NULL;
295}
296
Martin Rothe6ff1592017-06-24 21:34:29 -0600297#if IS_ENABLED(CONFIG_ELOG_GSMI)
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700298static void southbridge_smi_gsmi(void)
299{
300 u32 *ret, *param;
301 u8 sub_command;
302 em64t101_smm_state_save_area_t *io_smi =
Patrick Georgid61839c2018-12-03 16:10:33 +0100303 smi_apmc_find_state_save(APM_CNT_ELOG_GSMI);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700304
305 if (!io_smi)
306 return;
307
308 /* Command and return value in EAX */
Lee Leahy26b7cd02017-03-16 18:47:55 -0700309 ret = (u32 *)&io_smi->rax;
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700310 sub_command = (u8)(*ret >> 8);
311
312 /* Parameter buffer in EBX */
Lee Leahy26b7cd02017-03-16 18:47:55 -0700313 param = (u32 *)&io_smi->rbx;
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700314
315 /* drivers/elog/gsmi.c */
316 *ret = gsmi_exec(sub_command, param);
317}
318#endif
319
320static void finalize(void)
321{
322 static int finalize_done;
323
324 if (finalize_done) {
325 printk(BIOS_DEBUG, "SMM already finalized.\n");
326 return;
327 }
328 finalize_done = 1;
329
Martin Rothe6ff1592017-06-24 21:34:29 -0600330#if IS_ENABLED(CONFIG_SPI_FLASH_SMM)
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700331 /* Re-init SPI driver to handle locked BAR */
332 spi_init();
333#endif
334}
335
336static void southbridge_smi_apmc(void)
337{
338 u8 reg8;
339 em64t101_smm_state_save_area_t *state;
340
341 /* Emulate B2 register as the FADT / Linux expects it */
342
343 reg8 = inb(APM_CNT);
344 switch (reg8) {
345 case APM_CNT_CST_CONTROL:
346 printk(BIOS_DEBUG, "C-state control\n");
347 break;
348 case APM_CNT_PST_CONTROL:
349 printk(BIOS_DEBUG, "P-state control\n");
350 break;
351 case APM_CNT_ACPI_DISABLE:
352 disable_pm1_control(SCI_EN);
353 printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n");
354 break;
355 case APM_CNT_ACPI_ENABLE:
356 enable_pm1_control(SCI_EN);
357 printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n");
358 break;
359 case APM_CNT_FINALIZE:
360 finalize();
361 break;
362 case APM_CNT_GNVS_UPDATE:
363 if (smm_initialized) {
364 printk(BIOS_DEBUG,
365 "SMI#: SMM structures already initialized!\n");
366 return;
367 }
368 state = smi_apmc_find_state_save(reg8);
369 if (state) {
370 /* EBX in the state save contains the GNVS pointer */
371 gnvs = (global_nvs_t *)((u32)state->rbx);
372 smm_initialized = 1;
373 printk(BIOS_DEBUG, "SMI#: Setting GNVS to %p\n", gnvs);
374 }
375 break;
Martin Rothe6ff1592017-06-24 21:34:29 -0600376#if IS_ENABLED(CONFIG_ELOG_GSMI)
Patrick Georgid61839c2018-12-03 16:10:33 +0100377 case APM_CNT_ELOG_GSMI:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700378 southbridge_smi_gsmi();
379 break;
380#endif
381 }
382
383 mainboard_smi_apmc(reg8);
384}
385
386static void southbridge_smi_pm1(void)
387{
388 u16 pm1_sts = clear_pm1_status();
389
390 /* While OSPM is not active, poweroff immediately
391 * on a power button event.
392 */
393 if (pm1_sts & PWRBTN_STS) {
394 /* power button pressed */
Martin Rothe6ff1592017-06-24 21:34:29 -0600395#if IS_ENABLED(CONFIG_ELOG_GSMI)
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700396 elog_add_event(ELOG_TYPE_POWER_BUTTON);
397#endif
398 disable_pm1_control(-1UL);
399 enable_pm1_control(SLP_EN | (SLP_TYP_S5 << 10));
400 }
401}
402
403static void southbridge_smi_gpe0(void)
404{
405 clear_gpe_status();
406}
407
408static void southbridge_smi_gpi(void)
409{
410 mainboard_smi_gpi(clear_alt_smi_status());
411
412 /* Clear again after mainboard handler */
413 clear_alt_smi_status();
414}
415
416static void southbridge_smi_mc(void)
417{
418 u32 reg32 = inl(ACPI_BASE_ADDRESS + SMI_EN);
419
420 /* Are microcontroller SMIs enabled? */
421 if ((reg32 & MCSMI_EN) == 0)
422 return;
423
424 printk(BIOS_DEBUG, "Microcontroller SMI.\n");
425}
426
427static void southbridge_smi_tco(void)
428{
429 u32 tco_sts = clear_tco_status();
430
431 /* Any TCO event? */
432 if (!tco_sts)
433 return;
434
Lee Leahy8a9c7dc2017-03-17 10:43:25 -0700435 // BIOSWR
436 if (tco_sts & (1 << 8)) {
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700437 u8 bios_cntl = pci_read_config16(PCH_DEV_LPC, BIOS_CNTL);
438
439 if (bios_cntl & 1) {
440 /*
441 * BWE is RW, so the SMI was caused by a
442 * write to BWE, not by a write to the BIOS
443 *
444 * This is the place where we notice someone
445 * is trying to tinker with the BIOS. We are
446 * trying to be nice and just ignore it. A more
447 * resolute answer would be to power down the
448 * box.
449 */
450 printk(BIOS_DEBUG, "Switching back to RO\n");
451 pci_write_config32(PCH_DEV_LPC, BIOS_CNTL,
452 (bios_cntl & ~1));
453 } /* No else for now? */
454 } else if (tco_sts & (1 << 3)) { /* TIMEOUT */
455 /* Handle TCO timeout */
456 printk(BIOS_DEBUG, "TCO Timeout.\n");
457 }
458}
459
460static void southbridge_smi_periodic(void)
461{
462 u32 reg32 = inl(ACPI_BASE_ADDRESS + SMI_EN);
463
464 /* Are periodic SMIs enabled? */
465 if ((reg32 & PERIODIC_EN) == 0)
466 return;
467
468 printk(BIOS_DEBUG, "Periodic SMI.\n");
469}
470
471static void southbridge_smi_monitor(void)
472{
473#define IOTRAP(x) (trap_sts & (1 << x))
474 u32 trap_sts, trap_cycle;
475 u32 data, mask = 0;
476 int i;
477
478 trap_sts = RCBA32(0x1e00); // TRSR - Trap Status Register
479 RCBA32(0x1e00) = trap_sts; // Clear trap(s) in TRSR
480
481 trap_cycle = RCBA32(0x1e10);
Lee Leahy26b7cd02017-03-16 18:47:55 -0700482 for (i = 16; i < 20; i++) {
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700483 if (trap_cycle & (1 << i))
484 mask |= (0xff << ((i - 16) << 2));
485 }
486
487
488 /* IOTRAP(3) SMI function call */
489 if (IOTRAP(3)) {
490 if (gnvs && gnvs->smif)
491 io_trap_handler(gnvs->smif); // call function smif
492 return;
493 }
494
495 /* IOTRAP(2) currently unused
496 * IOTRAP(1) currently unused */
497
498 /* IOTRAP(0) SMIC */
499 if (IOTRAP(0)) {
Lee Leahy8a9c7dc2017-03-17 10:43:25 -0700500 // It's a write
501 if (!(trap_cycle & (1 << 24))) {
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700502 printk(BIOS_DEBUG, "SMI1 command\n");
503 data = RCBA32(0x1e18);
504 data &= mask;
505 // if (smi1)
Lee Leahy26b7cd02017-03-16 18:47:55 -0700506 // southbridge_smi_command(data);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700507 // return;
508 }
509 // Fall through to debug
510 }
511
512 printk(BIOS_DEBUG, " trapped io address = 0x%x\n",
513 trap_cycle & 0xfffc);
Lee Leahy26b7cd02017-03-16 18:47:55 -0700514 for (i = 0; i < 4; i++)
Lee Leahy8a9c7dc2017-03-17 10:43:25 -0700515 if (IOTRAP(i))
516 printk(BIOS_DEBUG, " TRAP = %d\n", i);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700517 printk(BIOS_DEBUG, " AHBE = %x\n", (trap_cycle >> 16) & 0xf);
518 printk(BIOS_DEBUG, " MASK = 0x%08x\n", mask);
519 printk(BIOS_DEBUG, " read/write: %s\n",
520 (trap_cycle & (1 << 24)) ? "read" : "write");
521
522 if (!(trap_cycle & (1 << 24))) {
523 /* Write Cycle */
524 data = RCBA32(0x1e18);
525 printk(BIOS_DEBUG, " iotrap written data = 0x%08x\n", data);
526 }
527#undef IOTRAP
528}
529
530typedef void (*smi_handler_t)(void);
531
532static smi_handler_t southbridge_smi[32] = {
533 NULL, // [0] reserved
534 NULL, // [1] reserved
535 NULL, // [2] BIOS_STS
536 NULL, // [3] LEGACY_USB_STS
537 southbridge_smi_sleep, // [4] SLP_SMI_STS
538 southbridge_smi_apmc, // [5] APM_STS
539 NULL, // [6] SWSMI_TMR_STS
540 NULL, // [7] reserved
541 southbridge_smi_pm1, // [8] PM1_STS
542 southbridge_smi_gpe0, // [9] GPE0_STS
543 southbridge_smi_gpi, // [10] GPI_STS
544 southbridge_smi_mc, // [11] MCSMI_STS
545 NULL, // [12] DEVMON_STS
546 southbridge_smi_tco, // [13] TCO_STS
547 southbridge_smi_periodic, // [14] PERIODIC_STS
548 NULL, // [15] SERIRQ_SMI_STS
549 NULL, // [16] SMBUS_SMI_STS
550 NULL, // [17] LEGACY_USB2_STS
551 NULL, // [18] INTEL_USB2_STS
552 NULL, // [19] reserved
553 NULL, // [20] PCI_EXP_SMI_STS
554 southbridge_smi_monitor, // [21] MONITOR_STS
555 NULL, // [22] reserved
556 NULL, // [23] reserved
557 NULL, // [24] reserved
558 NULL, // [25] EL_SMI_STS
559 NULL, // [26] SPI_STS
560 NULL, // [27] reserved
561 NULL, // [28] reserved
562 NULL, // [29] reserved
563 NULL, // [30] reserved
564 NULL // [31] reserved
565};
566
567/**
568 * @brief Interrupt handler for SMI#
569 *
570 * @param smm_revision revision of the smm state save map
571 */
572
573void southbridge_smi_handler(void)
574{
575 int i;
576 u32 smi_sts;
577
578 /* We need to clear the SMI status registers, or we won't see what's
579 * happening in the following calls.
580 */
581 smi_sts = clear_smi_status();
582
583 /* Call SMI sub handler for each of the status bits */
584 for (i = 0; i < 31; i++) {
585 if (smi_sts & (1 << i)) {
586 if (southbridge_smi[i]) {
587 southbridge_smi[i]();
588 } else {
589 printk(BIOS_DEBUG,
Martin Rothde7ed6f2014-12-07 14:58:18 -0700590 "SMI_STS[%d] occurred, but no "
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700591 "handler available.\n", i);
592 }
593 }
594 }
595}