Date: Fri, 12 Dec 2003 11:44:41 -0800 From: John-Mark Gurney <gurney_j@efn.org> To: James Van Artsdalen <james-freebsd-amd64@jrv.org> Cc: freebsd-amd64@freebsd.org Subject: Re: bge usage of bus_dma_tag_create? Message-ID: <20031212194441.GD54398@funkthat.com> In-Reply-To: <200312120823.hBC8N6Ai074269@bigtex.jrv.org> References: <200312120823.hBC8N6Ai074269@bigtex.jrv.org>
next in thread | previous in thread | raw e-mail | index | archive | help
James Van Artsdalen wrote this message on Fri, Dec 12, 2003 at 02:23 -0600: > I am confused by this code in sys/dev/bge/if_bge.c. > Are the values for the lowaddr and highaddr args to > bus_dma_tag_create () swapped? > > The ata and aha drivers seem to have lowaddr <= highaddr, > but on AMD64 that's not true below. > > static int > bge_dma_alloc(dev) > device_t dev; > { > struct bge_softc *sc; > int nseg, i, error; > struct bge_dmamap_arg ctx; > > sc = device_get_softc(dev); > > /* > * Allocate the parent bus DMA tag appropriate for PCI. > */ > #define BGE_NSEG_NEW 32 > error = bus_dma_tag_create(NULL, /* parent */ > PAGE_SIZE, 0, /* alignment, boundary */ > BUS_SPACE_MAXADDR, /* lowaddr */ > BUS_SPACE_MAXADDR_32BIT,/* highaddr */ This really needs to be decided by the card, and if the card supports 64bit addressing or not.. but yes, this does look like they need to be reversed. If the card can support 64bit addressing, then they should both be changed to BUS_SPACE_MAXADDR, but if the card only supports 32bit addressing then they should be swapped.. >From the bus_dma man page: lowaddr highaddr Bounds of the window of bus address space that cannot be directly accessed by the device. The window contains all address greater than lowaddr and less than or equal to highaddr. For example, a device incapable of DMA above 4GB, would specify a highaddr of BUS_SPACE_MAXADDR and a lowaddr of BUS_SPACE_MAXADDR_32BIT. Similarly a device that Though why this would work on x86 isn't good, maybe we need to add an assert in the bus_dma routines that lowaddr <= highaddr? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031212194441.GD54398>