Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / i386 / isa / ic / i82365.h
1 #ifndef __83265_H__
2 #define __83265_H__
3
4 /***********************************************************************
5  * 82365.h -- information necessary for direct manipulation of PCMCIA
6  * cards and controllers
7  *
8  * Support is included for Intel 82365SL PCIC controllers and clones
9  * thereof.
10  *
11  * originally by Barry Jaspan; hacked over by Keith Moore
12  *
13  * $FreeBSD: src/sys/i386/isa/ic/i82365.h,v 1.2.16.1 2000/08/03 18:55:42 peter Exp $
14  ***********************************************************************/
15
16 /*
17  * PCIC Registers
18  *     Each register is given a name, and most of the bits are named too.
19  *     I should really name them all.
20  *
21  *     Finally, since the banks can be addressed with a regular syntax,
22  *     some macros are provided for that purpose.
23  */
24
25 #define PCIC_BASE 0x03e0        /* base adddress of pcic register set */
26
27 /* First, all the registers */
28 #define PCIC_ID_REV     0x00    /* Identification and Revision */
29 #define PCIC_STATUS     0x01    /* Interface Status */
30 #define PCIC_POWER      0x02    /* Power and RESETDRV control */
31 #define PCIC_INT_GEN    0x03    /* Interrupt and General Control */
32 #define PCIC_STAT_CHG   0x04    /* Card Status Change */
33 #define PCIC_STAT_INT   0x05    /* Card Status Change Interrupt Config */
34 #define PCIC_ADDRWINE   0x06    /* Address Window Enable */
35 #define PCIC_IOCTL      0x07    /* I/O Control */
36 #define PCIC_IO0_STL    0x08    /* I/O Address 0 Start Low Byte */
37 #define PCIC_IO0_STH    0x09    /* I/O Address 0 Start High Byte */
38 #define PCIC_IO0_SPL    0x0a    /* I/O Address 0 Stop Low Byte */
39 #define PCIC_IO0_SPH    0x0b    /* I/O Address 0 Stop High Byte */
40 #define PCIC_IO1_STL    0x0c    /* I/O Address 1 Start Low Byte */
41 #define PCIC_IO1_STH    0x0d    /* I/O Address 1 Start High Byte */
42 #define PCIC_IO1_SPL    0x0e    /* I/O Address 1 Stop Low Byte */
43 #define PCIC_IO1_SPH    0x0f    /* I/O Address 1 Stop High Byte */
44 #define PCIC_SM0_STL    0x10    /* System Memory Address 0 Mapping Start Low Byte */
45 #define PCIC_SM0_STH    0x11    /* System Memory Address 0 Mapping Start High Byte */
46 #define PCIC_SM0_SPL    0x12    /* System Memory Address 0 Mapping Stop Low Byte */
47 #define PCIC_SM0_SPH    0x13    /* System Memory Address 0 Mapping Stop High Byte */
48 #define PCIC_CM0_L      0x14    /* Card Memory Offset Address 0 Low Byte */
49 #define PCIC_CM0_H      0x15    /* Card Memory Offset Address 0 High Byte */
50 #define PCIC_CDGC       0x16    /* Card Detect and General Control */
51 #define PCIC_RES17      0x17    /* Reserved */
52 #define PCIC_SM1_STL    0x18    /* System Memory Address 1 Mapping Start Low Byte */
53 #define PCIC_SM1_STH    0x19    /* System Memory Address 1 Mapping Start High Byte */
54 #define PCIC_SM1_SPL    0x1a    /* System Memory Address 1 Mapping Stop Low Byte */
55 #define PCIC_SM1_SPH    0x1b    /* System Memory Address 1 Mapping Stop High Byte */
56 #define PCIC_CM1_L      0x1c    /* Card Memory Offset Address 1 Low Byte */
57 #define PCIC_CM1_H      0x1d    /* Card Memory Offset Address 1 High Byte */
58 #define PCIC_GLO_CTRL   0x1e    /* Global Control Register */
59 #define PCIC_RES1F      0x1f    /* Reserved */
60 #define PCIC_SM2_STL    0x20    /* System Memory Address 2 Mapping Start Low Byte */
61 #define PCIC_SM2_STH    0x21    /* System Memory Address 2 Mapping Start High Byte */
62 #define PCIC_SM2_SPL    0x22    /* System Memory Address 2 Mapping Stop Low Byte */
63 #define PCIC_SM2_SPH    0x23    /* System Memory Address 2 Mapping Stop High Byte */
64 #define PCIC_CM2_L      0x24    /* Card Memory Offset Address 2 Low Byte */
65 #define PCIC_CM2_H      0x25    /* Card Memory Offset Address 2 High Byte */
66 #define PCIC_RES26      0x26    /* Reserved */
67 #define PCIC_RES27      0x27    /* Reserved */
68 #define PCIC_SM3_STL    0x28    /* System Memory Address 3 Mapping Start Low Byte */
69 #define PCIC_SM3_STH    0x29    /* System Memory Address 3 Mapping Start High Byte */
70 #define PCIC_SM3_SPL    0x2a    /* System Memory Address 3 Mapping Stop Low Byte */
71 #define PCIC_SM3_SPH    0x2b    /* System Memory Address 3 Mapping Stop High Byte */
72 #define PCIC_CM3_L      0x2c    /* Card Memory Offset Address 3 Low Byte */
73 #define PCIC_CM3_H      0x2d    /* Card Memory Offset Address 3 High Byte */
74 #define PCIC_RES2E      0x2e    /* Reserved */
75 #define PCIC_RES2F      0x2f    /* Reserved */
76 #define PCIC_SM4_STL    0x30    /* System Memory Address 4 Mapping Start Low Byte */
77 #define PCIC_SM4_STH    0x31    /* System Memory Address 4 Mapping Start High Byte */
78 #define PCIC_SM4_SPL    0x32    /* System Memory Address 4 Mapping Stop Low Byte */
79 #define PCIC_SM4_SPH    0x33    /* System Memory Address 4 Mapping Stop High Byte */
80 #define PCIC_CM4_L      0x34    /* Card Memory Offset Address 4 Low Byte */
81 #define PCIC_CM4_H      0x35    /* Card Memory Offset Address 4 High Byte */
82 #define PCIC_RES36      0x36    /* Reserved */
83 #define PCIC_RES37      0x37    /* Reserved */
84 #define PCIC_RES38      0x38    /* Reserved */
85 #define PCIC_RES39      0x39    /* Reserved */
86 #define PCIC_RES3A      0x3a    /* Reserved */
87 #define PCIC_RES3B      0x3b    /* Reserved */
88 #define PCIC_RES3C      0x3c    /* Reserved */
89 #define PCIC_RES3D      0x3d    /* Reserved */
90 #define PCIC_RES3E      0x3e    /* Reserved */
91 #define PCIC_RES3F      0x3f    /* Reserved */
92
93 /* Now register bits, ordered by reg # */
94
95 /* For Identification and Revision (PCIC_ID_REV) */
96 #define PCIC_INTEL0     0x82    /* Intel 82365SL Rev. 0; Both Memory and I/O */
97 #define PCIC_INTEL1     0x83    /* Intel 82365SL Rev. 1; Both Memory and I/O */
98 #define PCIC_IBM1       0x88    /* IBM PCIC clone; Both Memory and I/O */
99 #define PCIC_IBM2       0x89    /* IBM PCIC clone; Both Memory and I/O */
100
101 /* For Interface Status register (PCIC_STATUS) */
102 #define PCIC_VPPV       0x80    /* Vpp_valid */
103 #define PCIC_POW        0x40    /* PC Card power active */
104 #define PCIC_READY      0x20    /* Ready/~Busy */
105 #define PCIC_MWP        0x10    /* Memory Write Protect */
106 #define PCIC_CD         0x0C    /* Both card detect bits */
107 #define PCIC_BVD        0x03    /* Both Battery Voltage Detect bits */
108
109 /* For the Power and RESETDRV register (PCIC_POWER) */
110 #define PCIC_OUTENA     0x80    /* Output Enable */
111 #define PCIC_DISRST     0x40    /* Disable RESETDRV */
112 #define PCIC_APSENA     0x20    /* Auto Pwer Switch Enable */
113 #define PCIC_PCPWRE     0x10    /* PC Card Power Enable */
114
115 /* For the Interrupt and General Control register (PCIC_INT_GEN) */
116 #define PCIC_CARDTYPE   0x20    /* Card Type 0 = memory, 1 = I/O */
117 #define         PCIC_IOCARD     0x20
118 #define         PCIC_MEMCARD    0x00
119 #define PCIC_CARDRESET  0x40    /* Card reset 0 = Reset, 1 = Normal */
120
121 /* For the Card Status Change register (PCIC_STAT_CHG) */
122 #define PCIC_CDTCH      0x08    /* Card Detect Change */
123 #define PCIC_RDYCH      0x04    /* Ready Change */
124 #define PCIC_BATWRN     0x02    /* Battery Warning */
125 #define PCIC_BATDED     0x01    /* Battery Dead */
126
127 /* For the Address Window Enable Register (PCIC_ADDRWINE) */
128 #define PCIC_SM0_EN     0x01    /* Memory Window 0 Enable */
129 #define PCIC_SM1_EN     0x02    /* Memory Window 1 Enable */
130 #define PCIC_SM2_EN     0x04    /* Memory Window 2 Enable */
131 #define PCIC_SM3_EN     0x08    /* Memory Window 3 Enable */
132 #define PCIC_SM4_EN     0x10    /* Memory Window 4 Enable */
133 #define PCIC_MEMCS16    0x20    /* ~MEMCS16 Decode A23-A12 */
134 #define PCIC_IO0_EN     0x40    /* I/O Window 0 Enable */
135 #define PCIC_IO1_EN     0x80    /* I/O Window 1 Enable */
136
137 /* For the I/O Control Register (PCIC_IOCTL) */
138 #define PCIC_IO0_16BIT  0x01    /* I/O to this segment is 16 bit */
139 #define PCIC_IO0_CS16   0x02    /* I/O cs16 source is the card */
140 #define PCIC_IO0_0WS    0x04    /* zero wait states added on 8 bit cycles */
141 #define PCIC_IO0_WS     0x08    /* Wait states added for 16 bit cycles */
142 #define PCIC_IO1_16BIT  0x10    /* I/O to this segment is 16 bit */
143 #define PCIC_IO1_CS16   0x20    /* I/O cs16 source is the card */
144 #define PCIC_IO1_0WS    0x04    /* zero wait states added on 8 bit cycles */
145 #define PCIC_IO1_WS     0x80    /* Wait states added for 16 bit cycles */
146
147 /* For the various I/O and Memory windows */
148 #define PCIC_ADDR_LOW   0
149 #define PCIC_ADDR_HIGH  1
150 #define PCIC_START      0x00    /* Start of mapping region */
151 #define PCIC_END        0x02    /* End of mapping region */
152 #define PCIC_MOFF       0x04    /* Card Memory Mapping region offset */
153 #define PCIC_IO0        0x08    /* I/O Address 0 */
154 #define PCIC_IO1        0x0c    /* I/O Address 1 */
155 #define PCIC_SM0        0x10    /* System Memory Address 0 Mapping */
156 #define PCIC_SM1        0x18    /* System Memory Address 1 Mapping */
157 #define PCIC_SM2        0x20    /* System Memory Address 2 Mapping */
158 #define PCIC_SM3        0x28    /* System Memory Address 3 Mapping */
159 #define PCIC_SM4        0x30    /* System Memory Address 4 Mapping */
160
161 /* For System Memory Window start registers
162    (PCIC_SMx|PCIC_START|PCIC_ADDR_HIGH) */
163 #define PCIC_ZEROWS     0x40    /* Zero wait states */
164 #define PCIC_DATA16     0x80    /* Data width is 16 bits */
165
166 /* For System Memory Window stop registers
167    (PCIC_SMx|PCIC_END|PCIC_ADDR_HIGH) */
168 #define PCIC_MW0        0x40    /* Wait state bit 0 */
169 #define PCIC_MW1        0x80    /* Wait state bit 1 */
170
171 /* For System Memory Window offset registers
172    (PCIC_SMx|PCIC_MOFF|PCIC_ADDR_HIGH) */
173 #define PCIC_REG        0x40    /* Attribute/Common select (why called Reg?) */
174 #define PCIC_WP         0x80    /* Write-protect this window */
175
176 /* For Card Detect and General Control register (PCIC_CDGC) */
177 #define PCIC_16_DL_INH  0x01    /* 16-bit memory delay inhibit */
178 #define PCIC_CNFG_RST_EN 0x02   /* configuration reset enable */
179 #define PCIC_GPI_EN     0x04    /* GPI Enable */
180 #define PCIC_GPI_TRANS  0x08    /* GPI Transition Control */
181 #define PCIC_CDRES_EN   0x10    /* card detect resume enable */
182 #define PCIC_SW_CD_INT  0x20    /* s/w card detect interrupt */
183
184 /* For Global Control register (PCIC_GLO_CTRL) */
185 #define PCIC_PWR_DOWN   0x01    /* power down */
186 #define PCIC_LVL_MODE   0x02    /* level mode interrupt enable */
187 #define PCIC_WB_CSCINT  0x04    /* explicit write-back csc intr */
188 #define PCIC_IRQ14_PULSE 0x08   /* irq 14 pulse mode enable */
189
190 /* DON'T ADD ANYTHING AFTER THIS #endif */
191 #endif /* __83265_H__ */