From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id CF53A940F91 for ; Mon, 22 Apr 2024 02:24:38 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Cw3Bh9SlyVsijwKfBo1f1KPEp6Sz2cQabcmpOcbQEYI=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1713752677; v=1; b=lPBTDdTdiUnMM9hEX4MBepo8J/60j0jA72ix83gdxYajZGliayYzNiOphrucmWgayVdM07ZM 5uhCmgGvl6p+Sy3HtFPKGrb3ZIRAQVJK+TQ6uMNLBQb5GsuWvJU9XLdew3os8yfsGW4JIBkzqvD s5IRJJOYlAh0GaWljX1N0csj8Et2xWrrzgv3ayCCc+TaR9eVZDm3QHgmX5OdFnrk+RTmgwPhTg5 HkhZvmPXcPl6ckESL5LXR3BYLmnWrVTTxtJ7B40o5YD+1qUYKoeZdR0YM+4m/KtOEp07e6QwdAD ZfIjLc5iFiIbDbPltWns4R+MylD+FVQkDc2RHQlN1XfOg== X-Received: by 127.0.0.2 with SMTP id M5JkYY7687511xsebwnSVSf2; Sun, 21 Apr 2024 19:24:37 -0700 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.68]) by mx.groups.io with SMTP id smtpd.web10.9384.1713752676173530829 for ; Sun, 21 Apr 2024 19:24:36 -0700 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) by PH7PR12MB9223.namprd12.prod.outlook.com (2603:10b6:510:2f2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 02:24:30 +0000 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::e006:4173:de2c:aca0]) by LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::e006:4173:de2c:aca0%5]) with mapi id 15.20.7409.042; Mon, 22 Apr 2024 02:24:30 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: introduce RedfishBootstrapAccountDxe Thread-Topic: [edk2-redfish-client][PATCH] RedfishClientPkg: introduce RedfishBootstrapAccountDxe Thread-Index: AQHakYvahXCxgTyFuk+EKdJSQR7xS7FzkWuw Date: Mon, 22 Apr 2024 02:24:30 +0000 Message-ID: References: <20240418122730.18204-1-nicklew@nvidia.com> In-Reply-To: <20240418122730.18204-1-nicklew@nvidia.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=02042108-8add-4e61-9fed-ea197e2b5c86;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2024-04-22T02:10:33Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|PH7PR12MB9223:EE_ x-ms-office365-filtering-correlation-id: 164985df-9a6a-4073-2ded-08dc6273577c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?YdU/uPpE12S1wuwhabAkmRGqZ+u/NablLweir9fbJvcI3GL5dkcF3C7HtmHL?= =?us-ascii?Q?cBn6PVcGgRPuY8IXlMD+f2IUx8873d5Rx34Bnl01jm7odFpRIV5hch5RbkbI?= =?us-ascii?Q?bdEMqE2zKoasqAuBSwS4HO4XicTw5nGqRpPZHr16mUi2wJfSli5gNsjVeUj2?= =?us-ascii?Q?27Or0T9ujmOl9iFJuTN65/bUEz/7kcRCb8XwBPjk229O+VB0SA2JJ6AiN/Wi?= =?us-ascii?Q?YXqrYqtfyCnCOwBYnlPmFjGoD7mI9bC0K4atuw4ZYI4ihl7CZs4WBKy8m+qv?= =?us-ascii?Q?juPcs6dOk5kTgz4pCbaRso5B8i16JJCGurQlc8QqDJ85SCuszm8EUaBpBiNO?= =?us-ascii?Q?KSQv1dgLkTQ9XzqYPJCE3EX7oWrxDlMicyerBcEWj9U2iJKd6PHp5IDNo8/1?= =?us-ascii?Q?RvFEJg77UxHjMb2IZ6X6vDJIxxhzEPMnRi/oMG5Y+NKrcl5/BHWJp2sJ+AuN?= =?us-ascii?Q?Xy7f48x2pUqgHjd27I5/lLIsnMFyWWPosiZZkp26MHL+sYxw6m2vbiLJloQE?= =?us-ascii?Q?51u5NyblYo0SXdwUhHosarACG5oXK3AN00OVFs0XSbQAZj6wN+B6TSE5Pamn?= =?us-ascii?Q?Y3jPqIo/V/WlHSpXKMqxUUg7tuQCw1cm70zIWg3ehV1AY7SBx7x0A7/uAI+Y?= =?us-ascii?Q?23lMrPzW6ZFR/e+HZ+QCcbzBKndeGjbnmlFFjVgAbBFJF58LOBMVSgwnpzwd?= =?us-ascii?Q?ZKhvIXlIs0wPFBn5lkFeswyV/RC+b+dJBbjanjyQxLvYsj4usDhFn/sgtO+D?= =?us-ascii?Q?5Sj6rseugVQUhPVQFUhfTlJZqaEE557ACNqKfkWkt5fGRzCS5dK0ye6qN/eu?= =?us-ascii?Q?UGQ3kWaGnRAyYPd4gif4JsGetk/VQN6WyiWBkBmsaJVhr9n4yforh+R+Cr8h?= =?us-ascii?Q?3AqnmgDFFUfMdJ2XGp5RtvSN3sESBhixwkf4xB1F/bJinD0u7lmIsfXffhtK?= =?us-ascii?Q?r2/R7b6w/ACSgk+TLMEnInr0uCbbPcCQAHNwdkwgKF4NUbA4m/MyFQboJUwf?= =?us-ascii?Q?M93g1CIQZpX9HqSr4U8SvZtFzfDgAQPu+xUT+ZvjEIZJLHtZOc1r7cYMZEk8?= =?us-ascii?Q?7r3Fn6hPc2i6mTlL3HYbrSkaXBBCpKIjSMYVXER0W2dSNWGYOpA0+IhoCCX/?= =?us-ascii?Q?/JllPLc37i4Z7wXaw1sp1wPN1H21HviY5So5h9KtkSy+2XSCE4JzA0SkBxgO?= =?us-ascii?Q?K/diNXP4WddSdK8kuKJfJEwd6kdXpiweOCefzYfEk36J4Vd0ZhoYH4WRvv79?= =?us-ascii?Q?BEKuEzS1aOiKJwFpPRd/Xg+JVhgI1s+b6gms05DDEZ91ds9vVkH/XlsE4bLy?= =?us-ascii?Q?v/jVnm+5P29MvWBSFlQPBZZCzhAcgvg721HwONTs3ZNftg=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?el8Bw3nma8r8jdwGri86JAPstdcS0/YBo6hEuVbxMJcCCZn9O6piyMIyajVb?= =?us-ascii?Q?L7IC8puISG7anmrSgRecNeQHeQoKaYgGjYk399cfKti7eMpCwBHYizMwitHK?= =?us-ascii?Q?JW9IhHIA4OLofZmZicslc9KBjWUmGrpgazeW8k+hcr1aAVyW8uboQhEjfrAF?= =?us-ascii?Q?MB9mXd5/mb8vxN31CmFVHC1M3fKReX3Y5wUwrsHSMGV/MOOIICzt05N//iFa?= =?us-ascii?Q?uA8yvZmZvojSvUF0Ohii76GUiF0EEexP8o6iDEn8WcZbsnSxWwpe2apUk/WF?= =?us-ascii?Q?X66+COmb4yFhKZf57bTTunuZkZ25mXWVCYcdXo0gXp/0W2dmkRzjF2LHh9EV?= =?us-ascii?Q?VG0Xk3VyBauql6m9oPVmAseDvgV/f5H696ozhNPmvVTLzfLqdE5ZfKbViQGX?= =?us-ascii?Q?b069Y0W1G4H0nH8BQuH/8VGg7/rniOrTzf2TkK0hybrwhyN4V+B5yfIXo2V4?= =?us-ascii?Q?hrc3Xv4oqruRWh3/sZjTW4xOWW44o9GGoRZdqUx0aC4ETSXblAeMQ6iSbvHc?= =?us-ascii?Q?SzzIYbsZGWYmR+Bsba4gr+yKimv54q64u9+cbUsfmXawyt9piVTUdSqY0bha?= =?us-ascii?Q?cIKxMhzU0HFhwKHZoFdbpM65CJ7y4tE3MwPh/tsufGw3hb1GqyNI0Euujjt6?= =?us-ascii?Q?naKIQ6whSalb3R+rGJzyuRReFQJA5XywGkaJ8MM0vItZLvMbGZRVcaMLh+Dj?= =?us-ascii?Q?wWfTRmcpOo3Gg7BUqp4or9WgHxoyRZMz8HdLGxfmCuwGCNKZ1sBnHMgFIjkD?= =?us-ascii?Q?MrXwaj9hcVkzJawDKGmV1pzqk3YvFCg6b86nhoWIrJNvw7v0ytIyWE3ipkLX?= =?us-ascii?Q?RpastJg3Jqri16lOxx8n+xPkXj2gmLx3r9DQYWvb+vfysKOjUbznsv3nkm2z?= =?us-ascii?Q?yayui2+8+ymCoArO+HuQTvUPmSuBv3oEhvtW2pTMzyHjzpQumT67QbL71KTk?= =?us-ascii?Q?MUeFL6CioMLYnURnbfKffRTzQLM0VjgRQz3VGDaFyXbYTy+Fq4YOzhBP2cZ6?= =?us-ascii?Q?K+f7hWwOtagdJcTsqjZIz8LnUEhDBJJHE+cAwgEJgmW6uddbl8fZlI0ebBWT?= =?us-ascii?Q?q4wIKirF2aAA+O52XgxhXR9ffeNctoos0LBKloySepAoaD8zehvmtyFwZEWK?= =?us-ascii?Q?xrGRueusC0FxAG9pTW/lUB2/VSHsrxkTVfrXd28GKMtp1ra8BVvBXUmcjvJy?= =?us-ascii?Q?GmEF7aoX9d4qRihm3CRV0T/ZkhZhLzVe6bKFt110/Bz8sQATa6727LXFEuLD?= =?us-ascii?Q?RGTLUtVSkmyzVqAOWSjtk3bM1G9u2TANBlSld35JZWQf8xAayYi1MN7npTKH?= =?us-ascii?Q?mPLwBAyPcQSD19zbJiWSIcRlTH8yp6DjwKyOwgoH86aclRdArA2D2UHb11XL?= =?us-ascii?Q?eDS86IjOsBOxJr5osr21/Rap/N3+JB51n9+ar2gckjzoWS0nLV4CnjbPsylY?= =?us-ascii?Q?Ed3EH/uAuj/No73jQs2Qv27tQ45aei7Flqfa6pX2/mRHrW/RhGXP++l4xnnA?= =?us-ascii?Q?Ef5E/n3IEgMe2kYdwjtMBOH4LNrTyIh37v7lXWse3hjFW1mLlzZYg0N18Fmo?= =?us-ascii?Q?CqBtEWY8fsdrWWFMiP8=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9452.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 164985df-9a6a-4073-2ded-08dc6273577c X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2024 02:24:30.7841 (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: /Y7qhZpoXGSj//NI68p+yktRO2+vgmWejemU3RO1Gs01vOv1uOlvHuYeZ6X9zoh5K9Hm251CHdwfNjUEeZ4KYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9223 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, 21 Apr 2024 19:24:36 -0700 Resent-From: abner.chang@amd.com Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: nMM7FjINQMJMTMDa3y9IXPhHx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=lPBTDdTd; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - General] Hi Nickle, One comment and few questions, > -----Original Message----- > From: Nickle Wang > Sent: Thursday, April 18, 2024 8:28 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: introduce > RedfishBootstrapAccountDxe > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > -Introduce RedfishBootstrapAccountDxe to delete bootstrap > account from /redfish/v1/AccountService/Accounts after BIOS > finished all Redfish jobs. The bootstrap account won't be > available to other application. So deleting bootstrap account > helps to release resource at BMC. > - After bootstrap account is deleted at BMC, the Redfish service > instance is no longer usable. Close Redfish service instance to > release the HTTP connection between BIOS and BMC. > > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > .../RedfishClientComponents.dsc.inc | 1 + > .../RedfishBootstrapAccountDxe.inf | 53 +++ > .../RedfishBootstrapAccountDxe.h | 58 ++++ > .../RedfishBootstrapAccountDxe.c | 328 ++++++++++++++++++ > RedfishClientPkg/RedfishClient.fdf.inc | 1 + > 5 files changed, 441 insertions(+) > create mode 100644 > RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in= f > create mode 100644 > RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.h > create mode 100644 > RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.c > > diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc > b/RedfishClientPkg/RedfishClientComponents.dsc.inc > index 42fc0c299..fe5248b62 100644 > --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc > +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc > @@ -20,6 +20,7 @@ > RedfishClientPkg/HiiToRedfishMemoryDxe/HiiToRedfishMemoryDxe.inf > RedfishClientPkg/HiiToRedfishBootDxe/HiiToRedfishBootDxe.inf > RedfishClientPkg/HiiToRedfishBiosDxe/HiiToRedfishBiosDxe.inf > + > RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in= f > !endif > # > # Below two modules should be pulled in by build tool. > diff --git > a/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= in > f > b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= in > f > new file mode 100644 > index 000000000..4073e95f4 > --- /dev/null > +++ > b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= in > f > @@ -0,0 +1,53 @@ > +## @file > +# This driver deletes bootstrap account in BMC after BIOS Redfish finis= hed > +# all jobs > +# > +# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reser= ved. Not sure if you want to update the copyright to 2024. > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x0001000b > + BASE_NAME =3D RedfishBootstrapAccountDxe > + FILE_GUID =3D 87555253-2F7E-45FC-B469-FD35B2E51210 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + ENTRY_POINT =3D RedfishBootstrapAccountEntryPoint > + UNLOAD_IMAGE =3D RedfishBootstrapAccountUnload > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + RedfishPkg/RedfishPkg.dec > + RedfishClientPkg/RedfishClientPkg.dec > + > +[Sources] > + RedfishBootstrapAccountDxe.h > + RedfishBootstrapAccountDxe.c > + > +[LibraryClasses] > + BaseLib > + BaseMemoryLib > + DebugLib > + MemoryAllocationLib > + PrintLib > + RedfishEventLib > + RedfishFeatureUtilityLib > + RedfishDebugLib > + RedfishVersionLib > + RedfishHttpLib > + UefiLib > + UefiBootServicesTableLib > + UefiRuntimeServicesTableLib > + UefiDriverEntryPoint > + > +[Protocols] > + gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMES ## > + gEdkIIRedfishCredentialProtocolGuid ## CONSUMES ## > + gEfiRestExProtocolGuid ## CONSUMES ## > + > +[Depex] > + gEdkIIRedfishCredentialProtocolGuid > diff --git > a/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= h > b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= h > new file mode 100644 > index 000000000..5262f1e6b > --- /dev/null > +++ > b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= h > @@ -0,0 +1,58 @@ > +/** @file > + Common header file for RedfishBootstrapAccountDxe driver. > + > + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REDFISH_BOOTSTRAP_ACCOUNT_DXE_H_ > +#define REDFISH_BOOTSTRAP_ACCOUNT_DXE_H_ > + > +#include > +#include > + > +// > +// Libraries > +// > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#define REDFISH_BOOTSTRAP_ACCOUNT_DEBUG DEBUG_VERBOSE > +#define REDFISH_MANAGER_ACCOUNT_COLLECTION_URI > L"AccountService/Accounts" > +#define REDFISH_URI_LENGTH 128 > + > +// > +// Definitions of REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE > +// > +typedef struct { > + EFI_HANDLE ImageHandle; > + EFI_HANDLE RestExHandle; > + REDFISH_SERVICE RedfishService; > + EFI_EVENT RedfishEvent; > + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL Protocol; > +} REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE; > + > +#define REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE_FROM_PROTOCOL(This) \ > + BASE_CR ((This), REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE, Protocol) > + > +#endif > diff --git > a/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= c > b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= c > new file mode 100644 > index 000000000..6fe4856f8 > --- /dev/null > +++ > b/RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.= c > @@ -0,0 +1,328 @@ > +/** @file > + This driver deletes bootstrap account in BMC after BIOS Redfish finish= ed > + all jobs. > + > + (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. > + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "RedfishBootstrapAccountDxe.h" > + > +REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE *mBootstrapPrivate =3D NULL; > + > +/** > + Close Redfish service instance by calling RestEx protocol to release i= nstance. > + > + @param[in] RestExHandle Handle of RestEx protocol. > + > + @retval EFI_SUCCESS The Redfish service is closed successful= ly. > + @retval EFI_INVALID_PARAMETER RestExHandle is NULL. > + @retval Others Error occurs. > + > +**/ > +EFI_STATUS > +CloseRedfishService ( > + IN EFI_HANDLE RestExHandle > + ) > +{ > + EFI_REST_EX_PROTOCOL *RestEx; > + EFI_STATUS Status; > + > + if (RestExHandle =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + Status =3D gBS->HandleProtocol ( > + RestExHandle, > + &gEfiRestExProtocolGuid, > + (VOID **)&RestEx > + ); > + if (!EFI_ERROR (Status)) { > + Status =3D RestEx->Configure (RestEx, NULL); > + DEBUG ((REDFISH_BOOTSTRAP_ACCOUNT_DEBUG, "%a: release RestEx > instance: %r\n", __func__, Status)); > + } > + > + return Status; > +} > + > +/** > + Callback function executed when the AfterProvisioning event group is > signaled. > + > + @param[in] Event Event whose notification function is being invok= ed. > + @param[out] Context Pointer to the Context buffer > + > +**/ > +VOID > +EFIAPI > +RedfishBootstrapAccountOnRedfishAfterProvisioning ( > + IN EFI_EVENT Event, > + OUT VOID *Context > + ) > +{ > + EFI_STATUS Status; > + REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE *Private; > + EDKII_REDFISH_CREDENTIAL_PROTOCOL *credentialProtocol; > + EDKII_REDFISH_AUTH_METHOD AuthMethod; > + CHAR8 *AccountName; > + CHAR8 *AccountCredential; > + CHAR16 TargetUri[REDFISH_URI_LENGTH]; > + CHAR16 *RedfishVersion; > + REDFISH_RESPONSE RedfishResponse; > + > + RedfishVersion =3D NULL; > + > + Private =3D (REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE *)Context; > + if ((Private =3D=3D NULL) || (Private->RedfishService =3D=3D NULL)) { > + DEBUG ((DEBUG_ERROR, "%a: Redfish service is not available\n", > __func__)); > + return; > + } > + > + // > + // Locate Redfish Credential Protocol to get credential for > + // accessing to Redfish service. > + // > + Status =3D gBS->LocateProtocol ( > + &gEdkIIRedfishCredentialProtocolGuid, > + NULL, > + (VOID **)&credentialProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((REDFISH_BOOTSTRAP_ACCOUNT_DEBUG, "%a: No Redfish > Credential Protocol is installed on system.", __func__)); > + return; > + } > + > + Status =3D credentialProtocol->GetAuthInfo ( > + credentialProtocol, > + &AuthMethod, > + &AccountName, > + &AccountCredential > + ); HI Nickle, I am not quite understand why do we acquire a credential here bu= t delete it from the Redfish account service here after provision. 1. We suppose acquire the credential before we start to communicate with Re= dfish. Will Redfish credential driver create another bootstrap account here= after provisioning? 2. And why do we delete the credential after provisioning? How about the la= ter Redfish property updating process? Or do I misunderstand the code logic? Regards, Abner > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: can not get bootstrap account information: > %r\n", __func__, Status)); > + return; > + } > + > + // > + // Carving the URI > + // > + RedfishVersion =3D RedfishGetVersion (Private->RedfishService); > + if (RedfishVersion =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "%a: can not get Redfish version\n", __func__))= ; > + return; > + } > + > + UnicodeSPrint (TargetUri, (sizeof (CHAR16) * REDFISH_URI_LENGTH), > L"%s%s/%a", RedfishVersion, REDFISH_MANAGER_ACCOUNT_COLLECTION_URI, > AccountName); > + > + DEBUG ((REDFISH_BOOTSTRAP_ACCOUNT_DEBUG, "%a: bootstrap account: > %a\n", __func__, AccountName)); > + DEBUG ((REDFISH_BOOTSTRAP_ACCOUNT_DEBUG, "%a: bootstrap > credential: %a\n", __func__, AccountCredential)); > + DEBUG ((REDFISH_BOOTSTRAP_ACCOUNT_DEBUG, "%a: bootstrap URI: > %s\n", __func__, TargetUri)); > + > + // > + // Remove bootstrap account at /redfish/v1/AccountService/Account > + // > + ZeroMem (&RedfishResponse, sizeof (REDFISH_RESPONSE)); > + Status =3D RedfishHttpDeleteResource ( > + Private->RedfishService, > + TargetUri, > + &RedfishResponse > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: can not remove bootstrap account at BMC: > %r", __func__, Status)); > + DumpRedfishResponse (__func__, DEBUG_ERROR, &RedfishResponse); > + } else { > + DEBUG ((REDFISH_BOOTSTRAP_ACCOUNT_DEBUG, "%a: bootstrap account: > %a is removed from: %s\n", __func__, AccountName, > REDFISH_MANAGER_ACCOUNT_COLLECTION_URI)); > + } > + > + // > + // Clean credential > + // > + ZeroMem (AccountName, AsciiStrSize (AccountName)); > + ZeroMem (AccountCredential, AsciiStrSize (AccountCredential)); > + > + // > + // Since the bootstrap account is deleted at BMC, the Redfish service = instance > is no longer usable. > + // Close Redfish service instance to release the HTTP connection betwe= en > BIOS and BMC. > + // > + Status =3D CloseRedfishService (Private->RestExHandle); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: cannot close Redfish service instance: %r\= n", > __func__, Status)); > + } > + > + RedfishHttpFreeResponse (&RedfishResponse); > + > + return; > +} > + > +/** > + Initialize a Redfish configure handler. > + > + This function will be called by the Redfish config driver to initializ= e each > Redfish configure > + handler. > + > + @param[in] This Pointer to > EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL instance. > + @param[in] RedfishConfigServiceInfo Redfish service informaiton. > + > + @retval EFI_SUCCESS The handler has been initialized = successfully. > + @retval EFI_DEVICE_ERROR Failed to create or configure the= REST EX > protocol instance. > + @retval EFI_ALREADY_STARTED This handler has already been > initialized. > + @retval Other Error happens during the initiali= zation. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishBootstrapAccountInit ( > + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This, > + IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo > + ) > +{ > + REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE *Private; > + > + Private =3D REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE_FROM_PROTOCOL > (This); > + > + Private->RedfishService =3D RedfishCreateService (RedfishConfigService= Info); > + if (Private->RedfishService =3D=3D NULL) { > + return EFI_DEVICE_ERROR; > + } > + > + Private->RestExHandle =3D RedfishConfigServiceInfo- > >RedfishServiceRestExHandle; > + > + return EFI_SUCCESS; > +} > + > +/** > + Stop a Redfish configure handler. > + > + @param[in] This Pointer to > EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL instance. > + > + @retval EFI_SUCCESS This handler has been stoped successf= ully. > + @retval Others Some error happened. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishBootstrapAccountStop ( > + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This > + ) > +{ > + REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE *Private; > + > + Private =3D REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE_FROM_PROTOCOL > (This); > + > + if (Private->RedfishService !=3D NULL) { > + RedfishCleanupService (Private->RedfishService); > + Private->RedfishService =3D NULL; > + } > + > + return EFI_SUCCESS; > +} > + > +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D { > + RedfishBootstrapAccountInit, > + RedfishBootstrapAccountStop > +}; > + > +/** > + Unloads an image. > + > + @param[in] ImageHandle Handle that identifies the image to = be > unloaded. > + > + @retval EFI_SUCCESS The image has been unloaded. > + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishBootstrapAccountUnload ( > + IN EFI_HANDLE ImageHandle > + ) > +{ > + EFI_STATUS Status; > + > + if (mBootstrapPrivate =3D=3D NULL) { > + return EFI_SUCCESS; > + } > + > + if (mBootstrapPrivate->RedfishEvent !=3D NULL) { > + gBS->CloseEvent (mBootstrapPrivate->RedfishEvent); > + } > + > + Status =3D gBS->UninstallProtocolInterface ( > + mBootstrapPrivate->ImageHandle, > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + (VOID *)&mBootstrapPrivate->Protocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: can not uninstall Redfish config handler > protocol: %r\n", __func__, Status)); > + } > + > + FreePool (mBootstrapPrivate); > + mBootstrapPrivate =3D NULL; > + > + return EFI_SUCCESS; > +} > + > +/** > + This is the declaration of an EFI image entry point. This entry point = is > + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers incl= uding > + both device drivers and bus drivers. > + > + @param[in] ImageHandle The firmware allocated handle for the UE= FI > image. > + @param[in] SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The operation completed successfully. > + @retval Others An unexpected error occurred. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishBootstrapAccountEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + EFI_STATUS Status; > + > + if (mBootstrapPrivate !=3D NULL) { > + return EFI_ALREADY_STARTED; > + } > + > + mBootstrapPrivate =3D AllocateZeroPool (sizeof > (REDFISH_BOOTSTRAP_ACCOUNT_PRIVATE)); > + if (mBootstrapPrivate =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + > + CopyMem (&mBootstrapPrivate->Protocol, &mRedfishConfigHandler, sizeof > (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL)); > + Status =3D gBS->InstallProtocolInterface ( > + &ImageHandle, > + &gEdkIIRedfishConfigHandlerProtocolGuid, > + EFI_NATIVE_INTERFACE, > + &mBootstrapPrivate->Protocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: can not install Redfish config handler > protocol: %r\n", __func__, Status)); > + goto ON_ERROR; > + } > + > + // > + // Register after provisioning event to remove bootstrap account. > + // > + Status =3D CreateAfterProvisioningEvent ( > + RedfishBootstrapAccountOnRedfishAfterProvisioning, > + (VOID *)mBootstrapPrivate, > + &mBootstrapPrivate->RedfishEvent > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: failed to register after-provisioning even= t: > %r\n", __func__, Status)); > + goto ON_ERROR; > + } > + > + return EFI_SUCCESS; > + > +ON_ERROR: > + > + RedfishBootstrapAccountUnload (ImageHandle); > + > + return Status; > +} > diff --git a/RedfishClientPkg/RedfishClient.fdf.inc > b/RedfishClientPkg/RedfishClient.fdf.inc > index 154f641b2..47e5093f2 100644 > --- a/RedfishClientPkg/RedfishClient.fdf.inc > +++ b/RedfishClientPkg/RedfishClient.fdf.inc > @@ -15,6 +15,7 @@ > INF RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf > INF RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > INF > RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf > + INF > RedfishClientPkg/RedfishBootstrapAccountDxe/RedfishBootstrapAccountDxe.in= f > INF RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.inf > INF > RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf > INF > RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.i > nf > -- > 2.34.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 (#118065): https://edk2.groups.io/g/devel/message/118065 Mute This Topic: https://groups.io/mt/105596648/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-