Skip to content

Commit

Permalink
montblanc: config: Updated fw_util to support new flash chip (#294)
Browse files Browse the repository at this point in the history
Summary:
**Description**

We know that the flash of IOB and DOM have interchangeable devices . The following is the table provided by HW.
![image](https://github.com/user-attachments/assets/3b58d674-4760-4518-a4e9-2036b740b481)
then there should exist two types of flash device in the feature shipment units,

**Motivation**
Then adding the detect flash chip ID function before upgrade action in the config file, the fw_util config can support feature units.

**Test Plan**

- Use the jq command to format the JSON file for improved readability.
- build the latest fboss bsp kmod.
- build the latest fboss platform manager binary.
- Run the fw_util with this config file.

Current tested the new config file on two tpye board normal.
[montblanc-fw_util_compatible_original_flash_log_20241113.txt](https://github.com/user-attachments/files/17727529/montblanc-fw_util_compatible_original_flash_log_20241113.txt)

[montblanc-fw_util_compatible_new_flash_log_20241113.txt](https://github.com/user-attachments/files/17727549/montblanc-fw_util_compatible_new_flash_log_20241113.txt)

Pull Request resolved: #294

Reviewed By: kimdo8736

Differential Revision: D65866056

Pulled By: joancaneus

fbshipit-source-id: 5124aa1cd2f874418d175a89d72e0c290464de91
  • Loading branch information
clslucas authored and facebook-github-bot committed Nov 21, 2024
1 parent 9c627e4 commit 65b9525
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions fboss/platform/configs/montblanc/fw_util.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
"iob_fpga": {
"getVersionCmd": "cat /run/devmap/fpgas/MCB_IOB_INFO_ROM/fw_ver",
"priority": 2,
"upgradeCmd": "iob_fpga_filename=$(head -n 1 /home/iob_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1;flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 -w $iob_fpga_filename -c N25Q128..3E",
"verifyFwCmd": "iob_fpga_filename=$(head -n 1 /home/iob_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1;flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 -v $iob_fpga_filename -c N25Q128..3E",
"readFwCmd": "flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1;flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 -r /tmp/iob_fpga_file_backup -c N25Q128..3E"
"upgradeCmd": "iob_fpga_filename=$(head -n 1 /home/iob_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1;FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 -w $iob_fpga_filename -c $fname; fi; done",
"verifyFwCmd": "iob_fpga_filename=$(head -n 1 /home/iob_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1;FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 -v $iob_fpga_filename -c $fname; fi; done",
"readFwCmd": "flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1;FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_1_DEVICE_1 -r /tmp/iob_fpga_file_backup -c $fname; fi; done"
},
"dom1_fpga": {
"preUpgradeCmd": "gpioset $(gpiodetect | grep -E 'fboss_iob_pci.gpiochip.*' | awk '{print $1}') 9=1",
"getVersionCmd": "cat /run/devmap/fpgas/SMB_DOM1_INFO_ROM/fw_ver",
"priority": 3,
"upgradeCmd": "dom1_fpga_filename=$(head -n 1 /home/dom1_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 -w $dom1_fpga_filename -c N25Q128..3E",
"verifyFwCmd": "dom1_fpga_filename=$(head -n 1 /home/dom1_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 -v $dom1_fpga_filename -c N25Q128..3E",
"readFwCmd": "flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 -r /tmp/dom1_fpga_file_backup -c N25Q128..3E",
"upgradeCmd": "dom1_fpga_filename=$(head -n 1 /home/dom1_fpga_filename.txt);FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 -w $dom1_fpga_filename -c $fname; fi; done",
"verifyFwCmd": "dom1_fpga_filename=$(head -n 1 /home/dom1_fpga_filename.txt);FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 -v $dom1_fpga_filename -c $fname; fi; done",
"readFwCmd": "FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_2_DEVICE_1 -r /tmp/dom1_fpga_file_backup -c $fname; fi; done",
"postUpgradeCmd": "gpioget $(gpiodetect | grep -E 'fboss_iob_pci.gpiochip.*' | awk '{print $1}') 9"
},
"dom2_fpga": {
"preUpgradeCmd": "gpioset $(gpiodetect | grep -E 'fboss_iob_pci.gpiochip.*' | awk '{print $1}') 10=1",
"getVersionCmd": "cat /run/devmap/fpgas/SMB_DOM2_INFO_ROM/fw_ver",
"priority": 4,
"upgradeCmd": "dom2_fpga_filename=$(head -n 1 /home/dom2_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 -w $dom2_fpga_filename -c N25Q128..3E",
"verifyFwCmd": "dom2_fpga_filename=$(head -n 1 /home/dom2_fpga_filename.txt);flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 -v $dom2_fpga_filename -c N25Q128..3E",
"readFwCmd": "flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 -r /tmp/dom2_fpga_file_backup -c N25Q128..3E",
"upgradeCmd": "dom2_fpga_filename=$(head -n 1 /home/dom2_fpga_filename.txt);FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 -w $dom2_fpga_filename -c $fname; fi; done",
"verifyFwCmd": "dom2_fpga_filename=$(head -n 1 /home/dom2_fpga_filename.txt);FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 -v $dom2_fpga_filename -c $fname; fi; done",
"readFwCmd": "FLASH_ID=(N25Q128..3E W25Q128.V..M);for fname in ${FLASH_ID[@]}; do if flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 | grep -q $fname ; then flashrom -p linux_spi:dev=/run/devmap/flashes/MCB_SPI_MASTER_3_DEVICE_1 -r /tmp/dom2_fpga_file_backup -c $fname; fi; done",
"postUpgradeCmd": "gpioget $(gpiodetect | grep -E 'fboss_iob_pci.gpiochip.*' | awk '{print $1}') 10"
},
"mcb_cpld": {
Expand Down

0 comments on commit 65b9525

Please sign in to comment.