Hi Gerd,

Is it still the solution with multiple hobs created for big data but you want 
the hob splitting and reassembling can be encapsulated in the Hoblib?

Does it need define the new hob type for chunk?

Thanks,
Jiaxin

> -----Original Message-----
> From: kra...@redhat.com <kra...@redhat.com>
> Sent: Friday, February 3, 2023 3:55 PM
> To: Ni, Ray <ray...@intel.com>
> Cc: Johnson, Brian <brian.john...@hpe.com>; devel@edk2.groups.io; Laszlo
> Ersek <ler...@redhat.com>; Wu, Jiaxin <jiaxin...@intel.com>; Dong, Eric
> <eric.d...@intel.com>; Zeng, Star <star.z...@intel.com>; Kumar, Rahul R
> <rahul.r.ku...@intel.com>; Kinney, Michael D <michael.d.kin...@intel.com>;
> Zimmer, Vincent <vincent.zim...@intel.com>
> Subject: Re: [edk2-devel] [PATCH v3 1/5] UefiCpuPkg/SmmBaseHob.h: Add
> SMM Base HOB Data
> 
> On Fri, Feb 03, 2023 at 03:14:42AM +0000, Ni, Ray wrote:
> > Gerd,
> > Can you please explain a bit more on the chunk idea?
> 
> > > > to introduce a generic and reusable concept of chunked HOBs, so you can
> > > > add helper functions to HobLib for splitting and reassembling, with a
> > > > struct along the lines of:
> > > >
> > > > typedef struct {
> > > >         // offset and size of this particular chunk
> > > >         UINT32  ChunkOffset;
> > > >         UINT32  ChunkSize;
> > > >
> > > >         // number of chunks and size of all chunks combined.
> > > >         UINT32  ChunkCount;
> > > >         UINT32  TotalSize;
> > > >
> > > >         // chunk data
> > > >         UINT8   Data[0];
> > > > } EFI_HOB_CHUNK;
> 
> Reassembling would work like this:
> 
>   // once
>   AssembledHob = malloc(HobChunk->TotalSize);
> 
>   // for each chunk
>   memcpy(AssembledHob + HobChunk->ChunkOffset, HobChunk->Data,
> HobChunk->ChunkSize);
> 
> Possible shortcut:
> 
>   if (HobChunk->ChunkSize == HobChunk->TotalSize)
>     // data is not splitted into multiple chunks
>     AssembledHob = HobChunk->Data
> 
> Advantage: you avoid the allocation in case the data fits into a single
> HOB.  Disadvantage: you need to track whenever AssembledHob is allocated
> (and must eventually be freed) or not.
> 
> HobChunk->ChunkCount is not really needed but might be useful for sanity
> checking.
> 
> take care,
>   Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99583): https://edk2.groups.io/g/devel/message/99583
Mute This Topic: https://groups.io/mt/96350760/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to