From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.53]) by mx.groups.io with SMTP id smtpd.web11.14979.1680055950027224171 for ; Tue, 28 Mar 2023 19:12:30 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=d9tHinh7; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.94.53, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4YCBRF4tKtRL5QbMLxJIg5K/EkHQ2reRMZPnf2gHxP2GabdM+oQyCsG+lc/S9ZjoovOCKGCrbKvQiOMyYBo/YapUNImeA4/LCa15bYzzq4Zry1Q6v60XOmQmgIDkhfodcO5PbDrypI4MRCoRwT8vokokEpWVC2UFi0aJUKdPwlPlHO02v86JK4wK0MvK7RDO4Cwop1Rg/lo1GmOetbH19PvLykQcczj6a4GtAD0GCW8scfVHhufQeZHzKW71Xocz4+/gVcPa8I1IJyjAVY2eDJiIUlnWpMXDkKeBxFhnDN/jYPmuoWQaoWTjsXN8ju5J3Lg8q/p+v0/+N6I3RgIsA== 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=qagijLhJ/vdaTmX6yLScULEix6uUklLc8w3kGFAqWw8=; b=ayw65O1ANnhbWzDExj4WPNOane8I5hRxXG0WToJTyDWiMbL6/6PIIDb/QeMCY4ZomJngj1I5S7R+8PGEJa56jJJcTYwugaQv3BkOXoZeV54cZL70hjJrYPWkTrU2E0wjrUzHqMM0Z1yJiWbegwf2Q8KQN6OQExPcC4f7ldU80P57zy9ruPiu2xs0sOTlA66TeRYihI2OT5F0Tk3WnAcnmfAtzuGBMP7UgCQQRetlAXgJ4q/Y6T6Cl1qnveREBpxedcJ+CRCRsAxL8LbObZMdHoCygLlCxa+NWlPSJEtwi8bU9pW434fdB2gYb8H55qfVfkkU0AwtgH7uGxRlagDepA== 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=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qagijLhJ/vdaTmX6yLScULEix6uUklLc8w3kGFAqWw8=; b=d9tHinh7BJTGzliIalINx6HNaQHbJ82VoApcmDIFfYwZIja9cn4+DCj/aj217rhuKHZsfrXaicu6HfJxn/PSJpVYb6BcHgBYTdCOPybCCbBi9BVBSVPnmfKv8rnrNnXRLSasicfk5lkIoq6hDONUOw+4H5d/Mou0kX2TUBvJW0A= Received: from BY5PR12MB3954.namprd12.prod.outlook.com (2603:10b6:a03:1af::16) by MW6PR12MB8916.namprd12.prod.outlook.com (2603:10b6:303:24b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.33; Wed, 29 Mar 2023 02:12:27 +0000 Received: from BY5PR12MB3954.namprd12.prod.outlook.com ([fe80::8658:10bf:b7b9:4da1]) by BY5PR12MB3954.namprd12.prod.outlook.com ([fe80::8658:10bf:b7b9:4da1%6]) with mapi id 15.20.6222.028; Wed, 29 Mar 2023 02:12:27 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [PATCH 2/3] RedfishPkg: Redfish discover driver improvement Thread-Topic: [PATCH 2/3] RedfishPkg: Redfish discover driver improvement Thread-Index: AQHZYTp2F7L+lZNxm0qBj64vv0Jz3q8RBKMQ Date: Wed, 29 Mar 2023 02:12:27 +0000 Message-ID: References: <20230328055911.221-1-nicklew@nvidia.com> In-Reply-To: <20230328055911.221-1-nicklew@nvidia.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-03-29T02:12:25Z; 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_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=4cf34c1e-195b-4171-8cbf-99f0e737de77; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BY5PR12MB3954:EE_|MW6PR12MB8916:EE_ x-ms-office365-filtering-correlation-id: 173570b8-1267-4ef4-35bd-08db2ffb0b37 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: P0ozhXzmcUTNhuajQlHL2/8V9KnQ+R/17UbJYtV/algfICEjdnVATFAmti3WZ8/5ZYLoCA4pdpwLVugxRFBhb/zwy2I0/JLpbJCn/P2k8LXrykmFZyTqt57SocYEJlwymo1VJ8ApscfJ8rtBOyAPRJZ6vw+4BZ3JVMOoLSlo64edyDD13W4df1j4/9PHghBomXALqmezCHfyl65KGxzGLFazSzWM0uJOnyLMYdF9AtsUv+Ja0KCXMvNrNYwffwQ/hV4zUAMf8N8Lcm5CNJP3oMLi4k4s9HRVvQzf3qIxhSd6B9MO0PtesocJApl0c5zf29GtTLRNjXxZLhZ6nwQ0V2X0m6Cwzru8v/Gyq2LJAGG9UzpkvYweHUc+/mrFQWyyYLgXgimsE3y/qkRQ4JxjZFno603HlvnMJFHNG36/aNuRVlTCgG9Bp0cwUmXrDxeaewQnfC+ORZXKdazMhG4yI4Eb9LPgDZLAbyU0bfs5WQhQTzvsuVW2UQ7P0PqlBZ1am0lZ0ixXgWIrlnC2U2mjIM2ce/ZGZ8J3UK5C7RcYKWzVqZET3pYKIiCB+8QWiQ4T+EQYmeWD15TX9pqd3vhIIKq6IpcGbxgZ7J6REwRSaPJazPWILZ2ylXTimf+QML5v2woKNqMxJmSw8ie7cCozhQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB3954.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(39860400002)(396003)(366004)(346002)(451199021)(186003)(33656002)(83380400001)(53546011)(9686003)(6506007)(26005)(71200400001)(7696005)(86362001)(54906003)(478600001)(19627235002)(110136005)(316002)(64756008)(66476007)(66946007)(66446008)(76116006)(8676002)(66556008)(41300700001)(5660300002)(8936002)(122000001)(52536014)(4326008)(2906002)(30864003)(55016003)(38100700002)(38070700005)(341764005)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xisirmC5Y1HZeHIFBM2maWn0m1xZPhTX1T7oaK12mdZARIYO2SamdTNuFWGH?= =?us-ascii?Q?RY2km7+3lmlHaRBqxA1x2mjDlQepjTlC+EFKKypMc7tB3s/jZGSqjPI7zbN6?= =?us-ascii?Q?Cb28tqGJPK+ilglqLUgATiNDEmC4eCin1ZfOsnSMYpj6krjwRNXBBN92ZvAT?= =?us-ascii?Q?JvzB3DlRzdAWB2d+mVUNy4pYKi2ZYdfHl7VYty8GDBEMxVMyZGECBmQfSQ2V?= =?us-ascii?Q?PGfmTMuy8SF1xNl7h8R6kcT8sHsakAgVPjFNP9VCAHaeokkYc5ALiFquFU8q?= =?us-ascii?Q?iISPEv7D9TAp0XgxmrLjxbHkLx58zPu/RP40KqjbcOyjOOpFm7GRokez+Crb?= =?us-ascii?Q?h1SYTe5mJ4wRKaH31fMH4s7hrvV82mZFp83kgS1vCJpGCh7p0RHq5I+gT5ft?= =?us-ascii?Q?ImY4VsHY9ISUI7R7+qI0DIpMFsO8wI9JXPEjjHf5OUf5BuxIwJhmetqM/F/d?= =?us-ascii?Q?hKyVxKaP2k9FOUNVfdAIqjuEEkJQq+zBlH38GOWpCoKWSUSqvK4f3I5zTUS5?= =?us-ascii?Q?99HLECjhhDRSpb+MJSuOtvB/qyjQVYw8/XT763RwH8JgGQ6yEV0sxf372i2H?= =?us-ascii?Q?5Z1PRVIFNPTrSmoJKRDui/xb2138quxQv5Z7m/Gv4W41IxEsLgS+F5Qojz1B?= =?us-ascii?Q?N+37LTuqrTYxiGSnO9aqXMgc+wRa4dIThzs9F0cyJ2GFHXu8YvINfJU0wqfG?= =?us-ascii?Q?0l7L6jhTkz8G/K8jz/z6GEJ3ASj2StqhUDF1qVcbQHKTwnHnE5cheEyjMdFc?= =?us-ascii?Q?3Oyc9xSo5ins4d3QhRgX7X0nPmF6sSxnOmHxbe5hWjJZzliLTfjOjOhuBw6c?= =?us-ascii?Q?AJ6C2K3mfe/xl+U/bV+ah5lrvsUiiwC5jmsu3LrB0vRn6ZyT8KGBuCq6Jxg9?= =?us-ascii?Q?1acjQ7Nf4U6mqx3mjcYSrwO7O77iGVHr7BRy66bYFY06MhiqKVqFw35kCBZW?= =?us-ascii?Q?riUXFzIej4MvGdyPO613B7UH9a5rLcpPk1r/PlE92XU75E0oWDDgnf8ydmc9?= =?us-ascii?Q?40CCtwbN7HcE1jmvhV29AxEmhxOdid8D1q3GdsipVfzFxGqCTRxd9Xj/7MHy?= =?us-ascii?Q?7JQeWKn+LrGCYtPtvp/C79Fd7AWpX3N3+3VM9rHmwqZMiOWRpriLxjYAZN0a?= =?us-ascii?Q?bfcQX/InQft+UXZRXgYdhcHFq8+tUwm/mOKyb8578BgiX9flteONnMI2yCPG?= =?us-ascii?Q?X1jhL0fFHcb9BrEHLMISGkURJHiDUO7Smwz04IqAHB3KnFm35AR7CjDzBfhL?= =?us-ascii?Q?KCUMA9kYkIbDWG+/HPrEmO+rIIGWTLB91XO2T01syV38tGvQD2qWX17+IYWZ?= =?us-ascii?Q?1yp9vFMYOcUAFGef7UuDTWlC6XqYZg/6LY6RGArARV839Kdx3NbM/h6Ttsu2?= =?us-ascii?Q?z4eoI6udwE1FiSk6H+BQ88+W7Kq9pp6s1NuACc4d9BQkYKgLTRiuPwo63ccc?= =?us-ascii?Q?xVHr6pIyxs5ixOYEAWUG2sr0cS3alRE3X2OveNskeEIJcsWooZyOn0KX1DHF?= =?us-ascii?Q?MLinG5IxQVn0gVFnHOlAs/lmQ8SnqJ9I/M8GWupPN2U9BvWf24MxrL+tso7y?= =?us-ascii?Q?qXEfo7V+cNKxn8knDbs=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB3954.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 173570b8-1267-4ef4-35bd-08db2ffb0b37 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2023 02:12:27.4505 (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: XgS5S8KElI0QvvytXswsqkHRkwO88UTecAT1ePM0T93HVmMQwO2OCi/GpIYQSXqLhrcnqB5/0NbexX0zux368w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8916 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Hi Nickle, I found that we had defined the Host IP address format in Redfish\Incluode\= IndustryStandard\RedfishHostInterface.h #define REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN 0x00 #define REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP4 0x01 #define REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_IP6 0x02 Could you please help to update the references of HostIpAddressFormat to us= e above macros? Thanks Abner > -----Original Message----- > From: Nickle Wang > Sent: Tuesday, March 28, 2023 1:59 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [PATCH 2/3] RedfishPkg: Redfish discover driver improvement >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > Bug fix: > - function stack fault > - properly handle "SubnetAddrInfoIPv6" when there is no IPv6 support > - copy-n-paste error in RedfishGetHostInterfaceProtocolData() > - fix typo > Enhancement: > - Redfish discover driver now can configure host IP address based on > the information from SMBIOS type 42 record. This saves the effort of > configuring host IP address in setup menu. > - Performance improvement to driver binding process. Redfish discover > driver will wait until all required drivers are ready and do driver > binding start(). > - Use CopyGuid() to copy GUID instead of intrinsic function. > - Error handling when SMBIOS data is corrupted. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > .../RedfishDiscoverInternal.h | 20 ++- > .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 142 ++++++++++++------ > .../RedfishSmbiosHostInterface.c | 13 +- > 3 files changed, 119 insertions(+), 56 deletions(-) >=20 > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h > index 04fa09e1cc..2704cd955d 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h > @@ -3,6 +3,7 @@ >=20 > (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> Copyright (c) 2022, AMD Incorporated. All rights reserved. > + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -102,7 +103,7 @@ typedef struct { > UINT32 SubnetAddrInfoIPv6Numbe= r; ///< IPv6 > address info number. > EFI_IP6_ADDRESS_INFO *SubnetAddrInfoIPv6; = ///< IPv6 > address info. > // > - // Network interface protocol and REST EX infor. > + // Network interface protocol and REST EX info. > // > UINT32 NetworkProtocolType; = ///< Network > protocol type. Refer to > = ///< > NETWORK_INTERFACE_PROTOCOL_TYPE. > @@ -112,7 +113,7 @@ typedef struct { > // EFI_REDFISH_DISCOVER_PROTOCOL instance installed > // on this network interface. > // > - EFI_HANDLE EfiRedfishDiscoverProto= colHandle; ///< > EFI_REDFISH_DISCOVER_PROTOTOCOL instance installed > + EFI_HANDLE EfiRedfishDiscoverProto= colHandle; ///< > EFI_REDFISH_DISCOVER_PROTOCOL instance installed > = ///< on this network interface. > } EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL; >=20 > @@ -123,7 +124,7 @@ typedef struct { > LIST_ENTRY Entry; ///< Link list ent= ry. > EFI_HANDLE OpenDriverAgentHandle; ///< The agent to = open > network protocol. > EFI_HANDLE OpenDriverControllerHandle; ///< The controlle= r handle > to open network protocol. > - EFI_HANDLE RestExChildHandle; ///< The child han= dle created > throught REST EX Service Protocol. > + EFI_HANDLE RestExChildHandle; ///< The child han= dle created > through REST EX Service Protocol. > EFI_HANDLE RestExControllerHandle; ///< The controlle= r handle > which provide REST EX protocol. > EFI_REST_EX_PROTOCOL *RestExProtocolInterface; ///< Pointer to > EFI_REST_EX_PROTOCOL. > UINT32 RestExId; ///< The identifie= r installed on REST EX > controller handle. > @@ -178,15 +179,18 @@ typedef struct { > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *NetworkInterface; ///< > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > = ///< instance used to discover Redfish > service. > // > - // Below for Host insterface discovery. > + // Below for Host interface discovery. > // > BOOLEAN HostIntfValidation;= ///< Indicates whether > to validate Redfish Host interface. > EFI_IP_ADDRESS TargetIpAddress; = ///< Target IP > address reported in Redfish Host interface. > + UINT8 HostAddrFormat; = ///< Unknown=3D00h, > Ipv4=3D01h, Ipv6=3D02h. > + EFI_IP_ADDRESS HostIpAddress; = ///< Host IP address > reported in Redfish Host interface. > + EFI_IP_ADDRESS HostSubnetMask; = ///< Host subnet > mask address reported in Redfish Host interface. > } EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE; >=20 > /** > - The function adds a new foudn Redfish service to internal list and > - notify clinet. > + The function adds a new found Redfish service to internal list and > + notify client. >=20 > It simply frees the packet. >=20 > @@ -197,7 +201,7 @@ typedef struct { > @param[in] Os OS string. > @param[in] OsVer OS version string. > @param[in] Product Product string. > - @param[in] ProductVer Product verison string. > + @param[in] ProductVer Product version string. > @param[in] UseHttps Redfish service requires secured con= nection. > @retval EFI_SUCCESS Redfish service is added to list suc= cessfully. >=20 > @@ -224,7 +228,7 @@ AddAndSignalNewRedfishService ( > @param[out] DeviceDescriptor Pointer to REDFISH_INTERFACE_DATA. > @param[out] ProtocolData Pointer to > REDFISH_OVER_IP_PROTOCOL_DATA. >=20 > - @retval EFI_SUCCESS Get host interface succesfully. > + @retval EFI_SUCCESS Get host interface successfully. > @retval Otherwise Fail to tet host interface. >=20 > **/ > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index 042d6d5fd5..ba42c8a5de 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -1,9 +1,10 @@ > /** @file >=20 > - The implementation of EFI Redfidh Discover Protocol. > + The implementation of EFI Redfish Discover Protocol. >=20 > (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> Copyright (c) 2022, AMD Incorporated. All rights reserved. > + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -270,10 +271,13 @@ Tcp6GetSubnetInfo ( >=20 > if (IpModedata.AddressCount =3D=3D 0) { > DEBUG ((DEBUG_INFO, "%a: No IPv6 address configured.\n", > __FUNCTION__)); > + Instance->SubnetAddrInfoIPv6Number =3D 0; > + return EFI_SUCCESS; > } >=20 > if (Instance->SubnetAddrInfoIPv6 !=3D NULL) { > FreePool (Instance->SubnetAddrInfoIPv6); > + Instance->SubnetAddrInfoIPv6 =3D NULL; > } >=20 > Instance->SubnetAddrInfoIPv6 =3D AllocateZeroPool > (IpModedata.AddressCount * sizeof (EFI_IP6_ADDRESS_INFO)); @@ -447,7 > +451,7 @@ NumberOfNetworkInterface ( >=20 > /** > This function checks the IP version supported on this > - netwoek interface. > + network interface. >=20 > @param[in] ThisNetworkInterface > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL >=20 > @@ -472,7 +476,7 @@ CheckIsIpVersion6 ( > @param[in] Instance EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE >=20 > @retval EFI_SUCCESS Redfish service is discovered through SMBIO= S > Host interface. > - @retval Others Fail to discover Redfish service throught S= MBIOS host > interface > + @retval Others Fail to discover Redfish service through SM= BIOS host > interface >=20 > **/ > EFI_STATUS > @@ -487,7 +491,7 @@ DiscoverRedfishHostInterface ( > CHAR16 Ipv6Str[sizeof "ffff:ffff:ffff:ffff:fff= f:ffff:ffff:ffff" + 1]; > CHAR8 RedfishServiceLocateStr[sizeof > "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" + 1]; > UINTN StrSize; > - UINTN MacCompareStstus; > + UINTN MacCompareStatus; > BOOLEAN IsHttps; >=20 > Data =3D NULL; > @@ -503,24 +507,52 @@ DiscoverRedfishHostInterface ( > Status =3D RedfishGetHostInterfaceProtocolData (mSmbios, > &DeviceDescriptor, &Data); // Search for SMBIOS type 42h > if (!EFI_ERROR (Status) && (Data !=3D NULL) && (DeviceDescriptor !=3D = NULL)) { > // > - // Chceck if we can reach out Redfish service using this network int= erface. > - // Check with MAC address using Device Descroptor Data Device Type 0= 4 > and Type 05. > + // Check if we can reach out Redfish service using this network inte= rface. > + // Check with MAC address using Device Descriptor Data Device Type 0= 4 > and Type 05. > // Those two types of Redfish host interface device has MAC informat= ion. > // > if (DeviceDescriptor->DeviceType =3D=3D > REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) { > - MacCompareStstus =3D CompareMem (&Instance->NetworkInterface- > >MacAddress, &DeviceDescriptor- > >DeviceDescriptor.PciPcieDeviceV2.MacAddress, 6); > + MacCompareStatus =3D CompareMem > + (&Instance->NetworkInterface->MacAddress, > + &DeviceDescriptor->DeviceDescriptor.PciPcieDeviceV2.MacAddress, 6); > } else if (DeviceDescriptor->DeviceType =3D=3D > REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2) { > - MacCompareStstus =3D CompareMem (&Instance->NetworkInterface- > >MacAddress, &DeviceDescriptor- > >DeviceDescriptor.UsbDeviceV2.MacAddress, 6); > + MacCompareStatus =3D CompareMem > + (&Instance->NetworkInterface->MacAddress, > + &DeviceDescriptor->DeviceDescriptor.UsbDeviceV2.MacAddress, 6); > } else { > return EFI_UNSUPPORTED; > } >=20 > - if (MacCompareStstus !=3D 0) { > + if (MacCompareStatus !=3D 0) { > return EFI_UNSUPPORTED; > } >=20 > + Instance->HostAddrFormat =3D Data->HostIpAddressFormat; > + if (Data->HostIpAddressFormat =3D=3D 1) { > + IP4_COPY_ADDRESS ((VOID *)&Instance->HostIpAddress.v4, (VOID > *)Data->HostIpAddress); > + IP4_COPY_ADDRESS ((VOID *)&Instance->HostSubnetMask.v4, (VOID > + *)Data->HostIpMask); > + > + if (EFI_IP4_EQUAL (&Instance->HostIpAddress.v4, &mZeroIp4Addr)) { > + DEBUG ((DEBUG_ERROR, "%a: invalid host IP address: zero address\= n", > __FUNCTION__)); > + // > + // Invalid IP address detected. Change address format to Unknown= and > use system default address. > + // > + Instance->HostAddrFormat =3D 0x00; > + } > + > + if (!IP4_IS_VALID_NETMASK (EFI_IP4 (Instance->HostSubnetMask.v4))) > { > + DEBUG ((DEBUG_ERROR, "%a: invalid subnet mask address\n", > __FUNCTION__)); > + // > + // Invalid subnet mast address detected. Change address format t= o > Unknown and use system default address. > + // > + Instance->HostAddrFormat =3D 0x00; > + } > + } else if (Data->HostIpAddressFormat =3D=3D 2) { > + IP6_COPY_ADDRESS ((VOID *)&Instance->HostIpAddress.v6, (VOID > *)Data->HostIpAddress); > + } > + > if (Data->RedfishServiceIpAddressFormat =3D=3D 1) { > IP4_COPY_ADDRESS ((VOID *)&Instance->TargetIpAddress.v4, (VOID > *)Data->RedfishServiceIpAddress); > + > + if (EFI_IP4_EQUAL (&Instance->TargetIpAddress.v4, &mZeroIp4Addr)) = { > + DEBUG ((DEBUG_ERROR, "%a: invalid service IP address: zero > address\n", __FUNCTION__)); > + } > } else { > IP6_COPY_ADDRESS ((VOID *)&Instance->TargetIpAddress.v6, (VOID > *)Data->RedfishServiceIpAddress); > } > @@ -530,7 +562,7 @@ DiscoverRedfishHostInterface ( > Status =3D EFI_UNSUPPORTED; > } else { > // > - // Add this istance to list without detial information of Redfish > + // Add this instance to list without detail information of > + Redfish > // service. > // > IsHttps =3D FALSE; > @@ -614,7 +646,7 @@ DiscoverRedfishHostInterface ( > @param[in] Os OS string. > @param[in] OsVer OS version string. > @param[in] Product Product string. > - @param[in] ProductVer Product verison string. > + @param[in] ProductVer Product version string. > @param[in] UseHttps Redfish service requires secured con= nection. > @retval EFI_SUCCESS Redfish service is added to list suc= cessfully. >=20 > @@ -671,7 +703,7 @@ AddAndSignalNewRedfishService ( > do { > if ((Char16Uuid =3D=3D NULL) || (DiscoveredList->Instance->Informa= tion.Uuid > =3D=3D NULL)) { > // > - // Check if this Redfish instance already found using IP addrres= s. > + // Check if this Redfish instance already found using IP address= . > // > if (!CheckIsIpVersion6 (NetworkInterface)) { > if (CompareMem ( > @@ -849,6 +881,10 @@ AddAndSignalNewRedfishService ( > Status =3D EFI_OUT_OF_RESOURCES; > goto EXIT_FREE_CONFIG_DATA; > } > + > + if (Instance->HostAddrFormat =3D=3D 2) { > + IP6_COPY_ADDRESS (&RestExHttpConfigData- > >HttpConfigData.AccessPoint.IPv6Node->LocalAddress, &Instance- > >HostIpAddress.v6); > + } > } else { > RestExHttpConfigData->HttpConfigData.AccessPoint.IPv4Node =3D > AllocateZeroPool (sizeof (EFI_HTTPv4_ACCESS_POINT)); > if (RestExHttpConfigData->HttpConfigData.AccessPoint.IPv4Node = =3D=3D > NULL) { @@ -856,7 +892,13 @@ AddAndSignalNewRedfishService ( > goto EXIT_FREE_CONFIG_DATA; > } >=20 > - RestExHttpConfigData->HttpConfigData.AccessPoint.IPv4Node- > >UseDefaultAddress =3D TRUE; > + if (Instance->HostAddrFormat =3D=3D 1) { > + RestExHttpConfigData->HttpConfigData.AccessPoint.IPv4Node- > >UseDefaultAddress =3D FALSE; > + IP4_COPY_ADDRESS (&RestExHttpConfigData- > >HttpConfigData.AccessPoint.IPv4Node->LocalAddress, &Instance- > >HostIpAddress.v4); > + IP4_COPY_ADDRESS (&RestExHttpConfigData- > >HttpConfigData.AccessPoint.IPv4Node->LocalSubnet, &Instance- > >HostSubnetMask.v4); > + } else { > + RestExHttpConfigData->HttpConfigData.AccessPoint.IPv4Node- > >UseDefaultAddress =3D TRUE; > + } > } >=20 > Status =3D RestEx->Configure ( > @@ -955,7 +997,7 @@ NetworkInterfaceGetSubnetInfo ( > Instance > ); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a:Faile to get Subnet infomation.\n", > __FUNCTION__)); > + DEBUG ((DEBUG_ERROR, "%a:Failed to get Subnet infomation.\n", > + __FUNCTION__)); > return Status; > } else { > DEBUG ((DEBUG_INFO, "%a:MAC address: %s\n", __FUNCTION__, > Instance->StrMacAddr)); @@ -982,7 +1024,7 @@ > NetworkInterfaceGetSubnetInfo ( > ThisSubnetAddrInfoIPv6++; > for (IPv6InfoIndex =3D 0; IPv6InfoIndex < Instance- > >SubnetAddrInfoIPv6Number - 1; IPv6InfoIndex++) { > // > - // Build up addtional > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL instances. > + // Build up additional > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL instances. > // > NewNetworkInterface =3D > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *)AllocateZeroPool (sizeof > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL)); > if (NewNetworkInterface !=3D NULL) { @@ -1103,9 +1145,9 @@ > RedfishServiceGetNetworkInterface ( > /** > This function acquires Redfish services by discovering static Redfish = setting > according to Redfish Host Interface or through SSDP. Returns a list of= EFI > - handles in EFI_REDFISH_DISCOVERED_LIST. Each of EFI handle has > cooresponding > - EFI REST EX instance installed on it. Each REST EX isntance is a child= instance > which > - created through EFI REST EX serivce protoocl for communicating with > specific > + handles in EFI_REDFISH_DISCOVERED_LIST. Each of EFI handle has > + corresponding EFI REST EX instance installed on it. Each REST EX > + instance is a child instance which created through EFI REST EX > + service protocol for communicating with specific > Redfish service. >=20 > @param[in] This EFI_REDFISH_DISCOVER_PROTOCOL in= stance. > @@ -1255,7 +1297,7 @@ RedfishServiceAbortAcquire ( > ) > { > // This function is used to abort Redfish service discovery through SS= DP > - // on the network interface. SSDP is optionally supprted by > EFI_REDFISH_DISCOVER_PROTOCOL, > + // on the network interface. SSDP is optionally suppoted by > + EFI_REDFISH_DISCOVER_PROTOCOL, > // we dont have implementation for SSDP now. >=20 > return EFI_UNSUPPORTED; > @@ -1425,7 +1467,7 @@ CreateRedfishDiscoverNetworkInterface ( } >=20 > /** > - This function destory network interface > + This function destroy network interface >=20 >=20 > @param[in] ThisNetworkInterface > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL instance. > @@ -1433,7 +1475,7 @@ CreateRedfishDiscoverNetworkInterface ( > @retval EFI_STATUS > **/ > EFI_STATUS > -DestroyRedfishNetwrokInterface ( > +DestroyRedfishNetworkInterface ( > IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *ThisNetworkInterface > ) > { > @@ -1467,11 +1509,13 @@ TestForRequiredProtocols ( > IN EFI_HANDLE ControllerHandle > ) > { > - UINT32 Id; > + UINT32 *Id; > UINTN Index; > EFI_STATUS Status; > + UINTN ListCount; >=20 > - for (Index =3D 0; Index < (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL)); Index++) { > + ListCount =3D (sizeof (gRequiredProtocol) / sizeof > + (REDFISH_DISCOVER_REQUIRED_PROTOCOL)); > + for (Index =3D 0; Index < ListCount; Index++) { > Status =3D gBS->OpenProtocol ( > ControllerHandle, > gRequiredProtocol[Index].RequiredServiceBindingProto= colGuid, > @@ -1490,8 +1534,10 @@ TestForRequiredProtocols ( > EFI_OPEN_PROTOCOL_GET_PROTOCOL > ); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a: %s is found on this controller handle.= \n", > __FUNCTION__, gRequiredProtocol[Index].ProtocolName)); > - return EFI_SUCCESS; > + if (Index =3D=3D ListCount - 1) { > + DEBUG ((DEBUG_ERROR, "%a: all required protocols are found on = this > controller handle: %p.\n", __FUNCTION__, ControllerHandle)); > + return EFI_SUCCESS; > + } > } > } > } > @@ -1517,7 +1563,7 @@ BuildupNetworkInterface ( > IN EFI_HANDLE ControllerHandle > ) > { > - UINT32 Id; > + UINT32 *Id; > UINT32 Index; > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > *NetworkInterface; > BOOLEAN IsNew; > @@ -1578,13 +1624,11 @@ BuildupNetworkInterface ( > return Status; > } >=20 > - NetworkInterface->NetworkProtocolType =3D > gRequiredProtocol[Index].ProtocolType; > - NetworkInterface->OpenDriverAgentHandle =3D Th= is- > >DriverBindingHandle; > - NetworkInterface->OpenDriverControllerHandle =3D > ControllerHandle; > - NetworkInterface->NetworkInterfaceProtocolInfo.ProtocolGuid =3D \ > - *gRequiredProtocol[Index].RequiredProtocolGuid; > - NetworkInterface->NetworkInterfaceProtocolInfo.ProtocolServiceGuid > =3D \ > - *gRequiredProtocol[Index].RequiredServiceBindingProtocolGuid; > + NetworkInterface->NetworkProtocolType =3D > gRequiredProtocol[Index].ProtocolType; > + NetworkInterface->OpenDriverAgentHandle =3D This- > >DriverBindingHandle; > + NetworkInterface->OpenDriverControllerHandle =3D ControllerHandle; > + CopyGuid (&NetworkInterface- > >NetworkInterfaceProtocolInfo.ProtocolGuid, > gRequiredProtocol[Index].RequiredProtocolGuid); > + CopyGuid > + (&NetworkInterface->NetworkInterfaceProtocolInfo.ProtocolServiceGuid, > + gRequiredProtocol[Index].RequiredServiceBindingProtocolGuid); > ProtocolDiscoverIdPtr =3D &NetworkInterface- > >NetworkInterfaceProtocolInfo.ProtocolDiscoverId; > OpenDriverAgentHandle =3D NetworkInterface- > >OpenDriverAgentHandle; > OpenDriverControllerHandle =3D NetworkInterface- > >OpenDriverControllerHandle; > @@ -1598,7 +1642,7 @@ BuildupNetworkInterface ( >=20 > gBS->RestoreTPL (OldTpl); > } else { > - // Record REST_EX instance. REST_EX is created when clinet asks fo= r > Redfish service discovery. > + // Record REST_EX instance. REST_EX is created when client asks fo= r > Redfish service discovery. > // Redfish Service Discover protocol will match REST EX to the > corresponding EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL > // when discovery. >=20 > @@ -1655,9 +1699,9 @@ BuildupNetworkInterface ( > ); > if (!EFI_ERROR (Status)) { > if ((gRequiredProtocol[Index].ProtocolType =3D=3D ProtocolTypeRe= stEx)) { > - // Install Redfish Discover Protocol when EFI REST EX protcol = is > discovered. > + // Install Redfish Discover Protocol when EFI REST EX protocol= is > discovered. > // This ensures EFI REST EX is ready while the consumer of > EFI_REDFISH_DISCOVER_PROTOCOL > - // acquires Redfish serivce over network interface. > + // acquires Redfish service over network interface. >=20 > if (!NewNetworkInterfaceInstalled) { > NetworkInterface =3D GetTargetNetworkInterfaceInternalByCont= roller > (ControllerHandle); @@ -1678,6 +1722,14 @@ BuildupNetworkInterface ( > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a: Fail to install > EFI_REDFISH_DISCOVER_PROTOCOL\n", __FUNCTION__)); > } > + } else { > + DEBUG ((DEBUG_INFO, "%a: Not REST EX, continue with next\n", > __FUNCTION__)); > + Index++; > + if (Index =3D=3D (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))) { > + break; > + } > + > + continue; > } > } >=20 > @@ -1692,11 +1744,11 @@ BuildupNetworkInterface ( > } > } while (Index < (sizeof (gRequiredProtocol) / sizeof > (REDFISH_DISCOVER_REQUIRED_PROTOCOL))); >=20 > - return EFI_UNSUPPORTED; > + return EFI_DEVICE_ERROR; > } >=20 > /** > - Close the protocol opened for Redfish discovery. This function also > destories > + Close the protocol opened for Redfish discovery. This function also > + destroy > the network services. >=20 > @param[in] ThisBindingProtocol A pointer to the > EFI_DRIVER_BINDING_PROTOCOL instance. > @@ -1707,8 +1759,8 @@ BuildupNetworkInterface ( > @param[in] DriverAgentHandle Driver agent handle which used to o= pen > protocol earlier. > @param[in] DriverControllerHandle Driver controller handle which used= to > open protocol earlier. >=20 > - @retval EFI_SUCCESS Prorocol is closed successfully. > - @retval Others Prorocol is closed unsuccessfully. > + @retval EFI_SUCCESS Protocol is closed successfully. > + @retval Others Protocol is closed unsuccessfully. >=20 > **/ > EFI_STATUS > @@ -1748,7 +1800,7 @@ CloseProtocolService ( > must support a protocol interface tha= t supplies > an I/O abstraction to the driver. > @retval EFI_SUCCESS One of required protocol is found. > - @retval Others Faile to stop the services on network= interface. > + @retval Others Failed to stop the services on networ= k interface. > **/ > EFI_STATUS > StopServiceOnNetworkInterface ( > @@ -1792,14 +1844,14 @@ StopServiceOnNetworkInterface ( > ThisNetworkInterface->OpenDriverControllerHandle > ); > if (!EFI_ERROR (Status)) { > - Status =3D DestroyRedfishNetwrokInterface (ThisNetworkInte= rface); > + Status =3D DestroyRedfishNetworkInterface > + (ThisNetworkInterface); > } >=20 > gBS->RestoreTPL (OldTpl); >=20 > // > // Disconnect EFI Redfish discover driver controller to noti= fy the > - // clinet which uses .EFI Redfish discover protocol. > + // client which uses .EFI Redfish discover protocol. > // > if (DiscoverProtocolHandle !=3D NULL) { > gBS->DisconnectController (DiscoverProtocolHandle, NULL, N= ULL); > @@ -1945,7 +1997,7 @@ RedfishDiscoverDriverBindingSupported ( > @retval EFI_SUCCESS The device was started. > @retval EFI_DEVICE_ERROR The device could not be started due t= o a > device error.Currently not implemented. > @retval EFI_OUT_OF_RESOURCES The request could not be completed > due to a lack of resources. > - @retval Others The driver failded to start the devic= e. > + @retval Others The driver failed to start the device= . >=20 > **/ > EFI_STATUS > @@ -2030,7 +2082,7 @@ RedfishDiscoverEntryPoint ( > InitializeListHead (&mEfiRedfishDiscoverNetworkInterface); > InitializeListHead (&mEfiRedfishDiscoverRestExInstance); > // > - // Install binding protoocl to obtain UDP and REST EX protocol. > + // Install binding protocol to obtain UDP and REST EX protocol. > // > Status =3D EfiLibInstallDriverBindingComponentName2 ( > ImageHandle, > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c > index 88cec1f416..0d6edc7dc3 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c > @@ -4,6 +4,7 @@ > Discover Redfish SMBIOS Host Interface. >=20 > (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -22,7 +23,7 @@ SMBIOS_TABLE_TYPE42 *mType42Record; > @param[out] DeviceDescriptor Pointer to REDFISH_INTERFACE_DATA. > @param[out] ProtocolData Pointer to > REDFISH_OVER_IP_PROTOCOL_DATA. >=20 > - @retval EFI_SUCCESS Get host interface succesfully. > + @retval EFI_SUCCESS Get host interface successfully. > @retval Otherwise Fail to tet host interface. >=20 > **/ > @@ -69,9 +70,15 @@ RedfishGetHostInterfaceProtocolData ( > // > if ((*RecordTmp =3D=3D > REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) || (*RecordTmp =3D=3D > REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2)) { > if (*RecordTmp =3D=3D > REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) { > - ASSERT (SpecificDataLen =3D=3D sizeof > (PCI_OR_PCIE_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1); > + if (SpecificDataLen !=3D sizeof > (PCI_OR_PCIE_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1) { > + ASSERT (SpecificDataLen =3D=3D sizeof > (PCI_OR_PCIE_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1); > + return EFI_VOLUME_CORRUPTED; > + } > } else { > - ASSERT (SpecificDataLen > sizeof > (REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2) + 1); > + if (SpecificDataLen !=3D sizeof > (USB_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1) { > + ASSERT (SpecificDataLen =3D=3D sizeof > (USB_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1); > + return EFI_VOLUME_CORRUPTED; > + } > } >=20 > *DeviceDescriptor =3D (REDFISH_INTERFACE_DATA *)RecordTmp; > -- > 2.40.0.windows.1