fby3.5: bb: Optimize CPLD update#268
Conversation
Summary: - Modify struct variable name. - Define delay time. - Define LSB to MSB function and add explaining comment. Test Plan: - Build code: Pass - Update CPLD: Pass Log: 1. Check update CPLD is successful. root@bmc-oob:~# fw-util slot1 --version bb_cpld BB CPLD Version: 00030E05 BB CPLD Version After activation: 00030E05 root@bmc-oob:~# fw-util slot1 --force --update bb_cpld Y35CBB_E06.rpd Failed to get board revision ID slot_id: 1, comp: f, intf: 0, img: Y35CBB_E06.rpd, force: 1 Set fan mode to manual and set PWM to 70% OnChip Flash Status = 0xFFFFFE00., slot_id 0x1, sectype 0x1, intf: 0x10, read 143360 bytes. Erase sector SUCCESS. Erase sector SUCCESS. updated cpld: 100 % Elapsed time: 57 sec. Set fan mode to auto and start fscd Force upgrade of slot1 : bb_cpld succeeded root@bmc-oob:~# power-util sled-cycle packet_write_wait: Connection to 192.168.88.24 port 22: Broken pipe root@bmc-oob:~# fw-util slot1 --version bb_cpld BB CPLD Version: 00030E06 BB CPLD Version After activation: 00030E06
|
@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
| // e.g. 1032 5476 -> 3210 7654 | ||
| // Change bit 1111 0000b(0xf0) and 0000 1111b(0x0f) | ||
| // e.g. 3210 7654 -> 7654 3210 | ||
| #define SWAP_LSB_TO_MSB(x) \ |
There was a problem hiding this comment.
There is a swap32() function in the /common/dev/pex89000.c file. Can we move this outside that file and use it for all swaps?
static void swap32(uint32_t *d)
{
if (!d)
return;
uint32_t t = ((*d >> 24) & 0xFF) | ((*d >> 8) & 0xFF00) | ((*d << 8) & 0xFF0000) |
((*d << 24) & 0xFF000000);
*d = t;
}
There was a problem hiding this comment.
Hi @GoldenBug ,
Thanks for your suggestions.
We check the function and think they are doing different things.
SWAP_LSB_TO_MSB() changes 2 bytes and the minimum unit of change is a bit.
For example, origin data 0xA2(1010 0010) after change is 0x45(0100 0101).
However, swap32() changes 8 bytes, and the minimum unit of change is a word.
For example, origin data 0x100000A2 after change is 0xA2000010.
|
@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: - Modify struct variable name. - Define delay time. - Define LSB to MSB function and add explaining comment. Pull Request resolved: facebook#268 Test Plan: - Build code: Pass - Update CPLD: Pass Log: 1. Check update CPLD is successful. root@bmc-oob:~# fw-util slot1 --version bb_cpld BB CPLD Version: 00030E05 BB CPLD Version After activation: 00030E05 root@bmc-oob:~# fw-util slot1 --force --update bb_cpld Y35CBB_E06.rpd Failed to get board revision ID slot_id: 1, comp: f, intf: 0, img: Y35CBB_E06.rpd, force: 1 Set fan mode to manual and set PWM to 70% OnChip Flash Status = 0xFFFFFE00., slot_id 0x1, sectype 0x1, intf: 0x10, read 143360 bytes. Erase sector SUCCESS. Erase sector SUCCESS. updated cpld: 100 % Elapsed time: 57 sec. Set fan mode to auto and start fscd Force upgrade of slot1 : bb_cpld succeeded root@bmc-oob:~# power-util sled-cycle packet_write_wait: Connection to 192.168.88.24 port 22: Broken pipe root@bmc-oob:~# fw-util slot1 --version bb_cpld BB CPLD Version: 00030E06 BB CPLD Version After activation: 00030E06 Reviewed By: garnermic Differential Revision: D36076646 Pulled By: GoldenBug fbshipit-source-id: 931efefe0ccc65a89afb65e2ae09b0a59a0d23d6
Summary:
Test Plan:
Log:
root@bmc-oob:
# fw-util slot1 --version bb_cpld# fw-util slot1 --force --update bb_cpld Y35CBB_E06.rpdBB CPLD Version: 00030E05
BB CPLD Version After activation: 00030E05
root@bmc-oob:
Failed to get board revision ID
slot_id: 1, comp: f, intf: 0, img: Y35CBB_E06.rpd, force: 1
Set fan mode to manual and set PWM to 70%
OnChip Flash Status = 0xFFFFFE00., slot_id 0x1, sectype 0x1, intf: 0x10, read 143360 bytes.
Erase sector SUCCESS.
Erase sector SUCCESS.
updated cpld: 100 %
Elapsed time: 57 sec.
Set fan mode to auto and start fscd
Force upgrade of slot1 : bb_cpld succeeded
root@bmc-oob:~# power-util sled-cycle
packet_write_wait: Connection to 192.168.88.24 port 22: Broken pipe
root@bmc-oob:~# fw-util slot1 --version bb_cpld
BB CPLD Version: 00030E06
BB CPLD Version After activation: 00030E06