From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.82]) by mx.groups.io with SMTP id smtpd.web10.372.1582659639814377326 for ; Tue, 25 Feb 2020 11:40:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=AVbwnKns; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.236.82, mailfrom: leo.duran@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Iu4gAP6VzhZe2G4MF3nbwMo9CtLXqsmGcuR7xJVqQQDJ10n9hovNtWe1xGYd39GqIXcSWeDqsr8aIxiSnWDcx9ryVR/wTj6QK8DHiz60ylU4ybSUuMV0POCErNzP9QyYfAO8qBu07xFoHOEcYdwX2XB0B57RFyJvVCPzory4B/jdbiM8KBFUWzWYwYoPtka823MAT45U9VshqAg7XRZ5O4sNjpJk0RBhWiFIat9xZYly45+f3rhaV51NPZC9yAEdhzHtTqvulWie6FfQlS1d0TgQT2Gb1tzVrk2Pf7FNAhqU3stDWEDT1FsA8BUkTmA3zjQALK/nenLv8MyP2F13ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gAWROY++aGByz+ae2DQ5bAN0W2lZelpRggLV6jKlCv4=; b=ZyToynsBoySNezsiW2w/NNZlL/pAygfR8jlJ+SO+rC/SXhA0IsVBKmJFQFH6oErVLwS0XSmK3pUOekRLAbFf0IxjKEEtlsb3rD3djw70/alVc2YvrNQtVka230KhERtdO/zeQDqEJfh8+PJK84nLKDZM0kJ1OJWWmvz9nb+GCc4YxUcnLoISRBhGg24G7ksJ+eDQWv/NdN0+NRuKOpGQKJc2KX2tGDACDSFO+xDyyNDROkyBJcKiJFhQKFDTs4ITsuSa8+sx6Hmdh/M0EI2UJJuX798H2buzoddzHhWKbev4d7yC+T9thBTU8Lv6dAKUMCij2RZjIHPNfqIsWkOshA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gAWROY++aGByz+ae2DQ5bAN0W2lZelpRggLV6jKlCv4=; b=AVbwnKnsmJPWBnF75/+++c/vLrR0qkovUWIc96YJ2OhSH69kwEGgPd6VsgJ/oRk/Neq/i8xhjn+GlV13Td3pG3U6ndqlC5HMXY6Ce5h+6RIPPbsv7dJ+8BiZdyK40O/T91ppt3XOKeN16nbC6nb/XuwzZHSq280F87IwOFvwca4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=leo.duran@amd.com; Received: from BN6PR12MB1922.namprd12.prod.outlook.com (2603:10b6:404:106::14) by BN6PR12MB1410.namprd12.prod.outlook.com (2603:10b6:404:18::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2750.17; Tue, 25 Feb 2020 19:40:36 +0000 Received: from BN6PR12MB1922.namprd12.prod.outlook.com ([fe80::d931:1942:a6b5:d74c]) by BN6PR12MB1922.namprd12.prod.outlook.com ([fe80::d931:1942:a6b5:d74c%7]) with mapi id 15.20.2750.021; Tue, 25 Feb 2020 19:40:36 +0000 From: Leo Duran To: devel@edk2.groups.io Cc: Leo Duran , Eric Dong , Ray Ni , Laszlo Ersek Subject: [PATCH 1/2] UefiCpuPkg: LocalApicLib: Export StandardSignatureIsAuthenticAMD function Date: Tue, 25 Feb 2020 13:39:25 -0600 Message-Id: <1582659566-9893-2-git-send-email-leo.duran@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582659566-9893-1-git-send-email-leo.duran@amd.com> References: <1582659566-9893-1-git-send-email-leo.duran@amd.com> X-ClientProxiedBy: SN4PR0801CA0024.namprd08.prod.outlook.com (2603:10b6:803:29::34) To BN6PR12MB1922.namprd12.prod.outlook.com (2603:10b6:404:106::14) Return-Path: leo.duran@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from leduran-Precision-WorkStation-T5400.amd.com (165.204.78.2) by SN4PR0801CA0024.namprd08.prod.outlook.com (2603:10b6:803:29::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2750.17 via Frontend Transport; Tue, 25 Feb 2020 19:40:36 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d059e507-343b-428a-d8dd-08d7ba2a9602 X-MS-TrafficTypeDiagnostic: BN6PR12MB1410:|BN6PR12MB1410: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 0324C2C0E2 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6029001)(4636009)(346002)(39860400002)(396003)(376002)(366004)(136003)(189003)(199004)(6916009)(44832011)(8676002)(36756003)(26005)(956004)(478600001)(81166006)(66556008)(966005)(6486002)(4326008)(2616005)(81156014)(8936002)(16526019)(66476007)(86362001)(186003)(66946007)(316002)(7696005)(2906002)(54906003)(6666004)(52116002)(5660300002)(19627235002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR12MB1410;H:BN6PR12MB1922.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xhIJnJPSVvRgjdPaAapK3tQy5f2POy2ljD7dZcH1TS/btnxhptIV38tWw10gATGRkpWEHmwb2AStyaMfRzJMI+jsdCf5Rhv6Mn5MfY8/wF2FfzKXdgL8p5YKL9bQliV/a38J6pNNjpqe3vCpzO7zep880lOcRuyAL44ygV0IKt6Piklw0r/Q7IY4cTGIKAfc8ChR0g5F7htkbrxPoEQ2vSiSiVU61aJFx9Qn3wlwqNSAElZohcG03vcg7HEcXfzoCoBfAdthz4S6co6W0XTweaP7u4aQqs2YIGz7zjBxK+tQhlzO20hYzEBv0lPmaR44+gWEJt6GR5srvHvFP+wyDJRFFa7rU2fKl0Ld4nUjR8cOLiXTK8jl2yZAKqRaMXkIXYhBB4N1XHEveq//3rTa96c/y91Sl3DoRiQMUyPEDvXQJx9rmJgKASD3fw3ZAuHZdXX61jEZ6JTNGl9y18ubSq2Ep9B3xZBAbISmnhZAUWN/i0cwXnnBN9S9IEwYhT0KHa+DWCBWvyzAgmSy4xrVLA== X-MS-Exchange-AntiSpam-MessageData: HHEEECFW8DpE8JVlkEG2Mb3wmcAgJMHCRjH107Cu/wtcrLFoU22eHDeXGxQi8IkvvM32loeLkHUc/HB+7C3j2z1aNu2NH6RBxgrY9kB4AJlB4ss5pgOR98XM4VdXU5Z7y5i0RQAOLSFYGSm6nu1yuA== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d059e507-343b-428a-d8dd-08d7ba2a9602 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2020 19:40:36.6915 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oMXlbzcK8PpDvYUkwB5/+paxxGetrzQ+45ShV1z2m0n6tZEW5t2bWmpZ5E5n6bEl X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1410 Content-Type: text/plain REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2556 The StandardSignatureIsAuthenticAMD function was introduced locally to help divert code paths pertinent (or not) to AMD processors. This patch exports that function so that it may serve the same purpose in other modules that consume LocalApicLib. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Leo Duran --- UefiCpuPkg/Include/Library/LocalApicLib.h | 15 +++++++ UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 47 +++++++++++----------- .../BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 47 +++++++++++----------- 3 files changed, 63 insertions(+), 46 deletions(-) diff --git a/UefiCpuPkg/Include/Library/LocalApicLib.h b/UefiCpuPkg/Include/Library/LocalApicLib.h index 96b93aa..a6e9dc6 100644 --- a/UefiCpuPkg/Include/Library/LocalApicLib.h +++ b/UefiCpuPkg/Include/Library/LocalApicLib.h @@ -5,6 +5,8 @@ handles cases where local APIC is disabled. Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2020, AMD Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -16,6 +18,19 @@ #define LOCAL_APIC_MODE_X2APIC 0x2 ///< x2APIC mode. /** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ); + +/** Retrieve the base address of local APIC. @return The base address of local APIC. diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c index 33ea15c..cebf1b3 100644 --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c @@ -4,7 +4,7 @@ This local APIC library instance supports xAPIC mode only. Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Inc. All rights reserved.
+ Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -27,28 +27,6 @@ // /** - Determine if the standard CPU signature is "AuthenticAMD". - - @retval TRUE The CPU signature matches. - @retval FALSE The CPU signature does not match. - -**/ -BOOLEAN -StandardSignatureIsAuthenticAMD ( - VOID - ) -{ - UINT32 RegEbx; - UINT32 RegEcx; - UINT32 RegEdx; - - AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && - RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && - RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); -} - -/** Determine if the CPU supports the Local APIC Base Address MSR. @retval TRUE The CPU supports the Local APIC Base Address MSR. @@ -76,6 +54,29 @@ LocalApicBaseAddressMsrSupported ( } /** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ) +{ + UINT32 RegEbx; + UINT32 RegEcx; + UINT32 RegEdx; + + AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); + return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && + RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && + RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); +} + +/** Retrieve the base address of local APIC. @return The base address of local APIC. diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c index d0f92b3..01996b1 100644 --- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c @@ -5,7 +5,7 @@ which have xAPIC and x2APIC modes. Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Inc. All rights reserved.
+ Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -28,28 +28,6 @@ // /** - Determine if the standard CPU signature is "AuthenticAMD". - - @retval TRUE The CPU signature matches. - @retval FALSE The CPU signature does not match. - -**/ -BOOLEAN -StandardSignatureIsAuthenticAMD ( - VOID - ) -{ - UINT32 RegEbx; - UINT32 RegEcx; - UINT32 RegEdx; - - AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && - RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && - RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); -} - -/** Determine if the CPU supports the Local APIC Base Address MSR. @retval TRUE The CPU supports the Local APIC Base Address MSR. @@ -77,6 +55,29 @@ LocalApicBaseAddressMsrSupported ( } /** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ) +{ + UINT32 RegEbx; + UINT32 RegEcx; + UINT32 RegEdx; + + AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); + return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && + RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && + RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); +} + +/** Retrieve the base address of local APIC. @return The base address of local APIC. -- 2.7.4