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
|
/*
* Creation Date: <2004/08/28 18:38:22 greg>
* Time-stamp: <2004/08/28 18:38:22 greg>
*
* <init.c>
*
* Initialization for briq
*
* Copyright (C) 2004 Greg Watson
*
* based on mol/init.c:
*
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Samuel & David Rydh
* (samuel@ibrium.se, dary@lindesign.se)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*/
#include "config.h"
#include "libopenbios/bindings.h"
#include "openbios/nvram.h"
#include "briq/briq.h"
#include "libopenbios/ofmem.h"
#include "openbios-version.h"
extern void unexpected_excep( int vector );
extern void setup_timers( void );
#if 0
int
get_bool_res( const char *res )
{
char buf[8], *p;
p = BootHGetStrRes( res, buf, sizeof(buf) );
if( !p )
return -1;
if( !strcasecmp(p,"true") || !strcasecmp(p,"yes") || !strcasecmp(p,"1") )
return 1;
return 0;
}
#endif
void
unexpected_excep( int vector )
{
printk("briQ panic: Unexpected exception %x\n", vector );
for( ;; )
;
}
uint32_t isa_io_base;
void
entry( void )
{
isa_io_base = 0x80000000;
printk("\n");
printk("=============================================================\n");
printk(PROGRAM_NAME " " OPENBIOS_VERSION_STR " [%s]\n",
OPENBIOS_BUILD_DATE);
ofmem_init();
initialize_forth();
/* won't return */
printk("of_startup returned!\n");
for( ;; )
;
}
static void
setenv( char *env, char *value )
{
push_str( value );
push_str( env );
fword("$setenv");
}
void
arch_of_init( void )
{
#if USE_RTAS
phandle_t ph;
#endif
int autoboot;
devtree_init();
node_methods_init();
modules_init();
setup_timers();
#ifdef CONFIG_DRIVER_PCI
ob_pci_init();
#endif
#if USE_RTAS
if( !(ph=find_dev("/rtas")) )
printk("Warning: No /rtas node\n");
else {
ulong size = 0x1000;
while( size < (ulong)of_rtas_end - (ulong)of_rtas_start )
size *= 2;
set_property( ph, "rtas-size", (char*)&size, sizeof(size) );
}
#endif
#if 0
/* tweak boot settings */
autoboot = !!get_bool_res("autoboot");
#endif
autoboot = 0;
if( !autoboot )
printk("Autobooting disabled - dropping into OpenFirmware\n");
setenv("auto-boot?", autoboot ? "true" : "false" );
setenv("boot-command", "briqboot");
#if 0
if( get_bool_res("tty-interface") == 1 )
#endif
fword("activate-tty-interface");
/* hack */
device_end();
bind_func("briqboot", boot );
}
|