ide-acpi.c revision 7ed5b157d9dff55bf477b4c8b4708d5d45476677
1/* 2 * Provides ACPI support for IDE drives. 3 * 4 * Copyright (C) 2005 Intel Corp. 5 * Copyright (C) 2005 Randy Dunlap 6 * Copyright (C) 2006 SUSE Linux Products GmbH 7 * Copyright (C) 2006 Hannes Reinecke 8 */ 9 10#include <linux/ata.h> 11#include <linux/delay.h> 12#include <linux/device.h> 13#include <linux/errno.h> 14#include <linux/kernel.h> 15#include <acpi/acpi.h> 16#include <linux/ide.h> 17#include <linux/pci.h> 18#include <linux/dmi.h> 19 20#include <acpi/acpi_bus.h> 21 22#define REGS_PER_GTF 7 23struct taskfile_array { 24 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ 25}; 26 27struct GTM_buffer { 28 u32 PIO_speed0; 29 u32 DMA_speed0; 30 u32 PIO_speed1; 31 u32 DMA_speed1; 32 u32 GTM_flags; 33}; 34 35struct ide_acpi_drive_link { 36 acpi_handle obj_handle; 37 u8 idbuff[512]; 38}; 39 40struct ide_acpi_hwif_link { 41 ide_hwif_t *hwif; 42 acpi_handle obj_handle; 43 struct GTM_buffer gtm; 44 struct ide_acpi_drive_link master; 45 struct ide_acpi_drive_link slave; 46}; 47 48#undef DEBUGGING 49/* note: adds function name and KERN_DEBUG */ 50#ifdef DEBUGGING 51#define DEBPRINT(fmt, args...) \ 52 printk(KERN_DEBUG "%s: " fmt, __func__, ## args) 53#else 54#define DEBPRINT(fmt, args...) do {} while (0) 55#endif /* DEBUGGING */ 56 57static int ide_noacpi; 58module_param_named(noacpi, ide_noacpi, bool, 0); 59MODULE_PARM_DESC(noacpi, "disable IDE ACPI support"); 60 61static int ide_acpigtf; 62module_param_named(acpigtf, ide_acpigtf, bool, 0); 63MODULE_PARM_DESC(acpigtf, "enable IDE ACPI _GTF support"); 64 65static int ide_acpionboot; 66module_param_named(acpionboot, ide_acpionboot, bool, 0); 67MODULE_PARM_DESC(acpionboot, "call IDE ACPI methods on boot"); 68 69static bool ide_noacpi_psx; 70static int no_acpi_psx(const struct dmi_system_id *id) 71{ 72 ide_noacpi_psx = true; 73 printk(KERN_NOTICE"%s detected - disable ACPI _PSx.\n", id->ident); 74 return 0; 75} 76 77static const struct dmi_system_id ide_acpi_dmi_table[] = { 78 /* Bug 9673. */ 79 /* We should check if this is because ACPI NVS isn't save/restored. */ 80 { 81 .callback = no_acpi_psx, 82 .ident = "HP nx9005", 83 .matches = { 84 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies Ltd."), 85 DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60") 86 }, 87 }, 88 89 { } /* terminate list */ 90}; 91 92static int ide_acpi_blacklist(void) 93{ 94 static int done; 95 if (done) 96 return 0; 97 done = 1; 98 dmi_check_system(ide_acpi_dmi_table); 99 return 0; 100} 101 102/** 103 * ide_get_dev_handle - finds acpi_handle and PCI device.function 104 * @dev: device to locate 105 * @handle: returned acpi_handle for @dev 106 * @pcidevfn: return PCI device.func for @dev 107 * 108 * Returns the ACPI object handle to the corresponding PCI device. 109 * 110 * Returns 0 on success, <0 on error. 111 */ 112static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, 113 acpi_integer *pcidevfn) 114{ 115 struct pci_dev *pdev = to_pci_dev(dev); 116 unsigned int bus, devnum, func; 117 acpi_integer addr; 118 acpi_handle dev_handle; 119 struct acpi_buffer buffer = {.length = ACPI_ALLOCATE_BUFFER, 120 .pointer = NULL}; 121 acpi_status status; 122 struct acpi_device_info *dinfo = NULL; 123 int ret = -ENODEV; 124 125 bus = pdev->bus->number; 126 devnum = PCI_SLOT(pdev->devfn); 127 func = PCI_FUNC(pdev->devfn); 128 /* ACPI _ADR encoding for PCI bus: */ 129 addr = (acpi_integer)(devnum << 16 | func); 130 131 DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); 132 133 dev_handle = DEVICE_ACPI_HANDLE(dev); 134 if (!dev_handle) { 135 DEBPRINT("no acpi handle for device\n"); 136 goto err; 137 } 138 139 status = acpi_get_object_info(dev_handle, &buffer); 140 if (ACPI_FAILURE(status)) { 141 DEBPRINT("get_object_info for device failed\n"); 142 goto err; 143 } 144 dinfo = buffer.pointer; 145 if (dinfo && (dinfo->valid & ACPI_VALID_ADR) && 146 dinfo->address == addr) { 147 *pcidevfn = addr; 148 *handle = dev_handle; 149 } else { 150 DEBPRINT("get_object_info for device has wrong " 151 " address: %llu, should be %u\n", 152 dinfo ? (unsigned long long)dinfo->address : -1ULL, 153 (unsigned int)addr); 154 goto err; 155 } 156 157 DEBPRINT("for dev=0x%x.%x, addr=0x%llx, *handle=0x%p\n", 158 devnum, func, (unsigned long long)addr, *handle); 159 ret = 0; 160err: 161 kfree(dinfo); 162 return ret; 163} 164 165/** 166 * ide_acpi_hwif_get_handle - Get ACPI object handle for a given hwif 167 * @hwif: device to locate 168 * 169 * Retrieves the object handle for a given hwif. 170 * 171 * Returns handle on success, 0 on error. 172 */ 173static acpi_handle ide_acpi_hwif_get_handle(ide_hwif_t *hwif) 174{ 175 struct device *dev = hwif->gendev.parent; 176 acpi_handle uninitialized_var(dev_handle); 177 acpi_integer pcidevfn; 178 acpi_handle chan_handle; 179 int err; 180 181 DEBPRINT("ENTER: device %s\n", hwif->name); 182 183 if (!dev) { 184 DEBPRINT("no PCI device for %s\n", hwif->name); 185 return NULL; 186 } 187 188 err = ide_get_dev_handle(dev, &dev_handle, &pcidevfn); 189 if (err < 0) { 190 DEBPRINT("ide_get_dev_handle failed (%d)\n", err); 191 return NULL; 192 } 193 194 /* get child objects of dev_handle == channel objects, 195 * + _their_ children == drive objects */ 196 /* channel is hwif->channel */ 197 chan_handle = acpi_get_child(dev_handle, hwif->channel); 198 DEBPRINT("chan adr=%d: handle=0x%p\n", 199 hwif->channel, chan_handle); 200 201 return chan_handle; 202} 203 204/** 205 * do_drive_get_GTF - get the drive bootup default taskfile settings 206 * @drive: the drive for which the taskfile settings should be retrieved 207 * @gtf_length: number of bytes of _GTF data returned at @gtf_address 208 * @gtf_address: buffer containing _GTF taskfile arrays 209 * 210 * The _GTF method has no input parameters. 211 * It returns a variable number of register set values (registers 212 * hex 1F1..1F7, taskfiles). 213 * The <variable number> is not known in advance, so have ACPI-CA 214 * allocate the buffer as needed and return it, then free it later. 215 * 216 * The returned @gtf_length and @gtf_address are only valid if the 217 * function return value is 0. 218 */ 219static int do_drive_get_GTF(ide_drive_t *drive, 220 unsigned int *gtf_length, unsigned long *gtf_address, 221 unsigned long *obj_loc) 222{ 223 acpi_status status; 224 struct acpi_buffer output; 225 union acpi_object *out_obj; 226 ide_hwif_t *hwif = drive->hwif; 227 struct device *dev = hwif->gendev.parent; 228 int err = -ENODEV; 229 int port; 230 231 *gtf_length = 0; 232 *gtf_address = 0UL; 233 *obj_loc = 0UL; 234 235 if (ide_noacpi) 236 return 0; 237 238 if (!dev) { 239 DEBPRINT("no PCI device for %s\n", hwif->name); 240 goto out; 241 } 242 243 if (!hwif->acpidata) { 244 DEBPRINT("no ACPI data for %s\n", hwif->name); 245 goto out; 246 } 247 248 port = hwif->channel ? drive->dn - 2: drive->dn; 249 250 DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n", 251 hwif->name, dev_name(dev), port, hwif->channel); 252 253 if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) { 254 DEBPRINT("%s drive %d:%d not present\n", 255 hwif->name, hwif->channel, port); 256 goto out; 257 } 258 259 if (!drive->acpidata->obj_handle) { 260 DEBPRINT("No ACPI object found for %s\n", drive->name); 261 goto out; 262 } 263 264 /* Setting up output buffer */ 265 output.length = ACPI_ALLOCATE_BUFFER; 266 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ 267 268 /* _GTF has no input parameters */ 269 err = -EIO; 270 status = acpi_evaluate_object(drive->acpidata->obj_handle, "_GTF", 271 NULL, &output); 272 if (ACPI_FAILURE(status)) { 273 printk(KERN_DEBUG 274 "%s: Run _GTF error: status = 0x%x\n", 275 __func__, status); 276 goto out; 277 } 278 279 if (!output.length || !output.pointer) { 280 DEBPRINT("Run _GTF: " 281 "length or ptr is NULL (0x%llx, 0x%p)\n", 282 (unsigned long long)output.length, 283 output.pointer); 284 goto out; 285 } 286 287 out_obj = output.pointer; 288 if (out_obj->type != ACPI_TYPE_BUFFER) { 289 DEBPRINT("Run _GTF: error: " 290 "expected object type of ACPI_TYPE_BUFFER, " 291 "got 0x%x\n", out_obj->type); 292 err = -ENOENT; 293 kfree(output.pointer); 294 goto out; 295 } 296 297 if (!out_obj->buffer.length || !out_obj->buffer.pointer || 298 out_obj->buffer.length % REGS_PER_GTF) { 299 printk(KERN_ERR 300 "%s: unexpected GTF length (%d) or addr (0x%p)\n", 301 __func__, out_obj->buffer.length, 302 out_obj->buffer.pointer); 303 err = -ENOENT; 304 kfree(output.pointer); 305 goto out; 306 } 307 308 *gtf_length = out_obj->buffer.length; 309 *gtf_address = (unsigned long)out_obj->buffer.pointer; 310 *obj_loc = (unsigned long)out_obj; 311 DEBPRINT("returning gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", 312 *gtf_length, *gtf_address, *obj_loc); 313 err = 0; 314out: 315 return err; 316} 317 318/** 319 * taskfile_load_raw - send taskfile registers to drive 320 * @drive: drive to which output is sent 321 * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) 322 * 323 * Outputs IDE taskfile to the drive. 324 */ 325static int taskfile_load_raw(ide_drive_t *drive, 326 const struct taskfile_array *gtf) 327{ 328 ide_task_t args; 329 int err = 0; 330 331 DEBPRINT("(0x1f1-1f7): hex: " 332 "%02x %02x %02x %02x %02x %02x %02x\n", 333 gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], 334 gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]); 335 336 memset(&args, 0, sizeof(ide_task_t)); 337 338 /* convert gtf to IDE Taskfile */ 339 memcpy(&args.tf_array[7], >f->tfa, 7); 340 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 341 342 if (!ide_acpigtf) { 343 DEBPRINT("_GTF execution disabled\n"); 344 return err; 345 } 346 347 err = ide_no_data_taskfile(drive, &args); 348 if (err) 349 printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", 350 __func__, err); 351 352 return err; 353} 354 355/** 356 * do_drive_set_taskfiles - write the drive taskfile settings from _GTF 357 * @drive: the drive to which the taskfile command should be sent 358 * @gtf_length: total number of bytes of _GTF taskfiles 359 * @gtf_address: location of _GTF taskfile arrays 360 * 361 * Write {gtf_address, length gtf_length} in groups of 362 * REGS_PER_GTF bytes. 363 */ 364static int do_drive_set_taskfiles(ide_drive_t *drive, 365 unsigned int gtf_length, 366 unsigned long gtf_address) 367{ 368 int rc = -ENODEV, err; 369 int gtf_count = gtf_length / REGS_PER_GTF; 370 int ix; 371 struct taskfile_array *gtf; 372 373 if (ide_noacpi) 374 return 0; 375 376 DEBPRINT("ENTER: %s, hard_port#: %d\n", drive->name, drive->dn); 377 378 if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) 379 goto out; 380 381 if (!gtf_count) /* shouldn't be here */ 382 goto out; 383 384 DEBPRINT("total GTF bytes=%u (0x%x), gtf_count=%d, addr=0x%lx\n", 385 gtf_length, gtf_length, gtf_count, gtf_address); 386 387 if (gtf_length % REGS_PER_GTF) { 388 printk(KERN_ERR "%s: unexpected GTF length (%d)\n", 389 __func__, gtf_length); 390 goto out; 391 } 392 393 rc = 0; 394 for (ix = 0; ix < gtf_count; ix++) { 395 gtf = (struct taskfile_array *) 396 (gtf_address + ix * REGS_PER_GTF); 397 398 /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ 399 err = taskfile_load_raw(drive, gtf); 400 if (err) 401 rc = err; 402 } 403 404out: 405 return rc; 406} 407 408/** 409 * ide_acpi_exec_tfs - get then write drive taskfile settings 410 * @drive: the drive for which the taskfile settings should be 411 * written. 412 * 413 * According to the ACPI spec this should be called after _STM 414 * has been evaluated for the interface. Some ACPI vendors interpret 415 * that as a hard requirement and modify the taskfile according 416 * to the Identify Drive information passed down with _STM. 417 * So one should really make sure to call this only after _STM has 418 * been executed. 419 */ 420int ide_acpi_exec_tfs(ide_drive_t *drive) 421{ 422 int ret; 423 unsigned int gtf_length; 424 unsigned long gtf_address; 425 unsigned long obj_loc; 426 427 if (ide_noacpi) 428 return 0; 429 430 DEBPRINT("call get_GTF, drive=%s port=%d\n", drive->name, drive->dn); 431 432 ret = do_drive_get_GTF(drive, >f_length, >f_address, &obj_loc); 433 if (ret < 0) { 434 DEBPRINT("get_GTF error (%d)\n", ret); 435 return ret; 436 } 437 438 DEBPRINT("call set_taskfiles, drive=%s\n", drive->name); 439 440 ret = do_drive_set_taskfiles(drive, gtf_length, gtf_address); 441 kfree((void *)obj_loc); 442 if (ret < 0) { 443 DEBPRINT("set_taskfiles error (%d)\n", ret); 444 } 445 446 DEBPRINT("ret=%d\n", ret); 447 448 return ret; 449} 450 451/** 452 * ide_acpi_get_timing - get the channel (controller) timings 453 * @hwif: target IDE interface (channel) 454 * 455 * This function executes the _GTM ACPI method for the target channel. 456 * 457 */ 458void ide_acpi_get_timing(ide_hwif_t *hwif) 459{ 460 acpi_status status; 461 struct acpi_buffer output; 462 union acpi_object *out_obj; 463 464 if (ide_noacpi) 465 return; 466 467 DEBPRINT("ENTER:\n"); 468 469 if (!hwif->acpidata) { 470 DEBPRINT("no ACPI data for %s\n", hwif->name); 471 return; 472 } 473 474 /* Setting up output buffer for _GTM */ 475 output.length = ACPI_ALLOCATE_BUFFER; 476 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ 477 478 /* _GTM has no input parameters */ 479 status = acpi_evaluate_object(hwif->acpidata->obj_handle, "_GTM", 480 NULL, &output); 481 482 DEBPRINT("_GTM status: %d, outptr: 0x%p, outlen: 0x%llx\n", 483 status, output.pointer, 484 (unsigned long long)output.length); 485 486 if (ACPI_FAILURE(status)) { 487 DEBPRINT("Run _GTM error: status = 0x%x\n", status); 488 return; 489 } 490 491 if (!output.length || !output.pointer) { 492 DEBPRINT("Run _GTM: length or ptr is NULL (0x%llx, 0x%p)\n", 493 (unsigned long long)output.length, 494 output.pointer); 495 kfree(output.pointer); 496 return; 497 } 498 499 out_obj = output.pointer; 500 if (out_obj->type != ACPI_TYPE_BUFFER) { 501 kfree(output.pointer); 502 DEBPRINT("Run _GTM: error: " 503 "expected object type of ACPI_TYPE_BUFFER, " 504 "got 0x%x\n", out_obj->type); 505 return; 506 } 507 508 if (!out_obj->buffer.length || !out_obj->buffer.pointer || 509 out_obj->buffer.length != sizeof(struct GTM_buffer)) { 510 kfree(output.pointer); 511 printk(KERN_ERR 512 "%s: unexpected _GTM length (0x%x)[should be 0x%zx] or " 513 "addr (0x%p)\n", 514 __func__, out_obj->buffer.length, 515 sizeof(struct GTM_buffer), out_obj->buffer.pointer); 516 return; 517 } 518 519 memcpy(&hwif->acpidata->gtm, out_obj->buffer.pointer, 520 sizeof(struct GTM_buffer)); 521 522 DEBPRINT("_GTM info: ptr: 0x%p, len: 0x%x, exp.len: 0x%Zx\n", 523 out_obj->buffer.pointer, out_obj->buffer.length, 524 sizeof(struct GTM_buffer)); 525 526 DEBPRINT("_GTM fields: 0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", 527 hwif->acpidata->gtm.PIO_speed0, 528 hwif->acpidata->gtm.DMA_speed0, 529 hwif->acpidata->gtm.PIO_speed1, 530 hwif->acpidata->gtm.DMA_speed1, 531 hwif->acpidata->gtm.GTM_flags); 532 533 kfree(output.pointer); 534} 535 536/** 537 * ide_acpi_push_timing - set the channel (controller) timings 538 * @hwif: target IDE interface (channel) 539 * 540 * This function executes the _STM ACPI method for the target channel. 541 * 542 * _STM requires Identify Drive data, which has to passed as an argument. 543 * Unfortunately drive->id is a mangled version which we can't readily 544 * use; hence we'll get the information afresh. 545 */ 546void ide_acpi_push_timing(ide_hwif_t *hwif) 547{ 548 acpi_status status; 549 struct acpi_object_list input; 550 union acpi_object in_params[3]; 551 struct ide_acpi_drive_link *master = &hwif->acpidata->master; 552 struct ide_acpi_drive_link *slave = &hwif->acpidata->slave; 553 554 if (ide_noacpi) 555 return; 556 557 DEBPRINT("ENTER:\n"); 558 559 if (!hwif->acpidata) { 560 DEBPRINT("no ACPI data for %s\n", hwif->name); 561 return; 562 } 563 564 /* Give the GTM buffer + drive Identify data to the channel via the 565 * _STM method: */ 566 /* setup input parameters buffer for _STM */ 567 input.count = 3; 568 input.pointer = in_params; 569 in_params[0].type = ACPI_TYPE_BUFFER; 570 in_params[0].buffer.length = sizeof(struct GTM_buffer); 571 in_params[0].buffer.pointer = (u8 *)&hwif->acpidata->gtm; 572 in_params[1].type = ACPI_TYPE_BUFFER; 573 in_params[1].buffer.length = ATA_ID_WORDS * 2; 574 in_params[1].buffer.pointer = (u8 *)&master->idbuff; 575 in_params[2].type = ACPI_TYPE_BUFFER; 576 in_params[2].buffer.length = ATA_ID_WORDS * 2; 577 in_params[2].buffer.pointer = (u8 *)&slave->idbuff; 578 /* Output buffer: _STM has no output */ 579 580 status = acpi_evaluate_object(hwif->acpidata->obj_handle, "_STM", 581 &input, NULL); 582 583 if (ACPI_FAILURE(status)) { 584 DEBPRINT("Run _STM error: status = 0x%x\n", status); 585 } 586 DEBPRINT("_STM status: %d\n", status); 587} 588 589/** 590 * ide_acpi_set_state - set the channel power state 591 * @hwif: target IDE interface 592 * @on: state, on/off 593 * 594 * This function executes the _PS0/_PS3 ACPI method to set the power state. 595 * ACPI spec requires _PS0 when IDE power on and _PS3 when power off 596 */ 597void ide_acpi_set_state(ide_hwif_t *hwif, int on) 598{ 599 ide_drive_t *drive; 600 int i; 601 602 if (ide_noacpi || ide_noacpi_psx) 603 return; 604 605 DEBPRINT("ENTER:\n"); 606 607 if (!hwif->acpidata) { 608 DEBPRINT("no ACPI data for %s\n", hwif->name); 609 return; 610 } 611 612 /* channel first and then drives for power on and verse versa for power off */ 613 if (on) 614 acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); 615 616 ide_port_for_each_present_dev(i, drive, hwif) { 617 if (drive->acpidata->obj_handle) 618 acpi_bus_set_power(drive->acpidata->obj_handle, 619 on ? ACPI_STATE_D0 : ACPI_STATE_D3); 620 } 621 622 if (!on) 623 acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D3); 624} 625 626/** 627 * ide_acpi_init - initialize the ACPI link for an IDE interface 628 * @hwif: target IDE interface (channel) 629 * 630 * The ACPI spec is not quite clear when the drive identify buffer 631 * should be obtained. Calling IDENTIFY DEVICE during shutdown 632 * is not the best of ideas as the drive might already being put to 633 * sleep. And obviously we can't call it during resume. 634 * So we get the information during startup; but this means that 635 * any changes during run-time will be lost after resume. 636 */ 637void ide_acpi_init(ide_hwif_t *hwif) 638{ 639 ide_acpi_blacklist(); 640 641 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); 642 if (!hwif->acpidata) 643 return; 644 645 hwif->acpidata->obj_handle = ide_acpi_hwif_get_handle(hwif); 646 if (!hwif->acpidata->obj_handle) { 647 DEBPRINT("no ACPI object for %s found\n", hwif->name); 648 kfree(hwif->acpidata); 649 hwif->acpidata = NULL; 650 } 651} 652 653void ide_acpi_port_init_devices(ide_hwif_t *hwif) 654{ 655 ide_drive_t *drive; 656 int i, err; 657 658 if (hwif->acpidata == NULL) 659 return; 660 661 /* 662 * The ACPI spec mandates that we send information 663 * for both drives, regardless whether they are connected 664 * or not. 665 */ 666 hwif->devices[0]->acpidata = &hwif->acpidata->master; 667 hwif->devices[1]->acpidata = &hwif->acpidata->slave; 668 669 /* get _ADR info for each device */ 670 ide_port_for_each_present_dev(i, drive, hwif) { 671 acpi_handle dev_handle; 672 673 DEBPRINT("ENTER: %s at channel#: %d port#: %d\n", 674 drive->name, hwif->channel, drive->dn & 1); 675 676 /* TBD: could also check ACPI object VALID bits */ 677 dev_handle = acpi_get_child(hwif->acpidata->obj_handle, 678 drive->dn & 1); 679 680 DEBPRINT("drive %s handle 0x%p\n", drive->name, dev_handle); 681 682 drive->acpidata->obj_handle = dev_handle; 683 } 684 685 /* send IDENTIFY for each device */ 686 ide_port_for_each_present_dev(i, drive, hwif) { 687 err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff); 688 if (err) 689 DEBPRINT("identify device %s failed (%d)\n", 690 drive->name, err); 691 } 692 693 if (!ide_acpionboot) { 694 DEBPRINT("ACPI methods disabled on boot\n"); 695 return; 696 } 697 698 /* ACPI _PS0 before _STM */ 699 ide_acpi_set_state(hwif, 1); 700 /* 701 * ACPI requires us to call _STM on startup 702 */ 703 ide_acpi_get_timing(hwif); 704 ide_acpi_push_timing(hwif); 705 706 ide_port_for_each_present_dev(i, drive, hwif) { 707 ide_acpi_exec_tfs(drive); 708 } 709} 710