Mike:
  I agree to update DXE dispatcher to directly handle FV image with PEI_DEPEX. 
If FV image with SMM_DEPEX, SMM dispatcher should handle it. Once SMM_DEPEX is 
satisfied, SMM core can trig event and let DxeCore install FV protocol for it. 

Thanks
Liming
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Kinney, 
Michael D
Sent: Tuesday, February 2, 2016 9:04 AM
To: Andrew Fish; edk2-devel@lists.01.org; Kinney, Michael D
Subject: Re: [edk2] Dxe Core support for EFI_SECTION_PEI_DEPEX section.

Andrew,

I agree that it looks like we can improve the logic here.

1) PEI Dispatcher: The logic looks correct to me.  It only looks for a section 
of type EFI_SECTION_PEI_DEPEX.

2) DXE Dispatcher: The current logic ignores an FV if there is either a PEI 
depex or an SMM depex present.  I think it would be safe to remove the checks 
for the PEI depex and the SMM depex, so it only pays attention to a DXE depex.  
If no DXE depex is present, then the FV can be evaluated immediately.  BTW, I 
did look at the history.  It appears that this aggressive filter has been in 
place since the first commit to the DXE Core to support FV scoped depex 
expressions.

3) SMM Dispatcher: Does not evaluate depex associated with FV.  Instead, it 
depends on the DXE Dispatcher to notify SMM Dispatcher when the SMM dispatcher 
should look in FVs for SMM drivers to dispatch.  So I do not think any logic 
changes are required in SMM.

Best regards,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
> Fish
> Sent: Monday, February 1, 2016 8:34 AM
> To: edk2-devel@lists.01.org <edk2-de...@ml01.01.org>
> Subject: [edk2] Dxe Core support for EFI_SECTION_PEI_DEPEX section.
> 
> I have an FV and I'd like to have PEI and DXE code in it. The code that I 
> need to
> access at PEI Time (DXE Core) is a compressed file in the FV. The code that 
> only needs
> to be accessed at DXE time is in a compressed FV. By default PEI will try to 
> decompress
> the FV Section, so I added a EFI_SECTION_PEI_DEPEX of FALSE to prevent this. 
> To my
> surprise this prevented the FV from being dispatched in DXE.
> 
> I don't see any language in the PI spec that calls out this behavior. I think 
> we should
> remove the checks for EFI_SECTION_PEI_DEPEX, and maybe even 
> EFI_SECTION_SMM_DEPEX. I
> think it is a better design to have the FV prevent the dispatch from the 
> phase(s) it is
> discovered in if that is the intent.
> 
> So for my example I added:
> SECTION PEI_DEPEX_EXP = {FALSE}
> 
> If you had a FV that showed up in DXE, but was for SMM you could:
> SECTION DXE_DEPEX_EXP = {FALSE}
> 
> This is the code I'm talking about:
> MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
> 
>             //
>             // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has 
> PEI depex
> section.
>             //
>             DepexBuffer  = NULL;
>             SizeOfBuffer = 0;
>             Status = Fv->ReadSection (
>                            Fv,
>                            &NameGuid,
>                            EFI_SECTION_PEI_DEPEX,
>                            0,
>                            &DepexBuffer,
>                            &SizeOfBuffer,
>                            &AuthenticationStatus
>                            );
>             if (!EFI_ERROR (Status)) {
>               //
>               // If PEI depex section is found, this FV image will be ignored 
> in DXE
> phase.
>               // Now, DxeCore doesn't support FV image with more one type 
> DEPEX
> section.
>               //
>               FreePool (DepexBuffer);
>               continue;
>             }
> 
> 
> Thanks,
> 
> Andrew Fish
> 
> PS This logic also exists.
> 
>             //
>             // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has 
> SMM depex
> section.
>             //
>             DepexBuffer  = NULL;
>             SizeOfBuffer = 0;
>             Status = Fv->ReadSection (
>                            Fv,
>                            &NameGuid,
>                            EFI_SECTION_SMM_DEPEX,
>                            0,
>                            &DepexBuffer,
>                            &SizeOfBuffer,
>                            &AuthenticationStatus
>                            );
>             if (!EFI_ERROR (Status)) {
>               //
>               // If SMM depex section is found, this FV image will be ignored 
> in DXE
> phase.
>               // Now, DxeCore doesn't support FV image with more one type 
> DEPEX
> section.
>               //
>               FreePool (DepexBuffer);
>               continue;
>             }
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to