ide-acpi.c 16 KB

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