2 /*******************************************************************************
4 * Module Name: hwregs - Read/write access functions for the various ACPI
5 * control and status registers.
7 ******************************************************************************/
10 * Copyright (C) 2000 - 2005, R. Byron Moore
11 * All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions, and the following disclaimer,
18 * without modification.
19 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
20 * substantially similar to the "NO WARRANTY" disclaimer below
21 * ("Disclaimer") and any redistribution must be conditioned upon
22 * including a substantially similar Disclaimer requirement for further
23 * binary redistribution.
24 * 3. Neither the names of the above-listed copyright holders nor the names
25 * of any contributors may be used to endorse or promote products derived
26 * from this software without specific prior written permission.
28 * Alternatively, this software may be distributed under the terms of the
29 * GNU General Public License ("GPL") version 2 as published by the Free
30 * Software Foundation.
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
36 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 * POSSIBILITY OF SUCH DAMAGES.
46 #include <linux/module.h>
48 #include <acpi/acpi.h>
49 #include <acpi/acnamesp.h>
50 #include <acpi/acevents.h>
52 #define _COMPONENT ACPI_HARDWARE
53 ACPI_MODULE_NAME ("hwregs")
56 /*******************************************************************************
58 * FUNCTION: acpi_hw_clear_acpi_status
60 * PARAMETERS: Flags - Lock the hardware or not
64 * DESCRIPTION: Clears all fixed and general purpose status bits
65 * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
67 ******************************************************************************/
70 acpi_hw_clear_acpi_status (
76 ACPI_FUNCTION_TRACE ("hw_clear_acpi_status");
79 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "About to write %04X to %04X\n",
80 ACPI_BITMASK_ALL_FIXED_STATUS
,
81 (u16
) acpi_gbl_FADT
->xpm1a_evt_blk
.address
));
83 if (flags
& ACPI_MTX_LOCK
) {
84 status
= acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE
);
85 if (ACPI_FAILURE (status
)) {
86 return_ACPI_STATUS (status
);
90 status
= acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK
, ACPI_REGISTER_PM1_STATUS
,
91 ACPI_BITMASK_ALL_FIXED_STATUS
);
92 if (ACPI_FAILURE (status
)) {
96 /* Clear the fixed events */
98 if (acpi_gbl_FADT
->xpm1b_evt_blk
.address
) {
99 status
= acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS
,
100 &acpi_gbl_FADT
->xpm1b_evt_blk
);
101 if (ACPI_FAILURE (status
)) {
102 goto unlock_and_exit
;
106 /* Clear the GPE Bits in all GPE registers in all GPE blocks */
108 status
= acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block
, ACPI_ISR
);
111 if (flags
& ACPI_MTX_LOCK
) {
112 (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE
);
114 return_ACPI_STATUS (status
);
118 /*******************************************************************************
120 * FUNCTION: acpi_get_sleep_type_data
122 * PARAMETERS: sleep_state - Numeric sleep state
123 * *sleep_type_a - Where SLP_TYPa is returned
124 * *sleep_type_b - Where SLP_TYPb is returned
126 * RETURN: Status - ACPI status
128 * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep
131 ******************************************************************************/
134 acpi_get_sleep_type_data (
139 acpi_status status
= AE_OK
;
140 struct acpi_parameter_info info
;
143 ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data");
147 * Validate parameters
149 if ((sleep_state
> ACPI_S_STATES_MAX
) ||
150 !sleep_type_a
|| !sleep_type_b
) {
151 return_ACPI_STATUS (AE_BAD_PARAMETER
);
155 * Evaluate the namespace object containing the values for this state
157 info
.parameters
= NULL
;
158 status
= acpi_ns_evaluate_by_name ((char *) acpi_gbl_sleep_state_names
[sleep_state
],
160 if (ACPI_FAILURE (status
)) {
161 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC
, "%s while evaluating sleep_state [%s]\n",
162 acpi_format_exception (status
), acpi_gbl_sleep_state_names
[sleep_state
]));
164 return_ACPI_STATUS (status
);
167 /* Must have a return object */
169 if (!info
.return_object
) {
170 ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
171 status
= AE_NOT_EXIST
;
174 /* It must be of type Package */
176 else if (ACPI_GET_OBJECT_TYPE (info
.return_object
) != ACPI_TYPE_PACKAGE
) {
177 ACPI_REPORT_ERROR (("Sleep State object not a Package\n"));
178 status
= AE_AML_OPERAND_TYPE
;
181 /* The package must have at least two elements */
183 else if (info
.return_object
->package
.count
< 2) {
184 ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
185 status
= AE_AML_NO_OPERAND
;
188 /* The first two elements must both be of type Integer */
190 else if ((ACPI_GET_OBJECT_TYPE (info
.return_object
->package
.elements
[0]) != ACPI_TYPE_INTEGER
) ||
191 (ACPI_GET_OBJECT_TYPE (info
.return_object
->package
.elements
[1]) != ACPI_TYPE_INTEGER
)) {
192 ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n",
193 acpi_ut_get_object_type_name (info
.return_object
->package
.elements
[0]),
194 acpi_ut_get_object_type_name (info
.return_object
->package
.elements
[1])));
195 status
= AE_AML_OPERAND_TYPE
;
199 * Valid _Sx_ package size, type, and value
201 *sleep_type_a
= (u8
) (info
.return_object
->package
.elements
[0])->integer
.value
;
202 *sleep_type_b
= (u8
) (info
.return_object
->package
.elements
[1])->integer
.value
;
205 if (ACPI_FAILURE (status
)) {
206 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
,
207 "While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
208 acpi_gbl_sleep_state_names
[sleep_state
], info
.return_object
,
209 acpi_ut_get_object_type_name (info
.return_object
)));
212 acpi_ut_remove_reference (info
.return_object
);
213 return_ACPI_STATUS (status
);
215 EXPORT_SYMBOL(acpi_get_sleep_type_data
);
218 /*******************************************************************************
220 * FUNCTION: acpi_hw_get_register_bit_mask
222 * PARAMETERS: register_id - Index of ACPI Register to access
224 * RETURN: The bit mask to be used when accessing the register
226 * DESCRIPTION: Map register_id into a register bit mask.
228 ******************************************************************************/
230 struct acpi_bit_register_info
*
231 acpi_hw_get_bit_register_info (
234 ACPI_FUNCTION_NAME ("hw_get_bit_register_info");
237 if (register_id
> ACPI_BITREG_MAX
) {
238 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
, "Invalid bit_register ID: %X\n", register_id
));
242 return (&acpi_gbl_bit_register_info
[register_id
]);
246 /*******************************************************************************
248 * FUNCTION: acpi_get_register
250 * PARAMETERS: register_id - ID of ACPI bit_register to access
251 * return_value - Value that was read from the register
252 * Flags - Lock the hardware or not
254 * RETURN: Status and the value read from specified Register. Value
255 * returned is normalized to bit0 (is shifted all the way right)
257 * DESCRIPTION: ACPI bit_register read function.
259 ******************************************************************************/
267 u32 register_value
= 0;
268 struct acpi_bit_register_info
*bit_reg_info
;
272 ACPI_FUNCTION_TRACE ("acpi_get_register");
275 /* Get the info structure corresponding to the requested ACPI Register */
277 bit_reg_info
= acpi_hw_get_bit_register_info (register_id
);
279 return_ACPI_STATUS (AE_BAD_PARAMETER
);
282 if (flags
& ACPI_MTX_LOCK
) {
283 status
= acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE
);
284 if (ACPI_FAILURE (status
)) {
285 return_ACPI_STATUS (status
);
289 /* Read from the register */
291 status
= acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK
,
292 bit_reg_info
->parent_register
, ®ister_value
);
294 if (flags
& ACPI_MTX_LOCK
) {
295 (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE
);
298 if (ACPI_SUCCESS (status
)) {
299 /* Normalize the value that was read */
301 register_value
= ((register_value
& bit_reg_info
->access_bit_mask
)
302 >> bit_reg_info
->bit_position
);
304 *return_value
= register_value
;
306 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "Read value %8.8X register %X\n",
307 register_value
, bit_reg_info
->parent_register
));
310 return_ACPI_STATUS (status
);
312 EXPORT_SYMBOL(acpi_get_register
);
315 /*******************************************************************************
317 * FUNCTION: acpi_set_register
319 * PARAMETERS: register_id - ID of ACPI bit_register to access
320 * Value - (only used on write) value to write to the
321 * Register, NOT pre-normalized to the bit pos
322 * Flags - Lock the hardware or not
326 * DESCRIPTION: ACPI Bit Register write function.
328 ******************************************************************************/
336 u32 register_value
= 0;
337 struct acpi_bit_register_info
*bit_reg_info
;
341 ACPI_FUNCTION_TRACE_U32 ("acpi_set_register", register_id
);
344 /* Get the info structure corresponding to the requested ACPI Register */
346 bit_reg_info
= acpi_hw_get_bit_register_info (register_id
);
348 ACPI_REPORT_ERROR (("Bad ACPI HW register_id: %X\n", register_id
));
349 return_ACPI_STATUS (AE_BAD_PARAMETER
);
352 if (flags
& ACPI_MTX_LOCK
) {
353 status
= acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE
);
354 if (ACPI_FAILURE (status
)) {
355 return_ACPI_STATUS (status
);
359 /* Always do a register read first so we can insert the new bits */
361 status
= acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK
,
362 bit_reg_info
->parent_register
, ®ister_value
);
363 if (ACPI_FAILURE (status
)) {
364 goto unlock_and_exit
;
368 * Decode the Register ID
369 * Register ID = [Register block ID] | [bit ID]
371 * Check bit ID to fine locate Register offset.
372 * Check Mask to determine Register offset, and then read-write.
374 switch (bit_reg_info
->parent_register
) {
375 case ACPI_REGISTER_PM1_STATUS
:
378 * Status Registers are different from the rest. Clear by
379 * writing 1, and writing 0 has no effect. So, the only relevant
380 * information is the single bit we're interested in, all others should
381 * be written as 0 so they will be left unchanged.
383 value
= ACPI_REGISTER_PREPARE_BITS (value
,
384 bit_reg_info
->bit_position
, bit_reg_info
->access_bit_mask
);
386 status
= acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK
,
387 ACPI_REGISTER_PM1_STATUS
, (u16
) value
);
393 case ACPI_REGISTER_PM1_ENABLE
:
395 ACPI_REGISTER_INSERT_VALUE (register_value
, bit_reg_info
->bit_position
,
396 bit_reg_info
->access_bit_mask
, value
);
398 status
= acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK
,
399 ACPI_REGISTER_PM1_ENABLE
, (u16
) register_value
);
403 case ACPI_REGISTER_PM1_CONTROL
:
406 * Write the PM1 Control register.
407 * Note that at this level, the fact that there are actually TWO
408 * registers (A and B - and B may not exist) is abstracted.
410 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "PM1 control: Read %X\n", register_value
));
412 ACPI_REGISTER_INSERT_VALUE (register_value
, bit_reg_info
->bit_position
,
413 bit_reg_info
->access_bit_mask
, value
);
415 status
= acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK
,
416 ACPI_REGISTER_PM1_CONTROL
, (u16
) register_value
);
420 case ACPI_REGISTER_PM2_CONTROL
:
422 status
= acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK
,
423 ACPI_REGISTER_PM2_CONTROL
, ®ister_value
);
424 if (ACPI_FAILURE (status
)) {
425 goto unlock_and_exit
;
428 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "PM2 control: Read %X from %8.8X%8.8X\n",
430 ACPI_FORMAT_UINT64 (acpi_gbl_FADT
->xpm2_cnt_blk
.address
)));
432 ACPI_REGISTER_INSERT_VALUE (register_value
, bit_reg_info
->bit_position
,
433 bit_reg_info
->access_bit_mask
, value
);
435 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "About to write %4.4X to %8.8X%8.8X\n",
437 ACPI_FORMAT_UINT64 (acpi_gbl_FADT
->xpm2_cnt_blk
.address
)));
439 status
= acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK
,
440 ACPI_REGISTER_PM2_CONTROL
, (u8
) (register_value
));
451 if (flags
& ACPI_MTX_LOCK
) {
452 (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE
);
455 /* Normalize the value that was read */
457 ACPI_DEBUG_EXEC (register_value
= ((register_value
& bit_reg_info
->access_bit_mask
) >> bit_reg_info
->bit_position
));
459 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "Set bits: %8.8X actual %8.8X register %X\n",
460 value
, register_value
, bit_reg_info
->parent_register
));
461 return_ACPI_STATUS (status
);
463 EXPORT_SYMBOL(acpi_set_register
);
466 /******************************************************************************
468 * FUNCTION: acpi_hw_register_read
470 * PARAMETERS: use_lock - Mutex hw access
471 * register_id - register_iD + Offset
472 * return_value - Value that was read from the register
474 * RETURN: Status and the value read.
476 * DESCRIPTION: Acpi register read function. Registers are read at the
479 ******************************************************************************/
482 acpi_hw_register_read (
492 ACPI_FUNCTION_TRACE ("hw_register_read");
495 if (ACPI_MTX_LOCK
== use_lock
) {
496 status
= acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE
);
497 if (ACPI_FAILURE (status
)) {
498 return_ACPI_STATUS (status
);
502 switch (register_id
) {
503 case ACPI_REGISTER_PM1_STATUS
: /* 16-bit access */
505 status
= acpi_hw_low_level_read (16, &value1
, &acpi_gbl_FADT
->xpm1a_evt_blk
);
506 if (ACPI_FAILURE (status
)) {
507 goto unlock_and_exit
;
510 /* PM1B is optional */
512 status
= acpi_hw_low_level_read (16, &value2
, &acpi_gbl_FADT
->xpm1b_evt_blk
);
517 case ACPI_REGISTER_PM1_ENABLE
: /* 16-bit access */
519 status
= acpi_hw_low_level_read (16, &value1
, &acpi_gbl_xpm1a_enable
);
520 if (ACPI_FAILURE (status
)) {
521 goto unlock_and_exit
;
524 /* PM1B is optional */
526 status
= acpi_hw_low_level_read (16, &value2
, &acpi_gbl_xpm1b_enable
);
531 case ACPI_REGISTER_PM1_CONTROL
: /* 16-bit access */
533 status
= acpi_hw_low_level_read (16, &value1
, &acpi_gbl_FADT
->xpm1a_cnt_blk
);
534 if (ACPI_FAILURE (status
)) {
535 goto unlock_and_exit
;
538 status
= acpi_hw_low_level_read (16, &value2
, &acpi_gbl_FADT
->xpm1b_cnt_blk
);
543 case ACPI_REGISTER_PM2_CONTROL
: /* 8-bit access */
545 status
= acpi_hw_low_level_read (8, &value1
, &acpi_gbl_FADT
->xpm2_cnt_blk
);
549 case ACPI_REGISTER_PM_TIMER
: /* 32-bit access */
551 status
= acpi_hw_low_level_read (32, &value1
, &acpi_gbl_FADT
->xpm_tmr_blk
);
554 case ACPI_REGISTER_SMI_COMMAND_BLOCK
: /* 8-bit access */
556 status
= acpi_os_read_port (acpi_gbl_FADT
->smi_cmd
, &value1
, 8);
560 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
, "Unknown Register ID: %X\n", register_id
));
561 status
= AE_BAD_PARAMETER
;
566 if (ACPI_MTX_LOCK
== use_lock
) {
567 (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE
);
570 if (ACPI_SUCCESS (status
)) {
571 *return_value
= value1
;
574 return_ACPI_STATUS (status
);
578 /******************************************************************************
580 * FUNCTION: acpi_hw_register_write
582 * PARAMETERS: use_lock - Mutex hw access
583 * register_id - register_iD + Offset
584 * Value - The value to write
588 * DESCRIPTION: Acpi register Write function. Registers are written at the
591 ******************************************************************************/
594 acpi_hw_register_write (
602 ACPI_FUNCTION_TRACE ("hw_register_write");
605 if (ACPI_MTX_LOCK
== use_lock
) {
606 status
= acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE
);
607 if (ACPI_FAILURE (status
)) {
608 return_ACPI_STATUS (status
);
612 switch (register_id
) {
613 case ACPI_REGISTER_PM1_STATUS
: /* 16-bit access */
615 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_FADT
->xpm1a_evt_blk
);
616 if (ACPI_FAILURE (status
)) {
617 goto unlock_and_exit
;
620 /* PM1B is optional */
622 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_FADT
->xpm1b_evt_blk
);
626 case ACPI_REGISTER_PM1_ENABLE
: /* 16-bit access*/
628 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_xpm1a_enable
);
629 if (ACPI_FAILURE (status
)) {
630 goto unlock_and_exit
;
633 /* PM1B is optional */
635 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_xpm1b_enable
);
639 case ACPI_REGISTER_PM1_CONTROL
: /* 16-bit access */
641 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_FADT
->xpm1a_cnt_blk
);
642 if (ACPI_FAILURE (status
)) {
643 goto unlock_and_exit
;
646 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_FADT
->xpm1b_cnt_blk
);
650 case ACPI_REGISTER_PM1A_CONTROL
: /* 16-bit access */
652 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_FADT
->xpm1a_cnt_blk
);
656 case ACPI_REGISTER_PM1B_CONTROL
: /* 16-bit access */
658 status
= acpi_hw_low_level_write (16, value
, &acpi_gbl_FADT
->xpm1b_cnt_blk
);
662 case ACPI_REGISTER_PM2_CONTROL
: /* 8-bit access */
664 status
= acpi_hw_low_level_write (8, value
, &acpi_gbl_FADT
->xpm2_cnt_blk
);
668 case ACPI_REGISTER_PM_TIMER
: /* 32-bit access */
670 status
= acpi_hw_low_level_write (32, value
, &acpi_gbl_FADT
->xpm_tmr_blk
);
674 case ACPI_REGISTER_SMI_COMMAND_BLOCK
: /* 8-bit access */
676 /* SMI_CMD is currently always in IO space */
678 status
= acpi_os_write_port (acpi_gbl_FADT
->smi_cmd
, value
, 8);
683 status
= AE_BAD_PARAMETER
;
688 if (ACPI_MTX_LOCK
== use_lock
) {
689 (void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE
);
692 return_ACPI_STATUS (status
);
696 /******************************************************************************
698 * FUNCTION: acpi_hw_low_level_read
700 * PARAMETERS: Width - 8, 16, or 32
701 * Value - Where the value is returned
702 * Reg - GAS register structure
706 * DESCRIPTION: Read from either memory or IO space.
708 ******************************************************************************/
711 acpi_hw_low_level_read (
714 struct acpi_generic_address
*reg
)
720 ACPI_FUNCTION_NAME ("hw_low_level_read");
724 * Must have a valid pointer to a GAS structure, and
725 * a non-zero address within. However, don't return an error
726 * because the PM1A/B code must not fail if B isn't present.
732 /* Get a local copy of the address. Handles possible alignment issues */
734 ACPI_MOVE_64_TO_64 (&address
, ®
->address
);
741 * Two address spaces supported: Memory or IO.
742 * PCI_Config is not supported here because the GAS struct is insufficient
744 switch (reg
->address_space_id
) {
745 case ACPI_ADR_SPACE_SYSTEM_MEMORY
:
747 status
= acpi_os_read_memory (
748 (acpi_physical_address
) address
,
753 case ACPI_ADR_SPACE_SYSTEM_IO
:
755 status
= acpi_os_read_port ((acpi_io_address
) address
,
761 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
,
762 "Unsupported address space: %X\n", reg
->address_space_id
));
763 return (AE_BAD_PARAMETER
);
766 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
768 ACPI_FORMAT_UINT64 (address
),
769 acpi_ut_get_region_name (reg
->address_space_id
)));
775 /******************************************************************************
777 * FUNCTION: acpi_hw_low_level_write
779 * PARAMETERS: Width - 8, 16, or 32
780 * Value - To be written
781 * Reg - GAS register structure
785 * DESCRIPTION: Write to either memory or IO space.
787 ******************************************************************************/
790 acpi_hw_low_level_write (
793 struct acpi_generic_address
*reg
)
799 ACPI_FUNCTION_NAME ("hw_low_level_write");
803 * Must have a valid pointer to a GAS structure, and
804 * a non-zero address within. However, don't return an error
805 * because the PM1A/B code must not fail if B isn't present.
811 /* Get a local copy of the address. Handles possible alignment issues */
813 ACPI_MOVE_64_TO_64 (&address
, ®
->address
);
819 * Two address spaces supported: Memory or IO.
820 * PCI_Config is not supported here because the GAS struct is insufficient
822 switch (reg
->address_space_id
) {
823 case ACPI_ADR_SPACE_SYSTEM_MEMORY
:
825 status
= acpi_os_write_memory (
826 (acpi_physical_address
) address
,
831 case ACPI_ADR_SPACE_SYSTEM_IO
:
833 status
= acpi_os_write_port ((acpi_io_address
) address
,
839 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
,
840 "Unsupported address space: %X\n", reg
->address_space_id
));
841 return (AE_BAD_PARAMETER
);
844 ACPI_DEBUG_PRINT ((ACPI_DB_IO
, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
846 ACPI_FORMAT_UINT64 (address
),
847 acpi_ut_get_region_name (reg
->address_space_id
)));