Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 8702ab5 | 2010-03-14 17:01:08 +0000 | [diff] [blame] | 2 | |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 3 | /* the problem: we have 82801dbm support in fb1, and 82801er in fb2. |
| 4 | * fb1 code is what we want, fb2 structure is needed however. |
| 5 | * so we need to get fb1 code for 82801dbm into fb2 structure. |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 6 | */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 7 | /* What I did: took the 80801er stuff from fb2, verify it against the |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 8 | * db stuff in fb1, and made sure it was right. |
| 9 | */ |
| 10 | |
| 11 | #ifndef I82801DX_H |
| 12 | #define I82801DX_H |
| 13 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 14 | #include <acpi/acpi.h> |
Aaron Durbin | 671909b | 2016-07-13 23:24:36 -0500 | [diff] [blame] | 15 | |
Stefan Reinauer | 3f5f6d8 | 2013-05-07 20:35:29 +0200 | [diff] [blame] | 16 | #if !defined(__ASSEMBLER__) |
Kyösti Mälkki | d7205be | 2019-09-27 07:24:17 +0300 | [diff] [blame] | 17 | |
| 18 | #include <device/device.h> |
Kyösti Mälkki | d7205be | 2019-09-27 07:24:17 +0300 | [diff] [blame] | 19 | |
| 20 | void i82801dx_enable(struct device *dev); |
Kyösti Mälkki | d1141ab | 2020-01-07 11:16:35 +0200 | [diff] [blame] | 21 | void i82801dx_early_init(void); |
Kyösti Mälkki | 55b7263 | 2019-07-08 22:36:38 +0300 | [diff] [blame] | 22 | void aseg_smm_lock(void); |
| 23 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 24 | #endif |
| 25 | |
Stefan Reinauer | bd11298 | 2010-03-17 03:14:54 +0000 | [diff] [blame] | 26 | #define DEBUG_PERIODIC_SMIS 0 |
| 27 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 28 | #define MAINBOARD_POWER_OFF 0 |
| 29 | #define MAINBOARD_POWER_ON 1 |
| 30 | #define MAINBOARD_POWER_KEEP 2 |
| 31 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 32 | /* |
Stefan Reinauer | 8702ab5 | 2010-03-14 17:01:08 +0000 | [diff] [blame] | 33 | * 000 = Non-combined. P0 is primary master. P1 is secondary master. |
| 34 | * 001 = Non-combined. P0 is secondary master. P1 is primary master. |
| 35 | * 100 = Combined. P0 is primary master. P1 is primary slave. IDE is secondary; |
| 36 | * Primary IDE channel disabled. |
| 37 | * 101 = Combined. P0 is primary slave. P1 is primary master. IDE is secondary. |
| 38 | * 110 = Combined. IDE is primary. P0 is secondary master. P1 is secondary |
| 39 | * slave; Secondary IDE channel disabled. |
| 40 | * 111 = Combined. IDE is primary. P0 is secondary slave. P1 is secondary master. |
| 41 | */ |
| 42 | /* PCI Configuration Space (D31:F1) */ |
| 43 | #define IDE_TIM_PRI 0x40 /* IDE timings, primary */ |
| 44 | #define IDE_TIM_SEC 0x42 /* IDE timings, secondary */ |
| 45 | |
| 46 | /* IDE_TIM bits */ |
| 47 | #define IDE_DECODE_ENABLE (1 << 15) |
| 48 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 49 | #define PCI_DMA_CFG 0x90 |
| 50 | #define SERIRQ_CNTL 0x64 |
| 51 | #define GEN_CNTL 0xd0 |
| 52 | #define GEN_STS 0xd4 |
| 53 | #define RTC_CONF 0xd8 |
| 54 | #define GEN_PMCON_3 0xa4 |
| 55 | |
| 56 | #define PCICMD 0x04 |
| 57 | #define PMBASE 0x40 |
| 58 | #define PMBASE_ADDR 0x0400 |
Stefan Reinauer | bc0f7a6 | 2010-08-01 15:41:14 +0000 | [diff] [blame] | 59 | #define DEFAULT_PMBASE PMBASE_ADDR |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 60 | #define ACPI_CNTL 0x44 |
Kyösti Mälkki | e614353 | 2013-02-26 17:24:41 +0200 | [diff] [blame] | 61 | #define ACPI_EN (1 << 4) |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 62 | #define BIOS_CNTL 0x4E |
| 63 | #define GPIO_BASE 0x58 |
| 64 | #define GPIO_CNTL 0x5C |
Joseph Smith | 48f3e2b | 2010-03-17 03:37:18 +0000 | [diff] [blame] | 65 | #define GPIOBASE_ADDR 0x0500 |
| 66 | #define PIRQA_ROUT 0x60 |
| 67 | #define PIRQB_ROUT 0x61 |
| 68 | #define PIRQC_ROUT 0x62 |
| 69 | #define PIRQD_ROUT 0x63 |
| 70 | #define PIRQE_ROUT 0x68 |
| 71 | #define PIRQF_ROUT 0x69 |
| 72 | #define PIRQG_ROUT 0x6A |
| 73 | #define PIRQH_ROUT 0x6B |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 74 | #define COM_DEC 0xE0 |
| 75 | #define LPC_EN 0xE6 |
| 76 | #define FUNC_DIS 0xF2 |
| 77 | |
| 78 | /* 1e f0 244e */ |
| 79 | |
| 80 | #define CMD 0x04 |
| 81 | #define SBUS_NUM 0x19 |
| 82 | #define SUB_BUS_NUM 0x1A |
| 83 | #define SMLT 0x1B |
| 84 | #define IOBASE 0x1C |
| 85 | #define IOLIM 0x1D |
| 86 | #define MEMBASE 0x20 |
| 87 | #define MEMLIM 0x22 |
| 88 | #define CNF 0x50 |
| 89 | #define MTT 0x70 |
| 90 | #define PCI_MAST_STS 0x82 |
| 91 | |
| 92 | #define RTC_FAILED (1 <<2) |
| 93 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 94 | #define PM1_STS 0x00 |
| 95 | #define WAK_STS (1 << 15) |
| 96 | #define PCIEXPWAK_STS (1 << 14) |
| 97 | #define PRBTNOR_STS (1 << 11) |
| 98 | #define RTC_STS (1 << 10) |
| 99 | #define PWRBTN_STS (1 << 8) |
| 100 | #define GBL_STS (1 << 5) |
| 101 | #define BM_STS (1 << 4) |
| 102 | #define TMROF_STS (1 << 0) |
| 103 | #define PM1_EN 0x02 |
| 104 | #define PCIEXPWAK_DIS (1 << 14) |
| 105 | #define RTC_EN (1 << 10) |
| 106 | #define PWRBTN_EN (1 << 8) |
| 107 | #define GBL_EN (1 << 5) |
| 108 | #define TMROF_EN (1 << 0) |
| 109 | #define PM1_CNT 0x04 |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 110 | #define GBL_RLS (1 << 2) |
| 111 | #define BM_RLD (1 << 1) |
| 112 | #define SCI_EN (1 << 0) |
| 113 | #define PM1_TMR 0x08 |
| 114 | #define PROC_CNT 0x10 |
| 115 | #define LV2 0x14 |
| 116 | #define LV3 0x15 |
| 117 | #define LV4 0x16 |
| 118 | #define PM2_CNT 0x20 // mobile only |
| 119 | #define GPE0_STS 0x28 |
| 120 | #define PME_B0_STS (1 << 13) |
| 121 | #define USB3_STS (1 << 12) |
| 122 | #define PME_STS (1 << 11) |
| 123 | #define BATLOW_STS (1 << 10) |
| 124 | #define GST_STS (1 << 9) |
| 125 | #define RI_STS (1 << 8) |
| 126 | #define SMB_WAK_STS (1 << 7) |
| 127 | #define TCOSCI_STS (1 << 6) |
| 128 | #define AC97_STS (1 << 5) |
| 129 | #define USB2_STS (1 << 4) |
| 130 | #define USB1_STS (1 << 3) |
| 131 | #define SWGPE_STS (1 << 2) |
| 132 | #define HOT_PLUG_STS (1 << 1) |
| 133 | #define THRM_STS (1 << 0) |
| 134 | #define GPE0_EN 0x2c |
| 135 | #define PME_B0_EN (1 << 13) |
| 136 | #define PME_EN (1 << 11) |
| 137 | #define SMI_EN 0x30 |
| 138 | #define EL_SMI_EN (1 << 25) // Intel Quick Resume Technology |
| 139 | #define INTEL_USB2_EN (1 << 18) // Intel-Specific USB2 SMI logic |
| 140 | #define LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic |
| 141 | #define PERIODIC_EN (1 << 14) // SMI on PERIODIC_STS in SMI_STS |
| 142 | #define TCO_EN (1 << 13) // Enable TCO Logic (BIOSWE et al) |
| 143 | #define MCSMI_EN (1 << 11) // Trap microcontroller range access |
| 144 | #define BIOS_RLS (1 << 7) // asserts SCI on bit set |
| 145 | #define SWSMI_TMR_EN (1 << 6) // start software smi timer on bit set |
| 146 | #define APMC_EN (1 << 5) // Writes to APM_CNT cause SMI# |
| 147 | #define SLP_SMI_EN (1 << 4) // Write to SLP_EN in PM1_CNT asserts SMI# |
| 148 | #define LEGACY_USB_EN (1 << 3) // Legacy USB circuit SMI logic |
| 149 | #define BIOS_EN (1 << 2) // Assert SMI# on setting GBL_RLS bit |
| 150 | #define EOS (1 << 1) // End of SMI (deassert SMI#) |
| 151 | #define GBL_SMI_EN (1 << 0) // SMI# generation at all? |
| 152 | #define SMI_STS 0x34 |
| 153 | #define ALT_GP_SMI_EN 0x38 |
| 154 | #define ALT_GP_SMI_STS 0x3a |
| 155 | #define GPE_CNTL 0x42 |
| 156 | #define DEVACT_STS 0x44 |
| 157 | #define SS_CNT 0x50 |
| 158 | #define C3_RES 0x54 |
| 159 | |
| 160 | #define TCOBASE 0x60 /* TCO Base Address Register */ |
| 161 | #define TCO1_CNT 0x08 /* TCO1 Control Register */ |
| 162 | |
Joseph Smith | b5466b0 | 2010-03-22 23:10:53 +0000 | [diff] [blame] | 163 | #define GEN_PMCON_1 0xa0 |
| 164 | #define GEN_PMCON_2 0xa2 |
| 165 | #define GEN_PMCON_3 0xa4 |
| 166 | |
Joseph Smith | 48f3e2b | 2010-03-17 03:37:18 +0000 | [diff] [blame] | 167 | /* GEN_PMCON_3 bits */ |
| 168 | #define RTC_BATTERY_DEAD (1 << 2) |
| 169 | #define RTC_POWER_FAILED (1 << 1) |
| 170 | #define SLEEP_AFTER_POWER_FAIL (1 << 0) |
| 171 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 172 | #endif /* I82801DX_H */ |