Date: Thu, 15 May 2003 22:43:50 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: mcgovern@beta.com Cc: hackers@freebsd.org Subject: Re: Questions on newbus... Message-ID: <20030515.224350.48400302.imp@bsdimp.com> In-Reply-To: <200305160121.h4G1LkPS036046@spoon.beta.com> References: <200305160121.h4G1LkPS036046@spoon.beta.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200305160121.h4G1LkPS036046@spoon.beta.com> "Brian J. McGovern" <mcgovern@beta.com> writes: : Now, I haven't done a lot of testing with the actual hardware (I haven't : updated the initialization code yet), but I'm assuming that these : bus_space_read() calls should give me physical address locations... In 4.x : (and earlier), the routines for allocating the resources would provide both : physical and virtual addresses. Use bus_space_read() and you'll be fine. : If I'm on track, how would I then properly convert these physical addresses : to usable virtual addresses? You don't have to worry abou tit. : If I'm off track (and I somehow expect I am), can someone take a few minutes : and coach me on how to read the PCI configuration registers, and get my : two memory windows mapped so I can start bit-banging the hardware? :) res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, size, RF_ACTIVE); bt = rman_get_bustag(res); bh = rman_get_bushandle(res); (you do this a second time for the other window). reg = bus_space_read_4(bt, bh, SOME_REGISTER); reg |= SR_ENABLE; bus_space_write_4(bt, bh, SOME_REGISTER, reg); Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030515.224350.48400302.imp>