aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/efi/efi-bgrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/platform/efi/efi-bgrt.c')
-rw-r--r--arch/x86/platform/efi/efi-bgrt.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index 9a52b5c4438f..bf51f4c02562 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -31,8 +31,7 @@ struct bmp_header {
31void __init efi_bgrt_init(void) 31void __init efi_bgrt_init(void)
32{ 32{
33 acpi_status status; 33 acpi_status status;
34 void __iomem *image; 34 void *image;
35 bool ioremapped = false;
36 struct bmp_header bmp_header; 35 struct bmp_header bmp_header;
37 36
38 if (acpi_disabled) 37 if (acpi_disabled)
@@ -73,20 +72,14 @@ void __init efi_bgrt_init(void)
73 return; 72 return;
74 } 73 }
75 74
76 image = efi_lookup_mapped_addr(bgrt_tab->image_address); 75 image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
77 if (!image) { 76 if (!image) {
78 image = early_ioremap(bgrt_tab->image_address, 77 pr_err("Ignoring BGRT: failed to map image header memory\n");
79 sizeof(bmp_header)); 78 return;
80 ioremapped = true;
81 if (!image) {
82 pr_err("Ignoring BGRT: failed to map image header memory\n");
83 return;
84 }
85 } 79 }
86 80
87 memcpy_fromio(&bmp_header, image, sizeof(bmp_header)); 81 memcpy(&bmp_header, image, sizeof(bmp_header));
88 if (ioremapped) 82 early_memunmap(image, sizeof(bmp_header));
89 early_iounmap(image, sizeof(bmp_header));
90 bgrt_image_size = bmp_header.size; 83 bgrt_image_size = bmp_header.size;
91 84
92 bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN); 85 bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
@@ -96,18 +89,14 @@ void __init efi_bgrt_init(void)
96 return; 89 return;
97 } 90 }
98 91
99 if (ioremapped) { 92 image = early_memremap(bgrt_tab->image_address, bmp_header.size);
100 image = early_ioremap(bgrt_tab->image_address, 93 if (!image) {
101 bmp_header.size); 94 pr_err("Ignoring BGRT: failed to map image memory\n");
102 if (!image) { 95 kfree(bgrt_image);
103 pr_err("Ignoring BGRT: failed to map image memory\n"); 96 bgrt_image = NULL;
104 kfree(bgrt_image); 97 return;
105 bgrt_image = NULL;
106 return;
107 }
108 } 98 }
109 99
110 memcpy_fromio(bgrt_image, image, bgrt_image_size); 100 memcpy(bgrt_image, image, bgrt_image_size);
111 if (ioremapped) 101 early_memunmap(image, bmp_header.size);
112 early_iounmap(image, bmp_header.size);
113} 102}