UINTN Index;\r
UINTN CurrentRow;\r
UINTN Max;\r
+ EFI_OPEN_FILE *File;\r
\r
CurrentRow = 0;\r
\r
// Need to call here to make sure Device Counts are valid\r
EblUpdateDeviceLists ();\r
\r
+ //\r
+ // Probe for media insertion/removal in removable media devices\r
+ //\r
+ Max = EfiGetDeviceCounts (EfiOpenBlockIo);\r
+ if (Max != 0) {\r
+ for (Index = 0; Index < Max; Index++) {\r
+ File = EfiDeviceOpenByType (EfiOpenBlockIo, Index);\r
+ if (File != NULL) {\r
+ if (File->FsBlockIoMedia->RemovableMedia) {\r
+ if (File->FsBlockIoMedia->MediaPresent) {\r
+ gBS->DisconnectController (File->EfiHandle, NULL, NULL);\r
+ }\r
+ gBS->ConnectController (File->EfiHandle, NULL, NULL, TRUE);\r
+ }\r
+ EfiClose (File);\r
+ }\r
+ }\r
+ }\r
+\r
+ // Now we can print out the info...\r
+\r
Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);\r
if (Max != 0) {\r
AsciiPrint ("Firmware Volume Devices:\n");\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