;	File: $Id: PBG4_5_8+5_9Best.txt,v 1.9 2005/09/17 00:09:35 raddog Exp $
;
;	$Log: PBG4_5_8+5_9Best.txt,v $
;	Revision 1.9  2005/09/17 00:09:35  raddog
;	Set voltage high, frequency 1/2 for sleep for compatibility with hibernation
;	
;	Revision 1.8  2005/09/06 17:32:31  raddog
;	Keith Cox 'NuBest' stepper table
;	
;	Revision 1.7  2005/09/02 21:50:51  raddog
;	Latest stepper tables from Keith Cox
;	
;	Revision 1.6  2005/08/31 23:39:46  raddog
;	Keith Cox's modified best file - IdleQtr 5ms.txt
;	
;	Revision 1.5  2005/08/17 22:46:17  raddog
;	[4220506]stepper tweak
;	
;	Revision 1.4  2005/08/17 18:33:35  raddog
;	[4219960]improve overtemp behavior, [4210384]downstep voltage protection
;	
;	Revision 1.3  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.2  2005/07/25 21:13:24  raddog
;	[4192395]Q16C/Q41C Stepper control
;	
;	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)
;		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 400µs assertion
;		All table entry point require a minimum 400µs 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 500µs should not cause a performance step down

;   StID  Down  Next       SetCMD SetFunc      Limit TDelay

       0     0    10     82400000       1          0         ; pmsIdle:      	   synchronously set delay_aack to 2 before frequency change
       1     0    13     00000001       1        400         ; pmsNorm:            400 mics settle time - make sure voltage is low
       2    40     2     00800002       1                    ; pmsNormHigh:        no time limit
       3     0     2     00800003       1       1000         ; pmsBoost:     	   1ms
       4     4    18     00400004       1        400         ; pmsLow:             400 mics settle time - make sure voltage is stable
       5     5    20     00400005       1        400         ; pmsHigh:            400 mics settle time - make sure voltage is stable
       6     6    22     00400006       1        400         ; pmsPrepCng:         400 mics settle time - make sure voltage is stable
       7     7    24     00400007       1        400         ; pmsPrepSleep:       400 mics settle time - make sure voltage is stable
       8     8    26     00400008       1        400         ; pmsOverTemp:        400 mics settle time - make sure voltage is stable
       9     9    11     00400009       1        400         ; pmsEnterNorm:       400 mics settle time - make sure voltage is stable

;   end of required steps

      10     0     1     0082800A       1                    ; pmsIdle2:     	   no time limit - quarter frequency - set voltage low

      11    11    12     8240810B       1        400         ; pmsEnterNorm1:      synchronously set delay_aack to 2 before frequency change, set voltage high for potential transition
      12    12     1     00C2800C       1          0         ; pmsEnterNorm2:      Transition back into normal step program

      13    35    14     0000810D       1        400         ; pmsNorm2:           400 mics delay until to allow voltage to rise to high.
      14     0    15     00C1800E       1          0         ; pmsNorm3:           Synchronously set medium and voltage back to low
      15    36    16     8000000F       1        400         ; pmsNorm4:           Set delay_aack to 0 after frequency change, delay for 400 mics for voltage settling guarantee
      16    37    17     00000010       1       3750         ; pmsNorm5:           3.75ms
      17    39     2     00008111       1        400         ; pmsNorm6:           400 mics settle time - set voltage back to high for step to high

      18    18    19     82408112       1        400         ; pmsLow1:            synchronously set delay_aack to 2 before frequency change, set voltage high for potential transition
      19    19    19     00828013       1                    ; pmsLow2:            Stick in low forever

      20    20    21     00408114       1        400         ; pmsHigh1:           force 400 mic transition
      21    21    21     80800015       1                    ; pmsHigh2:           Stick in high
       
      22    22    23     00408116       1        400         ; pmsPrepCng1:        prepare to change tables - synchronous transition to high power
      23    -1    -1     00C00017       1          0         ; pmsPrepCng2:        Synchronously move high then park
       
      24    24    25     00408118       1        400         ; pmsPrepSleep1:      prepare to sleep by moving voltage high
      25    -1    -1     00C10019       1          0         ; pmsPrepSleep2:      Synchronously move freq to 1/2 then park

;    Over temperature steps - go first to low power to establish a known state (since we may not know previous state)
;		Then operate normally (idle low, run medium) for duration of overtemp

      26    26    27     8240811A       1        400         ; pmsOverTemp1:       synchronously set delay_aack to 2 before frequency change
      27    27    28     00C2801B       1          0         ; pmsOverTemp2:       synchronously set frequency f/4, voltage low
      28    28    29     8240001C       1          0         ; pmsOverTempIdle:    synchronously set delay_aack to 2 before frequency change
      29    28    30     0082801D       1                    ; pmsOverTempIdle1:   no time limit - synchronously set frequency f/4, voltage low
      30    28    31     0000001E       1        400         ; pmsOverTempNorm:    100us limit
      31    41    32     0000811F       1        400         ; pmsOverTempNorm2:   400 mics delay until to allow voltage to rise to high.
      32    28    33     00C18020       1          0         ; pmsOverTempNorm3:   Synchronously set medium and voltage back to low
      33    42    34     80000021       1        400         ; pmsOverTempNorm4:   Set delay_aack to 0 after frequency change, no time limit
      34    43    34     00000022       1                    ; pmsOverTempNorm5:   half performance forever

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

      35     0    13     FFFFFFFD       1        400      0  ; pmsNorm2d:          Delayed step down.  Freq is slow, voltage on way up, delay until it gets there

      36    37    15     FFFFFFFD       1        400     37  ; pmsNorm4d:          Delayed step down.  Freq is medium, voltage on way down, delay until it gets there

      37     0    38     00408125       1          0         ; pmsNorm5d:          Freq is medium, voltage low, start move to high before we slow down
      38     0    13     FFFFFFFD       1        500      0  ; pmsNorm5d2:         Delayed step down.  Freq is medium, voltage low, move high before we go slow

      39     0    17     FFFFFFFD       1        500      0  ; pmsNorm6d:          Delayed step down.  Freq is medium, voltage on way up, delay until it gets there

      40     0     2     FFFFFFFD       1        500      0  ; pmsNormHighd:       Delayed step down.  Freq is high, voltage high, delay entry to idle

;  overtemp delayed steps
      41    28    31     FFFFFFFD       1        400     28  ; pmsOverTempNorm2d:  Delayed step down.  Freq is slow, voltage on way up, delay until it gets there
      42    43    33     FFFFFFFD       1        400     43  ; pmsOverTempNorm4d:  Delayed step down.  Freq is slow, voltage on way up, delay until it gets there
      43    28    44     0040812B       1          0         ; pmsOverTempNorm5d:  Freq is medium, voltage low, start move to high before we slow down
      44    28    31     FFFFFFFD       1        500     28  ; pmsOverTempNorm5d2: Delayed step down.  Freq is medium, voltage low, move high before we go slow
