aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-acpi.c49
-rw-r--r--drivers/ide/ide-probe.c1
-rw-r--r--include/linux/ide.h2
3 files changed, 23 insertions, 29 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index ac12d30f2105..25aaeae1e830 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -39,7 +39,6 @@ struct GTM_buffer {
39}; 39};
40 40
41struct ide_acpi_drive_link { 41struct ide_acpi_drive_link {
42 ide_drive_t *drive;
43 acpi_handle obj_handle; 42 acpi_handle obj_handle;
44 u8 idbuff[512]; 43 u8 idbuff[512];
45}; 44};
@@ -675,11 +674,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
675 */ 674 */
676void ide_acpi_init(ide_hwif_t *hwif) 675void ide_acpi_init(ide_hwif_t *hwif)
677{ 676{
678 int unit;
679 int err;
680 struct ide_acpi_drive_link *master;
681 struct ide_acpi_drive_link *slave;
682
683 ide_acpi_blacklist(); 677 ide_acpi_blacklist();
684 678
685 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); 679 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
@@ -691,40 +685,38 @@ void ide_acpi_init(ide_hwif_t *hwif)
691 DEBPRINT("no ACPI object for %s found\n", hwif->name); 685 DEBPRINT("no ACPI object for %s found\n", hwif->name);
692 kfree(hwif->acpidata); 686 kfree(hwif->acpidata);
693 hwif->acpidata = NULL; 687 hwif->acpidata = NULL;
694 return;
695 } 688 }
689}
690
691void ide_acpi_port_init_devices(ide_hwif_t *hwif)
692{
693 ide_drive_t *drive;
694 int i, err;
695
696 if (hwif->acpidata == NULL)
697 return;
696 698
697 /* 699 /*
698 * The ACPI spec mandates that we send information 700 * The ACPI spec mandates that we send information
699 * for both drives, regardless whether they are connected 701 * for both drives, regardless whether they are connected
700 * or not. 702 * or not.
701 */ 703 */
702 hwif->acpidata->master.drive = &hwif->drives[0];
703 hwif->drives[0].acpidata = &hwif->acpidata->master; 704 hwif->drives[0].acpidata = &hwif->acpidata->master;
704 master = &hwif->acpidata->master;
705
706 hwif->acpidata->slave.drive = &hwif->drives[1];
707 hwif->drives[1].acpidata = &hwif->acpidata->slave; 705 hwif->drives[1].acpidata = &hwif->acpidata->slave;
708 slave = &hwif->acpidata->slave;
709
710 706
711 /* 707 /*
712 * Send IDENTIFY for each drive 708 * Send IDENTIFY for each drive
713 */ 709 */
714 if (master->drive->present) { 710 for (i = 0; i < MAX_DRIVES; i++) {
715 err = taskfile_lib_get_identify(master->drive, master->idbuff); 711 drive = &hwif->drives[i];
716 if (err) { 712
717 DEBPRINT("identify device %s failed (%d)\n", 713 if (!drive->present)
718 master->drive->name, err); 714 continue;
719 }
720 }
721 715
722 if (slave->drive->present) { 716 err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff);
723 err = taskfile_lib_get_identify(slave->drive, slave->idbuff); 717 if (err)
724 if (err) {
725 DEBPRINT("identify device %s failed (%d)\n", 718 DEBPRINT("identify device %s failed (%d)\n",
726 slave->drive->name, err); 719 drive->name, err);
727 }
728 } 720 }
729 721
730 if (ide_noacpionboot) { 722 if (ide_noacpionboot) {
@@ -740,12 +732,11 @@ void ide_acpi_init(ide_hwif_t *hwif)
740 ide_acpi_get_timing(hwif); 732 ide_acpi_get_timing(hwif);
741 ide_acpi_push_timing(hwif); 733 ide_acpi_push_timing(hwif);
742 734
743 for (unit = 0; unit < MAX_DRIVES; ++unit) { 735 for (i = 0; i < MAX_DRIVES; i++) {
744 ide_drive_t *drive = &hwif->drives[unit]; 736 drive = &hwif->drives[i];
745 737
746 if (drive->present) { 738 if (drive->present)
747 /* Execute ACPI startup code */ 739 /* Execute ACPI startup code */
748 ide_acpi_exec_tfs(drive); 740 ide_acpi_exec_tfs(drive);
749 }
750 } 741 }
751} 742}
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index cab06ac9522a..abb695aa021d 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1430,6 +1430,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1430 } 1430 }
1431 1431
1432 ide_acpi_init(hwif); 1432 ide_acpi_init(hwif);
1433 ide_acpi_port_init_devices(hwif);
1433 } 1434 }
1434 1435
1435 for (i = 0; i < MAX_HWIFS; i++) { 1436 for (i = 0; i < MAX_HWIFS; i++) {
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 9f195078ff99..e33e307d9410 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1202,12 +1202,14 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1202extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1202extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1203extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1203extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1204extern void ide_acpi_init(ide_hwif_t *hwif); 1204extern void ide_acpi_init(ide_hwif_t *hwif);
1205void ide_acpi_port_init_devices(ide_hwif_t *);
1205extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1206extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1206#else 1207#else
1207static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1208static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1208static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1209static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1209static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1210static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1210static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1211static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
1212static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1211static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1213static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1212#endif 1214#endif
1213 1215