aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mlx
diff options
context:
space:
mode:
authorMatthew N. Dodd <mdodd@FreeBSD.org>2000-11-28 06:17:32 +0000
committerMatthew N. Dodd <mdodd@FreeBSD.org>2000-11-28 06:17:32 +0000
commit9b11c7ba44a00492a1d2537bc480b269b6f2f4c2 (patch)
treee34e34b164f418c42c2dde59871d2c16d3b2532b /sys/dev/mlx
parentc669d6a0020850fffafe282a9492f16a786ea8a8 (diff)
Notes
Diffstat (limited to 'sys/dev/mlx')
-rw-r--r--sys/dev/mlx/mlx.c3
-rw-r--r--sys/dev/mlx/mlx_pci.c17
-rw-r--r--sys/dev/mlx/mlxvar.h2
3 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c
index e5271c9db3b0..2a952eb71de6 100644
--- a/sys/dev/mlx/mlx.c
+++ b/sys/dev/mlx/mlx.c
@@ -199,8 +199,7 @@ mlx_free(struct mlx_softc *sc)
/* release the register window mapping */
if (sc->mlx_mem != NULL)
- bus_release_resource(sc->mlx_dev, SYS_RES_MEMORY,
- (sc->mlx_iftype == MLX_IFTYPE_3) ? MLX_CFG_BASE1 : MLX_CFG_BASE0, sc->mlx_mem);
+ bus_release_resource(sc->mlx_dev, sc->mlx_mem_type, sc->mlx_mem_rid, sc->mlx_mem);
/* free controller enquiry data */
if (sc->mlx_enq2 != NULL)
diff --git a/sys/dev/mlx/mlx_pci.c b/sys/dev/mlx/mlx_pci.c
index 2a2704850c22..84b07e7026ef 100644
--- a/sys/dev/mlx/mlx_pci.c
+++ b/sys/dev/mlx/mlx_pci.c
@@ -114,7 +114,7 @@ static int
mlx_pci_attach(device_t dev)
{
struct mlx_softc *sc;
- int i, rid, error;
+ int i, error;
u_int32_t command;
debug_called(1);
@@ -161,17 +161,20 @@ mlx_pci_attach(device_t dev)
switch(sc->mlx_iftype) {
case MLX_IFTYPE_2:
case MLX_IFTYPE_3:
- rid = MLX_CFG_BASE1;
- sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE);
+ sc->mlx_mem_type = SYS_RES_MEMORY;
+ sc->mlx_mem_rid = MLX_CFG_BASE1;
+ sc->mlx_mem = bus_alloc_resource(dev, sc->mlx_mem_type, &sc->mlx_mem_rid, 0, ~0, 1, RF_ACTIVE);
if (sc->mlx_mem == NULL) {
- rid = MLX_CFG_BASE0;
- sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, 1, RF_ACTIVE);
+ sc->mlx_mem_type = SYS_RES_IOPORT;
+ sc->mlx_mem_rid = MLX_CFG_BASE0;
+ sc->mlx_mem = bus_alloc_resource(dev, sc->mlx_mem_type, &sc->mlx_mem_rid, 0, ~0, 1, RF_ACTIVE);
}
break;
case MLX_IFTYPE_4:
case MLX_IFTYPE_5:
- rid = MLX_CFG_BASE0;
- sc->mlx_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE);
+ sc->mlx_mem_type = SYS_RES_MEMORY;
+ sc->mlx_mem_rid = MLX_CFG_BASE0;
+ sc->mlx_mem = bus_alloc_resource(dev, sc->mlx_mem_type, &sc->mlx_mem_rid, 0, ~0, 1, RF_ACTIVE);
break;
}
if (sc->mlx_mem == NULL) {
diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h
index edb1a853d094..06b0ffabac04 100644
--- a/sys/dev/mlx/mlxvar.h
+++ b/sys/dev/mlx/mlxvar.h
@@ -109,6 +109,8 @@ struct mlx_softc
device_t mlx_dev;
dev_t mlx_dev_t;
struct resource *mlx_mem; /* mailbox interface window */
+ int mlx_mem_rid;
+ int mlx_mem_type;
bus_space_handle_t mlx_bhandle; /* bus space handle */
bus_space_tag_t mlx_btag; /* bus space tag */
bus_dma_tag_t mlx_parent_dmat;/* parent DMA tag */