VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverInternal.h@ 107675

最後變更 在這個檔案從107675是 105670,由 vboxsync 提交於 7 月 前

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 13.1 KB
 
1/** @file
2 This file defines the EFI Redfish Discover Protocol interface.
3
4 (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
5 Copyright (c) 2022, AMD Incorporated. All rights reserved.
6 Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12#ifndef EFI_REDFISH_DISCOVER_INTERNAL_H_
13#define EFI_REDFISH_DISCOVER_INTERNAL_H_
14
15#include <Uefi.h>
16
17#include <Protocol/ComponentName.h>
18#include <Protocol/ComponentName2.h>
19#include <Protocol/DriverBinding.h>
20#include <Protocol/RedfishDiscover.h>
21#include <Protocol/Smbios.h>
22#include <Protocol/Tcp4.h>
23#include <Protocol/Tcp6.h>
24
25#include <Library/BaseLib.h>
26#include <Library/BaseMemoryLib.h>
27#include <Library/DebugLib.h>
28#include <Library/MemoryAllocationLib.h>
29#include <Library/NetLib.h>
30#include <Library/PrintLib.h>
31#include <Library/RedfishDebugLib.h>
32#include <Library/RestExLib.h>
33#include <Library/UefiLib.h>
34#include <Library/UefiBootServicesTableLib.h>
35#include <Library/UefiDriverEntryPoint.h>
36
37#include <IndustryStandard/RedfishHostInterface.h>
38
39#define REDFISH_DISCOVER_VERSION 0x00010000
40#define EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_TPL TPL_NOTIFY
41
42#define MAC_COMPARE(This, Target) (CompareMem ((VOID *)&(This)->MacAddress, &(Target)->MacAddress, (This)->HwAddressSize) == 0)
43#define VALID_TCP6(Target, This) ((Target)->IsIpv6 && ((This)->NetworkProtocolType == ProtocolTypeTcp6))
44#define VALID_TCP4(Target, This) (!(Target)->IsIpv6 && ((This)->NetworkProtocolType == ProtocolTypeTcp4))
45#define REDFISH_HI_ITERFACE_SPECIFIC_DATA_LENGTH_OFFSET ((UINT16)(UINTN)(&((SMBIOS_TABLE_TYPE42 *)0)->InterfaceTypeSpecificDataLength))
46#define REDFISH_HI_PROTOCOL_HOSTNAME_LENGTH_OFFSET ((UINT16)(UINTN)(&((REDFISH_OVER_IP_PROTOCOL_DATA *)0)->RedfishServiceHostnameLength))
47
48//
49// GUID definitions
50//
51
52#define EFI_REDFISH_DISCOVER_TCP4_INSTANCE_GUID \
53 { \
54 0xfbab97a4, 0x4c6a, 0xf8e8, { 0xf2, 0x25, 0x42, 0x8a, 0x80, 0x3f, 0xb6, 0xaa } \
55 }
56
57#define EFI_REDFISH_DISCOVER_TCP6_INSTANCE_GUID \
58 { \
59 0xbe513b6d, 0x41c1, 0x96Ed, { 0x8d, 0xaf, 0x3e, 0x89, 0xc5, 0xf5, 0x02, 0x25 } \
60 }
61
62#define EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_GUID \
63 { \
64 0xc44a6076, 0xd42a, 0x4d54, { 0x85, 0x6d, 0x98, 0x8a, 0x85, 0x8f, 0xa1, 0x11 } \
65 }
66
67extern EFI_COMPONENT_NAME_PROTOCOL gRedfishDiscoverComponentName;
68extern EFI_COMPONENT_NAME2_PROTOCOL gRedfishDiscoverComponentName2;
69extern EFI_UNICODE_STRING_TABLE *gRedfishDiscoverControllerNameTable;
70
71//
72// Enumeration of network protocols
73// required for the Redfish service discovery.
74//
75typedef enum {
76 ProtocolTypeTcp4 = 0, ///< Network protocol TCPv4.
77 ProtocolTypeTcp6, ///< Network protocol TCCv6.
78 ProtocolTypeRestEx, ///< REST EX over network protocol.
79 MaxProtocolType
80} NETWORK_INTERFACE_PROTOCOL_TYPE;
81
82//
83// Network protocol information installed on
84// the network interface.
85//
86typedef struct {
87 EFI_GUID ProtocolGuid; ///< Network protocol GUID.
88 EFI_GUID ProtocolServiceGuid; ///< Network protocol service GUID.
89 UINT32 ProtocolDiscoverId; ///< The identifier installed on network protocol handle.
90 EFI_HANDLE ProtocolControllerHandle; ///< The controller handle on network protocol.
91 VOID *NetworkProtocolInterface; ///< The protocol interface of network protocol.
92} REDFISH_DISCOVER_NETWORK_INTERFACE_PROTOCOL;
93
94//
95// Internal structure used to maintain network
96// interface properties.
97//
98typedef struct {
99 LIST_ENTRY Entry; ///< Link list entry.
100 EFI_HANDLE OpenDriverAgentHandle; ///< The agent to open network protocol.
101 EFI_HANDLE OpenDriverControllerHandle; ///< The controller handle to open network protocol.
102 UINTN HwAddressSize; ///< The size of network interface hardware address.
103 EFI_MAC_ADDRESS MacAddress; ///< MAC address of network interface.
104 CHAR16 *StrMacAddr; ///< String to MAC address of network interface.
105 BOOLEAN GotSubnetInfo; ///< Indicates sub net information is retrieved.
106 EFI_IP_ADDRESS SubnetAddr; ///< Subnet ID.
107 EFI_IP_ADDRESS SubnetMask; ///< Subnet mask (IPv4 only)
108 UINT8 SubnetPrefixLength; ///< Subnet prefix.
109 UINT16 VlanId; ///< VLAN ID
110 UINT32 SubnetAddrInfoIPv6Number; ///< IPv6 address info number.
111 EFI_IP6_ADDRESS_INFO *SubnetAddrInfoIPv6; ///< IPv6 address info.
112 //
113 // Network interface protocol and REST EX info.
114 //
115 UINT32 NetworkProtocolType; ///< Network protocol type. Refer to
116 ///< NETWORK_INTERFACE_PROTOCOL_TYPE.
117 REDFISH_DISCOVER_NETWORK_INTERFACE_PROTOCOL NetworkInterfaceProtocolInfo; ///< Network interface protocol information.
118 EFI_HANDLE RestExHandle; ///< REST EX handle associated with this network interface.
119 //
120 // EFI_REDFISH_DISCOVER_PROTOCOL instance installed
121 // on this network interface.
122 //
123 EFI_HANDLE EfiRedfishDiscoverProtocolHandle; ///< EFI_REDFISH_DISCOVER_PROTOCOL instance installed
124 ///< on this network interface.
125} EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL;
126
127//
128// Redfish Discover Instance signature
129//
130
131#define EFI_REDFISH_DISCOVER_DATA_SIGNATURE SIGNATURE_32 ('E', 'R', 'D', 'D')
132
133#define EFI_REDFISH_DISOVER_DATA_FROM_DISCOVER_PROTOCOL(a) \
134 CR (a, EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL, RedfishDiscoverProtocol, EFI_REDFISH_DISCOVER_DATA_SIGNATURE)
135
136//
137// Internal structure used to maintain REST EX properties.
138//
139typedef struct {
140 LIST_ENTRY Entry; ///< Link list entry.
141 UINT32 Signature; ///< Instance signature.
142 EFI_HANDLE OpenDriverAgentHandle; ///< The agent to open network protocol.
143 EFI_HANDLE OpenDriverControllerHandle; ///< The controller handle to open network protocol.
144 EFI_HANDLE RestExChildHandle; ///< The child handle created through REST EX Service Protocol.
145 EFI_HANDLE RestExControllerHandle; ///< The controller handle which provide REST EX protocol.
146 EFI_REST_EX_PROTOCOL *RestExProtocolInterface; ///< Pointer to EFI_REST_EX_PROTOCOL.
147 UINT32 RestExId; ///< The identifier installed on REST EX controller handle.
148 UINTN NumberOfNetworkInterfaces; ///< Number of network interfaces can do Redfish service discovery.
149 EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *NetworkInterfaceInstances; ///< Network interface instances. It's an array of instances. The number of entries
150 ///< in array is indicated by NumberOfNetworkInterfaces.
151 EFI_REDFISH_DISCOVER_PROTOCOL RedfishDiscoverProtocol; ///< EFI_REDFISH_DISCOVER_PROTOCOL protocol.
152} EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL;
153
154/**
155 This function to get subnet information.
156
157 @param[in] ImageHandle EFI handle with this image.
158 @param[in] Instance Instance of Network interface.
159 @retval EFI_STATUS Get subnet information successfully.
160 @retval Otherwise Fail to get subnet information.
161**/
162typedef
163EFI_STATUS
164(EFIAPI *EFI_REDFISH_DISCOVER_GET_SUBNET_INFO)(
165 IN EFI_HANDLE ImageHandle,
166 IN EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *Instance
167 );
168
169//
170// The require network protocol matrix.
171//
172typedef struct {
173 UINT32 ProtocolType; ///< Network protocol type,
174 ///< Refer to NETWORK_INTERFACE_PROTOCOL_TYPE.
175 CHAR16 *ProtocolName; ///< Protocol name.
176 EFI_GUID *RequiredProtocolGuid; ///< Network protocol interface GUID.
177 EFI_GUID *RequiredServiceBindingProtocolGuid; ///< Network protocol service GUID.
178 EFI_GUID *DiscoveredProtocolGuid; ///< Protocol interface GUID use to install identifier.
179 EFI_REDFISH_DISCOVER_GET_SUBNET_INFO GetSubnetInfo; ///< Function of getting subnet information.
180} REDFISH_DISCOVER_REQUIRED_PROTOCOL;
181
182//
183// Link list of Redfish discover instance.
184//
185typedef struct {
186 LIST_ENTRY NextInstance; ///< Next list.
187 EFI_REDFISH_DISCOVERED_INSTANCE *Instance; ///< Pointer to EFI_REDFISH_DISCOVERED_INSTANCE.
188} EFI_REDFISH_DISCOVERED_INTERNAL_LIST;
189
190//
191// Internal structure of Redfish discover instance.
192//
193typedef struct {
194 LIST_ENTRY Entry; ///< Link list entry.
195 EFI_HANDLE Owner; ///< The owner owns this Redfish service discovery.
196 ///< It's the EFI image handle of driver uses
197 ///< EFI Redfish Discover Protocol.
198 EFI_REDFISH_DISCOVER_FLAG DiscoverFlags; ///< EFI_REDFISH_DISCOVER_FLAG
199 EFI_REDFISH_DISCOVERED_TOKEN *DiscoverToken; ///< Token used to signal when Redfish service is discovered.
200 EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *NetworkInterface; ///< EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
201 ///< instance used to discover Redfish service.
202 //
203 // Below for Host interface discovery.
204 //
205 BOOLEAN HostIntfValidation; ///< Indicates whether to validate Redfish Host interface.
206 EFI_IP_ADDRESS TargetIpAddress; ///< Target IP address reported in Redfish Host interface.
207 UINT8 HostAddrFormat; ///< Unknown=00h, Ipv4=01h, Ipv6=02h.
208 EFI_IP_ADDRESS HostIpAddress; ///< Host IP address reported in Redfish Host interface.
209 EFI_IP_ADDRESS HostSubnetMask; ///< Host subnet mask address reported in Redfish Host interface.
210} EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE;
211
212/**
213 The function adds a new found Redfish service to internal list and
214 notify client.
215
216 It simply frees the packet.
217
218 @param[in] Instance EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE.
219 @param[in] RedfishVersion Redfish version.
220 @param[in] RedfishLocation Redfish location.
221 @param[in] Uuid Service UUID string.
222 @param[in] Os OS string.
223 @param[in] OsVer OS version string.
224 @param[in] Product Product string.
225 @param[in] ProductVer Product version string.
226 @param[in] UseHttps Redfish service requires secured connection.
227 @retval EFI_SUCCESS Redfish service is added to list successfully.
228
229**/
230EFI_STATUS
231AddAndSignalNewRedfishService (
232 IN EFI_REDFISH_DISCOVERED_INTERNAL_INSTANCE *Instance,
233 IN UINTN *RedfishVersion OPTIONAL,
234 IN CHAR8 *RedfishLocation OPTIONAL,
235 IN CHAR8 *Uuid OPTIONAL,
236 IN CHAR8 *Os OPTIONAL,
237 IN CHAR8 *OsVer OPTIONAL,
238 IN CHAR8 *Product OPTIONAL,
239 IN CHAR8 *ProductVer OPTIONAL,
240 IN BOOLEAN UseHttps
241 );
242
243/**
244 The function gets information reported in Redfish Host Interface.
245
246 It simply frees the packet.
247
248 @param[in] Smbios SMBIOS protocol.
249 @param[out] DeviceDescriptor Pointer to REDFISH_INTERFACE_DATA.
250 @param[out] ProtocolData Pointer to REDFISH_OVER_IP_PROTOCOL_DATA.
251
252 @retval EFI_SUCCESS Get host interface successfully.
253 @retval Otherwise Fail to tet host interface.
254
255**/
256EFI_STATUS
257RedfishGetHostInterfaceProtocolData (
258 IN EFI_SMBIOS_PROTOCOL *Smbios,
259 OUT REDFISH_INTERFACE_DATA **DeviceDescriptor,
260 OUT REDFISH_OVER_IP_PROTOCOL_DATA **ProtocolData
261 );
262
263extern EFI_GUID gRedfishDiscoverTcp4Instance;
264extern EFI_GUID gRedfishDiscoverTcp6Instance;
265extern EFI_GUID gRedfishDiscoverRestEXInstance;
266#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette