PERFORCE change 56526 for review
Peter Wemm
peter at FreeBSD.org
Mon Jul 5 10:53:26 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=56526
Change 56526 by peter at 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 <sys/mutex.h>
#include <sys/mbuf.h>
#include <sys/uio.h>
+#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
@@ -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) ====
More information about the p4-projects
mailing list