xserver: Branch 'master' - 8 commits

Ian Romanick idr at kemper.freedesktop.org
Fri Jul 21 13:54:31 PDT 2006


 hw/xfree86/int10/Makefile.am              |   20 ++--
 hw/xfree86/int10/generic.c                |  108 +++-------------------
 hw/xfree86/int10/helper_exec.c            |    8 +
 hw/xfree86/int10/helper_mem.c             |  147 ++++++++++++++++++++++++------
 hw/xfree86/int10/xf86int10.h              |   15 ++-
 hw/xfree86/os-support/linux/int10/linux.c |  120 ++----------------------
 6 files changed, 181 insertions(+), 237 deletions(-)

New commits:
diff-tree 22db3fdb54d2f7f6b72638b46c186af6db04e214 (from parents)
Merge: 2f98841fde6bad807967ed15e954291240714198 93cd53860c3aca182a0a02543c41b5d71d65926b
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jul 21 13:55:37 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver

diff-tree 2f98841fde6bad807967ed15e954291240714198 (from c69c00d6523a35232a32e54a533811fc2b37815a)
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Thu Jul 20 16:08:27 2006 -0700

    Remove unused variable.

diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 48675a4..9f6d07e 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -76,7 +76,6 @@ xf86Int10InfoPtr
 xf86ExtendedInitInt10(int entityIndex, int Flags)
 {
     xf86Int10InfoPtr pInt = NULL;
-    CARD8 *bios_base;
     int screen;
     int fd;
     static void* vidMem = NULL;
diff-tree c69c00d6523a35232a32e54a533811fc2b37815a (from parents)
Merge: 46369350d40819ecc2a9f37ed4aaa95866b80997 84683f19b4d1c712281036bcabf8dc623e64b26a
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Thu Jul 20 12:08:38 2006 -0700

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver

diff-tree 46369350d40819ecc2a9f37ed4aaa95866b80997 (from 490fb304599b1f24b36439e5c1397781e7d2f612)
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jul 14 15:51:55 2006 -0700

    Add some const qualifiers to serveral function parameters.

diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 97ed757..4ffd74b 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -576,7 +576,7 @@ pciCfg1outb(CARD16 addr, CARD8 val)
 }
 
 CARD8
-bios_checksum(CARD8 *start, int size)
+bios_checksum(const CARD8 *start, int size)
 {
     CARD8 sum = 0;
 
diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c
index 0338a86..b845713 100644
--- a/hw/xfree86/int10/helper_mem.c
+++ b/hw/xfree86/int10/helper_mem.c
@@ -224,7 +224,7 @@ xf86HandleInt10Options(ScrnInfoPtr pScrn
 }
 
 Bool
-int10skip(void* options)
+int10skip(const void* options)
 {
     Bool noint10 = FALSE;
 
@@ -235,7 +235,7 @@ int10skip(void* options)
 }
 
 Bool
-int10_check_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem)
+int10_check_bios(int scrnIndex, int codeSeg, const unsigned char* vbiosMem)
 {
     int size;
 
@@ -262,7 +262,7 @@ int10_check_bios(int scrnIndex, int code
 }
 
 Bool
-initPrimary(void* options)
+initPrimary(const void* options)
 {
     Bool initPrimary = FALSE;
 
@@ -281,7 +281,7 @@ initPrimary(void* options)
  * be used with extreme care.
  */
 void
-xf86int10ParseBiosLocation(void* options, 
+xf86int10ParseBiosLocation(const void* options,
 			   xf86int10BiosLocationPtr bios)
 {
     const char *p;
diff --git a/hw/xfree86/int10/xf86int10.h b/hw/xfree86/int10/xf86int10.h
index 581a3bd..47f965d 100644
--- a/hw/xfree86/int10/xf86int10.h
+++ b/hw/xfree86/int10/xf86int10.h
@@ -143,7 +143,7 @@ void dump_code(xf86Int10InfoPtr pInt);
 void dump_registers(xf86Int10InfoPtr pInt);
 void stack_trace(xf86Int10InfoPtr pInt);
 xf86Int10InfoPtr getInt10Rec(int entityIndex);
-CARD8 bios_checksum(CARD8 *start, int size);
+CARD8 bios_checksum(const CARD8 *start, int size);
 void LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
 void UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga);
 #if defined (_PC)
@@ -182,10 +182,11 @@ int setup_system_bios(void *base_addr);
 void reset_int_vect(xf86Int10InfoPtr pInt);
 void set_return_trap(xf86Int10InfoPtr pInt);
 void * xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex);
-Bool int10skip(void* options);
-Bool int10_check_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem);
-Bool initPrimary(void* options);
-void xf86int10ParseBiosLocation(void* options, 
+Bool int10skip(const void* options);
+Bool int10_check_bios(int scrnIndex, int codeSeg,
+    const unsigned char* vbiosMem);
+Bool initPrimary(const void* options);
+void xf86int10ParseBiosLocation(const void* options, 
 				xf86int10BiosLocationPtr bios);
 BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt,
     const xf86int10BiosLocationPtr bios);
diff-tree 490fb304599b1f24b36439e5c1397781e7d2f612 (from d3ee49bcbafe4b4e6b308686020847e978473779)
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jul 14 15:26:56 2006 -0700

    Rearrange code in xf86int10ParseBiosLocation to use strncasecmp.  This
    eliminates the need for the first use of xstrdup in this function.
    The second use of xstrdup was *never* necessary and has also been
    eliminated.

diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c
index 624359f..0338a86 100644
--- a/hw/xfree86/int10/helper_mem.c
+++ b/hw/xfree86/int10/helper_mem.c
@@ -284,36 +284,30 @@ void
 xf86int10ParseBiosLocation(void* options, 
 			   xf86int10BiosLocationPtr bios)
 {
-    char *s;
-    char *p;
-    char *str = NULL;
-
-    if (options)
-	str = xf86GetOptValString(options,OPT_BIOS_LOCATION);
+    const char *p;
+    const char *str;
 
     bios->bus = BUS_NONE;
-    if (!str)
+
+    if ((options == NULL) 
+	|| ((str = xf86GetOptValString(options, OPT_BIOS_LOCATION)) == NULL)) {
 	return;
-    
-    s = xstrdup(str);
-    p = strtok(s,":");
-    if (xf86NameCmp(p,"pci") == 0) bios->bus = BUS_PCI;
-    else
-	if (xf86NameCmp(p,"primary") == 0) bios->bus = BUS_ISA;
+    }
 
-    xfree(s);
-    
-    if (bios->bus == BUS_NONE) return;
+    if (strncasecmp(str, "pci", 3) == 0) {
+	bios->bus = BUS_PCI;
+    } else if (strncasecmp(str, "primary", 7) == 0) {
+	bios->bus = BUS_ISA;
+    }
+    else {
+	return;
+    }
     
-    s = xstrdup(str);
-    p = strchr(s, ':');
+    p = strchr(str, ':');
 		     
     switch (bios->bus) {
     case BUS_ISA:
-	if (p)
-	    bios->location.legacy = atoi(++p);
-	else
-	    bios->location.legacy = 0;
+	bios->location.legacy = (p != NULL) ? atoi(++p) : 0;
 	break;
     case BUS_PCI:
 	if (p) {
@@ -332,7 +326,6 @@ xf86int10ParseBiosLocation(void* options
     default:
 	break;
     }
-    xfree(s);
 }
 
 
diff-tree d3ee49bcbafe4b4e6b308686020847e978473779 (from 8793c7fd4ba7d1b3e2eff3f2c18d042ee9bb3f62)
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jul 14 15:13:35 2006 -0700

    Refactor common code from the generic.c and linux.c version of
    xf86ExtendedInitInt10 to xf86int10GetBiosLocationType and
    xf86int10GetBiosSegment.
    
    These changes were tested on MGA hardware on x86-64 with various
    combinations of InitPrimary and BiosLocation.

diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index 03fc89c..1b4475f 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -136,59 +136,12 @@ xf86ExtendedInitInt10(int entityIndex, i
     
     if (xf86IsEntityPrimary(entityIndex) 
 	&& !(initPrimary(options))) {
-	
-	if (bios.bus == BUS_ISA && bios.location.legacy) {
-	    xf86DrvMsg(screen, X_CONFIG,
-			   "Overriding BIOS location: 0x%x\n",
-		       bios.location.legacy);
-	    cs = bios.location.legacy >> 4;
-#define CHECK_V_SEGMENT_RANGE(x)   \
-               if (((x) << 4) < V_BIOS) {\
-		   xf86DrvMsg(screen, X_ERROR, \
-		              "V_BIOS address 0x%lx out of range\n", \
-			      (unsigned long)(x) << 4); \
-		    goto error1; \
-	       }
-	    CHECK_V_SEGMENT_RANGE(cs);
-	    vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4);
-	    if (!int10_check_bios(screen, cs, vbiosMem)) {
-		xf86DrvMsg(screen, X_ERROR,
-			   "No V_BIOS at specified address 0x%lx\n",
-			   (unsigned long)cs << 4);
-		goto error1;
-	    }
-	} else {
-	    if (bios.bus == BUS_PCI) {
-		xf86DrvMsg(screen, X_WARNING,
-			   "Option BiosLocation for primary device ignored: "
-			   "It points to PCI.\n");
-		xf86DrvMsg(screen, X_WARNING,
-			   "You must set Option InitPrimary also\n");
-	    }
-	    
-	    cs = MEM_RW(pInt,((0x10<<2)+2));
-	    CHECK_V_SEGMENT_RANGE(cs);
-	    vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4);
-	    if (!int10_check_bios(screen, cs, vbiosMem)) {
-		cs = MEM_RW(pInt, (0x42 << 2) + 2);
-		CHECK_V_SEGMENT_RANGE(cs);
-		vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4);
-		if (!int10_check_bios(screen, cs, vbiosMem)) {
-		    cs = V_BIOS >> 4;
-		    vbiosMem = (unsigned char *)sysMem - V_BIOS + (cs << 4);
-		    if (!int10_check_bios(screen, cs, vbiosMem)) {
-			xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n");
-			goto error1;
-		    }
-		}
-	    }
+	if (! xf86int10GetBiosSegment(pInt, &bios, 
+				      (unsigned char *)sysMem - V_BIOS)) {
+	    goto error1;
 	}
-	
-	xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
-		   (unsigned long)cs);
 
 	set_return_trap(pInt);
-	pInt->BIOSseg = cs;
 
 	pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
 	if (! (pInt->Flags & SET_BIOS_SCRATCH))
@@ -196,54 +149,33 @@ xf86ExtendedInitInt10(int entityIndex, i
 	xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
 	
     } else {
-	BusType location_type;
+	const BusType location_type = xf86int10GetBiosLocationType(pInt,
+								   &bios);
 	int bios_location = V_BIOS;
-	int pci_entity;
-	
-        EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
+
         reset_int_vect(pInt);
 	set_return_trap(pInt);
 
-	if (bios.bus != BUS_NONE) {
-	    switch (location_type = bios.bus) {
-	    case BUS_PCI:
-		xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: "
-			   "PCI:%i:%i%i\n",bios.location.pci.bus,
-			   bios.location.pci.dev,bios.location.pci.func);
-		break;
-	    case BUS_ISA:
-		bios_location = bios.location.legacy;
-		if (bios.location.legacy)
-		    xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: "
-			       "Legacy:0x%x\n",bios.location.legacy);
-		else
-		    xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: "
-			       "Legacy\n");
-		break;
-	    default:
-		break;
-	    }
-	} else
-	    location_type = pEnt->location.type;
-	
-	xfree(pEnt);
-
 	switch (location_type) {
-	case BUS_PCI:
+	case BUS_PCI: {
+	    const int pci_entity = (bios.bus == BUS_PCI)
+	      ? xf86GetPciEntity(bios.location.pci.bus,
+				 bios.location.pci.dev,
+				 bios.location.pci.func)
+	      : pInt->entityIndex;
+
 	    vbiosMem = (unsigned char *)base + bios_location;
-	    if (bios.bus == BUS_PCI)
-		pci_entity = xf86GetPciEntity(bios.location.pci.bus,
-					      bios.location.pci.dev,
-					      bios.location.pci.func);
-	    else 
-		pci_entity = pInt->entityIndex;
 	    if (!(size = mapPciRom(pci_entity,(unsigned char *)(vbiosMem)))) {
 		xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n");
 		goto error1;
 	    }
 	    INTPriv(pInt)->highMemory = GET_HIGH_BASE(size);
 	    break;
+	}
 	case BUS_ISA:
+	    if (bios.bus == BUS_ISA) {
+		bios_location = bios.location.legacy;
+	    }
 	    vbiosMem = (unsigned char *)sysMem + bios_location;
 #if 0
 	    (void)memset(vbiosMem, 0, V_BIOS_SIZE);
diff --git a/hw/xfree86/int10/helper_mem.c b/hw/xfree86/int10/helper_mem.c
index 65ffe3d..624359f 100644
--- a/hw/xfree86/int10/helper_mem.c
+++ b/hw/xfree86/int10/helper_mem.c
@@ -336,4 +336,104 @@ xf86int10ParseBiosLocation(void* options
 }
 
 
+BusType
+xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt,
+			     const xf86int10BiosLocationPtr bios)
+{
+    BusType location_type = bios->bus;
 
+    switch (location_type) {
+    case BUS_PCI:
+	xf86DrvMsg(pInt->scrnIndex,X_CONFIG,"Overriding bios location: "
+		   "PCI:%i:%i%i\n",bios->location.pci.bus,
+		   bios->location.pci.dev,bios->location.pci.func);
+	break;
+    case BUS_ISA:
+	if (bios->location.legacy)
+	    xf86DrvMsg(pInt->scrnIndex,X_CONFIG,"Overriding bios location: "
+		       "Legacy:0x%x\n",bios->location.legacy);
+	else
+	    xf86DrvMsg(pInt->scrnIndex,X_CONFIG,"Overriding bios location: "
+		       "Legacy\n");
+	break;
+    case BUS_NONE: {
+	EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
+	location_type = pEnt->location.type;
+	xfree(pEnt);
+	break;
+    }
+    default:
+	break;
+    }
+
+    return location_type;
+}
+
+
+#define CHECK_V_SEGMENT_RANGE(x)   \
+    if (((x) << 4) < V_BIOS) { \
+	xf86DrvMsg(pInt->scrnIndex, X_ERROR, \
+		   "V_BIOS address 0x%lx out of range\n", \
+		   (unsigned long)(x) << 4); \
+	return FALSE; \
+    }
+
+Bool
+xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
+			const xf86int10BiosLocationPtr bios, void * base)
+{
+    unsigned i;
+    int cs = ~0;
+    int segments[4];
+    const char * format;
+
+
+    if (bios->bus == BUS_ISA && bios->location.legacy) {
+	xf86DrvMsg(pInt->scrnIndex, X_CONFIG, 
+		   "Overriding BIOS location: 0x%x\n",
+		   bios->location.legacy);
+
+	segments[0] = bios->location.legacy >> 4;
+	segments[1] = ~0;
+
+	format = "No V_BIOS at specified address 0x%lx\n";
+    } else {
+	if (bios->bus == BUS_PCI) {
+	    xf86DrvMsg(pInt->scrnIndex, X_WARNING,
+		       "Option BiosLocation for primary device ignored: "
+		       "It points to PCI.\n");
+	    xf86DrvMsg(pInt->scrnIndex, X_WARNING,
+		       "You must set Option InitPrimary also\n");
+	}
+
+	segments[0] = MEM_RW(pInt, (0x10 << 2) + 2);
+	segments[1] = MEM_RW(pInt, (0x42 << 2) + 2);
+	segments[2] = V_BIOS >> 4;
+	segments[3] = ~0;
+
+	format = "No V_BIOS found\n";
+    }
+
+    for (i = 0; segments[i] != ~0; i++) {
+	unsigned char * vbiosMem;
+
+	cs = segments[i];
+
+	CHECK_V_SEGMENT_RANGE(cs);
+	vbiosMem = (unsigned char *)base + (cs << 4);
+	if (int10_check_bios(pInt->scrnIndex, cs, vbiosMem)) {
+	    break;
+	}
+    }
+
+    if (segments[i] == ~0) {
+	xf86DrvMsg(pInt->scrnIndex, X_ERROR, format, (unsigned long)cs << 4);
+	return FALSE;
+    }
+
+    xf86DrvMsg(pInt->scrnIndex, X_INFO, "Primary V_BIOS segment is: 0x%lx\n",
+	       (unsigned long)cs);
+
+    pInt->BIOSseg = cs;
+    return TRUE;
+}
diff --git a/hw/xfree86/int10/xf86int10.h b/hw/xfree86/int10/xf86int10.h
index 9e137df..581a3bd 100644
--- a/hw/xfree86/int10/xf86int10.h
+++ b/hw/xfree86/int10/xf86int10.h
@@ -187,6 +187,10 @@ Bool int10_check_bios(int scrnIndex, int
 Bool initPrimary(void* options);
 void xf86int10ParseBiosLocation(void* options, 
 				xf86int10BiosLocationPtr bios);
+BusType xf86int10GetBiosLocationType(const xf86Int10InfoPtr pInt,
+    const xf86int10BiosLocationPtr bios);
+Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt,
+    const xf86int10BiosLocationPtr bios, void * base);
 #ifdef DEBUG
 void dprint(unsigned long start, unsigned long size);
 #endif
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index 64087a2..6190024 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -264,52 +264,15 @@ xf86ExtendedInitInt10(int entityIndex, i
 	ErrorF("done\n");
 #endif
     }
-    
+
     xf86int10ParseBiosLocation(options,&bios);
 
     if (xf86IsEntityPrimary(entityIndex) 
 	&& !(initPrimary(options))) {
-	if (bios.bus == BUS_ISA && bios.location.legacy) {
-	    xf86DrvMsg(screen, X_CONFIG,
-		       "Overriding BIOS location: 0x%x\n",
-		       bios.location.legacy);
-	    cs = bios.location.legacy >> 4;
-	    bios_base = (unsigned char *)(cs << 4);
-	    if (!int10_check_bios(screen, cs, bios_base)) {
-		xf86DrvMsg(screen, X_ERROR,
-			   "No V_BIOS at specified address 0x%lx\n",cs << 4);
-		goto error3;
-	    }
-	} else {
-	    if (bios.bus == BUS_PCI) {
-		xf86DrvMsg(screen, X_WARNING,
-			   "Option BiosLocation for primary device ignored: "
-			   "It points to PCI.\n");
-		xf86DrvMsg(screen, X_WARNING,
-			   "You must set Option InitPrimary also\n");
-	    }
-
-	    cs = ((CARD16*)0)[(0x10<<1) + 1];
-
-	    bios_base = (unsigned char *)(cs << 4);
-
-	    if (!int10_check_bios(screen, cs, bios_base)) {
-		cs = ((CARD16*)0)[(0x42 << 1) + 1];
-		bios_base = (unsigned char *)(cs << 4);
-		if (!int10_check_bios(screen, cs, bios_base)) {
-		    cs = V_BIOS >> 4;
-		    bios_base = (unsigned char *)(cs << 4);
-		    if (!int10_check_bios(screen, cs, bios_base)) {
-			xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n");
-			goto error3;
-		    }
-		}
-	    }
+	if (! xf86int10GetBiosSegment(pInt, &bios, NULL)) {
+	    goto error3;
 	}
 
-	xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%lx\n", cs);
-
-	pInt->BIOSseg = cs;
 	set_return_trap(pInt);
 #ifdef _PC	
 	pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
@@ -318,41 +281,17 @@ xf86ExtendedInitInt10(int entityIndex, i
   	xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
 #endif
     } else {
-        EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex);
-	BusType location_type;
-
-	if (bios.bus != BUS_NONE) {
-	    switch (location_type = bios.bus) {
-	    case BUS_PCI:
-		xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: "
-			   "PCI:%i:%i%i\n",bios.location.pci.bus,
-			   bios.location.pci.dev,bios.location.pci.func);
-		break;
-	    case BUS_ISA:
-		if (bios.location.legacy)
-		    xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: "
-			       "Legacy:0x%x\n",bios.location.legacy);
-		else
-		    xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: "
-			       "Legacy\n");
-		break;
-	    default:
-		break;
-	    }
-	} else
-	    location_type = pEnt->location.type;
+	const BusType location_type = xf86int10GetBiosLocationType(pInt,
+								   &bios);
 
 	switch (location_type) {
-	case BUS_PCI:
-	{
-	    int pci_entity;
+	case BUS_PCI: {
+	    const int pci_entity = (bios.bus == BUS_PCI)
+	      ? xf86GetPciEntity(bios.location.pci.bus,
+				 bios.location.pci.dev,
+				 bios.location.pci.func)
+	      : pInt->entityIndex;
 	    
-	    if (bios.bus == BUS_PCI)
-		pci_entity = xf86GetPciEntity(bios.location.pci.bus,
-					      bios.location.pci.dev,
-					      bios.location.pci.func);
-	    else 
-		pci_entity = pInt->entityIndex;
 	    if (!mapPciRom(pci_entity, (unsigned char *)(V_BIOS))) {
 	        xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n");
 		goto error3;
@@ -361,38 +300,14 @@ xf86ExtendedInitInt10(int entityIndex, i
 	    break;
 	}
 	case BUS_ISA:
-	    if (bios.bus == BUS_ISA && bios.location.legacy) {
-		cs = bios.location.legacy >> 4;
-		bios_base = (unsigned char *)(cs << 4);
-		if (!int10_check_bios(screen, cs, bios_base)) {
-		    xf86DrvMsg(screen,X_ERROR,"No V_BIOS found "
-			       "on override address %p\n",bios_base);
-		    goto error3;
-		}
-	    } else {
-		cs = ((CARD16*)0)[(0x10<<1)+1];
-		bios_base = (unsigned char *)(cs << 4);
-		
-		if (!int10_check_bios(screen, cs, bios_base)) {
-		    cs = ((CARD16*)0)[(0x42<<1)+1];
-		    bios_base = (unsigned char *)(cs << 4);
-		    if (!int10_check_bios(screen, cs, bios_base)) {
-			cs = V_BIOS >> 4;
-			bios_base = (unsigned char *)(cs << 4);
-			if (!int10_check_bios(screen, cs, bios_base)) {
-			    xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n");
-			    goto error3;
-			}
-		    }
-		}
+	    if (! xf86int10GetBiosSegment(pInt, &bios, NULL)) {
+		goto error3;
 	    }
-	    xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%lx\n",cs);
-	    pInt->BIOSseg = cs;
 	    break;
 	default:
 	    goto error3;
 	}
-	xfree(pEnt);
+
 	pInt->num = 0xe6;
 	reset_int_vect(pInt);
 	set_return_trap(pInt);
diff-tree 8793c7fd4ba7d1b3e2eff3f2c18d042ee9bb3f62 (from 1450fd596433f7adfe3d0798dc2ddceb9d0a9034)
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jul 14 09:11:39 2006 -0700

    Refactor identical xf86InitInt10 function from generic.c and linux.c
    to helper_exec.c.

diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
index 69596d4..03fc89c 100644
--- a/hw/xfree86/int10/generic.c
+++ b/hw/xfree86/int10/generic.c
@@ -63,12 +63,6 @@ static void UnmapVRam(xf86Int10InfoPtr p
 static void *sysMem = NULL;
 
 xf86Int10InfoPtr
-xf86InitInt10(int entityIndex)
-{
-    return xf86ExtendedInitInt10(entityIndex, 0);
-}
-
-xf86Int10InfoPtr
 xf86ExtendedInitInt10(int entityIndex, int Flags)
 {
     xf86Int10InfoPtr pInt;
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 1809e2d..97ed757 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -685,3 +685,9 @@ xf86Int10SaveRestoreBIOSVars(xf86Int10In
     xf86UnMapVidMem(pInt->scrnIndex,base - BIOS_SCRATCH_OFF ,pagesize);
 }
 #endif
+
+xf86Int10InfoPtr
+xf86InitInt10(int entityIndex)
+{
+    return xf86ExtendedInitInt10(entityIndex, 0);
+}
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
index a911378..64087a2 100644
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ b/hw/xfree86/os-support/linux/int10/linux.c
@@ -79,12 +79,6 @@ static Int10LinuxSubModuleState int10Lin
 #endif /* DoSubModules */
 
 xf86Int10InfoPtr
-xf86InitInt10(int entityIndex)
-{
-    return xf86ExtendedInitInt10(entityIndex, 0);
-}
-
-xf86Int10InfoPtr
 xf86ExtendedInitInt10(int entityIndex, int Flags)
 {
     xf86Int10InfoPtr pInt = NULL;
diff-tree 1450fd596433f7adfe3d0798dc2ddceb9d0a9034 (from 4c225a3a8b2e7e5e5510347d8473f1318bbac769)
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jul 14 09:10:32 2006 -0700

    Trivial refactor of libint10_la_SOURCES.

diff --git a/hw/xfree86/int10/Makefile.am b/hw/xfree86/int10/Makefile.am
index f606f5e..35abd42 100644
--- a/hw/xfree86/int10/Makefile.am
+++ b/hw/xfree86/int10/Makefile.am
@@ -6,15 +6,18 @@ EXTRA_CFLAGS = @SERVER_DEFINES@ @MODULE_
 
 libint10_la_LDFLAGS = -avoid-version
 
-if INT10_VM86
-AM_CFLAGS = -D_PC -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
-INCLUDES = $(XORG_INCS)
-libint10_la_SOURCES = \
+COMMON_SOURCES = \
 	helper_exec.c \
 	helper_mem.c \
 	pci.c \
 	xf86int10.c \
-	xf86int10module.c \
+	xf86int10module.c
+
+if INT10_VM86
+AM_CFLAGS = -D_PC -D_VM86_LINUX $(XORG_CFLAGS) $(EXTRA_CFLAGS)
+INCLUDES = $(XORG_INCS)
+libint10_la_SOURCES = \
+	$(COMMON_SOURCES) \
 	$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \
 	$(srcdir)/../os-support/linux/int10/linux.c
 endif
@@ -22,8 +25,11 @@ endif
 if INT10_X86EMU
 AM_CFLAGS = -D_X86EMU -DNO_SYS_HEADERS -D_PC $(XORG_CFLAGS) $(EXTRA_CFLAGS)
 INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
-libint10_la_SOURCES = pci.c xf86int10module.c helper_exec.c helper_mem.c \
-	xf86int10.c xf86x86emu.c generic.c x86emu.c
+libint10_la_SOURCES = \
+	$(COMMON_SOURCES) \
+	xf86x86emu.c \
+	generic.c \
+	x86emu.c
 endif
 
 if INT10_STUB



More information about the xorg-commit mailing list