From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 16 07:02:58 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A5ADF16A4CE for ; Tue, 16 Mar 2004 07:02:58 -0800 (PST) Received: from ms007msg.fastweb.it (star-mail-b.fastweb.it [213.140.2.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC1F143D2F for ; Tue, 16 Mar 2004 07:02:57 -0800 (PST) (envelope-from thefly@acaro.org) Received: from tyler (1.10.185.82) by ms007msg.fastweb.it (6.7.019) id 40318639002F11D2; Tue, 16 Mar 2004 16:02:56 +0100 Received: by tyler (Postfix, from userid 1000) id AB261123712; Tue, 16 Mar 2004 16:03:21 +0100 (CET) Date: Tue, 16 Mar 2004 16:03:21 +0100 From: thefly To: freebsd-hackers@freebsd.org Message-ID: <20040316150321.GA4900@tyler> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Editor: VIM - Vi IMproved 6.2 (2003 Jun 1, compiled Mar 10 2004 06:43:21) X-OS: Debian GNU/Linux 2.6.4 i686 User-Agent: Mutt/1.5.5.1+cvs20040105i X-Mailman-Approved-At: Wed, 17 Mar 2004 05:13:33 -0800 Subject: bus_alloc_resource() returns NULL, but why? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2004 15:02:58 -0000 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