EFI changes for v4.4
Subsystems (10)
Linus,
Please pull the latest core-efi-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-efi-for-linus
# HEAD: 78b9bc947b18ed16b6c2c573d774e6d54ad9452d efi: Fix warning of int-to-pointer-cast on x86 32-bit builds
The main changes in this cycle were:
- further EFI code generalization to make it more workable for ARM64
- various extensions, such as 64-bit framebuffer address support, UEFI v2.5 EFI_PROPERTIES_TABLE support
- code modularization simplifications and cleanups
- new debugging parameters
- various fixes and smaller additions
Thanks,
Ingo
------------------>
Ard Biesheuvel (4):
efi: Add support for EFI_MEMORY_RO attribute introduced by UEFIv2.5
efi: Add support for UEFIv2.5 Properties table
efi: Introduce EFI_NX_PE_DATA bit and set it from properties table
efi: Use correct type for struct efi_memory_map::phys_map
Ben Hutchings (1):
efi: Auto-load the efi-pstore module
Jonathan (Zhixiong) Zhang (5):
efi, x86: Rearrange efi_mem_attributes()
acpi, x86: Implement arch_apei_get_mem_attributes() arm64/mm: Add PROT_DEVICE_nGnRnE and PROT_NORMAL_WT arm64, acpi/apei: Implement arch_apei_get_mem_attributes() acpi/apei: Use appropriate pgprot_t to map GHES memory
Leif Lindholm (3):
efi/x86: Move efi=debug option parsing to core
arm64: Use core efi=debug instead of uefi_debug command line parameter efi/arm64: Clean up efi_get_fdt_params() interface
Matt Fleming (4):
x86/efi-bgrt: Switch pr_err() to pr_debug() for invalid BGRT Revert "x86/efi: Request desired alignment via the PE/COFF headers"
efi: Use the generic efi.memmap instead of 'memmap'
efifb: Add support for 64-bit frame buffer addresses
Paul Gortmaker (1):
drivers/firmware: Make efi/esrt.c driver explicitly non-modular
Sai Praneeth (1):
x86/efi: Fix kernel panic when CONFIG_DEBUG_VIRTUAL is enabled
Taku Izumi (4):
efi: Add EFI_MEMORY_MORE_RELIABLE support to efi_md_typeattr_format() x86/efi: Rename print_efi_memmap() to efi_print_memmap()
efi: Add "efi_fake_mem" boot option
efi: Fix warning of int-to-pointer-cast on x86 32-bit builds
Documentation/arm/uefi.txt | 2 - Documentation/kernel-parameters.txt | 15 +++ arch/arm64/include/asm/acpi.h | 5 + arch/arm64/include/asm/memory.h | 1 + arch/arm64/include/asm/pgtable.h | 2 + arch/arm64/kernel/acpi.c | 29 +++++ arch/arm64/kernel/efi.c | 23 ++-- arch/arm64/mm/proc.S | 4 +- arch/x86/boot/compressed/eboot.c | 28 ++++- arch/x86/boot/header.S | 2 +- arch/x86/include/asm/acpi.h | 23 ++++ arch/x86/include/asm/efi.h | 1 + arch/x86/kernel/setup.c | 4 +- arch/x86/mm/pageattr.c | 9 +- arch/x86/platform/efi/efi-bgrt.c | 9 +- arch/x86/platform/efi/efi.c | 28 +---- drivers/acpi/apei/ghes.c | 10 +- drivers/firmware/efi/Kconfig | 22 ++++ drivers/firmware/efi/Makefile | 1 + drivers/firmware/efi/efi-pstore.c | 1 + drivers/firmware/efi/efi.c | 107 ++++++++++++---- drivers/firmware/efi/esrt.c | 19 +-- drivers/firmware/efi/fake_mem.c | 238 ++++++++++++++++++++++++++++++++++++ drivers/video/fbdev/efifb.c | 24 +++- include/linux/efi.h | 25 +++- include/uapi/linux/screen_info.h | 5 +- 26 files changed, 532 insertions(+), 105 deletions(-) create mode 100644 drivers/firmware/efi/fake_mem.c
Documentation/arm/uefi.txt +0 -2
@@ -60,5 +60,3 @@ linux,uefi-mmap-desc-ver | 32-bit | Version of the mmap descriptor format. -------------------------------------------------------------------------------- linux,uefi-stub-kern-ver | string | Copy of linux_banner from build. -------------------------------------------------------------------------------- - -For verbose debug messages, specify 'uefi_debug' on the kernel command line.
Documentation/kernel-parameters.txt +15 -0
@@ -1094,6 +1094,21 @@ bytes respectively. Such letter suffixes can also be entirely omitted. you are really sure that your UEFI does sane gc and fulfills the spec otherwise your board may brick. + efi_fake_mem= nn[KMG]@ss[KMG]:aa[,nn[KMG]@ss[KMG]:aa,..] [EFI; X86] + Add arbitrary attribute to specific memory range by + updating original EFI memory map. + Region of memory which aa attribute is added to is + from ss to ss+nn. + If efi_fake_mem=2G@4G:0x10000,2G@0x10a0000000:0x10000 + is specified, EFI_MEMORY_MORE_RELIABLE(0x10000) + attribute is added to range 0x100000000-0x180000000 and + 0x10a0000000-0x1120000000. + + Using this parameter you can do debugging of EFI memmap + related feature. For example, you can do debugging of + Address Range Mirroring feature even if your box + doesn't support it. + eisa_irq_edge= [PARISC,HW] See header of drivers/parisc/eisa.c.
arch/arm64/include/asm/acpi.h +5 -0
@@ -92,4 +92,9 @@ static inline const char *acpi_get_enable_method(int cpu) {return acpi_psci_present () ?"psci" :NULL ; } + +#ifdef CONFIG_ACPI_APEI +pgprot_t arch_apei_get_mem_attribute (phys_addr_t addr); +#endif +#endif /*_ASM_ACPI_H*/
arch/arm64/include/asm/memory.h +1 -0
@@ -94,6 +94,7 @@#define MT_DEVICE_GRE 2#define MT_NORMAL_NC 3#define MT_NORMAL 4 +#define MT_NORMAL_WT 5/* * Memory types for Stage-2 translation
arch/arm64/include/asm/pgtable.h +2 -0
@@ -60,8 +60,10 @@ extern void __pgd_error(const char *file, int line, unsigned long val);#define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)#define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) +#define PROT_DEVICE_nGnRnE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRnE))#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE))#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_NORMAL_NC)) +#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_NORMAL_WT))#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_NORMAL))#define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))
arch/arm64/kernel/acpi.c +29 -0
@@ -29,6 +29,11 @@#include <asm/cpu_ops.h> #include <asm/smp_plat.h> +#ifdef CONFIG_ACPI_APEI +# include <linux/efi.h> +# include <asm/pgtable.h> +#endif +int acpi_noirq =1 ;/* skip ACPI IRQ initialization */ int acpi_disabled =1 ;EXPORT_SYMBOL (acpi_disabled);
@@ -230,3 +235,27 @@ void __init acpi_gic_init(void)early_acpi_os_unmap_memory ((char *)table, tbl_size); } + +#ifdef CONFIG_ACPI_APEI +pgprot_t arch_apei_get_mem_attribute (phys_addr_t addr) +{ +/* +* According to "Table 8 Map: EFI memory types to AArch64 memory +* types" of UEFI 2.5 section 2.3.6.1, each EFI memory type is +* mapped to a corresponding MAIR attribute encoding. +* The EFI memory attribute advises all possible capabilities +* of a memory region. We use the most efficient capability. +*/ + +u64 attr; + + attr =efi_mem_attributes (addr); +if (attr &EFI_MEMORY_WB ) +return PAGE_KERNEL ; +if (attr &EFI_MEMORY_WT ) +return __pgprot (PROT_NORMAL_WT ); +if (attr &EFI_MEMORY_WC ) +return __pgprot (PROT_NORMAL_NC ); +return __pgprot (PROT_DEVICE_nGnRnE); +} +#endif
arch/arm64/kernel/efi.c +7 -16
@@ -51,15 +51,6 @@ static struct mm_struct efi_mm = { INIT_MM_CONTEXT(efi_mm) }; -static int uefi_debug__initdata ; -static int __init uefi_debug_setup (char *str) -{ - uefi_debug =1 ; - -return 0 ; -} -early_param ("uefi_debug" , uefi_debug_setup); -static int __init is_normal_ram (efi_memory_desc_t *md) {if (md->attribute &EFI_MEMORY_WB )
@@ -171,14 +162,14 @@ static __init void reserve_regions(void)efi_memory_desc_t *md;u64 paddr, npages, size; -if (uefi_debug) +if (efi_enabled (EFI_DBG ))pr_info ("Processing EFI memory map:\n" );for_each_efi_memory_desc (&memmap, md) { paddr = md->phys_addr; npages = md->num_pages; -if (uefi_debug) { +if (efi_enabled (EFI_DBG )) {char buf[64 ]; pr_info(" 0x%012llx-0x%012llx %s",
@@ -194,11 +185,11 @@ static __init void reserve_regions(void)if (is_reserve_region (md)) {memblock_reserve (paddr, size); -if (uefi_debug) +if (efi_enabled (EFI_DBG ))pr_cont ("*" ); } -if (uefi_debug) +if (efi_enabled (EFI_DBG ))pr_cont ("\n" ); }
@@ -210,14 +201,14 @@ void __init efi_init(void)struct efi_fdt_params params;/* Grab UEFI information placed in FDT by stub */ -if (!efi_get_fdt_params (¶ms, uefi_debug)) +if (!efi_get_fdt_params (¶ms))return ; efi_system_table = params.system_table;memblock_reserve (params.mmap &PAGE_MASK ,PAGE_ALIGN (params.mmap_size + (params.mmap & ~PAGE_MASK ))); - memmap.phys_map = (void *)params.mmap; + memmap.phys_map = params.mmap; memmap.map =early_memremap (params.mmap, params.mmap_size); memmap.map_end = memmap.map + params.mmap_size; memmap.desc_size = params.desc_size;
@@ -291,7 +282,7 @@ static int __init arm64_enable_runtime_services(void)pr_info ("Remapping and enabling EFI services.\n" ); mapsize = memmap.map_end - memmap.map; - memmap.map = (__force void *)ioremap_cache ((phys_addr_t )memmap.phys_map, + memmap.map = (__force void *)ioremap_cache (memmap.phys_map, mapsize);if (!memmap.map) {pr_err ("Failed to remap EFI memory map\n" );
arch/arm64/mm/proc.S +3 -1
@@ -163,12 +163,14 @@ ENTRY(__cpu_setup) * DEVICE_GRE 010 00001100 * NORMAL_NC 011 01000100 * NORMAL 100 11111111 + * NORMAL_WT 101 10111011 */ ldr x5, =MAIR(0x00, MT_DEVICE_nGnRnE) | \ MAIR(0x04, MT_DEVICE_nGnRE) | \ MAIR(0x0c, MT_DEVICE_GRE) | \ MAIR(0x44, MT_NORMAL_NC) | \ - MAIR(0xff, MT_NORMAL) + MAIR(0xff, MT_NORMAL) | \ + MAIR(0xbb, MT_NORMAL_WT) msr mair_el1, x5 /* * Prepare SCTLR
arch/x86/boot/compressed/eboot.c +22 -6
@@ -624,7 +624,7 @@ setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line,static efi_status_t __gop_query32 (struct efi_graphics_output_protocol_32 *gop32,struct efi_graphics_output_mode_info **info, -unsigned long *size,u32 *fb_base) +unsigned long *size,u64 *fb_base) {struct efi_graphics_output_protocol_mode_32 *mode;efi_status_t status;
@@ -650,7 +650,8 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto,unsigned long nr_gops;u16 width, height;u32 pixels_per_scan_line; -u32 fb_base; +u32 ext_lfb_base; +u64 fb_base;struct efi_pixel_bitmask pixel_info;int pixel_format;efi_status_t status;
@@ -667,7 +668,7 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto,bool conout_found = false;void *dummy =NULL ;u32 h = handles[i]; -u32 current_fb_base; +u64 current_fb_base; status =efi_call_early (handle_protocol, h, proto, (void **)&gop32);
@@ -715,6 +716,13 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto, si->lfb_width = width; si->lfb_height = height; si->lfb_base = fb_base; + + ext_lfb_base = (u64 )(unsigned long )fb_base >>32 ; +if (ext_lfb_base) { + si->capabilities |=VIDEO_CAPABILITY_64BIT_BASE ; + si->ext_lfb_base = ext_lfb_base; + } + si->pages =1 ;setup_pixel_info (si, pixels_per_scan_line, pixel_info, pixel_format);
@@ -729,7 +737,7 @@ setup_gop32(struct screen_info *si, efi_guid_t *proto,static efi_status_t __gop_query64 (struct efi_graphics_output_protocol_64 *gop64,struct efi_graphics_output_mode_info **info, -unsigned long *size,u32 *fb_base) +unsigned long *size,u64 *fb_base) {struct efi_graphics_output_protocol_mode_64 *mode;efi_status_t status;
@@ -755,7 +763,8 @@ setup_gop64(struct screen_info *si, efi_guid_t *proto,unsigned long nr_gops;u16 width, height;u32 pixels_per_scan_line; -u32 fb_base; +u32 ext_lfb_base; +u64 fb_base;struct efi_pixel_bitmask pixel_info;int pixel_format;efi_status_t status;
@@ -772,7 +781,7 @@ setup_gop64(struct screen_info *si, efi_guid_t *proto,bool conout_found = false;void *dummy =NULL ;u64 h = handles[i]; -u32 current_fb_base; +u64 current_fb_base; status =efi_call_early (handle_protocol, h, proto, (void **)&gop64);
@@ -820,6 +829,13 @@ setup_gop64(struct screen_info *si, efi_guid_t *proto, si->lfb_width = width; si->lfb_height = height; si->lfb_base = fb_base; + + ext_lfb_base = (u64 )(unsigned long )fb_base >>32 ; +if (ext_lfb_base) { + si->capabilities |=VIDEO_CAPABILITY_64BIT_BASE ; + si->ext_lfb_base = ext_lfb_base; + } + si->pages =1 ;setup_pixel_info (si, pixels_per_scan_line, pixel_info, pixel_format);
arch/x86/boot/header.S +1 -1
@@ -154,7 +154,7 @@ SYSSEG = 0x1000 /* historical load address >> 4 */ #else .quad 0 # ImageBase #endif - .long CONFIG_PHYSICAL_ALIGN # SectionAlignment + .long 0x20 # SectionAlignment .long 0x20 # FileAlignment .word 0 # MajorOperatingSystemVersion .word 0 # MinorOperatingSystemVersion
arch/x86/include/asm/acpi.h +23 -0
@@ -32,6 +32,10 @@#include <asm/mpspec.h> #include <asm/realmode.h> +#ifdef CONFIG_ACPI_APEI +# include <asm/pgtable_types.h> +#endif +#ifdef CONFIG_ACPI extern int acpi_lapic;extern int acpi_ioapic;
@@ -147,4 +151,23 @@ extern int x86_acpi_numa_init(void);#define acpi_unlazy_tlb (x) leave_mm(x) +#ifdef CONFIG_ACPI_APEI +static inline pgprot_t arch_apei_get_mem_attribute (phys_addr_t addr) +{ +/* +* We currently have no way to look up the EFI memory map +* attributes for a region in a consistent way, because the +* memmap is discarded after efi_free_boot_services(). So if +* you call efi_mem_attributes() during boot and at runtime, +* you could theoretically see different attributes. +* +* Since we are yet to see any x86 platforms that require +* anything other than PAGE_KERNEL (some arm64 platforms +* require the equivalent of PAGE_KERNEL_NOCACHE), return that +* until we know differently. +*/ +return PAGE_KERNEL ; +} +#endif +#endif /* _ASM_X86_ACPI_H */
arch/x86/include/asm/efi.h +1 -0
@@ -105,6 +105,7 @@ extern void __init efi_set_executable(efi_memory_desc_t *md, bool executable);extern int __init efi_memblock_x86_reserve_range (void );extern pgd_t *__init efi_call_phys_prolog (void );extern void __init efi_call_phys_epilog (pgd_t *save_pgd); +extern void __init efi_print_memmap (void );extern void __init efi_unmap_memmap (void );extern void __init efi_memory_uc (u64 addr,unsigned long size);extern void __init efi_map_region (efi_memory_desc_t *md);
arch/x86/kernel/setup.c +3 -1
@@ -1079,8 +1079,10 @@ void __init setup_arch(char **cmdline_p)memblock_set_current_limit (ISA_END_ADDRESS );memblock_x86_fill (); -if (efi_enabled (EFI_BOOT )) +if (efi_enabled (EFI_BOOT )) { +efi_fake_memmap ();efi_find_mirror (); + }/* * The EFI specification says that boot service code won't be called
arch/x86/mm/pageattr.c +6 -3
@@ -647,9 +647,12 @@ __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address,for (i =0 ; i <PTRS_PER_PTE ; i++, pfn += pfninc)set_pte (&pbase[i],pfn_pte (pfn,canon_pgprot (ref_prot))); -if (pfn_range_is_mapped (PFN_DOWN (__pa (address)), -PFN_DOWN (__pa (address)) +1 )) -split_page_count (level); +if (virt_addr_valid (address)) { +unsigned long pfn =PFN_DOWN (__pa (address)); + +if (pfn_range_is_mapped (pfn, pfn +1 )) +split_page_count (level); + }/* * Install the new, split up pagetable.
arch/x86/platform/efi/efi-bgrt.c +7 -2
@@ -50,11 +50,16 @@ void __init efi_bgrt_init(void) bgrt_tab->version);return ; } -if (bgrt_tab->status !=1 ) { -pr_err ("Ignoring BGRT: invalid status %u (expected 1)\n" , +if (bgrt_tab->status &0xfe ) { +pr_err ("Ignoring BGRT: reserved status bits are non-zero %u\n" , bgrt_tab->status);return ; } +if (bgrt_tab->status !=1 ) { +pr_debug ("Ignoring BGRT: invalid status %u (expected 1)\n" , + bgrt_tab->status); +return ; + }if (bgrt_tab->image_type !=0 ) {pr_err ("Ignoring BGRT: invalid image type %u (expected 0)\n" , bgrt_tab->image_type);
arch/x86/platform/efi/efi.c +4 -24
@@ -194,7 +194,7 @@ static void __init do_add_efi_memmap(void)int __init efi_memblock_x86_reserve_range (void ) {struct efi_info *e = &boot_params.efi_info; -unsigned long pmap; +phys_addr_t pmap;if (efi_enabled (EFI_PARAVIRT ))return 0 ;
@@ -209,7 +209,7 @@ int __init efi_memblock_x86_reserve_range(void)#else pmap = (e->efi_memmap | ((__u64 )e->efi_memmap_hi <<32 ));#endif - memmap.phys_map = (void *)pmap; + memmap.phys_map = pmap; memmap.nr_map = e->efi_memmap_size / e->efi_memdesc_size; memmap.desc_size = e->efi_memdesc_size;
@@ -222,7 +222,7 @@ int __init efi_memblock_x86_reserve_range(void)return 0 ; } -static void __init print_efi_memmap (void ) +void __init efi_print_memmap (void ) {#ifdef EFI_DEBUG efi_memory_desc_t *md;
@@ -524,7 +524,7 @@ void __init efi_init(void)return ;if (efi_enabled (EFI_DBG )) -print_efi_memmap (); +efi_print_memmap ();efi_esrt_init (); }
@@ -1017,24 +1017,6 @@ u32 efi_mem_type(unsigned long phys_addr)return 0 ; } -u64 efi_mem_attributes (unsigned long phys_addr) -{ -efi_memory_desc_t *md; -void *p; - -if (!efi_enabled (EFI_MEMMAP )) -return 0 ; - -for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { - md = p; -if ((md->phys_addr <= phys_addr) && - (phys_addr < (md->phys_addr + - (md->num_pages <<EFI_PAGE_SHIFT )))) -return md->attribute; - } -return 0 ; -} -static int __init arch_parse_efi_cmdline (char *str) {if (!str) {
@@ -1044,8 +1026,6 @@ static int __init arch_parse_efi_cmdline(char *str)if (parse_option_str (str,"old_map" ))set_bit (EFI_OLD_MEMMAP , &efi.flags); -if (parse_option_str (str,"debug" )) -set_bit (EFI_DBG , &efi.flags);return 0 ; }
drivers/acpi/apei/ghes.c +7 -3
@@ -157,11 +157,15 @@ static void __iomem *ghes_ioremap_pfn_nmi(u64 pfn)static void __iomem *ghes_ioremap_pfn_irq (u64 pfn) { -unsigned long vaddr; +unsigned long vaddr, paddr; +pgprot_t prot; vaddr = (unsigned long )GHES_IOREMAP_IRQ_PAGE (ghes_ioremap_area->addr); -ioremap_page_range (vaddr, vaddr +PAGE_SIZE , - pfn <<PAGE_SHIFT ,PAGE_KERNEL ); + + paddr = pfn <<PAGE_SHIFT ; + prot =arch_apei_get_mem_attribute (paddr); + +ioremap_page_range (vaddr, vaddr +PAGE_SIZE , paddr, prot);return (void __iomem *)vaddr; }
drivers/firmware/efi/Kconfig +22 -0
@@ -52,6 +52,28 @@ config EFI_RUNTIME_MAP See also Documentation/ABI/testing/sysfs-firmware-efi-runtime-map. +config EFI_FAKE_MEMMAP + bool "Enable EFI fake memory map" + depends on EFI && X86 + default n + help + Saying Y here will enable "efi_fake_mem" boot option. + By specifying this parameter, you can add arbitrary attribute + to specific memory range by updating original (firmware provided) + EFI memmap. + This is useful for debugging of EFI memmap related feature. + e.g. Address Range Mirroring feature. + +config EFI_MAX_FAKE_MEM + int "maximum allowable number of ranges in efi_fake_mem boot option" + depends on EFI_FAKE_MEMMAP + range 1 128 + default 8 + help + Maximum allowable number of ranges in efi_fake_mem boot option. + Ranges can be set up to this value using comma-separated list. + The default value is 8. + config EFI_PARAMS_FROM_FDT bool help
drivers/firmware/efi/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_UEFI_CPER) += cper.o obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o obj-$(CONFIG_EFI_STUB) += libstub/ +obj-$(CONFIG_EFI_FAKE_MEMMAP) += fake_mem.o
drivers/firmware/efi/efi-pstore.c +1 -0
@@ -400,3 +400,4 @@ module_exit(efivars_pstore_exit);MODULE_DESCRIPTION ("EFI variable backend for pstore" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:efivars" );
drivers/firmware/efi/efi.c +82 -25
184 lines not on this page · raw message
drivers/firmware/efi/esrt.c +3 -16
@@ -20,7 +20,6 @@#include <linux/kobject.h> #include <linux/list.h> #include <linux/memblock.h> -#include <linux/module.h> #include <linux/slab.h> #include <linux/types.h>
@@ -450,22 +449,10 @@ static int __init esrt_sysfs_init(void) esrt =NULL ;return error; } +device_initcall (esrt_sysfs_init); -static void __exit esrt_sysfs_exit(void) -{ -pr_debug ("esrt-sysfs: unloading.\n" ); -cleanup_entry_list (); -kset_unregister (esrt_kset); -sysfs_remove_group (esrt_kobj, &esrt_attr_group); -kfree (esrt); - esrt =NULL ; -kobject_del (esrt_kobj); -kobject_put (esrt_kobj); -} - -module_init (esrt_sysfs_init); -module_exit (esrt_sysfs_exit); - +/* MODULE_AUTHOR("Peter Jones <[email protected]>"); MODULE_DESCRIPTION("EFI System Resource Table support"); MODULE_LICENSE("GPL"); +*/
drivers/firmware/efi/fake_mem.c new file +238 -0
238 lines not on this page · raw message
drivers/video/fbdev/efifb.c +23 -1
@@ -114,6 +114,20 @@ static int efifb_setup(char *options)return 0 ; } +static inline bool fb_base_is_valid (void ) +{ +if (screen_info.lfb_base) +return true; + +if (!(screen_info.capabilities &VIDEO_CAPABILITY_64BIT_BASE )) +return false; + +if (screen_info.ext_lfb_base) +return true; + +return false; +} +static int efifb_probe (struct platform_device *dev) {struct fb_info *info;
@@ -141,7 +155,7 @@ static int efifb_probe(struct platform_device *dev) screen_info.lfb_depth =32 ;if (!screen_info.pages) screen_info.pages =1 ; -if (!screen_info.lfb_base) { +if (!fb_base_is_valid ()) {printk (KERN_DEBUG "efifb: invalid framebuffer address\n" );return -ENODEV ; }
@@ -160,6 +174,14 @@ static int efifb_probe(struct platform_device *dev) } efifb_fix.smem_start = screen_info.lfb_base; + +if (screen_info.capabilities &VIDEO_CAPABILITY_64BIT_BASE ) { +u64 ext_lfb_base; + + ext_lfb_base = (u64 )(unsigned long )screen_info.ext_lfb_base <<32 ; + efifb_fix.smem_start |= ext_lfb_base; + } + efifb_defined.bits_per_pixel = screen_info.lfb_depth; efifb_defined.xres = screen_info.lfb_width; efifb_defined.yres = screen_info.lfb_height;
include/linux/efi.h +23 -2
@@ -99,6 +99,7 @@ typedef struct {#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL)/* execute-protect */ #define EFI_MEMORY_MORE_RELIABLE \ ((u64)0x0000000000010000ULL)/* higher reliability */ +#define EFI_MEMORY_RO ((u64)0x0000000000020000ULL)/* read-only */ #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL)/* range requires runtime mapping */ #define EFI_MEMORY_DESCRIPTOR_VERSION 1
@@ -595,6 +596,9 @@ void efi_native_runtime_setup(void);#define DEVICE_TREE_GUID \ EFI_GUID( 0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 ) +#define EFI_PROPERTIES_TABLE_GUID \ + EFI_GUID( 0x880aaca3, 0x4adc, 0x4a04, 0x90, 0x79, 0xb7, 0x47, 0x34, 0x08, 0x25, 0xe5 ) + typedef struct { efi_guid_t guid; u64 table;
@@ -676,7 +680,7 @@ typedef struct { } efi_system_table_t;struct efi_memory_map { -void *phys_map; +phys_addr_t phys_map;void *map;void *map_end;int nr_map;
@@ -808,6 +812,15 @@ typedef struct _efi_file_io_interface {#define EFI_FILE_MODE_WRITE 0x0000000000000002#define EFI_FILE_MODE_CREATE 0x8000000000000000 +typedef struct { +u32 version; +u32 length; +u64 memory_protection_attribute; +}efi_properties_table_t ; + +#define EFI_PROPERTIES_TABLE_VERSION 0x00010000 +#define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1 +#define EFI_INVALID_TABLE_ADDR (~0UL)/*
@@ -830,6 +843,7 @@ extern struct efi {unsigned long runtime;/* runtime table */ unsigned long config_table;/* config tables */ unsigned long esrt;/* ESRT table */ +unsigned long properties_table;/* properties table */ efi_get_time_t *get_time;efi_set_time_t *set_time;efi_get_wakeup_time_t *get_wakeup_time;
@@ -901,13 +915,19 @@ extern void efi_initialize_iomem_resources(struct resource *code_resource, struct resource *data_resource, struct resource *bss_resource);extern void efi_get_time (struct timespec *now);extern void efi_reserve_boot_services (void ); -extern int efi_get_fdt_params (struct efi_fdt_params *params,int verbose); +extern int efi_get_fdt_params (struct efi_fdt_params *params);extern struct efi_memory_map memmap;extern struct kobject *efi_kobj;extern int efi_reboot_quirk_mode;extern bool efi_poweroff_required (void ); +#ifdef CONFIG_EFI_FAKE_MEMMAP +extern void __init efi_fake_memmap (void ); +#else +static inline void efi_fake_memmap (void ) { } +#endif +/* Iterate through an efi_memory_map */ #define for_each_efi_memory_desc (m, md) \ for ((md) = (m)->map; \
@@ -959,6 +979,7 @@ extern int __init efi_setup_pcdp_console(char *);#define EFI_PARAVIRT 6/* Access is via a paravirt interface */ #define EFI_ARCH_1 7/* First arch-specific bit */ #define EFI_DBG 8/* Print additional debug info at runtime */ +#define EFI_NX_PE_DATA 9/* Can runtime data regions be mapped non-executable? */ #ifdef CONFIG_EFI /*
include/uapi/linux/screen_info.h +3 -2
@@ -43,7 +43,8 @@ struct screen_info {__u16 pages;/* 0x32 */ __u16 vesa_attributes;/* 0x34 */ __u32 capabilities;/* 0x36 */ -__u8 _reserved[6 ];/* 0x3a */ +__u32 ext_lfb_base;/* 0x3a */ +__u8 _reserved[2 ];/* 0x3e */ } __attribute__((packed));#define VIDEO_TYPE_MDA 0x10/* Monochrome Text Display */
@@ -69,6 +70,6 @@ struct screen_info {#define VIDEO_FLAGS_NOCURSOR (1 << 0)/* The video mode has no cursor set */ #define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0) - +#define VIDEO_CAPABILITY_64BIT_BASE (1 << 1)/* Frame buffer base is 64-bit */ #endif /* _UAPI_SCREEN_INFO_H */