diff options
-rw-r--r-- | ArmPkg/Drivers/CpuDxe/Exception.c | 7 | ||||
-rw-r--r-- | ArmPkg/Library/BdsLib/BdsLinuxLoader.c | 18 |
2 files changed, 16 insertions, 9 deletions
diff --git a/ArmPkg/Drivers/CpuDxe/Exception.c b/ArmPkg/Drivers/CpuDxe/Exception.c index 2f7e1b637f..55a7132193 100644 --- a/ArmPkg/Drivers/CpuDxe/Exception.c +++ b/ArmPkg/Drivers/CpuDxe/Exception.c @@ -206,10 +206,13 @@ InitializeExceptions ( //Note: On ARM processor with the Security Extension, the Vector Table can be located anywhere in the memory.
// The Vector Base Address Register defines the location
- ArmWriteVBar(PcdGet32(PcdCpuVectorBaseAddress));
+ ArmWriteVBar (PcdGet32(PcdCpuVectorBaseAddress));
} else {
+ // The Vector table must be 32-byte aligned
+ ASSERT(((UINT32)ExceptionHandlersStart & ((1 << 5)-1)) == 0);
+
// We do not copy the Exception Table at PcdGet32(PcdCpuVectorBaseAddress). We just set Vector Base Address to point into CpuDxe code.
- ArmWriteVBar((UINT32)ExceptionHandlersStart);
+ ArmWriteVBar ((UINT32)ExceptionHandlersStart);
}
if (FiqEnabled) {
diff --git a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c index ca5e547043..f463fd9a34 100644 --- a/ArmPkg/Library/BdsLib/BdsLinuxLoader.c +++ b/ArmPkg/Library/BdsLib/BdsLinuxLoader.c @@ -201,7 +201,7 @@ BdsBootLinux ( EFI_STATUS Status; UINT32 LinuxImageSize; UINT32 KernelParamsSize; - VOID* KernelParamsAddress = NULL; + EFI_PHYSICAL_ADDRESS KernelParamsAddress; UINT32 MachineType; BOOLEAN FdtSupported = FALSE; LINUX_KERNEL LinuxKernel; @@ -214,15 +214,19 @@ BdsBootLinux ( LinuxImage = LINUX_KERNEL_MAX_OFFSET; Status = BdsLoadImage (LinuxKernelDevicePath, AllocateMaxAddress, &LinuxImage, &LinuxImageSize); if (EFI_ERROR(Status)) { - DEBUG ((EFI_D_ERROR, "ERROR: Do not find Linux kernel.\n")); + Print (L"ERROR: Did not find Linux kernel.\n"); return Status; } LinuxKernel = (LINUX_KERNEL)(UINTN)LinuxImage; - // Load the FDT binary from a device path - KernelParamsAddress = (VOID*)LINUX_ATAG_MAX_OFFSET; - Status = BdsLoadImage (FdtDevicePath, AllocateMaxAddress, (EFI_PHYSICAL_ADDRESS*)&KernelParamsAddress, &KernelParamsSize); - if (!EFI_ERROR(Status)) { + if (FdtDevicePath) { + // Load the FDT binary from a device path + KernelParamsAddress = LINUX_ATAG_MAX_OFFSET; + Status = BdsLoadImage (FdtDevicePath, AllocateMaxAddress, &KernelParamsAddress, &KernelParamsSize); + if (EFI_ERROR(Status)) { + Print (L"ERROR: Did not find Device Tree blob.\n"); + return Status; + } FdtSupported = TRUE; } @@ -259,7 +263,7 @@ BdsBootLinux ( // physical memory. if ((UINTN)KernelParamsAddress > LINUX_ATAG_MAX_OFFSET) { //Note: There is no requirement on the alignment - KernelParamsAddress = CopyMem (ALIGN32_BELOW(LINUX_ATAG_MAX_OFFSET - KernelParamsSize), KernelParamsAddress, KernelParamsSize); + KernelParamsAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)CopyMem (ALIGN32_BELOW(LINUX_ATAG_MAX_OFFSET - KernelParamsSize), (VOID*)(UINTN)KernelParamsAddress, KernelParamsSize); } if ((UINTN)LinuxImage > LINUX_KERNEL_MAX_OFFSET) { |