diff options
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 474 |
1 files changed, 240 insertions, 234 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index c5adb7b9c5b5..0ccbb4459fb9 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -189,7 +189,7 @@ static void ide_classify_atapi_dev(ide_drive_t *drive) | |||
189 | 189 | ||
190 | static void do_identify(ide_drive_t *drive, u8 cmd) | 190 | static void do_identify(ide_drive_t *drive, u8 cmd) |
191 | { | 191 | { |
192 | ide_hwif_t *hwif = HWIF(drive); | 192 | ide_hwif_t *hwif = drive->hwif; |
193 | u16 *id = drive->id; | 193 | u16 *id = drive->id; |
194 | char *m = (char *)&id[ATA_ID_PROD]; | 194 | char *m = (char *)&id[ATA_ID_PROD]; |
195 | unsigned long flags; | 195 | unsigned long flags; |
@@ -266,7 +266,7 @@ err_misc: | |||
266 | 266 | ||
267 | static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | 267 | static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) |
268 | { | 268 | { |
269 | ide_hwif_t *hwif = HWIF(drive); | 269 | ide_hwif_t *hwif = drive->hwif; |
270 | struct ide_io_ports *io_ports = &hwif->io_ports; | 270 | struct ide_io_ports *io_ports = &hwif->io_ports; |
271 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 271 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
272 | int use_altstatus = 0, rc; | 272 | int use_altstatus = 0, rc; |
@@ -341,7 +341,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | |||
341 | 341 | ||
342 | static int try_to_identify (ide_drive_t *drive, u8 cmd) | 342 | static int try_to_identify (ide_drive_t *drive, u8 cmd) |
343 | { | 343 | { |
344 | ide_hwif_t *hwif = HWIF(drive); | 344 | ide_hwif_t *hwif = drive->hwif; |
345 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 345 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
346 | int retval; | 346 | int retval; |
347 | int autoprobe = 0; | 347 | int autoprobe = 0; |
@@ -438,7 +438,7 @@ static u8 ide_read_device(ide_drive_t *drive) | |||
438 | 438 | ||
439 | static int do_probe (ide_drive_t *drive, u8 cmd) | 439 | static int do_probe (ide_drive_t *drive, u8 cmd) |
440 | { | 440 | { |
441 | ide_hwif_t *hwif = HWIF(drive); | 441 | ide_hwif_t *hwif = drive->hwif; |
442 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 442 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
443 | int rc; | 443 | int rc; |
444 | u8 present = !!(drive->dev_flags & IDE_DFLAG_PRESENT), stat; | 444 | u8 present = !!(drive->dev_flags & IDE_DFLAG_PRESENT), stat; |
@@ -463,7 +463,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
463 | if (ide_read_device(drive) != drive->select && present == 0) { | 463 | if (ide_read_device(drive) != drive->select && present == 0) { |
464 | if (drive->dn & 1) { | 464 | if (drive->dn & 1) { |
465 | /* exit with drive0 selected */ | 465 | /* exit with drive0 selected */ |
466 | SELECT_DRIVE(&hwif->drives[0]); | 466 | SELECT_DRIVE(hwif->devices[0]); |
467 | /* allow ATA_BUSY to assert & clear */ | 467 | /* allow ATA_BUSY to assert & clear */ |
468 | msleep(50); | 468 | msleep(50); |
469 | } | 469 | } |
@@ -509,7 +509,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
509 | } | 509 | } |
510 | if (drive->dn & 1) { | 510 | if (drive->dn & 1) { |
511 | /* exit with drive0 selected */ | 511 | /* exit with drive0 selected */ |
512 | SELECT_DRIVE(&hwif->drives[0]); | 512 | SELECT_DRIVE(hwif->devices[0]); |
513 | msleep(50); | 513 | msleep(50); |
514 | /* ensure drive irq is clear */ | 514 | /* ensure drive irq is clear */ |
515 | (void)tp_ops->read_status(hwif); | 515 | (void)tp_ops->read_status(hwif); |
@@ -522,7 +522,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd) | |||
522 | */ | 522 | */ |
523 | static void enable_nest (ide_drive_t *drive) | 523 | static void enable_nest (ide_drive_t *drive) |
524 | { | 524 | { |
525 | ide_hwif_t *hwif = HWIF(drive); | 525 | ide_hwif_t *hwif = drive->hwif; |
526 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 526 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
527 | u8 stat; | 527 | u8 stat; |
528 | 528 | ||
@@ -697,7 +697,8 @@ out: | |||
697 | 697 | ||
698 | static int ide_port_wait_ready(ide_hwif_t *hwif) | 698 | static int ide_port_wait_ready(ide_hwif_t *hwif) |
699 | { | 699 | { |
700 | int unit, rc; | 700 | ide_drive_t *drive; |
701 | int i, rc; | ||
701 | 702 | ||
702 | printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); | 703 | printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); |
703 | 704 | ||
@@ -714,9 +715,7 @@ static int ide_port_wait_ready(ide_hwif_t *hwif) | |||
714 | return rc; | 715 | return rc; |
715 | 716 | ||
716 | /* Now make sure both master & slave are ready */ | 717 | /* Now make sure both master & slave are ready */ |
717 | for (unit = 0; unit < MAX_DRIVES; unit++) { | 718 | ide_port_for_each_dev(i, drive, hwif) { |
718 | ide_drive_t *drive = &hwif->drives[unit]; | ||
719 | |||
720 | /* Ignore disks that we will not probe for later. */ | 719 | /* Ignore disks that we will not probe for later. */ |
721 | if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 || | 720 | if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 || |
722 | (drive->dev_flags & IDE_DFLAG_PRESENT)) { | 721 | (drive->dev_flags & IDE_DFLAG_PRESENT)) { |
@@ -732,8 +731,8 @@ static int ide_port_wait_ready(ide_hwif_t *hwif) | |||
732 | } | 731 | } |
733 | out: | 732 | out: |
734 | /* Exit function with master reselected (let's be sane) */ | 733 | /* Exit function with master reselected (let's be sane) */ |
735 | if (unit) | 734 | if (i) |
736 | SELECT_DRIVE(&hwif->drives[0]); | 735 | SELECT_DRIVE(hwif->devices[0]); |
737 | 736 | ||
738 | return rc; | 737 | return rc; |
739 | } | 738 | } |
@@ -749,7 +748,7 @@ out: | |||
749 | 748 | ||
750 | void ide_undecoded_slave(ide_drive_t *dev1) | 749 | void ide_undecoded_slave(ide_drive_t *dev1) |
751 | { | 750 | { |
752 | ide_drive_t *dev0 = &dev1->hwif->drives[0]; | 751 | ide_drive_t *dev0 = dev1->hwif->devices[0]; |
753 | 752 | ||
754 | if ((dev1->dn & 1) == 0 || (dev0->dev_flags & IDE_DFLAG_PRESENT) == 0) | 753 | if ((dev1->dn & 1) == 0 || (dev0->dev_flags & IDE_DFLAG_PRESENT) == 0) |
755 | return; | 754 | return; |
@@ -778,14 +777,15 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave); | |||
778 | 777 | ||
779 | static int ide_probe_port(ide_hwif_t *hwif) | 778 | static int ide_probe_port(ide_hwif_t *hwif) |
780 | { | 779 | { |
780 | ide_drive_t *drive; | ||
781 | unsigned long flags; | 781 | unsigned long flags; |
782 | unsigned int irqd; | 782 | unsigned int irqd; |
783 | int unit, rc = -ENODEV; | 783 | int i, rc = -ENODEV; |
784 | 784 | ||
785 | BUG_ON(hwif->present); | 785 | BUG_ON(hwif->present); |
786 | 786 | ||
787 | if ((hwif->drives[0].dev_flags & IDE_DFLAG_NOPROBE) && | 787 | if ((hwif->devices[0]->dev_flags & IDE_DFLAG_NOPROBE) && |
788 | (hwif->drives[1].dev_flags & IDE_DFLAG_NOPROBE)) | 788 | (hwif->devices[1]->dev_flags & IDE_DFLAG_NOPROBE)) |
789 | return -EACCES; | 789 | return -EACCES; |
790 | 790 | ||
791 | /* | 791 | /* |
@@ -796,7 +796,8 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
796 | if (irqd) | 796 | if (irqd) |
797 | disable_irq(hwif->irq); | 797 | disable_irq(hwif->irq); |
798 | 798 | ||
799 | local_irq_set(flags); | 799 | local_irq_save(flags); |
800 | local_irq_enable_in_hardirq(); | ||
800 | 801 | ||
801 | if (ide_port_wait_ready(hwif) == -EBUSY) | 802 | if (ide_port_wait_ready(hwif) == -EBUSY) |
802 | printk(KERN_DEBUG "%s: Wait for ready failed before probe !\n", hwif->name); | 803 | printk(KERN_DEBUG "%s: Wait for ready failed before probe !\n", hwif->name); |
@@ -805,9 +806,7 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
805 | * Second drive should only exist if first drive was found, | 806 | * Second drive should only exist if first drive was found, |
806 | * but a lot of cdrom drives are configured as single slaves. | 807 | * but a lot of cdrom drives are configured as single slaves. |
807 | */ | 808 | */ |
808 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 809 | ide_port_for_each_dev(i, drive, hwif) { |
809 | ide_drive_t *drive = &hwif->drives[unit]; | ||
810 | |||
811 | (void) probe_for_drive(drive); | 810 | (void) probe_for_drive(drive); |
812 | if (drive->dev_flags & IDE_DFLAG_PRESENT) | 811 | if (drive->dev_flags & IDE_DFLAG_PRESENT) |
813 | rc = 0; | 812 | rc = 0; |
@@ -828,20 +827,17 @@ static int ide_probe_port(ide_hwif_t *hwif) | |||
828 | static void ide_port_tune_devices(ide_hwif_t *hwif) | 827 | static void ide_port_tune_devices(ide_hwif_t *hwif) |
829 | { | 828 | { |
830 | const struct ide_port_ops *port_ops = hwif->port_ops; | 829 | const struct ide_port_ops *port_ops = hwif->port_ops; |
831 | int unit; | 830 | ide_drive_t *drive; |
832 | 831 | int i; | |
833 | for (unit = 0; unit < MAX_DRIVES; unit++) { | ||
834 | ide_drive_t *drive = &hwif->drives[unit]; | ||
835 | 832 | ||
833 | ide_port_for_each_dev(i, drive, hwif) { | ||
836 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { | 834 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
837 | if (port_ops && port_ops->quirkproc) | 835 | if (port_ops && port_ops->quirkproc) |
838 | port_ops->quirkproc(drive); | 836 | port_ops->quirkproc(drive); |
839 | } | 837 | } |
840 | } | 838 | } |
841 | 839 | ||
842 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 840 | ide_port_for_each_dev(i, drive, hwif) { |
843 | ide_drive_t *drive = &hwif->drives[unit]; | ||
844 | |||
845 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { | 841 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { |
846 | ide_set_max_pio(drive); | 842 | ide_set_max_pio(drive); |
847 | 843 | ||
@@ -852,11 +848,8 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
852 | } | 848 | } |
853 | } | 849 | } |
854 | 850 | ||
855 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | 851 | ide_port_for_each_dev(i, drive, hwif) { |
856 | ide_drive_t *drive = &hwif->drives[unit]; | 852 | if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT) |
857 | |||
858 | if ((hwif->host_flags & IDE_HFLAG_NO_IO_32BIT) || | ||
859 | drive->id[ATA_ID_DWORD_IO]) | ||
860 | drive->dev_flags |= IDE_DFLAG_NO_IO_32BIT; | 853 | drive->dev_flags |= IDE_DFLAG_NO_IO_32BIT; |
861 | else | 854 | else |
862 | drive->dev_flags &= ~IDE_DFLAG_NO_IO_32BIT; | 855 | drive->dev_flags &= ~IDE_DFLAG_NO_IO_32BIT; |
@@ -869,7 +862,7 @@ static void ide_port_tune_devices(ide_hwif_t *hwif) | |||
869 | static int ide_init_queue(ide_drive_t *drive) | 862 | static int ide_init_queue(ide_drive_t *drive) |
870 | { | 863 | { |
871 | struct request_queue *q; | 864 | struct request_queue *q; |
872 | ide_hwif_t *hwif = HWIF(drive); | 865 | ide_hwif_t *hwif = drive->hwif; |
873 | int max_sectors = 256; | 866 | int max_sectors = 256; |
874 | int max_sg_entries = PRD_ENTRIES; | 867 | int max_sg_entries = PRD_ENTRIES; |
875 | 868 | ||
@@ -918,36 +911,19 @@ static int ide_init_queue(ide_drive_t *drive) | |||
918 | return 0; | 911 | return 0; |
919 | } | 912 | } |
920 | 913 | ||
921 | static void ide_add_drive_to_hwgroup(ide_drive_t *drive) | 914 | static DEFINE_MUTEX(ide_cfg_mtx); |
922 | { | ||
923 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | ||
924 | |||
925 | spin_lock_irq(&hwgroup->lock); | ||
926 | if (!hwgroup->drive) { | ||
927 | /* first drive for hwgroup. */ | ||
928 | drive->next = drive; | ||
929 | hwgroup->drive = drive; | ||
930 | hwgroup->hwif = HWIF(hwgroup->drive); | ||
931 | } else { | ||
932 | drive->next = hwgroup->drive->next; | ||
933 | hwgroup->drive->next = drive; | ||
934 | } | ||
935 | spin_unlock_irq(&hwgroup->lock); | ||
936 | } | ||
937 | 915 | ||
938 | /* | 916 | /* |
939 | * For any present drive: | 917 | * For any present drive: |
940 | * - allocate the block device queue | 918 | * - allocate the block device queue |
941 | * - link drive into the hwgroup | ||
942 | */ | 919 | */ |
943 | static int ide_port_setup_devices(ide_hwif_t *hwif) | 920 | static int ide_port_setup_devices(ide_hwif_t *hwif) |
944 | { | 921 | { |
922 | ide_drive_t *drive; | ||
945 | int i, j = 0; | 923 | int i, j = 0; |
946 | 924 | ||
947 | mutex_lock(&ide_cfg_mtx); | 925 | mutex_lock(&ide_cfg_mtx); |
948 | for (i = 0; i < MAX_DRIVES; i++) { | 926 | ide_port_for_each_dev(i, drive, hwif) { |
949 | ide_drive_t *drive = &hwif->drives[i]; | ||
950 | |||
951 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | 927 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
952 | continue; | 928 | continue; |
953 | 929 | ||
@@ -961,139 +937,39 @@ static int ide_port_setup_devices(ide_hwif_t *hwif) | |||
961 | } | 937 | } |
962 | 938 | ||
963 | j++; | 939 | j++; |
964 | |||
965 | ide_add_drive_to_hwgroup(drive); | ||
966 | } | 940 | } |
967 | mutex_unlock(&ide_cfg_mtx); | 941 | mutex_unlock(&ide_cfg_mtx); |
968 | 942 | ||
969 | return j; | 943 | return j; |
970 | } | 944 | } |
971 | 945 | ||
972 | static ide_hwif_t *ide_ports[MAX_HWIFS]; | ||
973 | |||
974 | void ide_remove_port_from_hwgroup(ide_hwif_t *hwif) | ||
975 | { | ||
976 | ide_hwgroup_t *hwgroup = hwif->hwgroup; | ||
977 | |||
978 | ide_ports[hwif->index] = NULL; | ||
979 | |||
980 | spin_lock_irq(&hwgroup->lock); | ||
981 | /* | ||
982 | * Remove us from the hwgroup, and free | ||
983 | * the hwgroup if we were the only member | ||
984 | */ | ||
985 | if (hwif->next == hwif) { | ||
986 | BUG_ON(hwgroup->hwif != hwif); | ||
987 | kfree(hwgroup); | ||
988 | } else { | ||
989 | /* There is another interface in hwgroup. | ||
990 | * Unlink us, and set hwgroup->drive and ->hwif to | ||
991 | * something sane. | ||
992 | */ | ||
993 | ide_hwif_t *g = hwgroup->hwif; | ||
994 | |||
995 | while (g->next != hwif) | ||
996 | g = g->next; | ||
997 | g->next = hwif->next; | ||
998 | if (hwgroup->hwif == hwif) { | ||
999 | /* Chose a random hwif for hwgroup->hwif. | ||
1000 | * It's guaranteed that there are no drives | ||
1001 | * left in the hwgroup. | ||
1002 | */ | ||
1003 | BUG_ON(hwgroup->drive != NULL); | ||
1004 | hwgroup->hwif = g; | ||
1005 | } | ||
1006 | BUG_ON(hwgroup->hwif == hwif); | ||
1007 | } | ||
1008 | spin_unlock_irq(&hwgroup->lock); | ||
1009 | } | ||
1010 | |||
1011 | /* | 946 | /* |
1012 | * This routine sets up the irq for an ide interface, and creates a new | 947 | * This routine sets up the IRQ for an IDE interface. |
1013 | * hwgroup for the irq/hwif if none was previously assigned. | ||
1014 | * | ||
1015 | * Much of the code is for correctly detecting/handling irq sharing | ||
1016 | * and irq serialization situations. This is somewhat complex because | ||
1017 | * it handles static as well as dynamic (PCMCIA) IDE interfaces. | ||
1018 | */ | 948 | */ |
1019 | static int init_irq (ide_hwif_t *hwif) | 949 | static int init_irq (ide_hwif_t *hwif) |
1020 | { | 950 | { |
1021 | struct ide_io_ports *io_ports = &hwif->io_ports; | 951 | struct ide_io_ports *io_ports = &hwif->io_ports; |
1022 | unsigned int index; | 952 | int sa = 0; |
1023 | ide_hwgroup_t *hwgroup; | ||
1024 | ide_hwif_t *match = NULL; | ||
1025 | 953 | ||
1026 | mutex_lock(&ide_cfg_mtx); | 954 | mutex_lock(&ide_cfg_mtx); |
1027 | hwif->hwgroup = NULL; | 955 | spin_lock_init(&hwif->lock); |
1028 | 956 | ||
1029 | for (index = 0; index < MAX_HWIFS; index++) { | 957 | init_timer(&hwif->timer); |
1030 | ide_hwif_t *h = ide_ports[index]; | 958 | hwif->timer.function = &ide_timer_expiry; |
959 | hwif->timer.data = (unsigned long)hwif; | ||
1031 | 960 | ||
1032 | if (h && h->hwgroup) { /* scan only initialized ports */ | ||
1033 | if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) { | ||
1034 | if (hwif->host == h->host) | ||
1035 | match = h; | ||
1036 | } | ||
1037 | } | ||
1038 | } | ||
1039 | |||
1040 | /* | ||
1041 | * If we are still without a hwgroup, then form a new one | ||
1042 | */ | ||
1043 | if (match) { | ||
1044 | hwgroup = match->hwgroup; | ||
1045 | hwif->hwgroup = hwgroup; | ||
1046 | /* | ||
1047 | * Link us into the hwgroup. | ||
1048 | * This must be done early, do ensure that unexpected_intr | ||
1049 | * can find the hwif and prevent irq storms. | ||
1050 | * No drives are attached to the new hwif, choose_drive | ||
1051 | * can't do anything stupid (yet). | ||
1052 | * Add ourself as the 2nd entry to the hwgroup->hwif | ||
1053 | * linked list, the first entry is the hwif that owns | ||
1054 | * hwgroup->handler - do not change that. | ||
1055 | */ | ||
1056 | spin_lock_irq(&hwgroup->lock); | ||
1057 | hwif->next = hwgroup->hwif->next; | ||
1058 | hwgroup->hwif->next = hwif; | ||
1059 | BUG_ON(hwif->next == hwif); | ||
1060 | spin_unlock_irq(&hwgroup->lock); | ||
1061 | } else { | ||
1062 | hwgroup = kmalloc_node(sizeof(*hwgroup), GFP_KERNEL|__GFP_ZERO, | ||
1063 | hwif_to_node(hwif)); | ||
1064 | if (hwgroup == NULL) | ||
1065 | goto out_up; | ||
1066 | |||
1067 | spin_lock_init(&hwgroup->lock); | ||
1068 | |||
1069 | hwif->hwgroup = hwgroup; | ||
1070 | hwgroup->hwif = hwif->next = hwif; | ||
1071 | |||
1072 | init_timer(&hwgroup->timer); | ||
1073 | hwgroup->timer.function = &ide_timer_expiry; | ||
1074 | hwgroup->timer.data = (unsigned long) hwgroup; | ||
1075 | } | ||
1076 | |||
1077 | ide_ports[hwif->index] = hwif; | ||
1078 | |||
1079 | /* | ||
1080 | * Allocate the irq, if not already obtained for another hwif | ||
1081 | */ | ||
1082 | if (!match || match->irq != hwif->irq) { | ||
1083 | int sa = 0; | ||
1084 | #if defined(__mc68000__) | 961 | #if defined(__mc68000__) |
1085 | sa = IRQF_SHARED; | 962 | sa = IRQF_SHARED; |
1086 | #endif /* __mc68000__ */ | 963 | #endif /* __mc68000__ */ |
1087 | 964 | ||
1088 | if (hwif->chipset == ide_pci) | 965 | if (hwif->chipset == ide_pci) |
1089 | sa = IRQF_SHARED; | 966 | sa = IRQF_SHARED; |
1090 | 967 | ||
1091 | if (io_ports->ctl_addr) | 968 | if (io_ports->ctl_addr) |
1092 | hwif->tp_ops->set_irq(hwif, 1); | 969 | hwif->tp_ops->set_irq(hwif, 1); |
1093 | 970 | ||
1094 | if (request_irq(hwif->irq,&ide_intr,sa,hwif->name,hwgroup)) | 971 | if (request_irq(hwif->irq, &ide_intr, sa, hwif->name, hwif)) |
1095 | goto out_unlink; | 972 | goto out_up; |
1096 | } | ||
1097 | 973 | ||
1098 | if (!hwif->rqsize) { | 974 | if (!hwif->rqsize) { |
1099 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || | 975 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || |
@@ -1111,14 +987,12 @@ static int init_irq (ide_hwif_t *hwif) | |||
1111 | printk(KERN_INFO "%s at 0x%08lx on irq %d", hwif->name, | 987 | printk(KERN_INFO "%s at 0x%08lx on irq %d", hwif->name, |
1112 | io_ports->data_addr, hwif->irq); | 988 | io_ports->data_addr, hwif->irq); |
1113 | #endif /* __mc68000__ */ | 989 | #endif /* __mc68000__ */ |
1114 | if (match) | 990 | if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) |
1115 | printk(KERN_CONT " (serialized with %s)", match->name); | 991 | printk(KERN_CONT " (serialized)"); |
1116 | printk(KERN_CONT "\n"); | 992 | printk(KERN_CONT "\n"); |
1117 | 993 | ||
1118 | mutex_unlock(&ide_cfg_mtx); | 994 | mutex_unlock(&ide_cfg_mtx); |
1119 | return 0; | 995 | return 0; |
1120 | out_unlink: | ||
1121 | ide_remove_port_from_hwgroup(hwif); | ||
1122 | out_up: | 996 | out_up: |
1123 | mutex_unlock(&ide_cfg_mtx); | 997 | mutex_unlock(&ide_cfg_mtx); |
1124 | return 1; | 998 | return 1; |
@@ -1134,7 +1008,7 @@ static struct kobject *ata_probe(dev_t dev, int *part, void *data) | |||
1134 | { | 1008 | { |
1135 | ide_hwif_t *hwif = data; | 1009 | ide_hwif_t *hwif = data; |
1136 | int unit = *part >> PARTN_BITS; | 1010 | int unit = *part >> PARTN_BITS; |
1137 | ide_drive_t *drive = &hwif->drives[unit]; | 1011 | ide_drive_t *drive = hwif->devices[unit]; |
1138 | 1012 | ||
1139 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | 1013 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
1140 | return NULL; | 1014 | return NULL; |
@@ -1196,47 +1070,23 @@ void ide_init_disk(struct gendisk *disk, ide_drive_t *drive) | |||
1196 | 1070 | ||
1197 | EXPORT_SYMBOL_GPL(ide_init_disk); | 1071 | EXPORT_SYMBOL_GPL(ide_init_disk); |
1198 | 1072 | ||
1199 | static void ide_remove_drive_from_hwgroup(ide_drive_t *drive) | ||
1200 | { | ||
1201 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | ||
1202 | |||
1203 | if (drive == drive->next) { | ||
1204 | /* special case: last drive from hwgroup. */ | ||
1205 | BUG_ON(hwgroup->drive != drive); | ||
1206 | hwgroup->drive = NULL; | ||
1207 | } else { | ||
1208 | ide_drive_t *walk; | ||
1209 | |||
1210 | walk = hwgroup->drive; | ||
1211 | while (walk->next != drive) | ||
1212 | walk = walk->next; | ||
1213 | walk->next = drive->next; | ||
1214 | if (hwgroup->drive == drive) { | ||
1215 | hwgroup->drive = drive->next; | ||
1216 | hwgroup->hwif = hwgroup->drive->hwif; | ||
1217 | } | ||
1218 | } | ||
1219 | BUG_ON(hwgroup->drive == drive); | ||
1220 | } | ||
1221 | |||
1222 | static void drive_release_dev (struct device *dev) | 1073 | static void drive_release_dev (struct device *dev) |
1223 | { | 1074 | { |
1224 | ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); | 1075 | ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); |
1225 | ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; | 1076 | ide_hwif_t *hwif = drive->hwif; |
1226 | 1077 | ||
1227 | ide_proc_unregister_device(drive); | 1078 | ide_proc_unregister_device(drive); |
1228 | 1079 | ||
1229 | spin_lock_irq(&hwgroup->lock); | 1080 | spin_lock_irq(&hwif->lock); |
1230 | ide_remove_drive_from_hwgroup(drive); | ||
1231 | kfree(drive->id); | 1081 | kfree(drive->id); |
1232 | drive->id = NULL; | 1082 | drive->id = NULL; |
1233 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; | 1083 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; |
1234 | /* Messed up locking ... */ | 1084 | /* Messed up locking ... */ |
1235 | spin_unlock_irq(&hwgroup->lock); | 1085 | spin_unlock_irq(&hwif->lock); |
1236 | blk_cleanup_queue(drive->queue); | 1086 | blk_cleanup_queue(drive->queue); |
1237 | spin_lock_irq(&hwgroup->lock); | 1087 | spin_lock_irq(&hwif->lock); |
1238 | drive->queue = NULL; | 1088 | drive->queue = NULL; |
1239 | spin_unlock_irq(&hwgroup->lock); | 1089 | spin_unlock_irq(&hwif->lock); |
1240 | 1090 | ||
1241 | complete(&drive->gendev_rel_comp); | 1091 | complete(&drive->gendev_rel_comp); |
1242 | } | 1092 | } |
@@ -1302,10 +1152,10 @@ out: | |||
1302 | 1152 | ||
1303 | static void hwif_register_devices(ide_hwif_t *hwif) | 1153 | static void hwif_register_devices(ide_hwif_t *hwif) |
1304 | { | 1154 | { |
1155 | ide_drive_t *drive; | ||
1305 | unsigned int i; | 1156 | unsigned int i; |
1306 | 1157 | ||
1307 | for (i = 0; i < MAX_DRIVES; i++) { | 1158 | ide_port_for_each_dev(i, drive, hwif) { |
1308 | ide_drive_t *drive = &hwif->drives[i]; | ||
1309 | struct device *dev = &drive->gendev; | 1159 | struct device *dev = &drive->gendev; |
1310 | int ret; | 1160 | int ret; |
1311 | 1161 | ||
@@ -1328,11 +1178,10 @@ static void hwif_register_devices(ide_hwif_t *hwif) | |||
1328 | static void ide_port_init_devices(ide_hwif_t *hwif) | 1178 | static void ide_port_init_devices(ide_hwif_t *hwif) |
1329 | { | 1179 | { |
1330 | const struct ide_port_ops *port_ops = hwif->port_ops; | 1180 | const struct ide_port_ops *port_ops = hwif->port_ops; |
1181 | ide_drive_t *drive; | ||
1331 | int i; | 1182 | int i; |
1332 | 1183 | ||
1333 | for (i = 0; i < MAX_DRIVES; i++) { | 1184 | ide_port_for_each_dev(i, drive, hwif) { |
1334 | ide_drive_t *drive = &hwif->drives[i]; | ||
1335 | |||
1336 | drive->dn = i + hwif->channel * 2; | 1185 | drive->dn = i + hwif->channel * 2; |
1337 | 1186 | ||
1338 | if (hwif->host_flags & IDE_HFLAG_IO_32BIT) | 1187 | if (hwif->host_flags & IDE_HFLAG_IO_32BIT) |
@@ -1380,6 +1229,8 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1380 | if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) { | 1229 | if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) { |
1381 | int rc; | 1230 | int rc; |
1382 | 1231 | ||
1232 | hwif->dma_ops = d->dma_ops; | ||
1233 | |||
1383 | if (d->init_dma) | 1234 | if (d->init_dma) |
1384 | rc = d->init_dma(hwif, d); | 1235 | rc = d->init_dma(hwif, d); |
1385 | else | 1236 | else |
@@ -1387,12 +1238,13 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1387 | 1238 | ||
1388 | if (rc < 0) { | 1239 | if (rc < 0) { |
1389 | printk(KERN_INFO "%s: DMA disabled\n", hwif->name); | 1240 | printk(KERN_INFO "%s: DMA disabled\n", hwif->name); |
1241 | |||
1242 | hwif->dma_ops = NULL; | ||
1390 | hwif->dma_base = 0; | 1243 | hwif->dma_base = 0; |
1391 | hwif->swdma_mask = 0; | 1244 | hwif->swdma_mask = 0; |
1392 | hwif->mwdma_mask = 0; | 1245 | hwif->mwdma_mask = 0; |
1393 | hwif->ultra_mask = 0; | 1246 | hwif->ultra_mask = 0; |
1394 | } else if (d->dma_ops) | 1247 | } |
1395 | hwif->dma_ops = d->dma_ops; | ||
1396 | } | 1248 | } |
1397 | 1249 | ||
1398 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) || | 1250 | if ((d->host_flags & IDE_HFLAG_SERIALIZE) || |
@@ -1417,6 +1269,66 @@ static void ide_port_cable_detect(ide_hwif_t *hwif) | |||
1417 | } | 1269 | } |
1418 | } | 1270 | } |
1419 | 1271 | ||
1272 | static const u8 ide_hwif_to_major[] = | ||
1273 | { IDE0_MAJOR, IDE1_MAJOR, IDE2_MAJOR, IDE3_MAJOR, IDE4_MAJOR, | ||
1274 | IDE5_MAJOR, IDE6_MAJOR, IDE7_MAJOR, IDE8_MAJOR, IDE9_MAJOR }; | ||
1275 | |||
1276 | static void ide_port_init_devices_data(ide_hwif_t *hwif) | ||
1277 | { | ||
1278 | ide_drive_t *drive; | ||
1279 | int i; | ||
1280 | |||
1281 | ide_port_for_each_dev(i, drive, hwif) { | ||
1282 | u8 j = (hwif->index * MAX_DRIVES) + i; | ||
1283 | |||
1284 | memset(drive, 0, sizeof(*drive)); | ||
1285 | |||
1286 | drive->media = ide_disk; | ||
1287 | drive->select = (i << 4) | ATA_DEVICE_OBS; | ||
1288 | drive->hwif = hwif; | ||
1289 | drive->ready_stat = ATA_DRDY; | ||
1290 | drive->bad_wstat = BAD_W_STAT; | ||
1291 | drive->special.b.recalibrate = 1; | ||
1292 | drive->special.b.set_geometry = 1; | ||
1293 | drive->name[0] = 'h'; | ||
1294 | drive->name[1] = 'd'; | ||
1295 | drive->name[2] = 'a' + j; | ||
1296 | drive->max_failures = IDE_DEFAULT_MAX_FAILURES; | ||
1297 | |||
1298 | INIT_LIST_HEAD(&drive->list); | ||
1299 | init_completion(&drive->gendev_rel_comp); | ||
1300 | } | ||
1301 | } | ||
1302 | |||
1303 | static void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) | ||
1304 | { | ||
1305 | /* fill in any non-zero initial values */ | ||
1306 | hwif->index = index; | ||
1307 | hwif->major = ide_hwif_to_major[index]; | ||
1308 | |||
1309 | hwif->name[0] = 'i'; | ||
1310 | hwif->name[1] = 'd'; | ||
1311 | hwif->name[2] = 'e'; | ||
1312 | hwif->name[3] = '0' + index; | ||
1313 | |||
1314 | init_completion(&hwif->gendev_rel_comp); | ||
1315 | |||
1316 | hwif->tp_ops = &default_tp_ops; | ||
1317 | |||
1318 | ide_port_init_devices_data(hwif); | ||
1319 | } | ||
1320 | |||
1321 | static void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) | ||
1322 | { | ||
1323 | memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports)); | ||
1324 | hwif->irq = hw->irq; | ||
1325 | hwif->chipset = hw->chipset; | ||
1326 | hwif->dev = hw->dev; | ||
1327 | hwif->gendev.parent = hw->parent ? hw->parent : hw->dev; | ||
1328 | hwif->ack_intr = hw->ack_intr; | ||
1329 | hwif->config_data = hw->config; | ||
1330 | } | ||
1331 | |||
1420 | static unsigned int ide_indexes; | 1332 | static unsigned int ide_indexes; |
1421 | 1333 | ||
1422 | /** | 1334 | /** |
@@ -1466,12 +1378,43 @@ static void ide_free_port_slot(int idx) | |||
1466 | mutex_unlock(&ide_cfg_mtx); | 1378 | mutex_unlock(&ide_cfg_mtx); |
1467 | } | 1379 | } |
1468 | 1380 | ||
1381 | static void ide_port_free_devices(ide_hwif_t *hwif) | ||
1382 | { | ||
1383 | ide_drive_t *drive; | ||
1384 | int i; | ||
1385 | |||
1386 | ide_port_for_each_dev(i, drive, hwif) | ||
1387 | kfree(drive); | ||
1388 | } | ||
1389 | |||
1390 | static int ide_port_alloc_devices(ide_hwif_t *hwif, int node) | ||
1391 | { | ||
1392 | int i; | ||
1393 | |||
1394 | for (i = 0; i < MAX_DRIVES; i++) { | ||
1395 | ide_drive_t *drive; | ||
1396 | |||
1397 | drive = kzalloc_node(sizeof(*drive), GFP_KERNEL, node); | ||
1398 | if (drive == NULL) | ||
1399 | goto out_nomem; | ||
1400 | |||
1401 | hwif->devices[i] = drive; | ||
1402 | } | ||
1403 | return 0; | ||
1404 | |||
1405 | out_nomem: | ||
1406 | ide_port_free_devices(hwif); | ||
1407 | return -ENOMEM; | ||
1408 | } | ||
1409 | |||
1469 | struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) | 1410 | struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) |
1470 | { | 1411 | { |
1471 | struct ide_host *host; | 1412 | struct ide_host *host; |
1413 | struct device *dev = hws[0] ? hws[0]->dev : NULL; | ||
1414 | int node = dev ? dev_to_node(dev) : -1; | ||
1472 | int i; | 1415 | int i; |
1473 | 1416 | ||
1474 | host = kzalloc(sizeof(*host), GFP_KERNEL); | 1417 | host = kzalloc_node(sizeof(*host), GFP_KERNEL, node); |
1475 | if (host == NULL) | 1418 | if (host == NULL) |
1476 | return NULL; | 1419 | return NULL; |
1477 | 1420 | ||
@@ -1482,10 +1425,15 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) | |||
1482 | if (hws[i] == NULL) | 1425 | if (hws[i] == NULL) |
1483 | continue; | 1426 | continue; |
1484 | 1427 | ||
1485 | hwif = kzalloc(sizeof(*hwif), GFP_KERNEL); | 1428 | hwif = kzalloc_node(sizeof(*hwif), GFP_KERNEL, node); |
1486 | if (hwif == NULL) | 1429 | if (hwif == NULL) |
1487 | continue; | 1430 | continue; |
1488 | 1431 | ||
1432 | if (ide_port_alloc_devices(hwif, node) < 0) { | ||
1433 | kfree(hwif); | ||
1434 | continue; | ||
1435 | } | ||
1436 | |||
1489 | idx = ide_find_port_slot(d); | 1437 | idx = ide_find_port_slot(d); |
1490 | if (idx < 0) { | 1438 | if (idx < 0) { |
1491 | printk(KERN_ERR "%s: no free slot for interface\n", | 1439 | printk(KERN_ERR "%s: no free slot for interface\n", |
@@ -1507,8 +1455,7 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) | |||
1507 | return NULL; | 1455 | return NULL; |
1508 | } | 1456 | } |
1509 | 1457 | ||
1510 | if (hws[0]) | 1458 | host->dev[0] = dev; |
1511 | host->dev[0] = hws[0]->dev; | ||
1512 | 1459 | ||
1513 | if (d) { | 1460 | if (d) { |
1514 | host->init_chipset = d->init_chipset; | 1461 | host->init_chipset = d->init_chipset; |
@@ -1525,9 +1472,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1525 | ide_hwif_t *hwif, *mate = NULL; | 1472 | ide_hwif_t *hwif, *mate = NULL; |
1526 | int i, j = 0; | 1473 | int i, j = 0; |
1527 | 1474 | ||
1528 | for (i = 0; i < MAX_HOST_PORTS; i++) { | 1475 | ide_host_for_each_port(i, hwif, host) { |
1529 | hwif = host->ports[i]; | ||
1530 | |||
1531 | if (hwif == NULL) { | 1476 | if (hwif == NULL) { |
1532 | mate = NULL; | 1477 | mate = NULL; |
1533 | continue; | 1478 | continue; |
@@ -1553,9 +1498,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1553 | ide_port_init_devices(hwif); | 1498 | ide_port_init_devices(hwif); |
1554 | } | 1499 | } |
1555 | 1500 | ||
1556 | for (i = 0; i < MAX_HOST_PORTS; i++) { | 1501 | ide_host_for_each_port(i, hwif, host) { |
1557 | hwif = host->ports[i]; | ||
1558 | |||
1559 | if (hwif == NULL) | 1502 | if (hwif == NULL) |
1560 | continue; | 1503 | continue; |
1561 | 1504 | ||
@@ -1570,9 +1513,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1570 | ide_port_tune_devices(hwif); | 1513 | ide_port_tune_devices(hwif); |
1571 | } | 1514 | } |
1572 | 1515 | ||
1573 | for (i = 0; i < MAX_HOST_PORTS; i++) { | 1516 | ide_host_for_each_port(i, hwif, host) { |
1574 | hwif = host->ports[i]; | ||
1575 | |||
1576 | if (hwif == NULL) | 1517 | if (hwif == NULL) |
1577 | continue; | 1518 | continue; |
1578 | 1519 | ||
@@ -1597,9 +1538,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1597 | ide_acpi_port_init_devices(hwif); | 1538 | ide_acpi_port_init_devices(hwif); |
1598 | } | 1539 | } |
1599 | 1540 | ||
1600 | for (i = 0; i < MAX_HOST_PORTS; i++) { | 1541 | ide_host_for_each_port(i, hwif, host) { |
1601 | hwif = host->ports[i]; | ||
1602 | |||
1603 | if (hwif == NULL) | 1542 | if (hwif == NULL) |
1604 | continue; | 1543 | continue; |
1605 | 1544 | ||
@@ -1607,9 +1546,7 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1607 | hwif_register_devices(hwif); | 1546 | hwif_register_devices(hwif); |
1608 | } | 1547 | } |
1609 | 1548 | ||
1610 | for (i = 0; i < MAX_HOST_PORTS; i++) { | 1549 | ide_host_for_each_port(i, hwif, host) { |
1611 | hwif = host->ports[i]; | ||
1612 | |||
1613 | if (hwif == NULL) | 1550 | if (hwif == NULL) |
1614 | continue; | 1551 | continue; |
1615 | 1552 | ||
@@ -1647,17 +1584,85 @@ int ide_host_add(const struct ide_port_info *d, hw_regs_t **hws, | |||
1647 | } | 1584 | } |
1648 | EXPORT_SYMBOL_GPL(ide_host_add); | 1585 | EXPORT_SYMBOL_GPL(ide_host_add); |
1649 | 1586 | ||
1587 | static void __ide_port_unregister_devices(ide_hwif_t *hwif) | ||
1588 | { | ||
1589 | ide_drive_t *drive; | ||
1590 | int i; | ||
1591 | |||
1592 | ide_port_for_each_dev(i, drive, hwif) { | ||
1593 | if (drive->dev_flags & IDE_DFLAG_PRESENT) { | ||
1594 | device_unregister(&drive->gendev); | ||
1595 | wait_for_completion(&drive->gendev_rel_comp); | ||
1596 | } | ||
1597 | } | ||
1598 | } | ||
1599 | |||
1600 | void ide_port_unregister_devices(ide_hwif_t *hwif) | ||
1601 | { | ||
1602 | mutex_lock(&ide_cfg_mtx); | ||
1603 | __ide_port_unregister_devices(hwif); | ||
1604 | hwif->present = 0; | ||
1605 | ide_port_init_devices_data(hwif); | ||
1606 | mutex_unlock(&ide_cfg_mtx); | ||
1607 | } | ||
1608 | EXPORT_SYMBOL_GPL(ide_port_unregister_devices); | ||
1609 | |||
1610 | /** | ||
1611 | * ide_unregister - free an IDE interface | ||
1612 | * @hwif: IDE interface | ||
1613 | * | ||
1614 | * Perform the final unregister of an IDE interface. | ||
1615 | * | ||
1616 | * Locking: | ||
1617 | * The caller must not hold the IDE locks. | ||
1618 | * | ||
1619 | * It is up to the caller to be sure there is no pending I/O here, | ||
1620 | * and that the interface will not be reopened (present/vanishing | ||
1621 | * locking isn't yet done BTW). | ||
1622 | */ | ||
1623 | |||
1624 | static void ide_unregister(ide_hwif_t *hwif) | ||
1625 | { | ||
1626 | BUG_ON(in_interrupt()); | ||
1627 | BUG_ON(irqs_disabled()); | ||
1628 | |||
1629 | mutex_lock(&ide_cfg_mtx); | ||
1630 | |||
1631 | if (hwif->present) { | ||
1632 | __ide_port_unregister_devices(hwif); | ||
1633 | hwif->present = 0; | ||
1634 | } | ||
1635 | |||
1636 | ide_proc_unregister_port(hwif); | ||
1637 | |||
1638 | free_irq(hwif->irq, hwif); | ||
1639 | |||
1640 | device_unregister(hwif->portdev); | ||
1641 | device_unregister(&hwif->gendev); | ||
1642 | wait_for_completion(&hwif->gendev_rel_comp); | ||
1643 | |||
1644 | /* | ||
1645 | * Remove us from the kernel's knowledge | ||
1646 | */ | ||
1647 | blk_unregister_region(MKDEV(hwif->major, 0), MAX_DRIVES<<PARTN_BITS); | ||
1648 | kfree(hwif->sg_table); | ||
1649 | unregister_blkdev(hwif->major, hwif->name); | ||
1650 | |||
1651 | ide_release_dma_engine(hwif); | ||
1652 | |||
1653 | mutex_unlock(&ide_cfg_mtx); | ||
1654 | } | ||
1655 | |||
1650 | void ide_host_free(struct ide_host *host) | 1656 | void ide_host_free(struct ide_host *host) |
1651 | { | 1657 | { |
1652 | ide_hwif_t *hwif; | 1658 | ide_hwif_t *hwif; |
1653 | int i; | 1659 | int i; |
1654 | 1660 | ||
1655 | for (i = 0; i < MAX_HOST_PORTS; i++) { | 1661 | ide_host_for_each_port(i, hwif, host) { |
1656 | hwif = host->ports[i]; | ||
1657 | |||
1658 | if (hwif == NULL) | 1662 | if (hwif == NULL) |
1659 | continue; | 1663 | continue; |
1660 | 1664 | ||
1665 | ide_port_free_devices(hwif); | ||
1661 | ide_free_port_slot(hwif->index); | 1666 | ide_free_port_slot(hwif->index); |
1662 | kfree(hwif); | 1667 | kfree(hwif); |
1663 | } | 1668 | } |
@@ -1668,11 +1673,12 @@ EXPORT_SYMBOL_GPL(ide_host_free); | |||
1668 | 1673 | ||
1669 | void ide_host_remove(struct ide_host *host) | 1674 | void ide_host_remove(struct ide_host *host) |
1670 | { | 1675 | { |
1676 | ide_hwif_t *hwif; | ||
1671 | int i; | 1677 | int i; |
1672 | 1678 | ||
1673 | for (i = 0; i < MAX_HOST_PORTS; i++) { | 1679 | ide_host_for_each_port(i, hwif, host) { |
1674 | if (host->ports[i]) | 1680 | if (hwif) |
1675 | ide_unregister(host->ports[i]); | 1681 | ide_unregister(hwif); |
1676 | } | 1682 | } |
1677 | 1683 | ||
1678 | ide_host_free(host); | 1684 | ide_host_free(host); |
@@ -1691,8 +1697,8 @@ void ide_port_scan(ide_hwif_t *hwif) | |||
1691 | hwif->present = 1; | 1697 | hwif->present = 1; |
1692 | 1698 | ||
1693 | ide_port_tune_devices(hwif); | 1699 | ide_port_tune_devices(hwif); |
1694 | ide_acpi_port_init_devices(hwif); | ||
1695 | ide_port_setup_devices(hwif); | 1700 | ide_port_setup_devices(hwif); |
1701 | ide_acpi_port_init_devices(hwif); | ||
1696 | hwif_register_devices(hwif); | 1702 | hwif_register_devices(hwif); |
1697 | ide_proc_port_register_devices(hwif); | 1703 | ide_proc_port_register_devices(hwif); |
1698 | } | 1704 | } |