Author: wmb Date: 2009-01-23 22:15:58 +0100 (Fri, 23 Jan 2009) New Revision: 1081
Modified: cpu/x86/pc/olpc/acpi.fth cpu/x86/pc/olpc/biosresume.fth cpu/x86/pc/olpc/dsdt.dsl cpu/x86/pc/olpc/resume.bth dev/geode/display/gxfb.fth dev/geode/smi.fth dev/olpc/kb3700/ecio.fth Log: OLPC trac 9211 - multiple fixes for issues discovered in Windows testing, including standby flakiness, device testing framework failures due to some extant I/O ports not being reported via ACPI, and display partial turn-on when keys are typed during standby,
Modified: cpu/x86/pc/olpc/acpi.fth =================================================================== --- cpu/x86/pc/olpc/acpi.fth 2009-01-23 20:24:20 UTC (rev 1080) +++ cpu/x86/pc/olpc/acpi.fth 2009-01-23 21:15:58 UTC (rev 1081) @@ -192,6 +192,7 @@ ;
h# 6000 constant xp-smbus-base +defer more-platform-fixup ' noop to more-platform-fixup : rm-platform-fixup ( -- ) xp-smbus-base h# f001 h# 5140.000b 3dup msr! find-msr-entry 2! xp-smbus-base 1+ h# 10 isa-hdr >hdr-value l! @@ -201,4 +202,5 @@ h# 4e sci-mask! \ Include in the mask only events we care about
0 h# 40 pm! \ Restore long delay for power-off button + more-platform-fixup ;
Modified: cpu/x86/pc/olpc/biosresume.fth =================================================================== --- cpu/x86/pc/olpc/biosresume.fth 2009-01-23 20:24:20 UTC (rev 1080) +++ cpu/x86/pc/olpc/biosresume.fth 2009-01-23 21:15:58 UTC (rev 1081) @@ -61,13 +61,36 @@ " enable-scan" kbd-ih $call-method \ Restart keyboard ;
+: enable-uoc ( -- ) + uoc-pci-base h# 1000 4 h# 5151.0020 set-p2d-bm + h# 5120.000b msr@ 2 or h# 5120.000b msr! +; +: disable-uoc ( -- ) + h# 5120.000b msr@ 2 invert and h# 5120.000b msr! + h# 5101.0020 p2d-bm-off +; +' disable-uoc to more-platform-fixup +: video-refresh-off ( -- ) + h# 1000.002a msr@ drop d# 12 lshift ( dc-base ) + h# 4758 over l! 0 swap 4 + l! + d# 25 ms +; + : (suspend-devices) ( -- ) - dcon-power-off + dcon-power-off video-refresh-off + wlan-freeze suspend-ps2 [ifdef] setup-lid-wakeup setup-lid-wakeup [then] + sci-inhibit \ This prevents SCIs during a critical period + 0 sci-mask! \ No SCIs during sleep + enable-uoc \ So resume can turn on USB power + h# 99 h# 34 cmos! ; : (resume-devices) ( -- ) + disable-uoc \ Because Windows doesn't want to see the UOC + h# 4e sci-mask! + sci-uninhibit [ifdef] cleanup-lid-wakeup cleanup-lid-wakeup [then] resume-ps2 wlan-reset
Modified: cpu/x86/pc/olpc/dsdt.dsl =================================================================== --- cpu/x86/pc/olpc/dsdt.dsl 2009-01-23 20:24:20 UTC (rev 1080) +++ cpu/x86/pc/olpc/dsdt.dsl 2009-01-23 21:15:58 UTC (rev 1081) @@ -201,7 +201,7 @@ }
Name (_S0, Package (0x04) { Zero, Zero, Zero, Zero }) // Values for PM1a,b_CNT.SLP_TYP registers - Name (_S1, Package (0x04) { One, One, Zero, Zero }) +// Name (_S1, Package (0x04) { One, One, Zero, Zero }) Name (_S3, Package (0x04) { 0x03, 0x03, Zero, Zero }) Name (_S5, Package (0x04) { 0x05, 0x05, Zero, Zero }) Name (SLPS, Zero) // Current state - see _SST page 298 for values @@ -779,6 +779,9 @@ Memory32Fixed (ReadOnly, 0xFFF00000, 0x00100000, ) // GeodeROM has f0000000,10000000
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 }) CreateDWordField (MBRB, _SB.PCI0.SBF0.MEM._CRS._Y06._LEN, EM1L) Store (MEMK, Local0) // Memory size in Kbytes (from EBDA) @@ -822,8 +825,39 @@ }) }
-// Elided UART + Device (UAR1) + { + Name (_HID, EisaId ("PNP0501")) + Name (_UID, One) + Name (_DDN, "COM1") + Name (_STA, 3) // Present and decoding resources, but shouldn't be shown + Name (_CRS, ResourceTemplate () { + IO (Decode16, 0x03F8, 0x03F8, 0x00, 0x08, ) + IRQNoFlags () {4} + }) + }
+ Device(EC0) { + Name (_HID, EISAID("PNP0C09")) + Name (_CRS, ResourceTemplate() { + IO (Decode16, 0x62, 0x62, 0, 1) + IO (Decode16, 0x66, 0x66, 0, 1) + IO (Decode16, 0x61, 0x61, 0, 1) + IO (Decode16, 0x68, 0x68, 0, 1) + IO (Decode16, 0x6c, 0x6c, 0, 1) + IO (Decode16, 0x380, 0x380, 0, 4) + }) + +// // Define that the EC SCI is bit 0 of the GP_STS register +// Name(_GPE, 0) { +// OperationRegion(ECOR, EmbeddedControl, 0, 0xFF) +// Field(ECOR, ByteAcc, Lock, Preserve) { +// // Field definitions go here +// } +// } + + } + // Elided superio
// XXX ??? Maybe this should be moved out a level so it's not under SB F0 @@ -831,8 +865,8 @@ Name (_HID, EisaId ("PNP0303")) Name (_CID, 0x0B03D041)
- // Return this one if can wake from keyboard - XXX maybe need to be 3 instead of One - Name (_PRW, Package (0x02) { Zero, One }) + // Return this one if can wake from keyboard +// Name (_PRW, Package (0x02) { Zero, 3 })
Method (_PSW, 1, NotSerialized) { }
@@ -849,7 +883,7 @@ Device (PS2M) { Name (_HID, EisaId ("PNP0F03")) // ALPS Pointing device Name (_CID, 0x130FD041) - Name (_PRW, Package (0x02) { Zero, One }) +// Name (_PRW, Package (0x02) { Zero, 3 }) Method (_PSW, 1, NotSerialized) { } Name (_CRS, ResourceTemplate () { IRQNoFlags () {12} }) Name (_STA, 0x0F ) @@ -865,14 +899,14 @@ Name (_STR, Unicode ("CS553x USB Controller 0")) Name (_STA, 0x0F)
- Name (_PRW, Package (0x02) { 0x06, One }) +// Name (_PRW, Package (0x02) { 0x06, 3 }) }
Device (USB1) { Name (_ADR, 0x000F0005) Name (_STR, Unicode ("CS553x USB Controller 1")) Name (_STA, 0x0F) - Name (_PRW, Package (0x02) { 0x06, One }) +// Name (_PRW, Package (0x02) { 0x06, 3 }) }
// Device (USB2) {
Modified: cpu/x86/pc/olpc/resume.bth =================================================================== --- cpu/x86/pc/olpc/resume.bth 2009-01-23 20:24:20 UTC (rev 1080) +++ cpu/x86/pc/olpc/resume.bth 2009-01-23 21:15:58 UTC (rev 1081) @@ -291,23 +291,25 @@
h# 6010 config-rl ax stos \ NAND BAR ax bx mov \ Base address - 6 h# 6004 config-ww \ Enable access + h# 6004 config-rw ax stos \ NAND enables + 2 h# 6004 config-ww \ Enable access h# 24 [bx] ax mov ax stos \ NAND Timing1 h# 28 [bx] ax mov ax stos \ NAND Timing2 h# 2c [bx] ax mov ax stos \ NAND Timing3 - h# 6004 config-rw op: ax stos \ NAND enables + 0 h# 6004 config-ww \ Disable access
- h# 6104 config-rw op: ax stos \ SDHCI enables + h# 6104 config-rw ax stos \ SDHCI enables h# 0 h# 618c config-ww \ Set power state to 0 so reads will work h# 6110 config-rl ax stos \ SDHCI BAR ax bx mov \ Base address - 6 h# 6104 config-ww \ Enable access + 2 h# 6104 config-ww \ Enable access op: h# 3004 [bx] ax mov op: ax stos \ Clock config h# 300c [bx] ax mov ax stos \ Interrupt config h# 3038 [bx] ax mov ax stos \ GPIO Config h# 315c [bx] ax mov ax stos \ GPIO Data h# 610d config-rb al stos \ SDHCI latency timer h# 613c config-rb al stos \ SDHCI IRQ + 0 h# 6104 config-ww \ Disable access
h# 6210 config-rl ax stos \ Camera BAR h# 6204 config-rw ax stos \ Camera enables @@ -323,15 +325,33 @@ h# 5140.000c rmsr h# 30 [ax] dx lea \ GPIO data port d# 50,000 # cx mov forget-msr \ 50K spins is about 40 mS begin dx ax in h# e0 # al and h# c0 # al cmp loopne + +[ifdef] ineffective + \ XXX this doesn't work as-is because you have to wait a frame time + \ afterwards before the accesses will actually stop. I suppose that + \ it might be possible to turn it off just in time, but that would + \ require careful verification. + + \ Stop video refresh + h# 1000.002a rmsr d# 12 # ax shl ax bx mov \ DC PCI base address + h# 4758 # 0 [bx] mov \ Unlock DC registers + 0 # 4 [ax] mov \ Turn off access to display memory [then]
+[then] + [ifdef] checksum-test \ Checksum memory from 1M to top (excluding framebuffer) - bx bx xor h# 0010.0000 # si mov - h# 0ef0.0000 2 rshift # cx mov forget-msr \ Word count - begin ax lods ax bx add loopa - bx resume-data h# 10 - #) mov \ Save checksum + h# 4d534b43 # ax mov ax stos \ Marker 'CKSM' + di resume-data h# 10 - #) mov \ Save checksum base address + begin + bx bx xor + h# 10.0000 2 rshift # cx mov forget-msr \ Word count for 1MB + begin ax lods ax bx add loopa + ax stos + h# ec0.0000 # si cmp + = until [then]
[ifdef] measure-suspend @@ -339,10 +359,6 @@ rdtsc ax h# 18 #) mov dx h# 1c #) mov [then]
- \ Stop video refresh - h# 4758 # dc-pci-base #) mov \ Unlock DC registers - h# 0 # dc-pci-base 4 + #) mov \ Turn off access to display memory - h# 4000.0e00 h# 1410 port-wl \ Assert SLP_CLK_EN# 1 mS after SUSPA# \ This is pointless because register 14 is in the working power domain \ and does not retain the value across the suspend @@ -433,11 +449,20 @@
[ifdef] checksum-test \ Checksum memory from 1M to top (excluding framebuffer) - bx bx xor h# 0010.0000 # si mov - h# 0ef0.0000 2 rshift # cx mov forget-msr \ Word count - begin ax lods ax bx add loopa - bx resume-data h# 10 - #) cmp <> if ret then + resume-data h# 10 - #) di mov \ Save checksum base address + begin + bx bx xor + h# 10.0000 2 rshift # cx mov forget-msr \ Word count for 1MB + begin ax lods ax bx add loopa + ax 0 [di] cmp + <> if + char C 3f8 port-wb begin 3fd port-rb 20 bitand 0<> until + ret + then + 4 [di] di lea + h# ec0.0000 # si cmp + = until [then]
h# 38 [bp] si lea \ Save area @@ -787,13 +812,14 @@
h# 6010 config-setup ax lods ax dx out \ NAND BAR ax bx mov \ Base address + ax lods ax cx mov forget-msr \ NAND enables - save for later 6 h# 6004 config-ww \ Enable access ax lods ax h# 24 [bx] mov \ NAND Timing 1 ax lods ax h# 28 [bx] mov \ NAND Timing 2 ax lods ax h# 2c [bx] mov \ NAND Timing 3 - h# 6004 config-setup op: ax lods op: ax dx out \ NAND enables + h# 6004 config-setup cx ax mov op: ax dx out \ NAND enables
- op: ax lods ax cx mov forget-msr \ SDHCI enables - save for later + ax lods ax cx mov forget-msr \ SDHCI enables - save for later h# 6110 config-setup ax lods ax dx out \ SDHCI BAR ax bx mov \ Base address 6 h# 6104 config-ww \ Enable access
Modified: dev/geode/display/gxfb.fth =================================================================== --- dev/geode/display/gxfb.fth 2009-01-23 20:24:20 UTC (rev 1080) +++ dev/geode/display/gxfb.fth 2009-01-23 21:15:58 UTC (rev 1081) @@ -352,6 +352,7 @@ drop \ video-state - /l / . cr
+ unlock 0 4 dc! \ Turn off video memory access d# 25 ms \ Wait for a frame time to make sure the display is quiet ;
Modified: dev/geode/smi.fth =================================================================== --- dev/geode/smi.fth 2009-01-23 20:24:20 UTC (rev 1080) +++ dev/geode/smi.fth 2009-01-23 21:15:58 UTC (rev 1081) @@ -402,11 +402,10 @@
h# 11 h# 4c00.2002 msr-clr \ h# 10 h# 4c00.2002 msr-clr
- 0. h# 1000.0083 msr! \ Enable ASMIs in LX GLIU0 - 0. h# 5101.0083 msr! \ Enable ASMIs in 5536 GLIU0 + h# ff00 h# 1000.0083 msr-clr \ Enable ASMIs in LX GLIU0 + h# ff00 h# 4000.0083 msr-clr \ Enable ASMIs in LX GLIU1 + h# ff00 h# 5101.0083 msr-clr \ Enable ASMIs in 5536 GLIU0
- h# ff00 h# 1000.0082 msr-clr h# ff00 h# 1000.0083 msr-clr - h# ff00 h# 4000.0082 msr-clr h# ff00 h# 4000.0083 msr-clr h# 38. h# 1301 msr! ;
@@ -783,6 +782,48 @@ enable-io-smis ;
+[ifdef] notdef \ We don't need this, but it's nice to have the recipe +: disable-virtual-pci ( -- ) + \ Virtualize devices f and 1, or all devices if debugging + h# 5000.2012 msr@ swap h# ffff invert and swap h# 5000.2012 msr! + h# 5000.2002 msr@ swap 8 or swap h# 5000.2002 msr! \ Disable SSMI for config accesses +; +: disable-io-smis ( -- ) + h# 1301 msr@ swap h# 20 invert and swap h# 1301 msr! + + \ XXX these settings need to be folded into the MSR table for resume + h# 0000.00ff.fff00000. h# 5101.00e4 msr! \ Unvirtualize ACPI registers + 1. h# 5101.0002 msr! \ Disable SSMI in GLIU_GLD_MSR_SMI + 0. h# 5100.0002 msr! \ Enable SSMI in GLPCI_GLD_MSR_SMI + + \ Virtual registers + 0. h# 1000.00e3 msr! \ AC1C..AC1F + h# ff.fff00000. h# 1000.00e2 msr! \ 30..3f - for bouncing INTs to SMIs + 0. h# 5140.0002 msr! \ Port 92 INIT (bit 0 - reset) + + 1. h# 1000.2002 msr! \ AC1C generates SMI + 0. h# 1000.2003 msr! \ AC1C does not generate ERR + 1. h# 4000.2002 msr! + + h# 1f. h# 4c00.2002 msr! \ h# 10 h# 4c00.2002 msr-clr + + h# ff00. h# 1000.0083 msr! \ Enable ASMIs in LX GLIU0 + h# ff00. h# 4000.0084 msr! \ Enable AERRSs in LX GLIU0 + h# ff00. h# 5101.0083 msr! \ Enable ASMIs in 5536 GLIU0 +; +: unsetup-smi ( -- ) + disable-io-smis + disable-virtual-pci + + 0. h# 1301 msr! \ Disable IO and software SMI + + 0. h# 132b msr! \ Offset of SMM Header + 0. h# 133b msr! + + h# 00000.0.01.00000.0.01. h# 180e msr! \ Default value +; +[then] + defer suspend-devices ' noop to suspend-devices defer resume-devices ' noop to resume-devices
Modified: dev/olpc/kb3700/ecio.fth =================================================================== --- dev/olpc/kb3700/ecio.fth 2009-01-23 20:24:20 UTC (rev 1080) +++ dev/olpc/kb3700/ecio.fth 2009-01-23 21:15:58 UTC (rev 1081) @@ -156,6 +156,8 @@ : ebook-mode? ( -- b ) h# 2a ec-cmd-b@ ; : wlan-freeze ( -- ) h# 35 ec-cmd ; : sci-queue@ ( -- b ) h# 84 ec-cmd-b@ ; +: sci-inhibit ( -- ) h# 32 ec-cmd ; +: sci-uninhibit ( -- ) h# 34 ec-cmd ;
: ec-indexed-io-off ( -- ) h# fe95 ec@ h# 40 invert and h# fe95 ec! ;
openfirmware@openfirmware.info