In article <local.mail.freebsd-hackers/m111mgq-0000...@bert.kts.org> you write:
>Hi,
>
>perhaps i don't see the wood for trees.
>
>I'd like to write a driver for a PCI ISDN chipset which uses a 32k byte
>memory window as a sort of "dual ported ram" in the memory address space.
>
>What has to be done in the driver attach routine is
>
> - allocate a 32k contingous memory window
> - get the physical address of it
> - program the ISDN PCI chipset with the start address of the window
>
>Now can i just malloc 32k and then use vtophys() to get the physical
>start address to program the PCI chip with ?

With the "new-bus" architecture, I believe this is done the following way:

   1. Create a DMA tag describing the amount of memory needed, and what 
      the alignment constraints are.

        error = bus_dma_tag_create( .... );

   2. Allocate the memory described by the tag.

        error = bus_dmamem_alloc( .... );

   3. Map the memory into the address space.  A callback routine is used
      to record the physical -> virtual mapping.

        bus_dmamap_load( .... );


For pre-newbus, I think you just call contigmalloc(), and vtophys().
--
Jonathan


To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to