MdeModulePkg/CdExpressPei: Add RecoveryBlockIo2Ppi support

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17481 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Feng Tian 2015-05-20 06:32:03 +00:00 committed by erictian
parent 3fe5862f00
commit f9964c8019
3 changed files with 173 additions and 66 deletions

View File

@ -5,7 +5,7 @@
# finds whether there is Recovery data in the device. If it finds recovery # finds whether there is Recovery data in the device. If it finds recovery
# data, it will install Device Recovery Module PPI. # data, it will install Device Recovery Module PPI.
# #
# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions # are licensed and made available under the terms and conditions
@ -60,6 +60,9 @@
## NOTIFY ## NOTIFY
## CONSUMES ## CONSUMES
gEfiPeiVirtualBlockIoPpiGuid gEfiPeiVirtualBlockIoPpiGuid
## NOTIFY
## CONSUMES
gEfiPeiVirtualBlockIo2PpiGuid
gEfiPeiDeviceRecoveryModulePpiGuid ## PRODUCES gEfiPeiDeviceRecoveryModulePpiGuid ## PRODUCES
[FeaturePcd] [FeaturePcd]

View File

@ -1,7 +1,7 @@
/** @file /** @file
Source file for CD recovery PEIM Source file for CD recovery PEIM
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions are licensed and made available under the terms and conditions
@ -60,7 +60,8 @@ CdExpressPeimEntry (
} }
PrivateData->CapsuleCount = 0; PrivateData->CapsuleCount = 0;
Status = UpdateBlocksAndVolumes (PrivateData); Status = UpdateBlocksAndVolumes (PrivateData, TRUE);
Status = UpdateBlocksAndVolumes (PrivateData, FALSE);
// //
// Installs Ppi // Installs Ppi
@ -69,9 +70,9 @@ CdExpressPeimEntry (
PrivateData->DeviceRecoveryPpi.GetRecoveryCapsuleInfo = GetRecoveryCapsuleInfo; PrivateData->DeviceRecoveryPpi.GetRecoveryCapsuleInfo = GetRecoveryCapsuleInfo;
PrivateData->DeviceRecoveryPpi.LoadRecoveryCapsule = LoadRecoveryCapsule; PrivateData->DeviceRecoveryPpi.LoadRecoveryCapsule = LoadRecoveryCapsule;
PrivateData->PpiDescriptor.Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST); PrivateData->PpiDescriptor.Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
PrivateData->PpiDescriptor.Guid = &gEfiPeiDeviceRecoveryModulePpiGuid; PrivateData->PpiDescriptor.Guid = &gEfiPeiDeviceRecoveryModulePpiGuid;
PrivateData->PpiDescriptor.Ppi = &PrivateData->DeviceRecoveryPpi; PrivateData->PpiDescriptor.Ppi = &PrivateData->DeviceRecoveryPpi;
Status = PeiServicesInstallPpi (&PrivateData->PpiDescriptor); Status = PeiServicesInstallPpi (&PrivateData->PpiDescriptor);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -87,11 +88,19 @@ CdExpressPeimEntry (
// //
PrivateData->NotifyDescriptor.Flags = PrivateData->NotifyDescriptor.Flags =
( (
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
); );
PrivateData->NotifyDescriptor.Guid = &gEfiPeiVirtualBlockIoPpiGuid; PrivateData->NotifyDescriptor.Guid = &gEfiPeiVirtualBlockIoPpiGuid;
PrivateData->NotifyDescriptor.Notify = BlockIoNotifyEntry; PrivateData->NotifyDescriptor.Notify = BlockIoNotifyEntry;
PrivateData->NotifyDescriptor2.Flags =
(
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
);
PrivateData->NotifyDescriptor2.Guid = &gEfiPeiVirtualBlockIo2PpiGuid;
PrivateData->NotifyDescriptor2.Notify = BlockIoNotifyEntry;
return PeiServicesNotifyPpi (&PrivateData->NotifyDescriptor); return PeiServicesNotifyPpi (&PrivateData->NotifyDescriptor);
} }
@ -117,7 +126,11 @@ BlockIoNotifyEntry (
IN VOID *Ppi IN VOID *Ppi
) )
{ {
UpdateBlocksAndVolumes (mPrivateData); if (CompareGuid (NotifyDescriptor->Guid, &gEfiPeiVirtualBlockIo2PpiGuid)) {
UpdateBlocksAndVolumes (mPrivateData, TRUE);
} else {
UpdateBlocksAndVolumes (mPrivateData, FALSE);
}
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -126,22 +139,26 @@ BlockIoNotifyEntry (
Finds out all the current Block IO PPIs in the system and add them into private data. Finds out all the current Block IO PPIs in the system and add them into private data.
@param PrivateData The private data structure that contains recovery module information. @param PrivateData The private data structure that contains recovery module information.
@param BlockIo2 Boolean to show whether using BlockIo2 or BlockIo.
@retval EFI_SUCCESS The blocks and volumes are updated successfully. @retval EFI_SUCCESS The blocks and volumes are updated successfully.
**/ **/
EFI_STATUS EFI_STATUS
UpdateBlocksAndVolumes ( UpdateBlocksAndVolumes (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN BOOLEAN BlockIo2
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_PEI_PPI_DESCRIPTOR *TempPpiDescriptor; EFI_PEI_PPI_DESCRIPTOR *TempPpiDescriptor;
UINTN BlockIoPpiInstance; UINTN BlockIoPpiInstance;
EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi; EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi;
EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi;
UINTN NumberBlockDevices; UINTN NumberBlockDevices;
UINTN IndexBlockDevice; UINTN IndexBlockDevice;
EFI_PEI_BLOCK_IO_MEDIA Media; EFI_PEI_BLOCK_IO_MEDIA Media;
EFI_PEI_BLOCK_IO2_MEDIA Media2;
EFI_PEI_SERVICES **PeiServices; EFI_PEI_SERVICES **PeiServices;
IndexBlockDevice = 0; IndexBlockDevice = 0;
@ -150,12 +167,21 @@ UpdateBlocksAndVolumes (
// Assuming all device Block Io Peims are dispatched already // Assuming all device Block Io Peims are dispatched already
// //
for (BlockIoPpiInstance = 0; BlockIoPpiInstance < PEI_CD_EXPRESS_MAX_BLOCK_IO_PPI; BlockIoPpiInstance++) { for (BlockIoPpiInstance = 0; BlockIoPpiInstance < PEI_CD_EXPRESS_MAX_BLOCK_IO_PPI; BlockIoPpiInstance++) {
Status = PeiServicesLocatePpi ( if (BlockIo2) {
&gEfiPeiVirtualBlockIoPpiGuid, Status = PeiServicesLocatePpi (
BlockIoPpiInstance, &gEfiPeiVirtualBlockIo2PpiGuid,
&TempPpiDescriptor, BlockIoPpiInstance,
(VOID **) &BlockIoPpi &TempPpiDescriptor,
); (VOID **) &BlockIo2Ppi
);
} else {
Status = PeiServicesLocatePpi (
&gEfiPeiVirtualBlockIoPpiGuid,
BlockIoPpiInstance,
&TempPpiDescriptor,
(VOID **) &BlockIoPpi
);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
// //
// Done with all Block Io Ppis // Done with all Block Io Ppis
@ -164,11 +190,19 @@ UpdateBlocksAndVolumes (
} }
PeiServices = (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (); PeiServices = (EFI_PEI_SERVICES **) GetPeiServicesTablePointer ();
Status = BlockIoPpi->GetNumberOfBlockDevices ( if (BlockIo2) {
PeiServices, Status = BlockIo2Ppi->GetNumberOfBlockDevices (
BlockIoPpi, PeiServices,
&NumberBlockDevices BlockIo2Ppi,
); &NumberBlockDevices
);
} else {
Status = BlockIoPpi->GetNumberOfBlockDevices (
PeiServices,
BlockIoPpi,
&NumberBlockDevices
);
}
if (EFI_ERROR (Status) || (NumberBlockDevices == 0)) { if (EFI_ERROR (Status) || (NumberBlockDevices == 0)) {
continue; continue;
} }
@ -176,28 +210,51 @@ UpdateBlocksAndVolumes (
// Just retrieve the first block, should emulate all blocks. // Just retrieve the first block, should emulate all blocks.
// //
for (IndexBlockDevice = 1; IndexBlockDevice <= NumberBlockDevices && PrivateData->CapsuleCount < PEI_CD_EXPRESS_MAX_CAPSULE_NUMBER; IndexBlockDevice ++) { for (IndexBlockDevice = 1; IndexBlockDevice <= NumberBlockDevices && PrivateData->CapsuleCount < PEI_CD_EXPRESS_MAX_CAPSULE_NUMBER; IndexBlockDevice ++) {
Status = BlockIoPpi->GetBlockDeviceMediaInfo ( if (BlockIo2) {
PeiServices, Status = BlockIo2Ppi->GetBlockDeviceMediaInfo (
BlockIoPpi, PeiServices,
IndexBlockDevice, BlockIo2Ppi,
&Media IndexBlockDevice,
); &Media2
if (EFI_ERROR (Status) || );
!Media.MediaPresent || if (EFI_ERROR (Status) ||
((Media.DeviceType != IdeCDROM) && (Media.DeviceType != UsbMassStorage)) || !Media2.MediaPresent ||
(Media.BlockSize != PEI_CD_BLOCK_SIZE) ((Media2.InterfaceType != MSG_ATAPI_DP) && (Media2.InterfaceType != MSG_USB_DP)) ||
) { (Media2.BlockSize != PEI_CD_BLOCK_SIZE)
continue; ) {
continue;
}
DEBUG ((EFI_D_INFO, "PeiCdExpress InterfaceType is %d\n", Media2.InterfaceType));
DEBUG ((EFI_D_INFO, "PeiCdExpress MediaPresent is %d\n", Media2.MediaPresent));
DEBUG ((EFI_D_INFO, "PeiCdExpress BlockSize is 0x%x\n", Media2.BlockSize));
} else {
Status = BlockIoPpi->GetBlockDeviceMediaInfo (
PeiServices,
BlockIoPpi,
IndexBlockDevice,
&Media
);
if (EFI_ERROR (Status) ||
!Media.MediaPresent ||
((Media.DeviceType != IdeCDROM) && (Media.DeviceType != UsbMassStorage)) ||
(Media.BlockSize != PEI_CD_BLOCK_SIZE)
) {
continue;
}
DEBUG ((EFI_D_INFO, "PeiCdExpress DeviceType is %d\n", Media.DeviceType));
DEBUG ((EFI_D_INFO, "PeiCdExpress MediaPresent is %d\n", Media.MediaPresent));
DEBUG ((EFI_D_INFO, "PeiCdExpress BlockSize is 0x%x\n", Media.BlockSize));
} }
DEBUG ((EFI_D_INFO, "PeiCdExpress DeviceType is %d\n", Media.DeviceType));
DEBUG ((EFI_D_INFO, "PeiCdExpress MediaPresent is %d\n", Media.MediaPresent));
DEBUG ((EFI_D_INFO, "PeiCdExpress BlockSize is 0x%x\n", Media.BlockSize));
DEBUG ((EFI_D_INFO, "PeiCdExpress Status is %d\n", Status)); DEBUG ((EFI_D_INFO, "PeiCdExpress Status is %d\n", Status));
DEBUG ((EFI_D_INFO, "IndexBlockDevice is %d\n", IndexBlockDevice)); DEBUG ((EFI_D_INFO, "IndexBlockDevice is %d\n", IndexBlockDevice));
PrivateData->CapsuleData[PrivateData->CapsuleCount].IndexBlock = IndexBlockDevice; PrivateData->CapsuleData[PrivateData->CapsuleCount].IndexBlock = IndexBlockDevice;
PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo = BlockIoPpi; if (BlockIo2) {
PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo2 = BlockIo2Ppi;
} else {
PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo = BlockIoPpi;
}
Status = FindRecoveryCapsules (PrivateData); Status = FindRecoveryCapsules (PrivateData);
DEBUG ((EFI_D_INFO, "Status is %d\n", Status)); DEBUG ((EFI_D_INFO, "Status is %d\n", Status));
@ -231,6 +288,7 @@ FindRecoveryCapsules (
EFI_STATUS Status; EFI_STATUS Status;
UINTN Lba; UINTN Lba;
EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi; EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi;
EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi;
UINTN BufferSize; UINTN BufferSize;
UINT8 *Buffer; UINT8 *Buffer;
UINT8 Type; UINT8 Type;
@ -251,6 +309,7 @@ FindRecoveryCapsules (
// //
IndexBlockDevice = PrivateData->CapsuleData[PrivateData->CapsuleCount].IndexBlock; IndexBlockDevice = PrivateData->CapsuleData[PrivateData->CapsuleCount].IndexBlock;
BlockIoPpi = PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo; BlockIoPpi = PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo;
BlockIo2Ppi = PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo2;
VolumeSpaceSize = 0; VolumeSpaceSize = 0;
StartOfVolume = TRUE; StartOfVolume = TRUE;
@ -258,14 +317,25 @@ FindRecoveryCapsules (
while (TRUE) { while (TRUE) {
SetMem (Buffer, BufferSize, 0); SetMem (Buffer, BufferSize, 0);
Status = BlockIoPpi->ReadBlocks ( if (BlockIo2Ppi != NULL) {
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (), Status = BlockIo2Ppi->ReadBlocks (
BlockIoPpi, (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
IndexBlockDevice, BlockIo2Ppi,
Lba, IndexBlockDevice,
BufferSize, Lba,
Buffer BufferSize,
); Buffer
);
} else {
Status = BlockIoPpi->ReadBlocks (
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
BlockIoPpi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -302,7 +372,7 @@ FindRecoveryCapsules (
RoorDirRecord = (PEI_CD_EXPRESS_DIR_FILE_RECORD *) (Buffer + PEI_CD_EXPRESS_ROOT_DIR_RECORD_OFFSET); RoorDirRecord = (PEI_CD_EXPRESS_DIR_FILE_RECORD *) (Buffer + PEI_CD_EXPRESS_ROOT_DIR_RECORD_OFFSET);
RootDirLBA = RoorDirRecord->LocationOfExtent[0]; RootDirLBA = RoorDirRecord->LocationOfExtent[0];
Status = RetrieveCapsuleFileFromRoot (PrivateData, BlockIoPpi, IndexBlockDevice, RootDirLBA); Status = RetrieveCapsuleFileFromRoot (PrivateData, BlockIoPpi, BlockIo2Ppi, IndexBlockDevice, RootDirLBA);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
// //
// Just look for the first primary descriptor // Just look for the first primary descriptor
@ -321,6 +391,7 @@ FindRecoveryCapsules (
@param PrivateData The private data structure that contains recovery module information. @param PrivateData The private data structure that contains recovery module information.
@param BlockIoPpi The Block IO PPI used to access the volume. @param BlockIoPpi The Block IO PPI used to access the volume.
@param BlockIo2Ppi The Block IO 2 PPI used to access the volume.
@param IndexBlockDevice The index of current block device. @param IndexBlockDevice The index of current block device.
@param Lba The starting logic block address to retrieve capsule. @param Lba The starting logic block address to retrieve capsule.
@ -334,6 +405,7 @@ EFIAPI
RetrieveCapsuleFileFromRoot ( RetrieveCapsuleFileFromRoot (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData, IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi,
IN UINTN IndexBlockDevice, IN UINTN IndexBlockDevice,
IN UINT32 Lba IN UINT32 Lba
) )
@ -349,14 +421,25 @@ RetrieveCapsuleFileFromRoot (
SetMem (Buffer, BufferSize, 0); SetMem (Buffer, BufferSize, 0);
Status = BlockIoPpi->ReadBlocks ( if (BlockIo2Ppi != NULL) {
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (), Status = BlockIo2Ppi->ReadBlocks (
BlockIoPpi, (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
IndexBlockDevice, BlockIo2Ppi,
Lba, IndexBlockDevice,
BufferSize, Lba,
Buffer BufferSize,
); Buffer
);
} else {
Status = BlockIoPpi->ReadBlocks (
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
BlockIoPpi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
}
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -440,7 +523,8 @@ GetNumberRecoveryCapsules (
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData; PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
PrivateData = PEI_CD_EXPRESS_PRIVATE_DATA_FROM_THIS (This); PrivateData = PEI_CD_EXPRESS_PRIVATE_DATA_FROM_THIS (This);
UpdateBlocksAndVolumes (PrivateData); UpdateBlocksAndVolumes (PrivateData, TRUE);
UpdateBlocksAndVolumes (PrivateData, FALSE);
*NumberRecoveryCapsules = PrivateData->CapsuleCount; *NumberRecoveryCapsules = PrivateData->CapsuleCount;
if (*NumberRecoveryCapsules == 0) { if (*NumberRecoveryCapsules == 0) {
@ -546,6 +630,7 @@ LoadRecoveryCapsule (
EFI_STATUS Status; EFI_STATUS Status;
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData; PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi; EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi;
EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi;
UINTN NumberRecoveryCapsules; UINTN NumberRecoveryCapsules;
Status = GetNumberRecoveryCapsules (PeiServices, This, &NumberRecoveryCapsules); Status = GetNumberRecoveryCapsules (PeiServices, This, &NumberRecoveryCapsules);
@ -564,15 +649,27 @@ LoadRecoveryCapsule (
PrivateData = PEI_CD_EXPRESS_PRIVATE_DATA_FROM_THIS (This); PrivateData = PEI_CD_EXPRESS_PRIVATE_DATA_FROM_THIS (This);
BlockIoPpi = PrivateData->CapsuleData[CapsuleInstance - 1].BlockIo; BlockIoPpi = PrivateData->CapsuleData[CapsuleInstance - 1].BlockIo;
BlockIo2Ppi = PrivateData->CapsuleData[CapsuleInstance - 1].BlockIo2;
Status = BlockIoPpi->ReadBlocks ( if (BlockIo2Ppi != NULL) {
PeiServices, Status = BlockIo2Ppi->ReadBlocks (
BlockIoPpi, PeiServices,
PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock, BlockIo2Ppi,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA, PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleSize, PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
Buffer PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleSize,
); Buffer
);
} else {
Status = BlockIoPpi->ReadBlocks (
PeiServices,
BlockIoPpi,
PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleSize,
Buffer
);
}
return Status; return Status;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Header file for CD recovery PEIM Header file for CD recovery PEIM
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions are licensed and made available under the terms and conditions
@ -21,6 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <PiPei.h> #include <PiPei.h>
#include <Ppi/BlockIo.h> #include <Ppi/BlockIo.h>
#include <Ppi/BlockIo2.h>
#include <Guid/RecoveryDevice.h> #include <Guid/RecoveryDevice.h>
#include <Ppi/DeviceRecoveryModule.h> #include <Ppi/DeviceRecoveryModule.h>
@ -67,6 +68,7 @@ typedef struct {
UINTN CapsuleSize; UINTN CapsuleSize;
UINTN IndexBlock; UINTN IndexBlock;
EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIo; EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIo;
EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2;
} PEI_CD_EXPRESS_CAPSULE_DATA; } PEI_CD_EXPRESS_CAPSULE_DATA;
#define PEI_CD_EXPRESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('p', 'c', 'd', 'e') #define PEI_CD_EXPRESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('p', 'c', 'd', 'e')
@ -77,6 +79,7 @@ typedef struct {
EFI_PEI_DEVICE_RECOVERY_MODULE_PPI DeviceRecoveryPpi; EFI_PEI_DEVICE_RECOVERY_MODULE_PPI DeviceRecoveryPpi;
EFI_PEI_PPI_DESCRIPTOR PpiDescriptor; EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor; EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;
EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor2;
UINT8 *BlockBuffer; UINT8 *BlockBuffer;
UINTN CapsuleCount; UINTN CapsuleCount;
@ -130,13 +133,15 @@ BlockIoNotifyEntry (
Finds out all the current Block IO PPIs in the system and add them into private data. Finds out all the current Block IO PPIs in the system and add them into private data.
@param PrivateData The private data structure that contains recovery module information. @param PrivateData The private data structure that contains recovery module information.
@param BlockIo2 Boolean to show whether using BlockIo2 or BlockIo.
@retval EFI_SUCCESS The blocks and volumes are updated successfully. @retval EFI_SUCCESS The blocks and volumes are updated successfully.
**/ **/
EFI_STATUS EFI_STATUS
UpdateBlocksAndVolumes ( UpdateBlocksAndVolumes (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN BOOLEAN BlockIo2
); );
/** /**
@ -253,6 +258,7 @@ FindRecoveryCapsules (
@param PrivateData The private data structure that contains recovery module information. @param PrivateData The private data structure that contains recovery module information.
@param BlockIoPpi The Block IO PPI used to access the volume. @param BlockIoPpi The Block IO PPI used to access the volume.
@param BlockIo2Ppi The Block IO 2 PPI used to access the volume.
@param IndexBlockDevice The index of current block device. @param IndexBlockDevice The index of current block device.
@param Lba The starting logic block address to retrieve capsule. @param Lba The starting logic block address to retrieve capsule.
@ -266,6 +272,7 @@ EFIAPI
RetrieveCapsuleFileFromRoot ( RetrieveCapsuleFileFromRoot (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData, IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi, IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi,
IN UINTN IndexBlockDevice, IN UINTN IndexBlockDevice,
IN UINT32 Lba IN UINT32 Lba
); );