|
@@ -289,7 +289,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * ide_hwif_configure - configure an IDE interface
|
|
|
|
|
|
+ * ide_hw_configure - configure a hw_regs_t instance
|
|
* @dev: PCI device holding interface
|
|
* @dev: PCI device holding interface
|
|
* @d: IDE port info
|
|
* @d: IDE port info
|
|
* @port: port number
|
|
* @port: port number
|
|
@@ -300,23 +300,20 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *
|
|
* is done per interface port rather than per PCI device. There may be
|
|
* is done per interface port rather than per PCI device. There may be
|
|
* more than one port per device.
|
|
* more than one port per device.
|
|
*
|
|
*
|
|
- * Returns the new hardware interface structure, or NULL on a failure
|
|
|
|
|
|
+ * Returns zero on success or an error code.
|
|
*/
|
|
*/
|
|
|
|
|
|
-static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
|
|
|
|
- const struct ide_port_info *d,
|
|
|
|
- unsigned int port, int irq,
|
|
|
|
- hw_regs_t *hw)
|
|
|
|
|
|
+static int ide_hw_configure(struct pci_dev *dev, const struct ide_port_info *d,
|
|
|
|
+ unsigned int port, int irq, hw_regs_t *hw)
|
|
{
|
|
{
|
|
unsigned long ctl = 0, base = 0;
|
|
unsigned long ctl = 0, base = 0;
|
|
- ide_hwif_t *hwif;
|
|
|
|
|
|
|
|
if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) {
|
|
if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) {
|
|
if (ide_pci_check_iomem(dev, d, 2 * port) ||
|
|
if (ide_pci_check_iomem(dev, d, 2 * port) ||
|
|
ide_pci_check_iomem(dev, d, 2 * port + 1)) {
|
|
ide_pci_check_iomem(dev, d, 2 * port + 1)) {
|
|
printk(KERN_ERR "%s: I/O baseregs (BIOS) are reported "
|
|
printk(KERN_ERR "%s: I/O baseregs (BIOS) are reported "
|
|
"as MEM for port %d!\n", d->name, port);
|
|
"as MEM for port %d!\n", d->name, port);
|
|
- return NULL;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
ctl = pci_resource_start(dev, 2*port+1);
|
|
ctl = pci_resource_start(dev, 2*port+1);
|
|
@@ -330,7 +327,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
|
|
if (!base || !ctl) {
|
|
if (!base || !ctl) {
|
|
printk(KERN_ERR "%s: bad PCI BARs for port %d, skipping\n",
|
|
printk(KERN_ERR "%s: bad PCI BARs for port %d, skipping\n",
|
|
d->name, port);
|
|
d->name, port);
|
|
- return NULL;
|
|
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
memset(hw, 0, sizeof(*hw));
|
|
memset(hw, 0, sizeof(*hw));
|
|
@@ -339,13 +336,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
|
|
hw->chipset = d->chipset ? d->chipset : ide_pci;
|
|
hw->chipset = d->chipset ? d->chipset : ide_pci;
|
|
ide_std_init_ports(hw, base, ctl | 2);
|
|
ide_std_init_ports(hw, base, ctl | 2);
|
|
|
|
|
|
- hwif = ide_find_port_slot(d);
|
|
|
|
- if (hwif == NULL)
|
|
|
|
- return NULL;
|
|
|
|
-
|
|
|
|
- hwif->chipset = hw->chipset;
|
|
|
|
-
|
|
|
|
- return hwif;
|
|
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
|
|
#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
|
|
@@ -443,7 +434,6 @@ out:
|
|
* @dev: PCI device
|
|
* @dev: PCI device
|
|
* @d: IDE port info
|
|
* @d: IDE port info
|
|
* @pciirq: IRQ line
|
|
* @pciirq: IRQ line
|
|
- * @idx: ATA index table to update
|
|
|
|
* @hw: hw_regs_t instances corresponding to this PCI IDE device
|
|
* @hw: hw_regs_t instances corresponding to this PCI IDE device
|
|
* @hws: hw_regs_t pointers table to update
|
|
* @hws: hw_regs_t pointers table to update
|
|
*
|
|
*
|
|
@@ -457,10 +447,9 @@ out:
|
|
*/
|
|
*/
|
|
|
|
|
|
void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d,
|
|
void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d,
|
|
- int pciirq, u8 *idx, hw_regs_t *hw, hw_regs_t **hws)
|
|
|
|
|
|
+ int pciirq, hw_regs_t *hw, hw_regs_t **hws)
|
|
{
|
|
{
|
|
int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
|
|
int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
|
|
- ide_hwif_t *hwif;
|
|
|
|
u8 tmp;
|
|
u8 tmp;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -476,12 +465,10 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d,
|
|
continue; /* port not enabled */
|
|
continue; /* port not enabled */
|
|
}
|
|
}
|
|
|
|
|
|
- hwif = ide_hwif_configure(dev, d, port, pciirq, hw + port);
|
|
|
|
- if (hwif == NULL)
|
|
|
|
|
|
+ if (ide_hw_configure(dev, d, port, pciirq, hw + port))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
*(hws + port) = hw + port;
|
|
*(hws + port) = hw + port;
|
|
- *(idx + port) = hwif->index;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
|
|
EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
|
|
@@ -554,7 +541,7 @@ out:
|
|
|
|
|
|
int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
|
|
int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
|
|
{
|
|
{
|
|
- u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
|
|
|
|
|
|
+ struct ide_host *host;
|
|
hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL };
|
|
hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL };
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
@@ -562,9 +549,11 @@ int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
|
|
|
|
|
|
if (ret >= 0) {
|
|
if (ret >= 0) {
|
|
/* FIXME: silent failure can happen */
|
|
/* FIXME: silent failure can happen */
|
|
- ide_pci_setup_ports(dev, d, ret, &idx[0], &hw[0], &hws[0]);
|
|
|
|
|
|
+ ide_pci_setup_ports(dev, d, ret, &hw[0], &hws[0]);
|
|
|
|
|
|
- ide_device_add(idx, d, hws);
|
|
|
|
|
|
+ host = ide_host_alloc(d, hws);
|
|
|
|
+ if (host)
|
|
|
|
+ ide_host_register(host, d, hws);
|
|
}
|
|
}
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
@@ -575,9 +564,9 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
|
|
const struct ide_port_info *d)
|
|
const struct ide_port_info *d)
|
|
{
|
|
{
|
|
struct pci_dev *pdev[] = { dev1, dev2 };
|
|
struct pci_dev *pdev[] = { dev1, dev2 };
|
|
|
|
+ struct ide_host *host;
|
|
int ret, i;
|
|
int ret, i;
|
|
hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL };
|
|
hw_regs_t hw[4], *hws[] = { NULL, NULL, NULL, NULL };
|
|
- u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
for (i = 0; i < 2; i++) {
|
|
ret = do_ide_setup_pci_device(pdev[i], d, !i);
|
|
ret = do_ide_setup_pci_device(pdev[i], d, !i);
|
|
@@ -590,11 +579,12 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
/* FIXME: silent failure can happen */
|
|
/* FIXME: silent failure can happen */
|
|
- ide_pci_setup_ports(pdev[i], d, ret, &idx[i*2], &hw[i*2],
|
|
|
|
- &hws[i*2]);
|
|
|
|
|
|
+ ide_pci_setup_ports(pdev[i], d, ret, &hw[i*2], &hws[i*2]);
|
|
}
|
|
}
|
|
|
|
|
|
- ide_device_add(idx, d, hws);
|
|
|
|
|
|
+ host = ide_host_alloc(d, hws);
|
|
|
|
+ if (host)
|
|
|
|
+ ide_host_register(host, d, hws);
|
|
out:
|
|
out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|