diff options
-rw-r--r-- | EmbeddedPkg/Ebl/Ebl.inf | 1 | ||||
-rw-r--r-- | EmbeddedPkg/Ebl/EfiDevice.c | 21 | ||||
-rw-r--r-- | EmbeddedPkg/Ebl/Main.c | 44 | ||||
-rw-r--r-- | EmbeddedPkg/EmbeddedPkg.dec | 4 |
4 files changed, 48 insertions, 22 deletions
diff --git a/EmbeddedPkg/Ebl/Ebl.inf b/EmbeddedPkg/Ebl/Ebl.inf index bd8b67e552..44bab64b07 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 354a6d7720..2f9a606726 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 6d536fd79c..98097e4be1 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 ();
+ }
}
}
diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 040b70c4bc..2712477059 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -65,6 +65,8 @@ gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE|BOOLEAN|0x00000005
gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE|BOOLEAN|0x00000006
gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|FALSE|BOOLEAN|0x00000041
+ gEmbeddedTokenSpaceGuid.PcdEmbeddedProbeRemovable|TRUE|BOOLEAN|0x00000050
+
gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|FALSE|BOOLEAN|0x0000001b
gEmbeddedTokenSpaceGuid.PcdCacheEnable|FALSE|BOOLEAN|0x00000042
gEmbeddedTokenSpaceGuid.PcdGdbSerial|FALSE|BOOLEAN|0x0000004d
@@ -74,7 +76,7 @@ gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|L""|VOID*|0x00000007
gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07|UINT32|0x00000008
gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000|UINT32|0x00000009
- gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"Ebl"|VOID*|0x00000034
+ gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"Ebl %a"|VOID*|0x00000034
gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|131072|UINT32|0x00000040
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0|UINT32|0x0000000b
|