Author: wmb Date: 2009-10-06 23:49:09 +0200 (Tue, 06 Oct 2009) New Revision: 1398
Modified: cpu/x86/pc/olpc/via/resume.bth Log: Via resume.bth - eliminated a lot of ifdef'ed out cruft that was leftover from the Geode code and will never be used for the Via case.
Modified: cpu/x86/pc/olpc/via/resume.bth =================================================================== --- cpu/x86/pc/olpc/via/resume.bth 2009-10-06 21:36:16 UTC (rev 1397) +++ cpu/x86/pc/olpc/via/resume.bth 2009-10-06 21:49:09 UTC (rev 1398) @@ -21,11 +21,6 @@ \ This code will be copied to RAM at suspend-base
\ create measure-suspend -\ create save-display -\ create reset-smbus -\ create reset-smbus-bitbang -\ create restore-usb-power -\ create checksum-test
: resume-progress ( byte -- ) " h# 34 # al mov al h# 70 # out ( byte ) # al mov al h# 71 # out" eval @@ -168,42 +163,20 @@ \ This is where Geode saves the PIT state \ This is where Geode saves the SMBUS controller state \ This is where Geode saves the MFGPT state -\ This is where Geode saves the CaFe configuration
\ Other state we might want to save: \ ISA DMA Controller - \ AC97 + \ HDaudio \ Codec \ USB
\ This is where Geode stops the video refresh
-[ifdef] checksum-test - \ Checksum memory from 1M to top (excluding framebuffer) - h# 0010.0000 # si mov - 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 \ Word count for 1MB - begin ax lods ax bx add loopa - ax stos - h# ec0.0000 # si cmp - = until -[then] - [ifdef] measure-suspend di 0 #) mov rdtsc ax h# 18 #) mov dx h# 1c #) mov [then]
- \ This is where the Geode sets up the sleep/wakeup sequence timing - -[ifdef] notdef - \ Clear existing wakeup status - h# 400 port-rw op: ax dx out -[then] \ notdef - \ The caller chooses the wakeup conditions, so we don't do it here h# ffff h# 420 port-ww \ Clear all status bits
@@ -215,19 +188,6 @@
wbinvd \ Flush the cache
-[ifdef] delete-me - \ Setup the register values in advance so the active instruction sequence - \ is as short as possible, thus keeping all the activity in one cache line. -\ h# 0400 h# 404 port-ww \ Setup sleep type -[then] - -[ifdef] notdef - \ Align to a cache line boundary - also forth - begin here asm-base - h# 1f and while h# 90 c, repeat \ Align with NOPs - previous -[then] - h# 2400 h# 404 port-ww \ Go to sleep
h# 1000000 # cx mov begin nop loopa \ Spin in this cache line while going down @@ -246,8 +206,6 @@ \ Running from a 32-bit identity-mapped code segment \ Using physical addresses
-\ char < 3f8 port-wb begin 3fd port-rb 20 bitand 0<> until - resume-data # bp mov
cld @@ -260,134 +218,8 @@
h# 21 resume-progress
-[ifdef] checksum-test - \ Checksum memory from 1M to top (excluding framebuffer) - h# 0010.0000 # si mov - resume-data h# 10 - #) di mov \ Save checksum base address - begin - bx bx xor - h# 10.0000 2 rshift # cx mov \ 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
- h# 22 resume-progress - -[ifdef] reset-smbus-bitbang - \ GPIO15 is SMB_DATA - \ GPIO14 is SMB_CLOCK - h# 5140.000c rmsr ax bx mov - h# c000 # ax mov \ Mask to set SMB_DATA and SMB_CLOCK - h# 00 [bx] dx lea ax dx out \ Set output values to high - h# 04 [bx] dx lea ax dx out \ Set pins to output - h# c0000000 # ax mov \ Mask to clear SMB_DATA and SMB_CLOCK - h# 10 [bx] dx lea ax dx out \ Deselect OUT AUX1 - h# 14 [bx] dx lea ax dx out \ Deselect OUT AUX2 - h# 34 [bx] dx lea ax dx out \ Deselect IN AUX1 - - d# 16 # cx mov forget-msr \ Generate 8 low pulses on SMB_CLOCK - begin - \ 5 uS delay (slightly longer for GX) - rdtsc ax bx mov d# 5 d# 500 * # bx add - begin rdtsc bx ax sub 0>= until - - cx bx mov \ Save cx for use by rmsr - h# 5140.000c rmsr ax dx mov \ GPIO output register - h# 40000000 # ax mov ax dx out \ Clear SMB_CLOCK - bx cx mov forget-ms \ Restore cx - - \ 5 uS delay (slightly longer for GX) - rdtsc ax bx mov d# 5 d# 500 * # bx add - begin rdtsc bx ax sub 0>= until - - cx bx mov \ Save cx for use by rmsr - h# 5140.000c rmsr ax dx mov \ GPIO output register - h# 4000 # ax mov ax dx out \ Set SMB_CLOCK - bx cx mov forget-msr \ Restore cx - loopa - - \ 5 uS delay (slightly longer for GX) - rdtsc ax bx mov d# 5 d# 500 * # bx add - begin rdtsc bx ax sub 0>= until -[then] - - h# 23 resume-progress - -\ GPIO restore - - h# 24 resume-progress - -\ Display restore - -\ Flat panel turn-on - - h# 25 resume-progress - -\ PIC restore - - h# 26 resume-progress - -\ PIT restore - - h# 27 resume-progress - -\ SMBUS controller restore - -[ifdef] reset-smbus - \ This little dance resets the DCON's SMbus interface - \ We start with dx pointing to SMBUS reg 5 - dx dec dx dec \ Point back to smbus reg3 (control 1) - h# 1 # al mov \ START - al dx out \ Initiate an SMBUS cycle to the DCON - - \ We could split here and move the following down, so as to overlap - \ the delay time with other work, but it doesn't matter because the - \ later CaFe chip setup will stall anyway. - - d# 32 # cx mov forget-msr \ Loop count (usually ready in 20 uS) - dx dec dx dec \ SMBUS reg1 (status) - begin - dx al in - h# 40 # al test - loope \ Wait for ready to accept byte or timeout - - h# 1a # al mov \ Address byte - dx dec \ SMBUS reg0 (data) - al dx out \ Initiate address out cycle - - \ Another possible split point, in case we should need to overlap - d# 256 # cx mov forget-msr \ Loop count (usually ready in 172 uS) - dx inc \ SMBUS reg1 (status) - begin - dx al in - h# 50 # al test - loope \ Wait for done or error or timeout - - h# 2 # al mov \ Stop - dx inc dx inc \ SMBUS reg3 (control 1) - al dx out \ Initiate STOP - - h# 10 # al mov \ Ack NEGACK - dx dec dx dec \ SMBUS reg1 (status) - al dx out \ While acking the NEGACK - \ End of DCON SMbus reset dance -[then] - - h# 28 resume-progress - -\ MFGPTs restore - - h# 29 resume-progress - \ D12F0 SDIO h# 6010 config-setup ax lods ax dx out \ BAR0 h# 6014 config-setup ax lods ax dx out \ BAR1 @@ -448,15 +280,6 @@
h# 2a resume-progress
-\ Restore CaFe configuration - - h# 2b resume-progress - -\ Display base addresses - - \ There is a lot of other stuff that must be done to turn on the - \ video - but we will let the gx driver take care of that. - \ XXX keyboard init \ DCON fiddling \ USB @@ -501,8 +324,6 @@
\ Identity mapping of low memory might not exist now
-\ char > 3f8 port-wb begin 3fd port-rb 20 bitand 0<> until - gs pop
fs pop
openfirmware@openfirmware.info