summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halvict/ppc/pxidle.c
blob: 55114b480c52a1267566ab903a79e5e050609023 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*++
TITLE("Processor Idle")


Copyright (c) 1994  Microsoft Corporation

Module Name:

  pxidle.c

abstract:

  This module implements system platform dependent power management
  support.

Author:

   Jim Wooldridge

Environment:

    Kernel mode only.

Revision History:

--*/

#include "halp.h"
#include "pxmp.h"


VOID
HalProcessorIdle(
    VOID
    )

/*++

 Routine Description:

    This function is called when the current processor is idle with
    interrupts disabled. There is no thread active and there are no
    DPCs to process. Therefore, power can be switched to a standby
    mode until the the next interrupt occurs on the current processor.

    N.B. This routine is entered with EE in MSR clear. This routine
         must do any power management enabling necessary, set the EE
         bit in MSR, then either return or wait for an interrupt.

 Arguments:

    None.

 Return Value:

    None.


--*/

{
    //
    // If this processor is newly IDLE, drop the MPIC TaskPriority register
    // for this processor to 0 to make it a desirable target for interrupts.
    //

    if ( HALPCR->HardPriority ) {
        HALPCR->MpicProcessorBase->TaskPriority = 0;
        HALPCR->HardPriority = 0;
    }

#ifdef POWER_MANAGEMENT

    if(HalpProcessorIdleEx != NULL) {
        HalpProcessorIdleEx();
    } else {
        HalpProcessorIdle();
    }
    
#else

    HalpEnableInterrupts();

#endif // POWER_MANAGEMENT
}