nvidia-gpu: add voltage sensor

This commit introduces a voltage sensor for the GPU.

Tested: Build an image for gb200nvl-obmc machine with the following
patches cherry picked. This patches are needed to enable the mctp stack.

https://gerrit.openbmc.org/c/openbmc/openbmc/+/79422

```
$ curl -s -k -u 'root:0penBmc' https://10.137.203.137/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/voltage_NVIDIA_GB200_GPU_0_Voltage_0
{
  "@odata.id": "/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/voltage_NVIDIA_GB200_GPU_0_Voltage_0",
  "@odata.type": "#Sensor.v1_2_0.Sensor",
  "Id": "voltage_NVIDIA_GB200_GPU_0_Voltage_0",
  "Name": "NVIDIA GB200 GPU 0 Voltage 0",
  "Reading": 0.735,
  "ReadingRangeMax": 1.8446744073709552e+16,
  "ReadingRangeMin": 0.0,
  "ReadingType": "Voltage",
  "ReadingUnits": "V",
  "Status": {
    "Health": "OK",
    "State": "Enabled"
  }
}%
```

Change-Id: I3d98f3d7c11221a42460c6f8420c927c1b1711b2
Signed-off-by: Harshit Aghera <haghera@nvidia.com>
diff --git a/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp b/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp
index 10a3efc..e378cfc 100644
--- a/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp
+++ b/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp
@@ -33,6 +33,7 @@
     READ_THERMAL_PARAMETERS = 0x02,
     GET_CURRENT_POWER_DRAW = 0x03,
     GET_CURRENT_ENERGY_COUNTER = 0x06,
+    GET_VOLTAGE = 0x0F,
 };
 
 enum class DeviceIdentification : uint8_t
@@ -71,6 +72,8 @@
 
 using GetCurrentEnergyCounterRequest = GetNumericSensorReadingRequest;
 
+using GetVoltageRequest = GetNumericSensorReadingRequest;
+
 struct GetTemperatureReadingResponse
 {
     ocp::accelerator_management::CommonResponse hdr;
@@ -95,6 +98,12 @@
     uint64_t energy;
 } __attribute__((packed));
 
+struct GetVoltageResponse
+{
+    ocp::accelerator_management::CommonResponse hdr;
+    uint32_t voltage;
+} __attribute__((packed));
+
 int packHeader(const ocp::accelerator_management::BindingPciVidInfo& hdr,
                ocp::accelerator_management::BindingPciVid& msg);
 
@@ -138,4 +147,11 @@
     std::span<const uint8_t> buf,
     ocp::accelerator_management::CompletionCode& cc, uint16_t& reasonCode,
     uint64_t& energy);
+
+int encodeGetVoltageRequest(uint8_t instanceId, uint8_t sensorId,
+                            std::span<uint8_t> buf);
+
+int decodeGetVoltageResponse(std::span<const uint8_t> buf,
+                             ocp::accelerator_management::CompletionCode& cc,
+                             uint16_t& reasonCode, uint32_t& voltage);
 } // namespace gpu