ACPICA: Add 64-bit support to acpi_read and acpi_write

Needed by drivers for new ACPi tables.  Internal versions of
these functions still use 32-bit max transfers, in order to
minimize disruption and stack use for the standard ACPI registers
(FADT-based).

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Bob Moore 2009-06-24 09:44:06 +08:00 committed by Len Brown
parent f8d80cdf40
commit c6b5774caa
8 changed files with 328 additions and 106 deletions

View file

@ -62,6 +62,14 @@ u32 acpi_hw_get_mode(void);
/* /*
* hwregs - ACPI Register I/O * hwregs - ACPI Register I/O
*/ */
acpi_status
acpi_hw_validate_register(struct acpi_generic_address *reg,
u8 max_bit_width, u64 *address);
acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg);
acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg);
struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control); acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control);

View file

@ -424,8 +424,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
/* Read the Status Register */ /* Read the Status Register */
status = status =
acpi_read(&status_reg, acpi_hw_read(&status_reg,
&gpe_register_info->status_address); &gpe_register_info->status_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
@ -433,8 +433,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
/* Read the Enable Register */ /* Read the Enable Register */
status = status =
acpi_read(&enable_reg, acpi_hw_read(&enable_reg,
&gpe_register_info->enable_address); &gpe_register_info->enable_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }

View file

@ -843,14 +843,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
/* Disable all GPEs within this register */ /* Disable all GPEs within this register */
status = acpi_write(0x00, &this_register->enable_address); status = acpi_hw_write(0x00, &this_register->enable_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto error_exit; goto error_exit;
} }
/* Clear any pending GPE events within this register */ /* Clear any pending GPE events within this register */
status = acpi_write(0xFF, &this_register->status_address); status = acpi_hw_write(0xFF, &this_register->status_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto error_exit; goto error_exit;
} }

View file

@ -82,7 +82,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
/* Get current value of the enable register that contains this GPE */ /* Get current value of the enable register that contains this GPE */
status = acpi_read(&enable_mask, &gpe_register_info->enable_address); status = acpi_hw_read(&enable_mask, &gpe_register_info->enable_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -95,7 +95,7 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
/* Write the updated enable mask */ /* Write the updated enable mask */
status = acpi_write(enable_mask, &gpe_register_info->enable_address); status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
return (status); return (status);
} }
@ -130,8 +130,8 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
/* Write the entire GPE (runtime) enable register */ /* Write the entire GPE (runtime) enable register */
status = acpi_write(gpe_register_info->enable_for_run, status = acpi_hw_write(gpe_register_info->enable_for_run,
&gpe_register_info->enable_address); &gpe_register_info->enable_address);
return (status); return (status);
} }
@ -163,8 +163,8 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
* Write a one to the appropriate bit in the status register to * Write a one to the appropriate bit in the status register to
* clear this GPE. * clear this GPE.
*/ */
status = acpi_write(register_bit, status = acpi_hw_write(register_bit,
&gpe_event_info->register_info->status_address); &gpe_event_info->register_info->status_address);
return (status); return (status);
} }
@ -222,7 +222,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
/* GPE currently active (status bit == 1)? */ /* GPE currently active (status bit == 1)? */
status = acpi_read(&in_byte, &gpe_register_info->status_address); status = acpi_hw_read(&in_byte, &gpe_register_info->status_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto unlock_and_exit; goto unlock_and_exit;
} }
@ -266,8 +266,8 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
/* Disable all GPEs in this register */ /* Disable all GPEs in this register */
status = status =
acpi_write(0x00, acpi_hw_write(0x00,
&gpe_block->register_info[i].enable_address); &gpe_block->register_info[i].enable_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -303,8 +303,8 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
/* Clear status on all GPEs in this register */ /* Clear status on all GPEs in this register */
status = status =
acpi_write(0xFF, acpi_hw_write(0xFF,
&gpe_block->register_info[i].status_address); &gpe_block->register_info[i].status_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -345,9 +345,9 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
/* Enable all "runtime" GPEs in this register */ /* Enable all "runtime" GPEs in this register */
status = acpi_write(gpe_block->register_info[i].enable_for_run, status =
&gpe_block->register_info[i]. acpi_hw_write(gpe_block->register_info[i].enable_for_run,
enable_address); &gpe_block->register_info[i].enable_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -387,9 +387,9 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
/* Enable all "wake" GPEs in this register */ /* Enable all "wake" GPEs in this register */
status = acpi_write(gpe_block->register_info[i].enable_for_wake, status =
&gpe_block->register_info[i]. acpi_hw_write(gpe_block->register_info[i].enable_for_wake,
enable_address); &gpe_block->register_info[i].enable_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }

View file

@ -62,6 +62,184 @@ acpi_hw_write_multiple(u32 value,
struct acpi_generic_address *register_a, struct acpi_generic_address *register_a,
struct acpi_generic_address *register_b); struct acpi_generic_address *register_b);
/******************************************************************************
*
* FUNCTION: acpi_hw_validate_register
*
* PARAMETERS: Reg - GAS register structure
* max_bit_width - Max bit_width supported (32 or 64)
* Address - Pointer to where the gas->address
* is returned
*
* RETURN: Status
*
* DESCRIPTION: Validate the contents of a GAS register. Checks the GAS
* pointer, Address, space_id, bit_width, and bit_offset.
*
******************************************************************************/
acpi_status
acpi_hw_validate_register(struct acpi_generic_address *reg,
u8 max_bit_width, u64 *address)
{
/* Must have a valid pointer to a GAS structure */
if (!reg) {
return (AE_BAD_PARAMETER);
}
/*
* Copy the target address. This handles possible alignment issues.
* Address must not be null. A null address also indicates an optional
* ACPI register that is not supported, so no error message.
*/
ACPI_MOVE_64_TO_64(address, &reg->address);
if (!(*address)) {
return (AE_BAD_ADDRESS);
}
/* Validate the space_iD */
if ((reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
(reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
ACPI_ERROR((AE_INFO,
"Unsupported address space: 0x%X", reg->space_id));
return (AE_SUPPORT);
}
/* Validate the bit_width */
if ((reg->bit_width != 8) &&
(reg->bit_width != 16) &&
(reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
ACPI_ERROR((AE_INFO,
"Unsupported register bit width: 0x%X",
reg->bit_width));
return (AE_SUPPORT);
}
/* Validate the bit_offset. Just a warning for now. */
if (reg->bit_offset != 0) {
ACPI_WARNING((AE_INFO,
"Unsupported register bit offset: 0x%X",
reg->bit_offset));
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_read
*
* PARAMETERS: Value - Where the value is returned
* Reg - GAS register structure
*
* RETURN: Status
*
* DESCRIPTION: Read from either memory or IO space. This is a 32-bit max
* version of acpi_read, used internally since the overhead of
* 64-bit values is not needed.
*
* LIMITATIONS: <These limitations also apply to acpi_hw_write>
* bit_width must be exactly 8, 16, or 32.
* space_iD must be system_memory or system_iO.
* bit_offset and access_width are currently ignored, as there has
* not been a need to implement these.
*
******************************************************************************/
acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
{
u64 address;
acpi_status status;
ACPI_FUNCTION_NAME(hw_read);
/* Validate contents of the GAS register */
status = acpi_hw_validate_register(reg, 32, &address);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Initialize entire 32-bit return value to zero */
*value = 0;
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
status = acpi_os_read_memory((acpi_physical_address)
address, value, reg->bit_width);
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
status = acpi_hw_read_port((acpi_io_address)
address, value, reg->bit_width);
}
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
*value, reg->bit_width, ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id)));
return (status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_write
*
* PARAMETERS: Value - Value to be written
* Reg - GAS register structure
*
* RETURN: Status
*
* DESCRIPTION: Write to either memory or IO space. This is a 32-bit max
* version of acpi_write, used internally since the overhead of
* 64-bit values is not needed.
*
******************************************************************************/
acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
{
u64 address;
acpi_status status;
ACPI_FUNCTION_NAME(hw_write);
/* Validate contents of the GAS register */
status = acpi_hw_validate_register(reg, 32, &address);
if (ACPI_FAILURE(status)) {
return (status);
}
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
status = acpi_os_write_memory((acpi_physical_address)
address, value, reg->bit_width);
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
status = acpi_hw_write_port((acpi_io_address)
address, value, reg->bit_width);
}
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
value, reg->bit_width, ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id)));
return (status);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_hw_clear_acpi_status * FUNCTION: acpi_hw_clear_acpi_status
@ -152,15 +330,16 @@ acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control)
ACPI_FUNCTION_TRACE(hw_write_pm1_control); ACPI_FUNCTION_TRACE(hw_write_pm1_control);
status = acpi_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block); status =
acpi_hw_write(pm1a_control, &acpi_gbl_FADT.xpm1a_control_block);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
if (acpi_gbl_FADT.xpm1b_control_block.address) { if (acpi_gbl_FADT.xpm1b_control_block.address) {
status = status =
acpi_write(pm1b_control, acpi_hw_write(pm1b_control,
&acpi_gbl_FADT.xpm1b_control_block); &acpi_gbl_FADT.xpm1b_control_block);
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -218,12 +397,13 @@ acpi_hw_register_read(u32 register_id, u32 * return_value)
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
status = acpi_read(&value, &acpi_gbl_FADT.xpm2_control_block); status =
acpi_hw_read(&value, &acpi_gbl_FADT.xpm2_control_block);
break; break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
status = acpi_read(&value, &acpi_gbl_FADT.xpm_timer_block); status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm_timer_block);
break; break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
@ -340,7 +520,8 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
* as per the ACPI spec. * as per the ACPI spec.
*/ */
status = status =
acpi_read(&read_value, &acpi_gbl_FADT.xpm2_control_block); acpi_hw_read(&read_value,
&acpi_gbl_FADT.xpm2_control_block);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto exit; goto exit;
} }
@ -350,12 +531,13 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value)
ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS, ACPI_INSERT_BITS(value, ACPI_PM2_CONTROL_PRESERVED_BITS,
read_value); read_value);
status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block); status =
acpi_hw_write(value, &acpi_gbl_FADT.xpm2_control_block);
break; break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block); status = acpi_hw_write(value, &acpi_gbl_FADT.xpm_timer_block);
break; break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
@ -401,7 +583,7 @@ acpi_hw_read_multiple(u32 *value,
/* The first register is always required */ /* The first register is always required */
status = acpi_read(&value_a, register_a); status = acpi_hw_read(&value_a, register_a);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -409,7 +591,7 @@ acpi_hw_read_multiple(u32 *value,
/* Second register is optional */ /* Second register is optional */
if (register_b->address) { if (register_b->address) {
status = acpi_read(&value_b, register_b); status = acpi_hw_read(&value_b, register_b);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -452,7 +634,7 @@ acpi_hw_write_multiple(u32 value,
/* The first register is always required */ /* The first register is always required */
status = acpi_write(value, register_a); status = acpi_hw_write(value, register_a);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return (status); return (status);
} }
@ -470,7 +652,7 @@ acpi_hw_write_multiple(u32 value,
* and writes have no side effects" * and writes have no side effects"
*/ */
if (register_b->address) { if (register_b->address) {
status = acpi_write(value, register_b); status = acpi_hw_write(value, register_b);
} }
return (status); return (status);

View file

@ -100,7 +100,7 @@ acpi_status acpi_get_timer(u32 * ticks)
} }
status = status =
acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT.xpm_timer_block); acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View file

@ -80,7 +80,7 @@ acpi_status acpi_reset(void)
/* Write the reset value to the reset register */ /* Write the reset value to the reset register */
status = acpi_write(acpi_gbl_FADT.reset_value, reset_reg); status = acpi_hw_write(acpi_gbl_FADT.reset_value, reset_reg);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -97,67 +97,92 @@ ACPI_EXPORT_SYMBOL(acpi_reset)
* *
* DESCRIPTION: Read from either memory or IO space. * DESCRIPTION: Read from either memory or IO space.
* *
* LIMITATIONS: <These limitations also apply to acpi_write>
* bit_width must be exactly 8, 16, 32, or 64.
* space_iD must be system_memory or system_iO.
* bit_offset and access_width are currently ignored, as there has
* not been a need to implement these.
*
******************************************************************************/ ******************************************************************************/
acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg) acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
{ {
u32 value;
u32 width; u32 width;
u64 address; u64 address;
acpi_status status; acpi_status status;
ACPI_FUNCTION_NAME(acpi_read); ACPI_FUNCTION_NAME(acpi_read);
/* if (!return_value) {
* Must have a valid pointer to a GAS structure, and a non-zero address
* within.
*/
if (!reg) {
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
/* Get a local copy of the address. Handles possible alignment issues */ /* Validate contents of the GAS register. Allow 64-bit transfers */
ACPI_MOVE_64_TO_64(&address, &reg->address); status = acpi_hw_validate_register(reg, 64, &address);
if (!address) { if (ACPI_FAILURE(status)) {
return (AE_BAD_ADDRESS); return (status);
} }
/* Supported widths are 8/16/32 */
width = reg->bit_width; width = reg->bit_width;
if ((width != 8) && (width != 16) && (width != 32)) { if (width == 64) {
return (AE_SUPPORT); width = 32; /* Break into two 32-bit transfers */
} }
/* Initialize entire 32-bit return value to zero */ /* Initialize entire 64-bit return value to zero */
*value = 0; *return_value = 0;
value = 0;
/* /*
* Two address spaces supported: Memory or IO. PCI_Config is * Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient * not supported here because the GAS structure is insufficient
*/ */
switch (reg->space_id) { if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY: status = acpi_os_read_memory((acpi_physical_address)
address, &value, width);
if (ACPI_FAILURE(status)) {
return (status);
}
*return_value = value;
status = acpi_os_read_memory((acpi_physical_address) address, if (reg->bit_width == 64) {
value, width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO: /* Read the top 32 bits */
status = status = acpi_os_read_memory((acpi_physical_address)
acpi_hw_read_port((acpi_io_address) address, value, width); (address + 4), &value, 32);
break; if (ACPI_FAILURE(status)) {
return (status);
}
*return_value |= ((u64)value << 32);
}
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
default: status = acpi_hw_read_port((acpi_io_address)
ACPI_ERROR((AE_INFO, address, &value, width);
"Unsupported address space: %X", reg->space_id)); if (ACPI_FAILURE(status)) {
return (AE_BAD_PARAMETER); return (status);
}
*return_value = value;
if (reg->bit_width == 64) {
/* Read the top 32 bits */
status = acpi_hw_read_port((acpi_io_address)
(address + 4), &value, 32);
if (ACPI_FAILURE(status)) {
return (status);
}
*return_value |= ((u64)value << 32);
}
} }
ACPI_DEBUG_PRINT((ACPI_DB_IO, ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n",
*value, width, ACPI_FORMAT_UINT64(address), ACPI_FORMAT_UINT64(*return_value), reg->bit_width,
ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id))); acpi_ut_get_region_name(reg->space_id)));
return (status); return (status);
@ -169,7 +194,7 @@ ACPI_EXPORT_SYMBOL(acpi_read)
* *
* FUNCTION: acpi_write * FUNCTION: acpi_write
* *
* PARAMETERS: Value - To be written * PARAMETERS: Value - Value to be written
* Reg - GAS register structure * Reg - GAS register structure
* *
* RETURN: Status * RETURN: Status
@ -177,7 +202,7 @@ ACPI_EXPORT_SYMBOL(acpi_read)
* DESCRIPTION: Write to either memory or IO space. * DESCRIPTION: Write to either memory or IO space.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_write(u32 value, struct acpi_generic_address *reg) acpi_status acpi_write(u64 value, struct acpi_generic_address *reg)
{ {
u32 width; u32 width;
u64 address; u64 address;
@ -185,54 +210,61 @@ acpi_status acpi_write(u32 value, struct acpi_generic_address *reg)
ACPI_FUNCTION_NAME(acpi_write); ACPI_FUNCTION_NAME(acpi_write);
/* /* Validate contents of the GAS register. Allow 64-bit transfers */
* Must have a valid pointer to a GAS structure, and a non-zero address
* within. status = acpi_hw_validate_register(reg, 64, &address);
*/ if (ACPI_FAILURE(status)) {
if (!reg) { return (status);
return (AE_BAD_PARAMETER);
} }
/* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64(&address, &reg->address);
if (!address) {
return (AE_BAD_ADDRESS);
}
/* Supported widths are 8/16/32 */
width = reg->bit_width; width = reg->bit_width;
if ((width != 8) && (width != 16) && (width != 32)) { if (width == 64) {
return (AE_SUPPORT); width = 32; /* Break into two 32-bit transfers */
} }
/* /*
* Two address spaces supported: Memory or IO. * Two address spaces supported: Memory or IO. PCI_Config is
* PCI_Config is not supported here because the GAS struct is insufficient * not supported here because the GAS structure is insufficient
*/ */
switch (reg->space_id) { if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY: status = acpi_os_write_memory((acpi_physical_address)
address, ACPI_LODWORD(value),
width);
if (ACPI_FAILURE(status)) {
return (status);
}
status = acpi_os_write_memory((acpi_physical_address) address, if (reg->bit_width == 64) {
value, width); status = acpi_os_write_memory((acpi_physical_address)
break; (address + 4),
ACPI_HIDWORD(value), 32);
if (ACPI_FAILURE(status)) {
return (status);
}
}
} else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
case ACPI_ADR_SPACE_SYSTEM_IO: status = acpi_hw_write_port((acpi_io_address)
address, ACPI_LODWORD(value),
status = acpi_hw_write_port((acpi_io_address) address, value,
width); width);
break; if (ACPI_FAILURE(status)) {
return (status);
}
default: if (reg->bit_width == 64) {
ACPI_ERROR((AE_INFO, status = acpi_hw_write_port((acpi_io_address)
"Unsupported address space: %X", reg->space_id)); (address + 4),
return (AE_BAD_PARAMETER); ACPI_HIDWORD(value), 32);
if (ACPI_FAILURE(status)) {
return (status);
}
}
} }
ACPI_DEBUG_PRINT((ACPI_DB_IO, ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n",
value, width, ACPI_FORMAT_UINT64(address), ACPI_FORMAT_UINT64(value), reg->bit_width,
ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id))); acpi_ut_get_region_name(reg->space_id)));
return (status); return (status);

View file

@ -360,9 +360,9 @@ acpi_status acpi_set_firmware_waking_vector(u32 physical_address);
acpi_status acpi_set_firmware_waking_vector64(u64 physical_address); acpi_status acpi_set_firmware_waking_vector64(u64 physical_address);
#endif #endif
acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg); acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
acpi_status acpi_write(u32 value, struct acpi_generic_address *reg); acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
acpi_status acpi_status
acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b); acpi_get_sleep_type_data(u8 sleep_state, u8 * slp_typ_a, u8 * slp_typ_b);