Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Mar 2004 16:03:21 +0100
From:      thefly <thefly@acaro.org>
To:        freebsd-hackers@freebsd.org
Subject:   bus_alloc_resource() returns NULL, but why?
Message-ID:  <20040316150321.GA4900@tyler>

next in thread | raw e-mail | index | archive | help
Hi, i'm currently porting QuanCom PWDOG1 Watchdog card to FreeBSD, (you
can find the current code at http://chiakotay.nexlab.it/acaro/pwdog.c). 
I defined my softc struct:

struct pwdog1_softc {
        bus_space_tag_t bst;
	bus_space_handle_t bsh;
	struct resource *res;
	int rid;
};

In my attach() function i do NewBus initialization:

    sc = (struct pwdog1_softc *) device_get_softc(dev);

    sc->rid = 0;
    sc->res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, 0, ~0, 1, RF_ACTIVE);
    sc->bst = rman_get_bustag(sc->res);
    sc->bsh = rman_get_bushandle(sc->res);

but the problem is that bus_alloc_resource() returns NULL. I don't have
a clue about WHY it should. It's running on: FreeBSD 5.2.1-RELEASE with
GENERIC kernel in a dual pentium 200MMX.

Thanks in advance

-- 
    Claudio "thefly" Martella
    thefly@acaro.org
    GNU/PG keyid: 0x8EA95625



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040316150321.GA4900>