openbmc / pldm

Apache License 2.0
31 stars 40 forks source link

pldmtool failing to update attribute tables correctly #21

Closed crgeddes closed 3 years ago

crgeddes commented 3 years ago

I am trying to edit the string_attr.json file on the BMC and reboot pldm to test a new attribute. When I do this pldmtool is not correctly detecting the new attribute.

First I used the command @tomjoseph83 gave me awhile back to set up the mount directory : mkdir -p /tmp/share && mkdir -p /tmp/share-work/ && mount -t overlay -o lowerdir=/usr/share/pldm,upperdir=/tmp/share,workdir=/tmp/share-work/ overlay /usr/share/pldm

Then I added my attribute to /usr/share/pldm/bios/string_attrs.json

      {
         "attribute_name" : "hb_lid_ids",
         "string_type" : "ASCII",
         "minimum_string_length" : 0,
         "maximum_string_length" : 512,
         "default_string_length" : 376,
         "default_string" : "HBI=81e0065d,HBB=81e0065a,SBE=81e00661,HCODE=81e00696,PAYLOAD=81e00660,HBRT=81e0068e,HBD=81e0068d,GUARD=81e00667,HBEL=81e00668,NVRAM=81e0066b,OCC=81e00688,ATTR_TMP=81e00664,VERSION=81e00662,HBBL=81e0065b,RINGOVD=81e00620,WOFDATA=81e00692,SBKT=81e0066c,HB_VOLATILE=81e0066f,HDAT=81e00669,EECACHE=81e00679,DEVTREE=81e00672,BOOTKERNEL=81e00658,HCODE_LID=81e00671,OCMBFW=81e0067a",
         "helpText" : "Provides the host a mapping of the lid ids to human readable names.",
         "displayName" : "Hostboot Lid Ids"
      }

Then I reboot pldm systemctl daemon-reload && systemctl restart mctp-demux && systemctl restart pldmd

The string table shows my new attribute

root@mybmc:~# pldmtool bios GetBIOSTable --type 0
{
    "0": "AIX",
    "1": "Allowed",
    "2": "Automatic",
    "3": "Disabled",
    "4": "Enabled",
    "5": "IBM I",
    "6": "IPv4DHCP",
    "7": "IPv4Static",
    "8": "Linux",
    "9": "Not Allowed",
    "10": "OPAL",
    "11": "Perm",
    "12": "Power Off",
    "13": "PowerVM",
    "14": "Stay On",
    "15": "Temp",
    "16": "hb_debug_console",
    "17": "hb_hyp_switch",
    "18": "hb_lid_ids",

But it doesn't show up in the other tables and fails when I try to read the value.

root@mybmc:~# pldmtool bios GetBIOSAttributeCurrentValueByHandle -m 8 -a hb_lid_ids
Can not find the attribute hb_lid_ids
root@mybmc:~# 
crgeddes commented 3 years ago

Ah I have discovered my problem was my default string length was 1 byte too long . There might be better ways to handle a data error like this but I will close this issue as it is on my end.