Commit 96b61dfd authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bart.bkbits.net/ide-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents bffac3b3 b3d1aca1
......@@ -297,6 +297,8 @@ Summary of ide driver parameters for kernel command line
"ide=reverse" : formerly called to pci sub-system, but now local.
"ide=nodma" : disable DMA globally for the IDE subsystem.
The following are valid ONLY on ide0, which usually corresponds
to the first ATA interface found on the particular host, and the defaults for
the base,ctl ports must not be altered.
......
......@@ -491,6 +491,8 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
case PCI_DEVICE_ID_INTEL_ESB_1:
case PCI_DEVICE_ID_INTEL_ICH6_0:
case PCI_DEVICE_ID_INTEL_ICH6_1:
case PCI_DEVICE_ID_INTEL_ICH7_0:
case PCI_DEVICE_ID_INTEL_ICH7_1:
r->name = "PIIX/ICH";
r->get = pirq_piix_get;
r->set = pirq_piix_set;
......
......@@ -492,20 +492,6 @@ void destroy_proc_ide_interface(ide_hwif_t *hwif)
}
}
static void destroy_proc_ide_interfaces(void)
{
int h;
for (h = 0; h < MAX_HWIFS; h++) {
ide_hwif_t *hwif = &ide_hwifs[h];
#if 0
if (!hwif->present)
continue;
#endif
destroy_proc_ide_interface(hwif);
}
}
extern struct seq_operations ide_drivers_op;
static int ide_drivers_open(struct inode *inode, struct file *file)
{
......@@ -535,6 +521,5 @@ void proc_ide_create(void)
void proc_ide_destroy(void)
{
remove_proc_entry("ide/drivers", proc_ide_root);
destroy_proc_ide_interfaces();
remove_proc_entry("ide", NULL);
}
......@@ -2501,11 +2501,8 @@ void cleanup_module (void)
{
int index;
for (index = 0; index < MAX_HWIFS; ++index) {
for (index = 0; index < MAX_HWIFS; ++index)
ide_unregister(index);
if (ide_hwifs[index].dma_base)
(void) ide_release_dma(&ide_hwifs[index]);
}
#ifdef CONFIG_PROC_FS
proc_ide_destroy();
......
......@@ -321,12 +321,12 @@ static void __devinit init_dma_aec62xx(ide_hwif_t *hwif, unsigned long dmabase)
ide_setup_dma(hwif, dmabase, 8);
}
static void __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d)
{
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d)
{
unsigned long bar4reg = pci_resource_start(dev, 4);
......@@ -340,7 +340,7 @@ static void __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *
strcpy(d->name, "AEC6280R");
}
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
/**
......@@ -356,8 +356,7 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
{
ide_pci_device_t *d = &aec62xx_chipsets[id->driver_data];
d->init_setup(dev, d);
return 0;
return d->init_setup(dev, d);
}
static struct pci_device_id aec62xx_pci_tbl[] = {
......
......@@ -61,8 +61,8 @@ static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = {
#define BUSCLOCK(D) \
((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D)))
static void init_setup_aec6x80(struct pci_dev *, ide_pci_device_t *);
static void init_setup_aec62xx(struct pci_dev *, ide_pci_device_t *);
static int init_setup_aec6x80(struct pci_dev *, ide_pci_device_t *);
static int init_setup_aec62xx(struct pci_dev *, ide_pci_device_t *);
static unsigned int init_chipset_aec62xx(struct pci_dev *, const char *);
static void init_hwif_aec62xx(ide_hwif_t *);
static void init_dma_aec62xx(ide_hwif_t *, unsigned long);
......
......@@ -884,8 +884,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev
#if defined(CONFIG_SPARC64)
d->init_hwif = init_hwif_common_ali15x3;
#endif /* CONFIG_SPARC64 */
ide_setup_pci_device(dev, d);
return 0;
return ide_setup_pci_device(dev, d);
}
......
......@@ -493,9 +493,12 @@ static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_
{
amd_chipset = amd74xx_chipsets + id->driver_data;
amd_config = amd_ide_chips + id->driver_data;
if (dev->device != amd_config->id) BUG();
ide_setup_pci_device(dev, amd_chipset);
return 0;
if (dev->device != amd_config->id) {
printk(KERN_ERR "%s: assertion 0x%02x == 0x%02x failed !\n",
pci_name(dev), dev->device, amd_config->id);
return -ENODEV;
}
return ide_setup_pci_device(dev, amd_chipset);
}
static struct pci_device_id amd74xx_pci_tbl[] = {
......
......@@ -341,8 +341,7 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]);
return 0;
return ide_setup_pci_device(dev, &atiixp_pci_info[id->driver_data]);
}
static struct pci_device_id atiixp_pci_tbl[] = {
......
......@@ -709,8 +709,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &cmd64x_chipsets[id->driver_data]);
return 0;
return ide_setup_pci_device(dev, &cmd64x_chipsets[id->driver_data]);
}
static struct pci_device_id cmd64x_pci_tbl[] = {
......
......@@ -357,8 +357,7 @@ static ide_pci_device_t cs5530_chipset __devinitdata = {
static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &cs5530_chipset);
return 0;
return ide_setup_pci_device(dev, &cs5530_chipset);
}
static struct pci_device_id cs5530_pci_tbl[] = {
......
......@@ -426,15 +426,16 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev
{
ide_pci_device_t *d = &cy82c693_chipsets[id->driver_data];
struct pci_dev *dev2;
int ret = -ENODEV;
/* CY82C693 is more than only a IDE controller.
Function 1 is primary IDE channel, function 2 - secondary. */
if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
PCI_FUNC(dev->devfn) == 1) {
dev2 = pci_find_slot(dev->bus->number, dev->devfn + 1);
ide_setup_pci_devices(dev, dev2, d);
ret = ide_setup_pci_devices(dev, dev2, d);
}
return 0;
return ret;
}
static struct pci_device_id cy82c693_pci_tbl[] = {
......
......@@ -96,25 +96,26 @@ static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_devi
{
ide_pci_device_t *d = &generic_chipsets[id->driver_data];
u16 command;
int ret = -ENODEV;
if (dev->vendor == PCI_VENDOR_ID_UMC &&
dev->device == PCI_DEVICE_ID_UMC_UM8886A &&
(!(PCI_FUNC(dev->devfn) & 1)))
return 1; /* UM8886A/BF pair */
goto out; /* UM8886A/BF pair */
if (dev->vendor == PCI_VENDOR_ID_OPTI &&
dev->device == PCI_DEVICE_ID_OPTI_82C558 &&
(!(PCI_FUNC(dev->devfn) & 1)))
return 1;
goto out;
pci_read_config_word(dev, PCI_COMMAND, &command);
if(!(command & PCI_COMMAND_IO))
{
if (!(command & PCI_COMMAND_IO)) {
printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name);
return 1;
goto out;
}
ide_setup_pci_device(dev, d);
return 0;
ret = ide_setup_pci_device(dev, d);
out:
return ret;
}
static struct pci_device_id generic_pci_tbl[] = {
......
......@@ -251,8 +251,7 @@ static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_devic
d->name = chipset_names[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0];
d->bootable = (pcicmd & PCI_COMMAND_MEMORY) ? OFF_BOARD : NEVER_BOARD;
ide_setup_pci_device(dev, d);
return 0;
return ide_setup_pci_device(dev, d);
}
static struct pci_device_id hpt34x_pci_tbl[] = {
......
......@@ -1191,12 +1191,12 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
ide_setup_dma(hwif, dmabase, 8);
}
static void __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d)
{
struct pci_dev *findev = NULL;
if (PCI_FUNC(dev->devfn) & 1)
return;
return -ENODEV;
while ((findev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) {
if ((findev->vendor == dev->vendor) &&
......@@ -1209,19 +1209,18 @@ static void __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d
printk(KERN_WARNING "%s: pci-config space interrupt "
"fixed.\n", d->name);
}
ide_setup_pci_devices(dev, findev, d);
return;
return ide_setup_pci_devices(dev, findev, d);
}
}
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_hpt37x(struct pci_dev *dev, ide_pci_device_t *d)
{
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
{
struct pci_dev *findev = NULL;
u8 pin1 = 0, pin2 = 0;
......@@ -1231,7 +1230,7 @@ static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d
"HPT372N" };
if (PCI_FUNC(dev->devfn) & 1)
return;
return -ENODEV;
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff;
......@@ -1246,9 +1245,10 @@ static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d
case 6:
case 5:
case 4:
case 3: ide_setup_pci_device(dev, d);
return;
default: break;
case 3:
goto init_single;
default:
break;
}
d->channels = 1;
......@@ -1266,11 +1266,11 @@ static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d
"pin1=%d pin2=%d\n", d->name,
pin1, pin2);
}
ide_setup_pci_devices(dev, findev, d);
return;
return ide_setup_pci_devices(dev, findev, d);
}
}
ide_setup_pci_device(dev, d);
init_single:
return ide_setup_pci_device(dev, d);
}
......@@ -1287,8 +1287,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
{
ide_pci_device_t *d = &hpt366_chipsets[id->driver_data];
d->init_setup(dev, d);
return 0;
return d->init_setup(dev, d);
}
static struct pci_device_id hpt366_pci_tbl[] = {
......
......@@ -414,9 +414,9 @@ static struct chipset_bus_clock_list_entry sixty_six_base_hpt374[] = {
#define F_LOW_PCI_50 0x2d
#define F_LOW_PCI_66 0x42
static void init_setup_hpt366(struct pci_dev *, ide_pci_device_t *);
static void init_setup_hpt37x(struct pci_dev *, ide_pci_device_t *);
static void init_setup_hpt374(struct pci_dev *, ide_pci_device_t *);
static int init_setup_hpt366(struct pci_dev *, ide_pci_device_t *);
static int init_setup_hpt37x(struct pci_dev *, ide_pci_device_t *);
static int init_setup_hpt374(struct pci_dev *, ide_pci_device_t *);
static unsigned int init_chipset_hpt366(struct pci_dev *, const char *);
static void init_hwif_hpt366(ide_hwif_t *);
static void init_dma_hpt366(ide_hwif_t *, unsigned long);
......
......@@ -270,9 +270,8 @@ static int __devinit it8172_init_one(struct pci_dev *dev, const struct pci_devic
{
if ((!(PCI_FUNC(dev->devfn) & 1) ||
(!((dev->class >> 8) == PCI_CLASS_STORAGE_IDE))))
return 1; /* IT8172 is more than only a IDE controller */
ide_setup_pci_device(dev, &it8172_chipsets[id->driver_data]);
return 0;
return -ENODEV; /* IT8172 is more than an IDE controller */
return ide_setup_pci_device(dev, &it8172_chipsets[id->driver_data]);
}
static struct pci_device_id it8172_pci_tbl[] = {
......
......@@ -288,8 +288,7 @@ static ide_pci_device_t ns87415_chipset __devinitdata = {
static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &ns87415_chipset);
return 0;
return ide_setup_pci_device(dev, &ns87415_chipset);
}
static struct pci_device_id ns87415_pci_tbl[] = {
......
......@@ -348,15 +348,14 @@ static void __init init_hwif_opti621 (ide_hwif_t *hwif)
hwif->drives[1].autodma = hwif->autodma;
}
static void __init init_setup_opti621 (struct pci_dev *dev, ide_pci_device_t *d)
static int __init init_setup_opti621 (struct pci_dev *dev, ide_pci_device_t *d)
{
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]);
return 0;
return ide_setup_pci_device(dev, &opti621_chipsets[id->driver_data]);
}
static struct pci_device_id opti621_pci_tbl[] = {
......
......@@ -5,7 +5,7 @@
#include <linux/pci.h>
#include <linux/ide.h>
static void init_setup_opti621(struct pci_dev *, ide_pci_device_t *);
static int init_setup_opti621(struct pci_dev *, ide_pci_device_t *);
static void init_hwif_opti621(ide_hwif_t *);
static ide_pci_device_t opti621_chipsets[] __devinitdata = {
......
......@@ -316,21 +316,21 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
#endif /* PDC202_DEBUG_CABLE */
}
static void __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d)
{
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_pdc20270(struct pci_dev *dev,
ide_pci_device_t *d)
{
struct pci_dev *findev = NULL;
if ((dev->bus->self &&
dev->bus->self->vendor == PCI_VENDOR_ID_DEC) &&
(dev->bus->self->device == PCI_DEVICE_ID_DEC_21150)) {
if (PCI_SLOT(dev->devfn) & 2) {
return;
}
if (PCI_SLOT(dev->devfn) & 2)
return -ENODEV;
d->extra = 0;
while ((findev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, findev)) != NULL) {
if ((findev->vendor == dev->vendor) &&
......@@ -339,15 +339,15 @@ static void __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t
if (findev->irq != dev->irq) {
findev->irq = dev->irq;
}
ide_setup_pci_devices(dev, findev, d);
return;
return ide_setup_pci_devices(dev, findev, d);
}
}
}
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_pdc20276(struct pci_dev *dev,
ide_pci_device_t *d)
{
if ((dev->bus->self) &&
(dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) &&
......@@ -355,9 +355,9 @@ static void __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t
(dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960RM))) {
printk(KERN_INFO "ide: Skipping Promise PDC20276 "
"attached to I2O RAID controller.\n");
return;
return -ENODEV;
}
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
/**
......@@ -373,8 +373,7 @@ static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_de
{
ide_pci_device_t *d = &pdcnew_chipsets[id->driver_data];
d->init_setup(dev, d);
return 0;
return d->init_setup(dev, d);
}
static struct pci_device_id pdc202new_pci_tbl[] = {
......
......@@ -43,9 +43,9 @@ const static char *pdc_quirk_drives[] = {
set_2regs(0x13,(c)); \
} while(0)
static void init_setup_pdcnew(struct pci_dev *, ide_pci_device_t *);
static void init_setup_pdc20270(struct pci_dev *, ide_pci_device_t *);
static void init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d);
static int init_setup_pdcnew(struct pci_dev *, ide_pci_device_t *);
static int init_setup_pdc20270(struct pci_dev *, ide_pci_device_t *);
static int init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d);
static unsigned int init_chipset_pdcnew(struct pci_dev *, const char *);
static void init_hwif_pdc202new(ide_hwif_t *);
......
......@@ -658,7 +658,8 @@ static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase)
ide_setup_dma(hwif, dmabase, 8);
}
static void __devinit init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_pdc202ata4(struct pci_dev *dev,
ide_pci_device_t *d)
{
if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
u8 irq = 0, irq2 = 0;
......@@ -685,10 +686,11 @@ static void __devinit init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_
}
#endif
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __devinit init_setup_pdc20265(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_pdc20265(struct pci_dev *dev,
ide_pci_device_t *d)
{
if ((dev->bus->self) &&
(dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) &&
......@@ -696,7 +698,7 @@ static void __devinit init_setup_pdc20265(struct pci_dev *dev, ide_pci_device_t
(dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960RM))) {
printk(KERN_INFO "ide: Skipping Promise PDC20265 "
"attached to I2O RAID controller.\n");
return;
return -ENODEV;
}
#if 0
......@@ -714,12 +716,13 @@ static void __devinit init_setup_pdc20265(struct pci_dev *dev, ide_pci_device_t
}
#endif
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __devinit init_setup_pdc202xx(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_pdc202xx(struct pci_dev *dev,
ide_pci_device_t *d)
{
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
/**
......@@ -735,8 +738,7 @@ static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_dev
{
ide_pci_device_t *d = &pdc202xx_chipsets[id->driver_data];
d->init_setup(dev, d);
return 0;
return d->init_setup(dev, d);
}
static struct pci_device_id pdc202xx_pci_tbl[] = {
......
......@@ -63,9 +63,9 @@ static const char *pdc_quirk_drives[] = {
#define MC1 0x02 /* DMA"C" timing */
#define MC0 0x01 /* DMA"C" timing */
static void init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d);
static void init_setup_pdc20265(struct pci_dev *, ide_pci_device_t *);
static void init_setup_pdc202xx(struct pci_dev *, ide_pci_device_t *);
static int init_setup_pdc202ata4(struct pci_dev *dev, ide_pci_device_t *d);
static int init_setup_pdc20265(struct pci_dev *, ide_pci_device_t *);
static int init_setup_pdc202xx(struct pci_dev *, ide_pci_device_t *);
static unsigned int init_chipset_pdc202xx(struct pci_dev *, const char *);
static void init_hwif_pdc202xx(ide_hwif_t *);
static void init_dma_pdc202xx(ide_hwif_t *, unsigned long);
......
......@@ -134,6 +134,7 @@ static u8 piix_ratemask (ide_drive_t *drive)
case PCI_DEVICE_ID_INTEL_82801EB_11:
case PCI_DEVICE_ID_INTEL_ESB_2:
case PCI_DEVICE_ID_INTEL_ICH6_19:
case PCI_DEVICE_ID_INTEL_ICH7_21:
mode = 3;
break;
/* UDMA 66 capable */
......@@ -445,6 +446,7 @@ static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char
case PCI_DEVICE_ID_INTEL_82801E_11:
case PCI_DEVICE_ID_INTEL_ESB_2:
case PCI_DEVICE_ID_INTEL_ICH6_19:
case PCI_DEVICE_ID_INTEL_ICH7_21:
{
unsigned int extra = 0;
pci_read_config_dword(dev, 0x54, &extra);
......@@ -535,9 +537,9 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
* a standard ide PCI setup
*/
static void __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d)
static int __devinit init_setup_piix(struct pci_dev *dev, ide_pci_device_t *d)
{
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
/**
......@@ -553,8 +555,7 @@ static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_
{
ide_pci_device_t *d = &piix_pci_info[id->driver_data];
d->init_setup(dev, d);
return 0;
return d->init_setup(dev, d);
}
/**
......@@ -612,6 +613,7 @@ static struct pci_device_id piix_pci_tbl[] = {
#endif
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19},
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_19, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20},
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 21},
{ 0, },
};
MODULE_DEVICE_TABLE(pci, piix_pci_tbl);
......
......@@ -5,7 +5,7 @@
#include <linux/pci.h>
#include <linux/ide.h>
static void init_setup_piix(struct pci_dev *, ide_pci_device_t *);
static int init_setup_piix(struct pci_dev *, ide_pci_device_t *);
static unsigned int __devinit init_chipset_piix(struct pci_dev *, const char *);
static void init_hwif_piix(ide_hwif_t *);
......@@ -57,7 +57,8 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = {
/* 17 */ DECLARE_PIIX_DEV("ICH4"),
/* 18 */ DECLARE_PIIX_DEV("ICH5-SATA"),
/* 19 */ DECLARE_PIIX_DEV("ICH5"),
/* 20 */ DECLARE_PIIX_DEV("ICH6")
/* 20 */ DECLARE_PIIX_DEV("ICH6"),
/* 21 */ DECLARE_PIIX_DEV("ICH7"),
};
#endif /* PIIX_H */
......@@ -62,8 +62,7 @@ static ide_pci_device_t rz1000_chipset __devinitdata = {
static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &rz1000_chipset);
return 0;
return ide_setup_pci_device(dev, &rz1000_chipset);
}
static struct pci_device_id rz1000_pci_tbl[] = {
......
......@@ -489,8 +489,7 @@ static ide_pci_device_t sc1200_chipset __devinitdata = {
static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &sc1200_chipset);
return 0;
return ide_setup_pci_device(dev, &sc1200_chipset);
}
static struct pci_device_id sc1200_pci_tbl[] = {
......
......@@ -359,11 +359,9 @@ static unsigned int __init init_chipset_svwks (struct pci_dev *dev, const char *
else if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) ||
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE) ||
(dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2)) {
// u32 pioreg = 0, dmareg = 0;
/* Third Channel Test */
if (!(PCI_FUNC(dev->devfn) & 1)) {
#if 1
struct pci_dev * findev = NULL;
u32 reg4c = 0;
findev = pci_find_device(PCI_VENDOR_ID_SERVERWORKS,
......@@ -375,19 +373,11 @@ static unsigned int __init init_chipset_svwks (struct pci_dev *dev, const char *
reg4c |= 0x00000020;
pci_write_config_dword(findev, 0x4C, reg4c);
}
#endif
outb_p(0x06, 0x0c00);
dev->irq = inb_p(0x0c01);
#if 0
/* WE need to figure out how to get the correct one */
printk("%s: interrupt %d\n", name, dev->irq);
if (dev->irq != 0x0B)
dev->irq = 0x0B;
#endif
#if 0
printk("%s: device class (0x%04x)\n",
name, dev->class);
#else
if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
dev->class &= ~0x000F0F00;
// dev->class |= ~0x00000400;
......@@ -413,6 +403,7 @@ static unsigned int __init init_chipset_svwks (struct pci_dev *dev, const char *
* interrupt pin to be set, and it is a compatibility
* mode issue.
*/
if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE)
dev->irq = 0;
}
// pci_read_config_dword(dev, 0x40, &pioreg)
......@@ -566,20 +557,17 @@ static void __init init_dma_svwks (ide_hwif_t *hwif, unsigned long dmabase)
ide_setup_dma(hwif, dmabase, 8);
}
static void __init init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
static int __init init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d)
{
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
static void __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
static int __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
{
if (!(PCI_FUNC(dev->devfn) & 1)) {
d->bootable = NEVER_BOARD;
if (dev->resource[0].start == 0x01f1)
d->bootable = ON_BOARD;
} else {
if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
return;
}
#if 0
if ((IDE_PCI_DEVID_EQ(d->devid, DEVID_CSB6) &&
......@@ -591,7 +579,7 @@ static void __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
(!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2;
ide_setup_pci_device(dev, d);
return ide_setup_pci_device(dev, d);
}
......@@ -608,8 +596,7 @@ static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device
{
ide_pci_device_t *d = &serverworks_chipsets[id->driver_data];
d->init_setup(dev, d);
return 0;
return d->init_setup(dev, d);
}
static struct pci_device_id svwks_pci_tbl[] = {
......@@ -625,10 +612,6 @@ static struct pci_driver driver = {
.name = "Serverworks_IDE",
.id_table = svwks_pci_tbl,
.probe = svwks_init_one,
#if 0 /* FIXME: implement */
.suspend = ,
.resume = ,
#endif
};
static int svwks_ide_init(void)
......
......@@ -21,8 +21,8 @@ static const char *svwks_bad_ata100[] = {
NULL
};
static void init_setup_svwks(struct pci_dev *, ide_pci_device_t *);
static void init_setup_csb6(struct pci_dev *, ide_pci_device_t *);
static int init_setup_svwks(struct pci_dev *, ide_pci_device_t *);
static int init_setup_csb6(struct pci_dev *, ide_pci_device_t *);
static unsigned int init_chipset_svwks(struct pci_dev *, const char *);
static void init_hwif_svwks(ide_hwif_t *);
static void init_dma_svwks(ide_hwif_t *, unsigned long);
......
......@@ -681,12 +681,14 @@ static unsigned int __devinit
pci_init_sgiioc4(struct pci_dev *dev, ide_pci_device_t * d)
{
unsigned int class_rev;
int ret;
if (pci_enable_device(dev)) {
ret = pci_enable_device(dev);
if (ret < 0) {
printk(KERN_ERR
"Failed to enable device %s at slot %s\n",
d->name, dev->slot_name);
return -ENODEV;
goto out;
}
pci_set_master(dev);
......@@ -698,9 +700,18 @@ pci_init_sgiioc4(struct pci_dev *dev, ide_pci_device_t * d)
printk(KERN_ERR "Skipping %s IDE controller in slot %s: "
"firmware is obsolete - please upgrade to revision"
"46 or higher\n", d->name, dev->slot_name);
return -ENODEV;
ret = -EAGAIN;
goto err_disable;
}
return sgiioc4_ide_setup_pci_device(dev, d);
ret = sgiioc4_ide_setup_pci_device(dev, d);
if (ret < 0)
goto err_disable;
out:
return ret;
err_disable:
pci_disable_device(dev);
goto out;
}
static ide_pci_device_t sgiioc4_chipsets[] __devinitdata = {
......
......@@ -1102,8 +1102,7 @@ static ide_pci_device_t siimage_chipsets[] __devinitdata = {
static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]);
return 0;
return ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]);
}
static struct pci_device_id siimage_pci_tbl[] = {
......
......@@ -946,8 +946,7 @@ static ide_pci_device_t sis5513_chipset __devinitdata = {
static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &sis5513_chipset);
return 0;
return ide_setup_pci_device(dev, &sis5513_chipset);
}
static struct pci_device_id sis5513_pci_tbl[] = {
......
......@@ -490,8 +490,7 @@ static ide_pci_device_t sl82c105_chipset __devinitdata = {
static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &sl82c105_chipset);
return 0;
return ide_setup_pci_device(dev, &sl82c105_chipset);
}
static struct pci_device_id sl82c105_pci_tbl[] = {
......
......@@ -246,8 +246,7 @@ static ide_pci_device_t slc90e66_chipset __devinitdata = {
static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &slc90e66_chipset);
return 0;
return ide_setup_pci_device(dev, &slc90e66_chipset);
}
static struct pci_device_id slc90e66_pci_tbl[] = {
......
......@@ -158,9 +158,7 @@ static ide_pci_device_t triflex_device __devinitdata = {
static int __devinit triflex_init_one(struct pci_dev *dev,
const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &triflex_device);
return 0;
return ide_setup_pci_device(dev, &triflex_device);
}
static struct pci_device_id triflex_pci_tbl[] = {
......
......@@ -342,8 +342,7 @@ static ide_pci_device_t trm290_chipset __devinitdata = {
static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &trm290_chipset);
return 0;
return ide_setup_pci_device(dev, &trm290_chipset);
}
static struct pci_device_id trm290_pci_tbl[] = {
......
......@@ -620,8 +620,7 @@ static ide_pci_device_t via82cxxx_chipset __devinitdata = {
static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{
ide_setup_pci_device(dev, &via82cxxx_chipset);
return 0;
return ide_setup_pci_device(dev, &via82cxxx_chipset);
}
static struct pci_device_id via_pci_tbl[] = {
......
......@@ -290,13 +290,15 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d)
{
int ret;
if (pci_enable_device(dev)) {
if (pci_enable_device_bars(dev, 1 << 4)) {
ret = pci_enable_device_bars(dev, 1 << 4);
if (ret < 0) {
printk(KERN_WARNING "%s: (ide_setup_pci_device:) "
"Could not enable device.\n", d->name);
return -EBUSY;
} else
goto out;
}
printk(KERN_WARNING "%s: BIOS configuration fixed.\n", d->name);
}
......@@ -305,18 +307,23 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d)
* dma mask field to the ide_pci_device_t if we need it (or let
* lower level driver set the dma mask)
*/
if (pci_set_dma_mask(dev, 0xffffffff)) {
ret = pci_set_dma_mask(dev, DMA_32BIT_MASK);
if (ret < 0) {
printk(KERN_ERR "%s: can't set dma mask\n", d->name);
return -EBUSY;
pci_disable_device(dev);
goto out;
}
/* FIXME: Temporary - until we put in the hotplug interface logic
Check that the bits we want are not in use by someone else */
if (pci_request_region(dev, 4, "ide_tmp"))
return -EBUSY;
pci_release_region(dev, 4);
Check that the bits we want are not in use by someone else.
As someone else uses it, we do not (yuck) disable the device */
ret = pci_request_region(dev, 4, "ide_tmp");
if (ret < 0)
goto out;
return 0;
pci_release_region(dev, 4);
out:
return ret;
}
/**
......@@ -515,22 +522,26 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config)
{
int ret;
u32 class_rev;
u16 pcicmd;
if (noisy)
ide_setup_pci_noise(dev, d);
if (ide_pci_enable(dev, d))
return -EBUSY;
ret = ide_pci_enable(dev, d);
if (ret < 0)
goto out;
if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd)) {
ret = pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
if (ret < 0) {
printk(KERN_ERR "%s: error accessing PCI regs\n", d->name);
return -EIO;
goto err_disable;
}
if (!(pcicmd & PCI_COMMAND_IO)) { /* is device disabled? */
if (ide_pci_configure(dev, d))
return -ENODEV;
ret = ide_pci_configure(dev, d);
if (ret < 0)
goto err_disable;
*config = 1;
printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
}
......@@ -539,7 +550,19 @@ static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, in
class_rev &= 0xff;
if (noisy)
printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev);
return 0;
out:
return ret;
err_disable:
pci_disable_device(dev);
goto out;
}
static void ide_release_pci_controller(struct pci_dev *dev, ide_pci_device_t *d,
int noisy)
{
/* Balance ide_pci_enable() */
pci_disable_device(dev);
}
/**
......@@ -643,14 +666,16 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
* we "know" about, this information is in the ide_pci_device_t struct;
* for all other chipsets, we just assume both interfaces are enabled.
*/
static ata_index_t do_ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d, u8 noisy)
static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
ata_index_t *index, u8 noisy)
{
int pciirq = 0;
static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } };
int tried_config = 0;
ata_index_t index = { .b = { .low = 0xff, .high = 0xff } };
int pciirq, ret;
if (ide_setup_pci_controller(dev, d, noisy, &tried_config) < 0)
return index;
ret = ide_setup_pci_controller(dev, d, noisy, &tried_config);
if (ret < 0)
goto out;
/*
* Can we trust the reported IRQ?
......@@ -668,7 +693,10 @@ static ata_index_t do_ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_
* space, place chipset into init-mode, and/or preserve
* an interrupt if the card is not native ide support.
*/
pciirq = (d->init_chipset) ? d->init_chipset(dev, d->name) : 0;
ret = d->init_chipset ? d->init_chipset(dev, d->name) : 0;
if (ret < 0)
goto err_release_pci_controller;
pciirq = ret;
} else if (tried_config) {
if (noisy)
printk(KERN_INFO "%s: will probe irqs later\n", d->name);
......@@ -679,10 +707,10 @@ static ata_index_t do_ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_
d->name, pciirq);
pciirq = 0;
} else {
if (d->init_chipset)
{
if(d->init_chipset(dev, d->name) < 0)
return index;
if (d->init_chipset) {
ret = d->init_chipset(dev, d->name);
if (ret < 0)
goto err_release_pci_controller;
}
if (noisy)
#ifdef __sparc__
......@@ -694,17 +722,26 @@ static ata_index_t do_ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_
#endif
}
if(pciirq < 0) /* Error not an IRQ */
return index;
/* FIXME: silent failure can happen */
ide_pci_setup_ports(dev, d, pciirq, &index);
*index = ata_index;
ide_pci_setup_ports(dev, d, pciirq, index);
out:
return ret;
return index;
err_release_pci_controller:
ide_release_pci_controller(dev, d, noisy);
goto out;
}
void ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d)
int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
{
ata_index_t index_list = do_ide_setup_pci_device(dev, d, 1);
ata_index_t index_list;
int ret;
ret = do_ide_setup_pci_device(dev, d, &index_list, 1);
if (ret < 0)
goto out;
if ((index_list.b.low & 0xf0) != 0xf0)
probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.low], d->fixup);
......@@ -712,25 +749,42 @@ void ide_setup_pci_device (struct pci_dev *dev, ide_pci_device_t *d)
probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.high], d->fixup);
create_proc_ide_interfaces();
out:
return ret;
}
EXPORT_SYMBOL_GPL(ide_setup_pci_device);
void ide_setup_pci_devices (struct pci_dev *dev, struct pci_dev *dev2, ide_pci_device_t *d)
int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
ide_pci_device_t *d)
{
ata_index_t index_list = do_ide_setup_pci_device(dev, d, 1);
ata_index_t index_list2 = do_ide_setup_pci_device(dev2, d, 0);
struct pci_dev *pdev[] = { dev1, dev2 };
ata_index_t index_list[2];
int ret, i;
if ((index_list.b.low & 0xf0) != 0xf0)
probe_hwif_init(&ide_hwifs[index_list.b.low]);
if ((index_list.b.high & 0xf0) != 0xf0)
probe_hwif_init(&ide_hwifs[index_list.b.high]);
if ((index_list2.b.low & 0xf0) != 0xf0)
probe_hwif_init(&ide_hwifs[index_list2.b.low]);
if ((index_list2.b.high & 0xf0) != 0xf0)
probe_hwif_init(&ide_hwifs[index_list2.b.high]);
for (i = 0; i < 2; i++) {
ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i);
/*
* FIXME: Mom, mom, they stole me the helper function to undo
* do_ide_setup_pci_device() on the first device!
*/
if (ret < 0)
goto out;
}
for (i = 0; i < 2; i++) {
u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
int j;
for (j = 0; j < 2; j++) {
if ((idx[j] & 0xf0) != 0xf0)
probe_hwif_init(ide_hwifs + idx[j]);
}
}
create_proc_ide_interfaces();
out:
return ret;
}
EXPORT_SYMBOL_GPL(ide_setup_pci_devices);
......
......@@ -1422,7 +1422,7 @@ enum {
typedef struct ide_pci_device_s {
char *name;
void (*init_setup)(struct pci_dev *, struct ide_pci_device_s *);
int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *);
void (*init_setup_dma)(struct pci_dev *, struct ide_pci_device_s *, ide_hwif_t *);
unsigned int (*init_chipset)(struct pci_dev *, const char *);
void (*init_iops)(ide_hwif_t *);
......@@ -1438,8 +1438,8 @@ typedef struct ide_pci_device_s {
u8 flags;
} ide_pci_device_t;
extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
extern void ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *);
extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *);
void ide_map_sg(ide_drive_t *, struct request *);
void ide_init_sg_cmd(ide_drive_t *, struct request *);
......
......@@ -2238,6 +2238,30 @@
#define PCI_DEVICE_ID_INTEL_ICH6_17 0x266d
#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e
#define PCI_DEVICE_ID_INTEL_ICH6_19 0x266f
#define PCI_DEVICE_ID_INTEL_ICH7_0 0x27b0
#define PCI_DEVICE_ID_INTEL_ICH7_1 0x27b1
#define PCI_DEVICE_ID_INTEL_ICH7_2 0x27c0
#define PCI_DEVICE_ID_INTEL_ICH7_3 0x27c1
#define PCI_DEVICE_ID_INTEL_ICH7_4 0x27c2
#define PCI_DEVICE_ID_INTEL_ICH7_5 0x27c4
#define PCI_DEVICE_ID_INTEL_ICH7_6 0x27c5
#define PCI_DEVICE_ID_INTEL_ICH7_7 0x27c8
#define PCI_DEVICE_ID_INTEL_ICH7_8 0x27c9
#define PCI_DEVICE_ID_INTEL_ICH7_9 0x27ca
#define PCI_DEVICE_ID_INTEL_ICH7_10 0x27cb
#define PCI_DEVICE_ID_INTEL_ICH7_11 0x27cc
#define PCI_DEVICE_ID_INTEL_ICH7_12 0x27d0
#define PCI_DEVICE_ID_INTEL_ICH7_13 0x27d2
#define PCI_DEVICE_ID_INTEL_ICH7_14 0x27d4
#define PCI_DEVICE_ID_INTEL_ICH7_15 0x27d6
#define PCI_DEVICE_ID_INTEL_ICH7_16 0x27d8
#define PCI_DEVICE_ID_INTEL_ICH7_17 0x27da
#define PCI_DEVICE_ID_INTEL_ICH7_18 0x27dc
#define PCI_DEVICE_ID_INTEL_ICH7_19 0x27dd
#define PCI_DEVICE_ID_INTEL_ICH7_20 0x27de
#define PCI_DEVICE_ID_INTEL_ICH7_21 0x27df
#define PCI_DEVICE_ID_INTEL_ICH7_22 0x27e0
#define PCI_DEVICE_ID_INTEL_ICH7_23 0x27e2
#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment