netxen: clean up firmware version checks
authorDhananjay Phadke <dhananjay@netxen.com>
Sun, 26 Jul 2009 20:07:42 +0000 (20:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2009 18:15:25 +0000 (11:15 -0700)
NX2031 firmware version will never be > 4.0.0, so replace
(adapter->fw_major < 4) checks with pci revision ID check.

Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netxen/netxen_nic.h
drivers/net/netxen/netxen_nic_ctx.c
drivers/net/netxen/netxen_nic_hw.c
drivers/net/netxen/netxen_nic_init.c
drivers/net/netxen/netxen_nic_main.c

index e017827472ac16a6d14bc2e7d9003fe0b43f5124..b58d0b217424d7957308e273d3423d4eed3d2b17 100644 (file)
@@ -1299,7 +1299,7 @@ struct netxen_adapter {
 
        nx_nic_intr_coalesce_t coal;
 
-       u32 fw_major;
+       u32 resv5;
        u32 fw_version;
        const struct firmware *fw;
 };
index 9f8ae4719e2fb4a9d91d4893db5baf675ccd7616..9e0469643d340e74ab9b02f71a92e9fc5b75971c 100644 (file)
@@ -647,7 +647,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
                }
                rds_ring->desc_head = (struct rcv_desc *)addr;
 
-               if (adapter->fw_major < 4)
+               if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
                        rds_ring->crb_rcv_producer =
                                recv_crb_registers[port].crb_rcv_producer[ring];
        }
@@ -675,7 +675,7 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
        }
 
 
-       if (adapter->fw_major >= 4) {
+       if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
                err = nx_fw_cmd_create_rx_ctx(adapter);
                if (err)
                        goto err_out_free;
@@ -705,7 +705,7 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter)
 
        int port = adapter->portnum;
 
-       if (adapter->fw_major >= 4) {
+       if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
                nx_fw_cmd_destroy_rx_ctx(adapter);
                nx_fw_cmd_destroy_tx_ctx(adapter);
        } else {
index 088611bb5bdbc16c13a55c00d6e577c26638bebe..ddb9deb12b334efba60efe06302ec046d5146f81 100644 (file)
@@ -2045,7 +2045,6 @@ void netxen_nic_get_firmware_info(struct netxen_adapter *adapter)
        fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR);
        fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB);
 
-       adapter->fw_major = fw_major;
        adapter->fw_version = NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build);
 
        if (adapter->portnum == 0) {
index 91358459adb46aaa998c830f601df43a3d7aaf90..ef7f1b1b8454d6e754ce5bc749f2e88bfde0d6b6 100644 (file)
@@ -1477,7 +1477,7 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
                NXWR32(adapter, rds_ring->crb_rcv_producer,
                                (producer-1) & (rds_ring->num_desc-1));
 
-               if (adapter->fw_major < 4) {
+               if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
                        /*
                         * Write a doorbell msg to tell phanmon of change in
                         * receive ring producer
index 1aa850a0b89579430264cd8c62b8b570147672af..5d52630ecd8845719197e325f2d4d98f5d8eb050 100644 (file)
@@ -932,7 +932,7 @@ netxen_nic_attach(struct netxen_adapter *adapter)
                goto err_out_free_sw;
        }
 
-       if (adapter->fw_major < 4) {
+       if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
                tx_ring = adapter->tx_ring;
                tx_ring->crb_cmd_producer = crb_cmd_producer[adapter->portnum];
                tx_ring->crb_cmd_consumer = crb_cmd_consumer[adapter->portnum];
@@ -1103,7 +1103,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
         * See if the firmware gave us a virtual-physical port mapping.
         */
        adapter->physical_port = adapter->portnum;
-       if (adapter->fw_major < 4) {
+       if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) {
                i = NXRD32(adapter, CRB_V2P(adapter->portnum));
                if (i != 0x55555555)
                        adapter->physical_port = i;
@@ -1727,7 +1727,7 @@ static irqreturn_t netxen_intr(int irq, void *data)
        }
 
        /* clear interrupt */
-       if (adapter->fw_major < 4)
+       if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
                netxen_nic_disable_int(sds_ring);
 
        adapter->pci_write_immediate(adapter,