i2c-vr: xdpe1x2xx: Improve update flow

Changes:
- Use strtoul instead of strtol to correctly handle large hex values
- Replace nested switch-case logic with std::map for better
    readability and scalability

'''
Tested on harma:
<7> Found configuration interface at xyz.openbmc_project.EntityManager, /xyz/openbmc_project/inventory/system/board/Harma_MB/Harma_MB_VR_cpu0_vcore0
<7> [config] Voltage regulator device type: XDPE1X2XXFirmware on Bus: 28 at Address: 100
<7> Harma_MB_VR_cpu0_vcore0_610: created dbus interfaces on path /xyz/openbmc_project/software/Harma_MB_VR_cpu0_vcore0_610
<7> Harma_MB_VR_cpu0_vcore0_610: set version 1152932050
<7> [Software] enabling update of /xyz/openbmc_project/software/Harma_MB_VR_cpu0_vcore0_610 (adding the update interface)
<7> Done with initial configuration

<7> Requesting Image update with 11
<7> started asynchronous update with fd 11
<7> starting async update with FD: 12

<7> Harma_MB_VR_cpu0_vcore0_3294: created dbus interfaces on path /xyz/openbmc_project/software/Harma_MB_VR_cpu0_vcore0_3294
<7> starting the async update with memfd 12
<7> open fd 12
<7> file size: 4325
<7> parsing package header
<7> parsing package, pkg header size: 161
<7> Harma_MB_VR_cpu0_vcore0_3294: set version 4C366CF2
34Z 0x4C366CF2/XV0 Config
0000000sing: //XV0 PMBus LoopA User
50505055ing: //XV0 PMBus LoopB User
07> Parsing: //XV0 FW SVI3 LoopA
07> Parsing: //XV0 FW SVI3 LoopB
00000000ing: [End Configuration Data]
<7> Scratchpad Address: 0x2005e000
<7> CRC before programming: 0x44b858d2
<7> CRC of configuration: 0x4c366cf2
<7> VR Device ID: 0x96
<7> VR Device Rev: 0x1
<7> Remaining write cycles of VR: 19
<7> Invalidate current Configuration
<7> Programming section: 0
<7> Section Type: 0x4
<7> Invalidating section type: 4
<7> Setting scratchpad address: 0x2005e000
<7> Upload from scratch pad to OTP with soak time: 1600ms
<7> Programming section: 1
<7> Section Type: 0x7
<7> Invalidating section type: 7
<7> Setting scratchpad address: 0x2005e000
<7> Upload from scratch pad to OTP with soak time: 700ms
<7> Programming section: 2
<7> Section Type: 0x9
<7> Invalidating section type: 9
<7> Setting scratchpad address: 0x2005e000
<7> Upload from scratch pad to OTP with soak time: 700ms
<7> Programming section: 3
<7> Section Type: 0xd
<7> Invalidating section type: 13
<7> Setting scratchpad address: 0x2005e000
<7> Upload from scratch pad to OTP with soak time: 300ms
<7> Programming section: 4
<7> Section Type: 0xe
<7> Invalidating section type: 14
<7> Setting scratchpad address: 0x2005e000
<7> Upload from scratch pad to OTP with soak time: 300ms
<6> Successfully updated VR Harma_MB_VR_cpu0_vcore0

after ac-cycle:
<7> Found configuration interface at xyz.openbmc_project.EntityManager, /xyz/openbmc_project/inventory/system/board/Harma_MB/Harma_MB_VR_cpu0_vcore0
<7> [config] Voltage regulator device type: XDPE1X2XXFirmware on Bus: 28 at Address: 100
<7> Harma_MB_VR_cpu0_vcore0_8864: created dbus interfaces on path /xyz/openbmc_project/software/Harma_MB_VR_cpu0_vcore0_8864
<7> Harma_MB_VR_cpu0_vcore0_8864: set version 1278635250
<7> [Software] enabling update of /xyz/openbmc_project/software/Harma_MB_VR_cpu0_vcore0_8864 (adding the update interface)
'''

Change-Id: I8cfaa32318d35e68c3dc83416678c96623364b1b
Signed-off-by: Daniel Hsu <Daniel-Hsu@quantatw.com>
1 file changed
tree: ca37f217207a78c181612863fe4c43c2fdd4538b
  1. bios/
  2. bmc/
  3. common/
  4. cpld/
  5. eeprom-device/
  6. i2c-vr/
  7. subprojects/
  8. test/
  9. .clang-format
  10. .clang-tidy
  11. .gitignore
  12. .shellcheck
  13. LICENSE
  14. meson.build
  15. meson.options
  16. OWNERS
  17. README.md
README.md

phosphor-bmc-code-mgmt

Phosphor BMC Code Management provides a set of system software management applications. More information can be found at Software Architecture

To Build

To build this package, do the following steps:

  1. meson build
  2. ninja -C build

To clean the repository run rm -r build.