summaryrefslogtreecommitdiffstats
path: root/private/ntos/nthals/halppc/ppc/pxproc.c
blob: 5ec201f3767bbb01392c9f85236396eac1a6e5bc (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*++

Copyright (c) 1991  Microsoft Corporation

Module Name:

    pxproc.c

Abstract:

    Stub functions for UP hals.

Author:

    Ken Reneris (kenr) 22-Jan-1991

Environment:

    Kernel mode only.

Revision History:

    Jim Wooldridge Ported to PowerPC

--*/

#include "halp.h"

UCHAR   HalName[] = "PowerPC HAL";

BOOLEAN
HalpInitMP (
    IN ULONG Phase,
    IN PLOADER_PARAMETER_BLOCK LoaderBlock
    );

extern VOID HalpInitializePciBus (VOID);
VOID HalpInitOtherBuses (VOID);

#ifdef ALLOC_PRAGMA
#pragma alloc_text(INIT,HalpInitMP)
#pragma alloc_text(INIT,HalStartNextProcessor)
#pragma alloc_text(INIT,HalAllProcessorsStarted)
#pragma alloc_text(INIT,HalReportResourceUsage)
#pragma alloc_text(INIT,HalReportResourceUsage)
#pragma alloc_text(INIT,HalpInitOtherBuses)
#endif



BOOLEAN
HalpInitMP (
    IN ULONG Phase,
    IN PLOADER_PARAMETER_BLOCK LoaderBlock
    )
{
    return FALSE;
    // do nothing
}


VOID
HalpResetAllProcessors (
    VOID
    )
{
}


BOOLEAN
HalStartNextProcessor (
    IN PLOADER_PARAMETER_BLOCK LoaderBlock,
    IN PKPROCESSOR_STATE ProcessorState
    )

/*++

Routine Description:

    This function is called to start the next processor.

Arguments:

    LoaderBlock - Supplies a pointer to the loader parameter block.

    ProcessorState - Supplies a pointer to the processor state to be
        used to start the processor.

Return Value:

    If a processor is successfully started, then a value of TRUE is
    returned. Otherwise a value of FALSE is returned. If a value of
    TRUE is returned, then the logical processor number is stored
    in the processor control block specified by the loader block.

--*/

{

    PRESTART_BLOCK NextRestartBlock;
    ULONG Number;
    PKPRCB Prcb;

    //
    // If there is more than one restart block then this is a multi-
    // processor system.
    //
    // N.B. The first restart parameter block must be for the boot master
    //      and must represent logical processor 0.
    //
    // Scan the restart parameter blocks for a processor that is ready,
    // but not running. If a processor is found, then fill in the restart
    // processor state, set the logical processor number, and set start
    // in the boot status.
    //

    NextRestartBlock = SYSTEM_BLOCK->RestartBlock;
    Number = 0;
    while (NextRestartBlock != NULL) {
        if ((NextRestartBlock->BootStatus.ProcessorReady != FALSE) &&
            (NextRestartBlock->BootStatus.ProcessorStart == FALSE)) {
            RtlZeroMemory(&NextRestartBlock->u.Ppc, sizeof(PPC_RESTART_STATE));

            //
            // Set processor start address.
            //

            NextRestartBlock->u.Ppc.Iar = ProcessorState->ContextFrame.Iar;

            //
            // PowerPC linkage conventions pass parameters in registers
            // r.3 thru r.10.  Set all of them to allow as much flexibility
            // to the kernel as possible.
            //

            NextRestartBlock->u.Ppc.IntR3 = ProcessorState->ContextFrame.Gpr3;
            NextRestartBlock->u.Ppc.IntR4 = ProcessorState->ContextFrame.Gpr4;
            NextRestartBlock->u.Ppc.IntR5 = ProcessorState->ContextFrame.Gpr5;
            NextRestartBlock->u.Ppc.IntR6 = ProcessorState->ContextFrame.Gpr6;
            NextRestartBlock->u.Ppc.IntR7 = ProcessorState->ContextFrame.Gpr7;
            NextRestartBlock->u.Ppc.IntR8 = ProcessorState->ContextFrame.Gpr8;
            NextRestartBlock->u.Ppc.IntR9 = ProcessorState->ContextFrame.Gpr9;
            NextRestartBlock->u.Ppc.IntR10 = ProcessorState->ContextFrame.Gpr10;

            Prcb = (PKPRCB)(LoaderBlock->Prcb);
            Prcb->Number = (CCHAR)Number;
            Prcb->RestartBlock = NextRestartBlock;
            NextRestartBlock->BootStatus.ProcessorStart = 1;
            return TRUE;
        }

        Number++;
        NextRestartBlock = NextRestartBlock->NextRestartBlock;
    }

    return FALSE;
}

BOOLEAN
HalAllProcessorsStarted (
    VOID
    )
{
    return TRUE;
}

VOID
HalReportResourceUsage (
    VOID
    )
{
    INTERFACE_TYPE  interfacetype;
    ANSI_STRING     AHalName;
    UNICODE_STRING  UHalName;

    interfacetype = Internal;

    RtlInitAnsiString (&AHalName, HalName);
    RtlAnsiStringToUnicodeString (&UHalName, &AHalName, TRUE);
    HalpReportResourceUsage (
        &UHalName,          // descriptive name
        interfacetype       // device space interface type
    );

    interfacetype = Isa;

    HalpReportResourceUsage (
        &UHalName,          // descriptive name
        interfacetype       // device space interface type
    );

    RtlFreeUnicodeString (&UHalName);

    //
    // Registry is now intialized, see if there are any PCI buses
    //

    HalpInitializePciBus ();

#ifdef POWER_MANAGEMENT
    HalInitSystemPhase2();
#endif
}


VOID
HalpInitOtherBuses (
    VOID
    )
{
    // no other internal buses supported
}