Date: Thu, 20 Jan 2000 22:38:12 -0500 (EST) From: "Matthew N. Dodd" <winter@jurai.net> To: "Tony Frank (EPA)" <Tony.Frank@ericsson.com.au> Cc: "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.ORG> Subject: RE: How do I allocate 2 blocks of memory? Message-ID: <Pine.BSF.4.21.0001202230440.462-100000@sasami.jurai.net> In-Reply-To: <4B6BC00CD15FD2119E5F0008C7A419A5069CB74A@eaubrnt018.epa.ericsson.se>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 21 Jan 2000, Tony Frank (EPA) wrote: > Since the card supports having the MMIO and the SRAM in seperate areas, > essentially the driver should support this also. > > I'm not sure whether the card will let me arrange the memory locations so > that it's all continuous. Ah, in that case you just need to add 2 separate resources; you might want to do something like this: #define FOO_MEM_RID_MMIO 0 #define FOO_MEM_RID_SRAM 1 bus_set_resource(dev, SYS_RES_MEMORY, FOO_MEM_RID_MMIO, start, end); bus_set_resource(dev, SYS_RES_MEMORY, FOO_MEM_RID_SRAM, start, end); Then, when you're going to call bus_alloc_resource() you'll initialize 'rid' to one or the other of FOO_MEM_RID_{MMIO,SRAM}, depending on which one you want to deal with. > One issue that I havn't really looked at yet is having the adapter in 'plug > and play' mode. Ah, PnP is even easier. > So far, if the adapter is in PnP mode, when I do my "normal" probing, > it appears that there is no configuration stored, ie I read 0x0 > instead of some valid details. That makes it easy to skip over the PnP adapters in your IDENTIFY method. Put an adapter in PnP mode and boot up; make note of the 'unknownN:' messages; one will be your TR board. It should have a number of resources associated with it. > I assume that I need to do some form of 'PnP configuration' but I am > yet to start looking into this. Look at the if_ep driver in sys/dev/ep/; its about the cleanest example you'll get. I've got another driver for the TMS380 I'm working on thats about as widely attached but its not yet ready for the general public so you'll have to make do with if_ep for your example. > I think bus_set_resource() is what I'm looking for, as opposed to > bus_alloc_resource()... Indeed. bus_alloc_resource() is what you do in your attach routine when you're ready to reserve the resource and use it. > One other general sort of question... is there any kind of description on > how these bus_* functions operate and interact? Not as such, no. The good news is that the resource manager (such as it is) and the newbus calls are fairly easy to understand and examples are available, though in some cases confusing. Check out sys/kern/subr_bus.c and sys/kern/subr_rman.c. > I've basically been working my way through a few different drivers and > from other assorted files in the /usr/src/sys area, but although I see > examples of what other drivers are doing, I'm not always sure on why. > It seems to be mostly luck for me to accidentally stumble on an answer > to a question I'm wondering about... Well, you can do it the trial and error way like I did or you can ask questions; I feel I've got a pretty good handle on things or at least enough to field questions. -- | Matthew N. Dodd | '78 Datsun 280Z | '75 Volvo 164E | FreeBSD/NetBSD | | winter@jurai.net | 2 x '84 Volvo 245DL | ix86,sparc,pmax | | http://www.jurai.net/~winter | This Space For Rent | ISO8802.5 4ever | 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?Pine.BSF.4.21.0001202230440.462-100000>