Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2004 17:03:58 -0800 (PST)
From:      Nate Lawson <nate@root.org>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        arch@freebsd.org
Subject:   Re: newbus ioport usage
Message-ID:  <20040126165523.W30461@root.org>
In-Reply-To: <20040126.151728.133912536.imp@bsdimp.com>
References:  <20040126140100.T29680@root.org> <20040126.151728.133912536.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 26 Jan 2004, M. Warner Losh wrote:
> In message: <20040126140100.T29680@root.org>
>             Nate Lawson <nate@root.org> writes:
> : I have a driver that knows the IO port it wants.  It's not set up by a
> : parent bus, so I can't use bus_set_resource().  This call returns NULL.
> : Any idea how to debug why newbus is rejecting this request?  The io port
> : is not in use and the rid is unique.
> :
> :   bus_alloc_resource(dev, SYS_RES_IOPORT, rid, 0x101c, 0x101c, 1,
> :     RF_ACTIVE);
>
> Ummm, you can use bus_set_resource() in the driver to do this (I've
> done it before).  bus_set_resource() should return 0 to indicate
> success.  bus_alloc_resource should then succeed.  There may be one
> other step to do as well to make this work, but I'm not sure if it is
> an internal convention or actually required.  The pci bus code does a
> resource_list_add for each of the resources the child uses, but I
> think that's an internal thing to the pci bus (that other busses do
> also).

Ok, I'm doing the set/alloc and it works.  However, one weird thing.  If I
allocate all ports at boot time, it succeeds.  My driver goes through
multiple release/allocate cycles and it all works as expected.  However if
I boot and attach to only one of the registers, subsequent attempts to
attach the second one fail.  The resources are 2 IO ports, 0x101c and
0x101d.  Both are 1 byte.

-Nate



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