1 |
1275 |
phoenix |
/*
|
2 |
|
|
* linux/drivers/ide/pci/serverworks.c Version 0.8 25 Ebr 2003
|
3 |
|
|
*
|
4 |
|
|
* Copyright (C) 1998-2000 Michel Aubry
|
5 |
|
|
* Copyright (C) 1998-2000 Andrzej Krzysztofowicz
|
6 |
|
|
* Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
|
7 |
|
|
* Portions copyright (c) 2001 Sun Microsystems
|
8 |
|
|
*
|
9 |
|
|
*
|
10 |
|
|
* RCC/ServerWorks IDE driver for Linux
|
11 |
|
|
*
|
12 |
|
|
* OSB4: `Open South Bridge' IDE Interface (fn 1)
|
13 |
|
|
* supports UDMA mode 2 (33 MB/s)
|
14 |
|
|
*
|
15 |
|
|
* CSB5: `Champion South Bridge' IDE Interface (fn 1)
|
16 |
|
|
* all revisions support UDMA mode 4 (66 MB/s)
|
17 |
|
|
* revision A2.0 and up support UDMA mode 5 (100 MB/s)
|
18 |
|
|
*
|
19 |
|
|
* *** The CSB5 does not provide ANY register ***
|
20 |
|
|
* *** to detect 80-conductor cable presence. ***
|
21 |
|
|
*
|
22 |
|
|
* CSB6: `Champion South Bridge' IDE Interface (optional: third channel)
|
23 |
|
|
*
|
24 |
|
|
* Documentation:
|
25 |
|
|
* Available under NDA only. Errata info very hard to get.
|
26 |
|
|
*
|
27 |
|
|
*/
|
28 |
|
|
|
29 |
|
|
#include <linux/config.h>
|
30 |
|
|
#include <linux/types.h>
|
31 |
|
|
#include <linux/module.h>
|
32 |
|
|
#include <linux/kernel.h>
|
33 |
|
|
#include <linux/ioport.h>
|
34 |
|
|
#include <linux/pci.h>
|
35 |
|
|
#include <linux/hdreg.h>
|
36 |
|
|
#include <linux/ide.h>
|
37 |
|
|
#include <linux/init.h>
|
38 |
|
|
#include <linux/delay.h>
|
39 |
|
|
|
40 |
|
|
#include <asm/io.h>
|
41 |
|
|
|
42 |
|
|
#include "ide_modes.h"
|
43 |
|
|
#include "serverworks.h"
|
44 |
|
|
|
45 |
|
|
static u8 svwks_revision = 0;
|
46 |
|
|
static struct pci_dev *isa_dev;
|
47 |
|
|
|
48 |
|
|
#if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
|
49 |
|
|
#include <linux/stat.h>
|
50 |
|
|
#include <linux/proc_fs.h>
|
51 |
|
|
|
52 |
|
|
static u8 svwks_proc = 0;
|
53 |
|
|
#define SVWKS_MAX_DEVS 2
|
54 |
|
|
static struct pci_dev *svwks_devs[SVWKS_MAX_DEVS];
|
55 |
|
|
static int n_svwks_devs;
|
56 |
|
|
|
57 |
|
|
static int svwks_get_info (char *buffer, char **addr, off_t offset, int count)
|
58 |
|
|
{
|
59 |
|
|
char *p = buffer;
|
60 |
|
|
int i, len;
|
61 |
|
|
|
62 |
|
|
p += sprintf(p, "\n "
|
63 |
|
|
"ServerWorks OSB4/CSB5/CSB6\n");
|
64 |
|
|
|
65 |
|
|
for (i = 0; i < n_svwks_devs; i++) {
|
66 |
|
|
struct pci_dev *dev = svwks_devs[i];
|
67 |
|
|
unsigned long bibma = pci_resource_start(dev, 4);
|
68 |
|
|
u32 reg40, reg44;
|
69 |
|
|
u16 reg48, reg56;
|
70 |
|
|
u8 reg54, c0=0, c1=0;
|
71 |
|
|
|
72 |
|
|
pci_read_config_dword(dev, 0x40, ®40);
|
73 |
|
|
pci_read_config_dword(dev, 0x44, ®44);
|
74 |
|
|
pci_read_config_word(dev, 0x48, ®48);
|
75 |
|
|
pci_read_config_byte(dev, 0x54, ®54);
|
76 |
|
|
pci_read_config_word(dev, 0x56, ®56);
|
77 |
|
|
|
78 |
|
|
/*
|
79 |
|
|
* at that point bibma+0x2 et bibma+0xa are byte registers
|
80 |
|
|
* to investigate:
|
81 |
|
|
*/
|
82 |
|
|
c0 = inb_p(bibma + 0x02);
|
83 |
|
|
c1 = inb_p(bibma + 0x0a);
|
84 |
|
|
|
85 |
|
|
p += sprintf(p, "\n ServerWorks ");
|
86 |
|
|
switch(dev->device) {
|
87 |
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2:
|
88 |
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE:
|
89 |
|
|
p += sprintf(p, "CSB6 ");
|
90 |
|
|
break;
|
91 |
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
|
92 |
|
|
p += sprintf(p, "CSB5 ");
|
93 |
|
|
break;
|
94 |
|
|
case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE:
|
95 |
|
|
p += sprintf(p, "OSB4 ");
|
96 |
|
|
break;
|
97 |
|
|
default:
|
98 |
|
|
p += sprintf(p, "%04x ", dev->device);
|
99 |
|
|
break;
|
100 |
|
|
}
|
101 |
|
|
p += sprintf(p, "Chipset (rev %02x)\n", svwks_revision);
|
102 |
|
|
|
103 |
|
|
p += sprintf(p, "------------------------------- "
|
104 |
|
|
"General Status "
|
105 |
|
|
"---------------------------------\n");
|
106 |
|
|
p += sprintf(p, "--------------- Primary Channel "
|
107 |
|
|
"---------------- Secondary Channel "
|
108 |
|
|
"-------------\n");
|
109 |
|
|
p += sprintf(p, " %sabled"
|
110 |
|
|
" %sabled\n",
|
111 |
|
|
(c0&0x80) ? "dis" : " en",
|
112 |
|
|
(c1&0x80) ? "dis" : " en");
|
113 |
|
|
p += sprintf(p, "--------------- drive0 --------- drive1 "
|
114 |
|
|
"-------- drive0 ---------- drive1 ------\n");
|
115 |
|
|
p += sprintf(p, "DMA enabled: %s %s"
|
116 |
|
|
" %s %s\n",
|
117 |
|
|
(c0&0x20) ? "yes" : "no ",
|
118 |
|
|
(c0&0x40) ? "yes" : "no ",
|
119 |
|
|
(c1&0x20) ? "yes" : "no ",
|
120 |
|
|
(c1&0x40) ? "yes" : "no " );
|
121 |
|
|
p += sprintf(p, "UDMA enabled: %s %s"
|
122 |
|
|
" %s %s\n",
|
123 |
|
|
(reg54 & 0x01) ? "yes" : "no ",
|
124 |
|
|
(reg54 & 0x02) ? "yes" : "no ",
|
125 |
|
|
(reg54 & 0x04) ? "yes" : "no ",
|
126 |
|
|
(reg54 & 0x08) ? "yes" : "no " );
|
127 |
|
|
p += sprintf(p, "UDMA enabled: %s %s"
|
128 |
|
|
" %s %s\n",
|
129 |
|
|
((reg56&0x0005)==0x0005)?"5":
|
130 |
|
|
((reg56&0x0004)==0x0004)?"4":
|
131 |
|
|
((reg56&0x0003)==0x0003)?"3":
|
132 |
|
|
((reg56&0x0002)==0x0002)?"2":
|
133 |
|
|
((reg56&0x0001)==0x0001)?"1":
|
134 |
|
|
((reg56&0x000F))?"?":"0",
|
135 |
|
|
((reg56&0x0050)==0x0050)?"5":
|
136 |
|
|
((reg56&0x0040)==0x0040)?"4":
|
137 |
|
|
((reg56&0x0030)==0x0030)?"3":
|
138 |
|
|
((reg56&0x0020)==0x0020)?"2":
|
139 |
|
|
((reg56&0x0010)==0x0010)?"1":
|
140 |
|
|
((reg56&0x00F0))?"?":"0",
|
141 |
|
|
((reg56&0x0500)==0x0500)?"5":
|
142 |
|
|
((reg56&0x0400)==0x0400)?"4":
|
143 |
|
|
((reg56&0x0300)==0x0300)?"3":
|
144 |
|
|
((reg56&0x0200)==0x0200)?"2":
|
145 |
|
|
((reg56&0x0100)==0x0100)?"1":
|
146 |
|
|
((reg56&0x0F00))?"?":"0",
|
147 |
|
|
((reg56&0x5000)==0x5000)?"5":
|
148 |
|
|
((reg56&0x4000)==0x4000)?"4":
|
149 |
|
|
((reg56&0x3000)==0x3000)?"3":
|
150 |
|
|
((reg56&0x2000)==0x2000)?"2":
|
151 |
|
|
((reg56&0x1000)==0x1000)?"1":
|
152 |
|
|
((reg56&0xF000))?"?":"0");
|
153 |
|
|
p += sprintf(p, "DMA enabled: %s %s"
|
154 |
|
|
" %s %s\n",
|
155 |
|
|
((reg44&0x00002000)==0x00002000)?"2":
|
156 |
|
|
((reg44&0x00002100)==0x00002100)?"1":
|
157 |
|
|
((reg44&0x00007700)==0x00007700)?"0":
|
158 |
|
|
((reg44&0x0000FF00)==0x0000FF00)?"X":"?",
|
159 |
|
|
((reg44&0x00000020)==0x00000020)?"2":
|
160 |
|
|
((reg44&0x00000021)==0x00000021)?"1":
|
161 |
|
|
((reg44&0x00000077)==0x00000077)?"0":
|
162 |
|
|
((reg44&0x000000FF)==0x000000FF)?"X":"?",
|
163 |
|
|
((reg44&0x20000000)==0x20000000)?"2":
|
164 |
|
|
((reg44&0x21000000)==0x21000000)?"1":
|
165 |
|
|
((reg44&0x77000000)==0x77000000)?"0":
|
166 |
|
|
((reg44&0xFF000000)==0xFF000000)?"X":"?",
|
167 |
|
|
((reg44&0x00200000)==0x00200000)?"2":
|
168 |
|
|
((reg44&0x00210000)==0x00210000)?"1":
|
169 |
|
|
((reg44&0x00770000)==0x00770000)?"0":
|
170 |
|
|
((reg44&0x00FF0000)==0x00FF0000)?"X":"?");
|
171 |
|
|
|
172 |
|
|
p += sprintf(p, "PIO enabled: %s %s"
|
173 |
|
|
" %s %s\n",
|
174 |
|
|
((reg40&0x00002000)==0x00002000)?"4":
|
175 |
|
|
((reg40&0x00002200)==0x00002200)?"3":
|
176 |
|
|
((reg40&0x00003400)==0x00003400)?"2":
|
177 |
|
|
((reg40&0x00004700)==0x00004700)?"1":
|
178 |
|
|
((reg40&0x00005D00)==0x00005D00)?"0":"?",
|
179 |
|
|
((reg40&0x00000020)==0x00000020)?"4":
|
180 |
|
|
((reg40&0x00000022)==0x00000022)?"3":
|
181 |
|
|
((reg40&0x00000034)==0x00000034)?"2":
|
182 |
|
|
((reg40&0x00000047)==0x00000047)?"1":
|
183 |
|
|
((reg40&0x0000005D)==0x0000005D)?"0":"?",
|
184 |
|
|
((reg40&0x20000000)==0x20000000)?"4":
|
185 |
|
|
((reg40&0x22000000)==0x22000000)?"3":
|
186 |
|
|
((reg40&0x34000000)==0x34000000)?"2":
|
187 |
|
|
((reg40&0x47000000)==0x47000000)?"1":
|
188 |
|
|
((reg40&0x5D000000)==0x5D000000)?"0":"?",
|
189 |
|
|
((reg40&0x00200000)==0x00200000)?"4":
|
190 |
|
|
((reg40&0x00220000)==0x00220000)?"3":
|
191 |
|
|
((reg40&0x00340000)==0x00340000)?"2":
|
192 |
|
|
((reg40&0x00470000)==0x00470000)?"1":
|
193 |
|
|
((reg40&0x005D0000)==0x005D0000)?"0":"?");
|
194 |
|
|
|
195 |
|
|
}
|
196 |
|
|
p += sprintf(p, "\n");
|
197 |
|
|
|
198 |
|
|
/* p - buffer must be less than 4k! */
|
199 |
|
|
len = (p - buffer) - offset;
|
200 |
|
|
*addr = buffer + offset;
|
201 |
|
|
|
202 |
|
|
return len > count ? count : len;
|
203 |
|
|
}
|
204 |
|
|
#endif /* defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS) */
|
205 |
|
|
|
206 |
|
|
static int check_in_drive_lists (ide_drive_t *drive, const char **list)
|
207 |
|
|
{
|
208 |
|
|
while (*list)
|
209 |
|
|
if (!strcmp(*list++, drive->id->model))
|
210 |
|
|
return 1;
|
211 |
|
|
return 0;
|
212 |
|
|
}
|
213 |
|
|
|
214 |
|
|
static u8 svwks_ratemask (ide_drive_t *drive)
|
215 |
|
|
{
|
216 |
|
|
struct pci_dev *dev = HWIF(drive)->pci_dev;
|
217 |
|
|
u8 mode;
|
218 |
|
|
|
219 |
|
|
if (!svwks_revision)
|
220 |
|
|
pci_read_config_byte(dev, PCI_REVISION_ID, &svwks_revision);
|
221 |
|
|
|
222 |
|
|
if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
|
223 |
|
|
u32 reg = 0;
|
224 |
|
|
if (isa_dev)
|
225 |
|
|
pci_read_config_dword(isa_dev, 0x64, ®);
|
226 |
|
|
|
227 |
|
|
/*
|
228 |
|
|
* Don't enable UDMA on disk devices for the moment
|
229 |
|
|
*/
|
230 |
|
|
if(drive->media == ide_disk)
|
231 |
|
|
return 0;
|
232 |
|
|
/* Check the OSB4 DMA33 enable bit */
|
233 |
|
|
return ((reg & 0x00004000) == 0x00004000) ? 1 : 0;
|
234 |
|
|
} else if (svwks_revision < SVWKS_CSB5_REVISION_NEW) {
|
235 |
|
|
return 1;
|
236 |
|
|
} else if (svwks_revision >= SVWKS_CSB5_REVISION_NEW) {
|
237 |
|
|
u8 btr = 0;
|
238 |
|
|
pci_read_config_byte(dev, 0x5A, &btr);
|
239 |
|
|
mode = btr & 0x3;
|
240 |
|
|
if (!eighty_ninty_three(drive))
|
241 |
|
|
mode = min(mode, (u8)1);
|
242 |
|
|
/* If someone decides to do UDMA133 on CSB5 the same
|
243 |
|
|
issue will bite so be inclusive */
|
244 |
|
|
if (mode > 2 && check_in_drive_lists(drive, svwks_bad_ata100))
|
245 |
|
|
mode = 2;
|
246 |
|
|
}
|
247 |
|
|
if (((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
|
248 |
|
|
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) &&
|
249 |
|
|
(!(PCI_FUNC(dev->devfn) & 1)))
|
250 |
|
|
mode = 2;
|
251 |
|
|
return mode;
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
static u8 svwks_csb_check (struct pci_dev *dev)
|
255 |
|
|
{
|
256 |
|
|
switch (dev->device) {
|
257 |
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
|
258 |
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE:
|
259 |
|
|
case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2:
|
260 |
|
|
return 1;
|
261 |
|
|
default:
|
262 |
|
|
break;
|
263 |
|
|
}
|
264 |
|
|
return 0;
|
265 |
|
|
}
|
266 |
|
|
static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
|
267 |
|
|
{
|
268 |
|
|
u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
|
269 |
|
|
u8 dma_modes[] = { 0x77, 0x21, 0x20 };
|
270 |
|
|
u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
|
271 |
|
|
u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 };
|
272 |
|
|
u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 };
|
273 |
|
|
|
274 |
|
|
ide_hwif_t *hwif = HWIF(drive);
|
275 |
|
|
struct pci_dev *dev = hwif->pci_dev;
|
276 |
|
|
u8 speed;
|
277 |
|
|
u8 pio = ide_get_best_pio_mode(drive, 255, 5, NULL);
|
278 |
|
|
u8 unit = (drive->select.b.unit & 0x01);
|
279 |
|
|
u8 csb5 = svwks_csb_check(dev);
|
280 |
|
|
u8 ultra_enable = 0, ultra_timing = 0;
|
281 |
|
|
u8 dma_timing = 0, pio_timing = 0;
|
282 |
|
|
u16 csb5_pio = 0;
|
283 |
|
|
|
284 |
|
|
if (xferspeed == 255) /* PIO auto-tuning */
|
285 |
|
|
speed = XFER_PIO_0 + pio;
|
286 |
|
|
else
|
287 |
|
|
speed = ide_rate_filter(svwks_ratemask(drive), xferspeed);
|
288 |
|
|
|
289 |
|
|
/* If we are about to put a disk into UDMA mode we screwed up.
|
290 |
|
|
Our code assumes we never _ever_ do this on an OSB4 */
|
291 |
|
|
|
292 |
|
|
if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 &&
|
293 |
|
|
drive->media == ide_disk && speed >= XFER_UDMA_0)
|
294 |
|
|
BUG();
|
295 |
|
|
|
296 |
|
|
pci_read_config_byte(dev, drive_pci[drive->dn], &pio_timing);
|
297 |
|
|
pci_read_config_byte(dev, drive_pci2[drive->dn], &dma_timing);
|
298 |
|
|
pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing);
|
299 |
|
|
pci_read_config_word(dev, 0x4A, &csb5_pio);
|
300 |
|
|
pci_read_config_byte(dev, 0x54, &ultra_enable);
|
301 |
|
|
|
302 |
|
|
/* Per Specified Design by OEM, and ASIC Architect */
|
303 |
|
|
if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
|
304 |
|
|
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
|
305 |
|
|
if (!drive->init_speed) {
|
306 |
|
|
u8 dma_stat = hwif->INB(hwif->dma_status);
|
307 |
|
|
|
308 |
|
|
dma_pio:
|
309 |
|
|
if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) &&
|
310 |
|
|
((dma_stat & (1<<(5+unit))) == (1<<(5+unit)))) {
|
311 |
|
|
drive->current_speed = drive->init_speed = XFER_UDMA_0 + udma_modes[(ultra_timing >> (4*unit)) & ~(0xF0)];
|
312 |
|
|
return 0;
|
313 |
|
|
} else if ((dma_timing) &&
|
314 |
|
|
((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) {
|
315 |
|
|
u8 dmaspeed = dma_timing;
|
316 |
|
|
|
317 |
|
|
dma_timing &= ~0xFF;
|
318 |
|
|
if ((dmaspeed & 0x20) == 0x20)
|
319 |
|
|
dmaspeed = XFER_MW_DMA_2;
|
320 |
|
|
else if ((dmaspeed & 0x21) == 0x21)
|
321 |
|
|
dmaspeed = XFER_MW_DMA_1;
|
322 |
|
|
else if ((dmaspeed & 0x77) == 0x77)
|
323 |
|
|
dmaspeed = XFER_MW_DMA_0;
|
324 |
|
|
else
|
325 |
|
|
goto dma_pio;
|
326 |
|
|
drive->current_speed = drive->init_speed = dmaspeed;
|
327 |
|
|
return 0;
|
328 |
|
|
} else if (pio_timing) {
|
329 |
|
|
u8 piospeed = pio_timing;
|
330 |
|
|
|
331 |
|
|
pio_timing &= ~0xFF;
|
332 |
|
|
if ((piospeed & 0x20) == 0x20)
|
333 |
|
|
piospeed = XFER_PIO_4;
|
334 |
|
|
else if ((piospeed & 0x22) == 0x22)
|
335 |
|
|
piospeed = XFER_PIO_3;
|
336 |
|
|
else if ((piospeed & 0x34) == 0x34)
|
337 |
|
|
piospeed = XFER_PIO_2;
|
338 |
|
|
else if ((piospeed & 0x47) == 0x47)
|
339 |
|
|
piospeed = XFER_PIO_1;
|
340 |
|
|
else if ((piospeed & 0x5d) == 0x5d)
|
341 |
|
|
piospeed = XFER_PIO_0;
|
342 |
|
|
else
|
343 |
|
|
goto oem_setup_failed;
|
344 |
|
|
drive->current_speed = drive->init_speed = piospeed;
|
345 |
|
|
return 0;
|
346 |
|
|
}
|
347 |
|
|
}
|
348 |
|
|
}
|
349 |
|
|
|
350 |
|
|
oem_setup_failed:
|
351 |
|
|
|
352 |
|
|
pio_timing &= ~0xFF;
|
353 |
|
|
dma_timing &= ~0xFF;
|
354 |
|
|
ultra_timing &= ~(0x0F << (4*unit));
|
355 |
|
|
ultra_enable &= ~(0x01 << drive->dn);
|
356 |
|
|
csb5_pio &= ~(0x0F << (4*drive->dn));
|
357 |
|
|
|
358 |
|
|
switch(speed) {
|
359 |
|
|
case XFER_PIO_4:
|
360 |
|
|
case XFER_PIO_3:
|
361 |
|
|
case XFER_PIO_2:
|
362 |
|
|
case XFER_PIO_1:
|
363 |
|
|
case XFER_PIO_0:
|
364 |
|
|
pio_timing |= pio_modes[speed - XFER_PIO_0];
|
365 |
|
|
csb5_pio |= ((speed - XFER_PIO_0) << (4*drive->dn));
|
366 |
|
|
break;
|
367 |
|
|
|
368 |
|
|
case XFER_MW_DMA_2:
|
369 |
|
|
case XFER_MW_DMA_1:
|
370 |
|
|
case XFER_MW_DMA_0:
|
371 |
|
|
pio_timing |= pio_modes[pio];
|
372 |
|
|
csb5_pio |= (pio << (4*drive->dn));
|
373 |
|
|
dma_timing |= dma_modes[speed - XFER_MW_DMA_0];
|
374 |
|
|
break;
|
375 |
|
|
|
376 |
|
|
case XFER_UDMA_5:
|
377 |
|
|
case XFER_UDMA_4:
|
378 |
|
|
case XFER_UDMA_3:
|
379 |
|
|
case XFER_UDMA_2:
|
380 |
|
|
case XFER_UDMA_1:
|
381 |
|
|
case XFER_UDMA_0:
|
382 |
|
|
pio_timing |= pio_modes[pio];
|
383 |
|
|
csb5_pio |= (pio << (4*drive->dn));
|
384 |
|
|
dma_timing |= dma_modes[2];
|
385 |
|
|
ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit));
|
386 |
|
|
ultra_enable |= (0x01 << drive->dn);
|
387 |
|
|
default:
|
388 |
|
|
break;
|
389 |
|
|
}
|
390 |
|
|
|
391 |
|
|
pci_write_config_byte(dev, drive_pci[drive->dn], pio_timing);
|
392 |
|
|
if (csb5)
|
393 |
|
|
pci_write_config_word(dev, 0x4A, csb5_pio);
|
394 |
|
|
|
395 |
|
|
pci_write_config_byte(dev, drive_pci2[drive->dn], dma_timing);
|
396 |
|
|
pci_write_config_byte(dev, (0x56|hwif->channel), ultra_timing);
|
397 |
|
|
pci_write_config_byte(dev, 0x54, ultra_enable);
|
398 |
|
|
|
399 |
|
|
return (ide_config_drive_speed(drive, speed));
|
400 |
|
|
}
|
401 |
|
|
|
402 |
|
|
static void config_chipset_for_pio (ide_drive_t *drive)
|
403 |
|
|
{
|
404 |
|
|
u16 eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
|
405 |
|
|
u16 xfer_pio = drive->id->eide_pio_modes;
|
406 |
|
|
u8 timing, speed, pio;
|
407 |
|
|
|
408 |
|
|
pio = ide_get_best_pio_mode(drive, 255, 5, NULL);
|
409 |
|
|
|
410 |
|
|
if (xfer_pio > 4)
|
411 |
|
|
xfer_pio = 0;
|
412 |
|
|
|
413 |
|
|
if (drive->id->eide_pio_iordy > 0)
|
414 |
|
|
for (xfer_pio = 5;
|
415 |
|
|
xfer_pio>0 &&
|
416 |
|
|
drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio];
|
417 |
|
|
xfer_pio--);
|
418 |
|
|
else
|
419 |
|
|
xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
|
420 |
|
|
(drive->id->eide_pio_modes & 2) ? 0x04 :
|
421 |
|
|
(drive->id->eide_pio_modes & 1) ? 0x03 :
|
422 |
|
|
(drive->id->tPIO & 2) ? 0x02 :
|
423 |
|
|
(drive->id->tPIO & 1) ? 0x01 : xfer_pio;
|
424 |
|
|
|
425 |
|
|
timing = (xfer_pio >= pio) ? xfer_pio : pio;
|
426 |
|
|
|
427 |
|
|
switch(timing) {
|
428 |
|
|
case 4: speed = XFER_PIO_4;break;
|
429 |
|
|
case 3: speed = XFER_PIO_3;break;
|
430 |
|
|
case 2: speed = XFER_PIO_2;break;
|
431 |
|
|
case 1: speed = XFER_PIO_1;break;
|
432 |
|
|
default:
|
433 |
|
|
speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
|
434 |
|
|
break;
|
435 |
|
|
}
|
436 |
|
|
(void) svwks_tune_chipset(drive, speed);
|
437 |
|
|
drive->current_speed = speed;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
static void svwks_tune_drive (ide_drive_t *drive, u8 pio)
|
441 |
|
|
{
|
442 |
|
|
if(pio == 255)
|
443 |
|
|
(void) svwks_tune_chipset(drive, 255);
|
444 |
|
|
else
|
445 |
|
|
(void) svwks_tune_chipset(drive, (XFER_PIO_0 + pio));
|
446 |
|
|
}
|
447 |
|
|
|
448 |
|
|
static int config_chipset_for_dma (ide_drive_t *drive)
|
449 |
|
|
{
|
450 |
|
|
u8 speed = ide_dma_speed(drive, svwks_ratemask(drive));
|
451 |
|
|
|
452 |
|
|
if (!(speed))
|
453 |
|
|
speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL);
|
454 |
|
|
|
455 |
|
|
(void) svwks_tune_chipset(drive, speed);
|
456 |
|
|
return ide_dma_enable(drive);
|
457 |
|
|
}
|
458 |
|
|
|
459 |
|
|
static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
|
460 |
|
|
{
|
461 |
|
|
ide_hwif_t *hwif = HWIF(drive);
|
462 |
|
|
struct hd_driveid *id = drive->id;
|
463 |
|
|
|
464 |
|
|
drive->init_speed = 0;
|
465 |
|
|
|
466 |
|
|
if ((id->capability & 1) && drive->autodma) {
|
467 |
|
|
/* Consult the list of known "bad" drives */
|
468 |
|
|
if (hwif->ide_dma_bad_drive(drive))
|
469 |
|
|
goto fast_ata_pio;
|
470 |
|
|
if (id->field_valid & 4) {
|
471 |
|
|
if (id->dma_ultra & hwif->ultra_mask) {
|
472 |
|
|
/* Force if Capable UltraDMA */
|
473 |
|
|
int dma = config_chipset_for_dma(drive);
|
474 |
|
|
if ((id->field_valid & 2) && !dma)
|
475 |
|
|
goto try_dma_modes;
|
476 |
|
|
}
|
477 |
|
|
} else if (id->field_valid & 2) {
|
478 |
|
|
try_dma_modes:
|
479 |
|
|
if ((id->dma_mword & hwif->mwdma_mask) ||
|
480 |
|
|
(id->dma_1word & hwif->swdma_mask)) {
|
481 |
|
|
/* Force if Capable regular DMA modes */
|
482 |
|
|
if (!config_chipset_for_dma(drive))
|
483 |
|
|
goto no_dma_set;
|
484 |
|
|
}
|
485 |
|
|
} else if (hwif->ide_dma_good_drive(drive) &&
|
486 |
|
|
(id->eide_dma_time < 150)) {
|
487 |
|
|
/* Consult the list of known "good" drives */
|
488 |
|
|
if (!config_chipset_for_dma(drive))
|
489 |
|
|
goto no_dma_set;
|
490 |
|
|
} else {
|
491 |
|
|
goto no_dma_set;
|
492 |
|
|
}
|
493 |
|
|
} else if ((id->capability & 8) || (id->field_valid & 2)) {
|
494 |
|
|
fast_ata_pio:
|
495 |
|
|
no_dma_set:
|
496 |
|
|
config_chipset_for_pio(drive);
|
497 |
|
|
// hwif->tuneproc(drive, 5);
|
498 |
|
|
return hwif->ide_dma_off_quietly(drive);
|
499 |
|
|
}
|
500 |
|
|
return hwif->ide_dma_on(drive);
|
501 |
|
|
}
|
502 |
|
|
|
503 |
|
|
/* This can go soon */
|
504 |
|
|
|
505 |
|
|
static int svwks_ide_dma_end (ide_drive_t *drive)
|
506 |
|
|
{
|
507 |
|
|
return __ide_dma_end(drive);
|
508 |
|
|
}
|
509 |
|
|
|
510 |
|
|
static unsigned int __init init_chipset_svwks (struct pci_dev *dev, const char *name)
|
511 |
|
|
{
|
512 |
|
|
unsigned int reg;
|
513 |
|
|
u8 btr;
|
514 |
|
|
|
515 |
|
|
/* save revision id to determine DMA capability */
|
516 |
|
|
pci_read_config_byte(dev, PCI_REVISION_ID, &svwks_revision);
|
517 |
|
|
|
518 |
|
|
/* force Master Latency Timer value to 64 PCICLKs */
|
519 |
|
|
pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x40);
|
520 |
|
|
|
521 |
|
|
/* OSB4 : South Bridge and IDE */
|
522 |
|
|
if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
|
523 |
|
|
isa_dev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
|
524 |
|
|
PCI_DEVICE_ID_SERVERWORKS_OSB4, NULL);
|
525 |
|
|
if (isa_dev) {
|
526 |
|
|
pci_read_config_dword(isa_dev, 0x64, ®);
|
527 |
|
|
reg &= ~0x00002000; /* disable 600ns interrupt mask */
|
528 |
|
|
if(!(reg & 0x00004000))
|
529 |
|
|
printk(KERN_DEBUG "%s: UDMA not BIOS enabled.\n", name);
|
530 |
|
|
reg |= 0x00004000; /* enable UDMA/33 support */
|
531 |
|
|
pci_write_config_dword(isa_dev, 0x64, reg);
|
532 |
|
|
}
|
533 |
|
|
}
|
534 |
|
|
|
535 |
|
|
/* setup CSB5/CSB6 : South Bridge and IDE option RAID */
|
536 |
|
|
else if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ||
|
537 |
|
|
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
|
538 |
|
|
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
|
539 |
|
|
// u32 pioreg = 0, dmareg = 0;
|
540 |
|
|
|
541 |
|
|
/* Third Channel Test */
|
542 |
|
|
if (!(PCI_FUNC(dev->devfn) & 1)) {
|
543 |
|
|
#if 1
|
544 |
|
|
struct pci_dev * findev = NULL;
|
545 |
|
|
u32 reg4c = 0;
|
546 |
|
|
findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
|
547 |
|
|
PCI_DEVICE_ID_SERVERWORKS_CSB5, NULL);
|
548 |
|
|
if (findev) {
|
549 |
|
|
pci_read_config_dword(findev, 0x4C, ®4c);
|
550 |
|
|
reg4c &= ~0x000007FF;
|
551 |
|
|
reg4c |= 0x00000040;
|
552 |
|
|
reg4c |= 0x00000020;
|
553 |
|
|
pci_write_config_dword(findev, 0x4C, reg4c);
|
554 |
|
|
}
|
555 |
|
|
#endif
|
556 |
|
|
outb_p(0x06, 0x0c00);
|
557 |
|
|
dev->irq = inb_p(0x0c01);
|
558 |
|
|
#if 0
|
559 |
|
|
/* WE need to figure out how to get the correct one */
|
560 |
|
|
printk("%s: interrupt %d\n", name, dev->irq);
|
561 |
|
|
if (dev->irq != 0x0B)
|
562 |
|
|
dev->irq = 0x0B;
|
563 |
|
|
#endif
|
564 |
|
|
#if 0
|
565 |
|
|
printk("%s: device class (0x%04x)\n",
|
566 |
|
|
name, dev->class);
|
567 |
|
|
#else
|
568 |
|
|
if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
|
569 |
|
|
dev->class &= ~0x000F0F00;
|
570 |
|
|
// dev->class |= ~0x00000400;
|
571 |
|
|
dev->class |= ~0x00010100;
|
572 |
|
|
/**/
|
573 |
|
|
}
|
574 |
|
|
#endif
|
575 |
|
|
} else {
|
576 |
|
|
struct pci_dev * findev = NULL;
|
577 |
|
|
u8 reg41 = 0;
|
578 |
|
|
|
579 |
|
|
findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
|
580 |
|
|
PCI_DEVICE_ID_SERVERWORKS_CSB6, NULL);
|
581 |
|
|
if (findev) {
|
582 |
|
|
pci_read_config_byte(findev, 0x41, ®41);
|
583 |
|
|
reg41 &= ~0x40;
|
584 |
|
|
pci_write_config_byte(findev, 0x41, reg41);
|
585 |
|
|
}
|
586 |
|
|
/*
|
587 |
|
|
* This is a device pin issue on CSB6.
|
588 |
|
|
* Since there will be a future raid mode,
|
589 |
|
|
* early versions of the chipset require the
|
590 |
|
|
* interrupt pin to be set, and it is a compatibility
|
591 |
|
|
* mode issue.
|
592 |
|
|
*/
|
593 |
|
|
dev->irq = 0;
|
594 |
|
|
}
|
595 |
|
|
// pci_read_config_dword(dev, 0x40, &pioreg)
|
596 |
|
|
// pci_write_config_dword(dev, 0x40, 0x99999999);
|
597 |
|
|
// pci_read_config_dword(dev, 0x44, &dmareg);
|
598 |
|
|
// pci_write_config_dword(dev, 0x44, 0xFFFFFFFF);
|
599 |
|
|
/* setup the UDMA Control register
|
600 |
|
|
*
|
601 |
|
|
* 1. clear bit 6 to enable DMA
|
602 |
|
|
* 2. enable DMA modes with bits 0-1
|
603 |
|
|
* 00 : legacy
|
604 |
|
|
* 01 : udma2
|
605 |
|
|
* 10 : udma2/udma4
|
606 |
|
|
* 11 : udma2/udma4/udma5
|
607 |
|
|
*/
|
608 |
|
|
pci_read_config_byte(dev, 0x5A, &btr);
|
609 |
|
|
btr &= ~0x40;
|
610 |
|
|
if (!(PCI_FUNC(dev->devfn) & 1))
|
611 |
|
|
btr |= 0x2;
|
612 |
|
|
else
|
613 |
|
|
btr |= (svwks_revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
|
614 |
|
|
pci_write_config_byte(dev, 0x5A, btr);
|
615 |
|
|
}
|
616 |
|
|
|
617 |
|
|
|
618 |
|
|
#if defined(DISPLAY_SVWKS_TIMINGS) && defined(CONFIG_PROC_FS)
|
619 |
|
|
svwks_devs[n_svwks_devs++] = dev;
|
620 |
|
|
|
621 |
|
|
if (!svwks_proc) {
|
622 |
|
|
svwks_proc = 1;
|
623 |
|
|
ide_pci_register_host_proc(&svwks_procs[0]);
|
624 |
|
|
}
|
625 |
|
|
#endif /* DISPLAY_SVWKS_TIMINGS && CONFIG_PROC_FS */
|
626 |
|
|
|
627 |
|
|
return (dev->irq) ? dev->irq : 0;
|
628 |
|
|
}
|
629 |
|
|
|
630 |
|
|
static unsigned int __init ata66_svwks_svwks (ide_hwif_t *hwif)
|
631 |
|
|
{
|
632 |
|
|
return 1;
|
633 |
|
|
}
|
634 |
|
|
|
635 |
|
|
/* On Dell PowerEdge servers with a CSB5/CSB6, the top two bits
|
636 |
|
|
* of the subsystem device ID indicate presence of an 80-pin cable.
|
637 |
|
|
* Bit 15 clear = secondary IDE channel does not have 80-pin cable.
|
638 |
|
|
* Bit 15 set = secondary IDE channel has 80-pin cable.
|
639 |
|
|
* Bit 14 clear = primary IDE channel does not have 80-pin cable.
|
640 |
|
|
* Bit 14 set = primary IDE channel has 80-pin cable.
|
641 |
|
|
*/
|
642 |
|
|
static unsigned int __init ata66_svwks_dell (ide_hwif_t *hwif)
|
643 |
|
|
{
|
644 |
|
|
struct pci_dev *dev = hwif->pci_dev;
|
645 |
|
|
if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
|
646 |
|
|
dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
|
647 |
|
|
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE ||
|
648 |
|
|
dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE))
|
649 |
|
|
return ((1 << (hwif->channel + 14)) &
|
650 |
|
|
dev->subsystem_device) ? 1 : 0;
|
651 |
|
|
return 0;
|
652 |
|
|
}
|
653 |
|
|
|
654 |
|
|
/* Sun Cobalt Alpine hardware avoids the 80-pin cable
|
655 |
|
|
* detect issue by attaching the drives directly to the board.
|
656 |
|
|
* This check follows the Dell precedent (how scary is that?!)
|
657 |
|
|
*
|
658 |
|
|
* WARNING: this only works on Alpine hardware!
|
659 |
|
|
*/
|
660 |
|
|
static unsigned int __init ata66_svwks_cobalt (ide_hwif_t *hwif)
|
661 |
|
|
{
|
662 |
|
|
struct pci_dev *dev = hwif->pci_dev;
|
663 |
|
|
if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN &&
|
664 |
|
|
dev->vendor == PCI_VENDOR_ID_SERVERWORKS &&
|
665 |
|
|
dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE)
|
666 |
|
|
return ((1 << (hwif->channel + 14)) &
|
667 |
|
|
dev->subsystem_device) ? 1 : 0;
|
668 |
|
|
return 0;
|
669 |
|
|
}
|
670 |
|
|
|
671 |
|
|
static unsigned int __init ata66_svwks (ide_hwif_t *hwif)
|
672 |
|
|
{
|
673 |
|
|
struct pci_dev *dev = hwif->pci_dev;
|
674 |
|
|
|
675 |
|
|
/* Per Specified Design by OEM, and ASIC Architect */
|
676 |
|
|
if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
|
677 |
|
|
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2))
|
678 |
|
|
return 1;
|
679 |
|
|
|
680 |
|
|
/* Server Works */
|
681 |
|
|
if (dev->subsystem_vendor == PCI_VENDOR_ID_SERVERWORKS)
|
682 |
|
|
return ata66_svwks_svwks (hwif);
|
683 |
|
|
|
684 |
|
|
/* Dell PowerEdge */
|
685 |
|
|
if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL)
|
686 |
|
|
return ata66_svwks_dell (hwif);
|
687 |
|
|
|
688 |
|
|
/* Cobalt Alpine */
|
689 |
|
|
if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN)
|
690 |
|
|
return ata66_svwks_cobalt (hwif);
|
691 |
|
|
|
692 |
|
|
return 0;
|
693 |
|
|
}
|
694 |
|
|
|
695 |
|
|
#undef CAN_SW_DMA
|
696 |
|
|
static void __init init_hwif_svwks (ide_hwif_t *hwif)
|
697 |
|
|
{
|
698 |
|
|
u8 dma_stat = 0;
|
699 |
|
|
|
700 |
|
|
if (!hwif->irq)
|
701 |
|
|
hwif->irq = hwif->channel ? 15 : 14;
|
702 |
|
|
|
703 |
|
|
hwif->tuneproc = &svwks_tune_drive;
|
704 |
|
|
hwif->speedproc = &svwks_tune_chipset;
|
705 |
|
|
|
706 |
|
|
hwif->atapi_dma = 1;
|
707 |
|
|
|
708 |
|
|
if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
|
709 |
|
|
hwif->ultra_mask = 0x3f;
|
710 |
|
|
|
711 |
|
|
hwif->mwdma_mask = 0x07;
|
712 |
|
|
#ifdef CAN_SW_DMA
|
713 |
|
|
hwif->swdma_mask = 0x07;
|
714 |
|
|
#endif /* CAN_SW_DMA */
|
715 |
|
|
|
716 |
|
|
hwif->autodma = 0;
|
717 |
|
|
|
718 |
|
|
if (!hwif->dma_base) {
|
719 |
|
|
hwif->drives[0].autotune = 1;
|
720 |
|
|
hwif->drives[1].autotune = 1;
|
721 |
|
|
return;
|
722 |
|
|
}
|
723 |
|
|
|
724 |
|
|
hwif->ide_dma_check = &svwks_config_drive_xfer_rate;
|
725 |
|
|
if (hwif->pci_dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
|
726 |
|
|
hwif->ide_dma_end = &svwks_ide_dma_end;
|
727 |
|
|
else if (!(hwif->udma_four))
|
728 |
|
|
hwif->udma_four = ata66_svwks(hwif);
|
729 |
|
|
if (!noautodma)
|
730 |
|
|
hwif->autodma = 1;
|
731 |
|
|
|
732 |
|
|
dma_stat = hwif->INB(hwif->dma_status);
|
733 |
|
|
hwif->drives[0].autodma = (dma_stat & 0x20);
|
734 |
|
|
hwif->drives[1].autodma = (dma_stat & 0x40);
|
735 |
|
|
hwif->drives[0].autotune = (!(dma_stat & 0x20));
|
736 |
|
|
hwif->drives[1].autotune = (!(dma_stat & 0x40));
|
737 |
|
|
// hwif->drives[0].autodma = hwif->autodma;
|
738 |
|
|
// hwif->drives[1].autodma = hwif->autodma;
|
739 |
|
|
}
|
740 |
|
|
|
741 |
|
|
/*
|
742 |
|
|
* We allow the BM-DMA driver to only work on enabled interfaces.
|
743 |
|
|
*/
|
744 |
|
|
static void __init init_dma_svwks (ide_hwif_t *hwif, unsigned long dmabase)
|
745 |
|
|
{
|
746 |
|
|
struct pci_dev *dev = hwif->pci_dev;
|
747 |
|
|
|
748 |
|
|
if (((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
|
749 |
|
|
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) &&
|
750 |
|
|
(!(PCI_FUNC(dev->devfn) & 1)) && (hwif->channel))
|
751 |
|
|
return;
|
752 |
|
|
|
753 |
|
|
ide_setup_dma(hwif, dmabase, 8);
|
754 |
|
|
}
|
755 |
|
|
|
756 |
|
|
extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
|
757 |
|
|
|
758 |
|
|
static void __init init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
|
759 |
|
|
{
|
760 |
|
|
ide_setup_pci_device(dev, d);
|
761 |
|
|
}
|
762 |
|
|
|
763 |
|
|
static void __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
|
764 |
|
|
{
|
765 |
|
|
if (!(PCI_FUNC(dev->devfn) & 1)) {
|
766 |
|
|
d->bootable = NEVER_BOARD;
|
767 |
|
|
if (dev->resource[0].start == 0x01f1)
|
768 |
|
|
d->bootable = ON_BOARD;
|
769 |
|
|
} else {
|
770 |
|
|
if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
|
771 |
|
|
return;
|
772 |
|
|
}
|
773 |
|
|
#if 0
|
774 |
|
|
if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) &&
|
775 |
|
|
(!(PCI_FUNC(dev->devfn) & 1)))
|
776 |
|
|
d->autodma = AUTODMA;
|
777 |
|
|
#endif
|
778 |
|
|
|
779 |
|
|
d->channels = (((d->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
|
780 |
|
|
(d->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) &&
|
781 |
|
|
(!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2;
|
782 |
|
|
|
783 |
|
|
ide_setup_pci_device(dev, d);
|
784 |
|
|
}
|
785 |
|
|
|
786 |
|
|
|
787 |
|
|
/**
|
788 |
|
|
* svwks_init_one - called when a OSB/CSB is found
|
789 |
|
|
* @dev: the svwks device
|
790 |
|
|
* @id: the matching pci id
|
791 |
|
|
*
|
792 |
|
|
* Called when the PCI registration layer (or the IDE initialization)
|
793 |
|
|
* finds a device matching our IDE device tables.
|
794 |
|
|
*/
|
795 |
|
|
|
796 |
|
|
static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id)
|
797 |
|
|
{
|
798 |
|
|
ide_pci_device_t *d = &serverworks_chipsets[id->driver_data];
|
799 |
|
|
|
800 |
|
|
if (dev->device != d->device)
|
801 |
|
|
BUG();
|
802 |
|
|
d->init_setup(dev, d);
|
803 |
|
|
MOD_INC_USE_COUNT;
|
804 |
|
|
return 0;
|
805 |
|
|
}
|
806 |
|
|
|
807 |
|
|
static struct pci_device_id svwks_pci_tbl[] __devinitdata = {
|
808 |
|
|
{ PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
|
809 |
|
|
{ PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
|
810 |
|
|
{ PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
|
811 |
|
|
{ PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
|
812 |
|
|
{ 0, },
|
813 |
|
|
};
|
814 |
|
|
|
815 |
|
|
static struct pci_driver driver = {
|
816 |
|
|
.name = "Serverworks IDE",
|
817 |
|
|
.id_table = svwks_pci_tbl,
|
818 |
|
|
.probe = svwks_init_one,
|
819 |
|
|
#if 0 /* FIXME: implement */
|
820 |
|
|
.suspend = ,
|
821 |
|
|
.resume = ,
|
822 |
|
|
#endif
|
823 |
|
|
};
|
824 |
|
|
|
825 |
|
|
static int svwks_ide_init(void)
|
826 |
|
|
{
|
827 |
|
|
return ide_pci_register_driver(&driver);
|
828 |
|
|
}
|
829 |
|
|
|
830 |
|
|
static void svwks_ide_exit(void)
|
831 |
|
|
{
|
832 |
|
|
ide_pci_unregister_driver(&driver);
|
833 |
|
|
}
|
834 |
|
|
|
835 |
|
|
module_init(svwks_ide_init);
|
836 |
|
|
module_exit(svwks_ide_exit);
|
837 |
|
|
|
838 |
|
|
MODULE_AUTHOR("Michael Aubry. Andrzej Krzysztofowicz, Andre Hedrick");
|
839 |
|
|
MODULE_DESCRIPTION("PCI driver module for Serverworks OSB4/CSB5/CSB6 IDE");
|
840 |
|
|
MODULE_LICENSE("GPL");
|
841 |
|
|
|
842 |
|
|
EXPORT_NO_SYMBOLS;
|