diff options
author | Sarveshwar Bandi <sarveshwarb@serverengines.com> | 2009-11-20 17:23:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-20 17:23:47 -0500 |
commit | fa9a6fed87df1b50804405e700f8d30251d3aaf1 (patch) | |
tree | 6ff36c19f7fb6f68084f5c7d6f737d7a14c9bd16 /drivers/net/benet/be_main.c | |
parent | eb6d02133cf5451fece3a37ccccf2ce7c09a09c1 (diff) |
be2net: Patch to flash redboot section while firmware update.
Please apply patch to update redboot section while firmware update. Code
checks if section needs to be updated before actually doing it.
Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_main.c')
-rw-r--r-- | drivers/net/benet/be_main.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index c0bd20356eaf..921103c40195 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1721,6 +1721,31 @@ static int be_close(struct net_device *netdev) | |||
1721 | #define FW_FILE_HDR_SIGN "ServerEngines Corp. " | 1721 | #define FW_FILE_HDR_SIGN "ServerEngines Corp. " |
1722 | char flash_cookie[2][16] = {"*** SE FLAS", | 1722 | char flash_cookie[2][16] = {"*** SE FLAS", |
1723 | "H DIRECTORY *** "}; | 1723 | "H DIRECTORY *** "}; |
1724 | |||
1725 | static bool be_flash_redboot(struct be_adapter *adapter, | ||
1726 | const u8 *p) | ||
1727 | { | ||
1728 | u32 crc_offset; | ||
1729 | u8 flashed_crc[4]; | ||
1730 | int status; | ||
1731 | crc_offset = FLASH_REDBOOT_START + FLASH_REDBOOT_IMAGE_MAX_SIZE - 4 | ||
1732 | + sizeof(struct flash_file_hdr) - 32*1024; | ||
1733 | p += crc_offset; | ||
1734 | status = be_cmd_get_flash_crc(adapter, flashed_crc); | ||
1735 | if (status) { | ||
1736 | dev_err(&adapter->pdev->dev, | ||
1737 | "could not get crc from flash, not flashing redboot\n"); | ||
1738 | return false; | ||
1739 | } | ||
1740 | |||
1741 | /*update redboot only if crc does not match*/ | ||
1742 | if (!memcmp(flashed_crc, p, 4)) | ||
1743 | return false; | ||
1744 | else | ||
1745 | return true; | ||
1746 | |||
1747 | } | ||
1748 | |||
1724 | static int be_flash_image(struct be_adapter *adapter, | 1749 | static int be_flash_image(struct be_adapter *adapter, |
1725 | const struct firmware *fw, | 1750 | const struct firmware *fw, |
1726 | struct be_dma_mem *flash_cmd, u32 flash_type) | 1751 | struct be_dma_mem *flash_cmd, u32 flash_type) |
@@ -1760,6 +1785,12 @@ static int be_flash_image(struct be_adapter *adapter, | |||
1760 | image_offset = FLASH_PXE_BIOS_START; | 1785 | image_offset = FLASH_PXE_BIOS_START; |
1761 | image_size = FLASH_BIOS_IMAGE_MAX_SIZE; | 1786 | image_size = FLASH_BIOS_IMAGE_MAX_SIZE; |
1762 | break; | 1787 | break; |
1788 | case FLASHROM_TYPE_REDBOOT: | ||
1789 | if (!be_flash_redboot(adapter, fw->data)) | ||
1790 | return 0; | ||
1791 | image_offset = FLASH_REDBOOT_ISM_START; | ||
1792 | image_size = FLASH_REDBOOT_IMAGE_MAX_SIZE; | ||
1793 | break; | ||
1763 | default: | 1794 | default: |
1764 | return 0; | 1795 | return 0; |
1765 | } | 1796 | } |