/* Get current value of the enable register that contains this GPE */
- status = acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, &enable_mask,
- &gpe_register_info->enable_address);
+ status = acpi_read(&enable_mask, &gpe_register_info->enable_address);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Write the updated enable mask */
- status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, enable_mask,
- &gpe_register_info->enable_address);
-
+ status = acpi_write(enable_mask, &gpe_register_info->enable_address);
return (status);
}
/* Write the entire GPE (runtime) enable register */
- status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run,
- &gpe_register_info->enable_address);
+ status = acpi_write(gpe_register_info->enable_for_run,
+ &gpe_register_info->enable_address);
return (status);
}
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
- status = acpi_hw_low_level_write(8, register_bit,
- &gpe_event_info->register_info->
- status_address);
+ status = acpi_write(register_bit,
+ &gpe_event_info->register_info->status_address);
return (status);
}
/* GPE currently active (status bit == 1)? */
- status =
- acpi_hw_low_level_read(8, &in_byte,
- &gpe_register_info->status_address);
+ status = acpi_read(&in_byte, &gpe_register_info->status_address);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* Disable all GPEs in this register */
- status = acpi_hw_low_level_write(8, 0x00,
- &gpe_block->register_info[i].
- enable_address);
+ status =
+ acpi_write(0x00,
+ &gpe_block->register_info[i].enable_address);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Clear status on all GPEs in this register */
- status = acpi_hw_low_level_write(8, 0xFF,
- &gpe_block->register_info[i].
- status_address);
+ status =
+ acpi_write(0xFF,
+ &gpe_block->register_info[i].status_address);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Enable all "runtime" GPEs in this register */
- status =
- acpi_hw_low_level_write(8,
- gpe_block->register_info[i].
- enable_for_run,
- &gpe_block->register_info[i].
- enable_address);
+ status = acpi_write(gpe_block->register_info[i].enable_for_run,
+ &gpe_block->register_info[i].
+ enable_address);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Enable all "wake" GPEs in this register */
- status = acpi_hw_low_level_write(8,
- gpe_block->register_info[i].
- enable_for_wake,
- &gpe_block->register_info[i].
- enable_address);
+ status = acpi_write(gpe_block->register_info[i].enable_for_wake,
+ &gpe_block->register_info[i].
+ enable_address);
if (ACPI_FAILURE(status)) {
return (status);
}
/* Clear the fixed events */
if (acpi_gbl_FADT.xpm1b_event_block.address) {
- status =
- acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
- &acpi_gbl_FADT.xpm1b_event_block);
+ status = acpi_write(ACPI_BITMASK_ALL_FIXED_STATUS,
+ &acpi_gbl_FADT.xpm1b_event_block);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
return (&acpi_gbl_bit_register_info[register_id]);
}
+ACPI_EXPORT_SYMBOL(acpi_get_register_unlocked)
+
/*******************************************************************************
*
* FUNCTION: acpi_get_register
switch (register_id) {
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
- status =
- acpi_hw_low_level_read(16, &value1,
- &acpi_gbl_FADT.xpm1a_event_block);
+ status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_event_block);
if (ACPI_FAILURE(status)) {
goto exit;
}
/* PM1B is optional */
- status =
- acpi_hw_low_level_read(16, &value2,
- &acpi_gbl_FADT.xpm1b_event_block);
+ status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_event_block);
value1 |= value2;
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
- status =
- acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
+ status = acpi_read(&value1, &acpi_gbl_xpm1a_enable);
if (ACPI_FAILURE(status)) {
goto exit;
}
/* PM1B is optional */
- status =
- acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable);
+ status = acpi_read(&value2, &acpi_gbl_xpm1b_enable);
value1 |= value2;
break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
- status =
- acpi_hw_low_level_read(16, &value1,
- &acpi_gbl_FADT.xpm1a_control_block);
+ status = acpi_read(&value1, &acpi_gbl_FADT.xpm1a_control_block);
if (ACPI_FAILURE(status)) {
goto exit;
}
- status =
- acpi_hw_low_level_read(16, &value2,
- &acpi_gbl_FADT.xpm1b_control_block);
+ status = acpi_read(&value2, &acpi_gbl_FADT.xpm1b_control_block);
value1 |= value2;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- status =
- acpi_hw_low_level_read(8, &value1,
- &acpi_gbl_FADT.xpm2_control_block);
+ status = acpi_read(&value1, &acpi_gbl_FADT.xpm2_control_block);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- status =
- acpi_hw_low_level_read(32, &value1,
- &acpi_gbl_FADT.xpm_timer_block);
+ status = acpi_read(&value1, &acpi_gbl_FADT.xpm_timer_block);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
/* Now we can write the data */
- status =
- acpi_hw_low_level_write(16, value,
- &acpi_gbl_FADT.xpm1a_event_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm1a_event_block);
if (ACPI_FAILURE(status)) {
goto exit;
}
/* PM1B is optional */
- status =
- acpi_hw_low_level_write(16, value,
- &acpi_gbl_FADT.xpm1b_event_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm1b_event_block);
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
- status =
- acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
+ status = acpi_write(value, &acpi_gbl_xpm1a_enable);
if (ACPI_FAILURE(status)) {
goto exit;
}
/* PM1B is optional */
- status =
- acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable);
+ status = acpi_write(value, &acpi_gbl_xpm1b_enable);
break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
/* Now we can write the data */
- status =
- acpi_hw_low_level_write(16, value,
- &acpi_gbl_FADT.xpm1a_control_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block);
if (ACPI_FAILURE(status)) {
goto exit;
}
- status =
- acpi_hw_low_level_write(16, value,
- &acpi_gbl_FADT.xpm1b_control_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block);
break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
- status =
- acpi_hw_low_level_write(16, value,
- &acpi_gbl_FADT.xpm1a_control_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm1a_control_block);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
- status =
- acpi_hw_low_level_write(16, value,
- &acpi_gbl_FADT.xpm1b_control_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm1b_control_block);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- status =
- acpi_hw_low_level_write(8, value,
- &acpi_gbl_FADT.xpm2_control_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm2_control_block);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- status =
- acpi_hw_low_level_write(32, value,
- &acpi_gbl_FADT.xpm_timer_block);
+ status = acpi_write(value, &acpi_gbl_FADT.xpm_timer_block);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
/******************************************************************************
*
- * FUNCTION: acpi_hw_low_level_read
+ * FUNCTION: acpi_read
*
- * PARAMETERS: Width - 8, 16, or 32
- * Value - Where the value is returned
+ * PARAMETERS: Value - Where the value is returned
* Reg - GAS register structure
*
* RETURN: Status
*
******************************************************************************/
-acpi_status
-acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
+acpi_status acpi_read(u32 *value, struct acpi_generic_address *reg)
{
+ u32 width;
u64 address;
acpi_status status;
- ACPI_FUNCTION_NAME(hw_low_level_read);
+ ACPI_FUNCTION_NAME(acpi_read);
/*
* Must have a valid pointer to a GAS structure, and
if (!address) {
return (AE_OK);
}
+
+ /* Supported widths are 8/16/32 */
+
+ width = reg->bit_width;
+ if ((width != 8) && (width != 16) && (width != 32)) {
+ return (AE_SUPPORT);
+ }
+
+ /* Initialize entire 32-bit return value to zero */
+
*value = 0;
/*
return (status);
}
+ACPI_EXPORT_SYMBOL(acpi_read)
+
/******************************************************************************
*
- * FUNCTION: acpi_hw_low_level_write
+ * FUNCTION: acpi_write
*
- * PARAMETERS: Width - 8, 16, or 32
- * Value - To be written
+ * PARAMETERS: Value - To be written
* Reg - GAS register structure
*
* RETURN: Status
******************************************************************************/
acpi_status
-acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
+acpi_write(u32 value, struct acpi_generic_address *reg)
{
+ u32 width;
u64 address;
acpi_status status;
- ACPI_FUNCTION_NAME(hw_low_level_write);
+ ACPI_FUNCTION_NAME(acpi_write);
/*
* Must have a valid pointer to a GAS structure, and
return (AE_OK);
}
+ /* Supported widths are 8/16/32 */
+
+ width = reg->bit_width;
+ if ((width != 8) && (width != 16) && (width != 32)) {
+ return (AE_SUPPORT);
+ }
+
/*
* Two address spaces supported: Memory or IO.
* PCI_Config is not supported here because the GAS struct is insufficient
return (status);
}
+
+ACPI_EXPORT_SYMBOL(acpi_write)