From owner-freebsd-amd64@FreeBSD.ORG Fri Dec 12 11:44:45 2003 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1191D16A4CE for ; Fri, 12 Dec 2003 11:44:45 -0800 (PST) Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 75FAB43D09 for ; Fri, 12 Dec 2003 11:44:43 -0800 (PST) (envelope-from jmg@hydrogen.funkthat.com) Received: (qmail 1017 invoked from network); 12 Dec 2003 19:44:42 -0000 Received: from dsl017-045-168.spk4.dsl.speakeasy.net (HELO hydrogen.funkthat.com) ([69.17.45.168]) (envelope-sender ) by mail6.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 12 Dec 2003 19:44:42 -0000 Received: from hydrogen.funkthat.com (klyvwf@localhost.funkthat.com [127.0.0.1])hBCJiggP065304; Fri, 12 Dec 2003 11:44:42 -0800 (PST) (envelope-from jmg@hydrogen.funkthat.com) Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.10/8.12.10/Submit) id hBCJiffV065303; Fri, 12 Dec 2003 11:44:41 -0800 (PST) Date: Fri, 12 Dec 2003 11:44:41 -0800 From: John-Mark Gurney To: James Van Artsdalen Message-ID: <20031212194441.GD54398@funkthat.com> Mail-Followup-To: James Van Artsdalen , freebsd-amd64@freebsd.org References: <200312120823.hBC8N6Ai074269@bigtex.jrv.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200312120823.hBC8N6Ai074269@bigtex.jrv.org> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html cc: freebsd-amd64@freebsd.org Subject: Re: bge usage of bus_dma_tag_create? X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2003 19:44:45 -0000 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."