Skip to content

Commit 6915564

Browse files
committed
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>
1 parent 7a8379e commit 6915564

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

drivers/acpi/apei/apei-base.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,11 @@ int apei_map_generic_address(struct acpi_generic_address *reg)
632632
rc = apei_check_gar(reg, &address, &access_bit_width);
633633
if (rc)
634634
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;
636640
}
637641
EXPORT_SYMBOL_GPL(apei_map_generic_address);
638642

drivers/acpi/osl.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -447,24 +447,19 @@ void __ref acpi_os_unmap_memory(void *virt, acpi_size size)
447447
}
448448
EXPORT_SYMBOL_GPL(acpi_os_unmap_memory);
449449

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)
451451
{
452452
u64 addr;
453-
void __iomem *virt;
454453

455454
if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
456-
return 0;
455+
return NULL;
457456

458457
/* Handle possible alignment issues */
459458
memcpy(&addr, &gas->address, sizeof(addr));
460459
if (!addr || !gas->bit_width)
461-
return -EINVAL;
462-
463-
virt = acpi_os_map_iomem(addr, gas->bit_width / 8);
464-
if (!virt)
465-
return -EIO;
460+
return NULL;
466461

467-
return 0;
462+
return acpi_os_map_iomem(addr, gas->bit_width / 8);
468463
}
469464
EXPORT_SYMBOL(acpi_os_map_generic_address);
470465

@@ -1756,10 +1751,11 @@ acpi_status __init acpi_os_initialize(void)
17561751
* Use acpi_os_map_generic_address to pre-map the reset
17571752
* register if it's in system memory.
17581753
*/
1759-
int rv;
1754+
void *rv;
17601755

17611756
rv = acpi_os_map_generic_address(&acpi_gbl_FADT.reset_register);
1762-
pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv);
1757+
pr_debug(PREFIX "%s: map reset_reg %s\n", __func__,
1758+
rv ? "successful" : "failed");
17631759
}
17641760
acpi_os_initialized = true;
17651761

include/acpi/acpi_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void __iomem __ref
2121
void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size);
2222
void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
2323

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);
2525
void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
2626

2727
#endif

0 commit comments

Comments
 (0)