Blame view
drivers/ide/ide-pci-generic.c
6.05 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
1da177e4c Linux-2.6.12-rc2 |
2 |
* Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
ccd32e221 ide: Switch to a ... |
3 |
* Portions (C) Copyright 2002 Red Hat Inc |
1da177e4c Linux-2.6.12-rc2 |
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
* * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * For the avoidance of doubt the "preferred form" of this code is one which * is in an open non patent encumbered format. Where cryptographic key signing * forms part of the process of creating an executable the information * including keys needed to generate an equivalently functional executable * are deemed to be part of the source code. */ |
1da177e4c Linux-2.6.12-rc2 |
21 22 23 |
#include <linux/types.h> #include <linux/module.h> #include <linux/kernel.h> |
1da177e4c Linux-2.6.12-rc2 |
24 25 26 |
#include <linux/pci.h> #include <linux/ide.h> #include <linux/init.h> |
ced3ec8aa ide: prefix messa... |
27 |
#define DRV_NAME "ide_pci_generic" |
90ab5ee94 module_param: mak... |
28 |
static bool ide_generic_all; /* Set to claim all devices */ |
b189346cd [PATCH] ide: ide-... |
29 |
|
a4bea10ec [PATCH] Allow ide... |
30 31 |
module_param_named(all_generic_ide, ide_generic_all, bool, 0444); MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); |
b189346cd [PATCH] ide: ide-... |
32 |
|
c339dfdd6 ide_pci_generic: ... |
33 34 35 36 37 38 39 40 41 |
static void netcell_quirkproc(ide_drive_t *drive) { /* mark words 85-87 as valid */ drive->id[ATA_ID_CSF_DEFAULT] |= 0x4000; } static const struct ide_port_ops netcell_port_ops = { .quirkproc = netcell_quirkproc, }; |
ced3ec8aa ide: prefix messa... |
42 |
#define DECLARE_GENERIC_PCI_DEV(extra_flags) \ |
1c3dd326a ide: add DECLARE_... |
43 |
{ \ |
ced3ec8aa ide: prefix messa... |
44 |
.name = DRV_NAME, \ |
7cab14a79 ide: add IDE_HFLA... |
45 |
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \ |
5e71d9c5a ide: IDE_HFLAG_BO... |
46 |
extra_flags, \ |
5f8b6c348 ide: add ->mwdma_... |
47 48 49 |
.swdma_mask = ATA_SWDMA2, \ .mwdma_mask = ATA_MWDMA2, \ .udma_mask = ATA_UDMA6, \ |
1da177e4c Linux-2.6.12-rc2 |
50 |
} |
1da177e4c Linux-2.6.12-rc2 |
51 |
|
e6b53703b sections: fix sec... |
52 |
static const struct ide_port_info generic_chipsets[] __devinitconst = { |
ced3ec8aa ide: prefix messa... |
53 54 |
/* 0: Unknown */ DECLARE_GENERIC_PCI_DEV(0), |
1c3dd326a ide: add DECLARE_... |
55 |
|
ced3ec8aa ide: prefix messa... |
56 57 |
{ /* 1: NS87410 */ .name = DRV_NAME, |
17deabdcd IDE: Coding Style... |
58 |
.enablebits = { {0x43, 0x08, 0x08}, {0x47, 0x08, 0x08} }, |
5e71d9c5a ide: IDE_HFLAG_BO... |
59 |
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, |
5f8b6c348 ide: add ->mwdma_... |
60 61 62 |
.swdma_mask = ATA_SWDMA2, .mwdma_mask = ATA_MWDMA2, .udma_mask = ATA_UDMA6, |
1c3dd326a ide: add DECLARE_... |
63 |
}, |
ced3ec8aa ide: prefix messa... |
64 65 66 |
/* 2: SAMURAI / HT6565 / HINT_IDE */ DECLARE_GENERIC_PCI_DEV(0), /* 3: UM8673F / UM8886A / UM8886BF */ |
2467922a5 ide: remove no lo... |
67 |
DECLARE_GENERIC_PCI_DEV(IDE_HFLAG_NO_DMA), |
ced3ec8aa ide: prefix messa... |
68 69 70 71 72 |
/* 4: VIA_IDE / OPTI621V / Piccolo010{2,3,5} */ DECLARE_GENERIC_PCI_DEV(IDE_HFLAG_NO_AUTODMA), { /* 5: VIA8237SATA */ .name = DRV_NAME, |
7cab14a79 ide: add IDE_HFLA... |
73 74 |
.host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | IDE_HFLAG_OFF_BOARD, |
5f8b6c348 ide: add ->mwdma_... |
75 76 77 |
.swdma_mask = ATA_SWDMA2, .mwdma_mask = ATA_MWDMA2, .udma_mask = ATA_UDMA6, |
1c3dd326a ide: add DECLARE_... |
78 |
}, |
ced3ec8aa ide: prefix messa... |
79 80 |
{ /* 6: Revolution */ .name = DRV_NAME, |
c339dfdd6 ide_pci_generic: ... |
81 |
.port_ops = &netcell_port_ops, |
8ac2b42a4 ide: add IDE_HFLA... |
82 83 |
.host_flags = IDE_HFLAG_CLEAR_SIMPLEX | IDE_HFLAG_TRUST_BIOS_FOR_DMA | |
7cab14a79 ide: add IDE_HFLA... |
84 |
IDE_HFLAG_OFF_BOARD, |
5f8b6c348 ide: add ->mwdma_... |
85 86 87 |
.swdma_mask = ATA_SWDMA2, .mwdma_mask = ATA_MWDMA2, .udma_mask = ATA_UDMA6, |
1da177e4c Linux-2.6.12-rc2 |
88 89 90 91 92 93 94 95 96 97 98 |
} }; /** * generic_init_one - called when a PIIX is found * @dev: the generic device * @id: the matching pci id * * Called when the PCI registration layer (or the IDE initialization) * finds a device matching our IDE device tables. */ |
17deabdcd IDE: Coding Style... |
99 |
|
1da177e4c Linux-2.6.12-rc2 |
100 101 |
static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) { |
856204360 ide: constify str... |
102 |
const struct ide_port_info *d = &generic_chipsets[id->driver_data]; |
1da177e4c Linux-2.6.12-rc2 |
103 |
int ret = -ENODEV; |
b189346cd [PATCH] ide: ide-... |
104 105 106 |
/* Don't use the generic entry unless instructed to do so */ if (id->driver_data == 0 && ide_generic_all == 0) goto out; |
ea3075964 ide: generic IDE ... |
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
switch (dev->vendor) { case PCI_VENDOR_ID_UMC: if (dev->device == PCI_DEVICE_ID_UMC_UM8886A && !(PCI_FUNC(dev->devfn) & 1)) goto out; /* UM8886A/BF pair */ break; case PCI_VENDOR_ID_OPTI: if (dev->device == PCI_DEVICE_ID_OPTI_82C558 && !(PCI_FUNC(dev->devfn) & 1)) goto out; break; case PCI_VENDOR_ID_JMICRON: if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1) goto out; break; case PCI_VENDOR_ID_NS: if (dev->device == PCI_DEVICE_ID_NS_87410 && (dev->class >> 8) != PCI_CLASS_STORAGE_IDE) |
c333526f4 [PATCH] JMB 368 P... |
126 |
goto out; |
ea3075964 ide: generic IDE ... |
127 |
break; |
c333526f4 [PATCH] JMB 368 P... |
128 |
} |
15e0c6943 [PATCH] ide: fix ... |
129 |
|
3719bc5c2 [PATCH] ide-gener... |
130 |
if (dev->vendor != PCI_VENDOR_ID_JMICRON) { |
ea3075964 ide: generic IDE ... |
131 |
u16 command; |
3719bc5c2 [PATCH] ide-gener... |
132 133 |
pci_read_config_word(dev, PCI_COMMAND, &command); if (!(command & PCI_COMMAND_IO)) { |
28cfd8af5 ide: include PCI ... |
134 135 136 |
printk(KERN_INFO "%s %s: skipping disabled " "controller ", d->name, pci_name(dev)); |
3719bc5c2 [PATCH] ide-gener... |
137 138 |
goto out; } |
1da177e4c Linux-2.6.12-rc2 |
139 |
} |
6cdf6eb35 ide: add ->dev an... |
140 |
ret = ide_pci_init_one(dev, d, NULL); |
1da177e4c Linux-2.6.12-rc2 |
141 142 143 |
out: return ret; } |
9cbcc5e3c ide: use PCI_VDEV... |
144 145 146 |
static const struct pci_device_id generic_pci_tbl[] = { { PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_87410), 1 }, { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), 2 }, |
ced3ec8aa ide: prefix messa... |
147 148 149 150 151 152 153 |
{ PCI_VDEVICE(HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), 2 }, { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8673F), 3 }, { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8886A), 3 }, { PCI_VDEVICE(UMC, PCI_DEVICE_ID_UMC_UM8886BF), 3 }, { PCI_VDEVICE(HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), 2 }, { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C561), 4 }, { PCI_VDEVICE(OPTI, PCI_DEVICE_ID_OPTI_82C558), 4 }, |
1da177e4c Linux-2.6.12-rc2 |
154 |
#ifdef CONFIG_BLK_DEV_IDE_SATA |
ced3ec8aa ide: prefix messa... |
155 |
{ PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237_SATA), 5 }, |
1da177e4c Linux-2.6.12-rc2 |
156 |
#endif |
ced3ec8aa ide: prefix messa... |
157 158 |
{ PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), 4 }, { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), 4 }, |
8e182a90f pata_piccolo: Dri... |
159 160 |
{ PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), 4 }, { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_5), 4 }, |
ced3ec8aa ide: prefix messa... |
161 |
{ PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), 6 }, |
9cbcc5e3c ide: use PCI_VDEV... |
162 163 164 165 166 |
/* * Must come last. If you add entries adjust * this table and generic_chipsets[] appropriately. */ { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0 }, |
1da177e4c Linux-2.6.12-rc2 |
167 168 169 |
{ 0, }, }; MODULE_DEVICE_TABLE(pci, generic_pci_tbl); |
a9ab09e26 ide: use unique n... |
170 |
static struct pci_driver generic_pci_driver = { |
1da177e4c Linux-2.6.12-rc2 |
171 172 173 |
.name = "PCI_IDE", .id_table = generic_pci_tbl, .probe = generic_init_one, |
f566bcae9 ide/pci/generic: ... |
174 |
.remove = ide_pci_remove, |
feb22b7f8 ide: add proper P... |
175 176 |
.suspend = ide_pci_suspend, .resume = ide_pci_resume, |
1da177e4c Linux-2.6.12-rc2 |
177 |
}; |
82ab1eece ide: add missing ... |
178 |
static int __init generic_ide_init(void) |
1da177e4c Linux-2.6.12-rc2 |
179 |
{ |
a9ab09e26 ide: use unique n... |
180 |
return ide_pci_register_driver(&generic_pci_driver); |
1da177e4c Linux-2.6.12-rc2 |
181 |
} |
f566bcae9 ide/pci/generic: ... |
182 183 |
static void __exit generic_ide_exit(void) { |
a9ab09e26 ide: use unique n... |
184 |
pci_unregister_driver(&generic_pci_driver); |
f566bcae9 ide/pci/generic: ... |
185 |
} |
1da177e4c Linux-2.6.12-rc2 |
186 |
module_init(generic_ide_init); |
f566bcae9 ide/pci/generic: ... |
187 |
module_exit(generic_ide_exit); |
1da177e4c Linux-2.6.12-rc2 |
188 189 190 191 |
MODULE_AUTHOR("Andre Hedrick"); MODULE_DESCRIPTION("PCI driver module for generic PCI IDE"); MODULE_LICENSE("GPL"); |