From nobody Fri Mar 29 13:42:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+66160+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66160+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1602566302; cv=none; d=zohomail.com; s=zohoarc; b=lvItZ2cgoa5C6PwDLCQ32uGctC+8cC4Myz2KwNPeCR+eZ5dLyBrb6bWEy28Qf6rAMbqSMMD/5vvDqfuj1z+9l2aa5bbDF0aal+CMGUINghDm/ETEOeDGLziRRjZPWSOj3gwYQnDe2XYwIiCXP0gVTmGtleASj2oBCubjbNbIpj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602566302; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=OZcmp4TYcz1FkVTRuBsCFbKwIaTvPJ8j0CY1+qHbEmc=; b=YvG1k8aMdccFl8FldmPGcm0oxXWF5S8M2MtgWEhEamVHpP8SsHBGO6ZaX9sfi25/rfVdAKp9y9h50D8XdgBDDR43af8usNQkAxzg9mVNo9nNEiwwVuhOGmgOJOPvg5uGKozQzDeSrrKVCylqeGad4hXpBgsutVnwpTo2s+iQc/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+66160+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1602566302198249.48765832971696; Mon, 12 Oct 2020 22:18:22 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id M7yZYY1788612xZh6EttYKMh; Mon, 12 Oct 2020 22:18:21 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.5115.1602566301139639713 for ; Mon, 12 Oct 2020 22:18:21 -0700 X-Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09D5Da66002128; Tue, 13 Oct 2020 05:18:20 GMT X-Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0a-002e3701.pphosted.com with ESMTP id 343q1eqyp5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Oct 2020 05:18:20 +0000 X-Received: from g2t2360.austin.hpecorp.net (g2t2360.austin.hpecorp.net [16.196.225.135]) by g2t2354.austin.hpe.com (Postfix) with ESMTP id 0673AAC; Tue, 13 Oct 2020 05:18:20 +0000 (UTC) X-Received: from abner-virtual-machine.asiapacific.hpqcorp.net (abner-virtual-machine.asiapacific.hpqcorp.net [15.119.210.153]) by g2t2360.austin.hpecorp.net (Postfix) with ESMTP id A1A8C3D; Tue, 13 Oct 2020 05:18:18 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: Jiaxin Wu , Siyuan Fu , Fan Wang , Jiewen Yao , Nickle Wang Subject: [edk2-devel] [Redfish Discover Header File PATCH] RedfishPkg/Include: EFI Redfish Discover Protocol header file Date: Tue, 13 Oct 2020 12:33:43 +0800 Message-Id: <20201013043343.21356-1-abner.chang@hpe.com> X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: 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,abner.chang@hpe.com X-Gm-Message-State: DJC7nbRyliupsUCeUuBb5Ma4x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1602566301; bh=LUSk4x4vsPtE7rhUQstrwxMnYJVTg3CUnnfqnLMEhyc=; h=Cc:Date:From:Reply-To:Subject:To; b=Koibr1viW2pwAFx0+nA6j/dnSEiheatQfxiOyiH1F4J3pgAll78LTo73M7I/LDeoImD T/b+tVOA9+ZVJqRKB7rq/0Hqc7kpnuGKxszmyxtr/JfiBKP0jD9YqSMiDpZ1zyXAdqfIx Inig9KJg6ugOnhWTV3Puw/2Jab9xaGlgu5o= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Header file of EFI Redfish Discover Protocol for UEFI spec v2.8 Section 31.1. Signed-off-by: Abner Chang Cc: Jiaxin Wu Cc: Siyuan Fu Cc: Fan Wang Cc: Jiewen Yao Cc: Nickle Wang Reviewed-by: Nickle Wang --- RedfishPkg/Include/Protocol/RedfishDiscover.h | 198 ++++++++++++++++++ RedfishPkg/RedfishPkg.dec | 7 + 2 files changed, 205 insertions(+) create mode 100644 RedfishPkg/Include/Protocol/RedfishDiscover.h diff --git a/RedfishPkg/Include/Protocol/RedfishDiscover.h b/RedfishPkg/Inc= lude/Protocol/RedfishDiscover.h new file mode 100644 index 0000000000..574d7a16a6 --- /dev/null +++ b/RedfishPkg/Include/Protocol/RedfishDiscover.h @@ -0,0 +1,198 @@ +/** @file + This file defines the EFI Redfish Discover Protocol interface. + + (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EFI_REDFISH_DISCOVER_PROTOCOL_H_ +#define EFI_REDFISH_DISCOVER_PROTOCOL_H_ + +#include +#include +#include +#include + +// +// GUID definitions +// +#define EFI_REDFISH_DISCOVER_PROTOCOL_GUID \ + { \ + 0x5db12509, 0x4550, 0x4347, { 0x96, 0xb3, 0x73, 0xc0, 0xff, 0x6e, 0x86= , 0x9f } \ + } + +#define REDFISH_DISCOVER_TOKEN_SIGNATURE SIGNATURE_32 ('R', 'F', 'T', '= S') + +typedef UINT32 EFI_REDFISH_DISCOVER_FLAG; +#define EFI_REDFISH_DISCOVER_HOST_INTERFACE 0x00000001 ///< Discover Redfi= sh server reported in SMBIOS 42h. +#define EFI_REDFISH_DISCOVER_SSDP 0x00000002 ///< Discover Redfi= sh server using UPnP Http search method. +#define EFI_REDFISH_DISCOVER_SSDP_UDP6 0x00000004 ///< Use UDP versio= n 6. +#define EFI_REDFISH_DISCOVER_KEEP_ALIVE 0x00000008 ///< Keep to send U= PnP Search in the duration indicated in + ///< EFI_REDFISH_DI= SCOVER_DURATION_MASK. +#define EFI_REDFISH_DISCOVER_RENEW 0x00000010 ///< Set this bit t= o indicate this function to notify the caller + ///< a list of all = Redfish servers it found. Otherwise, this fucntion + ///< just notify th= e caller new found Redfish servers. + ///< +#define EFI_REDFISH_DISCOVER_VALIDATION 0x80000000 ///< Validate Redfi= sh service for host interface instance. +#define EFI_REDFISH_DISCOVER_DURATION_MASK 0x0f000000 ///< 2 to the Power= of Duration. The valid value of duration is between + ///< 3 to 15. The c= orresponding duration is 8 to 2^15 seconds. + ///< Duration is on= ly valid when EFI_REDFISH_DISCOVER_KEEP_ALIVE + ///< is set to 1. +#define EFI_REDFISH_DISCOVER_DURATION_BIT_POS 8 + +typedef struct _EFI_REDFISH_DISCOVER_PROTOCOL EFI_REDFISH_DISCOVER_PROTOCO= L; + +typedef struct _EFI_REDFISH_DISCOVERED_INFORMATION { + EFI_HANDLE RedfishRestExHandle; ///< REST EX EFI handle associ= ated with this Redfish service. + BOOLEAN IsUdp6; ///< Indicates it's IP versino= 6. + EFI_IP_ADDRESS RedfishHostIpAddress; ///< IP address of Redfish ser= vice. + UINTN RedfishVersion; ///< Redfish service version. + CHAR16 *Location; ///< Redfish service location. + CHAR16 *Uuid; ///< Redfish service UUID. + CHAR16 *OS; ///< Redfish service OS. + CHAR16 *OSVersion; ///< Redfish service OS versio= n. + CHAR16 *Product; ///< Redfish service product n= ame. + CHAR16 *ProductVer; ///< Redfish service product v= ersion. + BOOLEAN UseHttps; ///< Using HTTPS. +} EFI_REDFISH_DISCOVERED_INFORMATION; + +typedef struct { + EFI_STATUS Status; ///< Status of Redfish= service discovery. + EFI_REDFISH_DISCOVERED_INFORMATION Information; ///< Redfish service d= iscovered. +} EFI_REDFISH_DISCOVERED_INSTANCE; + +typedef struct { + UINTN NumberOfServiceFound; ///< Must be 0 when p= ass to Acquire (). + EFI_REDFISH_DISCOVERED_INSTANCE *RedfishInstances; ///< Must be NULL whe= n pass to Acquire (). +} EFI_REDFISH_DISCOVERED_LIST; + +typedef struct { + EFI_MAC_ADDRESS MacAddress; ///< MAC address of netw= ork interfase to discover Redfish service. + BOOLEAN IsIpv6; ///< Indicates it's IP v= ersino 6. + EFI_IP_ADDRESS SubnetId; ///< Subnet ID. + UINT8 SubnetPrefixLength; ///< Subnet prefix-lengt= h for IPv4 and IPv6. + UINT16 VlanId; ///< VLAN ID. +} EFI_REDFISH_DISCOVER_NETWORK_INSTANCE; + +typedef struct { + UINT32 Signature; ///< Token signature. + EFI_REDFISH_DISCOVERED_LIST DiscoverList; ///< The memory of EFI_REDFISH= _DISCOVERED_LIST is + ///< allocated by Acquire() an= d freed when caller invoke Release(). + EFI_EVENT Event; ///< The TPL_CALLBACK event to be notifi= ed when Redfish services + ///< are discovered or any errors occurr= ed during discovery. + UINTN Timeout; ///< The timeout value declared in EFI_R= EDFISH_DISCOVERED_TOKEN + ///< determines the seconds to drop disc= over process. + ///< Basically, the nearby Redfish servi= ces must response in >=3D1 + ///< and <=3D 5 seconds. The valid timeo= ut value used to have + ///< asynchronous discovery is >=3D 1 an= d <=3D 5 seconds. Set the + ///< timeout to zero means to discover R= edfish service synchronously. + ///< Event in token is created by caller= to listen the Reefish services + ///< found by Acquire(). +} EFI_REDFISH_DISCOVERED_TOKEN; + +/** + This function gets the NIC list which Redfish discover protocol + can discover Redfish service on it. + + @param[in] This EFI_REDFISH_DISCOVER_PROTOCOL instance. + @param[in] ImageHandle EFI Image handle request the NIC list, + @param[out] NumberOfNetworkInterfaces Number of NICs can do Redfish se= rvice discovery. + @param[out] NetworkInterfaces NIC instances. It's an array of instance= . The number of entries + in array is indicated by NumberOfNetworkInter= faces. + Caller has to release the memory + allocated by Redfish discover protocol. + + @retval EFI_SUCCESS REST EX instances of discovered Redfish are r= eleased. + @retval Others Fail to remove the entry + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_REDFISH_DISCOVER_NETWORK_LIST)( + IN EFI_REDFISH_DISCOVER_PROTOCOL *This, + IN EFI_HANDLE ImageHandle, + OUT UINTN *NumberOfNetworkInterfaces, + OUT EFI_REDFISH_DISCOVER_NETWORK_INSTANCE **NetworkInterfaces +); + +/** + This function acquires Redfish services by discovering static Redfish se= tting + according to Redfish Host Interface or through SSDP. Returns a list of E= FI + handles in EFI_REDFISH_DISCOVERED_LIST. Each of EFI handle has coorespon= ding + EFI REST EX instance installed on it. Each REST EX isntance is a child i= nstance which + created through EFI REST EX serivce protoocl for communicating with spec= ific + Redfish service. + + @param[in] This EFI_REDFISH_DISCOVER_PROTOCOL instance. + @param[in] ImageHandle EFI image owns these Redfish service instanc= es. + @param[in] TargetNetworkInterface Target NIC to do the discovery. + NULL means discover Redfish service on all N= ICs on platform. + @param[in] Flags Redfish service discover flags. + @param[in] Token EFI_REDFISH_DISCOVERED_TOKEN instance. + The memory of EFI_REDFISH_DISCOVERED_LIST an= d the strings in + EFI_REDFISH_DISCOVERED_INFORMATION are all a= llocated by Acquire() + and must be freed when caller invoke Release= (). + + @retval EFI_SUCCESS REST EX instance of discovered Redfish s= ervices are returned. + @retval EFI_INVALID_PARAMETERS ImageHandle =3D=3D NULL, Flags =3D=3D 0,= Token =3D=3D NULL, Token->Timeout > 5, + or Token->Event =3D=3D NULL. + @retval Others Fail acquire Redfish services. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_REDFISH_DISCOVER_ACQUIRE_SERVICE)( + IN EFI_REDFISH_DISCOVER_PROTOCOL *This, + IN EFI_HANDLE ImageHandle, + IN EFI_REDFISH_DISCOVER_NETWORK_INSTANCE *TargetNetworkInterface, + IN EFI_REDFISH_DISCOVER_FLAG Flags, + IN EFI_REDFISH_DISCOVERED_TOKEN *Token +); + +/** + This function aborts Redfish service discovery on the given network inte= rface. + + @param[in] This EFI_REDFISH_DISCOVER_PROTOCOL instance. + @param[in] TargetNetworkInterface Target NIC to do the discovery. + + @retval EFI_SUCCESS REST EX instance of discovered Redfish s= ervices are returned. + @retval Others Fail to abort Redfish service discovery. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_REDFISH_DISCOVER_ABORT_ACQUIRE)( + IN EFI_REDFISH_DISCOVER_PROTOCOL *This, + IN EFI_REDFISH_DISCOVER_NETWORK_INSTANCE *TargetNetworkInterface OPTION= AL +); + +/** + This function releases Redfish services found by RedfishServiceAcquire(). + + @param[in] This EFI_REDFISH_DISCOVER_PROTOCOL instance. + @param[in] InstanceList The Redfish service to release. + + @retval EFI_SUCCESS REST EX instances of discovered Redfish are r= eleased. + @retval Others Fail to remove the entry + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_REDFISH_DISCOVER_RELEASE_SERVICE)( + IN EFI_REDFISH_DISCOVER_PROTOCOL *This, + IN EFI_REDFISH_DISCOVERED_LIST *InstanceList +); + +typedef struct _EFI_REDFISH_DISCOVER_PROTOCOL { + EFI_REDFISH_DISCOVER_NETWORK_LIST GetNetworkInterfaceList; + EFI_REDFISH_DISCOVER_ACQUIRE_SERVICE AcquireRedfishService; + EFI_REDFISH_DISCOVER_ABORT_ACQUIRE AbortAcquireRedfishService; + EFI_REDFISH_DISCOVER_RELEASE_SERVICE ReleaseRedfishService; +} EFI_REDFISH_DISCOVER_PROTOCOL; + +extern EFI_GUID gEfiRestExProtocolGuid; +extern EFI_GUID gEfiRestExServiceBindingProtocolGuid; +extern EFI_GUID gEfiRedfishDiscoverProtocolGuid; +#endif diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec index e95ec5fe10..d8e174258a 100644 --- a/RedfishPkg/RedfishPkg.dec +++ b/RedfishPkg/RedfishPkg.dec @@ -13,6 +13,13 @@ PACKAGE_GUID =3D c432b76e-5232-11e7-9010-005056c00008 PACKAGE_VERSION =3D 1.0 =20 +[Includes] + Include + +[Protocols] + ## Include/Protocol/RedfishDiscover.h + gEfiRedfishDiscoverProtocolGuid =3D { 0x5db12509, 0x4550, 0x4347, {= 0x96, 0xb3, 0x73, 0xc0, 0xff, 0x6e, 0x86, 0x9f }} + [Guids] gEfiRedfishPkgTokenSpaceGuid =3D { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x= 88, 0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }} =20 --=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 (#66160): https://edk2.groups.io/g/devel/message/66160 Mute This Topic: https://groups.io/mt/77477678/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-