public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH v1 1/1] ManageabilityPkg: Ipmi Get/Set Boot Options
@ 2023-07-10 19:23 brit.chesley
  2023-07-11  1:36 ` Chang, Abner
       [not found] ` <1770AC5D28826C6A.5563@groups.io>
  0 siblings, 2 replies; 5+ messages in thread
From: brit.chesley @ 2023-07-10 19:23 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Isaac Oram, Abdul Lateef Attar, Nickle Wang

From: Brit Chesley <brit.chesley@amd.com>

BZ #: 4455.
Support parameter selectors for IPMI Get/Set boot options. The size of
the response data is now dependent on the parameter selector, rather
than being fixed.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Signed-off-by: Brit Chesley <Brit.Chesley@amd.com>
---
 .../IpmiCommandLibNetFnChassis.c              | 124 ++++++++++++++----
 1 file changed, 102 insertions(+), 22 deletions(-)

diff --git a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
index 0c40ad20b98a..01682f55b36d 100644
--- a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
+++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
@@ -152,17 +152,58 @@ IpmiSetSystemBootOptions (
   )
 {
   EFI_STATUS  Status;
-  UINT32      DataSize;
-
-  DataSize = sizeof (*BootOptionsResponse);
-  Status   = IpmiSubmitCommand (
-               IPMI_NETFN_CHASSIS,
-               IPMI_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
-               (VOID *)BootOptionsRequest,
-               sizeof (*BootOptionsRequest),
-               (VOID *)BootOptionsResponse,
-               &DataSize
-               );
+  UINT32      RequestDataSize;
+  UINT32      ResponseDataSize;
+
+  ResponseDataSize = sizeof (*BootOptionsResponse);
+  RequestDataSize  = sizeof (*BootOptionsRequest);
+
+  switch (BootOptionsRequest->ParameterValid.Bits.ParameterSelector) {
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SET_IN_PROGRESS:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_0);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SELECTOR:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_1);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SCAN:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_2);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_BMC_BOOT_FLAG:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_3);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INFO_ACK:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_4);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_FLAGS:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_5);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_INFO:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_6);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_MAILBOX:
+      RequestDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_7);
+      break;
+
+    default:
+      return EFI_INVALID_PARAMETER;
+      break;
+  }
+
+  Status = IpmiSubmitCommand (
+             IPMI_NETFN_CHASSIS,
+             IPMI_CHASSIS_SET_SYSTEM_BOOT_OPTIONS,
+             (VOID *)BootOptionsRequest,
+             RequestDataSize,
+             (VOID *)BootOptionsResponse,
+             &ResponseDataSize
+             );
   return Status;
 }
 
@@ -184,16 +225,55 @@ IpmiGetSystemBootOptions (
   )
 {
   EFI_STATUS  Status;
-  UINT32      DataSize;
-
-  DataSize = sizeof (*BootOptionsResponse);
-  Status   = IpmiSubmitCommand (
-               IPMI_NETFN_CHASSIS,
-               IPMI_CHASSIS_GET_SYSTEM_BOOT_OPTIONS,
-               (VOID *)BootOptionsRequest,
-               sizeof (*BootOptionsRequest),
-               (VOID *)BootOptionsResponse,
-               &DataSize
-               );
+  UINT32      ResponseDataSize;
+
+  ResponseDataSize = sizeof (*BootOptionsResponse);
+
+  switch (BootOptionsRequest->ParameterSelector.Bits.ParameterSelector) {
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SET_IN_PROGRESS:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_0);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SELECTOR:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_1);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_SERVICE_PARTITION_SCAN:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_2);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_SELECTOR_BMC_BOOT_FLAG:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_3);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INFO_ACK:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_4);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_FLAGS:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_5);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_INFO:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_6);
+      break;
+
+    case IPMI_BOOT_OPTIONS_PARAMETER_BOOT_INITIATOR_MAILBOX:
+      ResponseDataSize += sizeof (IPMI_BOOT_OPTIONS_RESPONSE_PARAMETER_7);
+      break;
+
+    default:
+      return EFI_INVALID_PARAMETER;
+      break;
+  }
+
+  Status = IpmiSubmitCommand (
+             IPMI_NETFN_CHASSIS,
+             IPMI_CHASSIS_GET_SYSTEM_BOOT_OPTIONS,
+             (VOID *)BootOptionsRequest,
+             sizeof (*BootOptionsRequest),
+             (VOID *)BootOptionsResponse,
+             &ResponseDataSize
+             );
   return Status;
 }
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-12  2:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-10 19:23 [edk2-platforms][PATCH v1 1/1] ManageabilityPkg: Ipmi Get/Set Boot Options brit.chesley
2023-07-11  1:36 ` Chang, Abner
2023-07-12  2:06   ` Isaac Oram
2023-07-12  2:10     ` Chang, Abner
     [not found] ` <1770AC5D28826C6A.5563@groups.io>
2023-07-12  2:02   ` [edk2-devel] " Chang, Abner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox