coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
smihandler.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <arch/hlt.h>
4 #include <arch/io.h>
5 #include <console/console.h>
6 #include <cpu/x86/cache.h>
7 #include <cpu/x86/msr.h>
8 #include <cpu/x86/smm.h>
11 #include <cpu/intel/msr.h>
12 #include <delay.h>
13 #include <device/mmio.h>
14 #include <device/pci_def.h>
15 #include <device/pci_ops.h>
16 #include <elog.h>
17 #include <intelblocks/fast_spi.h>
18 #include <intelblocks/pmclib.h>
19 #include <intelblocks/smihandler.h>
20 #include <intelblocks/tco.h>
21 #include <intelblocks/uart.h>
22 #include <smmstore.h>
23 #include <soc/nvs.h>
24 #include <soc/pci_devs.h>
25 #include <soc/pm.h>
26 #include <soc/gpio.h>
27 #include <soc/iomap.h>
28 #include <soc/smbus.h>
29 #include <spi-generic.h>
30 #include <stdint.h>
31 
32 /* SoC overrides. */
33 
35 {
36  return &em64t101_smm_ops;
37 }
38 
39 /* Specific SOC SMI handler during ramstage finalize phase */
41 {
42  return;
43 }
44 
46 {
47  return 1;
48 }
49 
50 /* Mainboard overrides. */
51 
53  const struct gpi_status *sts)
54 {
55  return;
56 }
57 
59 {
60  return;
61 }
62 
63 /* Common Functions */
64 
65 static void *find_save_state(const struct smm_save_state_ops *save_state_ops,
66  int cmd)
67 {
68  int node;
69  void *state = NULL;
70  uint32_t io_misc_info;
71  uint8_t reg_al;
72 
73  /* Check all nodes looking for the one that issued the IO */
74  for (node = 0; node < CONFIG_MAX_CPUS; node++) {
75  state = smm_get_save_state(node);
76 
77  io_misc_info = save_state_ops->get_io_misc_info(state);
78 
79  /* Check for Synchronous IO (bit0==1) */
80  if (!(io_misc_info & (1 << 0)))
81  continue;
82  /* Make sure it was a write (bit4==0) */
83  if (io_misc_info & (1 << 4))
84  continue;
85  /* Check for APMC IO port */
86  if (((io_misc_info >> 16) & 0xff) != APM_CNT)
87  continue;
88  /* Check AL against the requested command */
89  reg_al = save_state_ops->get_reg(state, RAX);
90  if (reg_al != cmd)
91  continue;
92  break;
93  }
94  return state;
95 }
96 
97 /* Inherited from cpu/x86/smm.h resulting in a different signature */
99 {
101 }
102 
104 {
105  int slot, func;
106  unsigned int val;
107  unsigned char hdr;
108 
109  for (slot = 0; slot < 0x20; slot++) {
110  for (func = 0; func < 8; func++) {
111  u16 reg16;
112 
113  pci_devfn_t dev = PCI_DEV(bus, slot, func);
114 
116  continue;
118 
119  if (val == 0xffffffff || val == 0x00000000 ||
120  val == 0x0000ffff || val == 0xffff0000)
121  continue;
122 
123  /* Disable Bus Mastering for this one device */
124  reg16 = pci_read_config16(dev, PCI_COMMAND);
125  reg16 &= ~PCI_COMMAND_MASTER;
126  pci_write_config16(dev, PCI_COMMAND, reg16);
127 
128  /* If it's not a bridge, move on. */
129  hdr = pci_read_config8(dev, PCI_HEADER_TYPE);
130  hdr &= 0x7f;
131  if (hdr != PCI_HEADER_TYPE_BRIDGE &&
133  continue;
134 
135  /*
136  * If secondary bus is equal to current bus bypass
137  * the bridge because it's likely unconfigured and
138  * would cause infinite recursion.
139  */
140  int secbus = pci_read_config8(dev, PCI_SECONDARY_BUS);
141 
142  if (secbus == bus)
143  continue;
144 
145  busmaster_disable_on_bus(secbus);
146  }
147  }
148 }
149 
151  const struct smm_save_state_ops *save_state_ops)
152 {
153  uint32_t reg32;
154  uint8_t slp_typ;
155 
156  /* First, disable further SMIs */
158  /* Figure out SLP_TYP */
159  reg32 = inl(ACPI_BASE_ADDRESS + PM1_CNT);
160  printk(BIOS_SPEW, "SMI#: SLP = 0x%08x\n", reg32);
161  slp_typ = acpi_sleep_from_pm1(reg32);
162 
163  /* Do any mainboard sleep handling */
164  mainboard_smi_sleep(slp_typ);
165 
166  /* Log S3, S4, and S5 entry */
167  if (slp_typ >= ACPI_S3)
169 
170  /* Clear pending GPE events */
172 
173  /* Next, do the deed. */
174 
175  switch (slp_typ) {
176  case ACPI_S0:
177  printk(BIOS_DEBUG, "SMI#: Entering S0 (On)\n");
178  break;
179  case ACPI_S3:
180  printk(BIOS_DEBUG, "SMI#: Entering S3 (Suspend-To-RAM)\n");
181  if (CONFIG(SOC_INTEL_COMMON_BLOCK_UART))
183 
184  /* Invalidate the cache before going to S3 */
185  wbinvd();
186  break;
187  case ACPI_S4:
188  printk(BIOS_DEBUG, "SMI#: Entering S4 (Suspend-To-Disk)\n");
189  break;
190  case ACPI_S5:
191  printk(BIOS_DEBUG, "SMI#: Entering S5 (Soft Power off)\n");
192 
193  /* Disable all GPE */
195  /* Set which state system will be after power reapplied */
197  /* also iterates over all bridges on bus 0 */
199 
200  /*
201  * Some platforms (e.g. Chromebooks) have observed race between
202  * SLP SMI and PWRBTN SMI because of the way these SMIs are
203  * triggered on power button press. Allow adding a delay before
204  * triggering sleep enable for S5, so that power button
205  * interrupt does not result into immediate wake.
206  */
207  mdelay(CONFIG_SOC_INTEL_COMMON_BLOCK_SMM_S5_DELAY_MS);
208 
209  /*
210  * Ensure any pending power button status bits are cleared as
211  * the system is entering S5 and doesn't want to be woken up
212  * right away from older power button events.
213  */
215 
216  break;
217  default:
218  printk(BIOS_DEBUG, "SMI#: ERROR: SLP_TYP reserved\n");
219  break;
220  }
221 
222  /*
223  * Write back to the SLP register to cause the originally intended
224  * event again. We need to set BIT13 (SLP_EN) though to make the
225  * sleep happen.
226  */
228 
229  /* Make sure to stop executing code here for S3/S4/S5 */
230  if (slp_typ >= ACPI_S3)
231  hlt();
232 
233  /*
234  * In most sleep states, the code flow of this function ends at
235  * the line above. However, if we entered sleep state S1 and wake
236  * up again, we will continue to execute code in this function.
237  */
238  if (pmc_read_pm1_control() & SCI_EN) {
239  /* The OS is not an ACPI OS, so we set the state to S0 */
241  }
242 }
243 
245  const struct smm_save_state_ops *save_state_ops)
246 {
247  u8 sub_command, ret;
248  void *io_smi = NULL;
249  uint32_t reg_ebx;
250 
251  io_smi = find_save_state(save_state_ops, APM_CNT_ELOG_GSMI);
252  if (!io_smi)
253  return;
254  /* Command and return value in EAX */
255  sub_command = (save_state_ops->get_reg(io_smi, RAX) >> 8)
256  & 0xff;
257 
258  /* Parameter buffer in EBX */
259  reg_ebx = save_state_ops->get_reg(io_smi, RBX);
260 
261  /* drivers/elog/gsmi.c */
262  ret = gsmi_exec(sub_command, &reg_ebx);
263  save_state_ops->set_reg(io_smi, RAX, ret);
264 }
265 
266 static void set_insmm_sts(const bool enable_writes)
267 {
268  msr_t msr = {
269  .lo = read32p(0xfed30880),
270  .hi = 0,
271  };
272  if (enable_writes)
273  msr.lo |= 1;
274  else
275  msr.lo &= ~1;
276 
278 }
279 
281  const struct smm_save_state_ops *save_state_ops)
282 {
283  u8 sub_command, ret;
284  void *io_smi;
285  uint32_t reg_ebx;
286 
287  io_smi = find_save_state(save_state_ops, APM_CNT_SMMSTORE);
288  if (!io_smi)
289  return;
290  /* Command and return value in EAX */
291  sub_command = (save_state_ops->get_reg(io_smi, RAX) >> 8) & 0xff;
292 
293  /* Parameter buffer in EBX */
294  reg_ebx = save_state_ops->get_reg(io_smi, RBX);
295 
296  const bool wp_enabled = !fast_spi_wpd_status();
297  if (wp_enabled) {
298  set_insmm_sts(true);
300  /* Not clearing SPI sync SMI status here results in hangs */
302  }
303 
304  /* drivers/smmstore/smi.c */
305  ret = smmstore_exec(sub_command, (void *)(uintptr_t)reg_ebx);
306  save_state_ops->set_reg(io_smi, RAX, ret);
307 
308  if (wp_enabled) {
310  set_insmm_sts(false);
311  }
312 }
313 
314 __weak const struct gpio_lock_config *soc_gpio_lock_config(size_t *num)
315 {
316  *num = 0;
317  return NULL;
318 }
319 
320 static void soc_lock_gpios(void)
321 {
322  const struct gpio_lock_config *soc_gpios;
323  size_t soc_gpio_num;
324 
325  /* get list of gpios from SoC */
326  soc_gpios = soc_gpio_lock_config(&soc_gpio_num);
327 
328  /* Lock any soc requested gpios */
329  if (soc_gpio_num)
330  gpio_lock_pads(soc_gpios, soc_gpio_num);
331 }
332 
333 static void finalize(void)
334 {
335  static int finalize_done;
336 
337  if (finalize_done) {
338  printk(BIOS_DEBUG, "SMM already finalized.\n");
339  return;
340  }
341  finalize_done = 1;
342 
343  if (CONFIG(SPI_FLASH_SMM))
344  /* Re-init SPI driver to handle locked BAR */
345  fast_spi_init();
346 
347  if (CONFIG(BOOTMEDIA_SMM_BWP)) {
349  set_insmm_sts(false);
350  }
351 
352  /*
353  * HECI is disabled in smihandler_soc_at_finalize() which also locks down the side band
354  * interface. Some boards may require this interface in mainboard_smi_finalize(),
355  * therefore, this call must precede smihandler_soc_at_finalize().
356  */
358 
359  /* Lock down all GPIOs that may have been requested by the SoC and/or the mainboard. */
360  if (CONFIG(SOC_INTEL_COMMON_BLOCK_SMM_LOCK_GPIO_PADS))
361  soc_lock_gpios();
362 
363  /* Specific SOC SMI handler during ramstage finalize phase */
365 }
366 
368  const struct smm_save_state_ops *save_state_ops)
369 {
370  uint8_t reg8;
371 
372  reg8 = apm_get_apmc();
373  switch (reg8) {
376  break;
377  case APM_CNT_ACPI_ENABLE:
379  break;
380  case APM_CNT_ELOG_GSMI:
381  if (CONFIG(ELOG_GSMI))
382  southbridge_smi_gsmi(save_state_ops);
383  break;
384  case APM_CNT_SMMSTORE:
385  if (CONFIG(SMMSTORE))
386  southbridge_smi_store(save_state_ops);
387  break;
388  case APM_CNT_FINALIZE:
389  finalize();
390  break;
391  }
392 
393  mainboard_smi_apmc(reg8);
394 }
395 
397  const struct smm_save_state_ops *save_state_ops)
398 {
399  uint16_t pm1_sts = pmc_clear_pm1_status();
400  u16 pm1_en = pmc_read_pm1_enable();
401 
402  /*
403  * While OSPM is not active, poweroff immediately
404  * on a power button event.
405  */
406  if ((pm1_sts & PWRBTN_STS) && (pm1_en & PWRBTN_EN)) {
407  /* power button pressed */
411  }
412 }
413 
415  const struct smm_save_state_ops *save_state_ops)
416 {
418 }
419 
421  const struct smm_save_state_ops *save_state_ops)
422 {
423  uint32_t tco_sts = pmc_clear_tco_status();
424 
425  /*
426  * SPI synchronous SMIs are TCO SMIs, but they do not have a status
427  * bit in the TCO_STS register. Furthermore, the TCO_STS bit in the
428  * SMI_STS register is continually set until the SMI handler clears
429  * the SPI synchronous SMI status bit in the SPI controller. To not
430  * risk missing any other TCO SMIs, do not clear the TCO_STS bit in
431  * this SMI handler invocation. If the TCO_STS bit remains set when
432  * returning from SMM, another SMI immediately happens which clears
433  * the TCO_STS bit and handles any pending events.
434  */
436 
437  /* If enabled, enforce SMM BIOS write protection */
438  if (CONFIG(BOOTMEDIA_SMM_BWP) && fast_spi_wpd_status()) {
439  /*
440  * BWE is RW, so the SMI was caused by a
441  * write to BWE, not by a write to the BIOS
442  *
443  * This is the place where we notice someone
444  * is trying to tinker with the BIOS. We are
445  * trying to be nice and just ignore it. A more
446  * resolute answer would be to power down the
447  * box.
448  */
449  printk(BIOS_DEBUG, "Switching SPI back to RO\n");
451  set_insmm_sts(false);
452  }
453 
454  /* Any TCO event? */
455  if (!tco_sts)
456  return;
457 
458  if (tco_sts & TCO_TIMEOUT) { /* TIMEOUT */
459  /* Handle TCO timeout */
460  printk(BIOS_DEBUG, "TCO Timeout.\n");
461  }
462 
463  if (tco_sts & (TCO_INTRD_DET << 16)) { /* INTRUDER# assertion */
464  /*
465  * Handle intrusion event
466  * If we ever get here, probably the case has been opened.
467  */
468  printk(BIOS_CRIT, "Case intrusion detected.\n");
469  }
470 }
471 
473  const struct smm_save_state_ops *save_state_ops)
474 {
475  uint32_t reg32;
476 
477  reg32 = pmc_get_smi_en();
478 
479  /* Are periodic SMIs enabled? */
480  if ((reg32 & PERIODIC_EN) == 0)
481  return;
482  printk(BIOS_DEBUG, "Periodic SMI.\n");
483 }
484 
486  const struct smm_save_state_ops *save_state_ops)
487 {
488  struct gpi_status smi_sts;
489 
490  gpi_clear_get_smi_status(&smi_sts);
491  mainboard_smi_gpi_handler(&smi_sts);
492 
493  /* Clear again after mainboard handler */
494  gpi_clear_get_smi_status(&smi_sts);
495 }
496 
498  const struct smm_save_state_ops *save_state_ops)
499 {
501 }
502 
504 {
505  int i;
506  uint32_t smi_sts;
507  const struct smm_save_state_ops *save_state_ops;
508 
509  /*
510  * We need to clear the SMI status registers, or we won't see what's
511  * happening in the following calls.
512  */
513  smi_sts = pmc_clear_smi_status();
514 
515  /*
516  * When the SCI_EN bit is set, PM1 and GPE0 events will trigger a SCI
517  * instead of a SMI#. However, SMI_STS bits PM1_STS and GPE0_STS can
518  * still be set. Therefore, when SCI_EN is set, ignore PM1 and GPE0
519  * events in the SMI# handler, as these events have triggered a SCI.
520  * Do not ignore any other SMI# types, since they cannot cause a SCI.
521  */
523  smi_sts &= ~(1 << PM1_STS_BIT | 1 << GPE0_STS_BIT);
524 
525  if (!smi_sts)
526  return;
527 
528  save_state_ops = get_smm_save_state_ops();
529 
530  /* Call SMI sub handler for each of the status bits */
531  for (i = 0; i < ARRAY_SIZE(southbridge_smi); i++) {
532  if (!(smi_sts & (1 << i)))
533  continue;
534 
535  if (southbridge_smi[i] != NULL) {
536  southbridge_smi[i](save_state_ops);
537  } else {
539  "SMI_STS[%d] occurred, but no "
540  "handler available.\n", i);
541  }
542  }
543 }
544 
546 {
547  em64t100_smm_state_save_area_t *smm_state = state;
548  return smm_state->io_misc_info;
549 }
550 
552 {
553  uintptr_t value = 0;
554  em64t100_smm_state_save_area_t *smm_state = state;
555 
556  switch (reg) {
557  case RAX:
558  value = smm_state->rax;
559  break;
560  case RBX:
561  value = smm_state->rbx;
562  break;
563  case RCX:
564  value = smm_state->rcx;
565  break;
566  case RDX:
567  value = smm_state->rdx;
568  break;
569  default:
570  break;
571  }
572  return value;
573 }
574 
575 static void em64t100_smm_save_state_set_reg(void *state, enum smm_reg reg,
576  uint64_t val)
577 {
578  em64t100_smm_state_save_area_t *smm_state = state;
579  switch (reg) {
580  case RAX:
581  smm_state->rax = val;
582  break;
583  case RBX:
584  smm_state->rbx = val;
585  break;
586  case RCX:
587  smm_state->rcx = val;
588  break;
589  case RDX:
590  smm_state->rdx = val;
591  break;
592  default:
593  break;
594  }
595 }
596 
598 {
599  em64t101_smm_state_save_area_t *smm_state = state;
600  return smm_state->io_misc_info;
601 }
602 
604 {
605  uintptr_t value = 0;
606  em64t101_smm_state_save_area_t *smm_state = state;
607 
608  switch (reg) {
609  case RAX:
610  value = smm_state->rax;
611  break;
612  case RBX:
613  value = smm_state->rbx;
614  break;
615  case RCX:
616  value = smm_state->rcx;
617  break;
618  case RDX:
619  value = smm_state->rdx;
620  break;
621  default:
622  break;
623  }
624  return value;
625 }
626 
627 static void em64t101_smm_save_state_set_reg(void *state, enum smm_reg reg,
628  uint64_t val)
629 {
630  em64t101_smm_state_save_area_t *smm_state = state;
631  switch (reg) {
632  case RAX:
633  smm_state->rax = val;
634  break;
635  case RBX:
636  smm_state->rbx = val;
637  break;
638  case RCX:
639  smm_state->rcx = val;
640  break;
641  case RDX:
642  smm_state->rdx = val;
643  break;
644  default:
645  break;
646  }
647 }
648 
649 const struct smm_save_state_ops em64t100_smm_ops = {
653 };
654 
655 const struct smm_save_state_ops em64t101_smm_ops = {
659 };
#define GPE0_STS_BIT
Definition: pm.h:67
#define SCI_EN
Definition: pm.h:30
#define SLP_SMI_EN
Definition: pm.h:45
#define PM1_STS_BIT
Definition: pm.h:68
#define PM1_CNT
Definition: pm.h:27
#define EOS
Definition: pm.h:48
#define PERIODIC_EN
Definition: pm.h:39
pte_t value
Definition: mmu.c:91
static __always_inline void hlt(void)
Definition: hlt.h:6
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define PWRBTN_STS
Definition: southbridge.h:30
#define PWRBTN_EN
Definition: southbridge.h:36
#define ELOG_TYPE_ACPI_ENTER
Definition: elog.h:143
#define ELOG_TYPE_POWER_BUTTON
Definition: elog.h:133
#define printk(level,...)
Definition: stdlib.h:16
void __weak mainboard_smi_finalize(void)
Definition: smihandler.c:211
void __weak southbridge_smi_handler(void)
Definition: smihandler.c:207
void __weak mainboard_smi_sleep(u8 slp_typ)
Definition: smihandler.c:210
int __weak mainboard_smi_apmc(u8 data)
Definition: smihandler.c:209
void * smm_get_save_state(int cpu)
Definition: smihandler.c:114
void mdelay(unsigned int msecs)
Definition: delay.c:2
u32 inl(u16 port)
uint32_t smmstore_exec(uint8_t command, void *param)
Definition: smi.c:144
@ CONFIG
Definition: dsi_common.h:201
void fast_spi_init(void)
Definition: fast_spi.c:41
void fast_spi_enable_wp(void)
Definition: fast_spi.c:428
bool fast_spi_clear_sync_smi_status(void)
Definition: fast_spi.c:407
bool fast_spi_wpd_status(void)
Definition: fast_spi.c:421
void fast_spi_disable_wp(void)
Definition: fast_spi.c:439
u32 gsmi_exec(u8 command, u32 *param)
Definition: gsmi.c:46
@ ACPI_S5
Definition: acpi.h:1385
@ ACPI_S4
Definition: acpi.h:1384
@ ACPI_S3
Definition: acpi.h:1383
@ ACPI_S0
Definition: acpi.h:1380
#define MSR_SPCL_CHIPSET_USAGE
Definition: msr.h:32
static void wbinvd(void)
Definition: cache.h:15
static __always_inline void wrmsr(unsigned int index, msr_t msr)
Definition: msr.h:157
#define APM_CNT
Definition: smm.h:19
#define APM_CNT_ELOG_GSMI
Definition: smm.h:29
#define APM_CNT_ACPI_DISABLE
Definition: smm.h:21
#define APM_CNT_ACPI_ENABLE
Definition: smm.h:22
#define APM_CNT_SMMSTORE
Definition: smm.h:28
#define APM_CNT_FINALIZE
Definition: smm.h:24
static __always_inline uint32_t read32p(const uintptr_t addr)
Definition: mmio.h:220
static __always_inline u16 pci_read_config16(const struct device *dev, u16 reg)
Definition: pci_ops.h:52
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition: pci_ops.h:58
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
static __always_inline void pci_write_config16(const struct device *dev, u16 reg, u16 val)
Definition: pci_ops.h:70
static int elog_gsmi_add_event(u8 event_type)
Definition: elog.h:45
static int elog_gsmi_add_event_byte(u8 event_type, u8 data)
Definition: elog.h:46
#define ACPI_BASE_ADDRESS
Definition: iomap.h:99
#define SLP_EN
Definition: pmc.h:62
#define SLP_TYP_S5
Definition: pmc.h:69
#define SLP_TYP
Definition: pmc.h:64
#define SLP_TYP_SHIFT
Definition: pmc.h:63
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define BIOS_CRIT
BIOS_CRIT - Recovery unlikely.
Definition: loglevel.h:56
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
Definition: loglevel.h:142
void mainboard_smi_espi_handler(void)
Definition: smihandler.c:26
void mainboard_smi_gpi_handler(const struct gpi_status *sts)
Definition: smihandler.c:16
state
Definition: raminit.c:1787
#define PCI_HEADER_TYPE
Definition: pci_def.h:47
#define PCI_HEADER_TYPE_CARDBUS
Definition: pci_def.h:50
#define PCI_SECONDARY_BUS
Definition: pci_def.h:101
#define PCI_COMMAND_MASTER
Definition: pci_def.h:13
#define PCI_COMMAND
Definition: pci_def.h:10
#define PCI_HEADER_TYPE_BRIDGE
Definition: pci_def.h:49
#define PCI_VENDOR_ID
Definition: pci_def.h:8
#define PCI_DEV(SEGBUS, DEV, FN)
Definition: pci_type.h:14
u32 pci_devfn_t
Definition: pci_type.h:8
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
@ RDX
Definition: save_state.h:12
@ RBX
Definition: save_state.h:10
@ RCX
Definition: save_state.h:11
@ RAX
Definition: save_state.h:9
u8 apm_get_apmc(void)
Definition: smi_trigger.c:46
smm_reg
Definition: smihandler.h:15
struct global_nvs * gnvs
const smi_handler_t southbridge_smi[SMI_STS_BITS]
Definition: smihandler.c:17
int smihandler_soc_disable_busmaster(pci_devfn_t dev)
Definition: smihandler.c:9
#define TCO_TIMEOUT
Definition: smbus.h:8
#define TCO_INTRD_DET
Definition: smbus.h:11
const struct smm_save_state_ops * get_smm_save_state_ops(void)
Definition: smihandler.c:18
void southbridge_smi_set_eos(void)
Definition: smihandler.c:41
void smihandler_soc_at_finalize(void)
Definition: smihandler.c:17
int gpio_lock_pads(const struct gpio_lock_config *pad_list, const size_t count)
Definition: gpio.c:504
void gpi_clear_get_smi_status(struct gpi_status *sts)
Definition: gpio.c:700
void pmc_clear_all_gpe_status(void)
Definition: pmclib.c:355
uint16_t pmc_read_pm1_enable(void)
Definition: pmclib.c:159
void pmc_disable_all_gpe(void)
Definition: pmclib.c:305
void pmc_set_power_failure_state(bool target_on)
Definition: pmclib.c:623
uint16_t pmc_clear_pm1_status(void)
Definition: pmclib.c:250
void pmc_disable_pm1_control(uint32_t mask)
Definition: pmclib.c:213
uint32_t pmc_read_pm1_control(void)
Definition: pmclib.c:196
void pmc_disable_smi(uint32_t mask)
Definition: pmclib.c:183
uint32_t pmc_clear_tco_status(void)
Definition: pmclib.c:275
uint32_t pmc_get_smi_en(void)
Definition: pmclib.c:171
uint32_t pmc_clear_smi_status(void)
Definition: pmclib.c:164
void pmc_enable_pm1_control(uint32_t mask)
Definition: pmclib.c:206
void pmc_enable_smi(uint32_t mask)
Definition: pmclib.c:176
bool uart_is_controller_initialized(void)
Definition: uart.c:78
void smihandler_southbridge_gpe0(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:414
static void finalize(void)
Definition: smihandler.c:333
void smihandler_southbridge_sleep(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:150
static uint32_t em64t101_smm_save_state_get_io_misc_info(void *state)
Definition: smihandler.c:597
__weak const struct gpio_lock_config * soc_gpio_lock_config(size_t *num)
Definition: smihandler.c:314
static uint64_t em64t100_smm_save_state_get_reg(void *state, enum smm_reg reg)
Definition: smihandler.c:551
static void southbridge_smi_gsmi(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:244
static void busmaster_disable_on_bus(int bus)
Definition: smihandler.c:103
void smihandler_southbridge_gpi(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:485
static void em64t100_smm_save_state_set_reg(void *state, enum smm_reg reg, uint64_t val)
Definition: smihandler.c:575
const struct smm_save_state_ops em64t101_smm_ops
Definition: smihandler.c:655
void smihandler_southbridge_periodic(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:472
void smihandler_southbridge_tco(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:420
static void soc_lock_gpios(void)
Definition: smihandler.c:320
void smihandler_southbridge_espi(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:497
static uint64_t em64t101_smm_save_state_get_reg(void *state, enum smm_reg reg)
Definition: smihandler.c:603
static void * find_save_state(const struct smm_save_state_ops *save_state_ops, int cmd)
Definition: smihandler.c:65
static void set_insmm_sts(const bool enable_writes)
Definition: smihandler.c:266
const struct smm_save_state_ops em64t100_smm_ops
Definition: smihandler.c:649
static uint32_t em64t100_smm_save_state_get_io_misc_info(void *state)
Definition: smihandler.c:545
void smihandler_southbridge_pm1(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:396
static void southbridge_smi_store(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:280
static void em64t101_smm_save_state_set_reg(void *state, enum smm_reg reg, uint64_t val)
Definition: smihandler.c:627
void smihandler_southbridge_apmc(const struct smm_save_state_ops *save_state_ops)
Definition: smihandler.c:367
#define NULL
Definition: stddef.h:19
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21
uint16_t u16
Definition: stdint.h:48
unsigned long long uint64_t
Definition: stdint.h:17
uint8_t u8
Definition: stdint.h:45
unsigned char uint8_t
Definition: stdint.h:8
Definition: device.h:76
uint8_t uior
Definition: nvs.h:29
unsigned int lo
Definition: msr.h:111
int(* set_reg)(const enum cpu_reg reg, const int node, void *in, const uint8_t length)
Definition: save_state.h:22
int(* get_reg)(const enum cpu_reg reg, const int node, void *out, const uint8_t length)
Definition: save_state.h:21
uint32_t(* get_io_misc_info)(void *state)
Definition: smihandler.h:24
u8 val
Definition: sys.c:300