Subversion Repositories HelenOS

Rev

Rev 3742 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3742 Rev 3743
1
/*
1
/*
2
 * Copyright (c) 2005 Martin Decky
2
 * Copyright (c) 2005 Martin Decky
3
 * Copyright (c) 2006 Jakub Jermar
3
 * Copyright (c) 2006 Jakub Jermar
4
 * All rights reserved.
4
 * All rights reserved.
5
 *
5
 *
6
 * Redistribution and use in source and binary forms, with or without
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
7
 * modification, are permitted provided that the following conditions
8
 * are met:
8
 * are met:
9
 *
9
 *
10
 * - Redistributions of source code must retain the above copyright
10
 * - Redistributions of source code must retain the above copyright
11
 *   notice, this list of conditions and the following disclaimer.
11
 *   notice, this list of conditions and the following disclaimer.
12
 * - Redistributions in binary form must reproduce the above copyright
12
 * - Redistributions in binary form must reproduce the above copyright
13
 *   notice, this list of conditions and the following disclaimer in the
13
 *   notice, this list of conditions and the following disclaimer in the
14
 *   documentation and/or other materials provided with the distribution.
14
 *   documentation and/or other materials provided with the distribution.
15
 * - The name of the author may not be used to endorse or promote products
15
 * - The name of the author may not be used to endorse or promote products
16
 *   derived from this software without specific prior written permission.
16
 *   derived from this software without specific prior written permission.
17
 *
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
28
 */
29
 
29
 
30
#include "main.h" 
30
#include "main.h" 
31
#include <printf.h>
31
#include <printf.h>
32
#include "asm.h"
32
#include "asm.h"
33
#include "_components.h"
33
#include "_components.h"
34
#include <balloc.h>
34
#include <balloc.h>
35
#include <ofw.h>
35
#include <ofw.h>
36
#include <ofw_tree.h>
36
#include <ofw_tree.h>
37
#include "ofwarch.h"
37
#include "ofwarch.h"
38
#include <align.h>
38
#include <align.h>
39
#include <string.h>
39
#include <string.h>
40
 
40
 
41
bootinfo_t bootinfo;
41
bootinfo_t bootinfo;
42
 
42
 
43
component_t components[COMPONENTS];
43
component_t components[COMPONENTS];
44
 
44
 
45
char *release = RELEASE;
45
char *release = RELEASE;
46
 
46
 
47
#ifdef REVISION
47
#ifdef REVISION
48
    char *revision = ", revision " REVISION;
48
    char *revision = ", revision " REVISION;
49
#else
49
#else
50
    char *revision = "";
50
    char *revision = "";
51
#endif
51
#endif
52
 
52
 
53
#ifdef TIMESTAMP
53
#ifdef TIMESTAMP
54
    char *timestamp = "\nBuilt on " TIMESTAMP;
54
    char *timestamp = "\nBuilt on " TIMESTAMP;
55
#else
55
#else
56
    char *timestamp = "";
56
    char *timestamp = "";
57
#endif
57
#endif
58
 
58
 
59
/** UltraSPARC subarchitecture - 1 for US, 3 for US3 */
59
/** UltraSPARC subarchitecture - 1 for US, 3 for US3, 0 for other */
60
uint8_t subarchitecture;
60
uint8_t subarchitecture = 0;
61
 
61
 
62
/**
62
/**
63
 * mask of the MID field inside the ICBUS_CONFIG register shifted by
63
 * mask of the MID field inside the ICBUS_CONFIG register shifted by
64
 * MID_SHIFT bits to the right
64
 * MID_SHIFT bits to the right
65
 */
65
 */
66
uint16_t mid_mask;
66
uint16_t mid_mask;
67
 
67
 
68
/** Print version information. */
68
/** Print version information. */
69
static void version_print(void)
69
static void version_print(void)
70
{
70
{
71
    printf("HelenOS SPARC64 Bootloader\nRelease %s%s%s\n"
71
    printf("HelenOS SPARC64 Bootloader\nRelease %s%s%s\n"
72
        "Copyright (c) 2006 HelenOS project\n",
72
        "Copyright (c) 2006 HelenOS project\n",
73
        release, revision, timestamp);
73
        release, revision, timestamp);
74
}
74
}
75
 
75
 
76
/* the lowest ID (read from the VER register) of some US3 CPU model */
76
/* the lowest ID (read from the VER register) of some US3 CPU model */
77
#define FIRST_US3_CPU   0x14
77
#define FIRST_US3_CPU   0x14
78
 
78
 
79
/* the greatest ID (read from the VER register) of some US3 CPU model */
79
/* the greatest ID (read from the VER register) of some US3 CPU model */
80
#define LAST_US3_CPU    0x19
80
#define LAST_US3_CPU    0x19
81
 
81
 
82
/* UltraSPARC IIIi processor implementation code */
82
/* UltraSPARC IIIi processor implementation code */
83
#define US_IIIi_CODE    0x15
83
#define US_IIIi_CODE    0x15
84
 
84
 
-
 
85
/* max. length of the "compatible" property of the root node */
-
 
86
#define COMPATIBLE_PROP_MAXLEN  64
-
 
87
 
-
 
88
/*
-
 
89
 * HelenOS bootloader will use these constants to distinguish particular
-
 
90
 * UltraSPARC architectures
-
 
91
 */
-
 
92
#define COMPATIBLE_SUN4U    10
-
 
93
#define COMPATIBLE_SUN4V    20
-
 
94
 
-
 
95
/** US architecture. COMPATIBLE_SUN4U for sun4v, COMPATIBLE_SUN4V for sun4u */
-
 
96
static uint8_t architecture;
-
 
97
 
85
/**
98
/**
-
 
99
 * Detects the UltraSPARC architecture (sun4u and sun4v currently supported)
-
 
100
 * by inspecting the property called "compatible" in the OBP root node.
-
 
101
 */
-
 
102
static void detect_architecture(void)
-
 
103
{
-
 
104
    phandle root = ofw_find_device("/");
-
 
105
    char compatible[COMPATIBLE_PROP_MAXLEN];
-
 
106
 
-
 
107
    if (ofw_get_property(root, "compatible", compatible,
-
 
108
            COMPATIBLE_PROP_MAXLEN) <= 0) {
-
 
109
        printf("Unable to determine architecture, default: sun4u.\n");
-
 
110
        architecture = COMPATIBLE_SUN4U;
-
 
111
        return;
-
 
112
    }
-
 
113
 
-
 
114
    if (strcmp(compatible, "sun4v") == 0) {
-
 
115
        architecture = COMPATIBLE_SUN4V;
-
 
116
    } else {
-
 
117
        /*
-
 
118
         * As not all sun4u machines have "sun4u" in their "compatible"
-
 
119
         * OBP property (e.g. Serengeti's OBP "compatible" property is
-
 
120
         * "SUNW,Serengeti"), we will by default fallback to sun4u if
-
 
121
         * an unknown value of the "compatible" property is encountered.
-
 
122
         */
-
 
123
        architecture = COMPATIBLE_SUN4U;
-
 
124
    }
-
 
125
}
-
 
126
 
-
 
127
/**
-
 
128
 * Detects the subarchitecture (US, US3) of the sun4u
86
 * Sets the global variables "subarchitecture" and "mid_mask" to
129
 * processor. Sets the global variables "subarchitecture" and "mid_mask" to
87
 * correct values.
130
 * correct values.
88
 */
131
 */
89
static void detect_subarchitecture(void)
132
static void detect_subarchitecture(void)
90
{
133
{
91
    uint64_t v;
134
    uint64_t v;
92
    asm volatile ("rdpr %%ver, %0\n" : "=r" (v));
135
    asm volatile ("rdpr %%ver, %0\n" : "=r" (v));
93
   
136
   
94
    v = (v << 16) >> 48;
137
    v = (v << 16) >> 48;
95
    if ((v >= FIRST_US3_CPU) && (v <= LAST_US3_CPU)) {
138
    if ((v >= FIRST_US3_CPU) && (v <= LAST_US3_CPU)) {
96
        subarchitecture = SUBARCH_US3;
139
        subarchitecture = SUBARCH_US3;
97
        if (v == US_IIIi_CODE)
140
        if (v == US_IIIi_CODE)
98
            mid_mask = (1 << 5) - 1;
141
            mid_mask = (1 << 5) - 1;
99
        else
142
        else
100
            mid_mask = (1 << 10) - 1;
143
            mid_mask = (1 << 10) - 1;
101
    } else if (v < FIRST_US3_CPU) {
144
    } else if (v < FIRST_US3_CPU) {
102
        subarchitecture = SUBARCH_US;
145
        subarchitecture = SUBARCH_US;
103
        mid_mask = (1 << 5) - 1;
146
        mid_mask = (1 << 5) - 1;
104
    } else {
147
    } else {
105
        printf("\nThis CPU is not supported by HelenOS.");
148
        printf("\nThis CPU is not supported by HelenOS.");
106
    }
149
    }
107
}
150
}
108
 
151
 
-
 
152
/**
-
 
153
 * Performs sun4u-specific initialization. The components are expected
-
 
154
 * to be already copied and boot allocator initialized.
-
 
155
 */
-
 
156
static void bootstrap_sun4u(void)
-
 
157
{
-
 
158
    printf("\nCanonizing OpenFirmware device tree...");
-
 
159
    bootinfo.ofw_root = ofw_tree_build();
-
 
160
    printf("done.\n");
-
 
161
 
-
 
162
    detect_subarchitecture();
-
 
163
 
-
 
164
#ifdef CONFIG_SMP
-
 
165
    printf("\nChecking for secondary processors...");
-
 
166
    if (!ofw_cpu())
-
 
167
        printf("Error: unable to get CPU properties\n");
-
 
168
    printf("done.\n");
-
 
169
#endif
-
 
170
 
-
 
171
    setup_palette();
-
 
172
}
-
 
173
 
-
 
174
/**
-
 
175
 * Performs sun4v-specific initialization. The components are expected
-
 
176
 * to be already copied and boot allocator initialized.
-
 
177
 */
-
 
178
static void bootstrap_sun4v(void)
-
 
179
{
-
 
180
}
-
 
181
 
109
void bootstrap(void)
182
void bootstrap(void)
110
{
183
{
111
    void *base = (void *) KERNEL_VIRTUAL_ADDRESS;
184
    void *base = (void *) KERNEL_VIRTUAL_ADDRESS;
112
    void *balloc_base;
185
    void *balloc_base;
113
    unsigned int top = 0;
186
    unsigned int top = 0;
114
    int i, j;
187
    int i, j;
115
 
188
 
116
    version_print();
-
 
117
   
-
 
118
    detect_subarchitecture();
189
    detect_architecture();
119
    init_components(components);
190
    init_components(components);
120
 
191
 
121
    if (!ofw_get_physmem_start(&bootinfo.physmem_start)) {
192
    if (!ofw_get_physmem_start(&bootinfo.physmem_start)) {
122
        printf("Error: unable to get start of physical memory.\n");
193
        printf("Error: unable to get start of physical memory.\n");
123
        halt();
194
        halt();
124
    }
195
    }
125
 
196
 
126
    if (!ofw_memmap(&bootinfo.memmap)) {
197
    if (!ofw_memmap(&bootinfo.memmap)) {
127
        printf("Error: unable to get memory map, halting.\n");
198
        printf("Error: unable to get memory map, halting.\n");
128
        halt();
199
        halt();
129
    }
200
    }
130
 
201
 
131
    if (bootinfo.memmap.total == 0) {
202
    if (bootinfo.memmap.total == 0) {
132
        printf("Error: no memory detected, halting.\n");
203
        printf("Error: no memory detected, halting.\n");
133
        halt();
204
        halt();
134
    }
205
    }
135
 
206
 
136
    /*
207
    /*
137
     * SILO for some reason adds 0x400000 and subtracts
208
     * SILO for some reason adds 0x400000 and subtracts
138
     * bootinfo.physmem_start to/from silo_ramdisk_image.
209
     * bootinfo.physmem_start to/from silo_ramdisk_image.
139
     * We just need plain physical address so we fix it up.
210
     * We just need plain physical address so we fix it up.
140
     */
211
     */
141
    if (silo_ramdisk_image) {
212
    if (silo_ramdisk_image) {
142
        silo_ramdisk_image += bootinfo.physmem_start;
213
        silo_ramdisk_image += bootinfo.physmem_start;
143
        silo_ramdisk_image -= 0x400000;
214
        silo_ramdisk_image -= 0x400000;
144
        /* Install 1:1 mapping for the ramdisk. */
215
        /* Install 1:1 mapping for the ramdisk. */
145
        if (ofw_map((void *)((uintptr_t)silo_ramdisk_image),
216
        if (ofw_map((void *)((uintptr_t)silo_ramdisk_image),
146
            (void *)((uintptr_t)silo_ramdisk_image),
217
            (void *)((uintptr_t)silo_ramdisk_image),
147
            silo_ramdisk_size, -1) != 0) {
218
            silo_ramdisk_size, -1) != 0) {
148
            printf("Failed to map ramdisk.\n");
219
            printf("Failed to map ramdisk.\n");
149
            halt();
220
            halt();
150
        }
221
        }
151
    }
222
    }
152
   
223
   
153
    printf("\nSystem info\n");
224
    printf("\nSystem info\n");
154
    printf(" memory: %dM starting at %P\n",
225
    printf(" memory: %dM starting at %P\n",
155
        bootinfo.memmap.total >> 20, bootinfo.physmem_start);
226
        bootinfo.memmap.total >> 20, bootinfo.physmem_start);
156
 
227
 
157
    printf("\nMemory statistics\n");
228
    printf("\nMemory statistics\n");
158
    printf(" kernel entry point at %P\n", KERNEL_VIRTUAL_ADDRESS);
229
    printf(" kernel entry point at %P\n", KERNEL_VIRTUAL_ADDRESS);
159
    printf(" %P: boot info structure\n", &bootinfo);
230
    printf(" %P: boot info structure\n", &bootinfo);
160
   
231
   
161
    /*
232
    /*
162
     * Figure out destination address for each component.
233
     * Figure out destination address for each component.
163
     * In this phase, we don't copy the components yet because we want to
234
     * In this phase, we don't copy the components yet because we want to
164
     * to be careful not to overwrite anything, especially the components
235
     * to be careful not to overwrite anything, especially the components
165
     * which haven't been copied yet.
236
     * which haven't been copied yet.
166
     */
237
     */
167
    bootinfo.taskmap.count = 0;
238
    bootinfo.taskmap.count = 0;
168
    for (i = 0; i < COMPONENTS; i++) {
239
    for (i = 0; i < COMPONENTS; i++) {
169
        printf(" %P: %s image (size %d bytes)\n", components[i].start,
240
        printf(" %P: %s image (size %d bytes)\n", components[i].start,
170
            components[i].name, components[i].size);
241
            components[i].name, components[i].size);
171
        top = ALIGN_UP(top, PAGE_SIZE);
242
        top = ALIGN_UP(top, PAGE_SIZE);
172
        if (i > 0) {
243
        if (i > 0) {
173
            if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
244
            if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
174
                printf("Skipping superfluous components.\n");
245
                printf("Skipping superfluous components.\n");
175
                break;
246
                break;
176
            }
247
            }
177
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
248
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
178
                base + top;
249
                base + top;
179
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
250
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
180
                components[i].size;
251
                components[i].size;
181
            bootinfo.taskmap.count++;
252
            bootinfo.taskmap.count++;
182
        }
253
        }
183
        top += components[i].size;
254
        top += components[i].size;
184
    }
255
    }
185
 
256
 
186
    j = bootinfo.taskmap.count - 1; /* do not consider ramdisk */
257
    j = bootinfo.taskmap.count - 1; /* do not consider ramdisk */
187
 
258
 
188
    if (silo_ramdisk_image) {
259
    if (silo_ramdisk_image) {
189
        /* Treat the ramdisk as the last bootinfo task. */
260
        /* Treat the ramdisk as the last bootinfo task. */
190
        if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
261
        if (bootinfo.taskmap.count == TASKMAP_MAX_RECORDS) {
191
            printf("Skipping ramdisk.\n");
262
            printf("Skipping ramdisk.\n");
192
            goto skip_ramdisk;
263
            goto skip_ramdisk;
193
        }
264
        }
194
        top = ALIGN_UP(top, PAGE_SIZE);
265
        top = ALIGN_UP(top, PAGE_SIZE);
195
        bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
266
        bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
196
            base + top;
267
            base + top;
197
        bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
268
        bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
198
            silo_ramdisk_size;
269
            silo_ramdisk_size;
199
        bootinfo.taskmap.count++;
270
        bootinfo.taskmap.count++;
200
        printf("\nCopying ramdisk...");
271
        printf("\nCopying ramdisk...");
201
        /*
272
        /*
202
         * Claim and map the whole ramdisk as it may exceed the area
273
         * Claim and map the whole ramdisk as it may exceed the area
203
         * given to us by SILO.
274
         * given to us by SILO.
204
         */
275
         */
205
        (void) ofw_claim_phys(base + top, silo_ramdisk_size);
276
        (void) ofw_claim_phys(base + top, silo_ramdisk_size);
206
        (void) ofw_map(base + top, base + top, silo_ramdisk_size, -1);
277
        (void) ofw_map(base + top, base + top, silo_ramdisk_size, -1);
207
        memmove(base + top, (void *)((uintptr_t)silo_ramdisk_image),
278
        memmove(base + top, (void *)((uintptr_t)silo_ramdisk_image),
208
            silo_ramdisk_size);
279
            silo_ramdisk_size);
209
        printf("done.\n");
280
        printf("done.\n");
210
        top += silo_ramdisk_size;
281
        top += silo_ramdisk_size;
211
    }
282
    }
212
skip_ramdisk:
283
skip_ramdisk:
213
 
284
 
214
    /*
285
    /*
215
     * Now we can proceed to copy the components. We do it in reverse order
286
     * Now we can proceed to copy the components. We do it in reverse order
216
     * so that we don't overwrite anything even if the components overlap
287
     * so that we don't overwrite anything even if the components overlap
217
     * with base.
288
     * with base.
218
     */
289
     */
219
    printf("\nCopying bootinfo tasks\n");
290
    printf("\nCopying bootinfo tasks\n");
220
    for (i = COMPONENTS - 1; i > 0; i--, j--) {
291
    for (i = COMPONENTS - 1; i > 0; i--, j--) {
221
        printf(" %s...", components[i].name);
292
        printf(" %s...", components[i].name);
222
 
293
 
223
        /*
294
        /*
224
         * At this point, we claim the physical memory that we are
295
         * At this point, we claim the physical memory that we are
225
         * going to use. We should be safe in case of the virtual
296
         * going to use. We should be safe in case of the virtual
226
         * address space because the OpenFirmware, according to its
297
         * address space because the OpenFirmware, according to its
227
         * SPARC binding, should restrict its use of virtual memory
298
         * SPARC binding, should restrict its use of virtual memory
228
         * to addresses from [0xffd00000; 0xffefffff] and
299
         * to addresses from [0xffd00000; 0xffefffff] and
229
         * [0xfe000000; 0xfeffffff].
300
         * [0xfe000000; 0xfeffffff].
230
         *
301
         *
231
         * XXX We don't map this piece of memory. We simply rely on
302
         * XXX We don't map this piece of memory. We simply rely on
232
         *     SILO to have it done for us already in this case.
303
         *     SILO to have it done for us already in this case.
233
         */
304
         */
234
        (void) ofw_claim_phys(bootinfo.physmem_start +
305
        (void) ofw_claim_phys(bootinfo.physmem_start +
235
            bootinfo.taskmap.tasks[j].addr,
306
            bootinfo.taskmap.tasks[j].addr,
236
            ALIGN_UP(components[i].size, PAGE_SIZE));
307
            ALIGN_UP(components[i].size, PAGE_SIZE));
237
           
308
           
238
        memcpy((void *)bootinfo.taskmap.tasks[j].addr,
309
        memcpy((void *)bootinfo.taskmap.tasks[j].addr,
239
            components[i].start, components[i].size);
310
            components[i].start, components[i].size);
240
        printf("done.\n");
311
        printf("done.\n");
241
    }
312
    }
242
 
313
 
243
    printf("\nCopying kernel...");
314
    printf("\nCopying kernel...");
244
    (void) ofw_claim_phys(bootinfo.physmem_start + base,
315
    (void) ofw_claim_phys(bootinfo.physmem_start + base,
245
        ALIGN_UP(components[0].size, PAGE_SIZE));
316
        ALIGN_UP(components[0].size, PAGE_SIZE));
246
    memcpy(base, components[0].start, components[0].size);
317
    memcpy(base, components[0].start, components[0].size);
247
    printf("done.\n");
318
    printf("done.\n");
248
 
319
 
249
    /*
320
    /*
250
     * Claim and map the physical memory for the boot allocator.
321
     * Claim and map the physical memory for the boot allocator.
251
     * Initialize the boot allocator.
322
     * Initialize the boot allocator.
252
     */
323
     */
253
    balloc_base = base + ALIGN_UP(top, PAGE_SIZE);
324
    balloc_base = base + ALIGN_UP(top, PAGE_SIZE);
254
    (void) ofw_claim_phys(bootinfo.physmem_start + balloc_base,
325
    (void) ofw_claim_phys(bootinfo.physmem_start + balloc_base,
255
        BALLOC_MAX_SIZE);
326
        BALLOC_MAX_SIZE);
256
    (void) ofw_map(balloc_base, balloc_base, BALLOC_MAX_SIZE, -1);
327
    (void) ofw_map(balloc_base, balloc_base, BALLOC_MAX_SIZE, -1);
257
    balloc_init(&bootinfo.ballocs, (uintptr_t)balloc_base);
328
    balloc_init(&bootinfo.ballocs, (uintptr_t)balloc_base);
258
 
329
 
259
    printf("\nCanonizing OpenFirmware device tree...");
330
    /* perform architecture-specific initialization */
260
    bootinfo.ofw_root = ofw_tree_build();
331
    if (architecture == COMPATIBLE_SUN4U) {
261
    printf("done.\n");
332
        bootstrap_sun4u();
262
 
-
 
263
#ifdef CONFIG_SMP
-
 
264
    printf("\nChecking for secondary processors...");
333
    } else if (architecture == COMPATIBLE_SUN4V) {
265
    if (!ofw_cpu())
334
        bootstrap_sun4v();
266
        printf("Error: unable to get CPU properties\n");
335
    } else {
267
    printf("done.\n");
336
        printf("Unknown architecture.\n");
268
#endif
337
        halt();
269
 
338
    }
270
    setup_palette();
-
 
271
 
339
 
272
    printf("\nBooting the kernel...\n");
340
    printf("\nBooting the kernel...\n");
273
    jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
341
    jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
274
        bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,
342
        bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,
275
        sizeof(bootinfo));
343
        sizeof(bootinfo));
276
}
344
}
277
 
345
 
278
 
346