From 208a8330d0029d4025f6f27f182d627bd9d7b38b Mon Sep 17 00:00:00 2001 From: andrewfish Date: Fri, 7 May 2010 16:45:48 +0000 Subject: Fix svn check in bug that broke CWD. Update the connect disconnect support in device command to minimize operations. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10462 6f19259b-4bc3-4df7-8a09-765794883524 --- EmbeddedPkg/Ebl/EfiDevice.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'EmbeddedPkg/Ebl') diff --git a/EmbeddedPkg/Ebl/EfiDevice.c b/EmbeddedPkg/Ebl/EfiDevice.c index 70ba70383c..80dcfcb5cc 100644 --- a/EmbeddedPkg/Ebl/EfiDevice.c +++ b/EmbeddedPkg/Ebl/EfiDevice.c @@ -207,13 +207,14 @@ EblDeviceCmd ( IN CHAR8 **Argv ) { + EFI_STATUS Status; UINTN Index; UINTN CurrentRow; UINTN Max; EFI_OPEN_FILE *File; CurrentRow = 0; - + // Need to call here to make sure Device Counts are valid EblUpdateDeviceLists (); @@ -227,9 +228,15 @@ EblDeviceCmd ( if (File != NULL) { if (File->FsBlockIoMedia->RemovableMedia) { if (File->FsBlockIoMedia->MediaPresent) { - gBS->DisconnectController (File->EfiHandle, NULL, NULL); + // Probe to see if media is present + Status = File->FsBlockIo->ReadBlocks (File->FsBlockIo, File->FsBlockIo->Media->MediaId, (EFI_LBA)0, 0, NULL); + if (Status == EFI_NO_MEDIA) { + gBS->DisconnectController (File->EfiHandle, NULL, NULL); + } + } else { + // Probe for media insertion and connect partition and filesystem drivers if needed + gBS->ConnectController (File->EfiHandle, NULL, NULL, TRUE); } - gBS->ConnectController (File->EfiHandle, NULL, NULL, TRUE); } EfiClose (File); } -- cgit v1.2.3