blob: e63327c01e47bd76035510fd45e68af8b9c5ab14 [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
74#define LPC_EN 0xE6
75#define FUNC_DIS 0xF2
76
77/* 1e f0 244e */
78
79#define CMD 0x04
80#define SBUS_NUM 0x19
81#define SUB_BUS_NUM 0x1A
82#define SMLT 0x1B
83#define IOBASE 0x1C
84#define IOLIM 0x1D
85#define MEMBASE 0x20
86#define MEMLIM 0x22
87#define CNF 0x50
88#define MTT 0x70
89#define PCI_MAST_STS 0x82
90
91#define RTC_FAILED (1 << 2)
92
93#define PM1_STS 0x00
94#define WAK_STS (1 << 15)
95#define PCIEXPWAK_STS (1 << 14)
96#define PRBTNOR_STS (1 << 11)
97#define RTC_STS (1 << 10)
98#define PWRBTN_STS (1 << 8)
99#define GBL_STS (1 << 5)
100#define BM_STS (1 << 4)
101#define TMROF_STS (1 << 0)
102#define PM1_EN 0x02
103#define PCIEXPWAK_DIS (1 << 14)
104#define RTC_EN (1 << 10)
105#define PWRBTN_EN (1 << 8)
106#define GBL_EN (1 << 5)
107#define TMROF_EN (1 << 0)
108#define PM1_CNT 0x04
109#define GBL_RLS (1 << 2)
110#define BM_RLD (1 << 1)
111#define SCI_EN (1 << 0)
112#define PM1_TMR 0x08
113#define PROC_CNT 0x10
114#define LV2 0x14
115#define LV3 0x15
116#define LV4 0x16
117#define PM2_CNT 0x20 // mobile only
118#define GPE0_STS 0x28
119#define PME_B0_STS (1 << 13)
120#define USB3_STS (1 << 12)
121#define PME_STS (1 << 11)
122#define BATLOW_STS (1 << 10)
123#define GST_STS (1 << 9)
124#define RI_STS (1 << 8)
125#define SMB_WAK_STS (1 << 7)
126#define TCOSCI_STS (1 << 6)
127#define AC97_STS (1 << 5)
128#define USB2_STS (1 << 4)
129#define USB1_STS (1 << 3)
130#define SWGPE_STS (1 << 2)
131#define HOT_PLUG_STS (1 << 1)
132#define THRM_STS (1 << 0)
133#define GPE0_EN 0x2c
134#define PME_B0_EN (1 << 13)
135#define PME_EN (1 << 11)
136#define SMI_EN 0x30
137#define EL_SMI_EN (1 << 25) // Intel Quick Resume Technology
138#define INTEL_USB2_EN (1 << 18) // Intel-Specific USB2 SMI logic
139#define LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic
140#define PERIODIC_EN (1 << 14) // SMI on PERIODIC_STS in SMI_STS
141#define TCO_EN (1 << 13) // Enable TCO Logic (BIOSWE et al)
142#define MCSMI_EN (1 << 11) // Trap microcontroller range access
143#define BIOS_RLS (1 << 7) // asserts SCI on bit set
144#define SWSMI_TMR_EN (1 << 6) // start software smi timer on bit set
145#define APMC_EN (1 << 5) // Writes to APM_CNT cause SMI#
146#define SLP_SMI_EN (1 << 4) // Write to SLP_EN in PM1_CNT asserts SMI#
147#define LEGACY_USB_EN (1 << 3) // Legacy USB circuit SMI logic
148#define BIOS_EN (1 << 2) // Assert SMI# on setting GBL_RLS bit
149#define EOS (1 << 1) // End of SMI (deassert SMI#)
150#define GBL_SMI_EN (1 << 0) // SMI# generation at all?
151#define SMI_STS 0x34
152#define ALT_GP_SMI_EN 0x38
153#define ALT_GP_SMI_STS 0x3a
154#define GPE_CNTL 0x42
155#define DEVACT_STS 0x44
156#define SS_CNT 0x50
157#define C3_RES 0x54
158
159#define TCOBASE 0x60 /* TCO Base Address Register */
160#define TCO1_CNT 0x08 /* TCO1 Control Register */
161
162#define GEN_PMCON_1 0xa0
163#define GEN_PMCON_2 0xa2
164#define GEN_PMCON_3 0xa4
165
166/* GEN_PMCON_3 bits */
167#define RTC_BATTERY_DEAD (1 << 2)
168#define RTC_POWER_FAILED (1 << 1)
169#define SLEEP_AFTER_POWER_FAIL (1 << 0)
170
171#endif /* I82801DX_H */