nvidia-gpu: add energy sensor

This commit introduces a energy 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/energy_NVIDIA_GB200_GPU_0_Energy_0
{
  "@odata.id": "/redfish/v1/Chassis/NVIDIA_GB200_1/Sensors/energy_NVIDIA_GB200_GPU_0_Energy_0",
  "@odata.type": "#Sensor.v1_2_0.Sensor",
  "Id": "energy_NVIDIA_GB200_GPU_0_Energy_0",
  "Name": "NVIDIA GB200 GPU 0 Energy 0",
  "Reading": 269947.856,
  "ReadingRangeMax": 1.8446744073709552e+16,
  "ReadingRangeMin": 0.0,
  "ReadingType": "EnergyJoules",
  "ReadingUnits": "J",
  "Status": {
    "Health": "OK",
    "State": "Enabled"
  }
}%
```

Change-Id: I6f53ab2a83eedd54005bbdcd781dc8d320d7f26a
Signed-off-by: Harshit Aghera <haghera@nvidia.com>
diff --git a/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp b/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp
index c7f7511..10a3efc 100644
--- a/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp
+++ b/src/nvidia-gpu/NvidiaGpuMctpVdm.hpp
@@ -32,6 +32,7 @@
     GET_TEMPERATURE_READING = 0x00,
     READ_THERMAL_PARAMETERS = 0x02,
     GET_CURRENT_POWER_DRAW = 0x03,
+    GET_CURRENT_ENERGY_COUNTER = 0x06,
 };
 
 enum class DeviceIdentification : uint8_t
@@ -68,6 +69,8 @@
     uint8_t averagingInterval;
 } __attribute__((packed));
 
+using GetCurrentEnergyCounterRequest = GetNumericSensorReadingRequest;
+
 struct GetTemperatureReadingResponse
 {
     ocp::accelerator_management::CommonResponse hdr;
@@ -86,6 +89,12 @@
     uint32_t power;
 } __attribute__((packed));
 
+struct GetCurrentEnergyCounterResponse
+{
+    ocp::accelerator_management::CommonResponse hdr;
+    uint64_t energy;
+} __attribute__((packed));
+
 int packHeader(const ocp::accelerator_management::BindingPciVidInfo& hdr,
                ocp::accelerator_management::BindingPciVid& msg);
 
@@ -121,4 +130,12 @@
     std::span<const uint8_t> buf,
     ocp::accelerator_management::CompletionCode& cc, uint16_t& reasonCode,
     uint32_t& power);
+
+int encodeGetCurrentEnergyCounterRequest(uint8_t instanceId, uint8_t sensorId,
+                                         std::span<uint8_t> buf);
+
+int decodeGetCurrentEnergyCounterResponse(
+    std::span<const uint8_t> buf,
+    ocp::accelerator_management::CompletionCode& cc, uint16_t& reasonCode,
+    uint64_t& energy);
 } // namespace gpu