X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ArmPkg%2FLibrary%2FBdsLib%2FBdsFilePath.c;h=ff421754fe214d9a5e161b73af418be86d401768;hb=9d8ee7815ca7ce02555e17b60b2672674a059ce4;hp=53af9ee76d36830c6a68619dca2c23703b667ebd;hpb=90cd0f1ad713e46087aa7c3c81816fa2b17bcf1b;p=mirror_edk2.git diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c index 53af9ee76d..ff421754fe 100644 --- a/ArmPkg/Library/BdsLib/BdsFilePath.c +++ b/ArmPkg/Library/BdsLib/BdsFilePath.c @@ -1038,7 +1038,7 @@ BdsTftpLoadImage ( EFI_DHCP4_MODE_DATA Dhcp4Mode; EFI_MTFTP4_CONFIG_DATA Mtftp4CfgData; IPv4_DEVICE_PATH *IPv4DevicePathNode; - FILEPATH_DEVICE_PATH *FilePathDevicePathNode; + CHAR16 *PathName; CHAR8 *AsciiFilePath; EFI_MTFTP4_TOKEN Mtftp4Token; UINT64 FileSize; @@ -1185,17 +1185,10 @@ BdsTftpLoadImage ( goto Error; } - // - // Convert the Unicode path of the file to Ascii - // - - FilePathDevicePathNode = (FILEPATH_DEVICE_PATH*)(IPv4DevicePathNode + 1); - AsciiFilePath = AllocatePool ((StrLen (FilePathDevicePathNode->PathName) + 1) * sizeof (CHAR8)); - if (AsciiFilePath == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto Error; - } - UnicodeStrToAsciiStr (FilePathDevicePathNode->PathName, AsciiFilePath); + // The Device Path might contain multiple FilePath nodes + PathName = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL*)(IPv4DevicePathNode + 1), FALSE, FALSE); + AsciiFilePath = AllocatePool (StrLen (PathName) + 1); + UnicodeStrToAsciiStr (PathName, AsciiFilePath); // // Try to get the size of the file in bytes from the server. If it fails, @@ -1241,7 +1234,7 @@ BdsTftpLoadImage ( Mtftp4Token.CheckPacket = Mtftp4CheckPacket; Mtftp4Token.Context = (VOID*)TftpContext; - Print (L"Downloading the file <%s> from the TFTP server\n", FilePathDevicePathNode->PathName); + Print (L"Downloading the file <%a> from the TFTP server\n", AsciiFilePath); Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token); Print (L"\n"); if (EFI_ERROR (Status)) { @@ -1303,6 +1296,7 @@ Error: } if (EFI_ERROR (Status)) { + *Image = 0; Print (L"Failed to download the file - Error=%r\n", Status); }