From 0c2b5da80e9551286cd02a92d91090290ae2d816 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Tue, 4 Sep 2007 06:12:48 +0000 Subject: Merge the PI enabling works from the branch First round of PI enabling work: 1) PiPeiCis changes (CONST, EFI_PEI_FILE_HANDLE.. etc) 2) Make use of FirmwareVolume 2 protocol. 3) Verified for Nt32Pkg and real platform for S3. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3773 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/FwVol/FwVol.c | 19 +++++---- MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c | 66 +++++++++++++++++++++++++++++-- MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c | 38 +++++++++--------- MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c | 8 ++-- 4 files changed, 96 insertions(+), 35 deletions(-) (limited to 'MdeModulePkg/Core/Dxe/FwVol') diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c index 98550c96eb..c89dc8c2ed 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c @@ -25,7 +25,7 @@ VOID *gEfiFwVolBlockNotifyReg; EFI_EVENT gEfiFwVolBlockEvent; FV_DEVICE mFvDevice = { - FV_DEVICE_SIGNATURE, + FV2_DEVICE_SIGNATURE, NULL, NULL, { @@ -35,7 +35,10 @@ FV_DEVICE mFvDevice = { FvReadFileSection, FvWriteFile, FvGetNextFile, - KEYSIZE + KEYSIZE, + NULL, + FvGetVolumeInfo, + FvSetVolumeInfo }, NULL, NULL, @@ -389,8 +392,8 @@ NotifyFwVolBlock ( Routine Description: This notification function is invoked when an instance of the EFI_FW_VOLUME_BLOCK_PROTOCOL is produced. It layers an instance of the - EFI_FIRMWARE_VOLUME_PROTOCOL on the same handle. This is the function where - the actual initialization of the EFI_FIRMWARE_VOLUME_PROTOCOL is done. + EFI_FIRMWARE_VOLUME2_PROTOCOL on the same handle. This is the function where + the actual initialization of the EFI_FIRMWARE_VOLUME2_PROTOCOL is done. Arguments: Event - The event that occured @@ -406,7 +409,7 @@ Returns: EFI_STATUS Status; UINTN BufferSize; EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb; - EFI_FIRMWARE_VOLUME_PROTOCOL *Fv; + EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; FV_DEVICE *FvDevice; EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader; // @@ -468,13 +471,13 @@ Returns: // // Check if there is an FV protocol already installed in that handle // - Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeProtocolGuid, (VOID **)&Fv); + Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv); if (!EFI_ERROR (Status)) { // // Update Fv to use a new Fvb // FvDevice = _CR (Fv, FV_DEVICE, Fv); - if (FvDevice->Signature == FV_DEVICE_SIGNATURE) { + if (FvDevice->Signature == FV2_DEVICE_SIGNATURE) { // // Only write into our device structure if it's our device structure // @@ -500,7 +503,7 @@ Returns: // Status = CoreInstallProtocolInterface ( &Handle, - &gEfiFirmwareVolumeProtocolGuid, + &gEfiFirmwareVolume2ProtocolGuid, EFI_NATIVE_INTERFACE, &FvDevice->Fv ); diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c index 4a31a8dcf6..280978ed1a 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolAttrib.c @@ -24,8 +24,8 @@ Abstract: EFI_STATUS EFIAPI FvGetVolumeAttributes ( - IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, - OUT EFI_FV_ATTRIBUTES *Attributes + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + OUT EFI_FV_ATTRIBUTES *Attributes ) /*++ @@ -76,8 +76,8 @@ Returns: EFI_STATUS EFIAPI FvSetVolumeAttributes ( - IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, - IN OUT EFI_FV_ATTRIBUTES *Attributes + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT EFI_FV_ATTRIBUTES *Attributes ) /*++ @@ -97,3 +97,61 @@ Returns: return EFI_UNSUPPORTED; } +EFI_STATUS +EFIAPI +FvGetVolumeInfo ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +/*++ + +Routine Description: + Return information of type InformationType for the requested firmware + volume. + +Arguments: + This - Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL. + InformationType - InformationType for requested. + BufferSize - On input, size of Buffer.On output, the amount of + data returned in Buffer. + Buffer - A poniter to the data buffer to return. +Returns: + EFI_SUCCESS - Successfully got volume Information. + +--*/ +{ + return EFI_UNSUPPORTED; +} + + +EFI_STATUS +EFIAPI +FvSetVolumeInfo ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN UINTN BufferSize, + IN CONST VOID *Buffer + ) +/*++ + +Routine Description: + Set information of type InformationType for the requested firmware + volume. + +Arguments: + This - Pointer to EFI_FIRMWARE_VOLUME2_PROTOCOL. + InformationType - InformationType for requested. + BufferSize - On input, size of Buffer.On output, the amount of + data returned in Buffer. + Buffer - A poniter to the data buffer to return. +Returns: + EFI_SUCCESS - Successfully set volume Information. + +--*/ +{ + return EFI_UNSUPPORTED; +} + + diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c index 313b36e6f7..a477ad488d 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c @@ -70,12 +70,12 @@ FfsAttributes2FvFileAttributes ( EFI_STATUS EFIAPI FvGetNextFile ( - IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, - IN OUT VOID *Key, - IN OUT EFI_FV_FILETYPE *FileType, + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT VOID *Key, + IN OUT EFI_FV_FILETYPE *FileType, OUT EFI_GUID *NameGuid, OUT EFI_FV_FILE_ATTRIBUTES *Attributes, - OUT UINTN *Size + OUT UINTN *Size ) /*++ @@ -140,7 +140,7 @@ Returns: // // Check if read operation is enabled // - if ((FvAttributes & EFI_FV_READ_STATUS) == 0) { + if ((FvAttributes & EFI_FV2_READ_STATUS) == 0) { return EFI_ACCESS_DENIED; } @@ -227,13 +227,13 @@ Returns: EFI_STATUS EFIAPI FvReadFile ( - IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, - IN EFI_GUID *NameGuid, - IN OUT VOID **Buffer, - IN OUT UINTN *BufferSize, - OUT EFI_FV_FILETYPE *FoundType, - OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, - OUT UINT32 *AuthenticationStatus + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT EFI_FV_FILETYPE *FoundType, + OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, + OUT UINT32 *AuthenticationStatus ) /*++ @@ -370,13 +370,13 @@ Returns: EFI_STATUS EFIAPI FvReadFileSection ( - IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, - IN EFI_GUID *NameGuid, - IN EFI_SECTION_TYPE SectionType, - IN UINTN SectionInstance, - IN OUT VOID **Buffer, - IN OUT UINTN *BufferSize, - OUT UINT32 *AuthenticationStatus + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN EFI_SECTION_TYPE SectionType, + IN UINTN SectionInstance, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT UINT32 *AuthenticationStatus ) /*++ diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c index 4368fe534e..bf075dca86 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolWrite.c @@ -25,10 +25,10 @@ Abstract: EFI_STATUS EFIAPI FvWriteFile ( - IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, - IN UINT32 NumberOfFiles, - IN EFI_FV_WRITE_POLICY WritePolicy, - IN EFI_FV_WRITE_FILE_DATA *FileData + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN UINT32 NumberOfFiles, + IN EFI_FV_WRITE_POLICY WritePolicy, + IN EFI_FV_WRITE_FILE_DATA *FileData ) /*++ -- cgit v1.2.3