diff options
| -rw-r--r-- | drivers/acpi/apei/apei-base.c | 17 | ||||
| -rw-r--r-- | drivers/acpi/apei/apei-internal.h | 9 | ||||
| -rw-r--r-- | drivers/acpi/apei/ghes.c | 6 |
3 files changed, 27 insertions, 5 deletions
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 5577762daee1..6686b1eaf13e 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
| @@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx, | |||
| 243 | u8 ins = entry->instruction; | 243 | u8 ins = entry->instruction; |
| 244 | 244 | ||
| 245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
| 246 | return acpi_os_map_generic_address(&entry->register_region); | 246 | return apei_map_generic_address(&entry->register_region); |
| 247 | 247 | ||
| 248 | return 0; | 248 | return 0; |
| 249 | } | 249 | } |
| @@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx, | |||
| 276 | u8 ins = entry->instruction; | 276 | u8 ins = entry->instruction; |
| 277 | 277 | ||
| 278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
| 279 | acpi_os_unmap_generic_address(&entry->register_region); | 279 | apei_unmap_generic_address(&entry->register_region); |
| 280 | 280 | ||
| 281 | return 0; | 281 | return 0; |
| 282 | } | 282 | } |
| @@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr, | |||
| 606 | return 0; | 606 | return 0; |
| 607 | } | 607 | } |
| 608 | 608 | ||
| 609 | int apei_map_generic_address(struct acpi_generic_address *reg) | ||
| 610 | { | ||
| 611 | int rc; | ||
| 612 | u32 access_bit_width; | ||
| 613 | u64 address; | ||
| 614 | |||
| 615 | rc = apei_check_gar(reg, &address, &access_bit_width); | ||
| 616 | if (rc) | ||
| 617 | return rc; | ||
| 618 | return acpi_os_map_generic_address(reg); | ||
| 619 | } | ||
| 620 | EXPORT_SYMBOL_GPL(apei_map_generic_address); | ||
| 621 | |||
| 609 | /* read GAR in interrupt (including NMI) or process context */ | 622 | /* read GAR in interrupt (including NMI) or process context */ |
| 610 | int apei_read(u64 *val, struct acpi_generic_address *reg) | 623 | int apei_read(u64 *val, struct acpi_generic_address *reg) |
| 611 | { | 624 | { |
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index cca240a33038..f220d642136e 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #define APEI_INTERNAL_H | 7 | #define APEI_INTERNAL_H |
| 8 | 8 | ||
| 9 | #include <linux/cper.h> | 9 | #include <linux/cper.h> |
| 10 | #include <linux/acpi.h> | ||
| 11 | #include <linux/acpi_io.h> | ||
| 10 | 12 | ||
| 11 | struct apei_exec_context; | 13 | struct apei_exec_context; |
| 12 | 14 | ||
| @@ -68,6 +70,13 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio | |||
| 68 | /* IP has been set in instruction function */ | 70 | /* IP has been set in instruction function */ |
| 69 | #define APEI_EXEC_SET_IP 1 | 71 | #define APEI_EXEC_SET_IP 1 |
| 70 | 72 | ||
| 73 | int apei_map_generic_address(struct acpi_generic_address *reg); | ||
| 74 | |||
| 75 | static inline void apei_unmap_generic_address(struct acpi_generic_address *reg) | ||
| 76 | { | ||
| 77 | acpi_os_unmap_generic_address(reg); | ||
| 78 | } | ||
| 79 | |||
| 71 | int apei_read(u64 *val, struct acpi_generic_address *reg); | 80 | int apei_read(u64 *val, struct acpi_generic_address *reg); |
| 72 | int apei_write(u64 val, struct acpi_generic_address *reg); | 81 | int apei_write(u64 val, struct acpi_generic_address *reg); |
| 73 | 82 | ||
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 9b3cac0abecc..1599566ed1fe 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
| @@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
| 301 | if (!ghes) | 301 | if (!ghes) |
| 302 | return ERR_PTR(-ENOMEM); | 302 | return ERR_PTR(-ENOMEM); |
| 303 | ghes->generic = generic; | 303 | ghes->generic = generic; |
| 304 | rc = acpi_os_map_generic_address(&generic->error_status_address); | 304 | rc = apei_map_generic_address(&generic->error_status_address); |
| 305 | if (rc) | 305 | if (rc) |
| 306 | goto err_free; | 306 | goto err_free; |
| 307 | error_block_length = generic->error_block_length; | 307 | error_block_length = generic->error_block_length; |
| @@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
| 321 | return ghes; | 321 | return ghes; |
| 322 | 322 | ||
| 323 | err_unmap: | 323 | err_unmap: |
| 324 | acpi_os_unmap_generic_address(&generic->error_status_address); | 324 | apei_unmap_generic_address(&generic->error_status_address); |
| 325 | err_free: | 325 | err_free: |
| 326 | kfree(ghes); | 326 | kfree(ghes); |
| 327 | return ERR_PTR(rc); | 327 | return ERR_PTR(rc); |
| @@ -330,7 +330,7 @@ err_free: | |||
| 330 | static void ghes_fini(struct ghes *ghes) | 330 | static void ghes_fini(struct ghes *ghes) |
| 331 | { | 331 | { |
| 332 | kfree(ghes->estatus); | 332 | kfree(ghes->estatus); |
| 333 | acpi_os_unmap_generic_address(&ghes->generic->error_status_address); | 333 | apei_unmap_generic_address(&ghes->generic->error_status_address); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | enum { | 336 | enum { |
