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