Suggest changing 'one by one' in subject to 'bytewise'.
On Thu, Oct 13, 2016 at 10:00:14AM +0800, Heyi Guo wrote:
From: Peicong Li lipeicong@huawei.com
We would get incorrect data when accessing multiple bytes at one time and across EEPROM page boundary, so we change to access EEPROM by single byte.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Peicong Li lipeicong@huawei.com
.../D03/Drivers/OemNicConfig2PHi1610/OemNicConfig2P.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/Platforms/Hisilicon/D03/Drivers/OemNicConfig2PHi1610/OemNicConfig2P.c b/Platforms/Hisilicon/D03/Drivers/OemNicConfig2PHi1610/OemNicConfig2P.c index 994ed6a..0760140 100644 --- a/Platforms/Hisilicon/D03/Drivers/OemNicConfig2PHi1610/OemNicConfig2P.c +++ b/Platforms/Hisilicon/D03/Drivers/OemNicConfig2PHi1610/OemNicConfig2P.c @@ -106,10 +106,11 @@ UINT16 make_crc_checksum(UINT8 *buf, UINT32 len) EFI_STATUS OemGetMacE2prom(IN UINT32 Port, OUT UINT8 *pucAddr) { I2C_DEVICE stI2cDev = {0};
- EFI_STATUS Status;
- EFI_STATUS Status = EFI_SUCCESS; UINT16 I2cOffset; UINT16 crc16; NIC_MAC_ADDRESS stMacDesc = {0};
- UINT32 i;
Status = I2CInit(0, EEPROM_I2C_PORT, Normal); if (EFI_ERROR(Status)) @@ -119,12 +120,14 @@ EFI_STATUS OemGetMacE2prom(IN UINT32 Port, OUT UINT8 *pucAddr) } I2cOffset = I2C_OFFSET_EEPROM_ETH0 + (Port * sizeof(NIC_MAC_ADDRESS));
Unrelated whitespace change.
stI2cDev.DeviceType = DEVICE_TYPE_E2PROM; stI2cDev.Port = EEPROM_I2C_PORT; stI2cDev.SlaveDeviceAddress = I2C_SLAVEADDR_EEPROM; stI2cDev.Socket = 0;
- Status = I2CRead(&stI2cDev, I2cOffset, sizeof(NIC_MAC_ADDRESS), (UINT8 *)&stMacDesc);
- for(i = 0; i < sizeof(NIC_MAC_ADDRESS); i++)
- {
for (...) {
(missing space, keep '{' on same line.)
Status |= I2CRead(&stI2cDev, I2cOffset+i, 1, (UINT8 *)&stMacDesc+i);
Spaces around '+'.
- } if (EFI_ERROR(Status)) {
Keep '{' with 'if'.
DEBUG((EFI_D_ERROR, "[%a]:[%dL] Call I2cRead failed! p1=0x%x.\n", __FUNCTION__, __LINE__, Status));
@@ -147,9 +150,10 @@ EFI_STATUS OemGetMacE2prom(IN UINT32 Port, OUT UINT8 *pucAddr) EFI_STATUS OemSetMacE2prom(IN UINT32 Port, IN UINT8 *pucAddr) { I2C_DEVICE stI2cDev = {0};
- EFI_STATUS Status;
- EFI_STATUS Status = EFI_SUCCESS; UINT16 I2cOffset; NIC_MAC_ADDRESS stMacDesc = {0};
- UINT32 i;
stMacDesc.MacLen = MAC_ADDR_LEN; @@ -170,7 +174,11 @@ EFI_STATUS OemSetMacE2prom(IN UINT32 Port, IN UINT8 *pucAddr) stI2cDev.Port = EEPROM_I2C_PORT; stI2cDev.SlaveDeviceAddress = I2C_SLAVEADDR_EEPROM; stI2cDev.Socket = 0;
- Status = I2CWrite(&stI2cDev, I2cOffset, sizeof(NIC_MAC_ADDRESS), (UINT8 *)&stMacDesc);
- for(i = 0; i < sizeof(NIC_MAC_ADDRESS); i++)
- {
Status |= I2CWrite(&stI2cDev, I2cOffset + i, 1, (UINT8 *)&stMacDesc+i);
- }
Identical comments as for previous for loop.
if (EFI_ERROR(Status)) { DEBUG((EFI_D_ERROR, "[%a]:[%dL] Call I2cWrite failed! p1=0x%x.\n", __FUNCTION__, __LINE__, Status));
-- 1.9.1