From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id C20CB94125B for ; Mon, 1 Apr 2024 06:04:33 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Ul6sG7GSHZw8y8P9LXOk9aCq0Vv/vZJMy8YGuR4gkXk=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1711951472; v=1; b=lgBUZcOk4r3yHBjUuhSDypMKILF+WbwqQMQYZmcL/ZmnM3On6vY/S83fHgL+5hohxbWNRmtr W9bNXWeGODWMCZh3+fCgJKGX4PP4eLzM1Obi6phVAg2dLhO7B6txsZRMaKkOq17xVsvzjzy7Tx8 aq+yXtWzlUos0ZwENH8WGBXDZTvUb/8p8ss+wivhjlLPGp4serrVYAoiI30UUsR9z5Uf6vaWNtu d9cYjZWEsV7q2FOFTgr6Be2ncNfE1p72/ZxfoTOKq2yBLLcmG+pFzII9br8gQK+MnCKNgl5Zzfv HRPk8unw5mOJiiiUzZNv1fkBgq+AU85AmDT2pPiPomqog== X-Received: by 127.0.0.2 with SMTP id 82D7YY7687511xO0osvQtXa3; Sun, 31 Mar 2024 23:04:32 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mx.groups.io with SMTP id smtpd.web10.31899.1711951462693257400 for ; Sun, 31 Mar 2024 23:04:31 -0700 X-CSE-ConnectionGUID: nszFThC4SQyWeRag1xuCVQ== X-CSE-MsgGUID: qi8rdBdGQMGr9gTCZKUcdQ== X-IronPort-AV: E=McAfee;i="6600,9927,11030"; a="7214043" X-IronPort-AV: E=Sophos;i="6.07,171,1708416000"; d="scan'208";a="7214043" X-Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2024 23:04:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,171,1708416000"; d="scan'208";a="17438920" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.43]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2024 23:04:30 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Ray Ni , Jason Lou , Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms V2 2/3] MinPlatformPkg: Get CoreType for all cores Date: Mon, 1 Apr 2024 14:04:10 +0800 Message-Id: <20240401060411.899-3-dun.tan@intel.com> In-Reply-To: <20240401060411.899-1-dun.tan@intel.com> References: <20240401060411.899-1-dun.tan@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Sun, 31 Mar 2024 23:04:32 -0700 Reply-To: devel@edk2.groups.io,dun.tan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Qt1kKmv3LSZE5nbaI5vYqlncx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=lgBUZcOk; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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; + 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 (#117280): https://edk2.groups.io/g/devel/message/117280 Mute This Topic: https://groups.io/mt/105259124/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-