Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/VBoxHfs.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/VBoxHfs.inf	(revision 42740)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/VBoxHfs.inf	(revision 42741)
@@ -36,4 +36,5 @@
 [Packages]
         MdePkg/MdePkg.dec
+        MdeModulePkg/MdeModulePkg.dec
         IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
         VBoxPkg/VBoxPkg.dec
@@ -49,4 +50,5 @@
    DebugLib
    PcdLib
+   DevicePathLib
 
 [Guids]
@@ -61,4 +63,5 @@
   gEfiUnicodeCollationProtocolGuid
   gEfiUnicodeCollation2ProtocolGuid
+  gEfiDevicePathToTextProtocolGuid                ## CONSUMED
 
 [Pcd]
@@ -67,5 +70,5 @@
 
 [BuildOptions.common]
-  GCC:*_*_*_CC_FLAGS = -DFSTYPE=hfs
+  GCC:*_*_*_CC_FLAGS = -DFSTYPE=hfs -DEFI_LOG_ENABLED=1
 # -DFSW_DEBUG_LEVEL=3
   INTEL:*_*_*_CC_FLAGS = -DFSTYPE=hfs
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/VBoxIso9660.inf
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/VBoxIso9660.inf	(revision 42740)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/VBoxIso9660.inf	(revision 42741)
@@ -34,4 +34,5 @@
 [Packages]
         MdePkg/MdePkg.dec
+        MdeModulePkg/MdeModulePkg.dec
         IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
         VBoxPkg/VBoxPkg.dec
@@ -47,4 +48,5 @@
    DebugLib
    PcdLib
+   DevicePathLib
 
 [Guids]
@@ -60,4 +62,5 @@
   gEfiUnicodeCollationProtocolGuid
   gEfiUnicodeCollation2ProtocolGuid
+  gEfiDevicePathToTextProtocolGuid                ## CONSUMED
 
 [Pcd]
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_core.h
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_core.h	(revision 42740)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_core.h	(revision 42741)
@@ -72,5 +72,5 @@
 
 /** Indicates that the block cache entry is empty. */
-#define FSW_INVALID_BNO (~0UL)
+#define FSW_INVALID_BNO (~0U)
 
 
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_efi.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_efi.c	(revision 42740)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_efi.c	(revision 42741)
@@ -67,4 +67,5 @@
 #define FSW_EFI_DRIVER_NAME(t) L"Fsw " FSW_EFI_STRINGIFY(t) L" File System Driver"
 
+
 // function prototypes
 
@@ -222,4 +223,7 @@
 
     // first, open DiskIO
+    LogFlowFuncEnter();
+    LogFlowFuncMarkDP(RemainingDevicePath);
+
     Status = BS->OpenProtocol(ControllerHandle,
                               &PROTO_NAME(DiskIoProtocol),
@@ -227,7 +231,10 @@
                               This->DriverBindingHandle,
                               ControllerHandle,
-                              EFI_OPEN_PROTOCOL_BY_DRIVER);
+                              EFI_OPEN_PROTOCOL_GET_PROTOCOL);
     if (EFI_ERROR(Status))
-        return Status;
+    {
+        LogFlowFuncLeaveRC(Status);
+        return Status;
+    }
 
     // we were just checking, close it again
@@ -244,4 +251,38 @@
                               ControllerHandle,
                               EFI_OPEN_PROTOCOL_TEST_PROTOCOL);
+    LogFlowFuncLeaveRC(Status);
+    return Status;
+}
+
+static EFI_STATUS fsw_efi_ReMount(IN FSW_VOLUME_DATA *pVolume,
+                                       IN EFI_HANDLE      ControllerHandle,
+                                       EFI_DISK_IO        *pDiskIo,
+                                       EFI_BLOCK_IO       *pBlockIo)
+{
+    EFI_STATUS Status;
+    LogFlowFuncEnter();
+    pVolume->Signature       = FSW_VOLUME_DATA_SIGNATURE;
+    pVolume->Handle          = ControllerHandle;
+    pVolume->DiskIo          = pDiskIo;
+    pVolume->MediaId         = pBlockIo->Media->MediaId;
+    pVolume->LastIOStatus    = EFI_SUCCESS;
+
+    // mount the filesystem
+    Status = fsw_efi_map_status(fsw_mount(pVolume, &fsw_efi_host_table,
+                                          &FSW_FSTYPE_TABLE_NAME(FSTYPE), &pVolume->vol),
+                                pVolume);
+
+    LogFlowFuncMarkVar(Status, "%r");
+    if (!EFI_ERROR(Status)) {
+        // register the SimpleFileSystem protocol
+        pVolume->FileSystem.Revision     = EFI_FILE_IO_INTERFACE_REVISION;
+        pVolume->FileSystem.OpenVolume   = fsw_efi_FileSystem_OpenVolume;
+        Status = BS->InstallMultipleProtocolInterfaces(&ControllerHandle,
+                                                       &PROTO_NAME(SimpleFileSystemProtocol), &pVolume->FileSystem,
+                                                       NULL);
+        if (EFI_ERROR(Status))
+            Print(L"Fsw ERROR: InstallMultipleProtocolInterfaces returned %x\n", Status);
+    }
+    LogFlowFuncLeaveRC(Status);
     return Status;
 }
@@ -269,8 +310,5 @@
     FSW_VOLUME_DATA     *Volume;
 
-#if DEBUG_LEVEL
-    Print(L"fsw_efi_DriverBinding_Start\n");
-#endif
-
+    LogFlowFuncEnter();
     // open consumed protocols
     Status = BS->OpenProtocol(ControllerHandle,
@@ -281,5 +319,5 @@
                               EFI_OPEN_PROTOCOL_GET_PROTOCOL);   // NOTE: we only want to look at the MediaId
     if (EFI_ERROR(Status)) {
-        Print(L"Fsw ERROR: OpenProtocol(BlockIo) returned %x\n", Status);
+        LogFlowFuncLeaveRC(Status);
         return Status;
     }
@@ -292,5 +330,5 @@
                               EFI_OPEN_PROTOCOL_BY_DRIVER);
     if (EFI_ERROR(Status)) {
-        Print(L"Fsw ERROR: OpenProtocol(DiskIo) returned %x\n", Status);
+        LogFlowFuncLeaveRC(Status);
         return Status;
     }
@@ -298,25 +336,5 @@
     // allocate volume structure
     Volume = AllocateZeroPool(sizeof(FSW_VOLUME_DATA));
-    Volume->Signature       = FSW_VOLUME_DATA_SIGNATURE;
-    Volume->Handle          = ControllerHandle;
-    Volume->DiskIo          = DiskIo;
-    Volume->MediaId         = BlockIo->Media->MediaId;
-    Volume->LastIOStatus    = EFI_SUCCESS;
-
-    // mount the filesystem
-    Status = fsw_efi_map_status(fsw_mount(Volume, &fsw_efi_host_table,
-                                          &FSW_FSTYPE_TABLE_NAME(FSTYPE), &Volume->vol),
-                                Volume);
-
-    if (!EFI_ERROR(Status)) {
-        // register the SimpleFileSystem protocol
-        Volume->FileSystem.Revision     = EFI_FILE_IO_INTERFACE_REVISION;
-        Volume->FileSystem.OpenVolume   = fsw_efi_FileSystem_OpenVolume;
-        Status = BS->InstallMultipleProtocolInterfaces(&ControllerHandle,
-                                                       &PROTO_NAME(SimpleFileSystemProtocol), &Volume->FileSystem,
-                                                       NULL);
-        if (EFI_ERROR(Status))
-            Print(L"Fsw ERROR: InstallMultipleProtocolInterfaces returned %x\n", Status);
-    }
+    Status = fsw_efi_ReMount(Volume, ControllerHandle, DiskIo, BlockIo);
 
     // on errors, close the opened protocols
@@ -326,10 +344,16 @@
         FreePool(Volume);
 
-        BS->CloseProtocol(ControllerHandle,
-                          &PROTO_NAME(DiskIoProtocol),
-                          This->DriverBindingHandle,
-                          ControllerHandle);
-    }
-
+#if 0
+        if (Status == EFI_MEDIA_CHANGED)
+            Status = fsw_efi_ReMount(Volume, ControllerHandle, DiskIo, BlockIo);
+        else
+#endif
+            BS->CloseProtocol(ControllerHandle,
+                              &PROTO_NAME(DiskIoProtocol),
+                              This->DriverBindingHandle,
+                              ControllerHandle);
+    }
+
+    LogFlowFuncLeaveRC(Status);
     return Status;
 }
Index: trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_iso9660.c
===================================================================
--- trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_iso9660.c	(revision 42740)
+++ trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_iso9660.c	(revision 42741)
@@ -88,5 +88,4 @@
 static fsw_status_t rr_find_nm(struct fsw_iso9660_volume *vol, struct iso9660_dirrec *dirrec, int off, struct fsw_string *str);
 static fsw_status_t rr_read_ce(struct fsw_iso9660_volume *vol, union fsw_rock_ridge_susp_ce *ce, fsw_u8 *begin);
-static void dump_dirrec(struct iso9660_dirrec *dirrec);
 //
 // Dispatch Table
@@ -226,25 +225,8 @@
 {
     int rc;
-    int i;
-    fsw_u8 *r = begin + ISOINT(ce->X.offset);
-    int len = ISOINT(ce->X.len);
     rc = vol->g.host_table->read_block(&vol->g, ISOINT(ce->X.block_loc), begin);
     if (rc != FSW_SUCCESS)
         return rc;
-    for (i = 0; i < len; ++i)
-    {
-        DEBUG((DEBUG_INFO, "%d: (%d:%x)%c ", i, r[i], r[i], r[i]));
-    }
-    return FSW_SUCCESS;
-}
-static void dump_dirrec(struct iso9660_dirrec *dirrec)
-{
-    int i;
-    fsw_u8 *r = (fsw_u8 *)dirrec + dirrec->file_identifier_length;
-    int len = dirrec->dirrec_length;
-    for (i = dirrec->file_identifier_length; i < len; ++i)
-    {
-        DEBUG((DEBUG_INFO, "%d: (%d:%x)%c ", i, r[i], r[i], r[i]));
-    }
+    return FSW_SUCCESS;
 }
 /**
@@ -624,5 +606,4 @@
         return FSW_VOLUME_CORRUPTED;
 
-     dump_dirrec(dirrec);
      if (vol->fRockRidge)
      {
