nvidia-oem: Add USBVendorIdProductId command
This command is used by BIOS before creating SMBIOS record
type 42. BIOS gets USBDescription information from BMC.
Note:
The implementation is for USBVendorIdProductId. The subsequent
patches will be implemented for USBDescription.
Design Document for RHI:
[1] https://gerrit.openbmc.org/c/openbmc/docs/+/79327
Redfish Host Interface specification:
[2] https://www.dmtf.org/sites/default/files/standards/documents/DSP0270_1.3.0.pdf
Tested:
Tested on gb200nvl-obmc platform
root@gb200nvl-obmc:~# ipmitool raw 0x3c 0x30 0x01
25 05
root@gb200nvl-obmc:~# ipmitool raw 0x3c 0x30 0x02
a2 a4
root@gb200nvl-obmc:~#
Change-Id: I6a325ca3410e2ac2ab0b8c3776944d31f3cac582
Signed-off-by: Prithvi Pai <ppai@nvidia.com>
diff --git a/oem/nvidia/bootstrap-credentials-oem-cmds.cpp b/oem/nvidia/bootstrap-credentials-oem-cmds.cpp
new file mode 100644
index 0000000..5863306
--- /dev/null
+++ b/oem/nvidia/bootstrap-credentials-oem-cmds.cpp
@@ -0,0 +1,48 @@
+/*
+ * SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION &
+ * AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "oemcommands.hpp"
+
+#include <ipmid/api.hpp>
+#include <ipmid/types.hpp>
+
+#include <cstdint>
+
+void registerBootstrapCredentialsOemCommands() __attribute__((constructor));
+
+namespace ipmi
+{
+ipmi::RspType<uint8_t, uint8_t> ipmiGetUsbVendorIdProductId(uint8_t type)
+{
+ constexpr uint8_t descriptorVendorId = 1;
+ constexpr uint8_t descriptorProductId = 2;
+
+ // IPMI OEM USB Linux Gadget info
+ constexpr uint16_t usbVendorId = 0x0525;
+ constexpr uint16_t usbProductId = 0xA4A2;
+
+ if (type == descriptorVendorId)
+ {
+ return ipmi::responseSuccess(static_cast<uint8_t>(usbVendorId >> 8),
+ static_cast<uint8_t>(usbVendorId & 0xFF));
+ }
+ else if (type == descriptorProductId)
+ {
+ return ipmi::responseSuccess(static_cast<uint8_t>(usbProductId >> 8),
+ static_cast<uint8_t>(usbProductId & 0xFF));
+ }
+ return ipmi::responseInvalidFieldRequest();
+}
+
+} // namespace ipmi
+
+void registerBootstrapCredentialsOemCommands()
+{
+ ipmi::registerHandler(
+ ipmi::prioOemBase, ipmi::groupNvidia,
+ ipmi::bootstrap_credentials_oem::cmdGetUsbVendorIdProductId,
+ ipmi::Privilege::Admin, ipmi::ipmiGetUsbVendorIdProductId);
+}