From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (NAM02-CY1-obe.outbound.protection.outlook.com [40.107.76.49]) by mx.groups.io with SMTP id smtpd.web12.14623.1574285582623179180 for ; Wed, 20 Nov 2019 13:33:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=XLi98S6c; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.76.49, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NdLZ8hUfHXrgQWEVgZSrSEWJbgP79VYwGSJSx5HVIoJGAdpmC3BHXzKggTAGu5rKyj8rl3qOzFPvXPlI073IgaQDkGTA5tqANNf6kC8vui5HRk83ZckytV+uQgAcJv+qWa1I2jVQWnkvONtQyS8vjM6gTmOjwHhuKmB9emlVOpp1ObD+VvKVXpqFs+51ge3KRHvpbj6gaYFeQG5cGdifQ2/zxaK/fy5JBx5/Bpu/KjuWjZFef5CDSrXDwTvTWjPhu3IxH/qDnKBykC0yme8o24EyukEVbMJiGHxdKn7dKyGUnyonCKm0pOJhuttXLjhnDCJaKovGQBaXuRt3qhZoxw== 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=woD72b/pX1vrpuq6dAApmimEN12wPywWUAJM876wrh4=; b=g81RcTZ1Vcp9k/p6Hb0R5i2Jv4lGea7xRbFi9H1wi8yTw86fv4extJ1E5wOMuiYgfKLNd44qpuFC47yDjUqFkJugqMGubeZl5nYnTw4xIQtgSZEHfGpDJqh+9PDQHirNu9k5vUfiKTIrPVlEpbOFjPBGhtmc51+lJMeyHKrMbQtbngKDvFAt5Fk/aLBcKpqDFVXbgtaGESXWMIv5m0tyGQIoNwatHrBmeb91wWb7Cp9QmngoWp8kDDckYP6NlGGjvPKb8M8RvJaEyAi5kV4/aZGFweg+U3NediLUvu79SZBIgCLlbvcQuLsfR7SNFIuRCvC0ndy11MUcRim1Y//oRA== 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=woD72b/pX1vrpuq6dAApmimEN12wPywWUAJM876wrh4=; b=XLi98S6cXnp4RDRj+iHB2Qjf7580/1jdLCnNHH+yixZBnZzwCQIzbYcea+Vlo37o05xx7MHMm2tz1gozNHNJA9XG8r48knX5eW4q2ahT+KxiEBPB6KIDoqjEFJ1Wnkwa1eyVlnJ7E37jLv6TuF69Sq76gwN1kXT8TfTchwjNW1Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.71.154) by DM6PR12MB3723.namprd12.prod.outlook.com (10.255.172.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Wed, 20 Nov 2019 21:33:00 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::dd0c:8e53:4913:8ef4]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::dd0c:8e53:4913:8ef4%5]) with mapi id 15.20.2451.031; Wed, 20 Nov 2019 21:33:00 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Subject: [RFC PATCH v3 40/43] UefiCpuPkg/MpInitLib: Add MP finalization interface to MpInitLib Date: Wed, 20 Nov 2019 15:32:46 -0600 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN1PR12CA0065.namprd12.prod.outlook.com (2603:10b6:802:20::36) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bd3e70bc-cdc6-46cf-1b7f-08d76e0137c3 X-MS-TrafficTypeDiagnostic: DM6PR12MB3723: X-MS-Exchange-PUrlCount: 1 X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 02272225C5 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6029001)(4636009)(39860400002)(346002)(366004)(136003)(396003)(376002)(189003)(199004)(76176011)(2616005)(6916009)(305945005)(2351001)(36756003)(81166006)(81156014)(8676002)(8936002)(47776003)(50226002)(2361001)(7736002)(118296001)(66066001)(316002)(16586007)(50466002)(99286004)(386003)(6506007)(26005)(48376002)(186003)(52116002)(51416003)(476003)(486006)(11346002)(446003)(66946007)(66476007)(66556008)(3846002)(6666004)(6116002)(6486002)(2906002)(25786009)(14454004)(966005)(478600001)(6512007)(6306002)(6436002)(5660300002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3723;H:DM6PR12MB3163.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: zq+jJPLbVU2MhI7MqfyzLHJXZfWrpFJtdNG1si73vgikAMWaFRkNcT7FiAf36wAwOmr2lCsEybsHrKP7n0gKgqj10M1PACQ8wtyU7VeR/XpklqYq1Li1PSBWSNO8y66tRW82r79+j+WQJZkbaiVS/MefhfTYsHhL/+RUUqeF8xu2iGs81eivXGj9F3HPP1zks8ItzK+w1FiC8eENQM3/t+0m1MAkhvbctvXGRVLoj6V6fcu7H+CPUz39DI+/h7hqgBHUm9B/b0IiL/QN8NErZqAHeKTywMIuumb1tAir2bqyzT2mqmTJ7H7hFgD3n2t+GqpOax+DRofJ2mbOvS8Gi37NuJTT69iMBU6at/CqAGpiJuaGjs4xpXhjLA2MiNOyHaedBHDjcz9quAAVHEdhhEii7m97lOrgxH6TmJWUqCZaeImFQtAqSK4o4D+KibyIC/AKEbvWE6ufgirDGkxcpEEviyzpgY9krPu6BGQpLB0= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd3e70bc-cdc6-46cf-1b7f-08d76e0137c3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2019 21:33:00.8629 (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: JMN8ph3ki/ZTdBUXGt8F36IVqv6k/bY4mXlAjwR2IHOZ10P2sUy7SYWJBtTNnTuECYEsPybBKouvPadp5rphoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3723 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 Provide an MP finalization function that can be called from the CPU protocol finalization function. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Tom Lendacky --- UefiCpuPkg/Include/Library/MpInitLib.h | 14 ++++++++++++++ UefiCpuPkg/Library/MpInitLib/MpLib.h | 11 +++++++++++ UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 18 ++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++++++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 16 ++++++++++++++++ 5 files changed, 82 insertions(+) diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h b/UefiCpuPkg/Include/Library/MpInitLib.h index 31eb227f1209..f9beeefca78e 100644 --- a/UefiCpuPkg/Include/Library/MpInitLib.h +++ b/UefiCpuPkg/Include/Library/MpInitLib.h @@ -378,4 +378,18 @@ MpInitLibStartupAllCPUs ( IN VOID *ProcedureArgument OPTIONAL ); +/** + This service allows users of MpLib to make any finalization changes + before transferring control out of UEFI + + @retval EFI_SUCCESS MP initialization succeeds. + @retval Others MP initialization fails. + +**/ +EFI_STATUS +EFIAPI +MpLibFinalize ( + VOID + ); + #endif diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h index 445ec2e950a9..22cf798c017d 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -655,5 +655,16 @@ EnableDebugAgent ( VOID ); +/** + Perform MpLib finalization before transferring control out of UEFI + + @param[in] CpuMpData The pointer to CPU MP Data structure. + +**/ +EFI_STATUS +MpFinalize ( + IN CPU_MP_DATA *CpuMpData + ); + #endif diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c index 8df5b6d919e6..16603ef3f20e 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -884,3 +884,21 @@ MpInitLibEnableDisableAP ( return Status; } + +/** + MP finalization + + @param[in] CpuMpData The pointer to CPU MP Data structure. +**/ +EFI_STATUS +MpFinalize ( + IN CPU_MP_DATA *CpuMpData + ) +{ + // + // DXE phase will do this transition, but just return EFI_SUCCESS for now. + // + return EFI_SUCCESS; +} + + diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index 817fbe85dd7d..63df349b0c92 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1800,6 +1800,29 @@ CheckAllAPs ( return EFI_NOT_READY; } +/** + MP finalization + + This service allows users of MpLib to make any finalization changes + before transferring control out of UEFI. + + This service must be invoked before exiting boot services. + + @retval EFI_SUCCESS MP finalization succeeds. + +**/ +EFI_STATUS +EFIAPI +MpLibFinalize ( + VOID + ) +{ + CPU_MP_DATA *CpuMpData; + + CpuMpData = GetCpuMpData (); + return MpFinalize (CpuMpData); +} + /** MP Initialize Library initialization. diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c index 56956a615b6b..793d26b1bf12 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c @@ -604,4 +604,20 @@ MpInitLibEnableDisableAP ( return EnableDisableApWorker (ProcessorNumber, EnableAP, HealthFlag); } +/** + MP finalization + + @param[in] CpuMpData The pointer to CPU MP Data structure. +**/ +EFI_STATUS +MpFinalize ( + IN CPU_MP_DATA *CpuMpData + ) +{ + // + // PEI phase shouldn't do such a transition. So simply return EFI_SUCCESS. + // + return EFI_SUCCESS; +} + -- 2.17.1