Subject: Re: mapping PCI memory
To: Emmanuel Dreyfus <manu@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 12/31/2003 15:47:54
On Fri, Dec 26, 2003 at 10:58:37PM +0100, Emmanuel Dreyfus wrote:
> Hi
> 
> For COMPAT_DARWIN, I need to map all the memory from the video board to
> the display server. 
> 
> As far as I understand the problem, I need to use bus_space_mmap for all
> the pages of memory that should be mapped. This leaves me with several
> questions
> 
> 1) I need a tag for a given display. On macppc, wsdisplay is child of
> ofb, and ofb_softc has two tags:
>         pci_chipset_tag_t sc_pc;
>         pcitag_t sc_pcitag;
> 
> What is the revelant tag here? I'd say pcitag_t, is that right?
> 
> 2) Is there a way of finding the tag from wsdisplay without the
> assumption that it's a child of ofb (on i386, it's a child of vga, for
> instace). 
> 
> 3) Do I have a way of discovering the amount of memory in the video
> board? It seems acheivable only if I assume it's a PCI board, do we have
> more general mecanisms?
> 
> 4) bus_space_mmap will want a base addresse, where can I find this?
> 
> 5) Once I have everything, I shall call bus_space_mmap for each page. Do
> we have another function that would do the job for the whole space?
> 
> Sorry if that's dumb questions, I'm not used at all to bus_space_*

I've not been thinking about this much, but I think the right place for
this would be in the VGA driver. The way to map the video memory is probably
device-specific.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 23 ans d'experience feront toujours la difference
--