Re: [edk2] [PATCH 2/2] MdeModulePkg DxeCore: Handle multiple FV images in one FV file
Oh, yes, agree. I should update description. Thanks, Star -Original Message- From: Gao, Liming Sent: Thursday, August 30, 2018 5:55 PM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Yao, Jiewen Subject: RE: [PATCH 2/2] MdeModulePkg DxeCore: Handle multiple FV images in one FV file Star: You change the parameter name in the function. Please also update the function description to match the function implementation. Thanks Liming >-Original Message- >From: Zeng, Star >Sent: Wednesday, August 29, 2018 5:38 PM >To: edk2-devel@lists.01.org >Cc: Zeng, Star ; Gao, Liming >; Yao, Jiewen >Subject: [PATCH 2/2] MdeModulePkg DxeCore: Handle multiple FV images in >one FV file > >REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1131 > >PI spec and BaseTools supports to generate multiple FV images in one FV >file. >This patch is to update DxeCore to handle the case. > >Cc: Liming Gao >Cc: Jiewen Yao >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Star Zeng >--- > MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 241 ++- >--- > 1 file changed, 128 insertions(+), 113 deletions(-) > >diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >index f72c47a9e54c..086a590ef4e3 100644 >--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >@@ -184,14 +184,13 @@ CoreAddToDriverList ( > ); > > /** >- Get the driver from the FV through driver name, and produce a FVB >protocol on FvHandle. >+ Get Fv image(s) from the FV through file name, and produce FVB >+ protocol >for every Fv image(s). > > @param FvThe FIRMWARE_VOLUME protocol installed on the > FV. > @param FvHandle The handle which FVB protocol installed on. > @param DriverNameThe driver guid specified. > > @retval EFI_OUT_OF_RESOURCES No enough memory or other resource. >- @retval EFI_VOLUME_CORRUPTED Corrupted volume. > @retval EFI_SUCCESS Function successfully returned. > > **/ >@@ -199,7 +198,7 @@ EFI_STATUS > CoreProcessFvImageFile ( > IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, > IN EFI_HANDLE FvHandle, >- IN EFI_GUID*DriverName >+ IN EFI_GUID*FileName > ); > > >@@ -1004,14 +1003,13 @@ GetFvUsedSize ( } > > /** >- Get the driver from the FV through driver name, and produce a FVB >protocol on FvHandle. >+ Get Fv image(s) from the FV through file name, and produce FVB >+ protocol >for every Fv image(s). > > @param FvThe FIRMWARE_VOLUME protocol installed on the > FV. > @param FvHandle The handle which FVB protocol installed on. > @param DriverNameThe driver guid specified. > > @retval EFI_OUT_OF_RESOURCES No enough memory or other resource. >- @retval EFI_VOLUME_CORRUPTED Corrupted volume. > @retval EFI_SUCCESS Function successfully returned. > > **/ >@@ -1019,7 +1017,7 @@ EFI_STATUS > CoreProcessFvImageFile ( > IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, > IN EFI_HANDLE FvHandle, >- IN EFI_GUID*DriverName >+ IN EFI_GUID*FileName > ) > { > EFI_STATUS Status; >@@ -1033,141 +1031,158 @@ CoreProcessFvImageFile ( > EFI_DEVICE_PATH_PROTOCOL*FvFileDevicePath; > UINT32 FvUsedSize; > UINT8 EraseByte; >+ UINTN Index; > > // >- // Read the first (and only the first) firmware volume section >+ // Read firmware volume section(s) > // > SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE; >- FvHeader = NULL; >- FvAlignment = 0; >- Buffer= NULL; >- BufferSize= 0; >- AlignedBuffer = NULL; >- Status = Fv->ReadSection ( >- Fv, >- DriverName, >- SectionType, >- 0, >- , >- , >- >- ); >- if (!EFI_ERROR (Status)) { >- // >-// Evaluate the authentication status of the Firmware Volume through >-// Security Architectural Protocol >-// >-if (gSecurity != NULL) { >- FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName); >- Status = gSecurity->FileAuthenticationState ( >-gSecurity, >-AuthenticationStatus, >-FvFileDevicePath >-); >- if (FvFileDevicePath != NULL) { >-FreePool (FvFileDevicePath); >- } > >- if (Status != EFI_SUCCESS) { >-// >-// Security check failed. The firmware volume should not be used for >any >purpose. >-// >-if (Buffer != NULL) { >- FreePool (Buffer); >+ Index = 0; >+ do { >+FvHeader =
Re: [edk2] [PATCH 2/2] MdeModulePkg DxeCore: Handle multiple FV images in one FV file
Star: You change the parameter name in the function. Please also update the function description to match the function implementation. Thanks Liming >-Original Message- >From: Zeng, Star >Sent: Wednesday, August 29, 2018 5:38 PM >To: edk2-devel@lists.01.org >Cc: Zeng, Star ; Gao, Liming ; >Yao, Jiewen >Subject: [PATCH 2/2] MdeModulePkg DxeCore: Handle multiple FV images in >one FV file > >REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1131 > >PI spec and BaseTools supports to generate multiple FV images >in one FV file. >This patch is to update DxeCore to handle the case. > >Cc: Liming Gao >Cc: Jiewen Yao >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Star Zeng >--- > MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 241 ++- >--- > 1 file changed, 128 insertions(+), 113 deletions(-) > >diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >index f72c47a9e54c..086a590ef4e3 100644 >--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c >@@ -184,14 +184,13 @@ CoreAddToDriverList ( > ); > > /** >- Get the driver from the FV through driver name, and produce a FVB >protocol on FvHandle. >+ Get Fv image(s) from the FV through file name, and produce FVB protocol >for every Fv image(s). > > @param FvThe FIRMWARE_VOLUME protocol installed on the > FV. > @param FvHandle The handle which FVB protocol installed on. > @param DriverNameThe driver guid specified. > > @retval EFI_OUT_OF_RESOURCES No enough memory or other resource. >- @retval EFI_VOLUME_CORRUPTED Corrupted volume. > @retval EFI_SUCCESS Function successfully returned. > > **/ >@@ -199,7 +198,7 @@ EFI_STATUS > CoreProcessFvImageFile ( > IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, > IN EFI_HANDLE FvHandle, >- IN EFI_GUID*DriverName >+ IN EFI_GUID*FileName > ); > > >@@ -1004,14 +1003,13 @@ GetFvUsedSize ( > } > > /** >- Get the driver from the FV through driver name, and produce a FVB >protocol on FvHandle. >+ Get Fv image(s) from the FV through file name, and produce FVB protocol >for every Fv image(s). > > @param FvThe FIRMWARE_VOLUME protocol installed on the > FV. > @param FvHandle The handle which FVB protocol installed on. > @param DriverNameThe driver guid specified. > > @retval EFI_OUT_OF_RESOURCES No enough memory or other resource. >- @retval EFI_VOLUME_CORRUPTED Corrupted volume. > @retval EFI_SUCCESS Function successfully returned. > > **/ >@@ -1019,7 +1017,7 @@ EFI_STATUS > CoreProcessFvImageFile ( > IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, > IN EFI_HANDLE FvHandle, >- IN EFI_GUID*DriverName >+ IN EFI_GUID*FileName > ) > { > EFI_STATUS Status; >@@ -1033,141 +1031,158 @@ CoreProcessFvImageFile ( > EFI_DEVICE_PATH_PROTOCOL*FvFileDevicePath; > UINT32 FvUsedSize; > UINT8 EraseByte; >+ UINTN Index; > > // >- // Read the first (and only the first) firmware volume section >+ // Read firmware volume section(s) > // > SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE; >- FvHeader = NULL; >- FvAlignment = 0; >- Buffer= NULL; >- BufferSize= 0; >- AlignedBuffer = NULL; >- Status = Fv->ReadSection ( >- Fv, >- DriverName, >- SectionType, >- 0, >- , >- , >- >- ); >- if (!EFI_ERROR (Status)) { >- // >-// Evaluate the authentication status of the Firmware Volume through >-// Security Architectural Protocol >-// >-if (gSecurity != NULL) { >- FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName); >- Status = gSecurity->FileAuthenticationState ( >-gSecurity, >-AuthenticationStatus, >-FvFileDevicePath >-); >- if (FvFileDevicePath != NULL) { >-FreePool (FvFileDevicePath); >- } > >- if (Status != EFI_SUCCESS) { >-// >-// Security check failed. The firmware volume should not be used for >any >purpose. >-// >-if (Buffer != NULL) { >- FreePool (Buffer); >+ Index = 0; >+ do { >+FvHeader = NULL; >+FvAlignment = 0; >+Buffer= NULL; >+BufferSize= 0; >+AlignedBuffer = NULL; >+Status = Fv->ReadSection ( >+ Fv, >+ FileName, >+ SectionType, >+ Index, >+ , >+
[edk2] [PATCH 2/2] MdeModulePkg DxeCore: Handle multiple FV images in one FV file
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1131 PI spec and BaseTools supports to generate multiple FV images in one FV file. This patch is to update DxeCore to handle the case. Cc: Liming Gao Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 241 ++ 1 file changed, 128 insertions(+), 113 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c index f72c47a9e54c..086a590ef4e3 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c @@ -184,14 +184,13 @@ CoreAddToDriverList ( ); /** - Get the driver from the FV through driver name, and produce a FVB protocol on FvHandle. + Get Fv image(s) from the FV through file name, and produce FVB protocol for every Fv image(s). @param FvThe FIRMWARE_VOLUME protocol installed on the FV. @param FvHandle The handle which FVB protocol installed on. @param DriverNameThe driver guid specified. @retval EFI_OUT_OF_RESOURCES No enough memory or other resource. - @retval EFI_VOLUME_CORRUPTED Corrupted volume. @retval EFI_SUCCESS Function successfully returned. **/ @@ -199,7 +198,7 @@ EFI_STATUS CoreProcessFvImageFile ( IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, - IN EFI_GUID*DriverName + IN EFI_GUID*FileName ); @@ -1004,14 +1003,13 @@ GetFvUsedSize ( } /** - Get the driver from the FV through driver name, and produce a FVB protocol on FvHandle. + Get Fv image(s) from the FV through file name, and produce FVB protocol for every Fv image(s). @param FvThe FIRMWARE_VOLUME protocol installed on the FV. @param FvHandle The handle which FVB protocol installed on. @param DriverNameThe driver guid specified. @retval EFI_OUT_OF_RESOURCES No enough memory or other resource. - @retval EFI_VOLUME_CORRUPTED Corrupted volume. @retval EFI_SUCCESS Function successfully returned. **/ @@ -1019,7 +1017,7 @@ EFI_STATUS CoreProcessFvImageFile ( IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, - IN EFI_GUID*DriverName + IN EFI_GUID*FileName ) { EFI_STATUS Status; @@ -1033,141 +1031,158 @@ CoreProcessFvImageFile ( EFI_DEVICE_PATH_PROTOCOL*FvFileDevicePath; UINT32 FvUsedSize; UINT8 EraseByte; + UINTN Index; // - // Read the first (and only the first) firmware volume section + // Read firmware volume section(s) // SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE; - FvHeader = NULL; - FvAlignment = 0; - Buffer= NULL; - BufferSize= 0; - AlignedBuffer = NULL; - Status = Fv->ReadSection ( - Fv, - DriverName, - SectionType, - 0, - , - , - - ); - if (!EFI_ERROR (Status)) { - // -// Evaluate the authentication status of the Firmware Volume through -// Security Architectural Protocol -// -if (gSecurity != NULL) { - FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName); - Status = gSecurity->FileAuthenticationState ( -gSecurity, -AuthenticationStatus, -FvFileDevicePath -); - if (FvFileDevicePath != NULL) { -FreePool (FvFileDevicePath); - } - if (Status != EFI_SUCCESS) { -// -// Security check failed. The firmware volume should not be used for any purpose. -// -if (Buffer != NULL) { - FreePool (Buffer); + Index = 0; + do { +FvHeader = NULL; +FvAlignment = 0; +Buffer= NULL; +BufferSize= 0; +AlignedBuffer = NULL; +Status = Fv->ReadSection ( + Fv, + FileName, + SectionType, + Index, + , + , + + ); +if (!EFI_ERROR (Status)) { + // + // Evaluate the authentication status of the Firmware Volume through + // Security Architectural Protocol + // + if (gSecurity != NULL) { +FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, FileName); +Status = gSecurity->FileAuthenticationState ( + gSecurity, + AuthenticationStatus, + FvFileDevicePath +