aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2007-12-22 14:44:29 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:08:00 -0500
commit804d8541d217f73a6543baac937cf65b8b4de850 (patch)
tree54c3f022cc401789cbb01595a5fe60c708454105
parent7cd61888d2ab9fa7e08205b18a24885e523df048 (diff)
qla3xxx annotations
stop the byteswap-in-place, annotate Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/qla3xxx.c44
-rw-r--r--drivers/net/qla3xxx.h55
2 files changed, 38 insertions, 61 deletions
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 00f2fddff1f2..a6aeb9d60443 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -540,20 +540,12 @@ static void eeprom_readword(struct ql3_adapter *qdev,
540 fm93c56a_deselect(qdev); 540 fm93c56a_deselect(qdev);
541} 541}
542 542
543static void ql_swap_mac_addr(u8 * macAddress) 543static void ql_set_mac_addr(struct net_device *ndev, u16 *addr)
544{ 544{
545#ifdef __BIG_ENDIAN 545 __le16 *p = (__le16 *)ndev->dev_addr;
546 u8 temp; 546 p[0] = cpu_to_le16(addr[0]);
547 temp = macAddress[0]; 547 p[1] = cpu_to_le16(addr[1]);
548 macAddress[0] = macAddress[1]; 548 p[2] = cpu_to_le16(addr[2]);
549 macAddress[1] = temp;
550 temp = macAddress[2];
551 macAddress[2] = macAddress[3];
552 macAddress[3] = temp;
553 temp = macAddress[4];
554 macAddress[4] = macAddress[5];
555 macAddress[5] = temp;
556#endif
557} 549}
558 550
559static int ql_get_nvram_params(struct ql3_adapter *qdev) 551static int ql_get_nvram_params(struct ql3_adapter *qdev)
@@ -590,18 +582,6 @@ static int ql_get_nvram_params(struct ql3_adapter *qdev)
590 return -1; 582 return -1;
591 } 583 }
592 584
593 /*
594 * We have a problem with endianness for the MAC addresses
595 * and the two 8-bit values version, and numPorts. We
596 * have to swap them on big endian systems.
597 */
598 ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn0.macAddress);
599 ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn1.macAddress);
600 ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn2.macAddress);
601 ql_swap_mac_addr(qdev->nvram_data.funcCfg_fn3.macAddress);
602 pEEPROMData = (u16 *) & qdev->nvram_data.version;
603 *pEEPROMData = le16_to_cpu(*pEEPROMData);
604
605 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); 585 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
606 return checksum; 586 return checksum;
607} 587}
@@ -3035,7 +3015,7 @@ static int ql_alloc_mem_resources(struct ql3_adapter *qdev)
3035 LS_64BITS(qdev->shadow_reg_phy_addr); 3015 LS_64BITS(qdev->shadow_reg_phy_addr);
3036 3016
3037 qdev->prsp_producer_index = 3017 qdev->prsp_producer_index =
3038 (u32 *) (((u8 *) qdev->preq_consumer_index) + 8); 3018 (__le32 *) (((u8 *) qdev->preq_consumer_index) + 8);
3039 qdev->rsp_producer_index_phy_addr_high = 3019 qdev->rsp_producer_index_phy_addr_high =
3040 qdev->req_consumer_index_phy_addr_high; 3020 qdev->req_consumer_index_phy_addr_high;
3041 qdev->rsp_producer_index_phy_addr_low = 3021 qdev->rsp_producer_index_phy_addr_low =
@@ -3215,7 +3195,7 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
3215 ql_write_page1_reg(qdev, &hmem_regs->reqLength, NUM_REQ_Q_ENTRIES); 3195 ql_write_page1_reg(qdev, &hmem_regs->reqLength, NUM_REQ_Q_ENTRIES);
3216 3196
3217 /* Response Queue Registers */ 3197 /* Response Queue Registers */
3218 *((u16 *) (qdev->prsp_producer_index)) = 0; 3198 *((__le16 *) (qdev->prsp_producer_index)) = 0;
3219 qdev->rsp_consumer_index = 0; 3199 qdev->rsp_consumer_index = 0;
3220 qdev->rsp_current = qdev->rsp_q_virt_addr; 3200 qdev->rsp_current = qdev->rsp_q_virt_addr;
3221 3201
@@ -3548,7 +3528,7 @@ static void ql_set_mac_info(struct ql3_adapter *qdev)
3548 qdev->ndev->name,value); 3528 qdev->ndev->name,value);
3549 break; 3529 break;
3550 } 3530 }
3551 qdev->numPorts = qdev->nvram_data.numPorts; 3531 qdev->numPorts = qdev->nvram_data.version_and_numPorts >> 8;
3552} 3532}
3553 3533
3554static void ql_display_dev_info(struct net_device *ndev) 3534static void ql_display_dev_info(struct net_device *ndev)
@@ -4051,12 +4031,10 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
4051 /* Validate and set parameters */ 4031 /* Validate and set parameters */
4052 if (qdev->mac_index) { 4032 if (qdev->mac_index) {
4053 ndev->mtu = qdev->nvram_data.macCfg_port1.etherMtu_mac ; 4033 ndev->mtu = qdev->nvram_data.macCfg_port1.etherMtu_mac ;
4054 memcpy(ndev->dev_addr, &qdev->nvram_data.funcCfg_fn2.macAddress, 4034 ql_set_mac_addr(ndev, qdev->nvram_data.funcCfg_fn2.macAddress);
4055 ETH_ALEN);
4056 } else { 4035 } else {
4057 ndev->mtu = qdev->nvram_data.macCfg_port0.etherMtu_mac ; 4036 ndev->mtu = qdev->nvram_data.macCfg_port0.etherMtu_mac ;
4058 memcpy(ndev->dev_addr, &qdev->nvram_data.funcCfg_fn0.macAddress, 4037 ql_set_mac_addr(ndev, qdev->nvram_data.funcCfg_fn0.macAddress);
4059 ETH_ALEN);
4060 } 4038 }
4061 memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); 4039 memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
4062 4040
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h
index d0ffb30ef371..58a086fddec6 100644
--- a/drivers/net/qla3xxx.h
+++ b/drivers/net/qla3xxx.h
@@ -50,7 +50,7 @@ struct ob_mac_iocb_req {
50#define OB_3032MAC_IOCB_REQ_UC 0x01 50#define OB_3032MAC_IOCB_REQ_UC 0x01
51 u8 reserved0; 51 u8 reserved0;
52 52
53 __le32 transaction_id; 53 u32 transaction_id; /* opaque for hardware */
54 __le16 data_len; 54 __le16 data_len;
55 u8 ip_hdr_off; 55 u8 ip_hdr_off;
56 u8 ip_hdr_len; 56 u8 ip_hdr_len;
@@ -86,7 +86,7 @@ struct ob_mac_iocb_rsp {
86#define OB_MAC_IOCB_RSP_I 0x01 86#define OB_MAC_IOCB_RSP_I 0x01
87 87
88 __le16 reserved0; 88 __le16 reserved0;
89 __le32 transaction_id; 89 u32 transaction_id; /* opaque for hardware */
90 __le32 reserved1; 90 __le32 reserved1;
91 __le32 reserved2; 91 __le32 reserved2;
92}; 92};
@@ -953,8 +953,8 @@ struct eeprom_bios_cfg {
953 */ 953 */
954struct eeprom_function_cfg { 954struct eeprom_function_cfg {
955 u8 reserved[30]; 955 u8 reserved[30];
956 u8 macAddress[6]; 956 u16 macAddress[3];
957 u8 macAddressSecondary[6]; 957 u16 macAddressSecondary[3];
958 958
959 u16 subsysVendorId; 959 u16 subsysVendorId;
960 u16 subsysDeviceId; 960 u16 subsysDeviceId;
@@ -965,8 +965,7 @@ struct eeprom_function_cfg {
965 */ 965 */
966struct eeprom_data { 966struct eeprom_data {
967 u8 asicId[4]; 967 u8 asicId[4];
968 u8 version; 968 u16 version_and_numPorts; /* together to avoid endianness crap */
969 u8 numPorts;
970 u16 boardId; 969 u16 boardId;
971 970
972#define EEPROM_BOARDID_STR_SIZE 16 971#define EEPROM_BOARDID_STR_SIZE 16
@@ -1056,31 +1055,31 @@ struct eeprom_data {
1056 */ 1055 */
1057struct lrg_buf_q_entry { 1056struct lrg_buf_q_entry {
1058 1057
1059 u32 addr0_lower; 1058 __le32 addr0_lower;
1060#define IAL_LAST_ENTRY 0x00000001 1059#define IAL_LAST_ENTRY 0x00000001
1061#define IAL_CONT_ENTRY 0x00000002 1060#define IAL_CONT_ENTRY 0x00000002
1062#define IAL_FLAG_MASK 0x00000003 1061#define IAL_FLAG_MASK 0x00000003
1063 u32 addr0_upper; 1062 __le32 addr0_upper;
1064 u32 addr1_lower; 1063 __le32 addr1_lower;
1065 u32 addr1_upper; 1064 __le32 addr1_upper;
1066 u32 addr2_lower; 1065 __le32 addr2_lower;
1067 u32 addr2_upper; 1066 __le32 addr2_upper;
1068 u32 addr3_lower; 1067 __le32 addr3_lower;
1069 u32 addr3_upper; 1068 __le32 addr3_upper;
1070 u32 addr4_lower; 1069 __le32 addr4_lower;
1071 u32 addr4_upper; 1070 __le32 addr4_upper;
1072 u32 addr5_lower; 1071 __le32 addr5_lower;
1073 u32 addr5_upper; 1072 __le32 addr5_upper;
1074 u32 addr6_lower; 1073 __le32 addr6_lower;
1075 u32 addr6_upper; 1074 __le32 addr6_upper;
1076 u32 addr7_lower; 1075 __le32 addr7_lower;
1077 u32 addr7_upper; 1076 __le32 addr7_upper;
1078 1077
1079}; 1078};
1080 1079
1081struct bufq_addr_element { 1080struct bufq_addr_element {
1082 u32 addr_low; 1081 __le32 addr_low;
1083 u32 addr_high; 1082 __le32 addr_high;
1084}; 1083};
1085 1084
1086#define QL_NO_RESET 0 1085#define QL_NO_RESET 0
@@ -1116,9 +1115,9 @@ struct ql_rcv_buf_cb {
1116#define MAX_OAL_CNT ((MAX_SKB_FRAGS-1)/4 + 1) 1115#define MAX_OAL_CNT ((MAX_SKB_FRAGS-1)/4 + 1)
1117 1116
1118struct oal_entry { 1117struct oal_entry {
1119 u32 dma_lo; 1118 __le32 dma_lo;
1120 u32 dma_hi; 1119 __le32 dma_hi;
1121 u32 len; 1120 __le32 len;
1122#define OAL_LAST_ENTRY 0x80000000 /* Last valid buffer in list. */ 1121#define OAL_LAST_ENTRY 0x80000000 /* Last valid buffer in list. */
1123#define OAL_CONT_ENTRY 0x40000000 /* points to an OAL. (continuation) */ 1122#define OAL_CONT_ENTRY 0x40000000 /* points to an OAL. (continuation) */
1124}; 1123};
@@ -1223,7 +1222,7 @@ struct ql3_adapter {
1223 struct net_rsp_iocb *rsp_current; 1222 struct net_rsp_iocb *rsp_current;
1224 u16 rsp_consumer_index; 1223 u16 rsp_consumer_index;
1225 u16 reserved_06; 1224 u16 reserved_06;
1226 volatile u32 *prsp_producer_index; 1225 volatile __le32 *prsp_producer_index;
1227 u32 rsp_producer_index_phy_addr_high; 1226 u32 rsp_producer_index_phy_addr_high;
1228 u32 rsp_producer_index_phy_addr_low; 1227 u32 rsp_producer_index_phy_addr_low;
1229 1228