Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

+13 -13
+5 -1
drivers/acpi/apei/apei-base.c
··· 632 632 rc = apei_check_gar(reg, &address, &access_bit_width); 633 633 if (rc) 634 634 return rc; 635 - return acpi_os_map_generic_address(reg); 635 + 636 + if (!acpi_os_map_generic_address(reg)) 637 + return -ENXIO; 638 + 639 + return 0; 636 640 } 637 641 EXPORT_SYMBOL_GPL(apei_map_generic_address); 638 642
+7 -11
drivers/acpi/osl.c
··· 447 447 } 448 448 EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); 449 449 450 - int acpi_os_map_generic_address(struct acpi_generic_address *gas) 450 + void __iomem *acpi_os_map_generic_address(struct acpi_generic_address *gas) 451 451 { 452 452 u64 addr; 453 - void __iomem *virt; 454 453 455 454 if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) 456 - return 0; 455 + return NULL; 457 456 458 457 /* Handle possible alignment issues */ 459 458 memcpy(&addr, &gas->address, sizeof(addr)); 460 459 if (!addr || !gas->bit_width) 461 - return -EINVAL; 460 + return NULL; 462 461 463 - virt = acpi_os_map_iomem(addr, gas->bit_width / 8); 464 - if (!virt) 465 - return -EIO; 466 - 467 - return 0; 462 + return acpi_os_map_iomem(addr, gas->bit_width / 8); 468 463 } 469 464 EXPORT_SYMBOL(acpi_os_map_generic_address); 470 465 ··· 1751 1756 * Use acpi_os_map_generic_address to pre-map the reset 1752 1757 * register if it's in system memory. 1753 1758 */ 1754 - int rv; 1759 + void *rv; 1755 1760 1756 1761 rv = acpi_os_map_generic_address(&acpi_gbl_FADT.reset_register); 1757 - pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv); 1762 + pr_debug(PREFIX "%s: map reset_reg %s\n", __func__, 1763 + rv ? "successful" : "failed"); 1758 1764 } 1759 1765 acpi_os_initialized = true; 1760 1766
+1 -1
include/acpi/acpi_io.h
··· 21 21 void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size); 22 22 void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); 23 23 24 - int acpi_os_map_generic_address(struct acpi_generic_address *addr); 24 + void __iomem *acpi_os_map_generic_address(struct acpi_generic_address *addr); 25 25 void acpi_os_unmap_generic_address(struct acpi_generic_address *addr); 26 26 27 27 #endif