coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pmutil.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef INTEL_COMMON_PMUTIL_H
4 #define INTEL_COMMON_PMUTIL_H
5 
6 #include <cpu/x86/smm.h>
7 
8 #define D31F0_PMBASE 0x40
9 #define D31F0_GEN_PMCON_1 0xa0
10 #define SMI_LOCK (1 << 4)
11 #define D31F0_GEN_PMCON_2 0xa2
12 #define D31F0_GEN_PMCON_3 0xa4
13 #define RTC_BATTERY_DEAD (1 << 2)
14 #define RTC_POWER_FAILED (1 << 1)
15 #define SLEEP_AFTER_POWER_FAIL (1 << 0)
16 #define D31F0_GEN_PMCON_LOCK 0xa6
17 #define ACPI_BASE_LOCK (1 << 1)
18 #define SLP_STR_POL_LOCK (1 << 2)
19 #define D31F0_ETR3 0xac
20 #define ETR3_CWORWRE (1 << 18)
21 #define ETR3_CF9GR (1 << 20)
22 #define ETR3_CF9LOCK (1 << 31)
23 #define D31F0_GPIO_ROUT 0xb8
24 #define GPI_DISABLE 0x00
25 #define GPI_IS_SMI 0x01
26 #define GPI_IS_SCI 0x02
27 #define GPI_IS_NMI 0x03
28 
29 #define MAINBOARD_POWER_OFF 0
30 #define MAINBOARD_POWER_ON 1
31 #define MAINBOARD_POWER_KEEP 2
32 
33 #define PM1_STS 0x00
34 #define WAK_STS (1 << 15)
35 #define PCIEXPWAK_STS (1 << 14)
36 #define PRBTNOR_STS (1 << 11)
37 #define RTC_STS (1 << 10)
38 #define PWRBTN_STS (1 << 8)
39 #define GBL_STS (1 << 5)
40 #define BM_STS (1 << 4)
41 #define TMROF_STS (1 << 0)
42 #define PM1_EN 0x02
43 #define PCIEXPWAK_DIS (1 << 14)
44 #define RTC_EN (1 << 10)
45 #define PWRBTN_EN (1 << 8)
46 #define GBL_EN (1 << 5)
47 #define TMROF_EN (1 << 0)
48 #define PM1_CNT 0x04
49 #define GBL_RLS (1 << 2)
50 #define BM_RLD (1 << 1)
51 #define SCI_EN (1 << 0)
52 #define PM1_TMR 0x08
53 #define PROC_CNT 0x10
54 #define LV2 0x14
55 #define LV3 0x15
56 #define LV4 0x16
57 #if CONFIG(SOUTHBRIDGE_INTEL_I82801GX)
58 #define PM2_CNT 0x20 // mobile only
59 #define GPE0_STS 0x28
60 #else
61 #define PM2_CNT 0x50 // mobile only
62 #define GPE0_STS 0x20
63 #endif /* CONFIG(SOUTHBRIDGE_INTEL_I82801GX) */
64 #define USB4_STS (1 << 14) /* i82801gx only */
65 #define PME_B0_STS (1 << 13)
66 #define PME_STS (1 << 11)
67 #define BATLOW_STS (1 << 10)
68 #define PCI_EXP_STS (1 << 9)
69 #define RI_STS (1 << 8)
70 #define SMB_WAK_STS (1 << 7)
71 #define TCOSCI_STS (1 << 6)
72 #define SWGPE_STS (1 << 2)
73 #define HOT_PLUG_STS (1 << 1)
74 #if CONFIG(SOUTHBRIDGE_INTEL_I82801GX)
75 #define GPE0_EN 0x2c
76 #else
77 #define GPE0_EN 0x28
78 #endif /* CONFIG(SOUTHBRIDGE_INTEL_I82801GX) */
79 #define PME_B0_EN (1 << 13)
80 #define PME_EN (1 << 11)
81 #define TCOSCI_EN (1 << 6)
82 #define SMI_EN 0x30
83 #define INTEL_USB2_EN (1 << 18) // Intel-Specific USB2 SMI logic
84 #define LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic
85 #define PERIODIC_EN (1 << 14) // SMI on PERIODIC_STS in SMI_STS
86 #define TCO_EN (1 << 13) // Enable TCO Logic (BIOSWE et al)
87 #define MCSMI_EN (1 << 11) // Trap microcontroller range access
88 #define BIOS_RLS (1 << 7) // asserts SCI on bit set
89 #define SWSMI_TMR_EN (1 << 6) // start software smi timer on bit set
90 #define APMC_EN (1 << 5) // Writes to APM_CNT cause SMI#
91 #define SLP_SMI_EN (1 << 4) // Write to SLP_EN in PM1_CNT asserts SMI#
92 #define LEGACY_USB_EN (1 << 3) // Legacy USB circuit SMI logic
93 #define BIOS_EN (1 << 2) // Assert SMI# on setting GBL_RLS bit
94 #define EOS (1 << 1) // End of SMI (deassert SMI#)
95 #define GBL_SMI_EN (1 << 0) // SMI# generation at all?
96 #define SMI_STS 0x34
97 #define ALT_GP_SMI_EN 0x38
98 #define ALT_GP_SMI_STS 0x3a
99 #define GPE_CNTL 0x42
100 #define DEVACT_STS 0x44
101 #define SS_CNT 0x50
102 #define C3_RES 0x54
103 #define TCO1_STS 0x64
104 #define DMISCI_STS (1 << 9)
105 #define BOOT_STS (1 << 18)
106 #define TCO2_STS 0x66
107 #define TCO1_CNT 0x68
108 #define TCO_LOCK (1 << 12)
109 #define TCO2_CNT 0x6a
110 
111 u16 get_pmbase(void);
112 
113 u16 reset_pm1_status(void);
114 void dump_pm1_status(u16 pm1_sts);
115 void dump_tco_status(u32 tco_sts);
116 u32 reset_tco_status(void);
117 void dump_gpe0_status(u64 gpe0_sts);
118 u64 reset_gpe0_status(void);
119 void dump_smi_status(u32 smi_sts);
120 u32 reset_smi_status(void);
121 void gpe0_mask(u32 clr, u32 set);
122 void alt_gpi_mask(u16 clr, u16 set);
123 void smi_set_eos(void);
124 void dump_alt_gp_smi_status(u16 alt_gp_smi_sts);
126 void dump_all_status(void);
127 
128 void southbridge_smm_xhci_sleep(u8 slp_type);
129 void gpi_route_interrupt(u8 gpi, u8 mode);
131 void southbridge_finalize_all(void);
132 void southbridge_smi_monitor(void);
133 void pch_log_state(void);
134 
135 #endif /*INTEL_COMMON_PMUTIL_H */
u16 get_pmbase(void)
Definition: pmutil.c:254
void southbridge_finalize_all(void)
Definition: smihandler.c:215
u32 reset_smi_status(void)
read and clear SMI_STS
Definition: pmutil.c:61
u64 reset_gpe0_status(void)
read and clear GPE0_STS
Definition: pmutil.c:101
void alt_gpi_mask(u16 clr, u16 set)
Definition: pmutil.c:11
u16 reset_alt_gp_smi_status(void)
read and clear ALT_GP_SMI_STS
Definition: pmutil.c:205
void gpe0_mask(u32 clr, u32 set)
Definition: pmutil.c:19
void dump_alt_gp_smi_status(u16 alt_gp_smi_sts)
Definition: pmutil.c:191
void smi_set_eos(void)
Set the EOS bit.
Definition: pmutil.c:182
void dump_pm1_status(u16 pm1_sts)
Definition: pmutil.c:40
void pch_log_state(void)
Definition: elog.c:88
void gpi_route_interrupt(u8 gpi, u8 mode)
Definition: smihandler.c:25
void dump_all_status(void)
Definition: pmutil.c:216
u16 reset_pm1_status(void)
read and clear PM1_STS
Definition: pmutil.c:31
void southbridge_smm_xhci_sleep(u8 slp_type)
Definition: smihandler.c:182
u32 reset_tco_status(void)
read and clear TCOx_STS
Definition: pmutil.c:144
void southbridge_smi_monitor(void)
Definition: smihandler.c:89
void dump_gpe0_status(u64 gpe0_sts)
Definition: pmutil.c:114
void dump_tco_status(u32 tco_sts)
Definition: pmutil.c:160
void southbridge_gate_memory_reset(void)
Definition: smihandler.c:69
void dump_smi_status(u32 smi_sts)
Definition: pmutil.c:72
uint64_t u64
Definition: stdint.h:54
uint32_t u32
Definition: stdint.h:51
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45