ide-acpi.c 16 KB

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