Re: svgalib-1.9.10 (and patch)

Search this archive.

From: Mihai Moise (mmoise@giref.ulaval.ca)
Date: Tue 03 Jul 2001 - 21:44:21 IDT


also sprach Matan Ziv-Av:

> Should you not save and restore this word?
> It could be in the font memory, and _init is run before svgalib saves
> fonts.

No, so I have included a second patch. I haven't tested this new code at
home, but that would hardly help since that branch is not taken on my
friend's card.

Mihai

diff -urN svgalib-1.9.10/src/g400.c svgalib_mihai/src/g400.c
--- svgalib-1.9.10/src/g400.c	Tue Jul  3 08:25:01 2001
+++ svgalib_mihai/src/g400.c	Tue Jul  3 14:39:37 2001
@@ -790,8 +790,7 @@
 
 static int g400_init(int force, int par1, int par2)
 {
-    unsigned long buf[64];
-    int found=0;
+    unsigned int found=0, buf[64], sav;
     int pci_id;
     char *ids[]={"Mystique", "G100", "G200", "G400", "G450"};
 
@@ -803,7 +802,7 @@
 
     found=__svgalib_pci_find_vendor_vga_pos(VENDOR_ID,buf,0);
     
-    if(found==-1) {
+	if(!found) {
         printf("Error: Must use Matrox driver, but no card found\n");
         exit(1);
     }
@@ -828,12 +827,32 @@
 	default:
 		id = ID_G100;
     }
-
-    g400_linear_base = buf[4]&0xffffff00;
-    g400_mmio_base = buf[5]&0xffffff00;
-
+	printf("linear base: %x\n", g400_linear_base = buf[4]&0xffffff00);
+    	printf("mmio base: %x\n", g400_mmio_base = buf[5]&0xffffff00);
     __svgalib_vgammbase=mmap(0,0x1000,PROT_READ|PROT_WRITE,MAP_SHARED,__svgalib_mem_fd,g400_mmio_base+0x1000) + 0xc00;
+	if(id == ID_1064){
+		/* For some mystique boards, the primary aperture is
+		for memory mapped registers. We detect this by writing
+		and reading from the bus FIFO status register, which is
+		read only and the upper 21 bits read 0. 
+		-- Mihai */
+                sav = *((unsigned int *)(__svgalib_vgammbase + 0x210));
+		*((int *)(__svgalib_vgammbase + 0x210)) = 0x1234;
+		if(*((int *) (__svgalib_vgammbase + 0x210)) == 0x1234){
+			printf("Changing configuration\n");
+			munmap(__svgalib_vgammbase - 0xc00, 0x1000);
+			g400_linear_base = buf[4]&0xffffff00;
+			g400_mmio_base = buf[5]&0xffffff00;
+    			__svgalib_vgammbase=mmap(0,0x1000,
+					PROT_READ|PROT_WRITE,
+					MAP_SHARED,
+					__svgalib_mem_fd,
+					g400_mmio_base+0x1000) + 0xc00;
+		} else *((unsigned int *)(__svgalib_vgammbase + 0x210) 
+                        = sav;
+	}
     __svgalib_mm_io_mapio();
+
 
     __svgalib_inpal=inpal;
     __svgalib_outpal=outpal;    




------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST