EEPROM Validation issue in Fru Device.

Kumar Thangavel thangavel.k at hcl.com
Wed Sep 29 15:53:33 AEST 2021


Classification: Public
Classification changed as Public.

From: Kumar Thangavel
Sent: Wednesday, September 29, 2021 11:19 AM
To: openbmc at lists.ozlabs.org
Cc: Velumani T-ERS,HCLTech <velumanit at hcl.com>; Patrick Williams <patrick at stwcx.xyz>; Amithash Prasad <amithash at fb.com>; Sai Dasari <sdasari at fb.com>; Ed Tanous <ed at tanous.net>; Vernon Mauery <vernon.mauery at linux.intel.com>; Jae Hyun Yoo <jae.hyun.yoo at linux.intel.com>
Subject: EEPROM Validation issue in Fru Device.

Classification: Confidential
Hi All,

           We are working in FRU module that has 16 bit EEPROM and Wanted to read eeprom data Via i2c.

           The below function in FruDevice.cpp in entity-manager validates 8bit or 16 bit device.

           This function returns "0" for 8 bit device.

           This function returns "0" for 16 bit device also. But it's supposed to return "1" for 16 bit device.

           We have tested with our 16bit device. It returns "0" only.

           If we read via i2c utility commands,  getting all 255 data in the first bytes.

           If we make code changes to return "1" for 16 bit device and called the function "i2cSmbusWriteThenRead",
           then we could able to read all the data perfectly for 16 bit device.

           Code snippet :

            static int isDevice16Bit(int file)
                {
                    /* Get first byte */
                    int byte1 = i2c_smbus_read_byte_data(file, 0);
                    if (byte1 < 0)
                    {
                        return byte1;
                    }
                    /* Read 7 more bytes, it will read same first byte in case of
                     * 8 bit but it will read next byte in case of 16 bit
                     */
                    for (int i = 0; i < 7; i++)
                    {
                        int byte2 = i2c_smbus_read_byte_data(file, 0);
                        if (byte2 < 0)
                        {
                            return byte2;
                        }
                        if (byte2 != byte1)
                        {
                            return 1;
                        }
                    }
                    return 0;
                }

    I2c utility command log :

    i2ctransfer 12 w2 at 0x51 0x00 0x00 r8
   WARNING! This program can confuse your I2C bus, cause data loss and worse!
   I will send the following messages to device file /dev/i2c-12:
   msg 0: addr 0x51, write, len 2, buf 0x00 0x00
   msg 1: addr 0x51, read, len 8
   Continue? [y/N] y
   0x01 0x00 0x00 0x01 0x0e 0x1c 0x00 0xd4

  Note :

          We removed the EEPROM entry in dts file to skip the eeprom driver and trying to read via i2c.

    Questions :

1.       How the function isDevice16Bit Validated for 16 bit device ?

2.       Is my validation and analysis is correct ?

     Could you please provide your suggestions on this.

Thanks,
Kumar.









::DISCLAIMER::
________________________________
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20210929/c4060a43/attachment-0001.htm>


More information about the openbmc mailing list