Re: [edk2-devel] [edk2-platforms V2 2/3] MinPlatformPkg: Get CoreType for all cores
Reviewed-by: Chasel Chiu Thanks, Chasel > -Original Message- > From: Tan, Dun > Sent: Sunday, March 31, 2024 11:04 PM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Lou, Yun ; Chiu, Chasel > ; Desimone, Nathaniel L > ; Liming Gao ; > Dong, Eric > 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 > Cc: Ray Ni > Cc: Jason Lou > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Liming Gao > Cc: Eric Dong > --- > 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; > + UINT8CoreType; > } 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 > + ) > +{ > + UINTNApNumber; > + EFI_STATUS Status; > + CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX > NativeModelIdAndCoreTypeEax; > + > + Status = mMpService->WhoAmI ( > + mMpService, > + > + ); > + ASSERT_EFI_ERROR (Status); > + > + AsmCpuidEx (CPUID_HYBRID_INFORMATION, > +CPUID_HYBRID_INFORMATION_MAIN_LEAF, > +, 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 ( >UINT32CurrProcessor; >EFI_CPU_ID_ORDER_MAP *CpuIdMapPtr; >UINT32Socket; > + UINT32CpuidMaxInput; > > - Status = EFI_SUCCESS; > + Status = EFI_SUCCESS; > + > + AsmCpuid (CPUID_SIGNATURE, , 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] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-platforms V2 2/3] MinPlatformPkg: Get CoreType for all cores
Reviewed-by: Ray Ni Thanks, Ray From: Tan, Dun Sent: Monday, April 1, 2024 14:04 To: devel@edk2.groups.io Cc: Ni, Ray ; Lou, Yun ; Chiu, Chasel ; Desimone, Nathaniel L ; Liming Gao ; Dong, Eric 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 Cc: Ray Ni Cc: Jason Lou Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong --- 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; + UINT8CoreType; } 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 + ) +{ + UINTNApNumber; + EFI_STATUS Status; + CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX NativeModelIdAndCoreTypeEax; + + Status = mMpService->WhoAmI ( + mMpService, + + ); + ASSERT_EFI_ERROR (Status); + + AsmCpuidEx (CPUID_HYBRID_INFORMATION, CPUID_HYBRID_INFORMATION_MAIN_LEAF, , 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 ( UINT32CurrProcessor; EFI_CPU_ID_ORDER_MAP *CpuIdMapPtr; UINT32Socket; + UINT32CpuidMaxInput; - Status = EFI_SUCCESS; + Status = EFI_SUCCESS; + + AsmCpuid (CPUID_SIGNATURE, , 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 (#117284): https://edk2.groups.io/g/devel/message/117284 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] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [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 Cc: Ray Ni Cc: Jason Lou Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong --- 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; + UINT8CoreType; } 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 + ) +{ + UINTNApNumber; + EFI_STATUS Status; + CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX NativeModelIdAndCoreTypeEax; + + Status = mMpService->WhoAmI ( + mMpService, + + ); + ASSERT_EFI_ERROR (Status); + + AsmCpuidEx (CPUID_HYBRID_INFORMATION, CPUID_HYBRID_INFORMATION_MAIN_LEAF, , 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 ( UINT32CurrProcessor; EFI_CPU_ID_ORDER_MAP *CpuIdMapPtr; UINT32Socket; + UINT32CpuidMaxInput; - Status = EFI_SUCCESS; + Status = EFI_SUCCESS; + + AsmCpuid (CPUID_SIGNATURE, , 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 (#117280): https://edk2.groups.io/g/devel/message/117280 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] -=-=-=-=-=-=-=-=-=-=-=-