<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">? sys/dev/pci/drm/drm_pciids.txt
Index: sys/dev/pci/agp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/agp.c,v
retrieving revision 1.59
diff -u -b -r1.59 agp.c
--- sys/dev/pci/agp.c	9 Jun 2008 06:49:54 -0000	1.59
+++ sys/dev/pci/agp.c	24 Jun 2008 16:46:54 -0000
@@ -276,7 +276,7 @@
 	return (1);
 }
 
-static const int agp_max[][2] = {
+static const unsigned int agp_max[][2] = {
 	{0,	0},
 	{32,	4},
 	{64,	28},
@@ -543,7 +543,7 @@
 	int error;
 	bus_dma_segment_t *segs, *seg;
 	bus_addr_t pa;
-	int contigpages, nseg;
+	int nseg;
 
 	mutex_enter(&amp;sc-&gt;as_mtx);
 
@@ -564,57 +564,40 @@
 	}
 
 	/*
-	 * XXXfvdl
 	 * The memory here needs to be directly accessable from the
 	 * AGP video card, so it should be allocated using bus_dma.
 	 * However, it need not be contiguous, since individual pages
 	 * are translated using the GATT.
-	 *
-	 * Using a large chunk of contiguous memory may get in the way
-	 * of other subsystems that may need one, so we try to be friendly
-	 * and ask for allocation in chunks of a minimum of 8 pages
-	 * of contiguous memory on average, falling back to 4, 2 and 1
-	 * if really needed. Larger chunks are preferred, since allocating
-	 * a bus_dma_segment per page would be overkill.
 	 */
 
-	for (contigpages = 8; contigpages &gt; 0; contigpages &gt;&gt;= 1) {
-		nseg = (mem-&gt;am_size / (contigpages * PAGE_SIZE)) + 1;
+		nseg = (mem-&gt;am_size + PAGE_SIZE - 1) / PAGE_SIZE;
 		segs = malloc(nseg * sizeof *segs, M_AGP, M_WAITOK);
-		if (segs == NULL) {
-			mutex_exit(&amp;sc-&gt;as_mtx);
-			return ENOMEM;
-		}
-		if (bus_dmamem_alloc(sc-&gt;as_dmat, mem-&gt;am_size, PAGE_SIZE, 0,
-				     segs, nseg, &amp;mem-&gt;am_nseg,
-				     contigpages &gt; 1 ?
-				     BUS_DMA_NOWAIT : BUS_DMA_WAITOK) != 0) {
+
+		if ((error = bus_dmamem_alloc(sc-&gt;as_dmat, mem-&gt;am_size, 
+		     PAGE_SIZE, 0, segs, nseg, &amp;mem-&gt;am_nseg, 
+		     BUS_DMA_WAITOK)) != 0) {
 			free(segs, M_AGP);
-			continue;
+			mutex_exit(&amp;sc-&gt;as_mtx);
+			return (error);
 		}
-		if (bus_dmamem_map(sc-&gt;as_dmat, segs, mem-&gt;am_nseg,
-		    mem-&gt;am_size, &amp;mem-&gt;am_virtual, BUS_DMA_WAITOK) != 0) {
+		if ((error = bus_dmamem_map(sc-&gt;as_dmat, segs, mem-&gt;am_nseg,
+		    mem-&gt;am_size, &amp;mem-&gt;am_virtual, BUS_DMA_WAITOK)) != 0) {
 			bus_dmamem_free(sc-&gt;as_dmat, segs, mem-&gt;am_nseg);
 			free(segs, M_AGP);
-			continue;
+			mutex_exit(&amp;sc-&gt;as_mtx);
+			return (error);
 		}
-		if (bus_dmamap_load(sc-&gt;as_dmat, mem-&gt;am_dmamap,
-		    mem-&gt;am_virtual, mem-&gt;am_size, NULL, BUS_DMA_WAITOK) != 0) {
+		if ((error = bus_dmamap_load(sc-&gt;as_dmat, mem-&gt;am_dmamap,
+		    mem-&gt;am_virtual, mem-&gt;am_size, NULL, BUS_DMA_WAITOK)) != 0) {
 			bus_dmamem_unmap(sc-&gt;as_dmat, mem-&gt;am_virtual,
 			    mem-&gt;am_size);
 			bus_dmamem_free(sc-&gt;as_dmat, segs, mem-&gt;am_nseg);
 			free(segs, M_AGP);
-			continue;
-		}
-		mem-&gt;am_dmaseg = segs;
-		break;
-	}
-
-	if (contigpages == 0) {
 		mutex_exit(&amp;sc-&gt;as_mtx);
-		return ENOMEM;
+			return (error);
 	}
 
+		mem-&gt;am_dmaseg = segs;
 
 	/*
 	 * Bind the individual pages and flush the chipset's
Index: sys/dev/pci/agp_i810.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/agp_i810.c,v
retrieving revision 1.54
diff -u -b -r1.54 agp_i810.c
--- sys/dev/pci/agp_i810.c	9 Jun 2008 06:49:54 -0000	1.54
+++ sys/dev/pci/agp_i810.c	24 Jun 2008 16:46:55 -0000
@@ -571,7 +571,7 @@
 {
 	struct agp_i810_softc *isc = sc-&gt;as_chipc;
 	pcireg_t reg;
-	u_int16_t miscc, gcc1, msac;
+	u_int16_t miscc, gcc1;
 
 	switch (isc-&gt;chiptype) {
 	case CHIP_I810:
@@ -593,14 +593,8 @@
 		return 128 * 1024 * 1024;
 	case CHIP_I915:
 	case CHIP_G33:
-		reg = pci_conf_read(sc-&gt;as_pc, sc-&gt;as_tag, AGP_I915_MSAC);
-		msac = (u_int16_t)(reg &gt;&gt; 16);
-		if (msac &amp; AGP_I915_MSAC_APER_128M)
-			return 128 * 1024 * 1024;
-		else
-			return 256 * 1024 * 1024;
 	case CHIP_I965:
-		return 512 * 1024 * 1024;
+		return sc-&gt;as_apsize;
 	default:
 		aprint_error(": Unknown chipset\n");
 	}
</pre></body></html>