blob: c07e5812fd26da9d1fd549874a52fbb7385d3240 [file] [log] [blame]
Kyösti Mälkki7b73e8522022-11-08 04:43:41 +00001/* SPDX-License-Identifier: GPL-2.0-only */
2
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.
6 */
7/* What I did: took the 80801er stuff from fb2, verify it against the
8 * db stuff in fb1, and made sure it was right.
9 */
10
11#ifndef I82801DX_H
12#define I82801DX_H
13
14#include <acpi/acpi.h>
15
16#if !defined(__ASSEMBLER__)
17
18#include <device/device.h>
19
20void i82801dx_enable(struct device *dev);
21void i82801dx_early_init(void);
22
23#endif
24
25#define DEBUG_PERIODIC_SMIS 0
26
27#define MAINBOARD_POWER_OFF 0
28#define MAINBOARD_POWER_ON 1
29#define MAINBOARD_POWER_KEEP 2
30
31/*
32 * 000 = Non-combined. P0 is primary master. P1 is secondary master.
33 * 001 = Non-combined. P0 is secondary master. P1 is primary master.
34 * 100 = Combined. P0 is primary master. P1 is primary slave. IDE is secondary;
35 * Primary IDE channel disabled.
36 * 101 = Combined. P0 is primary slave. P1 is primary master. IDE is secondary.
37 * 110 = Combined. IDE is primary. P0 is secondary master. P1 is secondary
38 * slave; Secondary IDE channel disabled.
39 * 111 = Combined. IDE is primary. P0 is secondary slave. P1 is secondary master.
40 */
41/* PCI Configuration Space (D31:F1) */
42#define IDE_TIM_PRI 0x40 /* IDE timings, primary */
43#define IDE_TIM_SEC 0x42 /* IDE timings, secondary */
44
45/* IDE_TIM bits */
46#define IDE_DECODE_ENABLE (1 << 15)
47
48#define PCI_DMA_CFG 0x90
49#define SERIRQ_CNTL 0x64
50#define GEN_CNTL 0xd0
51#define GEN_STS 0xd4
52#define RTC_CONF 0xd8
53#define GEN_PMCON_3 0xa4
54
55#define PCICMD 0x04
56#define PMBASE 0x40
57#define PMBASE_ADDR 0x0400
58#define DEFAULT_PMBASE PMBASE_ADDR
59#define ACPI_CNTL 0x44
60#define ACPI_EN (1 << 4)
61#define BIOS_CNTL 0x4E
62#define GPIO_BASE 0x58
63#define GPIO_CNTL 0x5C
64#define GPIOBASE_ADDR 0x0500
65#define PIRQA_ROUT 0x60
66#define PIRQB_ROUT 0x61
67#define PIRQC_ROUT 0x62
68#define PIRQD_ROUT 0x63
69#define PIRQE_ROUT 0x68
70#define PIRQF_ROUT 0x69
71#define PIRQG_ROUT 0x6A
72#define PIRQH_ROUT 0x6B
73#define COM_DEC 0xE0
Kyösti Mälkki458751c2019-12-19 06:45:56 +020074#define GEN1_DEC 0xE4
Kyösti Mälkki7b73e8522022-11-08 04:43:41 +000075#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
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
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
163#define GEN_PMCON_1 0xa0
164#define GEN_PMCON_2 0xa2
165#define GEN_PMCON_3 0xa4
166
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
172#endif /* I82801DX_H */