Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Oct 2003 10:43:20 +0100 (CET)
From:      Harti Brandt <brandt@fokus.fraunhofer.de>
To:        Vincent Jardin <vjardin@free.fr>
Cc:        freebsd-atm@freebsd.org
Subject:   Re: if_hatm, bus_dma_tag_create
Message-ID:  <20031031103750.T74490@beagle.fokus.fraunhofer.de>
In-Reply-To: <200310302359.59272.vjardin@free.fr>
References:  <200310302359.59272.vjardin@free.fr>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 30 Oct 2003, Vincent Jardin wrote:

VJ>Hi,
VJ>
VJ>if_hatm sets lowaddr to BUS_SPACE_MAXADDR_32BIT when it calls
VJ>bus_dma_tag_create().
VJ>
VJ>It means that bus_dmamap_create() returns mapp = NULL, doesn'it ?
VJ>
VJ>Then, why is lowaddr so high ;-( ?

lowaddr is the lower address of the range that the card can NOT access.
The HE's have only 32 bit addresses so they can access only the lower
4GByte of the address space on machines with more than 32 bit on the bus.

This has nothing to to with mapp beeing NULL. This is NULL on i386 because
the i386 has no iommu so the card uses physical memory addresse. There is
nothing to map. On sparc64 mapp is not NULL.

VJ>PS:
VJ>
VJ>/*
VJ> * Allocate a handle for mapping from kva/uva/physical
VJ> * address space into bus device space.
VJ> */
VJ>int
VJ>bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
VJ>{
VJ>        int error;
VJ>
VJ>        error = 0;
VJ>
VJ>        if (dmat->segments == NULL) {
VJ>                dmat->segments = (bus_dma_segment_t *)malloc(
VJ>                    sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF,
VJ>                    M_NOWAIT);
VJ>                if (dmat->segments == NULL)
VJ>                        return (ENOMEM);
VJ>        }
VJ>
VJ>        if (dmat->lowaddr < ptoa((vm_paddr_t)Maxmem)) {
VJ>                /* Must bounce */
VJ>                int maxpages;
VJ>...

That means, that the system will allocate bounce pages if there is more
than 4GB of memory. In that case a buffer may be above the limit and
then it must be copied to/from the bounce buffer which is guaranteed to
be below 4GB.

harti
-- 
harti brandt,
http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
brandt@fokus.fraunhofer.de, harti@freebsd.org


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031031103750.T74490>