aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-acpi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:41 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-24 18:22:41 -0400
commit8cd3c605624035b7f57deb8894e17c5ba6d05b2e (patch)
tree244c0b367a3bc1bba18d89d478cc2c5aa12149fe /drivers/ide/ide-acpi.c
parent94635d3ecfd478ada7cedcffd9d53709074444fc (diff)
ide-acpi: init ACPI handles early for devices
Init ACPI handles for devices in ide_acpi_port_init_devices() and remove no longer needed ide_acpi_drive_get_handle(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-acpi.c')
-rw-r--r--drivers/ide/ide-acpi.c65
1 files changed, 21 insertions, 44 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 0ac5c786a31..a3bebba1842 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -202,40 +202,6 @@ static acpi_handle ide_acpi_hwif_get_handle(ide_hwif_t *hwif)
202} 202}
203 203
204/** 204/**
205 * ide_acpi_drive_get_handle - Get ACPI object handle for a given drive
206 * @drive: device to locate
207 *
208 * Retrieves the object handle of a given drive. According to the ACPI
209 * spec the drive is a child of the hwif.
210 *
211 * Returns handle on success, 0 on error.
212 */
213static acpi_handle ide_acpi_drive_get_handle(ide_drive_t *drive)
214{
215 ide_hwif_t *hwif = drive->hwif;
216 int port;
217 acpi_handle drive_handle;
218
219 if (!hwif->acpidata)
220 return NULL;
221
222 if (!hwif->acpidata->obj_handle)
223 return NULL;
224
225 port = hwif->channel ? drive->dn - 2: drive->dn;
226
227 DEBPRINT("ENTER: %s at channel#: %d port#: %d\n",
228 drive->name, hwif->channel, port);
229
230
231 /* TBD: could also check ACPI object VALID bits */
232 drive_handle = acpi_get_child(hwif->acpidata->obj_handle, port);
233 DEBPRINT("drive %s handle 0x%p\n", drive->name, drive_handle);
234
235 return drive_handle;
236}
237
238/**
239 * do_drive_get_GTF - get the drive bootup default taskfile settings 205 * do_drive_get_GTF - get the drive bootup default taskfile settings
240 * @drive: the drive for which the taskfile settings should be retrieved 206 * @drive: the drive for which the taskfile settings should be retrieved
241 * @gtf_length: number of bytes of _GTF data returned at @gtf_address 207 * @gtf_length: number of bytes of _GTF data returned at @gtf_address
@@ -290,14 +256,9 @@ static int do_drive_get_GTF(ide_drive_t *drive,
290 goto out; 256 goto out;
291 } 257 }
292 258
293 /* Get this drive's _ADR info. if not already known. */
294 if (!drive->acpidata->obj_handle) { 259 if (!drive->acpidata->obj_handle) {
295 drive->acpidata->obj_handle = ide_acpi_drive_get_handle(drive); 260 DEBPRINT("No ACPI object found for %s\n", drive->name);
296 if (!drive->acpidata->obj_handle) { 261 goto out;
297 DEBPRINT("No ACPI object found for %s\n",
298 drive->name);
299 goto out;
300 }
301 } 262 }
302 263
303 /* Setting up output buffer */ 264 /* Setting up output buffer */
@@ -652,9 +613,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
652 acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); 613 acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0);
653 614
654 ide_port_for_each_dev(i, drive, hwif) { 615 ide_port_for_each_dev(i, drive, hwif) {
655 if (!drive->acpidata->obj_handle)
656 drive->acpidata->obj_handle = ide_acpi_drive_get_handle(drive);
657
658 if (drive->acpidata->obj_handle && 616 if (drive->acpidata->obj_handle &&
659 (drive->dev_flags & IDE_DFLAG_PRESENT)) { 617 (drive->dev_flags & IDE_DFLAG_PRESENT)) {
660 acpi_bus_set_power(drive->acpidata->obj_handle, 618 acpi_bus_set_power(drive->acpidata->obj_handle,
@@ -708,6 +666,25 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif)
708 hwif->devices[0]->acpidata = &hwif->acpidata->master; 666 hwif->devices[0]->acpidata = &hwif->acpidata->master;
709 hwif->devices[1]->acpidata = &hwif->acpidata->slave; 667 hwif->devices[1]->acpidata = &hwif->acpidata->slave;
710 668
669 /* get _ADR info for each device */
670 ide_port_for_each_dev(i, drive, hwif) {
671 acpi_handle dev_handle;
672
673 if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0)
674 continue;
675
676 DEBPRINT("ENTER: %s at channel#: %d port#: %d\n",
677 drive->name, hwif->channel, drive->dn & 1);
678
679 /* TBD: could also check ACPI object VALID bits */
680 dev_handle = acpi_get_child(hwif->acpidata->obj_handle,
681 drive->dn & 1);
682
683 DEBPRINT("drive %s handle 0x%p\n", drive->name, dev_handle);
684
685 drive->acpidata->obj_handle = dev_handle;
686 }
687
711 /* 688 /*
712 * Send IDENTIFY for each drive 689 * Send IDENTIFY for each drive
713 */ 690 */