mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/Bds: Fixed and Improved initrd support in the ArmPlatformPkg Boot Manager
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12641 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
483bc3d330
commit
22a262c8ee
|
@ -99,9 +99,9 @@ typedef struct {
|
|||
typedef struct _BDS_LOAD_OPTION_SUPPORT {
|
||||
BDS_SUPPORTED_DEVICE_TYPE Type;
|
||||
EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);
|
||||
BOOLEAN (*IsSupported)(IN BDS_LOAD_OPTION* BdsLoadOption);
|
||||
EFI_STATUS (*CreateDevicePathNode)(IN BDS_SUPPORTED_DEVICE* BdsLoadOption, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
|
||||
EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
|
||||
BOOLEAN (*IsSupported)(IN EFI_DEVICE_PATH *DevicePath);
|
||||
EFI_STATUS (*CreateDevicePathNode)(IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
|
||||
EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT ARM_BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);
|
||||
} BDS_LOAD_OPTION_SUPPORT;
|
||||
|
||||
#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)
|
||||
|
@ -128,7 +128,7 @@ BootDeviceListSupportedFree (
|
|||
|
||||
EFI_STATUS
|
||||
BootDeviceGetDeviceSupport (
|
||||
IN BDS_LOAD_OPTION *BootOption,
|
||||
IN EFI_DEVICE_PATH *DevicePath,
|
||||
OUT BDS_LOAD_OPTION_SUPPORT **DeviceSupport
|
||||
);
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ BootMenuAddBootOption (
|
|||
EFI_DEVICE_PATH_PROTOCOL *InitrdPathNode;
|
||||
EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
|
||||
UINTN CmdLineSize;
|
||||
BOOLEAN InitrdSupport;
|
||||
UINTN InitrdSize;
|
||||
|
||||
Attributes = 0;
|
||||
|
@ -139,8 +140,7 @@ BootMenuAddBootOption (
|
|||
}
|
||||
|
||||
// Create the specific device path node
|
||||
Print(L"File path of the EFI Application or the kernel: ");
|
||||
Status = SupportedBootDevice->Support->CreateDevicePathNode (SupportedBootDevice, &DevicePathNode, &BootType, &Attributes);
|
||||
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNode, &BootType, &Attributes);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto EXIT;
|
||||
|
@ -149,9 +149,16 @@ BootMenuAddBootOption (
|
|||
DevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)DevicePathNode);
|
||||
|
||||
if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
|
||||
Print(L"Add an initrd: ");
|
||||
Status = GetHIInputBoolean (&InitrdSupport);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (InitrdSupport) {
|
||||
// Create the specific device path node
|
||||
Print(L"File path of the initrd: ");
|
||||
Status = SupportedBootDevice->Support->CreateDevicePathNode (SupportedBootDevice, &InitrdPathNode, NULL, NULL);
|
||||
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNode, NULL, NULL);
|
||||
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
|
||||
Status = EFI_ABORTED;
|
||||
goto EXIT;
|
||||
|
@ -163,6 +170,9 @@ BootMenuAddBootOption (
|
|||
} else {
|
||||
InitrdPath = NULL;
|
||||
}
|
||||
} else {
|
||||
InitrdPath = NULL;
|
||||
}
|
||||
|
||||
Print(L"Arguments to pass to the binary: ");
|
||||
Status = GetHIInputAscii (CmdLine,BOOT_DEVICE_OPTION_MAX);
|
||||
|
@ -348,9 +358,11 @@ BootMenuUpdateBootOption (
|
|||
ARM_BDS_LOADER_TYPE BootType;
|
||||
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
|
||||
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
|
||||
EFI_DEVICE_PATH* InitrdPathList;
|
||||
EFI_DEVICE_PATH *InitrdPathNode;
|
||||
EFI_DEVICE_PATH *InitrdPath;
|
||||
UINTN InitrdSize;
|
||||
UINTN CmdLineSize;
|
||||
BOOLEAN InitrdSupport;
|
||||
|
||||
Status = BootMenuSelectBootOption (BootOptionsList, UPDATE_BOOT_ENTRY, TRUE, &BootOptionEntry);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
@ -359,14 +371,13 @@ BootMenuUpdateBootOption (
|
|||
BootOption = BootOptionEntry->BdsLoadOption;
|
||||
|
||||
// Get the device support for this Boot Option
|
||||
Status = BootDeviceGetDeviceSupport (BootOption, &DeviceSupport);
|
||||
Status = BootDeviceGetDeviceSupport (BootOption->FilePathList, &DeviceSupport);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Print(L"Not possible to retrieve the supported device for the update\n");
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Print(L"File path of the EFI Application or the kernel: ");
|
||||
Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, &DevicePath, NULL, NULL);
|
||||
Status = DeviceSupport->UpdateDevicePathNode (BootOption->FilePathList, L"EFI Application or the kernel", &DevicePath, NULL, NULL);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto EXIT;
|
||||
|
@ -375,7 +386,6 @@ BootMenuUpdateBootOption (
|
|||
OptionalData = BootOption->OptionalData;
|
||||
BootType = (ARM_BDS_LOADER_TYPE)ReadUnaligned32 ((UINT32 *)(&OptionalData->Header.LoaderType));
|
||||
|
||||
// TODO: Allow adding an initrd to a boot entry without one
|
||||
if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
|
||||
LinuxArguments = &OptionalData->Arguments.LinuxArguments;
|
||||
|
||||
|
@ -383,13 +393,47 @@ BootMenuUpdateBootOption (
|
|||
|
||||
InitrdSize = ReadUnaligned16 ((CONST UINT16*)&LinuxArguments->InitrdSize);
|
||||
if (InitrdSize > 0) {
|
||||
Print(L"File path of the initrd: ");
|
||||
Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize), &InitrdPathList, NULL, NULL);
|
||||
Print(L"Keep the initrd: ");
|
||||
} else {
|
||||
Print(L"Add an initrd: ");
|
||||
}
|
||||
Status = GetHIInputBoolean (&InitrdSupport);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = EFI_ABORTED;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (InitrdSupport) {
|
||||
if (InitrdSize > 0) {
|
||||
// Case we update the initrd device path
|
||||
Status = DeviceSupport->UpdateDevicePathNode ((EFI_DEVICE_PATH*)((LinuxArguments + 1) + CmdLineSize), L"initrd", &InitrdPath, NULL, NULL);
|
||||
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) {// EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
|
||||
Status = EFI_ABORTED;
|
||||
goto EXIT;
|
||||
}
|
||||
InitrdSize = GetDevicePathSize (InitrdPathList);
|
||||
InitrdSize = GetDevicePathSize (InitrdPath);
|
||||
} else {
|
||||
// Case we create the initrd device path
|
||||
|
||||
Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNode, NULL, NULL);
|
||||
if (EFI_ERROR(Status) && Status != EFI_NOT_FOUND) { // EFI_NOT_FOUND is returned on empty input string, but we can boot without an initrd
|
||||
Status = EFI_ABORTED;
|
||||
goto EXIT;
|
||||
}
|
||||
|
||||
if (InitrdPathNode != NULL) {
|
||||
// Duplicate Linux kernel Device Path
|
||||
DevicePath = DuplicateDevicePath (BootOption->FilePathList);
|
||||
// Replace Linux kernel Node by EndNode
|
||||
SetDevicePathEndNode (GetLastDevicePathNode (DevicePath));
|
||||
// Append the Device Path node to the select device path
|
||||
InitrdPath = AppendDevicePathNode (DevicePath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
|
||||
} else {
|
||||
InitrdPath = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
InitrdSize = 0;
|
||||
}
|
||||
|
||||
Print(L"Arguments to pass to the binary: ");
|
||||
|
@ -410,7 +454,7 @@ BootMenuUpdateBootOption (
|
|||
BootArguments->LinuxArguments.CmdLineSize = CmdLineSize;
|
||||
BootArguments->LinuxArguments.InitrdSize = InitrdSize;
|
||||
CopyMem (&BootArguments->LinuxArguments + 1, CmdLine, CmdLineSize);
|
||||
CopyMem ((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLine, InitrdPathList, InitrdSize);
|
||||
CopyMem ((UINTN)(&BootArguments->LinuxArguments + 1) + CmdLine, InitrdPath, InitrdSize);
|
||||
} else {
|
||||
BootArguments = NULL;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ BdsLoadOptionFileSystemList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionFileSystemCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -42,6 +42,7 @@ BdsLoadOptionFileSystemCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionFileSystemUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -49,7 +50,7 @@ BdsLoadOptionFileSystemUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionFileSystemIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
|
@ -59,7 +60,7 @@ BdsLoadOptionMemMapList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionMemMapCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -68,6 +69,7 @@ BdsLoadOptionMemMapCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionMemMapUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -75,7 +77,7 @@ BdsLoadOptionMemMapUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionMemMapIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
|
@ -85,7 +87,7 @@ BdsLoadOptionPxeList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionPxeCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -94,6 +96,7 @@ BdsLoadOptionPxeCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionPxeUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -101,7 +104,7 @@ BdsLoadOptionPxeUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionPxeIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
|
@ -111,7 +114,7 @@ BdsLoadOptionTftpList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionTftpCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -120,6 +123,7 @@ BdsLoadOptionTftpCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionTftpUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -127,7 +131,7 @@ BdsLoadOptionTftpUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionTftpIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
);
|
||||
|
||||
BDS_LOAD_OPTION_SUPPORT BdsLoadOptionSupportList[] = {
|
||||
|
@ -201,7 +205,7 @@ BootDeviceListSupportedFree (
|
|||
|
||||
EFI_STATUS
|
||||
BootDeviceGetDeviceSupport (
|
||||
IN BDS_LOAD_OPTION *BootOption,
|
||||
IN EFI_DEVICE_PATH *DevicePath,
|
||||
OUT BDS_LOAD_OPTION_SUPPORT **DeviceSupport
|
||||
)
|
||||
{
|
||||
|
@ -209,7 +213,7 @@ BootDeviceGetDeviceSupport (
|
|||
|
||||
// Find which supported device is the most appropriate
|
||||
for (Index = 0; Index < BDS_DEVICE_MAX; Index++) {
|
||||
if (BdsLoadOptionSupportList[Index].IsSupported (BootOption)) {
|
||||
if (BdsLoadOptionSupportList[Index].IsSupported (DevicePath)) {
|
||||
*DeviceSupport = &BdsLoadOptionSupportList[Index];
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -327,7 +331,7 @@ BdsLoadOptionFileSystemList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionFileSystemCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -338,6 +342,7 @@ BdsLoadOptionFileSystemCreateDevicePath (
|
|||
CHAR16 BootFilePath[BOOT_DEVICE_FILEPATH_MAX];
|
||||
UINTN BootFilePathSize;
|
||||
|
||||
Print(L"File path of the %s: ", FileName);
|
||||
Status = GetHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
|
@ -372,6 +377,7 @@ BdsLoadOptionFileSystemCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionFileSystemUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -388,6 +394,7 @@ BdsLoadOptionFileSystemUpdateDevicePath (
|
|||
|
||||
EndingDevicePath = (FILEPATH_DEVICE_PATH*)GetLastDevicePathNode (DevicePath);
|
||||
|
||||
Print(L"File path of the %s: ", FileName);
|
||||
StrnCpy (BootFilePath, EndingDevicePath->PathName, BOOT_DEVICE_FILEPATH_MAX);
|
||||
Status = EditHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
@ -421,12 +428,12 @@ BdsLoadOptionFileSystemUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionFileSystemIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH* DevicePathNode;
|
||||
|
||||
DevicePathNode = GetLastDevicePathNode (BdsLoadOption->FilePathList);
|
||||
DevicePathNode = GetLastDevicePathNode (DevicePath);
|
||||
|
||||
return IS_DEVICE_PATH_NODE(DevicePathNode,MEDIA_DEVICE_PATH,MEDIA_FILEPATH_DP);
|
||||
}
|
||||
|
@ -525,7 +532,7 @@ BdsLoadOptionMemMapList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionMemMapCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -536,27 +543,34 @@ BdsLoadOptionMemMapCreateDevicePath (
|
|||
CHAR16 StrStartingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
CHAR16 StrEndingAddress[BOOT_DEVICE_ADDRESS_MAX];
|
||||
|
||||
Print(L"Starting Address of the binary: ");
|
||||
Print(L"Starting Address of the %s: ", FileName);
|
||||
Status = GetHIInputStr (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
Print(L"Ending Address of the binary: ");
|
||||
Print(L"Ending Address of the %s: ", FileName);
|
||||
Status = GetHIInputStr (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
// Create the MemMap Device Path Node
|
||||
MemMapDevicePath = (MEMMAP_DEVICE_PATH*)AllocatePool (sizeof(MEMMAP_DEVICE_PATH));
|
||||
MemMapDevicePath = (MEMMAP_DEVICE_PATH*)AllocatePool (sizeof(MEMMAP_DEVICE_PATH) + END_DEVICE_PATH_LENGTH);
|
||||
MemMapDevicePath->Header.Type = HARDWARE_DEVICE_PATH;
|
||||
MemMapDevicePath->Header.SubType = HW_MEMMAP_DP;
|
||||
SetDevicePathNodeLength (MemMapDevicePath, sizeof(MEMMAP_DEVICE_PATH));
|
||||
MemMapDevicePath->MemoryType = EfiBootServicesData;
|
||||
MemMapDevicePath->StartingAddress = StrHexToUint64 (StrStartingAddress);
|
||||
MemMapDevicePath->EndingAddress = StrHexToUint64 (StrEndingAddress);
|
||||
|
||||
// Set a Device Path End Node after the Memory Map Device Path Node
|
||||
SetDevicePathEndNode (MemMapDevicePath + 1);
|
||||
|
||||
if (BootType != NULL || Attributes != NULL) {
|
||||
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
||||
}
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool (MemMapDevicePath);
|
||||
} else {
|
||||
|
@ -569,6 +583,7 @@ BdsLoadOptionMemMapCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionMemMapUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -583,14 +598,14 @@ BdsLoadOptionMemMapUpdateDevicePath (
|
|||
DevicePath = DuplicateDevicePath (OldDevicePath);
|
||||
EndingDevicePath = (MEMMAP_DEVICE_PATH*)GetLastDevicePathNode (DevicePath);
|
||||
|
||||
Print(L"Starting Address of the binary: ");
|
||||
Print(L"Starting Address of the %s: ", FileName);
|
||||
UnicodeSPrint (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX, L"0x%X", (UINTN)EndingDevicePath->StartingAddress);
|
||||
Status = EditHIInputStr (StrStartingAddress, BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
Print(L"Ending Address of the binary: ");
|
||||
Print(L"Ending Address of the %s: ", FileName);
|
||||
UnicodeSPrint (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX, L"0x%X", (UINTN)EndingDevicePath->EndingAddress);
|
||||
Status = EditHIInputStr (StrEndingAddress, BOOT_DEVICE_ADDRESS_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
@ -600,7 +615,10 @@ BdsLoadOptionMemMapUpdateDevicePath (
|
|||
EndingDevicePath->StartingAddress = StrHexToUint64 (StrStartingAddress);
|
||||
EndingDevicePath->EndingAddress = StrHexToUint64 (StrEndingAddress);
|
||||
|
||||
if (BootType != NULL || Attributes != NULL) {
|
||||
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
||||
}
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool(DevicePath);
|
||||
} else {
|
||||
|
@ -612,12 +630,12 @@ BdsLoadOptionMemMapUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionMemMapIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_DEVICE_PATH* DevicePathNode;
|
||||
|
||||
DevicePathNode = GetLastDevicePathNode (BdsLoadOption->FilePathList);
|
||||
DevicePathNode = GetLastDevicePathNode (DevicePath);
|
||||
|
||||
return IS_DEVICE_PATH_NODE(DevicePathNode,HARDWARE_DEVICE_PATH,HW_MEMMAP_DP);
|
||||
}
|
||||
|
@ -672,7 +690,7 @@ BdsLoadOptionPxeList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionPxeCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -687,6 +705,7 @@ BdsLoadOptionPxeCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionPxeUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -698,7 +717,7 @@ BdsLoadOptionPxeUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionPxeIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -706,7 +725,7 @@ BdsLoadOptionPxeIsSupported (
|
|||
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *PxeBcProtocol;
|
||||
|
||||
Status = BdsConnectDevicePath (BdsLoadOption->FilePathList, &Handle, &RemainingDevicePath);
|
||||
Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -773,7 +792,7 @@ BdsLoadOptionTftpList (
|
|||
|
||||
EFI_STATUS
|
||||
BdsLoadOptionTftpCreateDevicePath (
|
||||
IN BDS_SUPPORTED_DEVICE* BdsLoadOption,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -808,7 +827,7 @@ BdsLoadOptionTftpCreateDevicePath (
|
|||
return EFI_ABORTED;
|
||||
}
|
||||
|
||||
Print(L"File path of the EFI Application or the kernel : ");
|
||||
Print(L"File path of the %s : ", FileName);
|
||||
Status = GetHIInputStr (BootFilePath, BOOT_DEVICE_FILEPATH_MAX);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return EFI_ABORTED;
|
||||
|
@ -840,7 +859,10 @@ BdsLoadOptionTftpCreateDevicePath (
|
|||
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
||||
|
||||
if (BootType != NULL || Attributes != NULL) {
|
||||
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
||||
}
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool (IPv4DevicePathNode);
|
||||
} else {
|
||||
|
@ -853,6 +875,7 @@ BdsLoadOptionTftpCreateDevicePath (
|
|||
EFI_STATUS
|
||||
BdsLoadOptionTftpUpdateDevicePath (
|
||||
IN EFI_DEVICE_PATH *OldDevicePath,
|
||||
IN CHAR16* FileName,
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **NewDevicePath,
|
||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||
OUT UINT32 *Attributes
|
||||
|
@ -864,7 +887,7 @@ BdsLoadOptionTftpUpdateDevicePath (
|
|||
|
||||
BOOLEAN
|
||||
BdsLoadOptionTftpIsSupported (
|
||||
IN BDS_LOAD_OPTION* BdsLoadOption
|
||||
IN EFI_DEVICE_PATH *DevicePath
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -873,7 +896,7 @@ BdsLoadOptionTftpIsSupported (
|
|||
EFI_DEVICE_PATH *NextDevicePath;
|
||||
EFI_PXE_BASE_CODE_PROTOCOL *PxeBcProtocol;
|
||||
|
||||
Status = BdsConnectDevicePath (BdsLoadOption->FilePathList, &Handle, &RemainingDevicePath);
|
||||
Status = BdsConnectDevicePath (DevicePath, &Handle, &RemainingDevicePath);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue