Author: wmb Date: 2009-06-30 21:53:14 +0200 (Tue, 30 Jun 2009) New Revision: 1230
Modified: cpu/x86/pc/olpc/via/acpi.fth cpu/x86/pc/olpc/via/addrs.fth cpu/x86/pc/olpc/via/dsdt.dsl cpu/x86/pc/olpc/via/fw.bth cpu/x86/pc/olpc/via/ioinit.fth cpu/x86/pc/olpc/via/rmstart.fth cpu/x86/pc/olpc/via/romreset.bth dev/olpc/dcon/viadcon.fth Log: Via - ACPI wakeup support.
Modified: cpu/x86/pc/olpc/via/acpi.fth =================================================================== --- cpu/x86/pc/olpc/via/acpi.fth 2009-06-29 19:30:06 UTC (rev 1229) +++ cpu/x86/pc/olpc/via/acpi.fth 2009-06-30 19:53:14 UTC (rev 1230) @@ -232,6 +232,44 @@ dup >acpi-table-len 9 fix-checksum ;
+h# 28 constant rm-ds \ Must agree with GDT in rmstart.fth + +label do-acpi-wake + \ This code must be copied to low memory + \ Jump to this code (in low memory) with the linear target address in EAX + \ Interrupts must be off. We don't have a stack. + \ We got here via a far jmp to a 16-bit code segment, so we are + \ using the 16-bit instruction set, but we're not yet in real mode + + 16-bit + + ahead + 0 w, 0 w, \ Room for the segment:offset pointer + then + + op: ax bx mov + h# 0f # ax and + op: 4 # bx shr + + cs: ax wake-adr la1+ #) mov \ Offset + cs: bx wake-adr wa1+ #) mov \ Segment + + \ The following might be unnecessary + ax ax xor rm-ds # al mov \ 16-bit data segment + ax ds mov ax es mov ax ss mov + + cr0 ax mov h# fe # al and ax cr0 mov \ Enter real mode + + here 5 + do-acpi-wake - wake-adr + >seg:off #) far jmp \ Jump to set cs + + \ The following might be unnecessary + \ Now we are running in real mode; fix segments again + cs ax mov ax ds mov ax es mov + + cs: wake-adr wa1+ s#) far jmp +end-code +here do-acpi-wake - constant /do-acpi-wake + : setup-acpi ( -- ) [ifdef] notdef \ This has to agree with the _SB's _INI method, which gets the memory size @@ -254,6 +292,8 @@ " dsdt" find-drop-in 0= abort" No DSDT " ( adr len ) 2dup dsdt-adr swap move free-mem
+ do-acpi-wake wake-adr 4 + /do-acpi-wake move + [ifdef] notdef \ Copy in the SSDT \ I suppose we could point to it in FLASH - if so don't compress it,
Modified: cpu/x86/pc/olpc/via/addrs.fth =================================================================== --- cpu/x86/pc/olpc/via/addrs.fth 2009-06-29 19:30:06 UTC (rev 1229) +++ cpu/x86/pc/olpc/via/addrs.fth 2009-06-30 19:53:14 UTC (rev 1230) @@ -69,12 +69,13 @@ h# e0080 constant fadt-adr h# e0180 constant facs-adr h# e01c0 constant dbgp-adr -h# e0200 constant madt-adr \ MADT is 5a byts long +h# e0200 constant madt-adr \ MADT is 5a bytes long h# e0280 constant hpet-adr h# fc000 constant dsdt-adr h# fd000 constant ssdt-adr
h# ffc00 constant smbios-adr +h# fff00 constant wake-adr
h# 3e.0000 constant inflate-base h# 30.0000 constant workspace
Modified: cpu/x86/pc/olpc/via/dsdt.dsl =================================================================== --- cpu/x86/pc/olpc/via/dsdt.dsl 2009-06-29 19:30:06 UTC (rev 1229) +++ cpu/x86/pc/olpc/via/dsdt.dsl 2009-06-30 19:53:14 UTC (rev 1230) @@ -22,6 +22,14 @@ { Processor(_PR.CPU0,0x00,0x00000410,0x06) { + Name(_CST, Package() + { + 4, + Package(){ResourceTemplate(){Register(SystemIO, 8, 0, 0x414)}, 2, 2, 750}, + Package(){ResourceTemplate(){Register(SystemIO, 8, 0, 0x415)}, 3, 65, 500}, + Package(){ResourceTemplate(){Register(SystemIO, 8, 0, 0x416)}, 4, 100, 300}, + Package(){ResourceTemplate(){Register(SystemIO, 8, 0, 0x417)}, 5, 200, 200} + }) } } // System Sleep States
Modified: cpu/x86/pc/olpc/via/fw.bth =================================================================== --- cpu/x86/pc/olpc/via/fw.bth 2009-06-29 19:30:06 UTC (rev 1229) +++ cpu/x86/pc/olpc/via/fw.bth 2009-06-30 19:53:14 UTC (rev 1230) @@ -344,12 +344,12 @@ boot-getline to boot-file " rom:emacs" $boot ;
+fload ${BP}/cpu/x86/pc/rmtools.fth fload ${BP}/cpu/x86/pc/olpc/via/acpi.fth
fload ${BP}/cpu/x86/pc/olpc/via/smbios.fth
[ifdef] Later -fload ${BP}/cpu/x86/pc/rmtools.fth fload ${BP}/dev/geode/smi.fth \ fload ${BP}/cpu/x86/pc/biosload/rmenter.fth fload ${BP}/cpu/x86/pc/biosints.fth
Modified: cpu/x86/pc/olpc/via/ioinit.fth =================================================================== --- cpu/x86/pc/olpc/via/ioinit.fth 2009-06-29 19:30:06 UTC (rev 1229) +++ cpu/x86/pc/olpc/via/ioinit.fth 2009-06-30 19:53:14 UTC (rev 1230) @@ -199,7 +199,8 @@ 82 0f 0a mreg \ Direct SCI to IRQ 10 (0xa) 84 ff da mreg \ IRQs 7,6,4,3,1 are primary wakeups 85 ff 40 mreg \ IRQ 14 is primary wakeup - 8a 9f 1f mreg \ C-state auto switching with normal latencies +\ 8a 9f 1f mreg \ C-state auto switching with normal latencies + 8a 9f 9f mreg \ C-state auto switching with slow C4 recovery mode - for C4 support [ifdef] demo-board 8d 18 18 mreg \ fast clock as throttle timer tick, hold SMI# low until event status cleared (FIXME for OLPC) [then]
Modified: cpu/x86/pc/olpc/via/rmstart.fth =================================================================== --- cpu/x86/pc/olpc/via/rmstart.fth 2009-06-29 19:30:06 UTC (rev 1229) +++ cpu/x86/pc/olpc/via/rmstart.fth 2009-06-30 19:53:14 UTC (rev 1230) @@ -39,9 +39,8 @@ \ Addresses where the following items will be located in the processor's \ physical address space:
-\ ffff.fc00: GDT ( 3 entries ) + padding -\ ffff.fc20: GDT address + size ( 6 bytes ) plus padding -\ ffff.fc28: Startup code plus padding +\ ffff.fc00: GDT ( 4 active entries ) + padding +\ ffff.fc30: Startup code plus padding \ ffff.fff0: Reset entry point - jump to startup code plus padding to end
\ Assembler macros for startup diagnostics @@ -88,10 +87,12 @@ 0 w, 0 l, 0 w, \ * Null descriptor ffff w, 9b.000000 l, 00.c.f w, \ 10 Code, linear=physical, full 4Gbytes ffff w, 93.000000 l, 00.c.f w, \ 18 Data, linear=physical, full 4Gbytes + ffff w, 9b.0f0000 l, 00.0.0 w, \ 20 Code16, base f.0000, 64K + ffff w, 93.0f0000 l, 00.0.0 w, \ 28 Data16, base f.0000, 64K
\ ------->>>>> Startup code, reached by branch from main entry point below \ - \ ffff.fc20 + \ ffff.fc30
here \ Mark the beginning of this code so its size may be determined \ and so that a jump to it may be assembled later. @@ -170,8 +171,8 @@
here over - ( adr , size-of-preceding-code )
- \ ffff.fc20 is the location of the code that follows the GDT - ffff.fff0 ffff.fc20 - swap - ( address #bytes-to-pad ) + \ ffff.fc30 is the location of the code that follows the GDT + ffff.fff0 ffff.fc30 - swap - ( address #bytes-to-pad )
\ The code mustn't extend past ffff.ffc0, because that is where PC \ manufacturers put the 0x10-byte BIOS version string. @@ -187,7 +188,7 @@
16-bit cli cld \ Turn off interrupts (does not affect NMI) - #) jmp \ Relative jump back to ffff.fc20 + #) jmp \ Relative jump back to ffff.fc30 0 w, 0 c, \ align "pad" to end of ROM loader-version# l, \ version# loader-format# w, \ "format" (>1 when crc present)
Modified: cpu/x86/pc/olpc/via/romreset.bth =================================================================== --- cpu/x86/pc/olpc/via/romreset.bth 2009-06-29 19:30:06 UTC (rev 1229) +++ cpu/x86/pc/olpc/via/romreset.bth 2009-06-30 19:53:14 UTC (rev 1230) @@ -11,7 +11,10 @@
\needs start-assembling fload ${BP}/cpu/x86/asmtools.fth \needs write-dropin fload ${BP}/forth/lib/mkdropin.fth +\needs >seg:off fload ${BP}/cpu/x86/pc/rmtools.fth
+h# 20 constant rm-cs \ Must agree with GDT in rmstart.fth + fload ${BP}/cpu/x86/mmuparam.fth
\ startmacros.fth defines some assembler macros that make MSR and I/O port @@ -170,12 +173,21 @@ bx ax mov h# 1c00 invert # ax and acpi-io-base 4 + # dx mov op: ax dx out char r report
- resume-data # sp mov - resume-entry # ax mov ax call \ This might return if checksumming fails + cli + + facs-adr h# c + #) ax mov ax ax or 0<> if + \ Resume in real mode for ACPI operating systems + \ Linear wakeup address is in EAX + sp sp xor \ Possibly unnecessary + wake-adr >seg:off drop rm-cs #) far jmp + else + \ Resume in 32-bit protected mode for OFW + resume-data # sp mov + resume-entry # ax mov ax call \ This might return if checksumming fails + then char x report then \ Not a wakeup from S3
- \ Cache is now setup normally, backed by memory h# 20.0000 # esp mov
Modified: dev/olpc/dcon/viadcon.fth =================================================================== --- dev/olpc/dcon/viadcon.fth 2009-06-29 19:30:06 UTC (rev 1229) +++ dev/olpc/dcon/viadcon.fth 2009-06-30 19:53:14 UTC (rev 1230) @@ -83,7 +83,7 @@ d# 50 ms wait-output dcon-load \ Put the DCON in VGA-refreshed mode - d# 25 us + d# 25 ms \ Ensure that that DCON sees the DCONLOAD high \ display-on else dcon-unload \ Put the DCON in self-refresh mode
openfirmware@openfirmware.info