diff options
| -rw-r--r-- | drivers/ide/setup-pci.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 699c72947967..6302010fd8e2 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
| @@ -27,13 +27,13 @@ | |||
| 27 | * | 27 | * |
| 28 | * We attempt to place the PCI interface into PCI native mode. If | 28 | * We attempt to place the PCI interface into PCI native mode. If |
| 29 | * we succeed the BARs are ok and the controller is in PCI mode. | 29 | * we succeed the BARs are ok and the controller is in PCI mode. |
| 30 | * Returns 0 on success or an errno code. | 30 | * Returns 0 on success or an errno code. |
| 31 | * | 31 | * |
| 32 | * FIXME: if we program the interface and then fail to set the BARS | 32 | * FIXME: if we program the interface and then fail to set the BARS |
| 33 | * we don't switch it back to legacy mode. Do we actually care ?? | 33 | * we don't switch it back to legacy mode. Do we actually care ?? |
| 34 | */ | 34 | */ |
| 35 | 35 | ||
| 36 | static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name) | 36 | static int ide_setup_pci_baseregs(struct pci_dev *dev, const char *name) |
| 37 | { | 37 | { |
| 38 | u8 progif = 0; | 38 | u8 progif = 0; |
| 39 | 39 | ||
| @@ -140,7 +140,6 @@ void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d) | |||
| 140 | " PCI slot %s\n", d->name, dev->vendor, dev->device, | 140 | " PCI slot %s\n", d->name, dev->vendor, dev->device, |
| 141 | dev->revision, pci_name(dev)); | 141 | dev->revision, pci_name(dev)); |
| 142 | } | 142 | } |
| 143 | |||
| 144 | EXPORT_SYMBOL_GPL(ide_setup_pci_noise); | 143 | EXPORT_SYMBOL_GPL(ide_setup_pci_noise); |
| 145 | 144 | ||
| 146 | 145 | ||
| @@ -153,7 +152,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); | |||
| 153 | * but if that fails then we only need IO space. The PCI code should | 152 | * but if that fails then we only need IO space. The PCI code should |
| 154 | * have setup the proper resources for us already for controllers in | 153 | * have setup the proper resources for us already for controllers in |
| 155 | * legacy mode. | 154 | * legacy mode. |
| 156 | * | 155 | * |
| 157 | * Returns zero on success or an error code | 156 | * Returns zero on success or an error code |
| 158 | */ | 157 | */ |
| 159 | 158 | ||
| @@ -212,8 +211,8 @@ static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d) | |||
| 212 | * Maybe the user deliberately *disabled* the device, | 211 | * Maybe the user deliberately *disabled* the device, |
| 213 | * but we'll eventually ignore it again if no drives respond. | 212 | * but we'll eventually ignore it again if no drives respond. |
| 214 | */ | 213 | */ |
| 215 | if (ide_setup_pci_baseregs(dev, d->name) || pci_write_config_word(dev, PCI_COMMAND, pcicmd|PCI_COMMAND_IO)) | 214 | if (ide_setup_pci_baseregs(dev, d->name) || |
| 216 | { | 215 | pci_write_config_word(dev, PCI_COMMAND, pcicmd | PCI_COMMAND_IO)) { |
| 217 | printk(KERN_INFO "%s: device disabled (BIOS)\n", d->name); | 216 | printk(KERN_INFO "%s: device disabled (BIOS)\n", d->name); |
| 218 | return -ENODEV; | 217 | return -ENODEV; |
| 219 | } | 218 | } |
| @@ -242,7 +241,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info * | |||
| 242 | int bar) | 241 | int bar) |
| 243 | { | 242 | { |
| 244 | ulong flags = pci_resource_flags(dev, bar); | 243 | ulong flags = pci_resource_flags(dev, bar); |
| 245 | 244 | ||
| 246 | /* Unconfigured ? */ | 245 | /* Unconfigured ? */ |
| 247 | if (!flags || pci_resource_len(dev, bar) == 0) | 246 | if (!flags || pci_resource_len(dev, bar) == 0) |
| 248 | return 0; | 247 | return 0; |
| @@ -250,7 +249,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info * | |||
| 250 | /* I/O space */ | 249 | /* I/O space */ |
| 251 | if (flags & IORESOURCE_IO) | 250 | if (flags & IORESOURCE_IO) |
| 252 | return 0; | 251 | return 0; |
| 253 | 252 | ||
| 254 | /* Bad */ | 253 | /* Bad */ |
| 255 | return -EINVAL; | 254 | return -EINVAL; |
| 256 | } | 255 | } |
| @@ -284,7 +283,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, | |||
| 284 | "as MEM for port %d!\n", d->name, port); | 283 | "as MEM for port %d!\n", d->name, port); |
| 285 | return NULL; | 284 | return NULL; |
| 286 | } | 285 | } |
| 287 | 286 | ||
| 288 | ctl = pci_resource_start(dev, 2*port+1); | 287 | ctl = pci_resource_start(dev, 2*port+1); |
| 289 | base = pci_resource_start(dev, 2*port); | 288 | base = pci_resource_start(dev, 2*port); |
| 290 | if ((ctl && !base) || (base && !ctl)) { | 289 | if ((ctl && !base) || (base && !ctl)) { |
| @@ -293,8 +292,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, | |||
| 293 | return NULL; | 292 | return NULL; |
| 294 | } | 293 | } |
| 295 | } | 294 | } |
| 296 | if (!ctl) | 295 | if (!ctl) { |
| 297 | { | ||
| 298 | /* Use default values */ | 296 | /* Use default values */ |
| 299 | ctl = port ? 0x374 : 0x3f4; | 297 | ctl = port ? 0x374 : 0x3f4; |
| 300 | base = port ? 0x170 : 0x1f0; | 298 | base = port ? 0x170 : 0x1f0; |
| @@ -345,9 +343,9 @@ void ide_hwif_setup_dma(ide_hwif_t *hwif, const struct ide_port_info *d) | |||
| 345 | unsigned long dma_base = ide_get_or_set_dma_base(d, hwif); | 343 | unsigned long dma_base = ide_get_or_set_dma_base(d, hwif); |
| 346 | if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) { | 344 | if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) { |
| 347 | /* | 345 | /* |
| 348 | * Set up BM-DMA capability | 346 | * Set up BM-DMA capability |
| 349 | * (PnP BIOS should have done this) | 347 | * (PnP BIOS should have done this) |
| 350 | */ | 348 | */ |
| 351 | pci_set_master(dev); | 349 | pci_set_master(dev); |
| 352 | if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || !(pcicmd & PCI_COMMAND_MASTER)) { | 350 | if (pci_read_config_word(dev, PCI_COMMAND, &pcicmd) || !(pcicmd & PCI_COMMAND_MASTER)) { |
| 353 | printk(KERN_ERR "%s: %s error updating PCICMD\n", | 351 | printk(KERN_ERR "%s: %s error updating PCICMD\n", |
| @@ -452,7 +450,6 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int | |||
| 452 | *(idx + port) = hwif->index; | 450 | *(idx + port) = hwif->index; |
| 453 | } | 451 | } |
| 454 | } | 452 | } |
| 455 | |||
| 456 | EXPORT_SYMBOL_GPL(ide_pci_setup_ports); | 453 | EXPORT_SYMBOL_GPL(ide_pci_setup_ports); |
| 457 | 454 | ||
| 458 | /* | 455 | /* |
| @@ -535,7 +532,6 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d) | |||
| 535 | 532 | ||
| 536 | return ret; | 533 | return ret; |
| 537 | } | 534 | } |
| 538 | |||
| 539 | EXPORT_SYMBOL_GPL(ide_setup_pci_device); | 535 | EXPORT_SYMBOL_GPL(ide_setup_pci_device); |
| 540 | 536 | ||
| 541 | int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, | 537 | int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, |
| @@ -559,5 +555,4 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, | |||
| 559 | out: | 555 | out: |
| 560 | return ret; | 556 | return ret; |
| 561 | } | 557 | } |
| 562 | |||
| 563 | EXPORT_SYMBOL_GPL(ide_setup_pci_devices); | 558 | EXPORT_SYMBOL_GPL(ide_setup_pci_devices); |
