Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fby3.5: bb: Optimize CPLD update #268

Closed

Conversation

DelphineChiu
Copy link

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

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
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 28, 2022
@facebook-github-bot
Copy link
Contributor

@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) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@facebook-github-bot
Copy link
Contributor

@GoldenBug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@SaraLin-wiwynn SaraLin-wiwynn deleted the Sara/fby3.5-bb-Optimize_CPLD_update branch May 11, 2022 03:40
SaraLin-wiwynn added a commit to Wiwynn/OpenBIC that referenced this pull request May 11, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants