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

ACPI: utils: introduce acpi_get_local_u64_address()

The ACPI _ADR is a 64-bit value. We changed the definitions in commit
ca6f998cf9a2 ("ACPI: bus: change _ADR representation to 64 bits") but
some helpers still assume the value is a 32-bit value.

This patch adds a new helper to extract the full 64-bits. The existing
32-bit helper is kept for backwards-compatibility and cases where the
_ADR is known to fit in a 32-bit value.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240528192936.16180-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Mark Brown
0b7e4481 a1708fda

+14 -3
+13 -3
drivers/acpi/utils.c
··· 277 277 278 278 EXPORT_SYMBOL(acpi_evaluate_integer); 279 279 280 - int acpi_get_local_address(acpi_handle handle, u32 *addr) 280 + int acpi_get_local_u64_address(acpi_handle handle, u64 *addr) 281 281 { 282 - unsigned long long adr; 283 282 acpi_status status; 284 283 285 - status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); 284 + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, addr); 286 285 if (ACPI_FAILURE(status)) 287 286 return -ENODATA; 287 + return 0; 288 + } 289 + EXPORT_SYMBOL(acpi_get_local_u64_address); 288 290 291 + int acpi_get_local_address(acpi_handle handle, u32 *addr) 292 + { 293 + u64 adr; 294 + int ret; 295 + 296 + ret = acpi_get_local_u64_address(handle, &adr); 297 + if (ret < 0) 298 + return ret; 289 299 *addr = (u32)adr; 290 300 return 0; 291 301 }
+1
include/linux/acpi.h
··· 761 761 } 762 762 #endif 763 763 764 + int acpi_get_local_u64_address(acpi_handle handle, u64 *addr); 764 765 int acpi_get_local_address(acpi_handle handle, u32 *addr); 765 766 const char *acpi_get_subsystem_id(acpi_handle handle); 766 767