coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pmutil.h File Reference
#include <cpu/x86/smm.h>
Include dependency graph for pmutil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define D31F0_PMBASE   0x40
 
#define D31F0_GEN_PMCON_1   0xa0
 
#define SMI_LOCK   (1 << 4)
 
#define D31F0_GEN_PMCON_2   0xa2
 
#define D31F0_GEN_PMCON_3   0xa4
 
#define RTC_BATTERY_DEAD   (1 << 2)
 
#define RTC_POWER_FAILED   (1 << 1)
 
#define SLEEP_AFTER_POWER_FAIL   (1 << 0)
 
#define D31F0_GEN_PMCON_LOCK   0xa6
 
#define ACPI_BASE_LOCK   (1 << 1)
 
#define SLP_STR_POL_LOCK   (1 << 2)
 
#define D31F0_ETR3   0xac
 
#define ETR3_CWORWRE   (1 << 18)
 
#define ETR3_CF9GR   (1 << 20)
 
#define ETR3_CF9LOCK   (1 << 31)
 
#define D31F0_GPIO_ROUT   0xb8
 
#define GPI_DISABLE   0x00
 
#define GPI_IS_SMI   0x01
 
#define GPI_IS_SCI   0x02
 
#define GPI_IS_NMI   0x03
 
#define MAINBOARD_POWER_OFF   0
 
#define MAINBOARD_POWER_ON   1
 
#define MAINBOARD_POWER_KEEP   2
 
#define PM1_STS   0x00
 
#define WAK_STS   (1 << 15)
 
#define PCIEXPWAK_STS   (1 << 14)
 
#define PRBTNOR_STS   (1 << 11)
 
#define RTC_STS   (1 << 10)
 
#define PWRBTN_STS   (1 << 8)
 
#define GBL_STS   (1 << 5)
 
#define BM_STS   (1 << 4)
 
#define TMROF_STS   (1 << 0)
 
#define PM1_EN   0x02
 
#define PCIEXPWAK_DIS   (1 << 14)
 
#define RTC_EN   (1 << 10)
 
#define PWRBTN_EN   (1 << 8)
 
#define GBL_EN   (1 << 5)
 
#define TMROF_EN   (1 << 0)
 
#define PM1_CNT   0x04
 
#define GBL_RLS   (1 << 2)
 
#define BM_RLD   (1 << 1)
 
#define SCI_EN   (1 << 0)
 
#define PM1_TMR   0x08
 
#define PROC_CNT   0x10
 
#define LV2   0x14
 
#define LV3   0x15
 
#define LV4   0x16
 
#define PM2_CNT   0x50
 
#define GPE0_STS   0x20
 
#define USB4_STS   (1 << 14) /* i82801gx only */
 
#define PME_B0_STS   (1 << 13)
 
#define PME_STS   (1 << 11)
 
#define BATLOW_STS   (1 << 10)
 
#define PCI_EXP_STS   (1 << 9)
 
#define RI_STS   (1 << 8)
 
#define SMB_WAK_STS   (1 << 7)
 
#define TCOSCI_STS   (1 << 6)
 
#define SWGPE_STS   (1 << 2)
 
#define HOT_PLUG_STS   (1 << 1)
 
#define GPE0_EN   0x28
 
#define PME_B0_EN   (1 << 13)
 
#define PME_EN   (1 << 11)
 
#define TCOSCI_EN   (1 << 6)
 
#define SMI_EN   0x30
 
#define INTEL_USB2_EN   (1 << 18)
 
#define LEGACY_USB2_EN   (1 << 17)
 
#define PERIODIC_EN   (1 << 14)
 
#define TCO_EN   (1 << 13)
 
#define MCSMI_EN   (1 << 11)
 
#define BIOS_RLS   (1 << 7)
 
#define SWSMI_TMR_EN   (1 << 6)
 
#define APMC_EN   (1 << 5)
 
#define SLP_SMI_EN   (1 << 4)
 
#define LEGACY_USB_EN   (1 << 3)
 
#define BIOS_EN   (1 << 2)
 
#define EOS   (1 << 1)
 
#define GBL_SMI_EN   (1 << 0)
 
#define SMI_STS   0x34
 
#define ALT_GP_SMI_EN   0x38
 
#define ALT_GP_SMI_STS   0x3a
 
#define GPE_CNTL   0x42
 
#define DEVACT_STS   0x44
 
#define SS_CNT   0x50
 
#define C3_RES   0x54
 
#define TCO1_STS   0x64
 
#define DMISCI_STS   (1 << 9)
 
#define BOOT_STS   (1 << 18)
 
#define TCO2_STS   0x66
 
#define TCO1_CNT   0x68
 
#define TCO_LOCK   (1 << 12)
 
#define TCO2_CNT   0x6a
 

Functions

u16 get_pmbase (void)
 
u16 reset_pm1_status (void)
 read and clear PM1_STS More...
 
void dump_pm1_status (u16 pm1_sts)
 
void dump_tco_status (u32 tco_sts)
 
u32 reset_tco_status (void)
 read and clear TCOx_STS More...
 
void dump_gpe0_status (u64 gpe0_sts)
 
u64 reset_gpe0_status (void)
 read and clear GPE0_STS More...
 
void dump_smi_status (u32 smi_sts)
 
u32 reset_smi_status (void)
 read and clear SMI_STS More...
 
void gpe0_mask (u32 clr, u32 set)
 
void alt_gpi_mask (u16 clr, u16 set)
 
void smi_set_eos (void)
 Set the EOS bit. More...
 
void dump_alt_gp_smi_status (u16 alt_gp_smi_sts)
 
u16 reset_alt_gp_smi_status (void)
 read and clear ALT_GP_SMI_STS More...
 
void dump_all_status (void)
 
void southbridge_smm_xhci_sleep (u8 slp_type)
 
void gpi_route_interrupt (u8 gpi, u8 mode)
 
void southbridge_gate_memory_reset (void)
 
void southbridge_finalize_all (void)
 
void southbridge_smi_monitor (void)
 
void pch_log_state (void)
 

Macro Definition Documentation

◆ ACPI_BASE_LOCK

#define ACPI_BASE_LOCK   (1 << 1)

Definition at line 17 of file pmutil.h.

◆ ALT_GP_SMI_EN

#define ALT_GP_SMI_EN   0x38

Definition at line 97 of file pmutil.h.

◆ ALT_GP_SMI_STS

#define ALT_GP_SMI_STS   0x3a

Definition at line 98 of file pmutil.h.

◆ APMC_EN

#define APMC_EN   (1 << 5)

Definition at line 90 of file pmutil.h.

◆ BATLOW_STS

#define BATLOW_STS   (1 << 10)

Definition at line 67 of file pmutil.h.

◆ BIOS_EN

#define BIOS_EN   (1 << 2)

Definition at line 93 of file pmutil.h.

◆ BIOS_RLS

#define BIOS_RLS   (1 << 7)

Definition at line 88 of file pmutil.h.

◆ BM_RLD

#define BM_RLD   (1 << 1)

Definition at line 50 of file pmutil.h.

◆ BM_STS

#define BM_STS   (1 << 4)

Definition at line 40 of file pmutil.h.

◆ BOOT_STS

#define BOOT_STS   (1 << 18)

Definition at line 105 of file pmutil.h.

◆ C3_RES

#define C3_RES   0x54

Definition at line 102 of file pmutil.h.

◆ D31F0_ETR3

#define D31F0_ETR3   0xac

Definition at line 19 of file pmutil.h.

◆ D31F0_GEN_PMCON_1

#define D31F0_GEN_PMCON_1   0xa0

Definition at line 9 of file pmutil.h.

◆ D31F0_GEN_PMCON_2

#define D31F0_GEN_PMCON_2   0xa2

Definition at line 11 of file pmutil.h.

◆ D31F0_GEN_PMCON_3

#define D31F0_GEN_PMCON_3   0xa4

Definition at line 12 of file pmutil.h.

◆ D31F0_GEN_PMCON_LOCK

#define D31F0_GEN_PMCON_LOCK   0xa6

Definition at line 16 of file pmutil.h.

◆ D31F0_GPIO_ROUT

#define D31F0_GPIO_ROUT   0xb8

Definition at line 23 of file pmutil.h.

◆ D31F0_PMBASE

#define D31F0_PMBASE   0x40

Definition at line 8 of file pmutil.h.

◆ DEVACT_STS

#define DEVACT_STS   0x44

Definition at line 100 of file pmutil.h.

◆ DMISCI_STS

#define DMISCI_STS   (1 << 9)

Definition at line 104 of file pmutil.h.

◆ EOS

#define EOS   (1 << 1)

Definition at line 94 of file pmutil.h.

◆ ETR3_CF9GR

#define ETR3_CF9GR   (1 << 20)

Definition at line 21 of file pmutil.h.

◆ ETR3_CF9LOCK

#define ETR3_CF9LOCK   (1 << 31)

Definition at line 22 of file pmutil.h.

◆ ETR3_CWORWRE

#define ETR3_CWORWRE   (1 << 18)

Definition at line 20 of file pmutil.h.

◆ GBL_EN

#define GBL_EN   (1 << 5)

Definition at line 46 of file pmutil.h.

◆ GBL_RLS

#define GBL_RLS   (1 << 2)

Definition at line 49 of file pmutil.h.

◆ GBL_SMI_EN

#define GBL_SMI_EN   (1 << 0)

Definition at line 95 of file pmutil.h.

◆ GBL_STS

#define GBL_STS   (1 << 5)

Definition at line 39 of file pmutil.h.

◆ GPE0_EN

#define GPE0_EN   0x28

Definition at line 77 of file pmutil.h.

◆ GPE0_STS

#define GPE0_STS   0x20

Definition at line 62 of file pmutil.h.

◆ GPE_CNTL

#define GPE_CNTL   0x42

Definition at line 99 of file pmutil.h.

◆ GPI_DISABLE

#define GPI_DISABLE   0x00

Definition at line 24 of file pmutil.h.

◆ GPI_IS_NMI

#define GPI_IS_NMI   0x03

Definition at line 27 of file pmutil.h.

◆ GPI_IS_SCI

#define GPI_IS_SCI   0x02

Definition at line 26 of file pmutil.h.

◆ GPI_IS_SMI

#define GPI_IS_SMI   0x01

Definition at line 25 of file pmutil.h.

◆ HOT_PLUG_STS

#define HOT_PLUG_STS   (1 << 1)

Definition at line 73 of file pmutil.h.

◆ INTEL_USB2_EN

#define INTEL_USB2_EN   (1 << 18)

Definition at line 83 of file pmutil.h.

◆ LEGACY_USB2_EN

#define LEGACY_USB2_EN   (1 << 17)

Definition at line 84 of file pmutil.h.

◆ LEGACY_USB_EN

#define LEGACY_USB_EN   (1 << 3)

Definition at line 92 of file pmutil.h.

◆ LV2

#define LV2   0x14

Definition at line 54 of file pmutil.h.

◆ LV3

#define LV3   0x15

Definition at line 55 of file pmutil.h.

◆ LV4

#define LV4   0x16

Definition at line 56 of file pmutil.h.

◆ MAINBOARD_POWER_KEEP

#define MAINBOARD_POWER_KEEP   2

Definition at line 31 of file pmutil.h.

◆ MAINBOARD_POWER_OFF

#define MAINBOARD_POWER_OFF   0

Definition at line 29 of file pmutil.h.

◆ MAINBOARD_POWER_ON

#define MAINBOARD_POWER_ON   1

Definition at line 30 of file pmutil.h.

◆ MCSMI_EN

#define MCSMI_EN   (1 << 11)

Definition at line 87 of file pmutil.h.

◆ PCI_EXP_STS

#define PCI_EXP_STS   (1 << 9)

Definition at line 68 of file pmutil.h.

◆ PCIEXPWAK_DIS

#define PCIEXPWAK_DIS   (1 << 14)

Definition at line 43 of file pmutil.h.

◆ PCIEXPWAK_STS

#define PCIEXPWAK_STS   (1 << 14)

Definition at line 35 of file pmutil.h.

◆ PERIODIC_EN

#define PERIODIC_EN   (1 << 14)

Definition at line 85 of file pmutil.h.

◆ PM1_CNT

#define PM1_CNT   0x04

Definition at line 48 of file pmutil.h.

◆ PM1_EN

#define PM1_EN   0x02

Definition at line 42 of file pmutil.h.

◆ PM1_STS

#define PM1_STS   0x00

Definition at line 33 of file pmutil.h.

◆ PM1_TMR

#define PM1_TMR   0x08

Definition at line 52 of file pmutil.h.

◆ PM2_CNT

#define PM2_CNT   0x50

Definition at line 61 of file pmutil.h.

◆ PME_B0_EN

#define PME_B0_EN   (1 << 13)

Definition at line 79 of file pmutil.h.

◆ PME_B0_STS

#define PME_B0_STS   (1 << 13)

Definition at line 65 of file pmutil.h.

◆ PME_EN

#define PME_EN   (1 << 11)

Definition at line 80 of file pmutil.h.

◆ PME_STS

#define PME_STS   (1 << 11)

Definition at line 66 of file pmutil.h.

◆ PRBTNOR_STS

#define PRBTNOR_STS   (1 << 11)

Definition at line 36 of file pmutil.h.

◆ PROC_CNT

#define PROC_CNT   0x10

Definition at line 53 of file pmutil.h.

◆ PWRBTN_EN

#define PWRBTN_EN   (1 << 8)

Definition at line 45 of file pmutil.h.

◆ PWRBTN_STS

#define PWRBTN_STS   (1 << 8)

Definition at line 38 of file pmutil.h.

◆ RI_STS

#define RI_STS   (1 << 8)

Definition at line 69 of file pmutil.h.

◆ RTC_BATTERY_DEAD

#define RTC_BATTERY_DEAD   (1 << 2)

Definition at line 13 of file pmutil.h.

◆ RTC_EN

#define RTC_EN   (1 << 10)

Definition at line 44 of file pmutil.h.

◆ RTC_POWER_FAILED

#define RTC_POWER_FAILED   (1 << 1)

Definition at line 14 of file pmutil.h.

◆ RTC_STS

#define RTC_STS   (1 << 10)

Definition at line 37 of file pmutil.h.

◆ SCI_EN

#define SCI_EN   (1 << 0)

Definition at line 51 of file pmutil.h.

◆ SLEEP_AFTER_POWER_FAIL

#define SLEEP_AFTER_POWER_FAIL   (1 << 0)

Definition at line 15 of file pmutil.h.

◆ SLP_SMI_EN

#define SLP_SMI_EN   (1 << 4)

Definition at line 91 of file pmutil.h.

◆ SLP_STR_POL_LOCK

#define SLP_STR_POL_LOCK   (1 << 2)

Definition at line 18 of file pmutil.h.

◆ SMB_WAK_STS

#define SMB_WAK_STS   (1 << 7)

Definition at line 70 of file pmutil.h.

◆ SMI_EN

#define SMI_EN   0x30

Definition at line 82 of file pmutil.h.

◆ SMI_LOCK

#define SMI_LOCK   (1 << 4)

Definition at line 10 of file pmutil.h.

◆ SMI_STS

#define SMI_STS   0x34

Definition at line 96 of file pmutil.h.

◆ SS_CNT

#define SS_CNT   0x50

Definition at line 101 of file pmutil.h.

◆ SWGPE_STS

#define SWGPE_STS   (1 << 2)

Definition at line 72 of file pmutil.h.

◆ SWSMI_TMR_EN

#define SWSMI_TMR_EN   (1 << 6)

Definition at line 89 of file pmutil.h.

◆ TCO1_CNT

#define TCO1_CNT   0x68

Definition at line 107 of file pmutil.h.

◆ TCO1_STS

#define TCO1_STS   0x64

Definition at line 103 of file pmutil.h.

◆ TCO2_CNT

#define TCO2_CNT   0x6a

Definition at line 109 of file pmutil.h.

◆ TCO2_STS

#define TCO2_STS   0x66

Definition at line 106 of file pmutil.h.

◆ TCO_EN

#define TCO_EN   (1 << 13)

Definition at line 86 of file pmutil.h.

◆ TCO_LOCK

#define TCO_LOCK   (1 << 12)

Definition at line 108 of file pmutil.h.

◆ TCOSCI_EN

#define TCOSCI_EN   (1 << 6)

Definition at line 81 of file pmutil.h.

◆ TCOSCI_STS

#define TCOSCI_STS   (1 << 6)

Definition at line 71 of file pmutil.h.

◆ TMROF_EN

#define TMROF_EN   (1 << 0)

Definition at line 47 of file pmutil.h.

◆ TMROF_STS

#define TMROF_STS   (1 << 0)

Definition at line 41 of file pmutil.h.

◆ USB4_STS

#define USB4_STS   (1 << 14) /* i82801gx only */

Definition at line 64 of file pmutil.h.

◆ WAK_STS

#define WAK_STS   (1 << 15)

Definition at line 34 of file pmutil.h.

Function Documentation

◆ alt_gpi_mask()

void alt_gpi_mask ( u16  clr,
u16  set 
)

Definition at line 11 of file pmutil.c.

References ALT_GP_SMI_EN, read_pmbase16(), and write_pmbase16().

Referenced by gpi_route_interrupt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_all_status()

void dump_all_status ( void  )

Definition at line 216 of file pmutil.c.

References dump_alt_gp_smi_status(), dump_gpe0_status(), dump_pm1_status(), dump_smi_status(), dump_tco_status(), reset_alt_gp_smi_status(), reset_gpe0_status(), reset_pm1_status(), reset_smi_status(), and reset_tco_status().

Referenced by global_smi_enable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_alt_gp_smi_status()

void dump_alt_gp_smi_status ( u16  alt_gp_smi_sts)

Definition at line 191 of file pmutil.c.

References BIOS_DEBUG, and printk.

Referenced by dump_all_status().

Here is the caller graph for this function:

◆ dump_gpe0_status()

void dump_gpe0_status ( u64  gpe0_sts)

Definition at line 114 of file pmutil.c.

References BIOS_DEBUG, and printk.

Referenced by dump_all_status().

Here is the caller graph for this function:

◆ dump_pm1_status()

void dump_pm1_status ( u16  pm1_sts)

Definition at line 40 of file pmutil.c.

References BIOS_SPEW, PM1_EN, printk, and read_pmbase16().

Referenced by dump_all_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_smi_status()

void dump_smi_status ( u32  smi_sts)

Definition at line 72 of file pmutil.c.

References BIOS_DEBUG, and printk.

Referenced by dump_all_status().

Here is the caller graph for this function:

◆ dump_tco_status()

void dump_tco_status ( u32  tco_sts)

Definition at line 160 of file pmutil.c.

References BIOS_DEBUG, and printk.

Referenced by dump_all_status().

Here is the caller graph for this function:

◆ get_pmbase()

u16 get_pmbase ( void  )

Definition at line 254 of file pmutil.c.

◆ gpe0_mask()

void gpe0_mask ( u32  clr,
u32  set 
)

Definition at line 19 of file pmutil.c.

References GPE0_EN, read_pmbase32(), and write_pmbase32().

Referenced by gpi_route_interrupt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpi_route_interrupt()

void gpi_route_interrupt ( u8  gpi,
u8  mode 
)

Definition at line 25 of file smihandler.c.

References alt_gpi_mask(), D31F0_GPIO_ROUT, gpe0_mask(), GPI_IS_SCI, GPI_IS_SMI, PCI_DEV, pci_read_config32(), and pci_write_config32().

Referenced by mainboard_smi_apmc(), and mainboard_smi_sleep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pch_log_state()

void pch_log_state ( void  )

Definition at line 88 of file elog.c.

◆ reset_alt_gp_smi_status()

u16 reset_alt_gp_smi_status ( void  )

read and clear ALT_GP_SMI_STS

Returns
ALT_GP_SMI_STS register

Definition at line 205 of file pmutil.c.

References ALT_GP_SMI_STS, read_pmbase16(), and write_pmbase16().

Referenced by dump_all_status(), and southbridge_smi_gpi().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_gpe0_status()

u64 reset_gpe0_status ( void  )

read and clear GPE0_STS

Returns
GPE0_STS register

Definition at line 101 of file pmutil.c.

References GPE0_STS, read_pmbase32(), and write_pmbase32().

Referenced by dump_all_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_pm1_status()

u16 reset_pm1_status ( void  )

read and clear PM1_STS

Returns
PM1_STS register

Definition at line 31 of file pmutil.c.

References PM1_STS, read_pmbase16(), and write_pmbase16().

Referenced by clear_pm1_status(), and dump_all_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_smi_status()

u32 reset_smi_status ( void  )

read and clear SMI_STS

Returns
SMI_STS register

Definition at line 61 of file pmutil.c.

References read_pmbase32(), SMI_STS, and write_pmbase32().

Referenced by clear_smi_status(), and dump_all_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset_tco_status()

u32 reset_tco_status ( void  )

read and clear TCOx_STS

Returns
TCOx_STS registers

Definition at line 144 of file pmutil.c.

References BOOT_STS, read_pmbase32(), TCO1_STS, and write_pmbase32().

Referenced by clear_tco_status(), and dump_all_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ smi_set_eos()

void smi_set_eos ( void  )

Set the EOS bit.

Definition at line 182 of file pmutil.c.

References EOS, read_pmbase8(), SMI_EN, and write_pmbase8().

Here is the call graph for this function:

◆ southbridge_finalize_all()

void southbridge_finalize_all ( void  )

Definition at line 215 of file smihandler.c.

References intel_ironlake_finalize_smm(), intel_me_finalize_smm(), intel_model_2065x_finalize_smm(), intel_model_206ax_finalize_smm(), intel_pch_finalize_smm(), and intel_sandybridge_finalize_smm().

Referenced by southbridge_smi_apmc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ southbridge_gate_memory_reset()

void southbridge_gate_memory_reset ( void  )

Definition at line 69 of file smihandler.c.

References GP_IO_SEL, GP_IO_SEL2, GP_LVL, GP_LVL2, GPIO_USE_SEL, GPIO_USE_SEL2, GPIOBASE, PCH_LPC_DEV, PCI_DEV, pci_read_config16(), and southbridge_gate_memory_reset_real().

Referenced by southbridge_smi_sleep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ southbridge_smi_monitor()

void southbridge_smi_monitor ( void  )

Definition at line 89 of file smihandler.c.

References BIOS_DEBUG, gnvs, io_trap_handler(), IOTRAP, mask, printk, RCBA32, and global_nvs::smif.

Here is the call graph for this function:

◆ southbridge_smm_xhci_sleep()

void southbridge_smm_xhci_sleep ( u8  slp_type)

Definition at line 182 of file smihandler.c.

References ACPI_S3, ACPI_S4, ACPI_S5, FD, PCH_DISABLE_XHCI, PCH_LPC_DEV, pch_silicon_type(), PCH_TYPE_PPT, PCH_XHCI_DEV, pci_or_config16(), pci_read_config32(), RCBA, RCBA32, RCBA_ENABLE, xhci_a0_suspend_smm_workaround(), and XHCI_PWR_CNTL_STS.

Referenced by southbridge_smi_sleep().

Here is the call graph for this function:
Here is the caller graph for this function: