diff options
author | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-07 16:45:48 +0000 |
---|---|---|
committer | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-07 16:45:48 +0000 |
commit | 208a8330d0029d4025f6f27f182d627bd9d7b38b (patch) | |
tree | 717006429da60ba911584996afe266f0f7353a2f /EmbeddedPkg | |
parent | 0caa7ad507205968dfada67d0c368e62209d03ee (diff) | |
download | edk2-208a8330d0029d4025f6f27f182d627bd9d7b38b.tar.gz edk2-208a8330d0029d4025f6f27f182d627bd9d7b38b.tar.bz2 edk2-208a8330d0029d4025f6f27f182d627bd9d7b38b.zip |
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
Diffstat (limited to 'EmbeddedPkg')
-rw-r--r-- | EmbeddedPkg/Ebl/EfiDevice.c | 13 | ||||
-rw-r--r-- | EmbeddedPkg/Include/Library/EfiFileLib.h | 1 | ||||
-rw-r--r-- | EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c | 10 |
3 files changed, 21 insertions, 3 deletions
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);
}
diff --git a/EmbeddedPkg/Include/Library/EfiFileLib.h b/EmbeddedPkg/Include/Library/EfiFileLib.h index 9d98b19000..9ec5246358 100644 --- a/EmbeddedPkg/Include/Library/EfiFileLib.h +++ b/EmbeddedPkg/Include/Library/EfiFileLib.h @@ -94,6 +94,7 @@ typedef struct { EFI_FILE_SYSTEM_INFO *FsInfo;
EFI_FILE_INFO *FsFileInfo;
EFI_BLOCK_IO_MEDIA *FsBlockIoMedia; // Information valid for Fs#: or B#:
+ EFI_BLOCK_IO_PROTOCOL *FsBlockIo; // Information valid for Fs#: or B#:
UINTN DiskOffset; // Information valid for B#:
diff --git a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c b/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c index 1db7d7d035..c93304d537 100644 --- a/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c +++ b/EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c @@ -409,6 +409,7 @@ EblFileDevicePath ( Status = gBS->HandleProtocol (File->EfiHandle, &gEfiBlockIoProtocolGuid, (VOID **)&BlkIo); if (!EFI_ERROR (Status)) { File->FsBlockIoMedia = BlkIo->Media; + File->FsBlockIo = BlkIo; // If we are not opening the device this will get over written with file info File->MaxPosition = MultU64x32 (BlkIo->Media->LastBlock + 1, BlkIo->Media->BlockSize); @@ -1732,6 +1733,15 @@ EfiSetCwd ( return EFI_INVALID_PARAMETER; } + AsciiStrCpy (gCwd, File->DeviceName); + if (File->FileName == NULL) { + AsciiStrCat (gCwd, ":\\"); + } else { + AsciiStrCat (gCwd, ":"); + AsciiStrCat (gCwd, File->FileName); + } + + EfiClose (File); if (Path != Cwd) { FreePool (Path); |