Date: Wed, 05 Apr 2000 23:54:02 -0600 From: Warner Losh <imp@village.org> To: "Gary T. Corcoran" <garycor@home.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to get multiple PCI I/O base addresses in attach()? Message-ID: <200004060554.XAA88923@harmony.village.org> In-Reply-To: Your message of "Wed, 05 Apr 2000 23:07:57 EDT." <38EBFF8D.56BB4841@home.com> References: <38EBFF8D.56BB4841@home.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <38EBFF8D.56BB4841@home.com> "Gary T. Corcoran" writes: : I installed FreeBSD 4.0 and I'm trying to write the attach() routine : for my device driver, to be compiled as a loadable module. In 4.0 : the attach routine only gets passed a dev pointer, not a PCI configuration : pointer. My PCI device has up to 6 I/O ranges, and I need to get the : base addresses for those ranges. : : So how does one get multiple I/O base addresses from a dev pointer : for a PCI device in FreeBSD 4.x ? rid = 0x10; res1 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); rid = 0x14; res2 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); rid = 0x18; res3 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); rid = 0x1c; res4 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); rid = 0x20; res5 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); rid = 0x24; res6 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); should do the trick. Change SYS_RES_MEMORY to SYS_RES_IOPORT if it is I/O mapped rather than memory mapped. In case it wasn't clear, the rid is the offset into the config space where the BAR register that you want to use is. Multiples of 4 only need apply. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004060554.XAA88923>