hwregs.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. /*******************************************************************************
  2. *
  3. * Module Name: hwregs - Read/write access functions for the various ACPI
  4. * control and status registers.
  5. *
  6. ******************************************************************************/
  7. /*
  8. * Copyright (C) 2000 - 2012, Intel Corp.
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions, and the following disclaimer,
  16. * without modification.
  17. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18. * substantially similar to the "NO WARRANTY" disclaimer below
  19. * ("Disclaimer") and any redistribution must be conditioned upon
  20. * including a substantially similar Disclaimer requirement for further
  21. * binary redistribution.
  22. * 3. Neither the names of the above-listed copyright holders nor the names
  23. * of any contributors may be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * Alternatively, this software may be distributed under the terms of the
  27. * GNU General Public License ("GPL") version 2 as published by the Free
  28. * Software Foundation.
  29. *
  30. * NO WARRANTY
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41. * POSSIBILITY OF SUCH DAMAGES.
  42. */
  43. #include <acpi/acpi.h>
  44. #include "accommon.h"
  45. #include "acnamesp.h"
  46. #include "acevents.h"
  47. #define _COMPONENT ACPI_HARDWARE
  48. ACPI_MODULE_NAME("hwregs")
  49. #if (!ACPI_REDUCED_HARDWARE)
  50. /* Local Prototypes */
  51. static acpi_status
  52. acpi_hw_read_multiple(u32 *value,
  53. struct acpi_generic_address *register_a,
  54. struct acpi_generic_address *register_b);
  55. static acpi_status
  56. acpi_hw_write_multiple(u32 value,
  57. struct acpi_generic_address *register_a,
  58. struct acpi_generic_address *register_b);
  59. #endif /* !ACPI_REDUCED_HARDWARE */
  60. /******************************************************************************
  61. *
  62. * FUNCTION: acpi_hw_validate_register
  63. *
  64. * PARAMETERS: Reg - GAS register structure
  65. * max_bit_width - Max bit_width supported (32 or 64)
  66. * Address - Pointer to where the gas->address
  67. * is returned
  68. *
  69. * RETURN: Status
  70. *
  71. * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS
  72. * pointer, Address, space_id, bit_width, and bit_offset.
  73. *
  74. ******************************************************************************/
  75. acpi_status
  76. acpi_hw_validate_register(struct acpi_generic_address *reg,
  77. u8 max_bit_width, u64 *address)
  78. {
  79. /* Must have a valid pointer to a GAS structure */
  80. if (!reg) {
  81. return (AE_BAD_PARAMETER);
  82. }
  83. /*
  84. * Copy the target address. This handles possible alignment issues.
  85. * Address must not be null. A null address also indicates an optional
  86. * ACPI register that is not supported, so no error message.
  87. */
  88. ACPI_MOVE_64_TO_64(address, &reg->address);
  89. if (!(*address)) {
  90. return (AE_BAD_ADDRESS);
  91. }
  92. /* Validate the space_iD */
  93. if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
  94. (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
  95. ACPI_ERROR((AE_INFO,
  96. "Unsupported address space: 0x%X", reg->space_id));
  97. return (AE_SUPPORT);
  98. }
  99. /* Validate the bit_width */
  100. if ((reg->bit_width != 8) &&
  101. (reg->bit_width != 16) &&
  102. (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
  103. ACPI_ERROR((AE_INFO,
  104. "Unsupported register bit width: 0x%X",
  105. reg->bit_width));
  106. return (AE_SUPPORT);
  107. }
  108. /* Validate the bit_offset. Just a warning for now. */
  109. if (reg->bit_offset != 0) {
  110. ACPI_WARNING((AE_INFO,
  111. "Unsupported register bit offset: 0x%X",
  112. reg->bit_offset));
  113. }
  114. return (AE_OK);
  115. }
  116. /******************************************************************************
  117. *
  118. * FUNCTION: acpi_hw_read
  119. *
  120. * PARAMETERS: Value - Where the value is returned
  121. * Reg - GAS register structure
  122. *
  123. * RETURN: Status
  124. *
  125. * DESCRIPTION: Read from either memory or IO space. This is a 32-bit max
  126. * version of acpi_read, used internally since the overhead of
  127. * 64-bit values is not needed.
  128. *
  129. * LIMITATIONS: <These limitations also apply to acpi_hw_write>
  130. * bit_width must be exactly 8, 16, or 32.
  131. * space_iD must be system_memory or system_iO.
  132. * bit_offset and access_width are currently ignored, as there has
  133. * not been a need to implement these.
  134. *
  135. ******************************************************************************/
  136. acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
  137. {
  138. u64 address;
  139. u64 value64;
  140. acpi_status status;
  141. ACPI_FUNCTION_NAME(hw_read);
  142. /* Validate contents of the GAS register */
  143. status = acpi_hw_validate_register(reg, 32, &address);
  144. if (ACPI_FAILURE(status)) {
  145. return (status);
  146. }
  147. /* Initialize entire 32-bit return value to zero */
  148. *value = 0;
  149. /*
  150. * Two address spaces supported: Memory or IO. PCI_Config is
  151. * not supported here because the GAS structure is insufficient
  152. */
  153. if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
  154. status = acpi_os_read_memory((acpi_physical_address)
  155. address, &value64, reg->bit_width);
  156. *value = (u32)value64;
  157. } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
  158. status = acpi_hw_read_port((acpi_io_address)
  159. address, value, reg->bit_width);
  160. }
  161. ACPI_DEBUG_PRINT((ACPI_DB_IO,
  162. "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
  163. *value, reg->bit_width, ACPI_FORMAT_UINT64(address),
  164. acpi_ut_get_region_name(reg->space_id)));
  165. return (status);
  166. }
  167. /******************************************************************************
  168. *
  169. * FUNCTION: acpi_hw_write
  170. *
  171. * PARAMETERS: Value - Value to be written
  172. * Reg - GAS register structure
  173. *
  174. * RETURN: Status
  175. *
  176. * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max
  177. * version of acpi_write, used internally since the overhead of
  178. * 64-bit values is not needed.
  179. *
  180. ******************************************************************************/
  181. acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
  182. {
  183. u64 address;
  184. acpi_status status;
  185. ACPI_FUNCTION_NAME(hw_write);
  186. /* Validate contents of the GAS register */
  187. status = acpi_hw_validate_register(reg, 32, &address);
  188. if (ACPI_FAILURE(status)) {
  189. return (status);
  190. }
  191. /*
  192. * Two address spaces supported: Memory or IO. PCI_Config is
  193. * not supported here because the GAS structure is insufficient
  194. */
  195. if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
  196. status = acpi_os_write_memory((acpi_physical_address)
  197. address, (u64)value,
  198. reg->bit_width);
  199. } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
  200. status = acpi_hw_write_port((acpi_io_address)
  201. address, value, reg->bit_width);
  202. }
  203. ACPI_DEBUG_PRINT((ACPI_DB_IO,
  204. "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
  205. value, reg->bit_width, ACPI_FORMAT_UINT64(address),
  206. acpi_ut_get_region_name(reg->space_id)));
  207. return (status);
  208. }
  209. #if (!ACPI_REDUCED_HARDWARE)
  210. /*******************************************************************************
  211. *
  212. * FUNCTION: acpi_hw_clear_acpi_status
  213. *
  214. * PARAMETERS: None
  215. *
  216. * RETURN: Status
  217. *
  218. * DESCRIPTION: Clears all fixed and general purpose status bits
  219. *
  220. ******************************************************************************/
  221. acpi_status acpi_hw_clear_acpi_status(void)
  222. {
  223. acpi_status status;
  224. acpi_cpu_flags lock_flags = 0;
  225. ACPI_FUNCTION_TRACE(hw_clear_acpi_status);
  226. ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n",
  227. ACPI_BITMASK_ALL_FIXED_STATUS,
  228. ACPI_FORMAT_UINT64(acpi_gbl_xpm1a_status.address)));
  229. lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
  230. /* Clear the fixed events in PM1 A/B */
  231. status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
  232. ACPI_BITMASK_ALL_FIXED_STATUS);
  233. acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
  234. if (ACPI_FAILURE(status))
  235. goto exit;
  236. /* Clear the GPE Bits in all GPE registers in all GPE blocks */
  237. status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block, NULL);
  238. exit:
  239. return_ACPI_STATUS(status);
  240. }
  241. /*******************************************************************************
  242. *
  243. * FUNCTION: acpi_hw_get_bit_register_info
  244. *
  245. * PARAMETERS: register_id - Index of ACPI Register to access
  246. *
  247. * RETURN: The bitmask to be used when accessing the register
  248. *
  249. * DESCRIPTION: Map register_id into a register bitmask.
  250. *
  251. ******************************************************************************/
  252. struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
  253. {
  254. ACPI_FUNCTION_ENTRY();
  255. if (register_id > ACPI_BITREG_MAX) {
  256. ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: 0x%X",
  257. register_id));
  258. return (NULL);
  259. }
  260. return (&acpi_gbl_bit_register_info[register_id]);
  261. }
  262. /******************************************************************************
  263. *
  264. * FUNCTION: acpi_hw_write_pm1_control
  265. *
  266. * PARAMETERS: pm1a_control - Value to be written to PM1A control
  267. * pm1b_control - Value to be written to PM1B control
  268. *
  269. * RETURN: Status
  270. *
  271. * DESCRIPTION: Write the PM1 A/B control registers. These registers are
  272. * different than than the PM1 A/B status and enable registers
  273. * in that different values can be written to the A/B registers.
  274. * Most notably, the SLP_TYP bits can be different, as per the
  275. * values returned from the _Sx predefined methods.
  276. *
  277. ******************************************************************************/
  278. acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control)
  279. {
  280. acpi_status status;
  281. ACPI_FUNCTION_TRACE(hw_write_pm1_control);
  282. status =
  283. acpi_hw_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block);
  284. if (ACPI_FAILURE(status)) {
  285. return_ACPI_STATUS(status);
  286. }
  287. if (acpi_gbl_FADT.xpm1b_control_block.address) {
  288. status =
  289. acpi_hw_write(pm1b_control,
  290. &acpi_gbl_FADT.xpm1b_control_block);
  291. }
  292. return_ACPI_STATUS(status);
  293. }
  294. /******************************************************************************
  295. *
  296. * FUNCTION: acpi_hw_register_read
  297. *
  298. * PARAMETERS: register_id - ACPI Register ID
  299. * return_value - Where the register value is returned
  300. *
  301. * RETURN: Status and the value read.
  302. *
  303. * DESCRIPTION: Read from the specified ACPI register
  304. *
  305. ******************************************************************************/
  306. acpi_status
  307. acpi_hw_register_read(u32 register_id, u32 * return_value)
  308. {
  309. u32 value = 0;
  310. acpi_status status;
  311. ACPI_FUNCTION_TRACE(hw_register_read);
  312. switch (register_id) {
  313. case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */
  314. status = acpi_hw_read_multiple(&value,
  315. &acpi_gbl_xpm1a_status,
  316. &acpi_gbl_xpm1b_status);
  317. break;
  318. case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */
  319. status = acpi_hw_read_multiple(&value,
  320. &acpi_gbl_xpm1a_enable,
  321. &acpi_gbl_xpm1b_enable);
  322. break;
  323. case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
  324. status = acpi_hw_read_multiple(&value,
  325. &acpi_gbl_FADT.
  326. xpm1a_control_block,
  327. &acpi_gbl_FADT.
  328. xpm1b_control_block);
  329. /*
  330. * Zero the write-only bits. From the ACPI specification, "Hardware
  331. * Write-Only Bits": "Upon reads to registers with write-only bits,
  332. * software masks out all write-only bits."
  333. */
  334. value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS;
  335. break;
  336. case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
  337. status =
  338. acpi_hw_read(&value, &acpi_gbl_FADT.xpm2_control_block);
  339. break;
  340. case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
  341. status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm_timer_block);
  342. break;
  343. case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
  344. status =
  345. acpi_hw_read_port(acpi_gbl_FADT.smi_command, &value, 8);
  346. break;
  347. default:
  348. ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
  349. status = AE_BAD_PARAMETER;
  350. break;
  351. }
  352. if (ACPI_SUCCESS(status)) {
  353. *return_value = value;
  354. }
  355. return_ACPI_STATUS(status);
  356. }
  357. /******************************************************************************
  358. *
  359. * FUNCTION: acpi_hw_register_write
  360. *
  361. * PARAMETERS: register_id - ACPI Register ID
  362. * Value - The value to write
  363. *
  364. * RETURN: Status
  365. *
  366. * DESCRIPTION: Write to the specified ACPI register
  367. *
  368. * NOTE: In accordance with the ACPI specification, this function automatically
  369. * preserves the value of the following bits, meaning that these bits cannot be
  370. * changed via this interface:
  371. *
  372. * PM1_CONTROL[0] = SCI_EN
  373. * PM1_CONTROL[9]
  374. * PM1_STATUS[11]
  375. *
  376. * ACPI References:
  377. * 1) Hardware Ignored Bits: When software writes to a register with ignored
  378. * bit fields, it preserves the ignored bit fields
  379. * 2) SCI_EN: OSPM always preserves this bit position
  380. *
  381. ******************************************************************************/
  382. acpi_status acpi_hw_register_write(u32 register_id, u32 value)
  383. {
  384. acpi_status status;
  385. u32 read_value;
  386. ACPI_FUNCTION_TRACE(hw_register_write);
  387. switch (register_id) {
  388. case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */
  389. /*
  390. * Handle the "ignored" bit in PM1 Status. According to the ACPI
  391. * specification, ignored bits are to be preserved when writing.
  392. * Normally, this would mean a read/modify/write sequence. However,
  393. * preserving a bit in the status register is different. Writing a
  394. * one clears the status, and writing a zero preserves the status.
  395. * Therefore, we must always write zero to the ignored bit.
  396. *
  397. * This behavior is clarified in the ACPI 4.0 specification.
  398. */
  399. value &= ~ACPI_PM1_STATUS_PRESERVED_BITS;
  400. status = acpi_hw_write_multiple(value,
  401. &acpi_gbl_xpm1a_status,
  402. &acpi_gbl_xpm1b_status);
  403. break;
  404. case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access */
  405. status = acpi_hw_write_multiple(value,
  406. &acpi_gbl_xpm1a_enable,
  407. &acpi_gbl_xpm1b_enable);
  408. break;
  409. case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */
  410. /*
  411. * Perform a read first to preserve certain bits (per ACPI spec)
  412. * Note: This includes SCI_EN, we never want to change this bit
  413. */
  414. status = acpi_hw_read_multiple(&read_value,
  415. &acpi_gbl_FADT.
  416. xpm1a_control_block,
  417. &acpi_gbl_FADT.
  418. xpm1b_control_block);
  419. if (ACPI_FAILURE(status)) {
  420. goto exit;
  421. }
  422. /* Insert the bits to be preserved */
  423. ACPI_INSERT_BITS(value, ACPI_PM1_CONTROL_PRESERVED_BITS,
  424. read_value);
  425. /* Now we can write the data */
  426. status = acpi_hw_write_multiple(value,
  427. &acpi_gbl_FADT.
  428. xpm1a_control_block,
  429. &acpi_gbl_FADT.
  430. xpm1b_control_block);
  431. break;
  432. case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
  433. /*
  434. * For control registers, all reserved bits must be preserved,
  435. * as per the ACPI spec.
  436. */
  437. status =
  438. acpi_hw_read(&read_value,
  439. &acpi_gbl_FADT.xpm2_control_block);
  440. if (ACPI_FAILURE(status)) {
  441. goto exit;
  442. }
  443. /* Insert the bits to be preserved */
  444. ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS,
  445. read_value);
  446. status =
  447. acpi_hw_write(value, &acpi_gbl_FADT.xpm2_control_block);
  448. break;
  449. case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
  450. status = acpi_hw_write(value, &acpi_gbl_FADT.xpm_timer_block);
  451. break;
  452. case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
  453. /* SMI_CMD is currently always in IO space */
  454. status =
  455. acpi_hw_write_port(acpi_gbl_FADT.smi_command, value, 8);
  456. break;
  457. default:
  458. ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id));
  459. status = AE_BAD_PARAMETER;
  460. break;
  461. }
  462. exit:
  463. return_ACPI_STATUS(status);
  464. }
  465. /******************************************************************************
  466. *
  467. * FUNCTION: acpi_hw_read_multiple
  468. *
  469. * PARAMETERS: Value - Where the register value is returned
  470. * register_a - First ACPI register (required)
  471. * register_b - Second ACPI register (optional)
  472. *
  473. * RETURN: Status
  474. *
  475. * DESCRIPTION: Read from the specified two-part ACPI register (such as PM1 A/B)
  476. *
  477. ******************************************************************************/
  478. static acpi_status
  479. acpi_hw_read_multiple(u32 *value,
  480. struct acpi_generic_address *register_a,
  481. struct acpi_generic_address *register_b)
  482. {
  483. u32 value_a = 0;
  484. u32 value_b = 0;
  485. acpi_status status;
  486. /* The first register is always required */
  487. status = acpi_hw_read(&value_a, register_a);
  488. if (ACPI_FAILURE(status)) {
  489. return (status);
  490. }
  491. /* Second register is optional */
  492. if (register_b->address) {
  493. status = acpi_hw_read(&value_b, register_b);
  494. if (ACPI_FAILURE(status)) {
  495. return (status);
  496. }
  497. }
  498. /*
  499. * OR the two return values together. No shifting or masking is necessary,
  500. * because of how the PM1 registers are defined in the ACPI specification:
  501. *
  502. * "Although the bits can be split between the two register blocks (each
  503. * register block has a unique pointer within the FADT), the bit positions
  504. * are maintained. The register block with unimplemented bits (that is,
  505. * those implemented in the other register block) always returns zeros,
  506. * and writes have no side effects"
  507. */
  508. *value = (value_a | value_b);
  509. return (AE_OK);
  510. }
  511. /******************************************************************************
  512. *
  513. * FUNCTION: acpi_hw_write_multiple
  514. *
  515. * PARAMETERS: Value - The value to write
  516. * register_a - First ACPI register (required)
  517. * register_b - Second ACPI register (optional)
  518. *
  519. * RETURN: Status
  520. *
  521. * DESCRIPTION: Write to the specified two-part ACPI register (such as PM1 A/B)
  522. *
  523. ******************************************************************************/
  524. static acpi_status
  525. acpi_hw_write_multiple(u32 value,
  526. struct acpi_generic_address *register_a,
  527. struct acpi_generic_address *register_b)
  528. {
  529. acpi_status status;
  530. /* The first register is always required */
  531. status = acpi_hw_write(value, register_a);
  532. if (ACPI_FAILURE(status)) {
  533. return (status);
  534. }
  535. /*
  536. * Second register is optional
  537. *
  538. * No bit shifting or clearing is necessary, because of how the PM1
  539. * registers are defined in the ACPI specification:
  540. *
  541. * "Although the bits can be split between the two register blocks (each
  542. * register block has a unique pointer within the FADT), the bit positions
  543. * are maintained. The register block with unimplemented bits (that is,
  544. * those implemented in the other register block) always returns zeros,
  545. * and writes have no side effects"
  546. */
  547. if (register_b->address) {
  548. status = acpi_hw_write(value, register_b);
  549. }
  550. return (status);
  551. }
  552. #endif /* !ACPI_REDUCED_HARDWARE */