On Wed, Feb 21, 2024 at 03:48:25AM +0000, Ni, Ray wrote:
> > 
> > +  MaxCpusPerHob = (MAX_UINT16 - sizeof (EFI_HOB_GUID_TYPE) - sizeof
> > (MP_HAND_OFF)) / sizeof (PROCESSOR_HAND_OFF);
> 
> Above formula assumes the maximum HOB length could be 0xFFFF.

Which is IMHO correct.

> But actually the maximum HOB length could be only 0xFFF8 because
> PeiCore::PeiCreateHob() contains following logic:
> 
>   if (0x10000 - Length <= 0x7) {
>     return EFI_INVALID_PARAMETER;
>   }

That Length is the *data* size, the HOB header is not included.

The "- sizeof (EFI_HOB_GUID_TYPE)" in the formula above accounts the
space needed for HOB header and GUID.

take care,
  Gerd



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


Reply via email to