Commit 6915564d authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI: OSL: Change the type of acpi_os_map_generic_address() return value

Modify acpi_os_map_generic_address() to return the pointer returned
by acpi_os_map_iomem() which represents the logical address
corresponding to the struct acpi_generic_address argument passed to
it or NULL if that address cannot be obtained (for example, the
argument does not represent an address in system memory or it could
not be mapped by the OS).

Among other things, that will allow the ACPI OS layer to pass the
logical addresses of the FADT GPE blocks 0 and 1 to ACPICA going
forward.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7a8379eb
...@@ -632,7 +632,11 @@ int apei_map_generic_address(struct acpi_generic_address *reg) ...@@ -632,7 +632,11 @@ int apei_map_generic_address(struct acpi_generic_address *reg)
rc = apei_check_gar(reg, &address, &access_bit_width); rc = apei_check_gar(reg, &address, &access_bit_width);
if (rc) if (rc)
return rc; return rc;
return acpi_os_map_generic_address(reg);
if (!acpi_os_map_generic_address(reg))
return -ENXIO;
return 0;
} }
EXPORT_SYMBOL_GPL(apei_map_generic_address); EXPORT_SYMBOL_GPL(apei_map_generic_address);
......
...@@ -447,24 +447,19 @@ void __ref acpi_os_unmap_memory(void *virt, acpi_size size) ...@@ -447,24 +447,19 @@ void __ref acpi_os_unmap_memory(void *virt, acpi_size size)
} }
EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
int acpi_os_map_generic_address(struct acpi_generic_address *gas) void __iomem *acpi_os_map_generic_address(struct acpi_generic_address *gas)
{ {
u64 addr; u64 addr;
void __iomem *virt;
if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
return 0; return NULL;
/* Handle possible alignment issues */ /* Handle possible alignment issues */
memcpy(&addr, &gas->address, sizeof(addr)); memcpy(&addr, &gas->address, sizeof(addr));
if (!addr || !gas->bit_width) if (!addr || !gas->bit_width)
return -EINVAL; return NULL;
virt = acpi_os_map_iomem(addr, gas->bit_width / 8);
if (!virt)
return -EIO;
return 0; return acpi_os_map_iomem(addr, gas->bit_width / 8);
} }
EXPORT_SYMBOL(acpi_os_map_generic_address); EXPORT_SYMBOL(acpi_os_map_generic_address);
...@@ -1756,10 +1751,11 @@ acpi_status __init acpi_os_initialize(void) ...@@ -1756,10 +1751,11 @@ acpi_status __init acpi_os_initialize(void)
* Use acpi_os_map_generic_address to pre-map the reset * Use acpi_os_map_generic_address to pre-map the reset
* register if it's in system memory. * register if it's in system memory.
*/ */
int rv; void *rv;
rv = acpi_os_map_generic_address(&acpi_gbl_FADT.reset_register); rv = acpi_os_map_generic_address(&acpi_gbl_FADT.reset_register);
pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv); pr_debug(PREFIX "%s: map reset_reg %s\n", __func__,
rv ? "successful" : "failed");
} }
acpi_os_initialized = true; acpi_os_initialized = true;
......
...@@ -21,7 +21,7 @@ void __iomem __ref ...@@ -21,7 +21,7 @@ void __iomem __ref
void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size); void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size);
void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
int acpi_os_map_generic_address(struct acpi_generic_address *addr); void __iomem *acpi_os_map_generic_address(struct acpi_generic_address *addr);
void acpi_os_unmap_generic_address(struct acpi_generic_address *addr); void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment