mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
efi/x86: Move the EFI BGRT init code to early init code
Before invoking the arch specific handler, efi_mem_reserve() reserves the given memory region through memblock. efi_bgrt_init() will call efi_mem_reserve() after mm_init(), at which time memblock is dead and should not be used anymore. The EFI BGRT code depends on ACPI initialization to get the BGRT ACPI table, so move parsing of the BGRT table to ACPI early boot code to ensure that efi_mem_reserve() in EFI BGRT code still use memblock safely. Tested-by: Bhupesh Sharma <[email protected]> Signed-off-by: Dave Young <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Cc: Len Brown <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
c4c39c70c5
commit
7b0a911478
6 changed files with 59 additions and 54 deletions
|
|
@ -15,40 +15,41 @@
|
|||
#include <linux/sysfs.h>
|
||||
#include <linux/efi-bgrt.h>
|
||||
|
||||
static void *bgrt_image;
|
||||
static struct kobject *bgrt_kobj;
|
||||
|
||||
static ssize_t show_version(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->version);
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version);
|
||||
}
|
||||
static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
|
||||
|
||||
static ssize_t show_status(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->status);
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status);
|
||||
}
|
||||
static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
|
||||
|
||||
static ssize_t show_type(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_type);
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type);
|
||||
}
|
||||
static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
|
||||
|
||||
static ssize_t show_xoffset(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_offset_x);
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x);
|
||||
}
|
||||
static DEVICE_ATTR(xoffset, S_IRUGO, show_xoffset, NULL);
|
||||
|
||||
static ssize_t show_yoffset(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_offset_y);
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y);
|
||||
}
|
||||
static DEVICE_ATTR(yoffset, S_IRUGO, show_yoffset, NULL);
|
||||
|
||||
|
|
@ -84,15 +85,24 @@ static int __init bgrt_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (!bgrt_image)
|
||||
if (!bgrt_tab.image_address)
|
||||
return -ENODEV;
|
||||
|
||||
bgrt_image = memremap(bgrt_tab.image_address, bgrt_image_size,
|
||||
MEMREMAP_WB);
|
||||
if (!bgrt_image) {
|
||||
pr_notice("Ignoring BGRT: failed to map image memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
bin_attr_image.private = bgrt_image;
|
||||
bin_attr_image.size = bgrt_image_size;
|
||||
|
||||
bgrt_kobj = kobject_create_and_add("bgrt", acpi_kobj);
|
||||
if (!bgrt_kobj)
|
||||
return -EINVAL;
|
||||
if (!bgrt_kobj) {
|
||||
ret = -EINVAL;
|
||||
goto out_memmap;
|
||||
}
|
||||
|
||||
ret = sysfs_create_group(bgrt_kobj, &bgrt_attribute_group);
|
||||
if (ret)
|
||||
|
|
@ -102,6 +112,8 @@ static int __init bgrt_init(void)
|
|||
|
||||
out_kobject:
|
||||
kobject_put(bgrt_kobj);
|
||||
out_memmap:
|
||||
memunmap(bgrt_image);
|
||||
return ret;
|
||||
}
|
||||
device_initcall(bgrt_init);
|
||||
|
|
|
|||
Loading…
Reference in a new issue