> -  MpHandOff = GetMpHandOffHob (0);
> -  if (MpHandOff == NULL) {
> +  MaxLogicalProcessorNumber = 0;
> +  HaveMpHandOff             = FALSE;

1. Can we cache the first MpHandOff instance? It can be used as an indicator to 
replace "HaveMpHandOff",
and also can speed up the HOB enumeration in later logic.

> +
> +  while ((MpHandOff = GetMpHandOffHob
> (MaxLogicalProcessorNumber)) != 0) {

2. Can you use "!= NULL" instead of "!= 0"?

> +    DEBUG ((
> +      DEBUG_INFO,
> +      "%a: ProcessorIndex=%u CpuCount=%u\n",
> +      __func__,
> +      MpHandOff->ProcessorIndex,
> +      MpHandOff->CpuCount
> +      ));


3. can you add an assertion "ASSERT (MaxLogicalProcessorNumber == 
MpHandOff->ProcessorIndex);"?
It's to ensure no gap or overlap.

> +    MaxLogicalProcessorNumber += MpHandOff->CpuCount;
> +    HaveMpHandOff              = TRUE;
> +  }
> +
> +  if (!HaveMpHandOff) {
4. "HaveMpHandOff == TRUE"  --> "FirstMpHandOff != NULL"

> +      for (HobIndex = 0; HobIndex < MpHandOff->CpuCount; HobIndex++)

5. How about "ProcessorIndexInHob"? "HobIndex" is a bit confusing.
> 
> +    MpHandOff = GetMpHandOffHob (0);
6. All the GetMpHandOffHob(0) can be replaced with "FirstMpHandOff".


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


Reply via email to