]> err.no Git - linux-2.6/commitdiff
IB/mthca: Don't read reserved fields in mthca_QUERY_ADAPTER()
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Sun, 27 Jan 2008 16:13:20 +0000 (18:13 +0200)
committerRoland Dreier <rolandd@cisco.com>
Tue, 5 Feb 2008 04:20:43 +0000 (20:20 -0800)
For memfree devices, the firmware QUERY_ADAPTER command does not
return vendor_id, device_id, and revision_id; do not return these
fields in the QUERY_ADAPTER function for memfree devices.

Instead, for memfree devices, initialize the rev_id field of the mthca
device via init_node_data (MAD IFC query), as is done in the
query_device verb implementation.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mthca/mthca_cmd.c
drivers/infiniband/hw/mthca/mthca_main.c
drivers/infiniband/hw/mthca/mthca_provider.c

index 6966f943f44036b2fee4c07ccb4f0eda25a0956f..09a30dd12b147433020a796ef94b21cd33725bf3 100644 (file)
@@ -1255,9 +1255,14 @@ int mthca_QUERY_ADAPTER(struct mthca_dev *dev,
        if (err)
                goto out;
 
-       MTHCA_GET(adapter->vendor_id, outbox,   QUERY_ADAPTER_VENDOR_ID_OFFSET);
-       MTHCA_GET(adapter->device_id, outbox,   QUERY_ADAPTER_DEVICE_ID_OFFSET);
-       MTHCA_GET(adapter->revision_id, outbox, QUERY_ADAPTER_REVISION_ID_OFFSET);
+       if (!mthca_is_memfree(dev)) {
+               MTHCA_GET(adapter->vendor_id, outbox,
+                         QUERY_ADAPTER_VENDOR_ID_OFFSET);
+               MTHCA_GET(adapter->device_id, outbox,
+                         QUERY_ADAPTER_DEVICE_ID_OFFSET);
+               MTHCA_GET(adapter->revision_id, outbox,
+                         QUERY_ADAPTER_REVISION_ID_OFFSET);
+       }
        MTHCA_GET(adapter->inta_pin, outbox,    QUERY_ADAPTER_INTA_PIN_OFFSET);
 
        get_board_id(outbox + QUERY_ADAPTER_VSD_OFFSET / 4,
index 5cf8250d4e164003312fed79579b578267c94eed..e3bd71a3aa93589253cd8a760fba76db00ddd24d 100644 (file)
@@ -735,7 +735,8 @@ static int mthca_init_hca(struct mthca_dev *mdev)
        }
 
        mdev->eq_table.inta_pin = adapter.inta_pin;
-       mdev->rev_id            = adapter.revision_id;
+       if (!mthca_is_memfree(mdev))
+               mdev->rev_id = adapter.revision_id;
        memcpy(mdev->board_id, adapter.board_id, sizeof mdev->board_id);
 
        return 0;
index 19b7f61cf04c17bfd4d7e2396c01f176194d78ac..9e491df6419cd12b2266fb2846f381479d6e07b4 100644 (file)
@@ -1256,6 +1256,8 @@ static int mthca_init_node_data(struct mthca_dev *dev)
                goto out;
        }
 
+       if (mthca_is_memfree(dev))
+               dev->rev_id = be32_to_cpup((__be32 *) (out_mad->data + 32));
        memcpy(&dev->ib_dev.node_guid, out_mad->data + 12, 8);
 
 out: