/** @file\r
EBL commands for EFI and PI Devices\r
\r
- Copyright (c) 2007, Intel Corporation<BR>\r
- Portions copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
+ Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+ Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
\r
- All rights reserved. This program and the accompanying materials\r
+ This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
IN EFI_OPEN_FILE *File\r
)\r
{\r
+ CHAR16 *Str;\r
+\r
if (File == NULL) {\r
return;\r
}\r
\r
AsciiPrint (" %a: ", File->DeviceName);\r
if (File->FsInfo != NULL) {\r
- AsciiPrint ("%s: ", File->FsInfo->VolumeLabel);\r
+ for (Str = File->FsInfo->VolumeLabel; *Str != '\0'; Str++) {\r
+ if (*Str == ' ') {\r
+ // UI makes you enter _ for space, so make the printout match that\r
+ *Str = '_';\r
+ }\r
+ AsciiPrint ("%c", *Str);\r
+ }\r
+ AsciiPrint (":");\r
if (File->FsInfo->ReadOnly) {\r
AsciiPrint ("ReadOnly");\r
}\r
)\r
{\r
UINT64 DeviceSize;\r
-\r
+ UINTN Index;\r
+ UINTN Max;\r
+ EFI_OPEN_FILE *FsFile;\r
\r
if (File == NULL) {\r
return;\r
}\r
\r
AsciiPrint (" %a: ", File->DeviceName);\r
- if (File->FsBlockIoMedia.RemovableMedia) {\r
- AsciiPrint ("Removable ");\r
+\r
+ // print out name of file system, if any, on this block device\r
+ Max = EfiGetDeviceCounts (EfiOpenFileSystem);\r
+ if (Max != 0) {\r
+ for (Index = 0; Index < Max; Index++) {\r
+ FsFile = EfiDeviceOpenByType (EfiOpenFileSystem, Index);\r
+ if (FsFile != NULL) {\r
+ if (FsFile->EfiHandle == File->EfiHandle) {\r
+ AsciiPrint ("fs%d: ", Index);\r
+ EfiClose (FsFile);\r
+ break;\r
+ }\r
+ EfiClose (FsFile);\r
+ }\r
+ }\r
}\r
- if (!File->FsBlockIoMedia.MediaPresent) {\r
- AsciiPrint ("No Media ");\r
+\r
+ // Print out useful Block IO media properties\r
+ if (File->FsBlockIoMedia->RemovableMedia) {\r
+ AsciiPrint ("Removable ");\r
}\r
- if (File->FsBlockIoMedia.LogicalPartition) {\r
- AsciiPrint ("Partition ");\r
+ if (!File->FsBlockIoMedia->MediaPresent) {\r
+ AsciiPrint ("No Media\n");\r
+ } else {\r
+ if (File->FsBlockIoMedia->LogicalPartition) {\r
+ AsciiPrint ("Partition ");\r
+ }\r
+ DeviceSize = MultU64x32 (File->FsBlockIoMedia->LastBlock + 1, File->FsBlockIoMedia->BlockSize);\r
+ AsciiPrint ("Size = 0x%lX\n", DeviceSize);\r
}\r
- DeviceSize = MultU64x32 (File->FsBlockIoMedia.LastBlock + 1, File->FsBlockIoMedia.BlockSize);\r
- AsciiPrint ("Size = 0x%lX\n", DeviceSize);\r
-\r
EfiClose (File);\r
}\r
\r
-\r
/**\r
Print information about the Load File devices.\r
If the device supports PXE dump out extra information\r
UINTN Max;\r
\r
CurrentRow = 0;\r
- \r
+\r
// Need to call here to make sure Device Counts are valid\r
EblUpdateDeviceLists ();\r
\r
+ // Now we can print out the info...\r
Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);\r
if (Max != 0) {\r
AsciiPrint ("Firmware Volume Devices:\n");\r
}\r
\r
Status = gDS->ProcessFirmwareVolume (FvStart, FvSize, &FvHandle);\r
- FreePool (FvStart);\r
+ if (EFI_ERROR (Status)) {\r
+ FreePool (FvStart);\r
+ } \r
}\r
return Status;\r
}\r
UINTN Size;\r
UINTN Offset;\r
UINTN Chunk = FILE_COPY_CHUNK;\r
- \r
+\r
if (Argc < 3) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Status = EfiRead(Source, Buffer, &Chunk);\r
if (EFI_ERROR(Status)) {\r
- AsciiPrint("Read file error\n");\r
+ AsciiPrint("Read file error %r\n", Status);\r
goto Exit;\r
}\r
\r
Status = EfiWrite(Destination, Buffer, &Chunk);\r
if (EFI_ERROR(Status)) {\r
- AsciiPrint("Write file error\n");\r
+ AsciiPrint("Write file error %r\n", Status);\r
goto Exit;\r
} \r
}\r
\r
Status = EfiRead(Source, Buffer, &Chunk);\r
if (EFI_ERROR(Status)) {\r
- AsciiPrint("Read file error\n");\r
+ AsciiPrint("Read file error %r\n", Status);\r
goto Exit;\r
}\r
\r
Status = EfiWrite(Destination, Buffer, &Chunk);\r
if (EFI_ERROR(Status)) {\r
- AsciiPrint("Write file error\n");\r
+ AsciiPrint("Write file error %r\n", Status);\r
goto Exit;\r
} \r
}\r
\r
+\r
Exit:\r
if (Source != NULL) {\r
Status = EfiClose(Source);\r
AsciiPrint("Source close error %r\n", Status);\r
}\r
}\r
- \r
if (Destination != NULL) {\r
Status = EfiClose(Destination);\r
if (EFI_ERROR(Status)) {\r