summaryrefslogtreecommitdiff
path: root/EmbeddedPkg/Ebl
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-04 16:29:32 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-04 16:29:32 +0000
commitf6381f4c3d338f9056b8af24d4e8b3f8e23ad64b (patch)
treedac391d3c307147b64ad5e6bfb1dd57e5dbb35c3 /EmbeddedPkg/Ebl
parent2a9fe5409d044948b2285ff4971ba64d26584b16 (diff)
Remove probe for removable media from FileLib, it was getting called way too much. Now it is in the EBL shell device command. Cleanup some spacing issues in the lib code.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10454 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg/Ebl')
-rw-r--r--EmbeddedPkg/Ebl/Ebl.h1
-rw-r--r--EmbeddedPkg/Ebl/EfiDevice.c34
2 files changed, 29 insertions, 6 deletions
diff --git a/EmbeddedPkg/Ebl/Ebl.h b/EmbeddedPkg/Ebl/Ebl.h
index b1931a47f..04f75d0f7 100644
--- a/EmbeddedPkg/Ebl/Ebl.h
+++ b/EmbeddedPkg/Ebl/Ebl.h
@@ -51,6 +51,7 @@
#include <Library/DevicePathLib.h>
#include <Library/UefiLib.h>
#include <Library/EblNetworkLib.h>
+#include <Library/TimerLib.h>
#include <IndustryStandard/Pci.h>
diff --git a/EmbeddedPkg/Ebl/EfiDevice.c b/EmbeddedPkg/Ebl/EfiDevice.c
index 9b08fda12..70ba70383 100644
--- a/EmbeddedPkg/Ebl/EfiDevice.c
+++ b/EmbeddedPkg/Ebl/EfiDevice.c
@@ -210,12 +210,34 @@ EblDeviceCmd (
UINTN Index;
UINTN CurrentRow;
UINTN Max;
+ EFI_OPEN_FILE *File;
CurrentRow = 0;
// Need to call here to make sure Device Counts are valid
EblUpdateDeviceLists ();
+ //
+ // Probe for media insertion/removal in removable media devices
+ //
+ Max = EfiGetDeviceCounts (EfiOpenBlockIo);
+ if (Max != 0) {
+ for (Index = 0; Index < Max; Index++) {
+ File = EfiDeviceOpenByType (EfiOpenBlockIo, Index);
+ if (File != NULL) {
+ if (File->FsBlockIoMedia->RemovableMedia) {
+ if (File->FsBlockIoMedia->MediaPresent) {
+ gBS->DisconnectController (File->EfiHandle, NULL, NULL);
+ }
+ gBS->ConnectController (File->EfiHandle, NULL, NULL, TRUE);
+ }
+ EfiClose (File);
+ }
+ }
+ }
+
+ // Now we can print out the info...
+
Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);
if (Max != 0) {
AsciiPrint ("Firmware Volume Devices:\n");
@@ -730,7 +752,7 @@ EblFileCopyCmd (
UINTN Size;
UINTN Offset;
UINTN Chunk = FILE_COPY_CHUNK;
-
+
if (Argc < 3) {
return EFI_INVALID_PARAMETER;
}
@@ -759,13 +781,13 @@ EblFileCopyCmd (
Status = EfiRead(Source, Buffer, &Chunk);
if (EFI_ERROR(Status)) {
- AsciiPrint("Read file error\n");
+ AsciiPrint("Read file error %r\n", Status);
goto Exit;
}
Status = EfiWrite(Destination, Buffer, &Chunk);
if (EFI_ERROR(Status)) {
- AsciiPrint("Write file error\n");
+ AsciiPrint("Write file error %r\n", Status);
goto Exit;
}
}
@@ -776,17 +798,18 @@ EblFileCopyCmd (
Status = EfiRead(Source, Buffer, &Chunk);
if (EFI_ERROR(Status)) {
- AsciiPrint("Read file error\n");
+ AsciiPrint("Read file error %r\n", Status);
goto Exit;
}
Status = EfiWrite(Destination, Buffer, &Chunk);
if (EFI_ERROR(Status)) {
- AsciiPrint("Write file error\n");
+ AsciiPrint("Write file error %r\n", Status);
goto Exit;
}
}
+
Exit:
if (Source != NULL) {
Status = EfiClose(Source);
@@ -794,7 +817,6 @@ Exit:
AsciiPrint("Source close error %r\n", Status);
}
}
-
if (Destination != NULL) {
Status = EfiClose(Destination);
if (EFI_ERROR(Status)) {