Questions on newbus...
M. Warner Losh
imp at bsdimp.com
Thu May 15 21:44:27 PDT 2003
In message: <200305160121.h4G1LkPS036046 at spoon.beta.com>
"Brian J. McGovern" <mcgovern at 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
More information about the freebsd-hackers
mailing list