nvidia-gpu: add Power Sensor PeakReading Property

Add support for Sensor Properties PeakReading and PeakRedingTime.

Current Limitation -
The ResetMetrics action is currently not supported for Redfish URIs in
bmcweb. As a result, the ability to clear PeakReading values for GPU
Power Sensors has not been implemented.

Future Consideration -
If ResetMetrics action support is added to bmcweb in the future, the
corresponding functionality will also need to be implemented in the
dbus-sensor application to ensure full compatibility.

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

```
root@gb200nvl-obmc:~# busctl introspect xyz.openbmc_project.GpuSensor /xyz/openbmc_project/sensors/power/NVIDIA_GB200_GPU_0_Power_0
NAME                                                  TYPE      SIGNATURE  RESULT/VALUE                             FLAGS
org.freedesktop.DBus.Introspectable                   interface -          -                                        -
.Introspect                                           method    -          s                                        -
org.freedesktop.DBus.Peer                             interface -          -                                        -
.GetMachineId                                         method    -          s                                        -
.Ping                                                 method    -          -                                        -
org.freedesktop.DBus.Properties                       interface -          -                                        -
.Get                                                  method    ss         v                                        -
.GetAll                                               method    s          a{sv}                                    -
.Set                                                  method    ssv        -                                        -
.PropertiesChanged                                    signal    sa{sv}as   -                                        -
xyz.openbmc_project.Association.Definitions           interface -          -                                        -
.Associations                                         property  a(sss)     1 "chassis" "all_sensors" "/xyz/openb... emits-change
xyz.openbmc_project.Sensor.Value                      interface -          -                                        -
.MaxValue                                             property  d          5000                                     emits-change
.MinValue                                             property  d          0                                        emits-change
.Unit                                                 property  s          "xyz.openbmc_project.Sensor.Value.Uni... emits-change
.Value                                                property  d          29.194                                   emits-change writable
xyz.openbmc_project.Sensor.ValueMutability            interface -          -                                        -
.Mutable                                              property  b          true                                     emits-change
xyz.openbmc_project.State.Decorator.Availability      interface -          -                                        -
.Available                                            property  b          true                                     emits-change writable
xyz.openbmc_project.State.Decorator.OperationalStatus interface -          -                                        -
.Functional                                           property  b          true                                     emits-change
xyz.openbmc_project.Telemetry.Report                  interface -          -                                        -
.Readings                                             property  (ta(ssdt)) 0 1 "PeakReading" "" 80.933 0            emits-change
```

Change-Id: I0a4f7eb0a5db688f32bf80954839140da9bb7e2a
Signed-off-by: Harshit Aghera <haghera@nvidia.com>
diff --git a/src/nvidia-gpu/NvidiaGpuMctpVdm.cpp b/src/nvidia-gpu/NvidiaGpuMctpVdm.cpp
index ebfa76b..51a6755 100644
--- a/src/nvidia-gpu/NvidiaGpuMctpVdm.cpp
+++ b/src/nvidia-gpu/NvidiaGpuMctpVdm.cpp
@@ -218,16 +218,16 @@
     return 0;
 }
 
-int encodeGetCurrentPowerDrawRequest(uint8_t instanceId, uint8_t sensorId,
-                                     uint8_t averagingInterval,
-                                     std::span<uint8_t> buf)
+int encodeGetPowerDrawRequest(PlatformEnvironmentalCommands commandCode,
+                              uint8_t instanceId, uint8_t sensorId,
+                              uint8_t averagingInterval, std::span<uint8_t> buf)
 {
-    if (buf.size() < sizeof(GetCurrentPowerDrawRequest))
+    if (buf.size() < sizeof(GetPowerDrawRequest))
     {
         return EINVAL;
     }
 
-    auto* msg = reinterpret_cast<GetCurrentPowerDrawRequest*>(buf.data());
+    auto* msg = reinterpret_cast<GetPowerDrawRequest*>(buf.data());
 
     ocp::accelerator_management::BindingPciVidInfo header{};
     header.ocp_accelerator_management_msg_type =
@@ -243,8 +243,7 @@
         return rc;
     }
 
-    msg->hdr.command = static_cast<uint8_t>(
-        PlatformEnvironmentalCommands::GET_CURRENT_POWER_DRAW);
+    msg->hdr.command = static_cast<uint8_t>(commandCode);
     msg->hdr.data_size = sizeof(sensorId) + sizeof(averagingInterval);
     msg->sensorId = sensorId;
     msg->averagingInterval = averagingInterval;
@@ -252,10 +251,9 @@
     return 0;
 }
 
-int decodeGetCurrentPowerDrawResponse(
-    std::span<const uint8_t> buf,
-    ocp::accelerator_management::CompletionCode& cc, uint16_t& reasonCode,
-    uint32_t& power)
+int decodeGetPowerDrawResponse(std::span<const uint8_t> buf,
+                               ocp::accelerator_management::CompletionCode& cc,
+                               uint16_t& reasonCode, uint32_t& power)
 {
     auto rc =
         ocp::accelerator_management::decodeReasonCodeAndCC(buf, cc, reasonCode);
@@ -265,13 +263,13 @@
         return rc;
     }
 
-    if (buf.size() < sizeof(GetCurrentPowerDrawResponse))
+    if (buf.size() < sizeof(GetPowerDrawResponse))
     {
         return EINVAL;
     }
 
     const auto* response =
-        reinterpret_cast<const GetCurrentPowerDrawResponse*>(buf.data());
+        reinterpret_cast<const GetPowerDrawResponse*>(buf.data());
 
     const uint16_t dataSize = le16toh(response->hdr.data_size);
 
@@ -330,7 +328,7 @@
         return rc;
     }
 
-    if (buf.size() < sizeof(GetCurrentPowerDrawResponse))
+    if (buf.size() < sizeof(GetPowerDrawResponse))
     {
         return EINVAL;
     }