Subversion Repositories HelenOS

Rev

Rev 4031 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2511 vana 1
/*
2
 * Copyright (c) 2005 Martin Decky
3883 decky 3
 * Copyright (c) 2006 Jakub Jermar
2511 vana 4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * are met:
9
 *
10
 * - Redistributions of source code must retain the above copyright
11
 *   notice, this list of conditions and the following disclaimer.
12
 * - Redistributions in binary form must reproduce the above copyright
13
 *   notice, this list of conditions and the following disclaimer in the
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
16
 *   derived from this software without specific prior written permission.
17
 *
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
20
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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
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
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 */
29
 
30
#include "main.h" 
31
#include <printf.h>
32
#include "asm.h"
33
#include "_components.h"
34
#include <align.h>
35
#include <balloc.h>
3883 decky 36
#include <macros.h>
4031 svoboda 37
#include <string.h>
2511 vana 38
 
3578 vana 39
extern bootinfo_t binfo;
2511 vana 40
component_t components[COMPONENTS];
41
 
3883 decky 42
char *release = STRING(RELEASE);
2511 vana 43
 
44
void write(const char *str, const int len)
45
{
46
    return;
47
}
48
 
3775 jermar 49
#define DEFAULT_MEMORY_BASE     0x4000000
50
#define DEFAULT_MEMORY_SIZE     0x4000000
51
#define DEFAULT_LEGACY_IO_BASE      0x00000FFFFC000000 
52
#define DEFAULT_LEGACY_IO_SIZE      0x4000000 
2511 vana 53
 
3775 jermar 54
#define DEFAULT_FREQ_SCALE      0x0000000100000001 /* 1/1 */
55
#define DEFAULT_SYS_FREQ        100000000 /* 100MHz */
3661 vana 56
 
2511 vana 57
#ifdef REVISION
3883 decky 58
    char *revision = ", revision " STRING(REVISION);
2511 vana 59
#else
60
    char *revision = "";
61
#endif
62
 
63
#ifdef TIMESTAMP
3883 decky 64
    char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
2511 vana 65
#else
66
    char *timestamp = "";
67
#endif
68
 
69
/** Print version information. */
70
static void version_print(void)
71
{
3775 jermar 72
    printf("HelenOS IA64 Bootloader\nRelease %s%s%s\n"
73
        "Copyright (c) 2006 HelenOS project\n", release, revision,
74
        timestamp);
2511 vana 75
}
76
 
77
void bootstrap(void)
78
{
79
    int ii;
3775 jermar 80
    bootinfo_t *bootinfo = &binfo;
2511 vana 81
 
82
    version_print();
83
 
84
    init_components(components);
85
 
86
    printf("\nSystem info\n");
87
    printf("\nMemory statistics\n");
88
    printf(" %P: boot info structure\n", &bootinfo);
89
 
90
    unsigned int i;
91
    for (i = 0; i < COMPONENTS; i++)
92
        printf(" %P: %s image (size %d bytes)\n", components[i].start,
93
            components[i].name, components[i].size);
94
 
3775 jermar 95
    if (!bootinfo->hello_configured) {
3661 vana 96
        /*
3775 jermar 97
         * Load configuration defaults for simulators.
3661 vana 98
         */
3775 jermar 99
         bootinfo->memmap_items = 0;
3661 vana 100
 
3775 jermar 101
         bootinfo->memmap[bootinfo->memmap_items].base =
102
             DEFAULT_MEMORY_BASE;
103
         bootinfo->memmap[bootinfo->memmap_items].size =
104
             DEFAULT_MEMORY_SIZE;
105
         bootinfo->memmap[bootinfo->memmap_items].type =
106
             EFI_MEMMAP_FREE_MEM;
3661 vana 107
         bootinfo->memmap_items++;
2511 vana 108
 
3775 jermar 109
         bootinfo->memmap[bootinfo->memmap_items].base =
110
             DEFAULT_LEGACY_IO_BASE;
111
         bootinfo->memmap[bootinfo->memmap_items].size =
112
             DEFAULT_LEGACY_IO_SIZE;
113
         bootinfo->memmap[bootinfo->memmap_items].type =
114
             EFI_MEMMAP_IO_PORTS;
3661 vana 115
         bootinfo->memmap_items++;
116
 
117
         bootinfo->freq_scale = DEFAULT_FREQ_SCALE;
118
         bootinfo->sys_freq = DEFAULT_SYS_FREQ;
119
    }
120
 
3578 vana 121
    bootinfo->taskmap.count = 0;
2511 vana 122
    for (i = 0; i < COMPONENTS; i++) {
123
        if (i > 0) {
3775 jermar 124
            bootinfo->taskmap.tasks[bootinfo->taskmap.count].addr =
125
                components[i].start;
126
            bootinfo->taskmap.tasks[bootinfo->taskmap.count].size =
127
                components[i].size;
4031 svoboda 128
            strncpy(bootinfo->taskmap.tasks[
129
                bootinfo->taskmap.count].name,
130
                components[i].name, BOOTINFO_TASK_NAME_BUFLEN);
3578 vana 131
            bootinfo->taskmap.count++;
2511 vana 132
        }
133
    }
134
 
3578 vana 135
    jump_to_kernel(bootinfo);
2511 vana 136
}
137