On Jul 22, 2014, at 1:07 PM, Varad Gautam <[email protected]> wrote:
> Hi,
>
> I'm tracing the execution of PrePiLib:LoadDxeFromFv() and have a few
> questions.
>
> After getting VolumeHandle from the Hob in FfsFindNextVolume(), it is casted
> to
> `EFI_FIRMWARE_VOLUME_HEADER*` in FindFileEx() [1]. How does this work?
> I could not find `EFI_PEI_FV_HANDLE` being populated anywhere with fields in a
> `EFI_FIRMWARE_VOLUME_HEADER*`, and so for me, the FvLength [2] gets set
> to 0.
>
> Also, the call to PlatformPeim() at [3] appends a single PCD-specified
> FV to the Hob list.
My guess is the PCD is pointing to the wrong place in your port.
The best way to debug this is to generate a build report. You just need to add
-y REPORTFILE to the build command.
-y REPORTFILE, --report-file=REPORTFILE
Create/overwrite the report to the specified filename.
-Y REPORTTYPE, --report-type=REPORTTYPE
Flags that control the type of build report to
generate. Must be one of: [PCD, LIBRARY, FLASH,
DEPEX, BUILD_FLAGS, FIXED_ADDRESS, EXECUTION_ORDER].
To specify more than one flag, repeat this option on
the command line and the default flag set is [PCD,
LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS]
> So, I figure, this approach would not work if there are multiple
> non-nested FVs placed
> into an FD with DxeCore being in a separate FV from PrePi?
>
The FV HOB(s) (you can have more than one) only point to memory mapped FVs, and
this generally maps to your FLASH layout. So it is legal to have as many as you
want.
The “nested” FVs are not reported via the FV HOB, since they are discoverable
in a reported FV.
>
> [1]
> https://github.com/tianocore/edk2/blob/master/EmbeddedPkg/Library/PrePiLib/FwVol.c#L181
The EFI_PEI_FV_HANDLE exists to abstract the implementation of the file system
from the API. Thus it is possible for the PEI Core to support a 3rd party file
system vi a PPI plug in.
When the file system is the PI defined one, then it is legal to make the
EFI_PEI_FV_HANDLE a pointer to the EFI_FIRMWARE_VOLUME_HEADER. The PEI Core has
used this scheme in the past.
By definition the FV Header is at the beginning of the FV.
> [2]
> https://github.com/tianocore/edk2/blob/master/EmbeddedPkg/Library/PrePiLib/FwVol.c#L184
The start of the Volume should be a header. It would probably be a good idea to
add a check of the FwVolHeader->Signature == EFI_FVH_SIGNATURE at the start of
the function.
https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Pi/PiFirmwareVolume.h
///
/// Describes the features and layout of the firmware volume.
///
typedef struct {
///
/// The first 16 bytes are reserved to allow for the reset vector of
/// processors whose reset vector is at address 0.
///
UINT8 ZeroVector[16];
///
/// Declares the file system with which the firmware volume is formatted.
///
EFI_GUID FileSystemGuid;
///
/// Length in bytes of the complete firmware volume, including the header.
///
UINT64 FvLength;
///
/// Set to EFI_FVH_SIGNATURE
///
UINT32 Signature;
///
/// Declares capabilities and power-on defaults for the firmware volume.
///
EFI_FVB_ATTRIBUTES_2 Attributes;
///
/// Length in bytes of the complete firmware volume header.
///
UINT16 HeaderLength;
///
/// A 16-bit checksum of the firmware volume header. A valid header sums to
zero.
///
UINT16 Checksum;
///
/// Offset, relative to the start of the header, of the extended header
/// (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is no extended header.
///
UINT16 ExtHeaderOffset;
///
/// This field must always be set to zero.
///
UINT8 Reserved[1];
///
/// Set to 2. Future versions of this specification may define new header
fields and will
/// increment the Revision field accordingly.
///
UINT8 Revision;
///
/// An array of run-length encoded FvBlockMapEntry structures. The array is
/// terminated with an entry of {0,0}.
///
EFI_FV_BLOCK_MAP_ENTRY BlockMap[1];
} EFI_FIRMWARE_VOLUME_HEADER;
#define EFI_FVH_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', 'H')
Thanks,
Andrew Fish
> [3]
> https://github.com/tianocore/edk2/blob/master/ArmPlatformPkg/PrePi/PrePi.c#L175
>
> Thanks,
> Varad
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel