Index: FatPei/FatLiteApi.c
===================================================================
--- FatPei/FatLiteApi.c	(revision 93)
+++ FatPei/FatLiteApi.c	(working copy)
@@ -1,7 +1,7 @@
 /** @file
   FAT recovery PEIM entry point, Ppi Functions and FAT Api functions.
 
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the Software
@@ -157,7 +157,128 @@
   return EFI_SUCCESS;
 }
 
+/**
+  Discover all the block I/O 2 devices to find the FAT volume.
 
+  @param  PrivateData             Global memory map for accessing global
+                                  variables.
+
+  @retval EFI_SUCCESS             The function completed successfully.
+
+**/
+EFI_STATUS
+UpdateBlocksAndVolumes2 (
+  IN OUT PEI_FAT_PRIVATE_DATA            *PrivateData
+  )
+{
+  EFI_STATUS                     Status;
+  EFI_PEI_PPI_DESCRIPTOR         *TempPpiDescriptor;
+  UINTN                          BlockIoPpiInstance;
+  EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi;
+  UINTN                          NumberBlockDevices;
+  UINTN                          Index;
+  EFI_PEI_BLOCK_IO2_MEDIA        Media;
+  PEI_FAT_VOLUME                 Volume;
+  EFI_PEI_SERVICES               **PeiServices;
+
+  PeiServices = (EFI_PEI_SERVICES **) GetPeiServicesTablePointer ();
+
+  //
+  // Clean up caches
+  //
+  for (Index = 0; Index < PEI_FAT_CACHE_SIZE; Index++) {
+    PrivateData->CacheBuffer[Index].Valid = FALSE;
+  }
+
+  PrivateData->BlockDeviceCount = 0;
+
+  //
+  // Find out all Block Io Ppi instances within the system
+  // Assuming all device Block Io Peims are dispatched already
+  //
+  for (BlockIoPpiInstance = 0; BlockIoPpiInstance < PEI_FAT_MAX_BLOCK_IO_PPI; BlockIoPpiInstance++) {
+    Status = PeiServicesLocatePpi (
+              &gEfiPeiVirtualBlockIo2PpiGuid,
+              BlockIoPpiInstance,
+              &TempPpiDescriptor,
+              (VOID **) &BlockIo2Ppi
+              );
+    if (EFI_ERROR (Status)) {
+      //
+      // Done with all Block Io Ppis
+      //
+      break;
+    }
+
+    Status = BlockIo2Ppi->GetNumberOfBlockDevices (
+                            PeiServices,
+                            BlockIo2Ppi,
+                            &NumberBlockDevices
+                            );
+    if (EFI_ERROR (Status)) {
+      continue;
+    }
+
+    for (Index = 1; Index <= NumberBlockDevices && PrivateData->BlockDeviceCount < PEI_FAT_MAX_BLOCK_DEVICE; Index++) {
+
+      Status = BlockIo2Ppi->GetBlockDeviceMediaInfo (
+                              PeiServices,
+                              BlockIo2Ppi,
+                              Index,
+                              &Media
+                              );
+      if (EFI_ERROR (Status) || !Media.MediaPresent) {
+        continue;
+      }
+
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].BlockSize = (UINT32) Media.BlockSize;
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].LastBlock = Media.LastBlock;
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].IoAlign   = 0;
+      //
+      // Not used here
+      //
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].Logical           = FALSE;
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].PartitionChecked  = FALSE;
+
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].BlockIo2          = BlockIo2Ppi;
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].PhysicalDevNo     = (UINT8) Index;
+      PrivateData->BlockDevice[PrivateData->BlockDeviceCount].InterfaceType     = Media.InterfaceType;
+
+      PrivateData->BlockDeviceCount++;
+    }
+  }
+  //
+  // Find out all logical devices
+  //
+  FatFindPartitions (PrivateData);
+
+  //
+  // Build up file system volume array
+  //
+  PrivateData->VolumeCount = 0;
+  for (Index = 0; Index < PrivateData->BlockDeviceCount; Index++) {
+    Volume.BlockDeviceNo  = Index;
+    Status                = FatGetBpbInfo (PrivateData, &Volume);
+    if (Status == EFI_SUCCESS) {
+      //
+      // Add the detected volume to the volume array
+      //
+      CopyMem (
+        (UINT8 *) &(PrivateData->Volume[PrivateData->VolumeCount]),
+        (UINT8 *) &Volume,
+        sizeof (PEI_FAT_VOLUME)
+        );
+      PrivateData->VolumeCount += 1;
+      if (PrivateData->VolumeCount >= PEI_FAT_MAX_VOLUME) {
+        break;
+      }
+    }
+  }
+
+  return EFI_SUCCESS;
+}
+
+
 /**
   BlockIo installation notification function. Find out all the current BlockIO
   PPIs in the system and add them into private data. Assume there is
@@ -180,8 +301,11 @@
   IN VOID                       *Ppi
   )
 {
-  UpdateBlocksAndVolumes (mPrivateData);
-
+  if (CompareGuid (NotifyDescriptor->Guid, &gEfiPeiVirtualBlockIo2PpiGuid)) {
+    UpdateBlocksAndVolumes2 (mPrivateData);
+  } else {
+    UpdateBlocksAndVolumes (mPrivateData);
+  }
   return EFI_SUCCESS;
 }
 
@@ -254,6 +378,7 @@
   //
   PrivateData->BlockDeviceCount = 0;
 
+  UpdateBlocksAndVolumes2 (PrivateData);
   UpdateBlocksAndVolumes (PrivateData);
 
   //
@@ -266,11 +391,17 @@
   //
   PrivateData->NotifyDescriptor.Flags =
     (
+      EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
+    );
+  PrivateData->NotifyDescriptor.Guid    = &gEfiPeiVirtualBlockIoPpiGuid;
+  PrivateData->NotifyDescriptor.Notify  = BlockIoNotifyEntry;
+  PrivateData->NotifyDescriptor2.Flags  =
+    (
       EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
       EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
     );
-  PrivateData->NotifyDescriptor.Guid    = &gEfiPeiVirtualBlockIoPpiGuid;
-  PrivateData->NotifyDescriptor.Notify  = BlockIoNotifyEntry;
+  PrivateData->NotifyDescriptor2.Guid    = &gEfiPeiVirtualBlockIo2PpiGuid;
+  PrivateData->NotifyDescriptor2.Notify  = BlockIoNotifyEntry;
   return PeiServicesNotifyPpi (&PrivateData->NotifyDescriptor);
 }
 
@@ -424,22 +555,38 @@
       // Fill in the Capsule Type GUID according to the block device type
       //
       if (BlockDeviceNo < PrivateData->BlockDeviceCount) {
-        switch (PrivateData->BlockDevice[BlockDeviceNo].DevType) {
-        case LegacyFloppy:
-          CopyGuid (CapsuleType, &gRecoveryOnFatFloppyDiskGuid);
-          break;
+        if (PrivateData->BlockDevice[BlockDeviceNo].BlockIo2 != NULL) {
+          switch (PrivateData->BlockDevice[BlockDeviceNo].InterfaceType) {
+          case MSG_ATAPI_DP:
+            CopyGuid (CapsuleType, &gRecoveryOnFatIdeDiskGuid);
+            break;
 
-        case IdeCDROM:
-        case IdeLS120:
-          CopyGuid (CapsuleType, &gRecoveryOnFatIdeDiskGuid);
-          break;
+          case MSG_USB_DP:
+            CopyGuid (CapsuleType, &gRecoveryOnFatUsbDiskGuid);
+            break;
 
-        case UsbMassStorage:
-          CopyGuid (CapsuleType, &gRecoveryOnFatUsbDiskGuid);
-          break;
+          default:
+            break;
+          }
+        }
+        if (PrivateData->BlockDevice[BlockDeviceNo].BlockIo != NULL) {
+          switch (PrivateData->BlockDevice[BlockDeviceNo].DevType) {
+          case LegacyFloppy:
+            CopyGuid (CapsuleType, &gRecoveryOnFatFloppyDiskGuid);
+            break;
 
-        default:
-          break;
+          case IdeCDROM:
+          case IdeLS120:
+            CopyGuid (CapsuleType, &gRecoveryOnFatIdeDiskGuid);
+            break;
+
+          case UsbMassStorage:
+            CopyGuid (CapsuleType, &gRecoveryOnFatUsbDiskGuid);
+            break;
+
+          default:
+            break;
+          }
         }
       }
 
Index: FatPei/FatLiteLib.c
===================================================================
--- FatPei/FatLiteLib.c	(revision 93)
+++ FatPei/FatLiteLib.c	(working copy)
@@ -1,7 +1,7 @@
 /** @file
   General purpose supporting routines for FAT recovery PEIM
 
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the Software
@@ -83,7 +83,17 @@
     // Status = BlockDev->ReadFunc
     //  (PrivateData->PeiServices, BlockDev->PhysicalDevNo, Lba, BufferSize, Buffer);
     //
-    Status = BlockDev->BlockIo->ReadBlocks (
+    if (BlockDev->BlockIo2 != NULL) {
+      Status = BlockDev->BlockIo2->ReadBlocks (
+                                    (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
+                                    BlockDev->BlockIo2,
+                                    BlockDev->PhysicalDevNo,
+                                    Lba,
+                                    BufferSize,
+                                    Buffer
+                                    );
+    } else {
+      Status = BlockDev->BlockIo->ReadBlocks (
                                   (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
                                   BlockDev->BlockIo,
                                   BlockDev->PhysicalDevNo,
@@ -91,6 +101,7 @@
                                   BufferSize,
                                   Buffer
                                   );
+    }
 
   } else {
     Status = FatReadDisk (
Index: FatPei/FatLitePeim.h
===================================================================
--- FatPei/FatLitePeim.h	(revision 93)
+++ FatPei/FatLitePeim.h	(working copy)
@@ -1,7 +1,7 @@
 /** @file
   Data structures for FAT recovery PEIM
 
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the Software
@@ -16,6 +16,7 @@
 
 #include <Guid/RecoveryDevice.h>
 #include <Ppi/BlockIo.h>
+#include <Ppi/BlockIo2.h>
 #include <Ppi/DeviceRecoveryModule.h>
 
 #include <Library/DebugLib.h>
@@ -69,11 +70,13 @@
   // Following fields only valid for physical device
   //
   EFI_PEI_BLOCK_DEVICE_TYPE     DevType;
+  UINT8                         InterfaceType;
   //
   // EFI_PEI_READ_BLOCKS         ReadFunc;
   //
-  EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIo;
-  UINT8                         PhysicalDevNo;
+  EFI_PEI_RECOVERY_BLOCK_IO_PPI  *BlockIo;
+  EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2;
+  UINT8                          PhysicalDevNo;
 } PEI_FAT_BLOCK_DEVICE;
 
 //
@@ -147,6 +150,7 @@
   EFI_PEI_DEVICE_RECOVERY_MODULE_PPI  DeviceRecoveryPpi;
   EFI_PEI_PPI_DESCRIPTOR              PpiDescriptor;
   EFI_PEI_NOTIFY_DESCRIPTOR           NotifyDescriptor;
+  EFI_PEI_NOTIFY_DESCRIPTOR           NotifyDescriptor2;
 
   UINT8                               UnicodeCaseMap[0x300];
   CHAR8                               *EngUpperMap;
Index: FatPei/FatPei.inf
===================================================================
--- FatPei/FatPei.inf	(revision 93)
+++ FatPei/FatPei.inf	(working copy)
@@ -1,7 +1,7 @@
 ## @file
 #    Lite Fat driver only used in Pei Phase.
 #
-#  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions are
@@ -89,12 +89,12 @@
 
 [Ppis]
   gEfiPeiVirtualBlockIoPpiGuid                  # PPI_NOTIFY SOMETIMES_CONSUMED
+  gEfiPeiVirtualBlockIo2PpiGuid                 # PPI_NOTIFY SOMETIMES_CONSUMED
   gEfiPeiDeviceRecoveryModulePpiGuid            # SOMETIMES_PRODUCED
 
 
 [FeaturePcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport	         ## CONSUMES
-  
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport         ## CONSUMES
 
 [Depex]
   gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiBootInRecoveryModePpiGuid
