ppc64: Don't set Kp bit on SLB
[openbios/afaerber.git] / arch / x86 / openbios.c
blobdd444faba4051dbcfd7fce6ff59369b6168584b4
1 /* tag: openbios forth environment, executable code
3 * Copyright (C) 2003 Patrick Mauritz, Stefan Reinauer
5 * See the file "COPYING" for further information about
6 * the copyright and warranty status of this work.
7 */
9 #include "config.h"
10 #include "libopenbios/openbios.h"
11 #include "libopenbios/bindings.h"
12 #include "asm/types.h"
13 #include "dict.h"
14 #include "kernel/kernel.h"
15 #include "kernel/stack.h"
16 #include "drivers/drivers.h"
17 #include "drivers/pci.h"
18 #include "libopenbios/sys_info.h"
19 #include "openbios.h"
20 #include "relocate.h"
21 #include "boot.h"
23 void collect_sys_info(struct sys_info *info);
25 #ifdef CONFIG_DRIVER_PCI
26 static const pci_arch_t default_pci_host = {
27 .name = "Intel,i440FX",
28 .vendor_id = PCI_VENDOR_ID_INTEL,
29 .device_id = PCI_DEVICE_ID_INTEL_82441,
30 .io_base = 0x1000,
32 #endif
34 static void init_memory(void)
36 /* push start and end of available memory to the stack
37 * so that the forth word QUIT can initialize memory
38 * management. For now we use hardcoded memory between
39 * 0x10000 and 0x9ffff (576k). If we need more memory
40 * than that we have serious bloat.
43 PUSH(0x10000);
44 PUSH(0x9FFFF);
47 static void
48 arch_init( void )
50 openbios_init();
51 modules_init();
52 #ifdef CONFIG_DRIVER_PCI
53 arch = &default_pci_host;
54 ob_pci_init();
55 #endif
56 #ifdef CONFIG_DRIVER_IDE
57 setup_timers();
58 ob_ide_init("/pci/isa", 0x1f0, 0x3f4, 0x170, 0x374);
59 #endif
60 #ifdef CONFIG_DRIVER_FLOPPY
61 ob_floppy_init("/isa", "floppy0", 0x3f0, 0);
62 #endif
63 #ifdef CONFIG_XBOX
64 init_video(phys_to_virt(0x3C00000), 640, 480, 32, 2560);
65 node_methods_init();
66 #endif
67 device_end();
68 bind_func("platform-boot", boot );
69 bind_func("(go)", go );
72 int openbios(void)
74 #ifdef CONFIG_DEBUG_CONSOLE
75 #ifdef CONFIG_DEBUG_CONSOLE_SERIAL
76 uart_init(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED);
77 #endif
78 /* Clear the screen. */
79 cls();
80 #endif
82 collect_sys_info(&sys_info);
84 dict = (unsigned char *)sys_info.dict_start;
85 dicthead = (cell)sys_info.dict_end;
86 last = sys_info.dict_last;
87 dictlimit = sys_info.dict_limit;
89 forth_init();
91 relocate(&sys_info);
93 #ifdef CONFIG_DEBUG_CONSOLE_VGA
94 video_init();
95 #endif
96 #ifdef CONFIG_DEBUG_BOOT
97 printk("forth started.\n");
98 printk("initializing memory...");
99 #endif
101 init_memory();
103 #ifdef CONFIG_DEBUG_BOOT
104 printk("done\n");
105 #endif
107 PUSH_xt( bind_noname_func(arch_init) );
108 fword("PREPOST-initializer");
110 PC = (ucell)findword("initialize-of");
112 if (!PC) {
113 printk("panic: no dictionary entry point.\n");
114 return -1;
116 #ifdef CONFIG_DEBUG_DICTIONARY
117 printk("done (%d bytes).\n", dicthead);
118 printk("Jumping to dictionary...\n");
119 #endif
121 enterforth((xt_t)PC);
123 return 0;