aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 235ebdb29b28..9d8686a49fcf 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1501,7 +1501,7 @@ out_found:
1501} 1501}
1502EXPORT_SYMBOL_GPL(ide_find_port_slot); 1502EXPORT_SYMBOL_GPL(ide_find_port_slot);
1503 1503
1504int ide_device_add_all(u8 *idx, const struct ide_port_info *d) 1504int ide_device_add_all(u8 *idx, const struct ide_port_info *d, hw_regs_t **hws)
1505{ 1505{
1506 ide_hwif_t *hwif, *mate = NULL; 1506 ide_hwif_t *hwif, *mate = NULL;
1507 int i, rc = 0; 1507 int i, rc = 0;
@@ -1514,6 +1514,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1514 1514
1515 hwif = &ide_hwifs[idx[i]]; 1515 hwif = &ide_hwifs[idx[i]];
1516 1516
1517 ide_init_port_hw(hwif, hws[i]);
1517 ide_port_apply_params(hwif); 1518 ide_port_apply_params(hwif);
1518 1519
1519 if (d == NULL) { 1520 if (d == NULL) {
@@ -1603,15 +1604,18 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1603} 1604}
1604EXPORT_SYMBOL_GPL(ide_device_add_all); 1605EXPORT_SYMBOL_GPL(ide_device_add_all);
1605 1606
1606int ide_device_add(u8 idx[4], const struct ide_port_info *d) 1607int ide_device_add(u8 *idx, const struct ide_port_info *d, hw_regs_t **hws)
1607{ 1608{
1609 hw_regs_t *hws_all[MAX_HWIFS];
1608 u8 idx_all[MAX_HWIFS]; 1610 u8 idx_all[MAX_HWIFS];
1609 int i; 1611 int i;
1610 1612
1611 for (i = 0; i < MAX_HWIFS; i++) 1613 for (i = 0; i < MAX_HWIFS; i++) {
1614 hws_all[i] = (i < 4) ? hws[i] : NULL;
1612 idx_all[i] = (i < 4) ? idx[i] : 0xff; 1615 idx_all[i] = (i < 4) ? idx[i] : 0xff;
1616 }
1613 1617
1614 return ide_device_add_all(idx_all, d); 1618 return ide_device_add_all(idx_all, d, hws_all);
1615} 1619}
1616EXPORT_SYMBOL_GPL(ide_device_add); 1620EXPORT_SYMBOL_GPL(ide_device_add);
1617 1621
@@ -1634,8 +1638,8 @@ void ide_port_scan(ide_hwif_t *hwif)
1634} 1638}
1635EXPORT_SYMBOL_GPL(ide_port_scan); 1639EXPORT_SYMBOL_GPL(ide_port_scan);
1636 1640
1637static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no, 1641static void ide_legacy_init_one(u8 *idx, hw_regs_t **hws, hw_regs_t *hw,
1638 const struct ide_port_info *d, 1642 u8 port_no, const struct ide_port_info *d,
1639 unsigned long config) 1643 unsigned long config)
1640{ 1644{
1641 ide_hwif_t *hwif; 1645 ide_hwif_t *hwif;
@@ -1671,9 +1675,12 @@ static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no,
1671 1675
1672 hwif = ide_find_port_slot(d); 1676 hwif = ide_find_port_slot(d);
1673 if (hwif) { 1677 if (hwif) {
1674 ide_init_port_hw(hwif, hw); 1678 hwif->chipset = hw->chipset;
1679
1675 if (config) 1680 if (config)
1676 hwif->config_data = config; 1681 hwif->config_data = config;
1682
1683 hws[port_no] = hw;
1677 idx[port_no] = hwif->index; 1684 idx[port_no] = hwif->index;
1678 } 1685 }
1679} 1686}
@@ -1681,19 +1688,19 @@ static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no,
1681int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) 1688int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config)
1682{ 1689{
1683 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 1690 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
1684 hw_regs_t hw[2]; 1691 hw_regs_t hw[2], *hws[] = { NULL, NULL, NULL, NULL };
1685 1692
1686 memset(&hw, 0, sizeof(hw)); 1693 memset(&hw, 0, sizeof(hw));
1687 1694
1688 if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0) 1695 if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0)
1689 ide_legacy_init_one(idx, &hw[0], 0, d, config); 1696 ide_legacy_init_one(idx, hws, &hw[0], 0, d, config);
1690 ide_legacy_init_one(idx, &hw[1], 1, d, config); 1697 ide_legacy_init_one(idx, hws, &hw[1], 1, d, config);
1691 1698
1692 if (idx[0] == 0xff && idx[1] == 0xff && 1699 if (idx[0] == 0xff && idx[1] == 0xff &&
1693 (d->host_flags & IDE_HFLAG_SINGLE)) 1700 (d->host_flags & IDE_HFLAG_SINGLE))
1694 return -ENOENT; 1701 return -ENOENT;
1695 1702
1696 ide_device_add(idx, d); 1703 ide_device_add(idx, d, hws);
1697 1704
1698 return 0; 1705 return 0;
1699} 1706}