diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-26 16:44:19 -0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-26 16:44:19 -0400 | 
| commit | a52b0d25a722e84da999005b75f972aa4824253c (patch) | |
| tree | 4a3a48305f744e6bde2e3fd663a4473dd712049c /drivers/ide/ide.c | |
| parent | 539a5fe22620a1665cce504167953a71a43232ad (diff) | |
| parent | f37afdaca711838b50ecd89b9c15fc745270d77c (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (46 commits)
  ide: constify struct ide_dma_ops
  ide: add struct ide_dma_ops (take 3)
  ide: add IDE_HFLAG_SERIALIZE_DMA host flag
  sl82c105: check bridge revision in sl82c105_init_one()
  au1xxx-ide: use ->init_dma method
  palm_bk3710: use ->init_dma method
  sgiioc4: use ->init_dma method
  icside: use ->init_dma method
  ide-pmac: use ->init_dma method
  ide: do complete DMA setup in ->init_dma method (take 2)
  au1xxx-ide: fix MWDMA support
  ide: cleanup ide_setup_dma()
  ide: factor out setting PCI bus-mastering from ide_hwif_setup_dma()
  ide: export ide_allocate_dma_engine()
  ide: move ide_setup_dma() call out from ->init_dma method
  alim15x3: skip DMA initialization completely on revs < 0x20
  pdc202xx_old: remove init_dma_pdc202xx()
  ide: don't display "BIOS" settings in ide_setup_dma()
  ide: remove ->cds field from ide_hwif_t (take 2)
  ide: remove ide_dma_iobase()
  ...
Diffstat (limited to 'drivers/ide/ide.c')
| -rw-r--r-- | drivers/ide/ide.c | 86 | 
1 files changed, 4 insertions, 82 deletions
| diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index d868ca44d033..bced02f9f2c3 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -227,79 +227,6 @@ static int ide_system_bus_speed(void) | |||
| 227 | return pci_dev_present(pci_default) ? 33 : 50; | 227 | return pci_dev_present(pci_default) ? 33 : 50; | 
| 228 | } | 228 | } | 
| 229 | 229 | ||
| 230 | static struct resource* hwif_request_region(ide_hwif_t *hwif, | ||
| 231 | unsigned long addr, int num) | ||
| 232 | { | ||
| 233 | struct resource *res = request_region(addr, num, hwif->name); | ||
| 234 | |||
| 235 | if (!res) | ||
| 236 | printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n", | ||
| 237 | hwif->name, addr, addr+num-1); | ||
| 238 | return res; | ||
| 239 | } | ||
| 240 | |||
| 241 | /** | ||
| 242 | * ide_hwif_request_regions - request resources for IDE | ||
| 243 | * @hwif: interface to use | ||
| 244 | * | ||
| 245 | * Requests all the needed resources for an interface. | ||
| 246 | * Right now core IDE code does this work which is deeply wrong. | ||
| 247 | * MMIO leaves it to the controller driver, | ||
| 248 | * PIO will migrate this way over time. | ||
| 249 | */ | ||
| 250 | |||
| 251 | int ide_hwif_request_regions(ide_hwif_t *hwif) | ||
| 252 | { | ||
| 253 | unsigned long addr; | ||
| 254 | |||
| 255 | if (hwif->mmio) | ||
| 256 | return 0; | ||
| 257 | |||
| 258 | addr = hwif->io_ports[IDE_CONTROL_OFFSET]; | ||
| 259 | |||
| 260 | if (addr && !hwif_request_region(hwif, addr, 1)) | ||
| 261 | goto control_region_busy; | ||
| 262 | |||
| 263 | addr = hwif->io_ports[IDE_DATA_OFFSET]; | ||
| 264 | BUG_ON((addr | 7) != hwif->io_ports[IDE_STATUS_OFFSET]); | ||
| 265 | |||
| 266 | if (!hwif_request_region(hwif, addr, 8)) | ||
| 267 | goto data_region_busy; | ||
| 268 | |||
| 269 | return 0; | ||
| 270 | |||
| 271 | data_region_busy: | ||
| 272 | addr = hwif->io_ports[IDE_CONTROL_OFFSET]; | ||
| 273 | if (addr) | ||
| 274 | release_region(addr, 1); | ||
| 275 | control_region_busy: | ||
| 276 | /* If any errors are return, we drop the hwif interface. */ | ||
| 277 | return -EBUSY; | ||
| 278 | } | ||
| 279 | |||
| 280 | /** | ||
| 281 | * ide_hwif_release_regions - free IDE resources | ||
| 282 | * | ||
| 283 | * Note that we only release the standard ports, | ||
| 284 | * and do not even try to handle any extra ports | ||
| 285 | * allocated for weird IDE interface chipsets. | ||
| 286 | * | ||
| 287 | * Note also that we don't yet handle mmio resources here. More | ||
| 288 | * importantly our caller should be doing this so we need to | ||
| 289 | * restructure this as a helper function for drivers. | ||
| 290 | */ | ||
| 291 | |||
| 292 | void ide_hwif_release_regions(ide_hwif_t *hwif) | ||
| 293 | { | ||
| 294 | if (hwif->mmio) | ||
| 295 | return; | ||
| 296 | |||
| 297 | if (hwif->io_ports[IDE_CONTROL_OFFSET]) | ||
| 298 | release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1); | ||
| 299 | |||
| 300 | release_region(hwif->io_ports[IDE_DATA_OFFSET], 8); | ||
| 301 | } | ||
| 302 | |||
| 303 | void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | 230 | void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | 
| 304 | { | 231 | { | 
| 305 | ide_hwgroup_t *hwgroup = hwif->hwgroup; | 232 | ide_hwgroup_t *hwgroup = hwif->hwgroup; | 
| @@ -436,9 +363,7 @@ void ide_unregister(unsigned int index) | |||
| 436 | spin_lock_irq(&ide_lock); | 363 | spin_lock_irq(&ide_lock); | 
| 437 | 364 | ||
| 438 | if (hwif->dma_base) | 365 | if (hwif->dma_base) | 
| 439 | (void)ide_release_dma(hwif); | 366 | ide_release_dma_engine(hwif); | 
| 440 | |||
| 441 | ide_hwif_release_regions(hwif); | ||
| 442 | 367 | ||
| 443 | /* restore hwif data to pristine status */ | 368 | /* restore hwif data to pristine status */ | 
| 444 | ide_init_port_data(hwif, index); | 369 | ide_init_port_data(hwif, index); | 
| @@ -454,7 +379,6 @@ void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) | |||
| 454 | { | 379 | { | 
| 455 | memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); | 380 | memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); | 
| 456 | hwif->irq = hw->irq; | 381 | hwif->irq = hw->irq; | 
| 457 | hwif->noprobe = 0; | ||
| 458 | hwif->chipset = hw->chipset; | 382 | hwif->chipset = hw->chipset; | 
| 459 | hwif->gendev.parent = hw->dev; | 383 | hwif->gendev.parent = hw->dev; | 
| 460 | hwif->ack_intr = hw->ack_intr; | 384 | hwif->ack_intr = hw->ack_intr; | 
| @@ -545,7 +469,7 @@ int set_using_dma(ide_drive_t *drive, int arg) | |||
| 545 | if (!drive->id || !(drive->id->capability & 1)) | 469 | if (!drive->id || !(drive->id->capability & 1)) | 
| 546 | goto out; | 470 | goto out; | 
| 547 | 471 | ||
| 548 | if (hwif->dma_host_set == NULL) | 472 | if (hwif->dma_ops == NULL) | 
| 549 | goto out; | 473 | goto out; | 
| 550 | 474 | ||
| 551 | err = -EBUSY; | 475 | err = -EBUSY; | 
| @@ -585,11 +509,12 @@ int set_pio_mode(ide_drive_t *drive, int arg) | |||
| 585 | { | 509 | { | 
| 586 | struct request rq; | 510 | struct request rq; | 
| 587 | ide_hwif_t *hwif = drive->hwif; | 511 | ide_hwif_t *hwif = drive->hwif; | 
| 512 | const struct ide_port_ops *port_ops = hwif->port_ops; | ||
| 588 | 513 | ||
| 589 | if (arg < 0 || arg > 255) | 514 | if (arg < 0 || arg > 255) | 
| 590 | return -EINVAL; | 515 | return -EINVAL; | 
| 591 | 516 | ||
| 592 | if (hwif->set_pio_mode == NULL || | 517 | if (port_ops == NULL || port_ops->set_pio_mode == NULL || | 
| 593 | (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) | 518 | (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) | 
| 594 | return -ENOSYS; | 519 | return -ENOSYS; | 
| 595 | 520 | ||
| @@ -1005,14 +930,12 @@ static int __init ide_setup(char *s) | |||
| 1005 | goto done; | 930 | goto done; | 
| 1006 | case -3: /* "nowerr" */ | 931 | case -3: /* "nowerr" */ | 
| 1007 | drive->bad_wstat = BAD_R_STAT; | 932 | drive->bad_wstat = BAD_R_STAT; | 
| 1008 | hwif->noprobe = 0; | ||
| 1009 | goto done; | 933 | goto done; | 
| 1010 | case -4: /* "cdrom" */ | 934 | case -4: /* "cdrom" */ | 
| 1011 | drive->present = 1; | 935 | drive->present = 1; | 
| 1012 | drive->media = ide_cdrom; | 936 | drive->media = ide_cdrom; | 
| 1013 | /* an ATAPI device ignores DRDY */ | 937 | /* an ATAPI device ignores DRDY */ | 
| 1014 | drive->ready_stat = 0; | 938 | drive->ready_stat = 0; | 
| 1015 | hwif->noprobe = 0; | ||
| 1016 | goto done; | 939 | goto done; | 
| 1017 | case -5: /* nodma */ | 940 | case -5: /* nodma */ | 
| 1018 | drive->nodma = 1; | 941 | drive->nodma = 1; | 
| @@ -1043,7 +966,6 @@ static int __init ide_setup(char *s) | |||
| 1043 | drive->sect = drive->bios_sect = vals[2]; | 966 | drive->sect = drive->bios_sect = vals[2]; | 
| 1044 | drive->present = 1; | 967 | drive->present = 1; | 
| 1045 | drive->forced_geom = 1; | 968 | drive->forced_geom = 1; | 
| 1046 | hwif->noprobe = 0; | ||
| 1047 | goto done; | 969 | goto done; | 
| 1048 | default: | 970 | default: | 
| 1049 | goto bad_option; | 971 | goto bad_option; | 
