Commit Graph

155 Commits

Author SHA1 Message Date
Savva Mitrofanov f47aa892ca RedfishPkg/BaseUcs2Utf8Lib: Fix out of bounds shift in UTF8ToUCS2Char
Missing masks leads to shift out of bounds. Also there is no need to
construct CHAR16 using cast to CHAR8 buffer, better to use native endian
by assigning data directly into Ucs2Char variable

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
2024-07-22 12:45:14 +03:00
Nickle Wang 24fa360857 RedfishPkg: Rename x-uefi-redfish to x-UEFI-redfish
Rename x-uefi-redfish to x-UEFI-redfish to match the format of
UEFI configuration namespace prefix.

RFC: https://edk2.groups.io/g/rfc/message/849

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Co-authored-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2024-05-04 04:03:13 +00:00
Nickle Wang 6fb3cc05dc RedfishPkg/RedfishPlatformConfigDxe: support menu path report
"MenuPath" is the attribute in BIOS attribute registry. To support
reporting this attribute, we need to include the formset without
x-uefi-redfish support in database. So driver can find menu path to
target attribute in BIOS menu.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-04-04 14:24:31 +00:00
Abner Chang 2e4e41d012 RedfishPkg/RedfishPlatformConfigDxe: HII string is deleted unexpectedly
Add the condition check when delete HII string.
Only when the HiiStatement operand equal to "EFI_IFR_STRING_OP"
and the statement value type = EFI_IFR_TYPE_STRING.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Co-authored-by: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-04-04 14:24:31 +00:00
Abner Chang c8f56800fd RedfishPkg/RedfishPlatformConfigDxe:Add RefishDebugLib support
Add RedfishPlatformConfigDxe debug capability that aligns
with edk2 Redfish debug mechanism.

- PcdRedfishPlatformConfigDebugProperty, add PCD to control
  RedfishPlatformConfigDxe subordinate of Redfish debug
  capabilities.
- PcdRedfishPlatformConfigFeatureProperty, add PCD to
  manage RedfishPlatformConfigDxe features.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Co-authored-by: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-04-04 14:24:31 +00:00
Abner Chang b0be42516e RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro
Introduce DEBUG_REDFISH macro for the debug message
of edk2 Redfish components.
DEBUG_REDFISH can be used in any edk2 Redfish component
with Redfish DebugCatagory as the first parameter.
Whether the debug message is output or not depends on
the platform setting of PcdRedfishDebugCatagory.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-04-04 14:24:31 +00:00
abnchang 29114fc574 RedfishPkg/RedfishPlatformConfigDxe: Config language searching optimization
Build up the x-uefi-redfish string database for the Redfish confg
language searching, instead of using HII String protocol.
This can improve the time consumption lot on searching strings.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Co-authored-by: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-04-04 14:24:31 +00:00
Nickle Wang d9a6e7b0b8 RedfishPkg/RedfishCrtLib: fix unresolved external symbol issue
-Fix below compiler error reported in edk2 CI.
ERROR - Linker #2001 from JsonLib.lib(load.obj) : unresolved external
symbol __ftol2
-The file MathFtol.c is copied from IntrinsicLib in CryptoPkg.
-Add MathFtol.c to EccCheck IgnoreFiles.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-02-29 03:25:18 +00:00
Nickle Wang d4c76fa17d RedfishPkg/RedfishDebugLib: use RedfishHttpLib
Remove RedfishLib and use RedfishHttpLib for debug printing
Redfish response data.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-02-29 03:25:18 +00:00
Nickle Wang 422dfaab31 RedfishPkg/RedfishLib: include RedfishServiceData.h
Redfish common structures are moved to RedfishServiceData.h. Remove
them from RedfishLib.h

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-02-29 03:25:18 +00:00
Nickle Wang 9da786c16f RedfishPkg: introduce RedfishHttpLib
RedfishHttpLib is a wrapper library for Redfish feature drivers to
call Redfish HTTP Protocol easily.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-02-29 03:25:18 +00:00
Nickle Wang 0ce2012c6c RedfishPkg: implement Redfish HTTP protocol
implement Redfish HTTP protocol driver.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Co-authored-by: Igor Kulchytskyy <igork@ami.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-02-29 03:25:18 +00:00
Nickle Wang 1988f2df29 RedfishPkg: introduce Redfish HTTP protocol
Introduce Redfish HTTP protocol to improve Redfish performance
and communication stability between BIOS and Redfish service.
- Feature drivers often query same Redfish resource multiple
times for different purpose. Implement HTTP cache mechanism to
improve HTTP GET performance. "UseCache" parameter is provided
if application likes to send HTTP GET request to Redfish service
without using cache data.
- This driver will retire stale cache data automatically when
application modify Redfish resource at service side.
- PCD PcdHttpCacheDisabled is used to disable cache mechanism in
this driver for debugging purpose.
- PCD PcdRedfishServiceContentEncoding is used to enable content
encoding while sending data to Redfish service.
- Redfish HTTP protocol also implement retry mechanism to retry
HTTP request when BIOS receive unexpected response from Redfish service.
This function helps BIOS Redfish to finish its job as much as possible.
- PCDs are defined to control how many times BIOS will retry the
request and how many time BIOS will wait between retries.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Co-authored-by: Igor Kulchytskyy <igork@ami.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
2024-02-29 03:25:18 +00:00
Abner Chang 74b5309da9 RedfishPkg/RestJsonStructureDxe: Refine REST JSON C Structure DXE driver
BZ #: 4711
- Add mode debug messages.
- Remove the references of "Redfish" from this driver.
  As REST JSON C Structure was not designed for Redfish only.
  Any RESTful applications can register the converter and
  provide JSON-C structure conversions through
  EFI_REST_JSON_STRUCTURE_PROTOCOL. Therefore this driver
  shouldn't have a dependency on Redfish package and the
  references of "Redfish" terminology.
- Fix the missing parameter of DEBUG macros used in this
  driver.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
2024-02-27 07:39:51 +00:00
Abner Chang 9971b99461 RedfishPkg/JsonLib: Add JSON delete object function
To support the deletion on a specified JSON object.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
2024-01-16 09:13:03 +00:00
Nickle Wang d65b183f92 RedfishPkg/RedfishCrtLib: handle floating point number in JSON
When the value type is defined as number in Redfish schema, floating
point number is allowed. RedfishCrtLib raises assert without handling
this case now. Follow the way in EDK2 to call AsciiStrDecimalToUintnS
and handle the floating point number. Only the integer value is
returned.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2024-01-15 08:11:22 +00:00
Nickle Wang bc34a79cd2 RedfishPkg/RedfishDebugLib: add function to print buffer.
Introduce DumpBuffer function to print the buffer content. This helps
developer to debug Redfish issue.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2024-01-10 10:17:14 +00:00
Abner Chang 265b4ab91b RedfishPkg/RedfishRestExDxe: Update Supported function
Update Supported function to check it the given
controller handle is already started.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
2024-01-10 03:19:31 +00:00
Abner Chang b0e892d8a9 RedfishPkg/RedfishRestExDxe: Uncrustify RedfishRestExDriver.h
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
2024-01-10 03:19:31 +00:00
Abner Chang 0a12d8bd55 RedfishPkg/RedfishRestExDxe: Implement EDKII_HTTP_CALLBACK_PROTOCOL
Implement EDKII_HTTP_CALLBACK_PROTOCOL that listens to
HttpEventTlsConfigured event for reconfiguring TLS configuration
data.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
2024-01-10 03:19:31 +00:00
Mike Maslenkin d7d4f09ff8 RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses
URI is generated based on the RedfishLocation containing an ASCII string
representing the IP address. So, in the case of IPv4 the canonical
representation of an IPv4 address was inserted into the resulting Unicode
string i.e: "http{,s}://X.X.X.X/".

In the case of IPv6, to access resources, the IP address must be specified
in brackets, i.e. the resulting string should look like:
  "http{,s}://[X::X:X:X:X]/".

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 91f1ce4e27 RedfishDiscoverDxe: handle memory allocation error conditions.
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4625

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 139887a989 RedfishDiscoverDxe: release resources when refreshing information data
It is required to free previously allocated strings stored in
DiscoveredInstance->Information structure.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin f8de39afab RedfishDiscoverDxe: add a helper function deallocating string resources.
This patch adds a handy helper function deallocating resources from the
EFI_REDFISH_DISCOVERED_INFORMATION structure instance.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin d1c21f8d55 RedfishDiscoverDxe: refine InitInformationData() function
Cache size of ASCII string in local variable.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 17870bf3f5 RedfishDiscoverDxe: refine InitInformationData(), remove unnecessary casts
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 2cd1b439d7 RedfishDiscoverDxe: introduce InitInformationData helper function
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 24de462a9d RedfishPkg: add proper initialization of IPMI request
All fields of IPMI_CHANNEL_INFO_CHANNEL_NUMBER union must be
initialized to avoid error condition on BMC side.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 8b59cb79fa RedfishPkg: add Component Name protocols to RedfishConfigHandler driver
Currently there is no description for RedfishConfigHandler driver.
This leads to <null string> in the "DRIVER NAME" column of a `drivers`
command for example.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin a87e8505b1 RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin d81813368a RedfishPkg: RedfishPlatformConfigDxe: reduce memory allocations
It's unclear why the new string is allocated as copy of the original
string if its pointer is stored in an array and the original string
is released immediately after the copy is created. All data allocated
in the same pool.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 0f66c2e687 RedfishPkg: get rid of unused definitions from RedfishCrtLib.h
It seems that initial implementation of this header file is based on
CrtLibSupport.h from CryptoPkg. But uid, euid, gid, egid and sa_family_t
sre not used in RedfishPkg. So remove them.

Also take "true" and "false" definition from MdePkg's LibFdtSupport.h
header file, that also seems based on a header mentioned above.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 4fdd5165c1 RedfishPkg: fix RedfishPlatformCredentialLib library class name typo.
RedfishPlatformCredentialIpmiLib is the library instance name not the
class name.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Mike Maslenkin 59b4b5017c RedfishPkg: fix RedfishPlatformHostInterfaceLib library class name typo.
PlatformHostInterfaceBmcUsbNicLib is the library instance name not
the class name.

Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
2023-12-27 00:09:49 +00:00
Abner Chang b8a3eec88c RedfishPkg/RedfishDicovery: Remedy Redfish service discovery flow
Remedy Redfish service discovery flow changes made
in commit 8736b8fd.

The above fix creates the dependency with SMBIOS 42h record,
which has a problem as SMBIOS 42h may not be created when
RedfishDiscovery.Supported() is invoked even all of the
required protocols are ready on the ControllerHandle. We can’t
guarantee SMBIOS 42 structure will be always created before
ConnectController(). USB NIC maybe detected late and it means
PlatformHostInterfaceBmcUsbNicLib can populate SMBIOS 42h
information late as well. Calling to
RedfishServiceGetNetworkInterface with the previous fix may
result in no network interface for BMC-exposed NIC as SMBIOS
42h is not ready yet.This is the first issue.

Second, to skip the network interface when
NetworkInterfaceGetSubnetInfo() returns a failure also has
problem, as the NIC may be configured via RestEx->Configure().
This happens after the Host interface is discovered, as at this
moment we have the sufficient network information to configure
BMC-exposed NIC.

Base on Redfish spec in 31.1.5.2, “EFI Redfish Client may provide
selection UI of network interfaces for Redfish service discovery.",
This means edk2 Redfish client gets all network interfaces
through RedfishServiceGetNetworkInterface and choose the desired
network interface at its discretion for Redfish service.

So the fix here is:
1. In BuildNetworkInterface(), we don’t skip any network
   interface. In RedfishServiceGetNetworkInterface, we don’t
   skip any network interface even the subnet information is not
   retrieved. We will still return all of network interfaces to
   client.
2. In RedfishServiceAcquireService for
   EFI_REDFISH_RISCOVER_HOST_INTERFACE case, we don’t skip any
   network interface even the subnet information is not
   retrieved.

3. Added some more debug information.

Note: The subnet information is used for the scenario the system
is managed by a centralized Redfish service (not on BMC), says
the multiple Redfish computer system instances. As it mentions
in 31.1.5.2, Redfish client they may have to know the subnet
information so they can know the network domain the NIC is
connected. There may have multiple subnets in the corporation
network environment. So the subnet information provides client
an idea when they choose the network interface, so does VLAN ID.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-13 03:07:43 +00:00
Abner Chang 120aa60644 RedfishPkg/HostInterfaceBmcUsbNic: Fix potential memory corruption issue
Wrong memory allocation issue may result in memory
corruption.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang 5cdeff1eb3 RedfishPkg/HostInterfaceBmcUsbNic: Fix incorrect HI protocol record size
The size of structure must be minus with byte that is
occupied by the initial array.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang cf31257ec9 RedfishPkg/HostInterfaceBmcUsbNic: Correct MAC address reference
MAC address reference is incorrect when it is
copied to Host Interface DeviceDescriptor.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang cfafa45002 RedfishPkg/RedfishDiscovery: Refine SMBIOS 42h code
Refine SMBIOS 42h code add mode debug message
for the error conditions.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang 4b5e2b3ac1 RedfishPkg/RedfishDiscovery: Add more debug message
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang dbaf9d3046 RedfishPkg/RedfishConfigHandler: Correct the prototype of callback function
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang 8325fd6466 RedfishPkg/RedfishConfigHandler: Use Redfish HI readiness notification
Wait until Redfish Host Interface is installed on
the system then acquire Redfish service.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang 843ed20714 RedfishPkg/RedfishHostInterfaceDxe: Add Redfish HI readiness notification
Introduce gEdkIIRedfishHostInterfaceReadyProtocolGuid
and produce it when Redfish Host Interface is installed
on system.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang a3b56f93e1 RedfishPkg/BmcUsbNicLib: Update BMC USB NIC searching algorithm
Update BMC USB NIC searching algorithm for IPv4 only.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Co-authored-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-12-05 03:27:03 +00:00
Abner Chang 70b174e24d RedfishPkg/HostInterfaceBmcUsbNic: Set default Redfish service port
BZ #4607
Create a PCD for the default Redfish service port.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
2023-12-01 15:06:21 +00:00
Mike Maslenkin b4f8c75e31 RedfishPkg: add explicit variable initialization
Ancient GCC 4.8.5 warned about variable may be unitialied.
And it doesn't look like false alarm.

The warning is:
edk2/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c: In function 'GetQuestionDefault':
edk2/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c:5519:6: error: 'ConfigAccess' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   if (ConfigAccess != NULL) {

Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-11-30 07:10:34 +00:00
Mike Maslenkin ed923afda5 RedfishPkg: fix memory leak in HiiUtilityLib
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2023-11-30 07:10:34 +00:00
Igor Kulchytskyy 8736b8fdca RedfishPkg: RedfishDiscoverDxe: Optimize the Redfish Discover flow
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4602

Filter out the network interfaces which are not supported by
Redfish Host Interface.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
2023-11-22 13:31:54 +00:00
Igor Kulchytskyy f444c4bea5 RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4602

Supported function of the driver changed to wait for all network
interface to be installed.

Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by Mike Maslenkin <mike.maslenkin@gmail.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
2023-11-22 13:31:54 +00:00
Liming Gao 8dd52c949e Revert "RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed later"
This reverts commit 06b27ccb90.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-11-22 13:31:54 +00:00