mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/Bds: Fixed adding support for new boot entry when the generated DevicePath is bigger than one node
The initial support was only considering the added Device Path will be a single node. TFTP for instance requires two new nodes on the top of the ethernet Device Path; a first one for the IP address of the server and a second one for the file to download. This change replace the return argument from a DevicePath node by a DevicePath. It means the End Device Path node is now required. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14194 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a90e327921
commit
ecc62d1390
|
@ -100,7 +100,7 @@ typedef struct _BDS_LOAD_OPTION_SUPPORT {
|
||||||
BDS_SUPPORTED_DEVICE_TYPE Type;
|
BDS_SUPPORTED_DEVICE_TYPE Type;
|
||||||
EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);
|
EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);
|
||||||
BOOLEAN (*IsSupported)(IN EFI_DEVICE_PATH *DevicePath);
|
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 (*CreateDevicePathNode)(IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes, 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);
|
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;
|
} BDS_LOAD_OPTION_SUPPORT;
|
||||||
|
|
||||||
|
|
|
@ -125,8 +125,8 @@ BootMenuAddBootOption (
|
||||||
ARM_BDS_LOADER_TYPE BootType;
|
ARM_BDS_LOADER_TYPE BootType;
|
||||||
BDS_LOAD_OPTION_ENTRY *BdsLoadOptionEntry;
|
BDS_LOAD_OPTION_ENTRY *BdsLoadOptionEntry;
|
||||||
EFI_DEVICE_PATH *DevicePath;
|
EFI_DEVICE_PATH *DevicePath;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePathNodes;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *InitrdPathNode;
|
EFI_DEVICE_PATH_PROTOCOL *InitrdPathNodes;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
|
EFI_DEVICE_PATH_PROTOCOL *InitrdPath;
|
||||||
UINTN CmdLineSize;
|
UINTN CmdLineSize;
|
||||||
BOOLEAN InitrdSupport;
|
BOOLEAN InitrdSupport;
|
||||||
|
@ -143,13 +143,17 @@ BootMenuAddBootOption (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the specific device path node
|
// Create the specific device path node
|
||||||
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNode, &BootType, &Attributes);
|
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"EFI Application or the kernel", &DevicePathNodes, &BootType, &Attributes);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
}
|
}
|
||||||
// Append the Device Path node to the select device path
|
// Append the Device Path to the selected device path
|
||||||
DevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)DevicePathNode);
|
DevicePath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)DevicePathNodes);
|
||||||
|
if (DevicePath == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
|
|
||||||
if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
|
if ((BootType == BDS_LOADER_KERNEL_LINUX_ATAG) || (BootType == BDS_LOADER_KERNEL_LINUX_FDT)) {
|
||||||
Print(L"Add an initrd: ");
|
Print(L"Add an initrd: ");
|
||||||
|
@ -161,15 +165,19 @@ BootMenuAddBootOption (
|
||||||
|
|
||||||
if (InitrdSupport) {
|
if (InitrdSupport) {
|
||||||
// Create the specific device path node
|
// Create the specific device path node
|
||||||
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNode, NULL, NULL);
|
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"initrd", &InitrdPathNodes, 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
|
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;
|
Status = EFI_ABORTED;
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InitrdPathNode != NULL) {
|
if (InitrdPathNodes != NULL) {
|
||||||
// Append the Device Path node to the select device path
|
// Append the Device Path to the selected device path
|
||||||
InitrdPath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
|
InitrdPath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
|
||||||
|
if (InitrdPath == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
InitrdPath = NULL;
|
InitrdPath = NULL;
|
||||||
}
|
}
|
||||||
|
@ -214,7 +222,6 @@ BootMenuAddBootOption (
|
||||||
FREE_DEVICE_PATH:
|
FREE_DEVICE_PATH:
|
||||||
FreePool (DevicePath);
|
FreePool (DevicePath);
|
||||||
|
|
||||||
|
|
||||||
EXIT:
|
EXIT:
|
||||||
if (Status == EFI_ABORTED) {
|
if (Status == EFI_ABORTED) {
|
||||||
Print(L"\n");
|
Print(L"\n");
|
||||||
|
@ -281,7 +288,7 @@ BootMenuSelectBootOption (
|
||||||
if (BootOptionCount == 0) {
|
if (BootOptionCount == 0) {
|
||||||
if (StrCmp (InputStatement, DELETE_BOOT_ENTRY) == 0) {
|
if (StrCmp (InputStatement, DELETE_BOOT_ENTRY) == 0) {
|
||||||
Print (L"Nothing to remove!\n");
|
Print (L"Nothing to remove!\n");
|
||||||
}else if (StrCmp (InputStatement, UPDATE_BOOT_ENTRY) == 0) {
|
} else if (StrCmp (InputStatement, UPDATE_BOOT_ENTRY) == 0) {
|
||||||
Print (L"Couldn't find valid boot entries\n");
|
Print (L"Couldn't find valid boot entries\n");
|
||||||
} else{
|
} else{
|
||||||
Print (L"No supported Boot Entry.\n");
|
Print (L"No supported Boot Entry.\n");
|
||||||
|
@ -362,7 +369,7 @@ BootMenuUpdateBootOption (
|
||||||
ARM_BDS_LOADER_TYPE BootType;
|
ARM_BDS_LOADER_TYPE BootType;
|
||||||
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
|
ARM_BDS_LOADER_OPTIONAL_DATA* OptionalData;
|
||||||
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
|
ARM_BDS_LINUX_ARGUMENTS* LinuxArguments;
|
||||||
EFI_DEVICE_PATH *InitrdPathNode;
|
EFI_DEVICE_PATH *InitrdPathNodes;
|
||||||
EFI_DEVICE_PATH *InitrdPath;
|
EFI_DEVICE_PATH *InitrdPath;
|
||||||
UINTN InitrdSize;
|
UINTN InitrdSize;
|
||||||
UINTN CmdLineSize;
|
UINTN CmdLineSize;
|
||||||
|
@ -419,20 +426,24 @@ BootMenuUpdateBootOption (
|
||||||
} else {
|
} else {
|
||||||
// Case we create the initrd device path
|
// Case we create the initrd device path
|
||||||
|
|
||||||
Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNode, NULL, NULL);
|
Status = DeviceSupport->CreateDevicePathNode (L"initrd", &InitrdPathNodes, 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
|
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;
|
Status = EFI_ABORTED;
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InitrdPathNode != NULL) {
|
if (InitrdPathNodes != NULL) {
|
||||||
// Duplicate Linux kernel Device Path
|
// Duplicate Linux kernel Device Path
|
||||||
TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
|
TempInitrdPath = DuplicateDevicePath (BootOption->FilePathList);
|
||||||
// Replace Linux kernel Node by EndNode
|
// Replace Linux kernel Node by EndNode
|
||||||
SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
|
SetDevicePathEndNode (GetLastDevicePathNode (TempInitrdPath));
|
||||||
// Append the Device Path node to the select device path
|
// Append the Device Path to the selected device path
|
||||||
InitrdPath = AppendDevicePathNode (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNode);
|
InitrdPath = AppendDevicePath (TempInitrdPath, (CONST EFI_DEVICE_PATH_PROTOCOL *)InitrdPathNodes);
|
||||||
FreePool (TempInitrdPath);
|
FreePool (TempInitrdPath);
|
||||||
|
if (InitrdPath == NULL) {
|
||||||
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
|
goto EXIT;
|
||||||
|
}
|
||||||
InitrdSize = GetDevicePathSize (InitrdPath);
|
InitrdSize = GetDevicePathSize (InitrdPath);
|
||||||
} else {
|
} else {
|
||||||
InitrdPath = NULL;
|
InitrdPath = NULL;
|
||||||
|
@ -494,7 +505,7 @@ UpdateFdtPath (
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN FdtDevicePathSize;
|
UINTN FdtDevicePathSize;
|
||||||
BDS_SUPPORTED_DEVICE *SupportedBootDevice;
|
BDS_SUPPORTED_DEVICE *SupportedBootDevice;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNode;
|
EFI_DEVICE_PATH_PROTOCOL *FdtDevicePathNodes;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *FdtDevicePath;
|
||||||
|
|
||||||
Status = SelectBootDevice (&SupportedBootDevice);
|
Status = SelectBootDevice (&SupportedBootDevice);
|
||||||
|
@ -504,15 +515,15 @@ UpdateFdtPath (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the specific device path node
|
// Create the specific device path node
|
||||||
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNode, NULL, NULL);
|
Status = SupportedBootDevice->Support->CreateDevicePathNode (L"FDT blob", &FdtDevicePathNodes, NULL, NULL);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
Status = EFI_ABORTED;
|
Status = EFI_ABORTED;
|
||||||
goto EXIT;
|
goto EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FdtDevicePathNode != NULL) {
|
if (FdtDevicePathNodes != NULL) {
|
||||||
// Append the Device Path node to the select device path
|
// Append the Device Path node to the select device path
|
||||||
FdtDevicePath = AppendDevicePathNode (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNode);
|
FdtDevicePath = AppendDevicePath (SupportedBootDevice->DevicePathProtocol, FdtDevicePathNodes);
|
||||||
FdtDevicePathSize = GetDevicePathSize (FdtDevicePath);
|
FdtDevicePathSize = GetDevicePathSize (FdtDevicePath);
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
(CHAR16*)L"Fdt",
|
(CHAR16*)L"Fdt",
|
||||||
|
|
|
@ -34,7 +34,7 @@ BdsLoadOptionFileSystemList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionFileSystemCreateDevicePath (
|
BdsLoadOptionFileSystemCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
);
|
);
|
||||||
|
@ -61,7 +61,7 @@ BdsLoadOptionMemMapList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionMemMapCreateDevicePath (
|
BdsLoadOptionMemMapCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
);
|
);
|
||||||
|
@ -88,7 +88,7 @@ BdsLoadOptionPxeList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionPxeCreateDevicePath (
|
BdsLoadOptionPxeCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
);
|
);
|
||||||
|
@ -115,7 +115,7 @@ BdsLoadOptionTftpList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionTftpCreateDevicePath (
|
BdsLoadOptionTftpCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
);
|
);
|
||||||
|
@ -332,7 +332,7 @@ BdsLoadOptionFileSystemList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionFileSystemCreateDevicePath (
|
BdsLoadOptionFileSystemCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
)
|
)
|
||||||
|
@ -350,16 +350,17 @@ BdsLoadOptionFileSystemCreateDevicePath (
|
||||||
|
|
||||||
BootFilePathSize = StrSize (BootFilePath);
|
BootFilePathSize = StrSize (BootFilePath);
|
||||||
if (BootFilePathSize == 2) {
|
if (BootFilePathSize == 2) {
|
||||||
*DevicePathNode = NULL;
|
*DevicePathNodes = NULL;
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the FilePath Device Path node
|
// Create the FilePath Device Path node
|
||||||
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
FilePathDevicePath = (FILEPATH_DEVICE_PATH*)AllocatePool(SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize + END_DEVICE_PATH_LENGTH);
|
||||||
FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;
|
FilePathDevicePath->Header.Type = MEDIA_DEVICE_PATH;
|
||||||
FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
|
FilePathDevicePath->Header.SubType = MEDIA_FILEPATH_DP;
|
||||||
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||||
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
||||||
|
SetDevicePathEndNode ((VOID*)((UINTN)FilePathDevicePath + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize));
|
||||||
|
|
||||||
if (BootType != NULL || Attributes != NULL) {
|
if (BootType != NULL || Attributes != NULL) {
|
||||||
Status = BootDeviceGetType (FilePathDevicePath->PathName, BootType, Attributes);
|
Status = BootDeviceGetType (FilePathDevicePath->PathName, BootType, Attributes);
|
||||||
|
@ -368,7 +369,7 @@ BdsLoadOptionFileSystemCreateDevicePath (
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
FreePool (FilePathDevicePath);
|
FreePool (FilePathDevicePath);
|
||||||
} else {
|
} else {
|
||||||
*DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL*)FilePathDevicePath;
|
*DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)FilePathDevicePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -533,7 +534,7 @@ BdsLoadOptionMemMapList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionMemMapCreateDevicePath (
|
BdsLoadOptionMemMapCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
)
|
)
|
||||||
|
@ -574,7 +575,7 @@ BdsLoadOptionMemMapCreateDevicePath (
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
FreePool (MemMapDevicePath);
|
FreePool (MemMapDevicePath);
|
||||||
} else {
|
} else {
|
||||||
*DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL*)MemMapDevicePath;
|
*DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)MemMapDevicePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -691,13 +692,13 @@ BdsLoadOptionPxeList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionPxeCreateDevicePath (
|
BdsLoadOptionPxeCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
|
*DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH);
|
||||||
SetDevicePathEndNode (*DevicePathNode);
|
SetDevicePathEndNode (*DevicePathNodes);
|
||||||
*BootType = BDS_LOADER_EFI_APPLICATION;
|
*BootType = BDS_LOADER_EFI_APPLICATION;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -793,7 +794,7 @@ BdsLoadOptionTftpList (
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BdsLoadOptionTftpCreateDevicePath (
|
BdsLoadOptionTftpCreateDevicePath (
|
||||||
IN CHAR16* FileName,
|
IN CHAR16* FileName,
|
||||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode,
|
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes,
|
||||||
OUT ARM_BDS_LOADER_TYPE *BootType,
|
OUT ARM_BDS_LOADER_TYPE *BootType,
|
||||||
OUT UINT32 *Attributes
|
OUT UINT32 *Attributes
|
||||||
)
|
)
|
||||||
|
@ -839,7 +840,7 @@ BdsLoadOptionTftpCreateDevicePath (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate the memory for the IPv4 + File Path Device Path Nodes
|
// Allocate the memory for the IPv4 + File Path Device Path Nodes
|
||||||
IPv4DevicePathNode = (IPv4_DEVICE_PATH*)AllocatePool(sizeof(IPv4_DEVICE_PATH) + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
IPv4DevicePathNode = (IPv4_DEVICE_PATH*)AllocatePool(sizeof(IPv4_DEVICE_PATH) + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize + END_DEVICE_PATH_LENGTH);
|
||||||
|
|
||||||
// Create the IPv4 Device Path
|
// Create the IPv4 Device Path
|
||||||
IPv4DevicePathNode->Header.Type = MESSAGING_DEVICE_PATH;
|
IPv4DevicePathNode->Header.Type = MESSAGING_DEVICE_PATH;
|
||||||
|
@ -859,6 +860,9 @@ BdsLoadOptionTftpCreateDevicePath (
|
||||||
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
SetDevicePathNodeLength (FilePathDevicePath, SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize);
|
||||||
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
CopyMem (FilePathDevicePath->PathName, BootFilePath, BootFilePathSize);
|
||||||
|
|
||||||
|
// Set the End Device Path Node
|
||||||
|
SetDevicePathEndNode ((VOID*)((UINTN)FilePathDevicePath + SIZE_OF_FILEPATH_DEVICE_PATH + BootFilePathSize));
|
||||||
|
|
||||||
if (BootType != NULL || Attributes != NULL) {
|
if (BootType != NULL || Attributes != NULL) {
|
||||||
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
Status = BootDeviceGetType (NULL, BootType, Attributes);
|
||||||
}
|
}
|
||||||
|
@ -866,7 +870,7 @@ BdsLoadOptionTftpCreateDevicePath (
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
FreePool (IPv4DevicePathNode);
|
FreePool (IPv4DevicePathNode);
|
||||||
} else {
|
} else {
|
||||||
*DevicePathNode = (EFI_DEVICE_PATH_PROTOCOL*)IPv4DevicePathNode;
|
*DevicePathNodes = (EFI_DEVICE_PATH_PROTOCOL*)IPv4DevicePathNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Reference in New Issue