;	File: $Id: PBG4_5_8+5_9Better.txt,v 1.8 2005/09/17 00:09:35 raddog Exp $
;
;	$Log: PBG4_5_8+5_9Better.txt,v $
;	Revision 1.8  2005/09/17 00:09:35  raddog
;	Set voltage high, frequency 1/2 for sleep for compatibility with hibernation
;	
;	Revision 1.7  2005/09/06 18:23:26  raddog
;	Keith Cox 'NuBetter' table
;	
;	Revision 1.6  2005/09/02 21:50:51  raddog
;	Latest stepper tables from Keith Cox
;	
;	Revision 1.5  2005/08/17 18:33:35  raddog
;	[4219960]improve overtemp behavior, [4210384]downstep voltage protection
;	
;	Revision 1.4  2005/07/29 22:40:02  raddog
;	[4173968] Q16C/Q41C Hang during DVD playback, [4197260] Q16C/Q41C CPU Core voltage remains high when stepper is in reduce speed mode
;	
;	Revision 1.3  2005/07/25 21:13:24  raddog
;	[4192395]Q16C/Q41C Stepper control
;	
;	Revision 1.2  2005/07/18 23:38:38  raddog
;	[4174343]1.5GHz hang during install.  Also clean up PowerPlay usage to match Ingrid's check-in (PBG4_StepCtrlLoop.cpp 1.3)
;	
;	Revision 1.1  2005/07/06 02:13:32  raddog
;	Initial checkin for stepper kernel support for PowerBooks
;	
;
;
;   Example step definition file
;
;   This file should be compiled with the pmsset program.  It will compile and check 
;   for errors.  Eventually when I finish it, it will push the step table into the kernel
;   and activate it on all processors.
;
;   This is for testing.  I assume that normally we will have something in the kernel to
;   define this stuff although this could be used to modify the defaults for special
;   user applications.
;
;   Step definitions 0 - 9 are required and should not change meaning.
;
;   pmsIdle is the power for the idle loop (including nap) and should be lowest. 
;       We step up when we have work to do and exit the loop.  There is no time limit here.
;
;   pmsNorm is still low power and is the first step out of idle.  Time limit here.
;
;   pmsNormHigh is the highest normal power and is where we assume we are after boot.
;
;   pmsBoost is the overdrive step and should have a time limit but can be unlimited.
;
;   pmsLow is the lowest power, no time limit.  Used to force low power, if needed.
;
;   pmsHigh is highest normal, no time limit.  Used to for highest non-overdrive power, if needed.
;
;   pmsPrepCng is Prepare for step table change
;
;   pmsPrepSleep is Prepare for sleep
;
;	pmsOverTemp is for when the processor has gotten too hot
;
;	pmsEnterNorm is used to transition back into the normal step program 
;
;   pmsParked transitions to a parked state.  There is no corresponding step table entry.  It is a fixed valid of 0xFFFFFFFF.
;
;
;   There can be up to 64 steps.
;
;   The down field is the step to transition to when power is to be dropped.  Normally this 
;       would be idle.  Currently the transition point is on entry to the idle loop.
;		A -1 specifies that the next step is parked.
;
;   The next field is the normal forward step.  The power could go down, up, or stay the same.
;       This is normally triggered by the expiration of the time limit.
;		A -1 specifies that the next step is parked.
;
;   The combination of HWSel and HWfun determine the actual power state.  When we transition
;       to a step, HWfun is called with HWSel as the parameter.  Nothing is called if HWfun
;       is 0, or if we are already in that state.  Note that there can be forced transitions
;       that will call HWfun (if it exists) regardless of the current state.
;
;   The limit field is the time before transition to the next step.  It is in units
;       of microseconds and can be from 100 to 3155760000000000 (one century).
;       Leaving the field blank or -1 defaults to a century.
;       A zero indicates that this is an immediate step with no wait
;
;   The TDelay field is only valid for a pmsDelay command and is used to hold off a step down for the time limit.
;       If the limit expires, then we step to TDelay.  A step up takes the next and an explicit down take the down.
;       The limit field must be specified and must be non-zero and not infinite.  Note that TDelay can not
;       transition to park.
;
;
;   The current implementation of the hardware selector for Powerbooks with Intrepid is as follows:
;
;       bits                        meaning
;
;       pmsCngXClk  0x80000000      Change external clock
;       pmsXClk     0x7F000000      External clock frequency
;       pmsCngCPU   0x00800000      Change CPU parameters
;       pmsSync     0x00400000      Make changes synchronously, i.e., spin until delay finished
;       pmsMustCmp  0x00200000      Delay must complete before next change
;       pmsCPU      0x001F0000      CPU frequency
;       pmsCngVolt  0x00008000      Change voltage
;       pmsVoltage  0x00007F00      Voltage
;       pmsPowerID  0x000000FF      Identify power state to HW
;
;		pmsDelay    0xFFFFFFFD		Delayed step, no processor or platform changes.  Timer expiration causes transition to pmsTDelay
;       pmsParkIt   0xFFFFFFFF      Special value to indicate that we are to park
;

;	Rule set for this table (per Keith Cox) [actually these assumptions are for the best case]
;		Operating at F=Full requires V=High
;		Transitioning between F=Qtr and F=Half requires V=High
;		Operating at F=Qtr, Half desirable for V=Low
;		All requests for V=High require a minimum 400s assertion
;		All table entry point require a minimum 400s delay before setting V=Low to guarantee V=High assertion time
;		Operation at F=Qtr requires AAck delay=2
;		Operation at F=Half, Full desirable for AAck delay=0
;		Idle times shorter than 500s should not cause a performance step down

;   StID  Down  Next       SetCMD SetFunc      Limit TDelay

       0     0    10     81400000       1          0         ; pmsIdle:            synchronously set delay_aack to 1 before frequency change
       1     0    11     00000001       1       4600         ; pmsNorm:            5ms limit - 400 mics for transition delay
       2     0    12     00C00002       1          0         ; pmsNormHigh:        synchronously set frequency high
       3     0     2     00800003       1       1000         ; pmsBoost:           1ms
       4     4    20     81400004       1        400         ; pmsLow:             synchronously set delay_aack to 1 before frequency change, guarantee 400us voltage stability
       5     5    13     00400005       1        400         ; pmsHigh:            400 mics settle time - make sure voltage is stable
       6     6    15     00400006       1        400         ; pmsPrepCng:         400 mics settle time - make sure voltage is stable
       7     7    17     00400007       1        400         ; pmsPrepSleep:       400 mics settle time - make sure voltage is stable
       8    19    19     81400008       1        400         ; pmsOverTemp:        synchronously set delay_aack to 1 then go to low power for overtemp, guarantee 400us voltage stability
       9     9    21     81400009       1        400         ; pmsEnterNorm:       synchronously set delay_aack to 1 then go to low power for overtemp, guarantee 400us voltage stability

;   end of required steps

      10     0     1     0081800A       1                    ; pmsIdle2:           no time limit - half frequency - set voltage low

      11    22     2     0000810B       1        400         ; pmsNorm2:           400 mics delay until to allow voltage to rise to high.
      
      12    23    12     8000000C       1                    ; pmsNormHigh2:       no time limit - set delay_aack 0
      
      13    13    14     0040810D       1        400         ; pmsHigh1:           force 400 mic transition
      14    14    14     8080000E       1                    ; pmsHigh2:           Stick in high

      15    15    16     0040810F       1        400         ; pmsPrepCng1:        prepare to change tables - synchronous transition to high power
      16    -1    -1     00C00010       1          0         ; pmsPrepCng2:        Synchronously move high then park
       
      17    17    18     81408111       1        400         ; pmsPrepSleep1:      prepare to sleep by setting delay_aack 1 and voltage high
      18    -1    -1     00C10012       1          0         ; pmsPrepSleep2:      Synchronously move freq to 1/2 then park

;    Over temperature steps

      19    19    19     00818013       1                    ; pmsOverTemp1:       no time limit - half frequency - stay here until pmsEnterNorm invoked
 
 ;	Additional steps
 
      20    20    20     00818014       1                    ; pmsLow2:            Stick in medium forever

      21    21     1     00C18015       1          0         ; pmsEnterNorm2:      Transition back into normal step program

;	Delayed steps - note that an explicit step down and the delayed step could be different.  However, they are the same in this step table

      22     0    11     FFFFFFFD       1        500      0  ; pmsNorm2d:	       Delayed step down.  Freq is medium, voltage on way up, delay until it gets there

      23     0    12     FFFFFFFD       1        500      0  ; pmsNormHigh2d:      Delayed step down.  Freq is high, voltage high, delay entry to idle

