diff options
author | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-11 00:09:48 +0000 |
---|---|---|
committer | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-11 00:09:48 +0000 |
commit | 884366cf56a53f3e54c19790e60c9eb788706e1c (patch) | |
tree | 0424d702ca6dc05597b9971aa601381d2b750aa1 /EmbeddedPkg/Ebl | |
parent | 9f6b977f6619950438ac3b765904b7a3ff454baa (diff) | |
download | edk2-884366cf56a53f3e54c19790e60c9eb788706e1c.zip edk2-884366cf56a53f3e54c19790e60c9eb788706e1c.tar.gz edk2-884366cf56a53f3e54c19790e60c9eb788706e1c.tar.bz2 |
Added a PCD to turn on/off probing Block IO devices to detect add/remove/change. FAT driver does not do this so if the shell does not do this you will get dir hits on an SD Card that has been removed. Default is ON. I moved this feature from device command to main command loop so it gets done after you type return before your command is processed.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10479 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg/Ebl')
-rw-r--r-- | EmbeddedPkg/Ebl/Ebl.inf | 1 | ||||
-rw-r--r-- | EmbeddedPkg/Ebl/EfiDevice.c | 21 | ||||
-rw-r--r-- | EmbeddedPkg/Ebl/Main.c | 44 |
3 files changed, 45 insertions, 21 deletions
diff --git a/EmbeddedPkg/Ebl/Ebl.inf b/EmbeddedPkg/Ebl/Ebl.inf index bd8b67e..44bab64 100644 --- a/EmbeddedPkg/Ebl/Ebl.inf +++ b/EmbeddedPkg/Ebl/Ebl.inf @@ -99,6 +99,7 @@ gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable
gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd
gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd
+ gEmbeddedTokenSpaceGuid.PcdEmbeddedProbeRemovable
[FixedPcd.common]
gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand
diff --git a/EmbeddedPkg/Ebl/EfiDevice.c b/EmbeddedPkg/Ebl/EfiDevice.c index 354a6d7..2f9a606 100644 --- a/EmbeddedPkg/Ebl/EfiDevice.c +++ b/EmbeddedPkg/Ebl/EfiDevice.c @@ -210,34 +210,13 @@ 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) {
- // Probe to see if media is present (or not) or media changed
- // this causes the ReinstallProtocolInterface() to fire in the
- // block io driver to update the system about media change events
- File->FsBlockIo->ReadBlocks (File->FsBlockIo, File->FsBlockIo->Media->MediaId, (EFI_LBA)0, 0, NULL);
- }
- EfiClose (File);
- }
- }
- }
-
// Now we can print out the info...
-
Max = EfiGetDeviceCounts (EfiOpenFirmwareVolume);
if (Max != 0) {
AsciiPrint ("Firmware Volume Devices:\n");
diff --git a/EmbeddedPkg/Ebl/Main.c b/EmbeddedPkg/Ebl/Main.c index 6d536fd..98097e4 100644 --- a/EmbeddedPkg/Ebl/Main.c +++ b/EmbeddedPkg/Ebl/Main.c @@ -456,6 +456,45 @@ EblPrintStartupBanner ( /**
+ Send null requests to all removable media block IO devices so the a media add/remove/change
+ can be detected in real before we execute a command.
+
+ This is mainly due to the fact that the FAT driver does not do this today so you can get stale
+ dir commands after an SD Card has been removed.
+**/
+VOID
+EblProbeRemovableMedia (
+ VOID
+ )
+{
+ UINTN Index;
+ UINTN Max;
+ EFI_OPEN_FILE *File;
+
+ //
+ // 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) {
+ // Probe to see if media is present (or not) or media changed
+ // this causes the ReinstallProtocolInterface() to fire in the
+ // block io driver to update the system about media change events
+ File->FsBlockIo->ReadBlocks (File->FsBlockIo, File->FsBlockIo->Media->MediaId, (EFI_LBA)0, 0, NULL);
+ }
+ EfiClose (File);
+ }
+ }
+ }
+}
+
+
+
+
+/**
Print the prompt for the EBL.
**/
VOID
@@ -611,6 +650,11 @@ EdkBootLoaderEntry ( EblPrompt ();
GetCmd (CmdLine, MAX_CMD_LINE);
SetCmdHistory (CmdLine);
+
+ if (FeaturePcdGet (PcdEmbeddedProbeRemovable)) {
+ // Probe removable media devices to see if media has been inserted or removed.
+ EblProbeRemovableMedia ();
+ }
}
}
|