aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-10-23Merge branch 'armv8-uefi-latest' of https://github.com/mosalter/linux into ↵Graeme Gregory
leg-kernel Conflicts: arch/arm/Kconfig include/linux/efi.h
2013-10-23Merge branch 'efi-stub-arm-submitted-v4-20130928-leg-kernel-20131018' of ↵Graeme Gregory
git://git.linaro.org/people/roy.franz/linux into leg-kernel Conflicts: arch/arm/Kconfig
2013-10-23Merge branch 'topic-armv7-uefi-runtime-services' of ↵Graeme Gregory
git://git.linaro.org/people/leiflindholm/linux into leg-kernel
2013-10-18arm64: add EFI runtime supportMark Salter
Signed-off-by: Mark Salter <msalter@redhat.com>
2013-10-18arm64: add early_ioremap supportMark Salter
EFI runtime support needs to make temporary short term mappings at early boot time before ioremap is available. This patch adds support for such early mappings based on "fixmap" support found in a number of other architectures. This also allows for a number of permanent mappings which may need to persist beyond paging_init(). This implementation uses the 2MiB of address space currently dedicated to the early_printk console registers. This allows for mapping up to 32 64K pages or 512 4K pages. Signed-off-by: Mark Salter <msalter@redhat.com>
2013-10-18arm64: allow ioremap_cache() of RAM pagesMark Salter
Some drivers call ioremap_cache() to map an address which could either be outside of RAM or in a reserved area of RAM. We can't normally ioremap RAM, but since the driver wants a cacheable mapping, we can just use the existing kernel mapping of RAM in this particular case. Signed-off-by: Mark Salter <msalter@redhat.com>
2013-10-18arm64: add EFI stubMark Salter
Signed-off-by: Mark Salter <msalter@redhat.com>
2013-10-18Disable stack protection for decompressor/stubRoy Franz
The ARM decompressor/EFI stub do not implement the functions (__stack_chk_guard_setup, etc) that are required for support of stack protection. The actual enablement of stack protection is controlled by heuristics in GCC, which the code added for the EFI stub triggers when CONFIG_STACKPROTECTOR is set. Even with CONFIG_STACKPROTECTOR set, the decompressor was not compiled with stack protection actually enabled. Adding -fno-stack-protector to the decompressor/stub build keeps it building without stack protection as it has always been built. The x86 decompressor/stub is also build with -fno-stack-protector. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18Add EFI stub for ARMRoy Franz
This patch adds EFI stub support for the ARM Linux kernel. The EFI stub operates similarly to the x86 stub: it is a shim between the EFI firmware and the normal zImage entry point, and sets up the environment that the zImage is expecting. This includes loading the initrd (optionaly) and device tree from the system partition based on the kernel command line. The stub updates the device tree as necessary, adding entries for EFI runtime services. The PE/COFF "MZ" header at offset 0 results in the first instruction being an add that corrupts r5, which is not used by the zImage interface. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18Add strstr to compressed string.c for ARM.Roy Franz
The shared efi-stub-helper.c functions require a strstr implementation. Implementation copied from arch/x86/boot/string.c Signed-off-by: Roy Franz <roy.franz@linaro.org> Reviewed-by: Grant Likely <grant.likely@linaro.org>
2013-10-18Add shared update_fdt() function for ARM/ARM64Roy Franz
Both ARM and ARM64 stubs will update the device tree that they pass to the kernel. In both cases they primarily need to add the same UEFI related information, so the function can be shared. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18efi-stub.txt updates for ARMRoy Franz
Update efi-stub.txt documentation to be more general and not x86 specific. Add ARM only "dtb=" command line option description. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18efi: resolve warnings found on ARM compileRoy Franz
warnings from gcc: warning: label 'free_pool' defined but not used [-Wunused-label] warning: value computed is not used [-Wunused-value] Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Fix types in EFI calls to match EFI function definitions.Roy Franz
EFI calls can made directly on ARM, so the function pointers are directly invoked. This allows types to be checked at compile time, so here we ensure that the parameters match the function signature. The wrappers used by x86 prevent any type checking. Correct the type of chunksize to be based on native width as specified by the EFI_FILE_PROTOCOL read() function. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Renames in handle_cmdline_files() to complete generalization.Roy Franz
Rename variables to be not initrd specific, as now the function loads arbitrary files. This change is exclusively renames and comment changes to reflect the generalization. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Generalize handle_ramdisks() and rename to handle_cmdline_files().Roy Franz
The handle_cmdline_files now takes the option to handle as a string, and returns the loaded data through parameters, rather than taking an x86 specific setup_header structure. For ARM, this will be used to load a device tree blob in addition to initrd images. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Allow efi_free() to be called with size of 0Roy Franz
Make efi_free() safely callable with size of 0, similar to free() being callable with NULL pointers, and do nothing in that case. Remove size checks that this makes redundant. This also avoids some size checks in the ARM EFI stub code that will be added as well. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: use efi_get_memory_map() to get final map for x86Roy Franz
Replace the open-coded memory map getting with the efi_get_memory_map() that is now general enough to use. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: generalize efi_get_memory_map()Roy Franz
Add arguments for returning the descriptor version and also the memory map key. The key is required for calling exit_boot_services(). Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Rename __get_map() to efi_get_memory_map()Roy Franz
Rename function in preparation for making it more flexible and sharing it. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Move unicode to ASCII conversion to shared function.Roy Franz
Move the open-coded conversion to a shared function for use by all architectures. Change the allocation to prefer a high address for ARM, as this is required to avoid conflicts with reserved regions in low memory. We don't know the specifics of these regions until after we process the command line and device tree. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Generalize relocate_kernel() for use by other architectures.Roy Franz
Rename relocate_kernel() to efi_relocate_kernel(), and take parameters rather than x86 specific structure. Add max_addr argument as for ARM we have some address constraints that we need to enforce when relocating the kernel. Add alloc_size parameter for use by ARM64 which uses an uncompressed kernel, and needs to allocate space for BSS. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Move relocate_kernel() to shared file.Roy Franz
The relocate_kernel() function will be generalized and used by all architectures, as they all have similar requirements. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Enforce minimum alignment of 1 page on allocations.Roy Franz
The efi_high_alloc() and efi_low_alloc() functions use the EFI_ALLOCATE_ADDRESS option to the EFI function allocate_pages(), which requires a minimum of page alignment, and rejects all other requests. The existing code could fail to allocate depending on allocation size, as although repeated allocation attempts were made, none were guaranteed to be page aligned. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Rename memory allocation/free functionsRoy Franz
Rename them to be more similar, as low_free() could be used to free memory allocated by both high_alloc() and low_alloc(). high_alloc() -> efi_high_alloc() low_alloc() -> efi_low_alloc() low_free() -> efi_free() Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Add system table pointer argument to shared functions.Roy Franz
Add system table pointer argument to shared EFI stub related functions so they no longer use a global system table pointer as they did when part of eboot.c. For the ARM EFI stub this allows us to avoid global variables completely and thereby not have to deal with GOT fixups. Not having the EFI stub fixup its GOT, which is shared with the decompressor, simplifies the relocating of the zImage to a bootable address. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Move common EFI stub code from x86 arch code to common locationRoy Franz
No code changes made, just moving functions and #define from x86 arch directory to common location. Code is shared using #include, similar to how decompression code is shared among architectures. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Add proper definitions for some EFI function pointers.Roy Franz
The x86/AMD64 EFI stubs must use a call wrapper to convert between the Linux and EFI ABIs, so void pointers are sufficient. For ARM, the ABIs are compatible, so we can directly invoke the function pointers. The functions that are used by the ARM stub are updated to match the EFI definitions. Also add some EFI types used by EFI functions. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18EFI stub documentation updatesRoy Franz
Move efi-stub.txt out of x86 directory and into common directory in preparation for adding ARM EFI stub support. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18Add config EFI_STUB for ARM to KconfigRoy Franz
Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18Disable stack protection for decompressor/stubRoy Franz
The ARM decompressor/EFI stub do not implement the functions (__stack_chk_guard_setup, etc) that are required for support of stack protection. The actual enablement of stack protection is controlled by heuristics in GCC, which the code added for the EFI stub triggers when CONFIG_STACKPROTECTOR is set. Even with CONFIG_STACKPROTECTOR set, the decompressor was not compiled with stack protection actually enabled. Adding -fno-stack-protector to the decompressor/stub build keeps it building without stack protection as it has always been built. The x86 decompressor/stub is also build with -fno-stack-protector. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18Add EFI stub for ARMRoy Franz
This patch adds EFI stub support for the ARM Linux kernel. The EFI stub operates similarly to the x86 stub: it is a shim between the EFI firmware and the normal zImage entry point, and sets up the environment that the zImage is expecting. This includes loading the initrd (optionaly) and device tree from the system partition based on the kernel command line. The stub updates the device tree as necessary, adding entries for EFI runtime services. The PE/COFF "MZ" header at offset 0 results in the first instruction being an add that corrupts r5, which is not used by the zImage interface. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18Add strstr to compressed string.c for ARM.Roy Franz
The shared efi-stub-helper.c functions require a strstr implementation. Implementation copied from arch/x86/boot/string.c Signed-off-by: Roy Franz <roy.franz@linaro.org> Reviewed-by: Grant Likely <grant.likely@linaro.org>
2013-10-18Add shared update_fdt() function for ARM/ARM64Roy Franz
Both ARM and ARM64 stubs will update the device tree that they pass to the kernel. In both cases they primarily need to add the same UEFI related information, so the function can be shared. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18efi-stub.txt updates for ARMRoy Franz
Update efi-stub.txt documentation to be more general and not x86 specific. Add ARM only "dtb=" command line option description. Signed-off-by: Roy Franz <roy.franz@linaro.org>
2013-10-18efi: resolve warnings found on ARM compileRoy Franz
warnings from gcc: warning: label 'free_pool' defined but not used [-Wunused-label] warning: value computed is not used [-Wunused-value] Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Fix types in EFI calls to match EFI function definitions.Roy Franz
EFI calls can made directly on ARM, so the function pointers are directly invoked. This allows types to be checked at compile time, so here we ensure that the parameters match the function signature. The wrappers used by x86 prevent any type checking. Correct the type of chunksize to be based on native width as specified by the EFI_FILE_PROTOCOL read() function. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Renames in handle_cmdline_files() to complete generalization.Roy Franz
Rename variables to be not initrd specific, as now the function loads arbitrary files. This change is exclusively renames and comment changes to reflect the generalization. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Generalize handle_ramdisks() and rename to handle_cmdline_files().Roy Franz
The handle_cmdline_files now takes the option to handle as a string, and returns the loaded data through parameters, rather than taking an x86 specific setup_header structure. For ARM, this will be used to load a device tree blob in addition to initrd images. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Allow efi_free() to be called with size of 0Roy Franz
Make efi_free() safely callable with size of 0, similar to free() being callable with NULL pointers, and do nothing in that case. Remove size checks that this makes redundant. This also avoids some size checks in the ARM EFI stub code that will be added as well. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: use efi_get_memory_map() to get final map for x86Roy Franz
Replace the open-coded memory map getting with the efi_get_memory_map() that is now general enough to use. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: generalize efi_get_memory_map()Roy Franz
Add arguments for returning the descriptor version and also the memory map key. The key is required for calling exit_boot_services(). Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Rename __get_map() to efi_get_memory_map()Roy Franz
Rename function in preparation for making it more flexible and sharing it. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Move unicode to ASCII conversion to shared function.Roy Franz
Move the open-coded conversion to a shared function for use by all architectures. Change the allocation to prefer a high address for ARM, as this is required to avoid conflicts with reserved regions in low memory. We don't know the specifics of these regions until after we process the command line and device tree. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Generalize relocate_kernel() for use by other architectures.Roy Franz
Rename relocate_kernel() to efi_relocate_kernel(), and take parameters rather than x86 specific structure. Add max_addr argument as for ARM we have some address constraints that we need to enforce when relocating the kernel. Add alloc_size parameter for use by ARM64 which uses an uncompressed kernel, and needs to allocate space for BSS. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Move relocate_kernel() to shared file.Roy Franz
The relocate_kernel() function will be generalized and used by all architectures, as they all have similar requirements. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Enforce minimum alignment of 1 page on allocations.Roy Franz
The efi_high_alloc() and efi_low_alloc() functions use the EFI_ALLOCATE_ADDRESS option to the EFI function allocate_pages(), which requires a minimum of page alignment, and rejects all other requests. The existing code could fail to allocate depending on allocation size, as although repeated allocation attempts were made, none were guaranteed to be page aligned. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Rename memory allocation/free functionsRoy Franz
Rename them to be more similar, as low_free() could be used to free memory allocated by both high_alloc() and low_alloc(). high_alloc() -> efi_high_alloc() low_alloc() -> efi_low_alloc() low_free() -> efi_free() Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Add system table pointer argument to shared functions.Roy Franz
Add system table pointer argument to shared EFI stub related functions so they no longer use a global system table pointer as they did when part of eboot.c. For the ARM EFI stub this allows us to avoid global variables completely and thereby not have to deal with GOT fixups. Not having the EFI stub fixup its GOT, which is shared with the decompressor, simplifies the relocating of the zImage to a bootable address. Signed-off-by: Roy Franz <roy.franz@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-10-18efi: Move common EFI stub code from x86 arch code to common locationRoy Franz
No code changes made, just moving functions and #define from x86 arch directory to common location. Code is shared using #include, similar to how decompression code is shared among architectures. Signed-off-by: Roy Franz <roy.franz@linaro.org> Acked-by: Mark Salter <msalter@redhat.com> Reviewed-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com>