xserver/hw/kdrive/vesa vbe.c, 1.15, 1.16 vbe.h, 1.10, 1.11 vesa.c, 1.32, 1.33 vm86.c, 1.9, 1.10 vm86.h, 1.4, 1.5

Keith Packard <xserver-commit-u7BhqnqprCWvj1b/[email protected]>
Newsgroups gmane.comp.freedesktop.xserver.cvs
Message-ID <[email protected]>
Committed by: keithp

Update of /cvs/xserver/xserver/hw/kdrive/vesa
In directory pdx:/tmp/cvs-serv2204/hw/kdrive/vesa

Modified Files:
	vbe.c vbe.h vesa.c vm86.c vm86.h 
Log Message:
2004-07-26  Keith Packard  <[email protected]>

	* hw/kdrive/fbdev/fbdev.c: (fbdevModeSupported),
	(fbdevScreenInitialize):
	Eliminate bogus rate check in fbdevModeSupported.
	Hmm.  Potentially bogus rate selection necessary for Mac fbdev

	* hw/kdrive/src/kaa.c: (kaaPixmapSave):
	Don't know about fb changes to pixmaps, so can't track dirt.

	* hw/kdrive/src/kmode.c: (KdFindMode):
	Add Mac specific 1280x854 mode.
	Warn when requested mode isn't found.
	
	* hw/kdrive/vesa/vbe.c: (VbeBoot), (VbeDoInterruptE6):
	* hw/kdrive/vesa/vbe.h:
	* hw/kdrive/vesa/vesa.c: (vesaInitialize), (vesaUseMsg),
	(vesaProcessArgument):
	* hw/kdrive/vesa/vm86.c: (Vm86DoInterrupt), (Vm86DoPOST):
	* hw/kdrive/vesa/vm86.h:
	Add ability to soft-boot video cards.

	* xfixes/region.c: (ProcXFixesExpandRegion),
	(SProcXFixesExpandRegion):
	* xfixes/xfixes.c: (XFixesNumberRequests):
	* xfixes/xfixesint.h:
	Add region expand request.  FIXME: need test cases


Index: vbe.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vbe.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- vbe.c	15 Oct 2003 01:00:38 -0000	1.15
+++ vbe.c	26 Jul 2004 17:14:26 -0000	1.16
@@ -638,6 +638,20 @@
     return TRUE;
 }
 
+Bool
+VbeBoot(Vm86InfoPtr vi)
+{
+    int	code;
+    int bus = 1;
+    int device = 0;
+    int function = 0;
+
+    vi->vms.regs.eax = (bus << 8) | (device << 3) | (function & 0x7);
+    code = VbeDoInterruptE6 (vi);
+    ErrorF ("Boot: %d\n", code);
+    return TRUE;
+}
+
 int
 VbeDoInterrupt10(Vm86InfoPtr vi)
 {
@@ -677,3 +691,17 @@
     }
     return code;
 }
+
+int
+VbeDoInterruptE6(Vm86InfoPtr vi)
+{
+    int code;
+    int oldax;
+
+    oldax = vi->vms.regs.eax & 0xffff;
+    
+    code = Vm86DoPOST (vi);
+    ErrorF("POST (0x%04X): 0x%04X\n",
+	   oldax, vi->vms.regs.eax & 0xffff);
+    return code;
+}

Index: vbe.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vbe.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- vbe.h	15 Oct 2003 01:00:38 -0000	1.10
+++ vbe.h	26 Jul 2004 17:14:27 -0000	1.11
@@ -157,4 +157,10 @@
 int
 VbeDoInterrupt10(Vm86InfoPtr vi);
 
+Bool
+VbeBoot(Vm86InfoPtr vi);
+
+int
+VbeDoInterruptE6(Vm86InfoPtr vi);
+
 #endif

Index: vesa.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vesa.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- vesa.c	20 May 2004 02:42:20 -0000	1.32
+++ vesa.c	26 Jul 2004 17:14:27 -0000	1.33
@@ -41,6 +41,7 @@
 Bool vesa_force_text = FALSE;
 Bool vesa_restore_font = TRUE;
 Bool vesa_map_holes = TRUE;
+Bool vesa_boot = FALSE;
 
 #define VesaPriv(scr)	((VesaScreenPrivPtr) (scr)->driver)
 
@@ -216,6 +217,9 @@
     if(!priv->vi)
 	goto fail;
 
+    if (vesa_boot)
+	VbeBoot (priv->vi);
+
     priv->modes = vesaGetModes (priv->vi, &priv->nmode);
 	
     if (!priv->modes)
@@ -1756,6 +1760,7 @@
     ErrorF("-map-holes    Use contiguous memory map (For seg fault with rare BIOS)\n");
     ErrorF("-verbose      Emit diagnostic messages during BIOS initialization\n");
     ErrorF("-force-text   Always use standard 25x80 text mode on server exit or VT switch\n");
+    ErrorF("-boot         Soft boot video card\n");
     /* XXX: usage for -vesatest, -no-map-holes (don't need?),
      * XXX: and -trash-font. Also in man page. */
 }
@@ -1802,6 +1807,9 @@
     } else if(!strcmp(argv[i], "-trash-font")) {
 	vesa_restore_font = FALSE;
 	return 1;
+    } else if(!strcmp(argv[i], "-boot")) {
+	vesa_boot = TRUE;
+	return 1;
     }
     
     return 0;

Index: vm86.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vm86.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- vm86.c	15 Jan 2004 09:15:53 -0000	1.9
+++ vm86.c	26 Jul 2004 17:14:27 -0000	1.10
@@ -219,7 +219,8 @@
     off = MMW(vi,num * 4);
     if(MAKE_POINTER(seg, off) < ROM_BASE ||
        MAKE_POINTER(seg, off) >= ROM_BASE + ROM_SIZE) {
-	ErrorF("Interrupt pointer doesn't point at ROM\n");
+	ErrorF("Interrupt pointer (seg %x off %x) doesn't point at ROM\n",
+	       seg, off);
 	return -1;
     }
     memcpy(&(LM(vi,vi->ret_code)), retcode_data, sizeof(retcode_data));
@@ -244,6 +245,40 @@
 	return 0;
 }
 
+int
+Vm86DoPOST(Vm86InfoPtr vi)
+{
+    U16 seg, off;
+    int code;
+
+    seg = 0xC000;
+    off = 3;
+    if(MAKE_POINTER(seg, off) < ROM_BASE ||
+       MAKE_POINTER(seg, off) >= ROM_BASE + ROM_SIZE) {
+	ErrorF("BIOS pointer (seg %x off %x) doesn't point at ROM\n",
+	       seg, off);
+	return -1;
+    }
+    memcpy(&(LM(vi,vi->ret_code)), retcode_data, sizeof(retcode_data));
+    vi->vms.regs.ss = POINTER_SEGMENT(vi->stack_base);
+    vi->vms.regs.esp = STACK_SIZE;
+    PUSHW(vi, POINTER_SEGMENT(vi->ret_code));
+    PUSHW(vi, POINTER_OFFSET(vi->ret_code));
+    vi->vms.regs.cs = seg;
+    vi->vms.regs.eip = off;
+    OsBlockSignals ();
+    code = vm86_loop(vi);
+    OsReleaseSignals ();
+    if(code < 0) {
+	ErrorF("vm86 failed (errno %d)\n", errno);
+	return -1;
+    } else if(code != 0) {
+	ErrorF("vm86 returned 0x%04X\n", code);
+	return -1;
+    } else
+	return 0;
+}
+
 #define DEBUG_VBE 0
 #if DEBUG_VBE
 #define DBG(x) ErrorF x; usleep(10*1000)

Index: vm86.h
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/vesa/vm86.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- vm86.h	9 Oct 2003 06:36:26 -0000	1.4
+++ vm86.h	26 Jul 2004 17:14:27 -0000	1.5
@@ -137,6 +137,9 @@
 Vm86DoInterrupt(Vm86InfoPtr vi, int num);
 
 int
+Vm86DoPOST(Vm86InfoPtr vi);
+
+int
 Vm86IsMemory(Vm86InfoPtr vi, U32 i);
 
 U8
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.