From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (NAM04-BN8-obe.outbound.protection.outlook.com [40.107.100.72]) by mx.groups.io with SMTP id smtpd.web10.6962.1670567993000657481 for ; Thu, 08 Dec 2022 22:39:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=iBHWiPQ+; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.100.72, mailfrom: simowang@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehGszNO0SMeDpaNqM3KK+yt96htPH/1nU9RzxcoYypoi9jVRGd8bjcmx75UyR8AQGoLcZreLQlXB+SqRFmTM9DW42wAsOVPLPrJOqC/aKNxQZ4JOeCKcX1YvYZAlM8EXMZymOB6tVYSeRy51f/IIYqyGJhCiSgCOvPOk0OWosPedOHm/PzpncQBxFLZE4PeGECN7AQv0yvzmV34z/ybv89pfitZN3dsiHZelM9EjnYpblkfdez++dYNPE/3yCbroBwHDoDKO0aio0g9Ipu51EGrRvKBuiwlEt+BLo32vmh/fVAY1EPFHhuHdgb1EIyCbhxY/vlbww3OnbkiIJ51BAQ== 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=fROc3e3xLtKZD4FyeqG3LpsknjRtJBZlVLArLDlUlkE=; b=dspff7ScN7nlvsMGlvTo9sKlVoUr4jNEpoqy9cqqd5nvruPyq5mKlTd53I6DY3ueV2pXkOh9m9m/iyvggEh5Hu8sEEIXXsSQjf719D9TNJgtOvlapaXsXINlNk4UnLzsOo0H8bjU3NxeANiM8VnclW/AHUqqYSrHk6wR4YWNaRe8PjQr6bcfqjCZ6rvVXJmTSrGF6NKnWfWXEONvqsJ0zAmPxVdKd1hMeKgv3fcXG8wqCpCqmZkUDEBZ+OY+zT62C0lEfBGPR3IUiUuewjREBJEpXXIRPq8T5mEbVx8JauoeLKXUdhFhl00A3tAcqaU7oQkAd36qMxQFc8m6O14ljA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fROc3e3xLtKZD4FyeqG3LpsknjRtJBZlVLArLDlUlkE=; b=iBHWiPQ+xIso/aH9X+dyGliQPoUqkgVm2nvmqFKtu3+lrPX7hWHL0/FkcwflKXH+YQvq2NXhy6zZpsy1DjXgpznmUbL8hoi5CbbmywUUmTncZ0E/8NPhUO0unWWgjgXoWnRUJjOP3olVe900vdO1k3y61KpI3uvEOUDIakyzQj5fZ6/k1XzxmEKqfvsDYWqhpsjiijeQVPTKmMYN7vaeQggb4CsNR0Vmm7nzDCQuRHwQ3s0hRmlmFN4eatWR642bYvUPqAzpam20BhL8mO7bwkf824WIMBmfCj8xDXFWOTaPidQewVulS/E2AFL0X6iIWLhxChRJameVT2wozgOfaA== Received: from DS0PR12MB6583.namprd12.prod.outlook.com (2603:10b6:8:d1::12) by DS0PR12MB7512.namprd12.prod.outlook.com (2603:10b6:8:13a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Fri, 9 Dec 2022 06:39:48 +0000 Received: from DS0PR12MB6583.namprd12.prod.outlook.com ([fe80::6aee:c2b3:2eb1:7c7b]) by DS0PR12MB6583.namprd12.prod.outlook.com ([fe80::6aee:c2b3:2eb1:7c7b%7]) with mapi id 15.20.5880.016; Fri, 9 Dec 2022 06:39:48 +0000 From: "Simon Wang (SW-GPU)" To: "devel@edk2.groups.io" CC: Nickle Wang , Nick Ramirez , "abner.chang@amd.com" , Igor Miroshnichenko Subject: [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Add Redfish.Settings support Thread-Topic: [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Add Redfish.Settings support Thread-Index: AQHZC5hDy2iR9gZTWU2Xlf3X5ss1J65lGa/A Date: Fri, 9 Dec 2022 06:39:48 +0000 Message-ID: References: <20221209063413.31912-1-simowang@nvidia.com> In-Reply-To: <20221209063413.31912-1-simowang@nvidia.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS0PR12MB6583:EE_|DS0PR12MB7512:EE_ x-ms-office365-filtering-correlation-id: a6c59bb1-a3e9-4fee-dc83-08dad9b02ad4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hdsES6K6BdbeQ7JyU6WjNtS2IA4ZZXh6e9zEGsp49WJ2p9Jwf0HVvVkNBFQA7MCIySkZP+SYNku6WE7IC74JmfXmZ4ILePkSmPNCCAGhQlgUUJpWp5B+E/Ql6qaSpzC4QNEdEZD3z9UTotgj8gVn5Y+YcALADaA8Td0P3WZaYUxuvqXqJiQXyJQk/wyDmIFBc5KG/oCcNSj0DKEc2Xaqg81KL+i2eto/aKl8JPT/kQVuaM/hZPmUZ9AYg6qGhdL6wB9YRf9WYHSIVMreT8UNTqnqR0BDT5tRwMv39zM9j1ejFF0BP7v5lCCpItiEOSJSglnlhmmf+5UaSQH3Y3z/g9RDkZZOKeA4lNayrD+upIpVRGdOgnWHbICbP3JajrkoPtnbFmdWZUaAAD6T3A5nWIQYlYjf5WPyxkiegH4cgc8z4r2cNNfM55+cL/LQcSj5ib3WIU75LCAJq0WmqkBUOSQw/+dSb9fCHRLFyzdfwWq/MMlqwVSkBhxw49QqL9Rb9tSz8ifz/fe0hCR96wnvaN7wISQI9e0EttbTJ/E1spNw2PlUU0FncKCRR+DCW1WeeQa7nv5CH80K4l+QdN4I7hRDpdwHEoY675k04wv8/VvjtBL2vw0Orp+Kq6CI7dz71CRJmVxxtyUmrzXuwJ2JsnGlSNLQK2PFo0mJ2egc9jmxE1wp+9lnzC8B5Qe4ANJpQr2/ZAS9Npmocgap7qRjnQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB6583.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(136003)(376002)(346002)(366004)(451199015)(26005)(5660300002)(38070700005)(8936002)(186003)(52536014)(7696005)(9686003)(55016003)(107886003)(478600001)(54906003)(6916009)(38100700002)(33656002)(83380400001)(41300700001)(30864003)(71200400001)(6506007)(2906002)(66946007)(76116006)(66446008)(122000001)(19627235002)(66556008)(86362001)(64756008)(316002)(8676002)(66476007)(4326008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1YUjmnwAgTDGS6qi2hHrerj+sWgCjFHQpeLweIuq1EEYYJ8CKG8XLHG2ho96?= =?us-ascii?Q?OAY1PrbfUWpOZ35cOHQ7W+6X6wN86OAdy4pFrXe9NzOvq9FPtCEFoQimcDy7?= =?us-ascii?Q?tZb06/jBIgOmMvF+R/GREwCJQGJBH9hr7uFNv4Pi7D2L59/RqWEl29NjB6ww?= =?us-ascii?Q?NeOS4NFDkVSn/oWN7voh7WnvhgT+Vn3WEKvXHFzIVQq8Sl5J8iZpZq+79xO6?= =?us-ascii?Q?k5QtupJnSDUWYCKmcN0XFewT9z/3bHkL87PDIw078iY3m/QFDlcteswwvinF?= =?us-ascii?Q?zMpUONpCjnidqKJmvttD+dupRA7dY7c1QGKwYbrJYNUIgkASflH6litzULX7?= =?us-ascii?Q?ByHNAC1k1jIHdvhc3KyTk7R6jTRrZz4bsgyWxroA1ZJFYkK5/mRd+vTFXJAu?= =?us-ascii?Q?uQNsqWqIWqvXV0QbwKFdkjjcPbx9+ULZ8bgzeKkQG0QMpjHNvqlacvotuNEQ?= =?us-ascii?Q?LtNLA2EIpS+TunI3kFGpcZWdtqmXrM9hwRZY7jqj+Mi5moVoubFK1MECXRW6?= =?us-ascii?Q?5GjWxe4d1hM0vVfJzncKybPjr+vg+TziSaljvAJwwRZTnjeunSpknDuQjUGu?= =?us-ascii?Q?Y/mIbGx2RnU5o6qoddK9DAiVznD5N6hMXcC29i4xR545mO6TIXIpP4uXNjT7?= =?us-ascii?Q?L6iZsX3JkTQI4ofdC70QLioggnLGGIUxiV5hWZ1w1jr5te+XynTN6P3D+MMK?= =?us-ascii?Q?lRRo/TmQZ3Y1IfKOPecv/Ob2t9o8U0aX+ekvleicozTqgitz01aNvQbPOD0M?= =?us-ascii?Q?a+WKhq2EihOO95g/FAR0swj26gxRxkbFhokUAFyiAJkSL+wn6Wqlad2c69gR?= =?us-ascii?Q?YRiTioffgK3Slr2Eg9k144YU8zWVYLOa/abcBdDY9PylQju7K09hTq2ms7sn?= =?us-ascii?Q?v8iEtAKu7yilkpMKsva3Lv30/gNoLRI/MiaaAlTEUhmUL7MfydKH28RxxeKK?= =?us-ascii?Q?EBmneBh8GyxJID43N+Jr1g0yRbF1vpk7gP8nBDHuOCjOdrpqkE0AmzK3ubOE?= =?us-ascii?Q?FxH6aUfMYH6v+tI39ypGGZ0UiYvbhwCMIaDTTF+q5SqmGgYQ/skcyrbdNwd1?= =?us-ascii?Q?QtumQHqJz5ihySz+vyFzj8IiKGq5iTBmImNC5TNVirhFXzqU5lVqNvwXNZz1?= =?us-ascii?Q?L/4MI4pGcOT1oKqLu183xE1rZapY5P4xxK/LpiGIGKSiUrrjW9ayLu0WajI/?= =?us-ascii?Q?2pngRXPLxtMUbUOaLziLNtdArRBy0sJwW3Rm37tjtUD3dn7Y+dsNbHwZkLZk?= =?us-ascii?Q?o/OFKHIWw3kb+bubpk2iQMTb6gS6jVpA1qhl6sXF5dzpnZq6BktMOupaYyQK?= =?us-ascii?Q?pdnwkoeFfESnww7qS3RJuVZSh8SBeMqHPDaaEC9YGLoIJb0rLBEpH0vWHKhX?= =?us-ascii?Q?sgznZLIIHzeba1efUYpazraeEmUB/cULJ1SnX2JydNpxaLBGjZVWY2ayb/VM?= =?us-ascii?Q?s4B5784I/tLwy/N2Z3DKgRSAHDfaC2Kq5eE1wBQXzac/Wk0enaru++6ja9j+?= =?us-ascii?Q?7jB8MC/YjNn+dw3V9jr0IizAzKtma5A4nO/AXfxEttr8G81idm6qVeWU2YK8?= =?us-ascii?Q?cw9WgUzpuJa2cgA1gcC/RQQA6SO1Ate5kMKvDkCa?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB6583.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6c59bb1-a3e9-4fee-dc83-08dad9b02ad4 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Dec 2022 06:39:48.1942 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: irxfxC9br8GkuWwxGZRgqbo/DFnzPCRe3V4UFLbgnqovodiTuadnu2kp/0QFBHDuN4R2IH6OnUbVO7JvjHPXJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7512 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable BIOS feature driver cannot recognize "@Redfish.Settings", decode it and get= pending setting URI. So BIOS feature driver can consume pending setting fr= om correct place. Signed-off-by: Simon Wang Cc: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- .../Features/Bios/v1_0_9/Dxe/BiosDxe.c | 214 +++++++++++------- 1 file changed, 130 insertions(+), 84 deletions(-) diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c b/RedfishC= lientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c index a478061cde..5e3820fa96 100644 --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c @@ -2,6 +2,7 @@ Redfish feature driver implementation - Bios =20 (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -9,15 +10,15 @@ =20 #include "../Common/BiosCommon.h" =20 -extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate; +extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate; =20 EFI_STATUS HandleResource ( - IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, - IN EFI_STRING Uri + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN EFI_STRING Uri ); =20 -EFI_HANDLE medfishResourceConfigProtocolHandle; +EFI_HANDLE medfishResourceConfigProtocolHandle; =20 /** Provising redfish resource by given URI. @@ -33,16 +34,16 @@ EFI_HANDLE medfishResourceConfigProtocolHandle; **/ EFI_STATUS RedfishResourceProvisioningResource ( - IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, - IN EFI_STRING Uri, - IN BOOLEAN PostMode + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri, + IN BOOLEAN PostMode ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; - EFI_STATUS Status; - REDFISH_RESPONSE Response; + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; =20 - if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { return EFI_INVALID_PARAMETER; } =20 @@ -60,7 +61,7 @@ RedfishResourceProvisioningResource ( return Status; } =20 - Private->Uri =3D Uri; + Private->Uri =3D Uri; Private->Payload =3D Response.Payload; ASSERT (Private->Payload !=3D NULL); =20 @@ -94,16 +95,22 @@ RedfishResourceProvisioningResource ( **/ EFI_STATUS = RedfishResourceConsumeResource ( - IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, - IN EFI_STRING Uri + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; - EFI_STATUS Status; - REDFISH_RESPONSE Response; - CHAR8 *Etag; - - if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + REDFISH_RESPONSE *ExpectedResponse; + REDFISH_RESPONSE RedfishSettingsResponse; + CHAR8 *Etag; + UINTN Index; + EDKII_JSON_VALUE JsonValue; + EFI_STRING RedfishSettingsUri; + CONST CHAR8 *RedfishSettingsUriKeys[] =3D { "@Redfi= sh.Settings", "SettingsObject", "@odata.id" }; + + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { return EFI_INVALID_PARAMETER; } =20 @@ -119,7 +126,37 @@ RedfishResourceConsumeResource ( return Status; } =20 - Private->Uri =3D Uri; + ExpectedResponse =3D &Response; + RedfishSettingsUri =3D NULL; + JsonValue =3D RedfishJsonInPayload (Response.Payload); + + // + // Seeking RedfishSettings URI link. + // + for (Index =3D 0; Index < ARRAY_SIZE (RedfishSettingsUriKeys); Index++) = { + if (JsonValue =3D=3D NULL) { + break; + } + + JsonValue =3D JsonObjectGetValue (JsonValueGetObject (JsonValue),=20 + RedfishSettingsUriKeys[Index]); } + + if (JsonValue !=3D NULL) { + // + // Verify RedfishSettings URI link is valid to retrieve resource or no= t. + // + RedfishSettingsUri =3D JsonValueGetUnicodeString (JsonValue); + + Status =3D GetResourceByUri (Private->RedfishService, RedfishSettingsU= ri, &RedfishSettingsResponse); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTIO= N__, RedfishSettingsUri)); + } else { + Uri =3D RedfishSettingsUri; + ExpectedResponse =3D &RedfishSettingsResponse; + } + } + + Private->Uri =3D Uri; Private->Payload =3D Response.Payload; ASSERT (Private->Payload !=3D NULL); =20 @@ -129,7 +166,7 @@ RedfishResourceConsumeResource ( // // Find etag in HTTP response header // - Etag =3D NULL; + Etag =3D NULL; Status =3D GetEtagAndLocation (&Response, &Etag, NULL); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n", __FU= NCTION__)); @@ -153,13 +190,23 @@ RedfishResourceConsumeResource ( // Release resource // if (Private->Payload !=3D NULL) { - RedfishFreeResponse ( - Response.StatusCode, - Response.HeaderCount, - Response.Headers, - Response.Payload - ); - Private->Payload =3D NULL; + if (Response.Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + } + + if (RedfishSettingsResponse.Payload !=3D NULL) { + RedfishFreeResponse ( + RedfishSettingsResponse.StatusCode, + RedfishSettingsResponse.HeaderCount, + RedfishSettingsResponse.Headers, + RedfishSettingsResponse.Payload + ); + } } =20 if (Private->Json !=3D NULL) { @@ -185,13 +232,13 @@ RedfishResourceConsumeResource ( **/ EFI_STATUS Re= dfishResourceGetInfo ( - IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, OUT REDFISH_SCHEMA_INFO *Info ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; + REDFISH_RESOURCE_COMMON_PRIVATE *Private; =20 - if (This =3D=3D NULL || Info =3D=3D NULL) { + if ((This =3D=3D NULL) || (Info =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 @@ -217,15 +264,15 @@ RedfishResourceGetInfo ( **/ EFI_STATUS RedfishRes= ourceUpdate ( - IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, - IN EFI_STRING Uri + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; - EFI_STATUS Status; - REDFISH_RESPONSE Response; + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; =20 - if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { return EFI_INVALID_PARAMETER; } =20 @@ -241,7 +288,7 @@ RedfishResourceUpdate ( return Status; } =20 - Private->Uri =3D Uri; + Private->Uri =3D Uri; Private->Payload =3D Response.Payload; ASSERT (Private->Payload !=3D NULL); =20 @@ -286,15 +333,15 @@ RedfishResourceUpdate ( **/ EFI_STATUS RedfishReso= urceCheck ( - IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, - IN EFI_STRING Uri + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; - EFI_STATUS Status; - REDFISH_RESPONSE Response; + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; =20 - if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { return EFI_INVALID_PARAMETER; } =20 @@ -310,7 +357,7 @@ RedfishResourceCheck ( return Status; } =20 - Private->Uri =3D Uri; + Private->Uri =3D Uri; Private->Payload =3D Response.Payload; ASSERT (Private->Payload !=3D NULL); =20 @@ -354,18 +401,17 @@ RedfishResourceCheck ( @retval Others Some error happened. =20 **/ - EFI_STATUS RedfishResourceIdentify ( IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, IN EFI_STRING Uri ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; - EFI_STATUS Status; - REDFISH_RESPONSE Response; + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; =20 - if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + if ((This =3D=3D NULL) || IS_EMPTY_STRING (Uri)) { return EFI_INVALID_PARAMETER; } =20 @@ -381,7 +427,7 @@ RedfishResourceIdentify ( return Status; } =20 - Private->Uri =3D Uri; + Private->Uri =3D Uri; Private->Payload =3D Response.Payload; ASSERT (Private->Payload !=3D NULL); =20 @@ -392,6 +438,7 @@ RedfishResourceIdentify ( if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, identify %s failed: %r\n", __FUNCTION__, Uri= , Status)); } + // // Release resource // @@ -413,7 +460,7 @@ RedfishResourceIdentify ( return Status; } =20 -EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL mRedfishResourceConfig =3D { +EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL mRedfishResourceConfig =3D { RedfishResourceProvisioningResource, RedfishResourceConsumeResource, RedfishResourceUpdate, @@ -441,10 +488,10 @@ EFI_STATUS EFIAPI RedfishResourceInit ( IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This, - IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo + IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; + REDFISH_RESOURCE_COMMON_PRIVATE *Private; =20 Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his); =20 @@ -468,10 +515,10 @@ RedfishResourceInit ( EFI_STATUS EFIAPI RedfishRes= ourceStop ( - IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This ) { - REDFISH_RESOURCE_COMMON_PRIVATE *Private; + REDFISH_RESOURCE_COMMON_PRIVATE *Private; =20 Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his); =20 @@ -493,7 +540,7 @@ RedfishResourceStop ( return EFI_SUCCESS; } =20 -EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D { +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D { RedfishResourceInit, RedfishResourceStop }; @@ -506,10 +553,9 @@ EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHa= ndler =3D { **/ VOID EFIAPI -EfiRestJasonStructureProtocolIsReady - ( - IN EFI_EVENT Event, - IN VOID *Context +EfiRestJasonStructureProtocolIsReady ( + IN EFI_EVENT Event, + IN VOID *Context ) { EFI_STATUS Status; @@ -523,10 +569,10 @@ EfiRestJasonStructureProtocolIsReady } =20 Status =3D gBS->LocateProtocol ( - &gEfiRestJsonStructureProtocolGuid, - NULL, - (VOID **)&mRedfishResourcePrivate->JsonStructProtocol - ); + &gEfiRestJsonStructureProtocolGuid, + NULL, + (VOID **)&mRedfishResourcePrivate->JsonStructProtocol + ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to locate gEfiRestJsonStructureProtoc= olGuid: %r\n", __FUNCTION__, Status)); } @@ -550,7 +596,7 @@ RedfishResourceUnload ( ) { EFI_STATUS Status; - EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; =20 if (mRedfishResourcePrivate =3D=3D NULL) { return EFI_NOT_READY; @@ -564,12 +610,12 @@ RedfishResourceUnload ( Status =3D gBS->OpenProtocol ( ImageHandle, &gEdkIIRedfishConfigHandlerProtocolGuid, - (VOID **) &ConfigHandler, + (VOID **)&ConfigHandler, NULL, NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL ); - if (EFI_ERROR (Status) || ConfigHandler =3D=3D NULL) { + if (EFI_ERROR (Status) || (ConfigHandler =3D=3D NULL)) { return Status; } =20 @@ -612,10 +658,10 @@ RedfishResourceUnload ( EFI_STATUS EFIAPI RedfishE= xternalResourceResourceFeatureCallback ( - IN EDKII_REDFISH_FEATURE_PROTOCOL *This, - IN FEATURE_CALLBACK_ACTION FeatureAction, - IN VOID *Context, - IN OUT RESOURCE_INFORMATION_EXCHANGE *InformationExchange + IN EDKII_REDFISH_FEATURE_PROTOCOL *This, + IN FEATURE_CALLBACK_ACTION FeatureAction, + IN VOID *Context, + IN OUT RESOURCE_INFORMATION_EXCHANGE *InformationExchange ) { EFI_STATUS Status; @@ -647,11 +693,12 @@ RedfishExternalResourceResourceFeatureCallback ( // // Create the full URI from Redfish service root. // - ResourceUri =3D (EFI_STRING)AllocateZeroPool (MAX_URI_LENGTH * sizeof(CH= AR16)); + ResourceUri =3D (EFI_STRING)AllocateZeroPool (MAX_URI_LENGTH * sizeof=20 + (CHAR16)); if (ResourceUri =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for full URI.\n", __= FUNCTION__)); return EFI_OUT_OF_RESOURCES; } + StrCatS (ResourceUri, MAX_URI_LENGTH, Private->RedfishVersion); StrCatS (ResourceUri, MAX_URI_LENGTH, InformationExchange->SendInformati= on.FullUri); =20 @@ -681,10 +728,9 @@ RedfishExternalResourceResourceFeatureCallback ( **/ = VOID EFIAPI -EdkIIRedfishFeatureProtocolIsReady - ( - IN EFI_EVENT Event, - IN VOID *Context +EdkIIRedfishFeatureProtocolIsReady ( + IN EFI_EVENT Event, + IN VOID *Context ) { EFI_STATUS Status; @@ -699,10 +745,10 @@ EdkIIRedfishFeatureProtocolIsReady } =20 Status =3D gBS->LocateProtocol ( - &gEdkIIRedfishFeatureProtocolGuid, - NULL, - (VOID **)&FeatureProtocol - ); + &gEdkIIRedfishFeatureProtocolGuid, + NULL, + (VOID **)&FeatureProtocol + ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, failed to locate gEdkIIRedfishFeatureProtoco= lGuid: %r\n", __FUNCTION__, Status)); gBS->CloseEvent (Event); @@ -744,8 +790,8 @@ RedfishResourceEntryPoint ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; - VOID *Registration; + EFI_STATUS Status; + VOID *Registration; =20 if (mRedfishResourcePrivate !=3D NULL) { return EFI_ALREADY_STARTED; -- 2.17.1