mirror of https://github.com/acidanthera/audk.git
ArmPkg/BdsLib: Linux kernel supports either FDT or ATAG
If a FDT blob is passed to the kernel it is required we can load it. If we fail to load the binary then we must abort the Linux booting process. ArmPkg/CpuDxe: Ensure the reset vector passed to the CP15 VBAR register is aligned on the right boundary git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11968 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f3de0a607d
commit
1c1e70fa6e
|
@ -206,10 +206,13 @@ InitializeExceptions (
|
||||||
|
|
||||||
//Note: On ARM processor with the Security Extension, the Vector Table can be located anywhere in the memory.
|
//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
|
// The Vector Base Address Register defines the location
|
||||||
ArmWriteVBar(PcdGet32(PcdCpuVectorBaseAddress));
|
ArmWriteVBar (PcdGet32(PcdCpuVectorBaseAddress));
|
||||||
} else {
|
} 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.
|
// 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) {
|
if (FiqEnabled) {
|
||||||
|
|
|
@ -201,7 +201,7 @@ BdsBootLinux (
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 LinuxImageSize;
|
UINT32 LinuxImageSize;
|
||||||
UINT32 KernelParamsSize;
|
UINT32 KernelParamsSize;
|
||||||
VOID* KernelParamsAddress = NULL;
|
EFI_PHYSICAL_ADDRESS KernelParamsAddress;
|
||||||
UINT32 MachineType;
|
UINT32 MachineType;
|
||||||
BOOLEAN FdtSupported = FALSE;
|
BOOLEAN FdtSupported = FALSE;
|
||||||
LINUX_KERNEL LinuxKernel;
|
LINUX_KERNEL LinuxKernel;
|
||||||
|
@ -214,15 +214,19 @@ BdsBootLinux (
|
||||||
LinuxImage = LINUX_KERNEL_MAX_OFFSET;
|
LinuxImage = LINUX_KERNEL_MAX_OFFSET;
|
||||||
Status = BdsLoadImage (LinuxKernelDevicePath, AllocateMaxAddress, &LinuxImage, &LinuxImageSize);
|
Status = BdsLoadImage (LinuxKernelDevicePath, AllocateMaxAddress, &LinuxImage, &LinuxImageSize);
|
||||||
if (EFI_ERROR(Status)) {
|
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;
|
return Status;
|
||||||
}
|
}
|
||||||
LinuxKernel = (LINUX_KERNEL)(UINTN)LinuxImage;
|
LinuxKernel = (LINUX_KERNEL)(UINTN)LinuxImage;
|
||||||
|
|
||||||
// Load the FDT binary from a device path
|
if (FdtDevicePath) {
|
||||||
KernelParamsAddress = (VOID*)LINUX_ATAG_MAX_OFFSET;
|
// Load the FDT binary from a device path
|
||||||
Status = BdsLoadImage (FdtDevicePath, AllocateMaxAddress, (EFI_PHYSICAL_ADDRESS*)&KernelParamsAddress, &KernelParamsSize);
|
KernelParamsAddress = LINUX_ATAG_MAX_OFFSET;
|
||||||
if (!EFI_ERROR(Status)) {
|
Status = BdsLoadImage (FdtDevicePath, AllocateMaxAddress, &KernelParamsAddress, &KernelParamsSize);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
Print (L"ERROR: Did not find Device Tree blob.\n");
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
FdtSupported = TRUE;
|
FdtSupported = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +263,7 @@ BdsBootLinux (
|
||||||
// physical memory.
|
// physical memory.
|
||||||
if ((UINTN)KernelParamsAddress > LINUX_ATAG_MAX_OFFSET) {
|
if ((UINTN)KernelParamsAddress > LINUX_ATAG_MAX_OFFSET) {
|
||||||
//Note: There is no requirement on the alignment
|
//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) {
|
if ((UINTN)LinuxImage > LINUX_KERNEL_MAX_OFFSET) {
|
||||||
|
|
Loading…
Reference in New Issue