blob: 5b04f799a39943e28d76f9628dd51bda2db35b4f [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>
Kyösti Mälkki13f66502019-03-03 08:01:05 +020020#include <device/mmio.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020021#include <device/pci_ops.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070022#include <console/console.h>
23#include <cpu/x86/cache.h>
24#include <device/pci_def.h>
25#include <cpu/x86/smm.h>
Kyösti Mälkkie31ec292019-08-10 17:27:01 +030026#include <cpu/intel/em64t101_save_state.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070027#include <spi-generic.h>
28#include <elog.h>
Patrick Georgi546953c2014-11-29 10:38:17 +010029#include <halt.h>
Kyösti Mälkkicbf95712020-01-05 08:05:45 +020030#include <option.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070031#include <soc/lpc.h>
32#include <soc/nvs.h>
33#include <soc/pci_devs.h>
34#include <soc/pm.h>
35#include <soc/rcba.h>
Julius Werner4ee4bd52014-10-20 13:46:39 -070036#include <soc/xhci.h>
Duncan Laurief3e0a132015-01-14 17:33:00 -080037#include <drivers/intel/gma/i915_reg.h>
Duncan Lauriec88c54c2014-04-30 16:36:13 -070038
39static u8 smm_initialized = 0;
40
41/*
42 * GNVS needs to be updated by an 0xEA PM Trap (B2) after it has been located
43 * by coreboot.
44 */
45static global_nvs_t *gnvs;
46global_nvs_t *smm_get_gnvs(void)
47{
48 return gnvs;
49}
50
51int southbridge_io_trap_handler(int smif)
52{
53 switch (smif) {
54 case 0x32:
55 printk(BIOS_DEBUG, "OS Init\n");
56 /* gnvs->smif:
57 * On success, the IO Trap Handler returns 0
58 * On failure, the IO Trap Handler returns a value != 0
59 */
60 gnvs->smif = 0;
61 return 1; /* IO trap handled */
62 }
63
64 /* Not handled */
65 return 0;
66}
67
68/**
69 * @brief Set the EOS bit
70 */
71void southbridge_smi_set_eos(void)
72{
73 enable_smi(EOS);
74}
75
76static void busmaster_disable_on_bus(int bus)
77{
Lee Leahy26b7cd02017-03-16 18:47:55 -070078 int slot, func;
79 unsigned int val;
80 unsigned char hdr;
Duncan Lauriec88c54c2014-04-30 16:36:13 -070081
Lee Leahy26b7cd02017-03-16 18:47:55 -070082 for (slot = 0; slot < 0x20; slot++) {
83 for (func = 0; func < 8; func++) {
84 u32 reg32;
Duncan Lauriec88c54c2014-04-30 16:36:13 -070085
Kyösti Mälkkie16c9df2018-12-29 08:04:16 +020086 pci_devfn_t dev = PCI_DEV(bus, slot, func);
Lee Leahy26b7cd02017-03-16 18:47:55 -070087 val = pci_read_config32(dev, PCI_VENDOR_ID);
Duncan Lauriec88c54c2014-04-30 16:36:13 -070088
Lee Leahy26b7cd02017-03-16 18:47:55 -070089 if (val == 0xffffffff || val == 0x00000000 ||
90 val == 0x0000ffff || val == 0xffff0000)
91 continue;
Duncan Lauriec88c54c2014-04-30 16:36:13 -070092
Lee Leahy26b7cd02017-03-16 18:47:55 -070093 /* Disable Bus Mastering for this one device */
94 reg32 = pci_read_config32(dev, PCI_COMMAND);
95 reg32 &= ~PCI_COMMAND_MASTER;
96 pci_write_config32(dev, PCI_COMMAND, reg32);
Duncan Lauriec88c54c2014-04-30 16:36:13 -070097
Lee Leahy26b7cd02017-03-16 18:47:55 -070098 /* If this is a bridge, then follow it. */
99 hdr = pci_read_config8(dev, PCI_HEADER_TYPE);
100 hdr &= 0x7f;
101 if (hdr == PCI_HEADER_TYPE_BRIDGE ||
102 hdr == PCI_HEADER_TYPE_CARDBUS) {
103 unsigned int buses;
104 buses = pci_read_config32(dev, PCI_PRIMARY_BUS);
105 busmaster_disable_on_bus((buses >> 8) & 0xff);
106 }
107 }
108 }
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700109}
110
Duncan Laurief3e0a132015-01-14 17:33:00 -0800111/*
112 * Turn off the backlight if it is on, and wait for the specified
113 * backlight off delay. This will allow panel power timings to meet
114 * spec and prevent brief garbage on the screen when turned off
115 * during firmware with power button triggered SMI.
116 */
117static void backlight_off(void)
118{
119 void *reg_base;
120 uint32_t pp_ctrl;
121 uint32_t bl_off_delay;
122
Lee Leahy6ef51922017-03-17 10:56:08 -0700123 reg_base = (void *)((uintptr_t)pci_read_config32(SA_DEV_IGD,
124 PCI_BASE_ADDRESS_0) & ~0xf);
Duncan Laurief3e0a132015-01-14 17:33:00 -0800125
126 /* Check if backlight is enabled */
127 pp_ctrl = read32(reg_base + PCH_PP_CONTROL);
128 if (!(pp_ctrl & EDP_BLC_ENABLE))
129 return;
130
131 /* Enable writes to this register */
132 pp_ctrl &= ~PANEL_UNLOCK_MASK;
133 pp_ctrl |= PANEL_UNLOCK_REGS;
134
135 /* Turn off backlight */
136 pp_ctrl &= ~EDP_BLC_ENABLE;
137
138 write32(reg_base + PCH_PP_CONTROL, pp_ctrl);
139 read32(reg_base + PCH_PP_CONTROL);
140
141 /* Read backlight off delay in 100us units */
142 bl_off_delay = read32(reg_base + PCH_PP_OFF_DELAYS);
143 bl_off_delay &= PANEL_LIGHT_OFF_DELAY_MASK;
144 bl_off_delay *= 100;
145
146 /* Wait for backlight to turn off */
147 udelay(bl_off_delay);
148
149 printk(BIOS_INFO, "Backlight turned off\n");
150}
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700151
152static void southbridge_smi_sleep(void)
153{
154 u8 reg8;
155 u32 reg32;
156 u8 slp_typ;
Nico Huber9faae2b2018-11-14 00:00:35 +0100157 u8 s5pwr = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700158
159 /* save and recover RTC port values */
160 u8 tmp70, tmp72;
161 tmp70 = inb(0x70);
162 tmp72 = inb(0x72);
163 get_option(&s5pwr, "power_on_after_fail");
164 outb(tmp70, 0x70);
165 outb(tmp72, 0x72);
166
167 /* First, disable further SMIs */
168 disable_smi(SLP_SMI_EN);
169
170 /* Figure out SLP_TYP */
171 reg32 = inl(ACPI_BASE_ADDRESS + PM1_CNT);
172 printk(BIOS_SPEW, "SMI#: SLP = 0x%08x\n", reg32);
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500173 slp_typ = acpi_sleep_from_pm1(reg32);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700174
175 /* Do any mainboard sleep handling */
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500176 mainboard_smi_sleep(slp_typ);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700177
178 /* USB sleep preparations */
179 usb_xhci_sleep_prepare(PCH_DEV_XHCI, slp_typ);
180
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700181 /* Log S3, S4, and S5 entry */
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500182 if (slp_typ >= ACPI_S3)
Kyösti Mälkki9dd1a122019-11-06 11:04:27 +0200183 elog_gsmi_add_event_byte(ELOG_TYPE_ACPI_ENTER, slp_typ);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700184
Duncan Lauried775dda2014-10-25 01:49:32 -0700185 /* Clear pending GPE events */
186 clear_gpe_status();
187
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700188 /* Next, do the deed.
189 */
190
191 switch (slp_typ) {
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500192 case ACPI_S0:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700193 printk(BIOS_DEBUG, "SMI#: Entering S0 (On)\n");
194 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500195 case ACPI_S1:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700196 printk(BIOS_DEBUG, "SMI#: Entering S1 (Assert STPCLK#)\n");
197 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500198 case ACPI_S3:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700199 printk(BIOS_DEBUG, "SMI#: Entering S3 (Suspend-To-RAM)\n");
200
201 /* Invalidate the cache before going to S3 */
202 wbinvd();
203 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500204 case ACPI_S4:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700205 printk(BIOS_DEBUG, "SMI#: Entering S4 (Suspend-To-Disk)\n");
206 break;
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500207 case ACPI_S5:
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700208 printk(BIOS_DEBUG, "SMI#: Entering S5 (Soft Power off)\n");
209
Duncan Laurief3e0a132015-01-14 17:33:00 -0800210 /* Turn off backlight if needed */
211 backlight_off();
212
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700213 /* Disable all GPE */
214 disable_all_gpe();
215
216 /* Always set the flag in case CMOS was changed on runtime. For
217 * "KEEP", switch to "OFF" - KEEP is software emulated
218 */
219 reg8 = pci_read_config8(PCH_DEV_LPC, GEN_PMCON_3);
220 if (s5pwr == MAINBOARD_POWER_ON)
221 reg8 &= ~1;
222 else
223 reg8 |= 1;
224 pci_write_config8(PCH_DEV_LPC, GEN_PMCON_3, reg8);
225
226 /* also iterates over all bridges on bus 0 */
227 busmaster_disable_on_bus(0);
228 break;
229 default:
230 printk(BIOS_DEBUG, "SMI#: ERROR: SLP_TYP reserved\n");
231 break;
232 }
233
234 /*
235 * Write back to the SLP register to cause the originally intended
236 * event again. We need to set BIT13 (SLP_EN) though to make the
237 * sleep happen.
238 */
239 enable_pm1_control(SLP_EN);
240
241 /* Make sure to stop executing code here for S3/S4/S5 */
Aaron Durbin9e6d1432016-07-13 23:21:41 -0500242 if (slp_typ >= ACPI_S3)
Patrick Georgi546953c2014-11-29 10:38:17 +0100243 halt();
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700244
245 /*
246 * In most sleep states, the code flow of this function ends at
247 * the line above. However, if we entered sleep state S1 and wake
248 * up again, we will continue to execute code in this function.
249 */
250 reg32 = inl(ACPI_BASE_ADDRESS + PM1_CNT);
251 if (reg32 & SCI_EN) {
252 /* The OS is not an ACPI OS, so we set the state to S0 */
253 disable_pm1_control(SLP_EN | SLP_TYP);
254 }
255}
256
257/*
258 * Look for Synchronous IO SMI and use save state from that
259 * core in case we are not running on the same core that
260 * initiated the IO transaction.
261 */
262static em64t101_smm_state_save_area_t *smi_apmc_find_state_save(u8 cmd)
263{
264 em64t101_smm_state_save_area_t *state;
265 int node;
266
267 /* Check all nodes looking for the one that issued the IO */
268 for (node = 0; node < CONFIG_MAX_CPUS; node++) {
269 state = smm_get_save_state(node);
270
271 /* Check for Synchronous IO (bit0==1) */
272 if (!(state->io_misc_info & (1 << 0)))
273 continue;
274
275 /* Make sure it was a write (bit4==0) */
276 if (state->io_misc_info & (1 << 4))
277 continue;
278
279 /* Check for APMC IO port */
280 if (((state->io_misc_info >> 16) & 0xff) != APM_CNT)
281 continue;
282
283 /* Check AX against the requested command */
284 if ((state->rax & 0xff) != cmd)
285 continue;
286
287 return state;
288 }
289
290 return NULL;
291}
292
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700293static void southbridge_smi_gsmi(void)
294{
295 u32 *ret, *param;
296 u8 sub_command;
297 em64t101_smm_state_save_area_t *io_smi =
Patrick Georgid61839c2018-12-03 16:10:33 +0100298 smi_apmc_find_state_save(APM_CNT_ELOG_GSMI);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700299
300 if (!io_smi)
301 return;
302
303 /* Command and return value in EAX */
Lee Leahy26b7cd02017-03-16 18:47:55 -0700304 ret = (u32 *)&io_smi->rax;
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700305 sub_command = (u8)(*ret >> 8);
306
307 /* Parameter buffer in EBX */
Lee Leahy26b7cd02017-03-16 18:47:55 -0700308 param = (u32 *)&io_smi->rbx;
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700309
310 /* drivers/elog/gsmi.c */
311 *ret = gsmi_exec(sub_command, param);
312}
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700313
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700314static void southbridge_smi_apmc(void)
315{
316 u8 reg8;
317 em64t101_smm_state_save_area_t *state;
318
319 /* Emulate B2 register as the FADT / Linux expects it */
320
321 reg8 = inb(APM_CNT);
322 switch (reg8) {
323 case APM_CNT_CST_CONTROL:
324 printk(BIOS_DEBUG, "C-state control\n");
325 break;
326 case APM_CNT_PST_CONTROL:
327 printk(BIOS_DEBUG, "P-state control\n");
328 break;
329 case APM_CNT_ACPI_DISABLE:
330 disable_pm1_control(SCI_EN);
331 printk(BIOS_DEBUG, "SMI#: ACPI disabled.\n");
332 break;
333 case APM_CNT_ACPI_ENABLE:
334 enable_pm1_control(SCI_EN);
335 printk(BIOS_DEBUG, "SMI#: ACPI enabled.\n");
336 break;
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700337 case APM_CNT_GNVS_UPDATE:
338 if (smm_initialized) {
339 printk(BIOS_DEBUG,
340 "SMI#: SMM structures already initialized!\n");
341 return;
342 }
343 state = smi_apmc_find_state_save(reg8);
344 if (state) {
345 /* EBX in the state save contains the GNVS pointer */
346 gnvs = (global_nvs_t *)((u32)state->rbx);
347 smm_initialized = 1;
348 printk(BIOS_DEBUG, "SMI#: Setting GNVS to %p\n", gnvs);
349 }
350 break;
Patrick Georgid61839c2018-12-03 16:10:33 +0100351 case APM_CNT_ELOG_GSMI:
Kyösti Mälkki9dd1a122019-11-06 11:04:27 +0200352 if (CONFIG(ELOG_GSMI))
353 southbridge_smi_gsmi();
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700354 break;
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700355 }
356
357 mainboard_smi_apmc(reg8);
358}
359
360static void southbridge_smi_pm1(void)
361{
362 u16 pm1_sts = clear_pm1_status();
363
364 /* While OSPM is not active, poweroff immediately
365 * on a power button event.
366 */
367 if (pm1_sts & PWRBTN_STS) {
368 /* power button pressed */
Kyösti Mälkki9dd1a122019-11-06 11:04:27 +0200369 elog_gsmi_add_event(ELOG_TYPE_POWER_BUTTON);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700370 disable_pm1_control(-1UL);
371 enable_pm1_control(SLP_EN | (SLP_TYP_S5 << 10));
372 }
373}
374
375static void southbridge_smi_gpe0(void)
376{
377 clear_gpe_status();
378}
379
380static void southbridge_smi_gpi(void)
381{
382 mainboard_smi_gpi(clear_alt_smi_status());
383
384 /* Clear again after mainboard handler */
385 clear_alt_smi_status();
386}
387
388static void southbridge_smi_mc(void)
389{
390 u32 reg32 = inl(ACPI_BASE_ADDRESS + SMI_EN);
391
392 /* Are microcontroller SMIs enabled? */
393 if ((reg32 & MCSMI_EN) == 0)
394 return;
395
396 printk(BIOS_DEBUG, "Microcontroller SMI.\n");
397}
398
399static void southbridge_smi_tco(void)
400{
401 u32 tco_sts = clear_tco_status();
402
403 /* Any TCO event? */
404 if (!tco_sts)
405 return;
406
Lee Leahy8a9c7dc2017-03-17 10:43:25 -0700407 // BIOSWR
408 if (tco_sts & (1 << 8)) {
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700409 u8 bios_cntl = pci_read_config16(PCH_DEV_LPC, BIOS_CNTL);
410
411 if (bios_cntl & 1) {
412 /*
413 * BWE is RW, so the SMI was caused by a
414 * write to BWE, not by a write to the BIOS
415 *
416 * This is the place where we notice someone
417 * is trying to tinker with the BIOS. We are
418 * trying to be nice and just ignore it. A more
419 * resolute answer would be to power down the
420 * box.
421 */
422 printk(BIOS_DEBUG, "Switching back to RO\n");
423 pci_write_config32(PCH_DEV_LPC, BIOS_CNTL,
424 (bios_cntl & ~1));
425 } /* No else for now? */
426 } else if (tco_sts & (1 << 3)) { /* TIMEOUT */
427 /* Handle TCO timeout */
428 printk(BIOS_DEBUG, "TCO Timeout.\n");
429 }
430}
431
432static void southbridge_smi_periodic(void)
433{
434 u32 reg32 = inl(ACPI_BASE_ADDRESS + SMI_EN);
435
436 /* Are periodic SMIs enabled? */
437 if ((reg32 & PERIODIC_EN) == 0)
438 return;
439
440 printk(BIOS_DEBUG, "Periodic SMI.\n");
441}
442
443static void southbridge_smi_monitor(void)
444{
445#define IOTRAP(x) (trap_sts & (1 << x))
446 u32 trap_sts, trap_cycle;
447 u32 data, mask = 0;
448 int i;
449
450 trap_sts = RCBA32(0x1e00); // TRSR - Trap Status Register
451 RCBA32(0x1e00) = trap_sts; // Clear trap(s) in TRSR
452
453 trap_cycle = RCBA32(0x1e10);
Lee Leahy26b7cd02017-03-16 18:47:55 -0700454 for (i = 16; i < 20; i++) {
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700455 if (trap_cycle & (1 << i))
456 mask |= (0xff << ((i - 16) << 2));
457 }
458
459
460 /* IOTRAP(3) SMI function call */
461 if (IOTRAP(3)) {
462 if (gnvs && gnvs->smif)
463 io_trap_handler(gnvs->smif); // call function smif
464 return;
465 }
466
467 /* IOTRAP(2) currently unused
468 * IOTRAP(1) currently unused */
469
470 /* IOTRAP(0) SMIC */
471 if (IOTRAP(0)) {
Lee Leahy8a9c7dc2017-03-17 10:43:25 -0700472 // It's a write
473 if (!(trap_cycle & (1 << 24))) {
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700474 printk(BIOS_DEBUG, "SMI1 command\n");
475 data = RCBA32(0x1e18);
476 data &= mask;
477 // if (smi1)
Lee Leahy26b7cd02017-03-16 18:47:55 -0700478 // southbridge_smi_command(data);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700479 // return;
480 }
481 // Fall through to debug
482 }
483
484 printk(BIOS_DEBUG, " trapped io address = 0x%x\n",
485 trap_cycle & 0xfffc);
Lee Leahy26b7cd02017-03-16 18:47:55 -0700486 for (i = 0; i < 4; i++)
Lee Leahy8a9c7dc2017-03-17 10:43:25 -0700487 if (IOTRAP(i))
488 printk(BIOS_DEBUG, " TRAP = %d\n", i);
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700489 printk(BIOS_DEBUG, " AHBE = %x\n", (trap_cycle >> 16) & 0xf);
490 printk(BIOS_DEBUG, " MASK = 0x%08x\n", mask);
491 printk(BIOS_DEBUG, " read/write: %s\n",
492 (trap_cycle & (1 << 24)) ? "read" : "write");
493
494 if (!(trap_cycle & (1 << 24))) {
495 /* Write Cycle */
496 data = RCBA32(0x1e18);
497 printk(BIOS_DEBUG, " iotrap written data = 0x%08x\n", data);
498 }
499#undef IOTRAP
500}
501
502typedef void (*smi_handler_t)(void);
503
504static smi_handler_t southbridge_smi[32] = {
505 NULL, // [0] reserved
506 NULL, // [1] reserved
507 NULL, // [2] BIOS_STS
508 NULL, // [3] LEGACY_USB_STS
509 southbridge_smi_sleep, // [4] SLP_SMI_STS
510 southbridge_smi_apmc, // [5] APM_STS
511 NULL, // [6] SWSMI_TMR_STS
512 NULL, // [7] reserved
513 southbridge_smi_pm1, // [8] PM1_STS
514 southbridge_smi_gpe0, // [9] GPE0_STS
515 southbridge_smi_gpi, // [10] GPI_STS
516 southbridge_smi_mc, // [11] MCSMI_STS
517 NULL, // [12] DEVMON_STS
518 southbridge_smi_tco, // [13] TCO_STS
519 southbridge_smi_periodic, // [14] PERIODIC_STS
520 NULL, // [15] SERIRQ_SMI_STS
521 NULL, // [16] SMBUS_SMI_STS
522 NULL, // [17] LEGACY_USB2_STS
523 NULL, // [18] INTEL_USB2_STS
524 NULL, // [19] reserved
525 NULL, // [20] PCI_EXP_SMI_STS
526 southbridge_smi_monitor, // [21] MONITOR_STS
527 NULL, // [22] reserved
528 NULL, // [23] reserved
529 NULL, // [24] reserved
530 NULL, // [25] EL_SMI_STS
531 NULL, // [26] SPI_STS
532 NULL, // [27] reserved
533 NULL, // [28] reserved
534 NULL, // [29] reserved
535 NULL, // [30] reserved
536 NULL // [31] reserved
537};
538
539/**
540 * @brief Interrupt handler for SMI#
541 *
542 * @param smm_revision revision of the smm state save map
543 */
544
545void southbridge_smi_handler(void)
546{
547 int i;
548 u32 smi_sts;
549
550 /* We need to clear the SMI status registers, or we won't see what's
551 * happening in the following calls.
552 */
553 smi_sts = clear_smi_status();
554
555 /* Call SMI sub handler for each of the status bits */
556 for (i = 0; i < 31; i++) {
557 if (smi_sts & (1 << i)) {
558 if (southbridge_smi[i]) {
559 southbridge_smi[i]();
560 } else {
561 printk(BIOS_DEBUG,
Martin Rothde7ed6f2014-12-07 14:58:18 -0700562 "SMI_STS[%d] occurred, but no "
Duncan Lauriec88c54c2014-04-30 16:36:13 -0700563 "handler available.\n", i);
564 }
565 }
566 }
567}