From owner-p4-projects@FreeBSD.ORG Mon Jul 5 17:53:25 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9348716A4D0; Mon, 5 Jul 2004 17:53:25 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CA4E16A4CE for ; Mon, 5 Jul 2004 17:53:25 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66E7B43D31 for ; Mon, 5 Jul 2004 17:53:25 +0000 (GMT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i65HrPlG096754 for ; Mon, 5 Jul 2004 17:53:25 GMT (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i65HrOhg096751 for perforce@freebsd.org; Mon, 5 Jul 2004 17:53:24 GMT (envelope-from peter@freebsd.org) Date: Mon, 5 Jul 2004 17:53:24 GMT Message-Id: <200407051753.i65HrOhg096751@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 56526 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2004 17:53:26 -0000 http://perforce.freebsd.org/chv.cgi?CH=56526 Change 56526 by peter@peter_overcee on 2004/07/05 17:52:43 Integ -I -b i386_hammer Affected files ... .. //depot/projects/hammer/sys/amd64/acpica/acpi_machdep.c#15 integrate .. //depot/projects/hammer/sys/amd64/amd64/amd64_mem.c#8 integrate .. //depot/projects/hammer/sys/amd64/amd64/busdma_machdep.c#12 integrate .. //depot/projects/hammer/sys/amd64/amd64/intr_machdep.c#22 integrate .. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#64 integrate .. //depot/projects/hammer/sys/amd64/amd64/mptable.c#29 integrate .. //depot/projects/hammer/sys/amd64/amd64/nexus.c#26 integrate .. //depot/projects/hammer/sys/amd64/conf/NOTES#35 integrate .. //depot/projects/hammer/sys/amd64/include/param.h#20 integrate .. //depot/projects/hammer/sys/amd64/isa/isa.c#11 integrate .. //depot/projects/hammer/sys/amd64/pci/pci_cfgreg.c#14 integrate Differences ... ==== //depot/projects/hammer/sys/amd64/acpica/acpi_machdep.c#15 (text+ko) ==== ==== //depot/projects/hammer/sys/amd64/amd64/amd64_mem.c#8 (text+ko) ==== ==== //depot/projects/hammer/sys/amd64/amd64/busdma_machdep.c#12 (text+ko) ==== @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -84,8 +85,24 @@ static int reserved_bpages; static int active_bpages; static int total_bpages; +static int total_bounced; +static int total_deferred; static bus_addr_t bounce_lowaddr = BUS_SPACE_MAXADDR; +SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); +SYSCTL_INT(_hw_busdma, OID_AUTO, free_bpages, CTLFLAG_RD, &free_bpages, 0, + "Free bounce pages"); +SYSCTL_INT(_hw_busdma, OID_AUTO, reserved_bpages, CTLFLAG_RD, &reserved_bpages, + 0, "Reserved bounce pages"); +SYSCTL_INT(_hw_busdma, OID_AUTO, active_bpages, CTLFLAG_RD, &active_bpages, 0, + "Active bounce pages"); +SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, + "Total bounce pages"); +SYSCTL_INT(_hw_busdma, OID_AUTO, total_bounced, CTLFLAG_RD, &total_bounced, 0, + "Total bounce requests"); +SYSCTL_INT(_hw_busdma, OID_AUTO, total_deferred, CTLFLAG_RD, &total_deferred, 0, + "Total bounce requests that were deferred"); + struct bus_dmamap { struct bp_list bpages; int pagesneeded; @@ -109,7 +126,8 @@ static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr, bus_size_t size); static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr); +static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, + bus_size_t len); /* * Return true if a match is made. @@ -120,14 +138,18 @@ * to check for a match, if there is no filter callback then assume a match. */ static __inline int -run_filter(bus_dma_tag_t dmat, bus_addr_t paddr) +run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t len) { + bus_size_t bndy; int retval; retval = 0; + bndy = dmat->boundary; + do { - if (paddr > dmat->lowaddr - && paddr <= dmat->highaddr + if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) + || ((paddr & (dmat->alignment - 1)) != 0) + || ((paddr & bndy) != ((paddr + len) & bndy))) && (dmat->filter == NULL || (*dmat->filter)(dmat->filterarg, paddr) != 0)) retval = 1; @@ -188,6 +210,10 @@ bus_dma_tag_t newtag; int error = 0; + /* Basic sanity checking */ + if (boundary != 0 && boundary < maxsegsz) + maxsegsz = boundary; + /* Return a NULL tag on failure */ *dmat = NULL; @@ -322,7 +348,13 @@ return (ENOMEM); } - if (dmat->lowaddr < ptoa((vm_paddr_t)Maxmem)) { + /* + * Bouncing might be required if the driver asks for an active + * exclusion region, a data alignment that is stricter than 1, and/or + * an active address boundary. + */ + if (dmat->lowaddr < ptoa((vm_paddr_t)Maxmem) + || dmat->alignment > 1 || dmat->boundary > 0) { /* Must bounce */ int maxpages; @@ -340,8 +372,7 @@ */ maxpages = MIN(MAX_BPAGES, Maxmem - atop(dmat->lowaddr)); if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (dmat->map_count > 0 - && total_bpages < maxpages)) { + || (dmat->map_count > 0 && total_bpages < maxpages)) { int pages; if (dmat->lowaddr > bounce_lowaddr) { @@ -426,6 +457,7 @@ * XXX Use Contigmalloc until it is merged into this facility * and handles multi-seg allocations. Nobody is doing * multi-seg allocations yet though. + * XXX Certain AGP hardware does. */ *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, @@ -492,8 +524,9 @@ else pmap = NULL; - if (dmat->lowaddr < ptoa((vm_paddr_t)Maxmem) && - map->pagesneeded == 0) { + if ((dmat->lowaddr < ptoa((vm_paddr_t)Maxmem) + || dmat->boundary > 0 || dmat->alignment > 1) + && map->pagesneeded == 0) { vm_offset_t vendaddr; /* @@ -505,7 +538,7 @@ while (vaddr < vendaddr) { paddr = pmap_kextract(vaddr); - if (run_filter(dmat, paddr) != 0) { + if (run_filter(dmat, paddr, 0) != 0) { needbounce = 1; map->pagesneeded++; } @@ -566,7 +599,7 @@ sgsize = (baddr - curaddr); } - if (map->pagesneeded != 0 && run_filter(dmat, curaddr)) + if (map->pagesneeded != 0 && run_filter(dmat, curaddr, sgsize)) curaddr = add_bounce_page(dmat, map, vaddr, sgsize); /* @@ -763,6 +796,8 @@ * want to add support for invalidating * the caches on broken hardware */ + total_bounced++; + if (op & BUS_DMASYNC_PREWRITE) { while (bpage != NULL) { bcopy((void *)bpage->datavaddr, @@ -901,6 +936,7 @@ STAILQ_INSERT_TAIL(&bounce_map_callbacklist, map, links); busdma_swi_pending = 1; + total_deferred++; swi_sched(vm_ih, 0); } } ==== //depot/projects/hammer/sys/amd64/amd64/intr_machdep.c#22 (text+ko) ==== ==== //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#64 (text+ko) ==== ==== //depot/projects/hammer/sys/amd64/amd64/mptable.c#29 (text+ko) ==== @@ -958,7 +958,8 @@ 'A' + pin); return (PCI_INVALID_IRQ); } - device_printf(pcib, "slot %d INT%c routed to irq %d\n", slot, 'A' + pin, - args.vector); + if (bootverbose) + device_printf(pcib, "slot %d INT%c routed to irq %d\n", slot, + 'A' + pin, args.vector); return (args.vector); } ==== //depot/projects/hammer/sys/amd64/amd64/nexus.c#26 (text+ko) ==== @@ -342,7 +342,7 @@ rman_set_bustag(rv, AMD64_BUS_SPACE_MEM); } else if (type == SYS_RES_IOPORT) { rman_set_bustag(rv, AMD64_BUS_SPACE_IO); - rman_set_bushandle(rv, rv->r_start); + rman_set_bushandle(rv, rman_get_start(rv)); } if (needactivate) { @@ -359,6 +359,7 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + /* * If this is a memory resource, map it into the kernel. */ @@ -434,7 +435,7 @@ panic("nexus_setup_intr: NULL irq resource!"); *cookiep = 0; - if ((irq->r_flags & RF_SHAREABLE) == 0) + if ((rman_get_flags(irq) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; /* @@ -444,8 +445,8 @@ if (error) return (error); - error = intr_add_handler(device_get_nameunit(child), irq->r_start, - ihand, arg, flags, cookiep); + error = intr_add_handler(device_get_nameunit(child), + rman_get_start(irq), ihand, arg, flags, cookiep); return (error); } ==== //depot/projects/hammer/sys/amd64/conf/NOTES#35 (text+ko) ==== @@ -4,7 +4,7 @@ # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # -# (XXX from i386:NOTES,v 1.1162) +# (XXX from i386:NOTES,v 1.1164) # $FreeBSD: src/sys/amd64/conf/NOTES,v 1.14 2004/05/17 22:13:14 peter Exp $ # ==== //depot/projects/hammer/sys/amd64/include/param.h#20 (text+ko) ==== ==== //depot/projects/hammer/sys/amd64/isa/isa.c#11 (text+ko) ==== ==== //depot/projects/hammer/sys/amd64/pci/pci_cfgreg.c#14 (text+ko) ====