Author: wmb
Date: Thu Jul 15 19:59:50 2010
New Revision: 1878
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1878
Log:
OLPC XO-1.5 - When resuming to Windows, restore the SDHCI PCI config register that says the device is in D3 power state.
Modified:
cpu/x86/pc/olpc/via/startpcirestore.fth
Modified: cpu/x86/pc/olpc/via/startpcirestore.fth
==============================================================================
--- cpu/x86/pc/olpc/via/startpcirestore.fth Thu Jul 15 19:58:21 2010 (r1877)
+++ cpu/x86/pc/olpc/via/startpcirestore.fth Thu Jul 15 19:59:50 2010 (r1878)
@@ -32,7 +32,8 @@
\ al 8000.1029 #) mov
\ al 8000.2029 #) mov
- f9 6099 config-wb \ Two SD slots (correct for XP, wrong for Linux)
+ f9 6099 config-wb \ Two SD slots (correct for XP, wrong for Linux)
+ 03 6084 config-wb \ D3 power state
\ \ Enable System Management Mode, assuming that the in-memory data structures are already set up
\ 21 383 config-wb \ Enable A/Bxxxx range as memory instead of frame buffer (with fxxxx region R/O)
Author: wmb
Date: Thu Jul 15 19:54:33 2010
New Revision: 1875
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1875
Log:
OLPC - Commentary improvements - no substantive change.
Modified:
cpu/x86/pc/olpc/countdwn.fth
dev/mmc/sdhci/sdhci.fth
Modified: cpu/x86/pc/olpc/countdwn.fth
==============================================================================
--- cpu/x86/pc/olpc/countdwn.fth Thu Jul 15 19:53:02 2010 (r1874)
+++ cpu/x86/pc/olpc/countdwn.fth Thu Jul 15 19:54:33 2010 (r1875)
@@ -2,10 +2,11 @@
purpose: Check for auto-boot interruption
\ This is similar to the ofw/core/countdwn.fth, except that you
-\ have to use a specific key from the main keyboard, because
-\ children tend to pound on the keyboard randomly. If you have
-\ a serial console, you can still use any key, since only developers
-\ have serial consoles.
+\ have to use a specific key (escape) from the main keyboard, because
+\ children tend to pound on the keyboard randomly. The serial
+\ console also requires the escape key, because the Windows kernel
+\ debugger might be connected to the serial port. It sends (non-escape)
+\ characters periodically, and we don't want those to break into OFW.
headerless
: show-countdown ( #seconds -- interrupted? )
@@ -16,7 +17,7 @@
stdin @ if
console-key? if
- console-key h# 1b = if
+ console-key h# 1b = if \ 1b is ESC
\ consume extra escapes in case the user typed several
begin console-key? while console-key drop repeat
true unloop unloop exit
@@ -26,7 +27,7 @@
[ifdef] ukey
ukey? if
\ ukey drop
- ukey h# 1b = if
+ ukey h# 1b = if \ 1b is ESC
true unloop unloop exit
then
then
Modified: dev/mmc/sdhci/sdhci.fth
==============================================================================
--- dev/mmc/sdhci/sdhci.fth Thu Jul 15 19:53:02 2010 (r1874)
+++ dev/mmc/sdhci/sdhci.fth Thu Jul 15 19:54:33 2010 (r1875)
@@ -391,10 +391,9 @@
: deselect-card ( -- ) 0 h# 0700 0 cmd ; \ CMD7 - with null RCA
: select-card ( -- ) \ CMD7 R1b
rca h# 071b 0 cmd
- \ In principle this shouldn't be necessary, but the Via VX855's SD
- \ host controller incorrectly sets the "data transfer complete" bit
- \ during CMD7 with nonzero RCA, and if you don't clear it, subsequent
- \ commands sometimes fail with either Command Timeout or CRC error.
+ \ Unlike Version 1.00, version 2.00 of the SD Host Controller
+ \ Specification says that Transfer Complete is set after R1b
+ \ commands, so we must clear that bit if it is set.
isr@ isr!
;
@@ -408,7 +407,7 @@
: stop-transmission ( -- ) rca h# 0c1b 0 cmd ; \ CMD12 R1b UNTESTED
-: get-status ( -- status ) rca h# 0d1a 0 cmd response ; \ CMD13 R1 UNTESTED
+: get-status ( -- status ) rca h# 0d1a 0 cmd response ; \ CMD13 R1
: go-inactive ( -- ) rca h# 0f00 0 cmd ; \ CMD15 - UNTESTED
@@ -620,16 +619,16 @@
else
2 set-bus-width \ acmd6 - bus width 4
4-bit
- /block set-blocklen \ Cmd 16
+ /block set-blocklen \ cmd16
\ High speed didn't exist until SD spec version 1.10
\ The low nibble of the first byte of SCR data is 0 for v1.0 and v1.01,
\ 1 for v1.10, and 2 for v2.
- get-scr c@ h# f and 0= if exit then
+ get-scr c@ h# f and 0= if exit then \ acmd51
\ Ask if high-speed is supported
- h# 00ff.fff1 switch-function d# 13 + c@ 2 and if
- h# 80ff.fff1 switch-function drop \ Perform the switch
+ h# 00ff.fff1 switch-function d# 13 + c@ 2 and if \ cmd6
+ h# 80ff.fff1 switch-function drop \ Perform the switch cmd6
\ Bump the host controller clock
host-high-speed \ Changes the clock edge
card-clock-50
Author: wmb
Date: Thu Jul 15 19:53:02 2010
New Revision: 1874
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1874
Log:
OLPC XO-1.5 - When resuming from S3, restore the SDHCI state differently for Linux and Windows.
Modified:
cpu/x86/pc/olpc/via/acpi.fth
cpu/x86/pc/olpc/via/addrs.fth
cpu/x86/pc/olpc/via/romreset.bth
Modified: cpu/x86/pc/olpc/via/acpi.fth
==============================================================================
--- cpu/x86/pc/olpc/via/acpi.fth Thu Jul 15 19:41:34 2010 (r1873)
+++ cpu/x86/pc/olpc/via/acpi.fth Thu Jul 15 19:53:02 2010 (r1874)
@@ -290,6 +290,8 @@
do-acpi-wake wake-adr /do-acpi-wake move
+ false windows-mode-adr !
+
[ifdef] notdef
\ Copy in the SSDT
\ I suppose we could point to it in FLASH - if so don't compress it,
@@ -315,16 +317,10 @@
defer more-platform-fixup ' noop to more-platform-fixup
: rm-platform-fixup ( -- )
-[ifdef] Later
-Geode xp-smbus-base h# f001 h# 5140.000b 3dup msr! find-msr-entry 2!
-Geode xp-smbus-base 1+ h# 10 isa-hdr >hdr-value l!
-
- begin sci-queue@ 0= until \ Clean out the SCI queue
- h# 20 acpi-w@ h# 20 acpi-w! \ Ack outstanding events
-Geode h# 4e sci-mask! \ Include in the mask only events we care about
+ \ Disable the internal SD to prevent Windows from making it C:
+ h# f9 h# 6099 config-b!
+ true windows-mode-adr ! \ Tell the resume code to do it too
-Geode 0 h# 40 pm! \ Restore long delay for power-off button
-[then]
more-platform-fixup
;
Modified: cpu/x86/pc/olpc/via/addrs.fth
==============================================================================
--- cpu/x86/pc/olpc/via/addrs.fth Thu Jul 15 19:41:34 2010 (r1873)
+++ cpu/x86/pc/olpc/via/addrs.fth Thu Jul 15 19:53:02 2010 (r1874)
@@ -87,8 +87,9 @@
h# ffc00 constant smbios-adr
h# fff00 constant wake-adr \ Needs to be at least h# 32 bytes - used in acpi.fth
h# fff40 constant rm-buf \ 8-byte buffer used by BIOS INT 15 AH=C0 for returning config info
-h# fff48 constant video-mode-adr \ Saves display mode for resume code
-\ h# fff4c constant next-adr
+h# fff48 constant video-mode-adr \ Saves display mode for resume code
+h# fff4c constant windows-mode-adr \ Flag to control Windows-specific resume fixups
+\ h# fff50 Next address available for resume variables
h# fff80 constant 'int10-dispatch
Modified: cpu/x86/pc/olpc/via/romreset.bth
==============================================================================
--- cpu/x86/pc/olpc/via/romreset.bth Thu Jul 15 19:41:34 2010 (r1873)
+++ cpu/x86/pc/olpc/via/romreset.bth Thu Jul 15 19:53:02 2010 (r1874)
@@ -248,9 +248,10 @@
ax jmp \ Jump in 32-bit protected mode
then
- \ This only works if prep-rm has already been executed;
- \ otherwise it will hang trying to re-enable SMM
- fload ${BP}/cpu/x86/pc/olpc/via/startpcirestore.fth \ SD host controller PCI BARs
+ \ These fixups are only needed by Windows, and some of them are bad for Linux
+ windows-mode-adr #) ax mov ax ax or 0<> if
+ fload ${BP}/cpu/x86/pc/olpc/via/startpcirestore.fth \ SD host controller PCI BARs
+ then
facs-adr h# c + #) ax mov ax ax or 0<> if
\ Resume in real mode for ACPI operating systems
Author: rsmith
Date: Wed Jul 14 22:34:13 2010
New Revision: 1869
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1869
Log:
OLPC XO 1.5: ALPS keyboard support; Trust the EC.
The ALPS keyboard need 500ms to startup before you can successfully
talk to it. The previous keyboard routines would try to probe
at the same time that the EC is trying to detect what keyboard
controller is installed. When OFW dosen't get a response
it assumes there is no keyboard.
Now OFW assumes that the EC is properly detecting the keboard
controller (Which is does as of Ver 1.9.30) and the only command
it sends is the scan enable.
Modified:
cpu/x86/pc/olpc/via/devices.fth
cpu/x86/pc/olpc/via/ec-version.fth
dev/pckbd.fth
Modified: cpu/x86/pc/olpc/via/devices.fth
==============================================================================
--- cpu/x86/pc/olpc/via/devices.fth Wed Jul 14 22:08:26 2010 (r1868)
+++ cpu/x86/pc/olpc/via/devices.fth Wed Jul 14 22:34:13 2010 (r1869)
@@ -121,6 +121,8 @@
[then]
: serial-enabled? ( -- flag ) h# 8846 config-b@ h# 40 and 0<> ;
+create trust-ec-keyboard
+
fload ${BP}/dev/pci/isaall.fth
\ We don't need a serial selftest because the serial port is internal only
\ and the selftest turns off the diag device
Modified: cpu/x86/pc/olpc/via/ec-version.fth
==============================================================================
--- cpu/x86/pc/olpc/via/ec-version.fth Wed Jul 14 22:08:26 2010 (r1868)
+++ cpu/x86/pc/olpc/via/ec-version.fth Wed Jul 14 22:34:13 2010 (r1869)
@@ -3,5 +3,5 @@
\ Alternate command for getting EC microcode, for testing new versions.
\ Temporarily uncomment the line and modify the path as necessary
-\ macro: GET_EC cp ~rsmith/olpc/ec/ec-code15/image/ecimage.bin ec.img
+macro: GET_EC cp ~rsmith/olpc/ec/ec-code15/image/ecimage.bin ec.img
\ macro: GET_EC wget -q http://dev.laptop.org/pub/ec/ec_test.img -O ec.img
Modified: dev/pckbd.fth
==============================================================================
--- dev/pckbd.fth Wed Jul 14 22:08:26 2010 (r1868)
+++ dev/pckbd.fth Wed Jul 14 22:34:13 2010 (r1869)
@@ -257,17 +257,10 @@
[ifdef] olpc
[ifndef] demo-board
-: ?olpc-keyboard ( -- )
- " enable-intf" $call-parent
- begin d# 50 timed-read 0= while
- drop
- true to keyboard-present?
- exit
- repeat
- keyboard-present? if exit then
- kbd-reset 0= to keyboard-present?
-;
+[ifdef] trust-ec-keyboard
+: ?olpc-keyboard ( -- ) true to keyboard-present? ;
+[else]
\ For the ENE keyboard controller we have to tell the EC to use
\ a different internal mapping table. OLPC switched from an
\ ALPS to an ENE controller in late 2007.
@@ -284,7 +277,23 @@
\ This looks like an ENE controller, so flip the mapping table
h# f7 cmd
+;
+
+: ?olpc-keyboard ( -- )
+ " enable-intf" $call-parent
+ begin d# 50 timed-read 0= while
+ drop
+ true to keyboard-present?
+ exit
+ repeat
+ keyboard-present? if exit then
+ kbd-reset 0= to keyboard-present?
+
+ \ Try resetting the keyboard
+ kbd-reset 0= to keyboard-present?
+ keyboard-present? if olpc-set-ec-keymap then
;
+[then]
fload ${BP}/cpu/x86/pc/olpc/keymap.fth
[then]
@@ -423,7 +432,6 @@
clear-state
[ifdef] ?olpc-keyboard
?olpc-keyboard
- keyboard-present? if olpc-set-ec-keymap exit then
[else]
get-initial-state