Subject: agp(4) products list ordering fix
To: NetBSD current <current-users@netbsd.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 09/06/2007 15:24:49
--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


Hi,

The agp_lookup() function expect to find agp products table sorted by
vendor domains. I had to split the recently added `NAGP_AMD64' block
to fullfill this rule.

With this change, the AMD8151 chipset on my Tyan S2885 workstation is
detected, and looks functional (the small test from the agp(4) man
page is successfull).

pchb8 at pci4 dev 0 function 0
pchb8: Advanced Micro Devices AMD8151 AGP Device (rev. 0x14)
agp0 at pchb8: 2 Miscellaneous Control unit(s) found.
agp0: aperture at 0xf0000000, size 0x8000000

Does this look ok ?

Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.

--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="netbsd-agplookup.diff"

Index: sys/dev/pci/agp.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/agp.c,v
retrieving revision 1.48
diff -u -r1.48 agp.c
--- sys/dev/pci/agp.c	15 Aug 2007 02:26:13 -0000	1.48
+++ sys/dev/pci/agp.c	6 Sep 2007 12:54:36 -0000
@@ -123,6 +123,11 @@
 	  NULL,			agp_ali_attach },
 #endif
 
+#if NAGP_AMD64 > 0
+	{ PCI_VENDOR_AMD,	PCI_PRODUCT_AMD_AGP8151_DEV,
+	  agp_amd64_match,	agp_amd64_attach },
+#endif
+
 #if NAGP_AMD > 0
 	{ PCI_VENDOR_AMD,	-1,
 	  agp_amd_match,	agp_amd_attach },
@@ -164,27 +169,26 @@
 	  NULL,			agp_intel_attach },
 #endif
 
-#if NAGP_SIS > 0
-	{ PCI_VENDOR_SIS,	-1,
-	  NULL,			agp_sis_attach },
-#endif
-
-#if NAGP_VIA > 0
-	{ PCI_VENDOR_VIATECH,	-1,
-	  NULL,			agp_via_attach },
+#if NAGP_AMD64 > 0
+	{ PCI_VENDOR_NVIDIA,	PCI_PRODUCT_NVIDIA_NFORCE3_PCHB,
+	  agp_amd64_match,	agp_amd64_attach },
+	{ PCI_VENDOR_NVIDIA,	PCI_PRODUCT_NVIDIA_NFORCE3_250_PCHB,
+	  agp_amd64_match,	agp_amd64_attach },
 #endif
 
 #if NAGP_AMD64 > 0
-	{ PCI_VENDOR_AMD,	PCI_PRODUCT_AMD_AGP8151_DEV,
-	  agp_amd64_match,	agp_amd64_attach },
 	{ PCI_VENDOR_SIS,	PCI_PRODUCT_SIS_755,
 	  agp_amd64_match,	agp_amd64_attach },
 	{ PCI_VENDOR_SIS,	PCI_PRODUCT_SIS_760,
 	  agp_amd64_match,	agp_amd64_attach },
-	{ PCI_VENDOR_NVIDIA,	PCI_PRODUCT_NVIDIA_NFORCE3_PCHB,
-	  agp_amd64_match,	agp_amd64_attach },
-	{ PCI_VENDOR_NVIDIA,	PCI_PRODUCT_NVIDIA_NFORCE3_250_PCHB,
-	  agp_amd64_match,	agp_amd64_attach },
+#endif
+
+#if NAGP_SIS > 0
+	{ PCI_VENDOR_SIS,	-1,
+	  NULL,			agp_sis_attach },
+#endif
+
+#if NAGP_AMD64 > 0
 	{ PCI_VENDOR_VIATECH,	PCI_PRODUCT_VIATECH_K8M800_0,
 	  agp_amd64_match,	agp_amd64_attach },
 	{ PCI_VENDOR_VIATECH,	PCI_PRODUCT_VIATECH_K8T890_0,
@@ -195,6 +199,11 @@
 	  agp_amd64_match,	agp_amd64_attach },
 #endif
 
+#if NAGP_VIA > 0
+	{ PCI_VENDOR_VIATECH,	-1,
+	  NULL,			agp_via_attach },
+#endif
+
 	{ 0,			0,
 	  NULL,			NULL },
 };

--DocE+STaALJfprDB--