aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2019-11-28 02:28:12 +0000
committerAlexander Motin <mav@FreeBSD.org>2019-11-28 02:28:12 +0000
commit241da27e240e7068ecbdc4cb78503585d5442d9b (patch)
treedf49d92d6978b5bfed76a4d545def5270567bcad /sys
parent841c3621b431c31760b72ef67670098a82bc7ac6 (diff)
downloadsrc-241da27e240e7068ecbdc4cb78503585d5442d9b.tar.gz
src-241da27e240e7068ecbdc4cb78503585d5442d9b.zip
Make the code slightly more compact.
There should be no functional change. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=355163
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ntb/ntb_hw/ntb_hw_intel.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
index 3facd48a5346..33d68c61becf 100644
--- a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
+++ b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c
@@ -782,37 +782,42 @@ bar_get_xlat_params(struct ntb_softc *ntb, enum ntb_bar bar, uint32_t *base,
static int
intel_ntb_map_pci_bars(struct ntb_softc *ntb)
{
+ struct ntb_pci_bar_info *bar;
int rc;
- ntb->bar_info[NTB_CONFIG_BAR].pci_resource_id = PCIR_BAR(0);
- rc = map_mmr_bar(ntb, &ntb->bar_info[NTB_CONFIG_BAR]);
+ bar = &ntb->bar_info[NTB_CONFIG_BAR];
+ bar->pci_resource_id = PCIR_BAR(0);
+ rc = map_mmr_bar(ntb, bar);
if (rc != 0)
goto out;
- ntb->bar_info[NTB_B2B_BAR_1].pci_resource_id = PCIR_BAR(2);
- rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_1]);
+ bar = &ntb->bar_info[NTB_B2B_BAR_1];
+ bar->pci_resource_id = PCIR_BAR(2);
+ rc = map_memory_window_bar(ntb, bar);
if (rc != 0)
goto out;
- ntb->bar_info[NTB_B2B_BAR_1].psz_off = XEON_PBAR23SZ_OFFSET;
- ntb->bar_info[NTB_B2B_BAR_1].ssz_off = XEON_SBAR23SZ_OFFSET;
- ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off = XEON_PBAR2XLAT_OFFSET;
+ bar->psz_off = XEON_PBAR23SZ_OFFSET;
+ bar->ssz_off = XEON_SBAR23SZ_OFFSET;
+ bar->pbarxlat_off = XEON_PBAR2XLAT_OFFSET;
- ntb->bar_info[NTB_B2B_BAR_2].pci_resource_id = PCIR_BAR(4);
- rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_2]);
+ bar = &ntb->bar_info[NTB_B2B_BAR_2];
+ bar->pci_resource_id = PCIR_BAR(4);
+ rc = map_memory_window_bar(ntb, bar);
if (rc != 0)
goto out;
- ntb->bar_info[NTB_B2B_BAR_2].psz_off = XEON_PBAR4SZ_OFFSET;
- ntb->bar_info[NTB_B2B_BAR_2].ssz_off = XEON_SBAR4SZ_OFFSET;
- ntb->bar_info[NTB_B2B_BAR_2].pbarxlat_off = XEON_PBAR4XLAT_OFFSET;
+ bar->psz_off = XEON_PBAR4SZ_OFFSET;
+ bar->ssz_off = XEON_SBAR4SZ_OFFSET;
+ bar->pbarxlat_off = XEON_PBAR4XLAT_OFFSET;
if (!HAS_FEATURE(ntb, NTB_SPLIT_BAR))
goto out;
- ntb->bar_info[NTB_B2B_BAR_3].pci_resource_id = PCIR_BAR(5);
- rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_3]);
- ntb->bar_info[NTB_B2B_BAR_3].psz_off = XEON_PBAR5SZ_OFFSET;
- ntb->bar_info[NTB_B2B_BAR_3].ssz_off = XEON_SBAR5SZ_OFFSET;
- ntb->bar_info[NTB_B2B_BAR_3].pbarxlat_off = XEON_PBAR5XLAT_OFFSET;
+ bar = &ntb->bar_info[NTB_B2B_BAR_3];
+ bar->pci_resource_id = PCIR_BAR(5);
+ rc = map_memory_window_bar(ntb, bar);
+ bar->psz_off = XEON_PBAR5SZ_OFFSET;
+ bar->ssz_off = XEON_SBAR5SZ_OFFSET;
+ bar->pbarxlat_off = XEON_PBAR5XLAT_OFFSET;
out:
if (rc != 0)
@@ -935,15 +940,14 @@ map_memory_window_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar)
static void
intel_ntb_unmap_pci_bar(struct ntb_softc *ntb)
{
- struct ntb_pci_bar_info *current_bar;
+ struct ntb_pci_bar_info *bar;
int i;
for (i = 0; i < NTB_MAX_BARS; i++) {
- current_bar = &ntb->bar_info[i];
- if (current_bar->pci_resource != NULL)
+ bar = &ntb->bar_info[i];
+ if (bar->pci_resource != NULL)
bus_release_resource(ntb->device, SYS_RES_MEMORY,
- current_bar->pci_resource_id,
- current_bar->pci_resource);
+ bar->pci_resource_id, bar->pci_resource);
}
}