changeset 23260:427075ffb413

allow sis vidix driver to access registers and avoid segfaulting (patch by Andrew Calkin)
author ben
date Wed, 09 May 2007 17:16:59 +0000
parents 07ff903a59f5
children 1bd2f5e63da5
files vidix/sis_vid.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/sis_vid.c	Tue May 08 21:23:07 2007 +0000
+++ b/vidix/sis_vid.c	Wed May 09 17:16:59 2007 +0000
@@ -291,6 +291,7 @@
 		case DEVICE_SIS_650_VGA:
 		    /* M650 & 651 have 2 overlays */
 		    /* JCP: I think this works, but not really tested yet */
+		    if (enable_app_io() == 0 )
 		    {
 			unsigned char CR5F;
 			unsigned char tempreg1, tempreg2;
@@ -315,6 +316,7 @@
 				printf
 				    ("[SiS] detected M650/651 with 2 overlays\n");
 			}
+			disable_app_io();
 		    }
 		    sis_vga_engine = SIS_315_VGA;
 		    break;
@@ -345,6 +347,12 @@
 	return (EINTR);
     }
 
+    if (enable_app_io() != 0)
+    {
+      printf("[SiS] can't enable register I/O\n");
+      return(EINTR);
+    }
+
     /* JCP: this is WRONG.  Need to coordinate w/ sisfb to use correct mem */
     /* map 16MB scary hack for now. */
     sis_mem_base = map_phys_mem(pci_info.base0, 0x1000000);
@@ -395,6 +403,7 @@
     /* unmap_phys_mem(sis_reg_base, 0x20000); */
     /* JCP: see above, hence also a hack. */
     unmap_phys_mem(sis_mem_base, 0x1000000);
+    disable_app_io();
 }
 
 static int sis_get_caps(vidix_capability_t * to)