ide: remove obsoleted "idex=serialize" kernel parameter
[firefly-linux-kernel-4.4.55.git] / drivers / ide / ide.c
index 917c72dcd33dccc806c42c20d9662750ebe52b89..3cac96f3b0aa02e51a2c7be7b41311d015a03131 100644 (file)
@@ -100,13 +100,8 @@ int ide_noacpitfs = 1;
 int ide_noacpionboot = 1;
 #endif
 
-/*
- * This is declared extern in ide.h, for access by other IDE modules:
- */
 ide_hwif_t ide_hwifs[MAX_HWIFS];       /* master data repository */
 
-EXPORT_SYMBOL(ide_hwifs);
-
 static void ide_port_init_devices_data(ide_hwif_t *);
 
 /*
@@ -232,117 +227,6 @@ static int ide_system_bus_speed(void)
        return pci_dev_present(pci_default) ? 33 : 50;
 }
 
-ide_hwif_t * ide_find_port(unsigned long base)
-{
-       ide_hwif_t *hwif;
-       int i;
-
-       for (i = 0; i < MAX_HWIFS; i++) {
-               hwif = &ide_hwifs[i];
-               if (hwif->io_ports[IDE_DATA_OFFSET] == base)
-                       goto found;
-       }
-
-       for (i = 0; i < MAX_HWIFS; i++) {
-               hwif = &ide_hwifs[i];
-               if (hwif->chipset == ide_unknown)
-                       goto found;
-       }
-
-       hwif = NULL;
-found:
-       return hwif;
-}
-
-EXPORT_SYMBOL_GPL(ide_find_port);
-
-static struct resource* hwif_request_region(ide_hwif_t *hwif,
-                                           unsigned long addr, int num)
-{
-       struct resource *res = request_region(addr, num, hwif->name);
-
-       if (!res)
-               printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
-                               hwif->name, addr, addr+num-1);
-       return res;
-}
-
-/**
- *     ide_hwif_request_regions - request resources for IDE
- *     @hwif: interface to use
- *
- *     Requests all the needed resources for an interface.
- *     Right now core IDE code does this work which is deeply wrong.
- *     MMIO leaves it to the controller driver,
- *     PIO will migrate this way over time.
- */
-
-int ide_hwif_request_regions(ide_hwif_t *hwif)
-{
-       unsigned long addr;
-       unsigned int i;
-
-       if (hwif->mmio)
-               return 0;
-       addr = hwif->io_ports[IDE_CONTROL_OFFSET];
-       if (addr && !hwif_request_region(hwif, addr, 1))
-               goto control_region_busy;
-       hwif->straight8 = 0;
-       addr = hwif->io_ports[IDE_DATA_OFFSET];
-       if ((addr | 7) == hwif->io_ports[IDE_STATUS_OFFSET]) {
-               if (!hwif_request_region(hwif, addr, 8))
-                       goto data_region_busy;
-               hwif->straight8 = 1;
-               return 0;
-       }
-       for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-               addr = hwif->io_ports[i];
-               if (!hwif_request_region(hwif, addr, 1)) {
-                       while (--i)
-                               release_region(addr, 1);
-                       goto data_region_busy;
-               }
-       }
-       return 0;
-
-data_region_busy:
-       addr = hwif->io_ports[IDE_CONTROL_OFFSET];
-       if (addr)
-               release_region(addr, 1);
-control_region_busy:
-       /* If any errors are return, we drop the hwif interface. */
-       return -EBUSY;
-}
-
-/**
- *     ide_hwif_release_regions - free IDE resources
- *
- *     Note that we only release the standard ports,
- *     and do not even try to handle any extra ports
- *     allocated for weird IDE interface chipsets.
- *
- *     Note also that we don't yet handle mmio resources here. More
- *     importantly our caller should be doing this so we need to 
- *     restructure this as a helper function for drivers.
- */
-
-void ide_hwif_release_regions(ide_hwif_t *hwif)
-{
-       u32 i = 0;
-
-       if (hwif->mmio)
-               return;
-       if (hwif->io_ports[IDE_CONTROL_OFFSET])
-               release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1);
-       if (hwif->straight8) {
-               release_region(hwif->io_ports[IDE_DATA_OFFSET], 8);
-               return;
-       }
-       for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
-               if (hwif->io_ports[i])
-                       release_region(hwif->io_ports[i], 1);
-}
-
 void ide_remove_port_from_hwgroup(ide_hwif_t *hwif)
 {
        ide_hwgroup_t *hwgroup = hwif->hwgroup;
@@ -479,9 +363,7 @@ void ide_unregister(unsigned int index)
        spin_lock_irq(&ide_lock);
 
        if (hwif->dma_base)
-               (void)ide_release_dma(hwif);
-
-       ide_hwif_release_regions(hwif);
+               ide_release_dma_engine(hwif);
 
        /* restore hwif data to pristine status */
        ide_init_port_data(hwif, index);
@@ -497,7 +379,6 @@ void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw)
 {
        memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
        hwif->irq = hw->irq;
-       hwif->noprobe = 0;
        hwif->chipset = hw->chipset;
        hwif->gendev.parent = hw->dev;
        hwif->ack_intr = hw->ack_intr;
@@ -588,7 +469,7 @@ int set_using_dma(ide_drive_t *drive, int arg)
        if (!drive->id || !(drive->id->capability & 1))
                goto out;
 
-       if (hwif->dma_host_set == NULL)
+       if (hwif->dma_ops == NULL)
                goto out;
 
        err = -EBUSY;
@@ -627,11 +508,14 @@ out:
 int set_pio_mode(ide_drive_t *drive, int arg)
 {
        struct request rq;
+       ide_hwif_t *hwif = drive->hwif;
+       const struct ide_port_ops *port_ops = hwif->port_ops;
 
        if (arg < 0 || arg > 255)
                return -EINVAL;
 
-       if (drive->hwif->set_pio_mode == NULL)
+       if (port_ops == NULL || port_ops->set_pio_mode == NULL ||
+           (hwif->host_flags & IDE_HFLAG_NO_SET_MODE))
                return -ENOSYS;
 
        if (drive->special.b.set_tune)
@@ -1046,14 +930,12 @@ static int __init ide_setup(char *s)
                                goto done;
                        case -3: /* "nowerr" */
                                drive->bad_wstat = BAD_R_STAT;
-                               hwif->noprobe = 0;
                                goto done;
                        case -4: /* "cdrom" */
                                drive->present = 1;
                                drive->media = ide_cdrom;
                                /* an ATAPI device ignores DRDY */
                                drive->ready_stat = 0;
-                               hwif->noprobe = 0;
                                goto done;
                        case -5: /* nodma */
                                drive->nodma = 1;
@@ -1084,7 +966,6 @@ static int __init ide_setup(char *s)
                                drive->sect     = drive->bios_sect = vals[2];
                                drive->present  = 1;
                                drive->forced_geom = 1;
-                               hwif->noprobe = 0;
                                goto done;
                        default:
                                goto bad_option;
@@ -1114,7 +995,7 @@ static int __init ide_setup(char *s)
                 * (-8, -9, -10) are reserved to ease the hardcoding.
                 */
                static const char *ide_words[] = {
-                       "minus1", "serialize", "minus3", "minus4",
+                       "minus1", "minus2", "minus3", "minus4",
                        "reset", "minus6", "ata66", "minus8", "minus9",
                        "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb",
                        "dtc2278", "umc8672", "ali14xx", NULL };
@@ -1195,12 +1076,7 @@ static int __init ide_setup(char *s)
                        case -5: /* "reset" */
                                hwif->reset = 1;
                                goto obsolete_option;
-                       case -2: /* "serialize" */
-                               hwif->mate = &ide_hwifs[hw^1];
-                               hwif->mate->mate = hwif;
-                               hwif->serialized = hwif->mate->serialized = 1;
-                               goto obsolete_option;
-
+                       case -2:
                        case -1:
                        case 0:
                        case 1:
@@ -1358,6 +1234,38 @@ static void ide_port_class_release(struct device *portdev)
        put_device(&hwif->gendev);
 }
 
+static unsigned int ide_ignore_cable;
+
+static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
+{
+       int i, j = 1;
+
+       if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1)
+               return -EINVAL;
+
+       if (i >= MAX_HWIFS || j < 0 || j > 1)
+               return -EINVAL;
+
+       if (j)
+               ide_ignore_cable |= (1 << i);
+       else
+               ide_ignore_cable &= (1 << i);
+
+       return 0;
+}
+
+module_param_call(ignore_cable, ide_set_ignore_cable, NULL, NULL, 0);
+MODULE_PARM_DESC(ignore_cable, "ignore cable detection");
+
+void ide_port_apply_params(ide_hwif_t *hwif)
+{
+       if (ide_ignore_cable & (1 << hwif->index)) {
+               printk(KERN_INFO "ide: ignoring cable detection for %s\n",
+                                hwif->name);
+               hwif->cbl = ATA_CBL_PATA40_SHORT;
+       }
+}
+
 /*
  * This is gets invoked once during initialization, to set *everything* up
  */