Author: wmb
Date: 2009-02-20 10:14:16 +0100 (Fri, 20 Feb 2009)
New Revision: 1107
Modified:
cpu/x86/pc/biosints.fth
cpu/x86/pc/olpc/dsdt.dsl
dev/geode/display/gxvga.fth
Log:
OLPC - Fixed the VESA BIOS emulation for Windows, supporting
mode 112 (640x480x32), 115 (800x600x32), and 118 (1024x768x32)
Modified: cpu/x86/pc/biosints.fth
===================================================================
--- cpu/x86/pc/biosints.fth 2009-02-20 08:23:30 UTC (rev 1106)
+++ cpu/x86/pc/biosints.fth 2009-02-20 09:14:16 UTC (rev 1107)
@@ -200,18 +200,52 @@
create mode12-info \ w b b w w w w d w w w b b b b b b b b b
h# db w, \ Linear, (VGA), Graphics, Color, no TTY Output, D1=1, hardware-supported
+create mode-112-info
+\ h# bf w, \ Linear, VGA, Graphics, Color, TTY Output, D1=1, hardware-supported
+\ 7 c, 0 c, d# 64 w, d# 64 w, h# a000 w, 0 w, 0 l, \ Not windowed
+ h# fb w, \ Linear, noVGA, Graphics, Color, noTTY Output, D1=1, hardware-supported
+ 0 c, 0 c, d# 0 w, d# 0 w, 0 w, 0 w, 0 l, \ Not windowed
+ d# 640 /l* w, \ BytesPerScanLine
+ d# 640 w, d# 480 w, \ X, Y res
+ d# 8 c, d# 16 c, \ Char width, height
+ 1 c, \ NumPlanes
+ d# 32 c, \ Bits/pixel
+ 1 c, \ NumBanks
+ 6 c, \ MemModel - DirectColor
+ 0 c, \ Bank size (not banked)
+ 2 c, \ NumImagePages
+ 1 c, \ Reserved
+
+ \ Banked Color info
+ 8 c, d# 16 c, 8 c, 8 c, 8 c, 0 c, 0 c, 0 c, \ {RGBX}{Bits,Pos}
+ 0 c, \ Gamma fixed (change if we implement function 9)
+
+ fb-pci-base l, 0 l, 0 w, \ Framebuffer address
+
+ \ Linear info
+ d# 640 /l* w, \ Bytes per scan line
+ 0 c, \ No banks
+
+\ fbsize d# 640 / d# 480 / 4 / c, ( need to account for cmd buffer )
+ d# 11 c, \ Number of images that will fit in framebuffer
+
+ 8 c, d# 16 c, 8 c, 8 c, 8 c, 0 c, 0 c, 0 c, \ {RGBX}{Bits,Pos}
+
+ d# 56,200,000 l, \ Max pixel clock
+here mode-112-info - constant /mode-112-info
+
create mode-115-info
- h# fb w, \ Linear, NotVGA, Graphics, Color, no TTY Output, D1=1, hardware-supported
- 0 c, 0 c, 0 w, d# 64 w, 0 w, 0 w, 0 l, \ Not windowed
- 0 w, \ BytesPerScanLine irrelevant in linear mode
+ h# fb w, \ Linear, VGA, Graphics, Color, TTY Output, D1=1, hardware-supported
+ 0 c, 0 c, d# 0 w, d# 0 w, h# 0 w, 0 w, 0 l, \ Not windowed
+ d# 800 /l* w, \ BytesPerScanLine
d# 800 w, d# 600 w, \ X, Y res
- d# 15 c, d# 18 w, \ Char width, height (sort of irrelevant)
- 1 c, \ NumPlanes (irrelevant for linear?)
- d# 24 c, \ Bits/pixel
+ d# 8 c, d# 16 c, \ Char width, height
+ 1 c, \ NumPlanes
+ d# 32 c, \ Bits/pixel
1 c, \ NumBanks
- 6 c, \ MemModel - DirectColor (?)
+ 6 c, \ MemModel - DirectColor
0 c, \ Bank size (not banked)
- 0 c, \ NumImagePages
+ 2 c, \ NumImagePages
1 c, \ Reserved
\ Banked Color info
@@ -221,11 +255,11 @@
fb-pci-base l, 0 l, 0 w, \ Framebuffer address
\ Linear info
- d# 4096 /w* w, \ Bytes per scan line
+ d# 800 /l* w, \ Bytes per scan line
0 c, \ No banks
-\ fbsize d# 1200 / d# 900 / 2/ c,
- 3 c, \ Number of images that will fit in framebuffer
+\ fbsize d# 800 / d# 600 / 4/ c,
+ 7 c, \ Number of images that will fit in framebuffer
8 c, d# 16 c, 8 c, 8 c, 8 c, 0 c, 0 c, 0 c, \ {RGBX}{Bits,Pos}
@@ -233,17 +267,18 @@
here mode-115-info - constant /mode-115-info
create mode-118-info
- h# fb w, \ Linear, NotVGA, Graphics, Color, no TTY Output, D1=1, hardware-supported
- 0 c, 0 c, 0 w, d# 64 w, 0 w, 0 w, 0 l, \ Not windowed
- 0 w, \ BytesPerScanLine irrelevant in linear mode
+ h# fb w, \ Linear, VGA, Graphics, Color, TTY Output, D1=1, hardware-supported
+ 0 c, 0 c, d# 0 w, d# 0 w, h# 0 w, 0 w, 0 l, \ Not windowed
+ d# 1024 /l* w, \ BytesPerScanLine
d# 1024 w, d# 768 w, \ X, Y res
- d# 15 c, d# 18 w, \ Char width, height (sort of irrelevant)
- 1 c, \ NumPlanes (irrelevant for linear?)
- d# 24 c, \ Bits/pixel
+\ d# 12 c, d# 15 c, \ Char width, height
+ d# 8 c, d# 16 c, \ Char width, height (sort of irrelevant)
+ 1 c, \ NumPlanes
+ d# 32 c, \ Bits/pixel
1 c, \ NumBanks
- 6 c, \ MemModel - DirectColor (?)
+ 6 c, \ MemModel - DirectColor
0 c, \ Bank size (not banked)
- 0 c, \ NumImagePages
+ 2 c, \ NumImagePages
1 c, \ Reserved
\ Banked Color info
@@ -253,11 +288,11 @@
fb-pci-base l, 0 l, 0 w, \ Framebuffer address
\ Linear info
- d# 4096 /w* w, \ Bytes per scan line
+ d# 1024 /l* w, \ Bytes per scan line
0 c, \ No banks
-\ fbsize d# 1200 / d# 900 / 2/ c,
- 3 c, \ Number of images that will fit in framebuffer
+\ fbsize d# 1024 / d# 768 / 4 / c,
+ 4 c, \ Number of images that will fit in framebuffer
8 c, d# 16 c, 8 c, 8 c, 8 c, 0 c, 0 c, 0 c, \ {RGBX}{Bits,Pos}
@@ -266,11 +301,11 @@
create mode-120-info
h# fb w, \ Linear, NotVGA, Graphics, Color, no TTY Output, D1=1, hardware-supported
- 0 c, 0 c, 0 w, d# 64 w, 0 w, 0 w, 0 l, \ Not windowed
- 0 w, \ BytesPerScanLine irrelevant in linear mode
+ 0 c, 0 c, d# 0 w, d# 0 w, h# 0 w, 0 w, 0 l, \ Not windowed
+ d# 1200 /w* w, \ BytesPerScanLine
d# 1200 w, d# 900 w, \ X, Y res
- d# 15 c, d# 18 w, \ Char width, height (sort of irrelevant)
- 1 c, \ NumPlanes (irrelevant for linear?)
+ d# 15 c, d# 18 c, \ Char width, height (sort of irrelevant)
+ 1 c, \ NumPlanes
d# 16 c, \ Bits/pixel
1 c, \ NumBanks
6 c, \ MemModel - DirectColor (?)
@@ -289,7 +324,7 @@
0 c, \ No banks
\ fbsize d# 1200 / d# 900 / 2/ c,
- 7 c, \ Number of images that will fit in framebuffer
+ 6 c, \ Number of images that will fit in framebuffer
5 c, d# 11 c, 6 c, 5 c, 5 c, 0 c, 0 c, 0 c, \ {RGBX}{Bits,Pos}
@@ -309,9 +344,11 @@
: vbe-ok ( -- ) h# 4f rm-ax! ;
: vbe-modes ( -- )
+\ ." vbe-modes" cr
?vbe2
h# 41534556 0 >vbe-pa l! \ VbeSignature
- h# 0300 4 >vbe-pa w! \ VbeVersion
+\ h# 0300 4 >vbe-pa w! \ VbeVersion
+ h# 0200 4 >vbe-pa w! \ VbeVersion
1 d# 10 >vbe-pa l! \ Capabilities - 8-bit DACs
vbebuf d# 34 + d# 14 >vbe-pa seg:off! \ VbeFarPtr to mode list
fbsize d# 16 rshift d# 18 >vbe-pa w! \ TotalMemory
@@ -328,33 +365,56 @@
d# 34 >vbe-pa
\ 3 w!++ \ Text mode 3
\ h# 12 w!++ \ Graphics mode 12
- h# 115 w!++ \ 800x600x24
- h# 118 w!++ \ 1024x768x24
- h# 120 w!++ \ OLPC native mode
+ h# 112 w!++ \ 640x480x32
+ h# 115 w!++ \ 800x600x32
+ h# 118 w!++ \ 1024x768x32
+\ h# 120 w!++ \ OLPC native mode
-1 swap w! \ End of list
vbe-ok
;
: vbe-get-mode ( -- )
- rm-cx@ case
- h# 115 of mode-115-info /mode-115-info endof
- h# 118 of mode-118-info /mode-118-info endof
- h# 120 of mode-120-info /mode-120-info endof
+
+ rm-cx@
+\ ." vbe-get-mode " dup . cr
+h# 1ff and case
+ h# 112 of mode-112-info /mode-112-info endof
+ h# 115 of mode-115-info /mode-115-info endof
+ h# 118 of mode-118-info /mode-118-info endof
+\ h# 120 of mode-120-info /mode-120-info endof
( default ) ." Bad VBE mode number " dup . cr 0 0 rot
endcase ( adr len )
0 >vbe-pa h# 100 erase
0 >vbe-pa swap move
+ vbe-ok
;
+: vbe-error ( -- ) h# 014f rm-ax! ;
+0 value vbe-this-mode
: vbe-set-mode ( -- )
- ." VBE set mode " rm-cx@ . cr
- debug-me
+ rm-bx@ case
+ h# 4112 of " 640x480x32" endof
+ h# 4115 of " 800x600x32" endof
+ h# 4118 of " 1024x768x32" endof
+ ( default ) drop vbe-error exit
+ endcase
+
+ " screen-ih" eval ['] $call-method catch if
+ 3drop vbe-error exit
+ then
+ rm-bx@ to vbe-this-mode
+ vbe-ok
;
+: vbe-current-mode ( -- )
+ vbe-this-mode rm-bx!
+ vbe-ok
+;
: vesa-bios ( -- )
rm-al@ case
h# 00 of vbe-modes endof
h# 01 of vbe-get-mode endof
h# 02 of vbe-set-mode endof
+ h# 03 of vbe-current-mode endof
( default ) ." Unsupported VBE function" dup .x cr
endcase
;
Modified: cpu/x86/pc/olpc/dsdt.dsl
===================================================================
--- cpu/x86/pc/olpc/dsdt.dsl 2009-02-20 08:23:30 UTC (rev 1106)
+++ cpu/x86/pc/olpc/dsdt.dsl 2009-02-20 09:14:16 UTC (rev 1107)
@@ -771,7 +771,6 @@
Name (_UID, One)
Method (_CRS, 0, NotSerialized) {
Name (MBRB, ResourceTemplate () {
- Memory32Fixed (ReadWrite, 0x00000000, 0x000A0000, )
Memory32Fixed (ReadOnly, 0x000E0000, 0x00020000, )
Memory32Fixed (ReadWrite, 0x00100000, 0x00000000, _Y06) // Edited below
// Assumes that the SMM memory is at 8040.0000, I think
@@ -781,7 +780,6 @@
IO (Decode16, 0x0092, 0x0092, 0x00, 0x01, )
IO (Decode16, 0x0030, 0x0030, 0x00, 0x10, ) // I/O ports to fake out SMI interrupts
- IO (Decode16, 0x03c0, 0x03c0, 0x00, 0x20, ) // Claim VGA I/O ports
// We claim the EC ports here instead of in an EC node
// because we don't want Windows to load an EC driver
// nor to complain about not being able to do so.
@@ -839,7 +837,7 @@
Name (_HID, EisaId ("PNP0501"))
Name (_UID, One)
Name (_DDN, "COM1")
- Name (_STA, 3) // Present and decoding resources, but shouldn't be shown
+ Name (_STA, 0xf) // You can use the serial port if you open the box
Name (_CRS, ResourceTemplate () {
IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08, )
IRQNoFlags () {4}
Modified: dev/geode/display/gxvga.fth
===================================================================
--- dev/geode/display/gxvga.fth 2009-02-20 08:23:30 UTC (rev 1106)
+++ dev/geode/display/gxvga.fth 2009-02-20 09:14:16 UTC (rev 1107)
@@ -554,26 +554,38 @@
1 ms \ Let memory accesses finish
4 dc@ 1 invert and 4 dc! \ Turn off FIFO load
;
-: 8bpp ( -- ) 8 dc@ h# 300 invert and 8 dc! ; \ drop down to 8bpp mode
+: 8bpp ( -- ) 8 dc@ h# 300 invert and 8 dc! ;
+: 16bpp ( -- ) 8 dc@ h# 300 invert and h# 100 or 8 dc! ;
+: 24bpp ( -- ) 8 dc@ h# 300 invert and h# 200 or 8 dc! ;
+: 32bpp ( -- ) 8 dc@ h# 300 or 8 dc! ;
: vga-start ( -- )
8 dc@ 1 or 8 dc! \ Timing generator
\ Fixed timing must be off to use the upscaler
4 dc@ h# 40000 invert and h# 80 or 4 dc! \ Fixed Timing (40000) off, VGA (80) on
;
-: display-lfb ( -- ) 5601 4 dc! ; \ Enable linear framebuffer
+: display-lfb ( -- ) 6501 4 dc! ; \ Enable linear framebuffer
-: setup-filter-mode3 ( -- )
-\ d# 400 1- d# 640 1- wljoin h# 5c dc!
+: setup-filter-720x400 ( -- )
d# 400 1- d# 720 1- wljoin h# 5c dc!
h# 1c802666 h# 90 dc!
filter-taps
;
-: setup-filter-mode12 ( -- )
+: setup-filter-640x480 ( -- )
d# 480 1- d# 640 1- wljoin h# 5c dc!
h# 22222222 h# 90 dc!
filter-taps
;
+: setup-filter-800x600 ( -- )
+ d# 600 1- d# 800 1- wljoin h# 5c dc!
+ h# 2ab42ab4 h# 90 dc!
+ filter-taps
+;
+: setup-filter-1024x768 ( -- )
+ d# 768 1- d# 1024 1- wljoin h# 5c dc!
+ h# 369d369d h# 90 dc!
+ filter-taps
+;
: filteron ( -- ) h# 1000 h# 94 dc! ;
: filteroff ( -- )
h# 40004000 h# 90 dc!
@@ -629,7 +641,7 @@
\ otherwise the filter and the VGA don't synchronize to the
\ frame and the sequencer shuts off after one frame.
\ That can be fixed with all-off vga-start
- setup-filter-mode3 filteron
+ setup-filter-720x400 filteron
all-off 8bpp vga-start
use-vga-dac
@@ -642,7 +654,7 @@
\ otherwise the filter and the VGA don't synchronize to the
\ frame and the sequencer shuts off after one frame.
\ That can be fixed with all-off vga-start
- setup-filter-mode12 filteron
+ setup-filter-640x480 filteron
all-off 8bpp vga-start
use-vga-dac
@@ -657,6 +669,36 @@
: graphics-mode12 ( -- )
switch-to-vga-mode12 graphics-mode12
;
+: 640x480x32 ( -- ) \ vesa-mode112
+ set-mode \ Get back into native resolution linear mode
+ unlock
+ 32bpp
+ d# 640 d# 32 * 6 rshift dup h# 30 dc! h# 34 dc!
+ all-off setup-filter-640x480 filteron
+ display-on
+ lock
+;
+
+: 800x600x32 ( -- ) \ vesa-mode115
+ set-mode \ Get back into native resolution linear mode
+ unlock
+ 32bpp
+ d# 800 d# 32 * 6 rshift dup h# 30 dc! h# 34 dc!
+ all-off setup-filter-800x600 filteron
+ display-on
+ lock
+;
+
+: 1024x768x32 ( -- ) \ vesa-mode118
+ set-mode \ Get back into native resolution linear mode
+ unlock
+ 32bpp
+ d# 1024 d# 32 * 6 rshift dup h# 30 dc! h# 34 dc!
+ all-off setup-filter-1024x768 filteron
+ display-on
+ lock
+;
+
warning !
\ LICENSE_BEGIN