[TGL][EHL] Fix regression for Flash descriptor lock (#1425)

Add BootMediaWriteByType and use for flash descriptor
update.

Signed-off-by: Subash Lakkimsetti <subash.lakkimsetti@intel.com>
This commit is contained in:
Subash Lakkimsetti 2021-12-01 22:25:11 -07:00 committed by GitHub
parent fb0a4aec22
commit 7a3bab7fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 3 deletions

View File

@ -387,6 +387,28 @@ BootMediaWrite (
OUT UINT8 *Buffer
);
/**
This function writes blocks to the SPI device based on flash region type.
@param[in] FlashRegionType The Flash Region type for flash cycle which is listed in the Descriptor.
@param[in] Address The block address in the FlashRegionAll to read from on the SPI.
@param[in] ByteCount Size of the Buffer in bytes.
@param[out] Buffer Pointer to caller-allocated buffer containing the data received during the SPI cycle.
@retval EFI_SUCCESS Write completes successfully.
@retval others Device error, the command aborts abnormally.
**/
EFI_STATUS
EFIAPI
BootMediaWriteByType (
IN FLASH_REGION_TYPE FlashRegionType,
IN UINT64 Address,
IN UINT32 ByteCount,
OUT UINT8 *Buffer
);
/**
Erase the data on the BootMedia.

View File

@ -113,7 +113,7 @@ BootMediaReadByType (
}
/**
This function writes blocks from the SPI device.
This function writes blocks to the SPI device.
@param[in] Address The block address in the FlashRegionAll to read from on the SPI.
@param[in] ByteCount Size of the Buffer in bytes.
@ -134,6 +134,31 @@ BootMediaWrite (
return mFwuSpiService->SpiWrite (FlashRegionBios, (UINT32)Address, ByteCount, Buffer);
}
/**
This function writes blocks to the SPI device based on flash region type.
@param[in] FlashRegionType The Flash Region type for flash cycle which is listed in the Descriptor.
@param[in] Address The block address in the FlashRegionAll to read from on the SPI.
@param[in] ByteCount Size of the Buffer in bytes.
@param[out] Buffer Pointer to caller-allocated buffer containing the data received during the SPI cycle.
@retval EFI_SUCCESS Write completes successfully.
@retval others Device error, the command aborts abnormally.
**/
EFI_STATUS
EFIAPI
BootMediaWriteByType (
IN FLASH_REGION_TYPE FlashRegionType,
IN UINT64 Address,
IN UINT32 ByteCount,
OUT UINT8 *Buffer
)
{
return mFwuSpiService->SpiWrite (FlashRegionType, (UINT32)Address, ByteCount, Buffer);
}
/**
This function erases blocks from the SPI device.

View File

@ -450,7 +450,7 @@ SetFlashDescriptorLock (
//
// Write to flash descriptor master access region
//
Status = BootMediaReadByType (FlashRegionDescriptor, (UINT32) B_FLASH_FMBA, sizeof(FlashDescMasterAccess), (UINT8 *) FlashDescMasterAccess);
Status = BootMediaWriteByType (FlashRegionDescriptor, (UINT32) B_FLASH_FMBA, sizeof(FlashDescMasterAccess), (UINT8 *) FlashDescMasterAccess);
if (EFI_ERROR (Status)) {
DEBUG((DEBUG_ERROR, "SPI Lock write failed 0x%x\n", Status));
}

View File

@ -459,7 +459,7 @@ SetFlashDescriptorLock (
//
// Write to flash descriptor master access region
//
Status = BootMediaReadByType (FlashRegionDescriptor, (UINT32) B_FLASH_FMBA, sizeof(FlashDescMasterAccess), (UINT8 *) FlashDescMasterAccess);
Status = BootMediaWriteByType (FlashRegionDescriptor, (UINT32) B_FLASH_FMBA, sizeof(FlashDescMasterAccess), (UINT8 *) FlashDescMasterAccess);
if (EFI_ERROR (Status)) {
DEBUG((DEBUG_ERROR, "SPI Lock write failed 0x%x\n", Status));
}