Giter VIP home page Giter VIP logo

ipmi-fru-parser's Introduction

ipmi-fru-parser

Building

To build this package, do the following steps:

meson setup builddir
ninja -C builddir

ipmi-fru-parser's People

Contributors

adamliyi avatar alexanderamelkin avatar amboar avatar anoo1 avatar bradbishop avatar devenrao avatar dkodihal avatar dnbazhenov avatar geissonator avatar gtmills avatar lgon avatar lxwinspur avatar manojkiraneda avatar msbarth avatar nasamuffin avatar nkskjames avatar osenft avatar pstrinkle avatar thangqn-ampere avatar tomjoseph83 avatar vejmarie avatar vmauery avatar wak-google avatar williamspatrick avatar wltu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipmi-fru-parser's Issues

【ipmitool fru list,can't show FRUID 0 all informations】

use "ipmitool fru list",Missing complete FRUID0 device information in the echo data

root@test-evb:~# ipmitool fru list
FRU Device Description : Builtin FRU Device (ID 0)
FRU Device Description : motherboard (ID 1)
Device not present (Requested sensor, data, or record not found)

root@test-evb:# ipmitool fru list 0
Chassis Type : Rack Mount Chassis
Board Mfg Date : Sun Feb 18 02:35:00 2024 UTC
Board Mfg : Biggest International Corp.
Board Product : Some Cool Product
Product Manufacturer : China OpenBmc
Product Name : test S10B316
Product Part Number : 12345789
Product Serial : 12345789
root@test-evb:
# ipmitool fru list 1
Device not present (Requested sensor, data, or record not found)

Bad type conversion in ipmi_validate_fru_area

This is exposed when building under GCC 5.2:

arm-openbmc-linux-gnueabi-g++  -march=armv5e -marm  -mthumb-interwork --sysroot=/scratch/joel/openbmc/build/tmp/sysroots/palmetto  -O2 -pipe -g -feliminate-unused-debug-types  -fpic -std=gnu++14 -fvisibility-inlines-hidden   -c -o writefrudata.o writefrudata.C
cc1: warning: command line option '-std=gnu++14' is valid for C++/ObjC++ but not for C
writefrudata.C: In function 'int ipmi_validate_fru_area(uint8_t, const char*, sd_bus*, bool)':
writefrudata.C:588:51: error: cannot convert 'std::ifstream {aka std::basic_ifstream<char>}' to 'bool' in initialization
         bool present = std::ifstream(fru_file_name);
                                                   ^
<builtin>: recipe for target 'writefrudata.o' failed
make: *** [writefrudata.o] Error 1

【NetFn:0x0a ,Cmd:12<ipmiStorageWriteFruData> There are two function definitions,What are the differences between them?】

  1. workspace\sources\phosphor-ipmi-host\dbus-sdr\storagecommands.cpp
    //
    ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
    ipmi::storage::cmdWriteFruData,
    ipmi::Privilege::Operator, ipmiStorageWriteFruData);

  2. workspace\sources\phosphor-ipmi-fru\strgfnhandler.cpp
    void register_netfn_storage_write_fru()
    {
    std::printf("Registering NetFn:[0x%X], Cmd:[0x%X]\n", NETFUN_STORAGE,
    IPMI_CMD_WRITE_FRU_DATA);

    ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_WRITE_FRU_DATA, NULL,
    ipmiStorageWriteFruData, SYSTEM_INTERFACE);
    }

std::string in an extra-properties.yaml

Even though std::string is part of the supported types of Value std::variant, it's deceivingly hard to use.

I was running into this issue: https://stackoverflow.com/questions/44086269/why-does-my-variant-convert-a-stdstring-to-a-bool where:
"The type of "hello" is const char [6], which decays to const char *. The conversion from const char * to bool is a built-in conversion, while the conversion from const char * to std::string is a user-defined conversion, which means the former is performed."

The fix was to declare the string using a Folded Block Scalar > and then wrapping the string in std::string("hello") for example.

A comment / documentation somewhere of this behavior may be useful as this is not very obvious.

Wrong size for variable 'offset'

variable 'offset' in function 'ipmiStorageWriteFruData' is declared as uint8_t, but it should be uint16_t.

ipmi_ret_t ipmiStorageWriteFruData(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request,
ipmi_response_t response,
ipmi_data_len_t dataLen,
ipmi_context_t context)
{
...
uint16_t offset = 0; // offset should be declared as uint16_t
...
offset = ((uint16_t)reqptr->offsetms) << 8 | reqptr->offsetls; // otherwise, this operation shall give unexcepted result

Confirm license choice as GPLv3.

My understanding is we are importing code from another open source package and thus this is going to be GPLv3. Need confirmation that I picked the correct license for the initial commit.

【use "ipmitool fru edit" Command sent successfully, but EEPROM data has not changed 】

Use “ipmitool fru edit”,want to modify the information of a certain domain;Then ipmitool fru list to check ,The data viewed using ipmitool is OK [it is the modified data];
But:

  1. Abnormal l printing information has occurred here

Mar 09 16:06:01 test-evb ipmid[327]: FRU file is incomplete
Mar 09 16:06:01 test-evb ipmid[327]: Populating FRU areas failed
Mar 09 16:06:01 test-evb ipmid[327]: Incomplete FRU file
Mar 09 16:06:01 test-evb ipmid[327]: Populating FRU areas failed
Mar 09 16:06:01 test-evb ipmid[327]: Incomplete FRU file
Mar 09 16:06:01 test-evb ipmid[327]: Populating FRU areas failed
Mar 09 16:06:01 test-evb ipmid[327]: Incomplete FRU file
Mar 09 16:06:01 test-evb ipmid[327]: Populating FRU areas failed

  1. eeprom EEPROM data not synchronized

test befoe:
root@test-evb:# ipmitool fru list
FRU Device Description : Builtin FRU Device (ID 0)
Board Mfg Date : Wed Jan 10 04:58:00 2024 UTC
Board Mfg : AnyCompany
Board Product : HangZhou
Board Serial : pn123456789987654321
Board Part Number : Cloudnineinfo123456789
root@test-evb:
#
EEPROM Data:
root@test-evb:~# hexdump -Cv /sys/class/i2c-dev/i2c-28/device/28-0050/eeprom
00000000 01 00 00 01 00 00 00 fe 01 0a 19 aa ea e0 ca 41 |...............A|
00000010 6e 79 43 6f 6d 70 61 6e 79 c8 48 61 6e 67 5a 68 |nyCompany.HangZh|
00000020 6f 75 d4 70 6e 31 32 33 34 35 36 37 38 39 39 38 |ou.pn12345678998|
00000030 37 36 35 34 33 32 31 d6 43 6c 6f 75 64 6e 69 6e |7654321.Cloudnin|
00000040 65 69 6e 66 6f 31 32 33 34 35 36 37 38 39 c7 4e |einfo123456789.N|
00000050 6f 74 68 69 6e 67 c1 e8 ff ff ff ff ff ff ff ff |othing..........|
00000060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|

test after:
root@test-evb:# ipmitool fru list
FRU Device Description : Builtin FRU Device (ID 0)
Board Mfg Date : Wed Jan 10 04:58:00 2024 UTC
Board Mfg : CloudNineInfo
Board Product : HangZhou
Board Serial : pn123456789987654321
Board Part Number : Cloudnineinfo123456789
root@test-evb:
#
EEPROM Data:
root@test-evb:~# hexdump -Cv /sys/class/i2c-dev/i2c-28/device/28-0050/eeprom
00000000 01 00 00 01 00 00 00 fe 01 0a 19 aa ea e0 ca 41 |...............A|
00000010 6e 79 43 6f 6d 70 61 6e 79 c8 48 61 6e 67 5a 68 |nyCompany.HangZh|
00000020 6f 75 d4 70 6e 31 32 33 34 35 36 37 38 39 39 38 |ou.pn12345678998|
00000030 37 36 35 34 33 32 31 d6 43 6c 6f 75 64 6e 69 6e |7654321.Cloudnin|
00000040 65 69 6e 66 6f 31 32 33 34 35 36 37 38 39 c7 4e |einfo123456789.N|
00000050 6f 74 68 69 6e 67 c1 e8 ff ff ff ff ff ff ff ff |othing..........|
00000060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|

Use the field type format bits to determine byte interpretation when building the variant K/V pairs

What should be sent to dbus and in what format

MFG_Name = 0x9801
Model_Number = "9965439-092.A00LF "
Version = 0x0000

Serial_number = 0x1520e691

IPMI Incoming: Seq 0x1c, NetFn 0x28, CMD: 0x12
0x000000: 03 00 00 01 00 00 00 01 00 00 fe 01 05 00 02 98 ................
0x000010: 01 01 0b d2 39 39 36 35 34 33 39 2d 30 39 32 2e ....9965439-092.
0x000020: 41 30 30 4c 46 20 02 00 00 04 15 20 e6 91 00 00 A00LF ..... ....
0x000030: 00 c1 48 ..H

01 00 00 00 01 00 00 fe
^-- Product area

01 - version
05 - length = 5*8 = 40
00 - Language code
02 - 0b00 000010 = MFG Name - Binary for 2 bytes
98 01 - 0x9801 is the MFG name
01 - Product Name length - Binary for 1 byte
0b - Name is 0x0b
d2 - 0b11010010 Product Model Number - Ascii for 18 bytes
39 39 36 35 34 33 39 2d 30 39 32 2e 41 30 30 4c 46 20 - (9965439-092.A00LF )
02 - Product Version Length - binary for 2 bytes
00 00
04 - Product Serial number length
15 20 e6 91 - 0x1520e691 is the serial number
00 - Asset tag length
00 fru file id length
00 - Custom product info area length
C1 - Done
48 - CRC

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.