hwregs.c 19 KB

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