From: "Chang, Abner" <abner.chang@amd.com>
To: <devel@edk2.groups.io>
Cc: Isaac Oram <isaac.w.oram@intel.com>,
Abdul Lateef Attar <abdattar@amd.com>,
Nickle Wang <nicklew@nvidia.com>,
Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Subject: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFru: IPMI FRU Driver
Date: Fri, 12 May 2023 11:26:33 +0800 [thread overview]
Message-ID: <20230512032633.1740-1-abner.chang@amd.com> (raw)
From: Abner Chang <abner.chang@amd.com>
IpmiFru is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/IpmiFru in order to consolidate
edk2 system manageability support in one place.
Uncustify is applied to C files and no functionalities
are changed in this patch.
We will still keep the one under IpmiFeaturePkg/IpmiFru
until the reference to this instance are removed from
platforms.
Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
---
.../Universal/IpmiFru/IpmiFru.inf | 34 ++++++++++
.../Universal/IpmiFru/IpmiFru.c | 67 +++++++++++++++++++
2 files changed, 101 insertions(+)
create mode 100644 Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf
create mode 100644 Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c
diff --git a/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf
new file mode 100644
index 0000000000..ddef310309
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf
@@ -0,0 +1,34 @@
+### @file
+# Component description file for IPMI FRU.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = IpmiFru
+ FILE_GUID = CD9B99D9-E86F-48CF-A8EB-20120AC22666
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeFru
+
+[Sources]
+ IpmiFru.c
+
+[Packages]
+ ManageabilityPkg/ManageabilityPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ IpmiCommandLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiLib
+
+[Depex]
+ TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c
new file mode 100644
index 0000000000..2b489410db
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c
@@ -0,0 +1,67 @@
+/** @file
+ IPMI FRU Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+/*++
+
+Routine Description:
+
+ Initialize SM Redirection Fru Layer
+
+Arguments:
+
+ ImageHandle - ImageHandle of the loaded driver
+ SystemTable - Pointer to the System Table
+
+Returns:
+
+ EFI_STATUS
+
+--*/
+EFI_STATUS
+EFIAPI
+InitializeFru (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo;
+ IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoRequest;
+ IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoResponse;
+
+ //
+ // Get all the SDR Records from BMC and retrieve the Record ID from the structure for future use.
+ //
+ Status = IpmiGetDeviceId (&ControllerInfo);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=%x\n", Status));
+ return Status;
+ }
+
+ DEBUG ((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", ControllerInfo.DeviceSupport.Bits.FruInventorySupport));
+
+ if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) {
+ GetFruInventoryAreaInfoRequest.DeviceId = 0;
+ Status = IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoRequest, &GetFruInventoryAreaInfoResponse);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Status=%x\n", Status));
+ return Status;
+ }
+
+ DEBUG ((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=%x\n", GetFruInventoryAreaInfoResponse.InventoryAreaSize));
+ }
+
+ return EFI_SUCCESS;
+}
--
2.37.1.windows.1
next reply other threads:[~2023-05-12 3:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 3:26 Chang, Abner [this message]
2023-05-12 3:54 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFru: IPMI FRU Driver Nickle Wang
2023-05-12 7:50 ` Tinh Nguyen
2023-05-19 3:07 ` [edk2-devel] " Isaac Oram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230512032633.1740-1-abner.chang@amd.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox