summaryrefslogtreecommitdiffstats
path: root/sys/dev/mlx/mlx_pci.c
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2000-11-28 06:17:32 +0000
committermdodd <mdodd@FreeBSD.org>2000-11-28 06:17:32 +0000
commit67b4379f04a36c31ca81b79bacd6649857bbb563 (patch)
tree2efe53028a9cf8d4d861067fcd389493d9866598 /sys/dev/mlx/mlx_pci.c
parent51f405ec6ea3c70e9e867604bf429307817cb25c (diff)
downloadFreeBSD-src-67b4379f04a36c31ca81b79bacd6649857bbb563.zip
FreeBSD-src-67b4379f04a36c31ca81b79bacd6649857bbb563.tar.gz
Avoid hardcoding the 'rid' and 'type' of the MEM/IOPORT resource.
Store the 'rid' and 'type' in the softc and use them in mlx.c:mlx_free(). EISA and MCA front ends will require this. Approved by: msmith
Diffstat (limited to 'sys/dev/mlx/mlx_pci.c')
-rw-r--r--sys/dev/mlx/mlx_pci.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/mlx/mlx_pci.c b/sys/dev/mlx/mlx_pci.c
index 2a27048..84b07e7 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) {
OpenPOWER on IntegriCloud