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 252DB74004C for ; Thu, 2 Nov 2023 10:18:21 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=dckX4Y0f93CdMIhMUJRo4BcXvsWNUFg0S+UYbwBbkBk=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1698920299; v=1; b=V+26k9kJfJ5GPF/VK7ilpSAj9YeCGLzJFTOov8/76wluiPFrCgi5uedcuMHoWQ5vINwNG50T mARgCRSh42VasnbpcD6hmw7Nxz5OC5UeI1j9PBqvK/M1P6+vGUH9hew9TfKHPuTHAF7zYauHZh1 JuBTYRmrgLn0x2V673+rD92Y= X-Received: by 127.0.0.2 with SMTP id eK8wYY7687511x55gviUDSnQ; Thu, 02 Nov 2023 03:18:19 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.53]) by mx.groups.io with SMTP id smtpd.web11.27368.1698920299236091906 for ; Thu, 02 Nov 2023 03:18:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OBxC10e4SYfu15+LqsbG43ZMdeipC1yYGhWdgLXbtfvjzqfF/CHs9q3HSbB5z3LR5kJiVRlLTIM12hL8GjQWndG2q77nUhJe8XAf5uUHa7qIRvNjT/H6X/GnywEfHz2oAc6wuN0sFpPVvvDq+OLtPNmPs8HIN5ZN7SopCKI33Ea/jaAm9KmVPzRIE2T24QtH48BAAs46jNGuyJ1HgccWaa9FEtEi4vBrZPaGQ8YaHnoQw/nM0ESECZRy3RR0lWJYZPo6HK4k2Nori3cmOEZ8zpFLRtrDWNJ4o3JVIjUlEJlSGysrrJYsJcJtoZA3vqSirHfSiD7b+CWIAWYDmvBSaw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P+Gt7z3m0r5uo7YHxEQXgNYLSKvjeO8kCrNq7GN0aK8=; b=K23X3yUftDgd8gr43cYachSpEKPz2OEHrBYXpl8JtpECGUL4HI0scwEy6vyKeqFP1xTUBomDvaj+CN5+2LwWaUIy20BSzpeIGKAipyaqGw3jx/MiC9rX2u7uub+0hKrkzlRGdQ4rWYADOhfvQ/VFyUAr8j9S6YSlVMO10Vyv80q2b3s86UZopZIFem9iuunyaRZ5dSuH5VvkaN4WXPMMIyVWdKemsH0MXud2lUYmHS/kFNjXcR/PMqCmmrDZ8bffYUt8tb6j2qnAm8BsrjRqDxefnnP7+eub1ryWEPAyhYxmmDZvASVhd3tv73s2l+IMdxMfbIBWY5cTGbz5mEG8hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) X-Received: from BL1PR13CA0020.namprd13.prod.outlook.com (2603:10b6:208:256::25) by MW5PR12MB5623.namprd12.prod.outlook.com (2603:10b6:303:199::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.29; Thu, 2 Nov 2023 10:18:15 +0000 X-Received: from BL6PEPF0001AB53.namprd02.prod.outlook.com (2603:10b6:208:256:cafe::b0) by BL1PR13CA0020.outlook.office365.com (2603:10b6:208:256::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Thu, 2 Nov 2023 10:18:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.118.232) by BL6PEPF0001AB53.mail.protection.outlook.com (10.167.241.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Thu, 2 Nov 2023 10:18:14 +0000 X-Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 2 Nov 2023 03:17:59 -0700 X-Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 2 Nov 2023 03:17:58 -0700 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Thu, 2 Nov 2023 03:17:57 -0700 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH 2/2] RedfishClientPkg/RedfishFeatureCoreDxe: notify platform before reboot. Date: Thu, 2 Nov 2023 18:17:56 +0800 Message-ID: <20231102101756.13907-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB53:EE_|MW5PR12MB5623:EE_ X-MS-Office365-Filtering-Correlation-Id: 6600d54e-8bef-413b-97ea-08dbdb8d0656 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: Ipqjz1shCG3GHwB4W+I21UZ9gJPzC7zEke7nqHv/lG2MIuZ44BATk0jfSs3kYn+FE9nCSTDc2OHpPgou2MaEJakvQya9HhymBoCdu/xqHwTNME/ZOT20ZYcG8MxxBAw/kGToGX1PHRWP0zR6BqwkQhHgOs0OF+Yd9ePZydQeB5ejEsgd75yVNA6FV8LUdH6/cZ9FsEx8+P50G5afrv1I44VxUpv/Zm0iKVJ2hHhDm6Kj0t73/XleKmN14VrSSE4LZRSf06SdI+sL8y0NvuWawEsbiAjkHGzEofOEFFK0M6k3ETWzPbGUhg1StxpfqMTXHPuqD+z9aAKAifFLvNGPbgyOs1PrsIURrzO/KAR5wedP4iV0KK2KlWUoofSmAXvzE9WcsB974oRj5ELTFfVJlBqQl5lKYfhxcNF6KFxjkzbAlhIjumjNLmpGvwwFlCqVQyfFemON8hz+Zv/maqitcv20WQxPWJF4PMyAaeucKWmoy2Qw4npqCAoJHWES1flbXoGqiO29gMTkFyTWn//gRAnFW6RqU/D2YZdOq2hex+xSF3OQdq/sIaF2UwLVti5mhIeT/MlkEga4FSA4lR9i/peWgl0fFLWy2MLuLSNz/YNWZG/nPOVqB13XebaZ436BuBkAJ7TooWhxihsUE7cDWrMqLdK76RJqktvw06oOhxrSYRRVmx2ANowp++pUD3XSNm7vJiP00rAJRI9qQReAhVLSSM8JkCczrU83+NOmh9EjYNIsy6eBXNyvRqakbeUD X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2023 10:18:14.4392 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6600d54e-8bef-413b-97ea-08dbdb8d0656 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB53.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR12MB5623 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 Reply-To: devel@edk2.groups.io,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: f4dQZqB46iiysIQEWMFrwk0Ix7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Spam-Flag: yes X-Spam-Level: ************ X-GND-Spam-Score: 190 X-GND-Status: SPAM Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=V+26k9kJ; dmarc=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; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Call Redfish override protocol to notify platform that the Redfish changes system settings and about to perform system reboot. Platform firmware can do platform specific operation before system rebooted. To follow platform policy, platform can reject system reboot by returning error status and Redfish feature core driver will abort system reboot. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- .../RedfishFeatureCoreDxe.inf | 1 + .../RedfishFeatureCoreDxe.h | 1 + .../RedfishFeatureCoreDxe.c | 25 +++++++++++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.i= nf b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf index c67525ee..320eddc9 100644 --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf @@ -47,6 +47,7 @@ =20 [Protocols] gEdkIIRedfishFeatureProtocolGuid ## BY_START + gEdkiiRedfishOverrideProtocolGuid ## CONSUMED =20 [Pcd] gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEv= entGuid diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h= b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h index a94c7930..93139af2 100644 --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h @@ -12,6 +12,7 @@ #define EDKII_REDFISH_FEATURE_CORE_DXE_H_ =20 #include +#include =20 #include #include diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c= b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c index d9aa6e1a..e2ae125f 100644 --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c @@ -242,11 +242,14 @@ RedfishFeatureDriverStartup ( IN VOID *Context ) { + EFI_STATUS Status; REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext; UINT16 RebootTimeout; + EDKII_REDFISH_OVERRIDE_PROTOCOL *RedfishOverride; =20 - StartupContext =3D (REDFISH_FEATURE_STARTUP_CONTEXT *)Context; - RebootTimeout =3D PcdGet16 (PcdRedfishSystemRebootTimeout); + RedfishOverride =3D NULL; + StartupContext =3D (REDFISH_FEATURE_STARTUP_CONTEXT *)Context; + RebootTimeout =3D PcdGet16 (PcdRedfishSystemRebootTimeout); // // Invoke EDK2 Redfish feature driver callback to start up // the Redfish operations. @@ -290,6 +293,24 @@ RedfishFeatureDriverStartup ( if (PcdGetBool (PcdRedfishSystemRebootRequired)) { Print (L"System configuration is changed from RESTful interface. Reboo= t system in %d seconds...\n", RebootTimeout); gBS->Stall (RebootTimeout * 1000000U); + + // + // Call override protocol to notify platform that Redfish is processed + // and about to reboot system. + // + Status =3D gBS->LocateProtocol ( + &gEdkiiRedfishOverrideProtocolGuid, + NULL, + (VOID **)&RedfishOverride + ); + if (!EFI_ERROR (Status)) { + Status =3D RedfishOverride->NotifyPhase (RedfishOverride, EdkiiRedfi= shPhaseBeforeReboot); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: abort the reboot because NotifyPhase() r= eturns failure: %r\n", __func__, Status)); + return; + } + } + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); CpuDeadLoop (); } --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110512): https://edk2.groups.io/g/devel/message/110512 Mute This Topic: https://groups.io/mt/102338708/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-