diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-02-02 16:53:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-02 16:53:57 -0500 |
commit | 26351479ed43288be92935826c215fbe01e2abb2 (patch) | |
tree | 07b9669909f757e781ecb8d1694607099c75ae9f /drivers/net | |
parent | e408b8dcb5ce42243a902205005208e590f28454 (diff) |
qlge: bugfix: Fix endian issue when reading flash.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/qlge/qlge.h | 10 | ||||
-rw-r--r-- | drivers/net/qlge/qlge_main.c | 11 |
2 files changed, 12 insertions, 9 deletions
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index c1dadadfab18..e6fdce9206cc 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -787,12 +787,12 @@ struct mbox_params { | |||
787 | 787 | ||
788 | struct flash_params { | 788 | struct flash_params { |
789 | u8 dev_id_str[4]; | 789 | u8 dev_id_str[4]; |
790 | u16 size; | 790 | __le16 size; |
791 | u16 csum; | 791 | __le16 csum; |
792 | u16 ver; | 792 | __le16 ver; |
793 | u16 sub_dev_id; | 793 | __le16 sub_dev_id; |
794 | u8 mac_addr[6]; | 794 | u8 mac_addr[6]; |
795 | u16 res; | 795 | __le16 res; |
796 | }; | 796 | }; |
797 | 797 | ||
798 | 798 | ||
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 45421c8b6010..17d02eb6c8be 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -641,7 +641,7 @@ static void ql_enable_all_completion_interrupts(struct ql_adapter *qdev) | |||
641 | 641 | ||
642 | } | 642 | } |
643 | 643 | ||
644 | static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data) | 644 | static int ql_read_flash_word(struct ql_adapter *qdev, int offset, __le32 *data) |
645 | { | 645 | { |
646 | int status = 0; | 646 | int status = 0; |
647 | /* wait for reg to come ready */ | 647 | /* wait for reg to come ready */ |
@@ -656,8 +656,11 @@ static int ql_read_flash_word(struct ql_adapter *qdev, int offset, u32 *data) | |||
656 | FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR); | 656 | FLASH_ADDR, FLASH_ADDR_RDY, FLASH_ADDR_ERR); |
657 | if (status) | 657 | if (status) |
658 | goto exit; | 658 | goto exit; |
659 | /* get the data */ | 659 | /* This data is stored on flash as an array of |
660 | *data = ql_read32(qdev, FLASH_DATA); | 660 | * __le32. Since ql_read32() returns cpu endian |
661 | * we need to swap it back. | ||
662 | */ | ||
663 | *data = cpu_to_le32(ql_read32(qdev, FLASH_DATA)); | ||
661 | exit: | 664 | exit: |
662 | return status; | 665 | return status; |
663 | } | 666 | } |
@@ -666,7 +669,7 @@ static int ql_get_flash_params(struct ql_adapter *qdev) | |||
666 | { | 669 | { |
667 | int i; | 670 | int i; |
668 | int status; | 671 | int status; |
669 | u32 *p = (u32 *)&qdev->flash; | 672 | __le32 *p = (__le32 *)&qdev->flash; |
670 | 673 | ||
671 | if (ql_sem_spinlock(qdev, SEM_FLASH_MASK)) | 674 | if (ql_sem_spinlock(qdev, SEM_FLASH_MASK)) |
672 | return -ETIMEDOUT; | 675 | return -ETIMEDOUT; |