+ AsciiPrint ("Please send feedback to edk2-devel@lists.sourceforge.net\n");\r
+}\r
+\r
+\r
+/**\r
+ Send null requests to all removable media block IO devices so the a media add/remove/change\r
+ can be detected in real before we execute a command. \r
+\r
+ This is mainly due to the fact that the FAT driver does not do this today so you can get stale \r
+ dir commands after an SD Card has been removed.\r
+**/\r
+VOID\r
+EblProbeRemovableMedia (\r
+ VOID\r
+ )\r
+{\r
+ UINTN Index;\r
+ UINTN Max;\r
+ EFI_OPEN_FILE *File;\r
+\r
+ //\r
+ // Probe for media insertion/removal in removable media devices\r
+ //\r
+ Max = EfiGetDeviceCounts (EfiOpenBlockIo);\r
+ if (Max != 0) {\r
+ for (Index = 0; Index < Max; Index++) {\r
+ File = EfiDeviceOpenByType (EfiOpenBlockIo, Index);\r
+ if (File != NULL) {\r
+ if (File->FsBlockIoMedia->RemovableMedia) {\r
+ // Probe to see if media is present (or not) or media changed\r
+ // this causes the ReinstallProtocolInterface() to fire in the\r
+ // block io driver to update the system about media change events\r
+ File->FsBlockIo->ReadBlocks (File->FsBlockIo, File->FsBlockIo->Media->MediaId, (EFI_LBA)0, 0, NULL);\r
+ }\r
+ EfiClose (File);\r
+ }\r
+ }\r
+ }\r