Reviewed-by: Chasel Chiu <chasel.c...@intel.com>

Thanks,
Chasel


> -----Original Message-----
> From: Tan, Dun <dun....@intel.com>
> Sent: Sunday, March 31, 2024 11:04 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray...@intel.com>; Lou, Yun <yun....@intel.com>; Chiu, Chasel
> <chasel.c...@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desim...@intel.com>; Liming Gao <gaolim...@byosoft.com.cn>;
> Dong, Eric <eric.d...@intel.com>
> Subject: [edk2-platforms V2 2/3] MinPlatformPkg: Get CoreType for all cores
> 
> Add a new field CoreType in EFI_CPU_ID_ORDER_MAP and get CoreType for all
> cores.
> 
> Signed-off-by: Dun Tan <dun....@intel.com>
> Cc: Ray Ni <ray...@intel.com>
> Cc: Jason Lou <yun....@intel.com>
> Cc: Chasel Chiu <chasel.c...@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
> Cc: Liming Gao <gaolim...@byosoft.com.cn>
> Cc: Eric Dong <eric.d...@intel.com>
> ---
>  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 50
> ++++++++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 46 insertions(+), 4 deletions(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> index 62a7da290a..1fa70e3df9 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> @@ -18,6 +18,7 @@ typedef struct {
>    UINT32   Flags;
>    UINT32   SocketNum;
>    UINT32   Thread;
> +  UINT8    CoreType;
>  } EFI_CPU_ID_ORDER_MAP;
> 
>  //
> @@ -71,15 +72,16 @@ DebugDisplayReOrderTable (  {
>    UINT32 Index;
> 
> -  DEBUG ((DEBUG_INFO, "Index  AcpiProcId  ApicId   Thread  Flags   Skt\n"));
> +  DEBUG ((DEBUG_INFO, "Index  AcpiProcId  ApicId   Thread  Flags   Skt
> CoreType\n"));
>    for (Index = 0; Index < mNumberOfCpus; Index++) {
> -    DEBUG ((DEBUG_INFO, " %02d       0x%02X      0x%02X       %d      %d     
>  %d\n",
> +    DEBUG ((DEBUG_INFO, " %02d       0x%02X      0x%02X       %d      %d     
>  %d
> 0x%x\n",
>                             Index,
>                             CpuApicIdOrderTable[Index].AcpiProcessorUid,
>                             CpuApicIdOrderTable[Index].ApicId,
>                             CpuApicIdOrderTable[Index].Thread,
>                             CpuApicIdOrderTable[Index].Flags,
> -                           CpuApicIdOrderTable[Index].SocketNum));
> +                           CpuApicIdOrderTable[Index].SocketNum,
> +                           CpuApicIdOrderTable[Index].CoreType));
>    }
>  }
> 
> @@ -130,6 +132,31 @@ AppendCpuMapTableEntry (
> 
>  }
> 
> +/**
> +  Get CPU core type.
> +
> +  @param[in] CpuApicIdOrderTable         Point to a buffer which will be 
> filled in
> Core type information.
> +**/
> +VOID
> +EFIAPI
> +CollectCpuCoreType (
> +  IN EFI_CPU_ID_ORDER_MAP  *CpuApicIdOrderTable
> +  )
> +{
> +  UINTN                                    ApNumber;
> +  EFI_STATUS                               Status;
> +  CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX
> NativeModelIdAndCoreTypeEax;
> +
> +  Status = mMpService->WhoAmI (
> +                         mMpService,
> +                         &ApNumber
> +                         );
> +  ASSERT_EFI_ERROR (Status);
> +
> +  AsmCpuidEx (CPUID_HYBRID_INFORMATION,
> +CPUID_HYBRID_INFORMATION_MAIN_LEAF,
> +&NativeModelIdAndCoreTypeEax.Uint32, NULL, NULL, NULL);
> +  CpuApicIdOrderTable[ApNumber].CoreType =
> +(UINT8)NativeModelIdAndCoreTypeEax.Bits.CoreType;
> +}
> +
>  /**
>    Collect all processors information and create a Cpu Apic Id table.
> 
> @@ -146,8 +173,23 @@ CreateCpuLocalApicInTable (
>    UINT32                                    CurrProcessor;
>    EFI_CPU_ID_ORDER_MAP                      *CpuIdMapPtr;
>    UINT32                                    Socket;
> +  UINT32                                    CpuidMaxInput;
> 
> -  Status     = EFI_SUCCESS;
> +  Status = EFI_SUCCESS;
> +
> +  AsmCpuid (CPUID_SIGNATURE, &CpuidMaxInput, NULL, NULL, NULL);  if
> + (CpuidMaxInput >= CPUID_HYBRID_INFORMATION) {
> +    CollectCpuCoreType (CpuApicIdOrderTable);
> +    mMpService->StartupAllAPs (
> +                  mMpService,                               // This
> +                  (EFI_AP_PROCEDURE) CollectCpuCoreType,    // Procedure
> +                  TRUE,                                     // SingleThread
> +                  NULL,                                     // WaitEvent
> +                  0,                                        // 
> TimeoutInMicrosecsond
> +                  CpuApicIdOrderTable,                      // 
> ProcedureArgument
> +                  NULL                                      // FailedCpuList
> +                  );
> +  }
> 
>    for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus;
> CurrProcessor++, Index++) {
>      Status = mMpService->GetProcessorInfo (
> --
> 2.31.1.windows.1



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


Reply via email to