Subversion Repositories HelenOS

Rev

Rev 3684 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3684 Rev 4377
Line 34... Line 34...
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 <macros.h>
39
#include <string.h>
40
#include <string.h>
40
 
41
 
41
bootinfo_t bootinfo;
42
bootinfo_t bootinfo;
42
 
43
 
43
component_t components[COMPONENTS];
44
component_t components[COMPONENTS];
44
 
45
 
45
char *release = RELEASE;
46
char *release = STRING(RELEASE);
46
 
47
 
47
#ifdef REVISION
48
#ifdef REVISION
48
    char *revision = ", revision " REVISION;
49
    char *revision = ", revision " STRING(REVISION);
49
#else
50
#else
50
    char *revision = "";
51
    char *revision = "";
51
#endif
52
#endif
52
 
53
 
53
#ifdef TIMESTAMP
54
#ifdef TIMESTAMP
54
    char *timestamp = "\nBuilt on " TIMESTAMP;
55
    char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
55
#else
56
#else
56
    char *timestamp = "";
57
    char *timestamp = "";
57
#endif
58
#endif
58
 
59
 
59
/** UltraSPARC subarchitecture - 1 for US, 3 for US3 */
60
/** UltraSPARC subarchitecture - 1 for US, 3 for US3 */
Line 140... Line 141...
140
     */
141
     */
141
    if (silo_ramdisk_image) {
142
    if (silo_ramdisk_image) {
142
        silo_ramdisk_image += bootinfo.physmem_start;
143
        silo_ramdisk_image += bootinfo.physmem_start;
143
        silo_ramdisk_image -= 0x400000;
144
        silo_ramdisk_image -= 0x400000;
144
        /* Install 1:1 mapping for the ramdisk. */
145
        /* Install 1:1 mapping for the ramdisk. */
145
        if (ofw_map((void *)((uintptr_t)silo_ramdisk_image),
146
        if (ofw_map((void *)((uintptr_t) silo_ramdisk_image),
146
            (void *)((uintptr_t)silo_ramdisk_image),
147
            (void *)((uintptr_t) silo_ramdisk_image),
147
            silo_ramdisk_size, -1) != 0) {
148
            silo_ramdisk_size, -1) != 0) {
148
            printf("Failed to map ramdisk.\n");
149
            printf("Failed to map ramdisk.\n");
149
            halt();
150
            halt();
150
        }
151
        }
151
    }
152
    }
Line 176... Line 177...
176
            }
177
            }
177
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
178
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr =
178
                base + top;
179
                base + top;
179
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
180
            bootinfo.taskmap.tasks[bootinfo.taskmap.count].size =
180
                components[i].size;
181
                components[i].size;
-
 
182
            strncpy(bootinfo.taskmap.tasks[
-
 
183
                bootinfo.taskmap.count].name, components[i].name,
-
 
184
                BOOTINFO_TASK_NAME_BUFLEN);
181
            bootinfo.taskmap.count++;
185
            bootinfo.taskmap.count++;
182
        }
186
        }
183
        top += components[i].size;
187
        top += components[i].size;
184
    }
188
    }
185
 
189
 
Line 201... Line 205...
201
        /*
205
        /*
202
         * Claim and map the whole ramdisk as it may exceed the area
206
         * Claim and map the whole ramdisk as it may exceed the area
203
         * given to us by SILO.
207
         * given to us by SILO.
204
         */
208
         */
205
        (void) ofw_claim_phys(base + top, silo_ramdisk_size);
209
        (void) ofw_claim_phys(base + top, silo_ramdisk_size);
206
        (void) ofw_map(base + top, base + top, silo_ramdisk_size, -1);
210
        (void) ofw_map(bootinfo.physmem_start + base + top, base + top,
-
 
211
            silo_ramdisk_size, -1);
207
        memmove(base + top, (void *)((uintptr_t)silo_ramdisk_image),
212
        memmove(base + top, (void *)((uintptr_t)silo_ramdisk_image),
208
            silo_ramdisk_size);
213
            silo_ramdisk_size);
209
        printf("done.\n");
214
        printf("done.\n");
210
        top += silo_ramdisk_size;
215
        top += silo_ramdisk_size;
211
    }
216
    }
Line 251... Line 256...
251
     * Initialize the boot allocator.
256
     * Initialize the boot allocator.
252
     */
257
     */
253
    balloc_base = base + ALIGN_UP(top, PAGE_SIZE);
258
    balloc_base = base + ALIGN_UP(top, PAGE_SIZE);
254
    (void) ofw_claim_phys(bootinfo.physmem_start + balloc_base,
259
    (void) ofw_claim_phys(bootinfo.physmem_start + balloc_base,
255
        BALLOC_MAX_SIZE);
260
        BALLOC_MAX_SIZE);
256
    (void) ofw_map(balloc_base, balloc_base, BALLOC_MAX_SIZE, -1);
261
    (void) ofw_map(bootinfo.physmem_start + balloc_base, balloc_base,
-
 
262
        BALLOC_MAX_SIZE, -1);
257
    balloc_init(&bootinfo.ballocs, (uintptr_t)balloc_base);
263
    balloc_init(&bootinfo.ballocs, (uintptr_t)balloc_base);
258
 
264
 
259
    printf("\nCanonizing OpenFirmware device tree...");
265
    printf("\nCanonizing OpenFirmware device tree...");
260
    bootinfo.ofw_root = ofw_tree_build();
266
    bootinfo.ofw_root = ofw_tree_build();
261
    printf("done.\n");
267
    printf("done.\n");
262
 
268
 
263
#ifdef CONFIG_SMP
269
#ifdef CONFIG_AP
264
    printf("\nChecking for secondary processors...");
270
    printf("\nChecking for secondary processors...");
265
    if (!ofw_cpu())
271
    if (!ofw_cpu())
266
        printf("Error: unable to get CPU properties\n");
272
        printf("Error: unable to get CPU properties\n");
267
    printf("done.\n");
273
    printf("done.\n");
268
#endif
274
#endif
269
 
275
 
270
    setup_palette();
276
    ofw_setup_palette();
271
 
277
 
272
    printf("\nBooting the kernel...\n");
278
    printf("\nBooting the kernel...\n");
273
    jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
279
    jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
274
        bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,
280
        bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,
275
        sizeof(bootinfo));
281
        sizeof(bootinfo));
276
}
282
}
277
 
-