Date: Tue, 12 Dec 2000 18:13:40 -0700 From: "Steve Shoecraft" <sshoecraft@1-link.net> To: <freebsd-hackers@freebsd.org> Subject: RE: Accessing the Video Bios on a PCI card?? (vm_map ?) Message-ID: <000101c064a1$ee6ce4c0$8f05dacf@max.home.org>
next in thread | raw e-mail | index | archive | help
(this is a winblows system with my work-related email on it - you expect sane wrapping?) Anyway ... I got the size of the bios using the method you suggested. I used malloc to get a chunk of memory, turned the ptr into a physical addr, then used free to get rid of it. I then used pmap_mapdev to map the phsy to virt. You suggested using the resource manager to find a block ... how do I go about doing that? I've tried bus_alloc_resource with the MEMORY type, but it always fails... Any hints? Oh, and yes, the card is my primary adapter. I just want my driver to work even if the card is not the primary adapter. - Steve -----Original Message----- From: Mike Smith [mailto:msmith@freebsd.org] Sent: Tuesday, December 12, 2000 2:59 PM To: sshoecraft@1-link.net Cc: freebsd-hackers@freebsd.org Subject: Re: Accessing the Video Bios on a PCI card?? (vm_map ?) (please wrap your messages in a sane fashion!) > Ok. I've been looking at the kernel source for a bit, and come up with > a couple ideas how to do this. I wanted to run it by you guys to see if > this is the "right way." > > I'm guessing I'm gonna need to write the address where I WANT the bios > to show up in the PCIR_BIOS register. The problem is, how do I get that > addr. Do I: This is mostly correct, however the system BIOS should have done this for you already. Is this card your primary video card? > Will this work? I haven't tried it yet, but it sure looks like it's the > wrong way to do it. It seems like as soon as I access the addr, i.e.: No, you should not do it like that. The problem is depressingly difficult to resolve "cleanly". If you just want to rummage through the BIOS, and don't actually want to call any code in it, it's a little simpler. Start off by writing 0xfffffffe to the bios base address register. Then read it back and note that what you'll get is an address mask which tells you how big the ROM is. (You can convert to a size by flipping the bits and adding 1). Find a free memory area (start off by just guessing; later you'll need to use the resource manager to actually find a block) and write the physical base address of this area into the bios base address register, remembering to set the LSB to enable the decoder. Also make sure that the memory enable bit is set in the command register. Then use pmap_mapdev() to map that physical range into kernel space. That should get you going; you can look at the cardbus code to see how to find a memory range once you get to that point. (It's not perfect yet, but it works.) -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E 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?000101c064a1$ee6ce4c0$8f05dacf>