31 #include <linux/types.h>
32 #include <linux/module.h>
33 #include <linux/kernel.h>
34 #include <linux/pci.h>
40 #define DRV_NAME "serverworks"
42 #define SVWKS_CSB5_REVISION_NEW 0x92
43 #define SVWKS_CSB6_REVISION 0xa0
47 static const char *svwks_bad_ata100[] = {
76 pci_read_config_byte(dev, 0x5A, &btr);
81 if (
mode > 2 && check_in_drive_lists(drive, svwks_bad_ata100))
85 case 3: mask = 0x3f;
break;
86 case 2: mask = 0x1f;
break;
87 case 1: mask = 0x07;
break;
88 default: mask = 0x00;
break;
95 static u8 svwks_csb_check (
struct pci_dev *dev)
111 static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 };
112 static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 };
117 pci_write_config_byte(dev, drive_pci[drive->
dn], pio_modes[pio]);
119 if (svwks_csb_check(dev)) {
122 pci_read_config_word(dev, 0x4a, &csb_pio);
124 csb_pio &= ~(0x0f << (4 * drive->
dn));
125 csb_pio |= (pio << (4 * drive->
dn));
127 pci_write_config_word(dev, 0x4a, csb_pio);
133 static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 };
134 static const u8 dma_modes[] = { 0x77, 0x21, 0x20 };
135 static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 };
141 u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0;
143 pci_read_config_byte(dev, (0x56|hwif->
channel), &ultra_timing);
144 pci_read_config_byte(dev, 0x54, &ultra_enable);
146 ultra_timing &= ~(0x0F << (4*
unit));
147 ultra_enable &= ~(0x01 << drive->
dn);
150 dma_timing |= dma_modes[2];
152 ultra_enable |= (0x01 << drive->
dn);
156 pci_write_config_byte(dev, drive_pci2[drive->
dn], dma_timing);
157 pci_write_config_byte(dev, (0x56|hwif->
channel), ultra_timing);
158 pci_write_config_byte(dev, 0x54, ultra_enable);
161 static int init_chipset_svwks(
struct pci_dev *dev)
175 pci_read_config_dword(isa_dev, 0x64, ®);
177 if(!(reg & 0x00004000))
179 "enabled.\n", pci_name(dev));
181 pci_write_config_dword(isa_dev, 0x64, reg);
198 pci_read_config_dword(findev, 0x4C, ®4c);
199 reg4c &= ~0x000007FF;
202 pci_write_config_dword(findev, 0x4C, reg4c);
214 pci_read_config_byte(findev, 0x41, ®41);
216 pci_write_config_byte(findev, 0x41, reg41);
242 pci_read_config_byte(dev, 0x5A, &btr);
248 pci_write_config_byte(dev, 0x5A, btr);
252 pci_read_config_byte(dev, 0x5A, &btr);
255 pci_write_config_byte(dev, 0x5A, btr);
281 return ((1 << (hwif->
channel + 14)) &
299 return ((1 << (hwif->
channel + 14)) &
310 return ata66_svwks_svwks (hwif);
314 return ata66_svwks_dell (hwif);
318 return ata66_svwks_cobalt (hwif);
329 .set_pio_mode = svwks_set_pio_mode,
330 .set_dma_mode = svwks_set_dma_mode,
334 .set_pio_mode = svwks_set_pio_mode,
335 .set_dma_mode = svwks_set_dma_mode,
336 .udma_filter = svwks_udma_filter,
337 .cable_detect = svwks_cable_detect,
343 .init_chipset = init_chipset_svwks,
344 .port_ops = &osb4_port_ops,
351 .init_chipset = init_chipset_svwks,
352 .port_ops = &svwks_port_ops,
359 .init_chipset = init_chipset_svwks,
360 .port_ops = &svwks_port_ops,
367 .init_chipset = init_chipset_svwks,
368 .port_ops = &svwks_port_ops,
376 .init_chipset = init_chipset_svwks,
377 .port_ops = &svwks_port_ops,
397 u8 idx =
id->driver_data;
399 d = serverworks_chipsets[
idx];
403 else if (idx == 2 || idx == 3) {
426 .name =
"Serverworks_IDE",
427 .id_table = svwks_pci_tbl,
428 .probe = svwks_init_one,
434 static int __init svwks_ide_init(
void)
439 static void __exit svwks_ide_exit(
void)
447 MODULE_AUTHOR(
"Michael Aubry. Andrzej Krzysztofowicz, Andre Hedrick, Bartlomiej Zolnierkiewicz");