summaryrefslogtreecommitdiffstats
path: root/private/ntos/fw/mips/jzsetup.c
blob: 15583e79409bce5eda3f69d5e45764a4c6aec36d (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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
/*++

Copyright (c) 1991, 1992  Microsoft Corporation

Module Name:

    jzsetup.c

Abstract:

    This program loads up the Jazz non-volatile ram.

Author:

    David M. Robinson (davidro) 9-Aug-1991

Revision History:

--*/

#include "jzsetup.h"

//
// Routine prototypes.
//

BOOLEAN
JzInitializationMenu(
    VOID
    );

VOID
JzBootMenu(
    VOID
    );

VOID
JzEnvironmentMenu(
    VOID
    );

//
// Static data.
//

ULONG ScsiHostId;
PCHAR Banner1 = " JAZZ Setup Program Version 0.17";
PCHAR Banner2 = " Copyright (c) 1993 Microsoft Corporation";


ULONG
JzInitializeScsiHostId (
    VOID
    )

/*++

Routine Description:

    This routine gets the ScsiHostId from the configuration database if if
    exists.

Arguments:

    None.

Return Value:

    The ScsiHostId is read from the ScsiController configuration component
    if it exists.  If not, a value of 7 is returned.

--*/
{
    PCONFIGURATION_COMPONENT Component;
    PCM_SCSI_DEVICE_DATA ScsiDeviceData;
    UCHAR Buffer[sizeof(CM_PARTIAL_RESOURCE_LIST) +
                 (sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * 5) +
                 sizeof(CM_SCSI_DEVICE_DATA)];
    PCM_PARTIAL_RESOURCE_LIST Descriptor = (PCM_PARTIAL_RESOURCE_LIST)&Buffer;
    ULONG Count;

    if (((Component = ArcGetComponent("scsi(0)")) != NULL) &&
        (Component->Class == AdapterClass) && (Component->Type == ScsiAdapter) &&
        (ArcGetConfigurationData((PVOID)Descriptor, Component) == ESUCCESS) &&
        ((Count = Descriptor->Count) < 6)) {

        ScsiDeviceData = (PCM_SCSI_DEVICE_DATA)&Descriptor->PartialDescriptors[Count];

        if (ScsiDeviceData->HostIdentifier > 7) {
            return(7);
        } else {
            return(ScsiDeviceData->HostIdentifier);
        }
    }

    return(7);

}

VOID
JzSetup (
    VOID
    )

/*++

Routine Description:

    This routine is the top level of the setup program.

Arguments:

    None.

Return Value:

    None.

--*/
{
    BOOLEAN Reboot;
    LONG DefaultChoice = 0;

    //
    // Setup is running.
    //

    SetupIsRunning = TRUE;

    //
    // Initialize the ScsiHostId Value.
    //

    ScsiHostId = JzInitializeScsiHostId();

    //
    // Set up the screen.
    //

    JzSetScreenAttributes( TRUE, FALSE, FALSE);
    JzSetScreenColor(ArcColorWhite, ArcColorBlue);

    //
    // Loop on choices until exit is selected.
    //

    Reboot = FALSE;

    while (TRUE) {

        DefaultChoice = JzGetSelection(JzSetupChoices,
                                       NUMBER_OF_JZ_SETUP_CHOICES,
                                       DefaultChoice);

        //
        // If the escape key was pressed, exit.
        //

        if (DefaultChoice == -1) {
            DefaultChoice = 0x7fffffff;
        }

        //
        // Switch based on the action.
        //

        switch (DefaultChoice) {

        //
        // Change or initialize the configuration.
        //

        case 0:
	    Reboot = Reboot || JzInitializationMenu();
            break;

        //
        // Manage the boot process.
        //

        case 1:
            JzBootMenu();
            break;

        //
        // Exit.
        //

        default:
            if (Reboot) {
                ArcReboot();
            }
            return;
        }
    }
}

BOOLEAN
JzInitializationMenu(
    VOID
    )
/*++

Routine Description:

    This routine displays the configuration menu.

Arguments:

    None.

Return Value:

    If a system reboot is required, TRUE is returned, otherwise FALSE is
    returned.

--*/
{

    BOOLEAN Reboot;
    LONG DefaultChoice = 0;

    //
    // Loop on choices until exit is selected.
    //

    Reboot = FALSE;

    while (TRUE) {

        DefaultChoice = JzGetSelection(ConfigurationChoices,
                                       NUMBER_OF_CONFIGURATION_CHOICES,
                                       DefaultChoice);

        //
        // If the escape key was pressed, return.
        //

        if (DefaultChoice == -1) {
            DefaultChoice = 0x7fffffff;
        }

        //
        // Switch based on the action.
        //

        switch (DefaultChoice) {

        //
        // Load default configuration.
        //

        case 0:
            Reboot = Reboot || JzMakeDefaultConfiguration();
            break;

        //
        // Load default environment.
        //

        case 1:
            JzMakeDefaultEnvironment();
            break;


        //
        // Edit an environment variable
        //
        case 2:
            JzEditVariable();
            break;

        //
        // Set the RTC.
        //

        case 3:
            JzSetTime();
            break;

        //
        // Change the ethernet address.
        //

        case 4:
            JzSetEthernet();
            break;

        //
        // Run the debug monitor.
        //

        case 5:
            SetupIsRunning = FALSE;
            ArcEnterInteractiveMode();
            SetupIsRunning = TRUE;
            break;

        //
        // Return to main menu.
        //

        default:
            return(Reboot);
        }
    }
}