Subject: agp : panic with ali chipsets (PR24697 ?)
To: None <port-i386@netbsd.org>
From: None <pandre@nerim.net>
List: port-i386
Date: 06/02/2004 17:39:38
--=-=-=


Hi,

I have a thinkpad R30 with an ali chipset (pchb0: Acer Labs product 0x1621). As in PR24697, i get a panic at boot time with the GENERIC kernels of NetBSD 1.6.1, 1.6.2 and 2.0_BETA.

Until now, I have used a custom kernel without agp support. But as I have some spare time, I tracked the diffs between 2.0_BETA's agp_ali.c and Linux 2.6.1's ali-agp.c.

I have now a GENERIC 2.0_BETA kernel working on my thinkpad :
pchb0 at pci0 dev 0 function 0
pchb0: Acer Labs product 0x1621 (rev. 0x01)
agp0 at pchb0: aperture at 0xf0000000, size 0x4000000
ppb0 at pci0 dev 1 function 0: Acer Labs product 0x5247 (rev. 0x01)

the test program embedded in agp(4) seems to works fine too :
 barentz# ./agp_test
 version:        0.0
 id:             162110b9
 mode:           1b000203
 base:           f0000000
 size:           64M
 total mem:      241152
 system mem:     241152
 used mem:       0
 
 alloc key 0, paddr 0
 used mem now:   64
 
 agp test successful

Here is the diff against agp_ali.c v 1.4 :

--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=agp_ali.c-diff
Content-Description: agp_ali.c diff

--- agp_ali.c	2004-06-02 16:30:59.000000000 +0200
+++ agp_ali_pandre.c	2004-06-02 16:33:37.000000000 +0200
@@ -123,7 +123,7 @@
 
 	/* Install the gatt. */
 	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, AGP_ALI_ATTBASE);
-	reg = (reg & 0xff) | gatt->ag_physical;
+	reg = (reg & 0xfff) | (gatt->ag_physical & 0xfffff000);
 	pci_conf_write(pa->pa_pc, pa->pa_tag, AGP_ALI_ATTBASE, reg);
 	
 	/* Enable the TLB. */
@@ -189,7 +189,7 @@
 	 * The aperture size is derived from the low bits of attbase.
 	 * I'm not sure this is correct..
 	 */
-	i = (int)pci_conf_read(sc->as_pc, sc->as_tag, AGP_ALI_ATTBASE) & 0xff;
+	i = (int)pci_conf_read(sc->as_pc, sc->as_tag, AGP_ALI_ATTBASE) & 0x0f;
 	if (i >= agp_ali_table_size)
 		return 0;
 	return agp_ali_table[i];
@@ -208,7 +208,7 @@
 		return EINVAL;
 
 	reg = pci_conf_read(sc->as_pc, sc->as_tag, AGP_ALI_ATTBASE);
-	reg &= ~0xff;
+	reg &= ~0x0f;
 	reg |= i;
 	pci_conf_write(sc->as_pc, sc->as_tag, AGP_ALI_ATTBASE, reg);
 	return 0;

--=-=-=


Any chance to see this patch or a patch solving PR24687 commited ? 

Thanks !

--=-=-=--