aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-acpi.c')
-rw-r--r--drivers/ide/ide-acpi.c63
1 files changed, 20 insertions, 43 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 68bc61844780..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};
@@ -280,16 +279,6 @@ static int do_drive_get_GTF(ide_drive_t *drive,
280 279
281 port = hwif->channel ? drive->dn - 2: drive->dn; 280 port = hwif->channel ? drive->dn - 2: drive->dn;
282 281
283 if (!drive->acpidata) {
284 if (port == 0) {
285 drive->acpidata = &hwif->acpidata->master;
286 hwif->acpidata->master.drive = drive;
287 } else {
288 drive->acpidata = &hwif->acpidata->slave;
289 hwif->acpidata->slave.drive = drive;
290 }
291 }
292
293 DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n", 282 DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n",
294 hwif->name, dev->bus_id, port, hwif->channel); 283 hwif->name, dev->bus_id, port, hwif->channel);
295 284
@@ -494,7 +483,6 @@ int ide_acpi_exec_tfs(ide_drive_t *drive)
494 483
495 return ret; 484 return ret;
496} 485}
497EXPORT_SYMBOL_GPL(ide_acpi_exec_tfs);
498 486
499/** 487/**
500 * ide_acpi_get_timing - get the channel (controller) timings 488 * ide_acpi_get_timing - get the channel (controller) timings
@@ -580,7 +568,6 @@ void ide_acpi_get_timing(ide_hwif_t *hwif)
580 568
581 kfree(output.pointer); 569 kfree(output.pointer);
582} 570}
583EXPORT_SYMBOL_GPL(ide_acpi_get_timing);
584 571
585/** 572/**
586 * ide_acpi_push_timing - set the channel (controller) timings 573 * ide_acpi_push_timing - set the channel (controller) timings
@@ -634,7 +621,6 @@ void ide_acpi_push_timing(ide_hwif_t *hwif)
634 } 621 }
635 DEBPRINT("_STM status: %d\n", status); 622 DEBPRINT("_STM status: %d\n", status);
636} 623}
637EXPORT_SYMBOL_GPL(ide_acpi_push_timing);
638 624
639/** 625/**
640 * ide_acpi_set_state - set the channel power state 626 * ide_acpi_set_state - set the channel power state
@@ -688,11 +674,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
688 */ 674 */
689void ide_acpi_init(ide_hwif_t *hwif) 675void ide_acpi_init(ide_hwif_t *hwif)
690{ 676{
691 int unit;
692 int err;
693 struct ide_acpi_drive_link *master;
694 struct ide_acpi_drive_link *slave;
695
696 ide_acpi_blacklist(); 677 ide_acpi_blacklist();
697 678
698 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); 679 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
@@ -704,40 +685,38 @@ void ide_acpi_init(ide_hwif_t *hwif)
704 DEBPRINT("no ACPI object for %s found\n", hwif->name); 685 DEBPRINT("no ACPI object for %s found\n", hwif->name);
705 kfree(hwif->acpidata); 686 kfree(hwif->acpidata);
706 hwif->acpidata = NULL; 687 hwif->acpidata = NULL;
707 return;
708 } 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;
709 698
710 /* 699 /*
711 * The ACPI spec mandates that we send information 700 * The ACPI spec mandates that we send information
712 * for both drives, regardless whether they are connected 701 * for both drives, regardless whether they are connected
713 * or not. 702 * or not.
714 */ 703 */
715 hwif->acpidata->master.drive = &hwif->drives[0];
716 hwif->drives[0].acpidata = &hwif->acpidata->master; 704 hwif->drives[0].acpidata = &hwif->acpidata->master;
717 master = &hwif->acpidata->master;
718
719 hwif->acpidata->slave.drive = &hwif->drives[1];
720 hwif->drives[1].acpidata = &hwif->acpidata->slave; 705 hwif->drives[1].acpidata = &hwif->acpidata->slave;
721 slave = &hwif->acpidata->slave;
722
723 706
724 /* 707 /*
725 * Send IDENTIFY for each drive 708 * Send IDENTIFY for each drive
726 */ 709 */
727 if (master->drive->present) { 710 for (i = 0; i < MAX_DRIVES; i++) {
728 err = taskfile_lib_get_identify(master->drive, master->idbuff); 711 drive = &hwif->drives[i];
729 if (err) { 712
730 DEBPRINT("identify device %s failed (%d)\n", 713 if (!drive->present)
731 master->drive->name, err); 714 continue;
732 }
733 }
734 715
735 if (slave->drive->present) { 716 err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff);
736 err = taskfile_lib_get_identify(slave->drive, slave->idbuff); 717 if (err)
737 if (err) {
738 DEBPRINT("identify device %s failed (%d)\n", 718 DEBPRINT("identify device %s failed (%d)\n",
739 slave->drive->name, err); 719 drive->name, err);
740 }
741 } 720 }
742 721
743 if (ide_noacpionboot) { 722 if (ide_noacpionboot) {
@@ -753,13 +732,11 @@ void ide_acpi_init(ide_hwif_t *hwif)
753 ide_acpi_get_timing(hwif); 732 ide_acpi_get_timing(hwif);
754 ide_acpi_push_timing(hwif); 733 ide_acpi_push_timing(hwif);
755 734
756 for (unit = 0; unit < MAX_DRIVES; ++unit) { 735 for (i = 0; i < MAX_DRIVES; i++) {
757 ide_drive_t *drive = &hwif->drives[unit]; 736 drive = &hwif->drives[i];
758 737
759 if (drive->present) { 738 if (drive->present)
760 /* Execute ACPI startup code */ 739 /* Execute ACPI startup code */
761 ide_acpi_exec_tfs(drive); 740 ide_acpi_exec_tfs(drive);
762 }
763 } 741 }
764} 742}
765EXPORT_SYMBOL_GPL(ide_acpi_init);