From 2a05a4eb2c67ea327e54b2e5d5ef8ac1370a3f1f Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Tue, 27 Feb 2001 22:57:32 +0000 Subject: [PATCH] A better mousetrap: use device hints, as in: hint.fxp.0.prefer_iomap="1" to set IO vs. Memory space mapping. --- sys/dev/fxp/if_fxp.c | 13 ++++++------- sys/pci/if_fxp.c | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 8cc34ffdb90..068bd8c1f3a 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -314,7 +314,7 @@ fxp_attach(device_t dev) struct fxp_softc *sc = device_get_softc(dev); struct ifnet *ifp; u_int32_t val; - int rid, m1, m2, ebitmap; + int rid, m1, m2, prefer_iomap; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE); callout_handle_init(&sc->stat_ch); @@ -357,12 +357,11 @@ fxp_attach(device_t dev) */ m1 = PCIM_CMD_MEMEN; m2 = PCIM_CMD_PORTEN; - ebitmap = 0; - if (getenv_int("fxp_iomap", &ebitmap)) { - if (ebitmap & (1 << device_get_unit(dev))) { - m1 = PCIM_CMD_PORTEN; - m2 = PCIM_CMD_MEMEN; - } + prefer_iomap = 0; + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "prefer_iomap", &prefer_iomap) == 0 && prefer_iomap != 0) { + m1 = PCIM_CMD_PORTEN; + m2 = PCIM_CMD_MEMEN; } if (val & m1) { diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c index 8cc34ffdb90..068bd8c1f3a 100644 --- a/sys/pci/if_fxp.c +++ b/sys/pci/if_fxp.c @@ -314,7 +314,7 @@ fxp_attach(device_t dev) struct fxp_softc *sc = device_get_softc(dev); struct ifnet *ifp; u_int32_t val; - int rid, m1, m2, ebitmap; + int rid, m1, m2, prefer_iomap; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE); callout_handle_init(&sc->stat_ch); @@ -357,12 +357,11 @@ fxp_attach(device_t dev) */ m1 = PCIM_CMD_MEMEN; m2 = PCIM_CMD_PORTEN; - ebitmap = 0; - if (getenv_int("fxp_iomap", &ebitmap)) { - if (ebitmap & (1 << device_get_unit(dev))) { - m1 = PCIM_CMD_PORTEN; - m2 = PCIM_CMD_MEMEN; - } + prefer_iomap = 0; + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "prefer_iomap", &prefer_iomap) == 0 && prefer_iomap != 0) { + m1 = PCIM_CMD_PORTEN; + m2 = PCIM_CMD_MEMEN; } if (val & m1) { -- 2.45.2