aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-10-23 04:32:33 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-24 07:27:18 -0400
commitdc803df8dd68a045bea4753f5300eeecb961ca2d (patch)
tree3b9400298648a7a23d1674facff07830c761a3fd
parent8698a6b642910a3d35be7160cd00dc98ab584d97 (diff)
sfc: Remove pointless abstraction of memory BAR number
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/sfc/efx.c16
-rw-r--r--drivers/net/sfc/efx.h3
-rw-r--r--drivers/net/sfc/falcon.c2
3 files changed, 10 insertions, 11 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 30951fb3d20f..29003fe9cb4c 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -818,9 +818,8 @@ static int efx_init_io(struct efx_nic *efx)
818 goto fail2; 818 goto fail2;
819 } 819 }
820 820
821 efx->membase_phys = pci_resource_start(efx->pci_dev, 821 efx->membase_phys = pci_resource_start(efx->pci_dev, EFX_MEM_BAR);
822 efx->type->mem_bar); 822 rc = pci_request_region(pci_dev, EFX_MEM_BAR, "sfc");
823 rc = pci_request_region(pci_dev, efx->type->mem_bar, "sfc");
824 if (rc) { 823 if (rc) {
825 EFX_ERR(efx, "request for memory BAR failed\n"); 824 EFX_ERR(efx, "request for memory BAR failed\n");
826 rc = -EIO; 825 rc = -EIO;
@@ -829,21 +828,20 @@ static int efx_init_io(struct efx_nic *efx)
829 efx->membase = ioremap_nocache(efx->membase_phys, 828 efx->membase = ioremap_nocache(efx->membase_phys,
830 efx->type->mem_map_size); 829 efx->type->mem_map_size);
831 if (!efx->membase) { 830 if (!efx->membase) {
832 EFX_ERR(efx, "could not map memory BAR %d at %llx+%x\n", 831 EFX_ERR(efx, "could not map memory BAR at %llx+%x\n",
833 efx->type->mem_bar,
834 (unsigned long long)efx->membase_phys, 832 (unsigned long long)efx->membase_phys,
835 efx->type->mem_map_size); 833 efx->type->mem_map_size);
836 rc = -ENOMEM; 834 rc = -ENOMEM;
837 goto fail4; 835 goto fail4;
838 } 836 }
839 EFX_LOG(efx, "memory BAR %u at %llx+%x (virtual %p)\n", 837 EFX_LOG(efx, "memory BAR at %llx+%x (virtual %p)\n",
840 efx->type->mem_bar, (unsigned long long)efx->membase_phys, 838 (unsigned long long)efx->membase_phys,
841 efx->type->mem_map_size, efx->membase); 839 efx->type->mem_map_size, efx->membase);
842 840
843 return 0; 841 return 0;
844 842
845 fail4: 843 fail4:
846 pci_release_region(efx->pci_dev, efx->type->mem_bar); 844 pci_release_region(efx->pci_dev, EFX_MEM_BAR);
847 fail3: 845 fail3:
848 efx->membase_phys = 0; 846 efx->membase_phys = 0;
849 fail2: 847 fail2:
@@ -862,7 +860,7 @@ static void efx_fini_io(struct efx_nic *efx)
862 } 860 }
863 861
864 if (efx->membase_phys) { 862 if (efx->membase_phys) {
865 pci_release_region(efx->pci_dev, efx->type->mem_bar); 863 pci_release_region(efx->pci_dev, EFX_MEM_BAR);
866 efx->membase_phys = 0; 864 efx->membase_phys = 0;
867 } 865 }
868 866
diff --git a/drivers/net/sfc/efx.h b/drivers/net/sfc/efx.h
index ae76760d4f40..179e0e3b0ec6 100644
--- a/drivers/net/sfc/efx.h
+++ b/drivers/net/sfc/efx.h
@@ -19,6 +19,9 @@
19#define FALCON_A_S_DEVID 0x6703 19#define FALCON_A_S_DEVID 0x6703
20#define FALCON_B_P_DEVID 0x0710 20#define FALCON_B_P_DEVID 0x0710
21 21
22/* Solarstorm controllers use BAR 0 for I/O space and BAR 2(&3) for memory */
23#define EFX_MEM_BAR 2
24
22/* TX */ 25/* TX */
23extern netdev_tx_t efx_xmit(struct efx_nic *efx, 26extern netdev_tx_t efx_xmit(struct efx_nic *efx,
24 struct efx_tx_queue *tx_queue, 27 struct efx_tx_queue *tx_queue,
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index e3c33fa06c86..ade27920a96c 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -3117,7 +3117,6 @@ void falcon_update_nic_stats(struct efx_nic *efx)
3117 */ 3117 */
3118 3118
3119struct efx_nic_type falcon_a_nic_type = { 3119struct efx_nic_type falcon_a_nic_type = {
3120 .mem_bar = 2,
3121 .mem_map_size = 0x20000, 3120 .mem_map_size = 0x20000,
3122 .txd_ptr_tbl_base = FR_AA_TX_DESC_PTR_TBL_KER, 3121 .txd_ptr_tbl_base = FR_AA_TX_DESC_PTR_TBL_KER,
3123 .rxd_ptr_tbl_base = FR_AA_RX_DESC_PTR_TBL_KER, 3122 .rxd_ptr_tbl_base = FR_AA_RX_DESC_PTR_TBL_KER,
@@ -3131,7 +3130,6 @@ struct efx_nic_type falcon_a_nic_type = {
3131}; 3130};
3132 3131
3133struct efx_nic_type falcon_b_nic_type = { 3132struct efx_nic_type falcon_b_nic_type = {
3134 .mem_bar = 2,
3135 /* Map everything up to and including the RSS indirection 3133 /* Map everything up to and including the RSS indirection
3136 * table. Don't map MSI-X table, MSI-X PBA since Linux 3134 * table. Don't map MSI-X table, MSI-X PBA since Linux
3137 * requires that they not be mapped. */ 3135 * requires that they not be mapped. */