1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include <types.h>
24#include <console.h>
25#include <string.h>
26#include <tables.h>
27#include <multiboot.h>
28
29
30
31
32
33
34extern u8 gdt;
35extern u8 gdt_end;
36
37
38struct gdtarg {
39 unsigned short limit;
40 unsigned int base;
41} __attribute__((packed));
42
43#warning enable disabled code in archtables.c
44
45#if 0
46
47
48
49void move_gdt(unsigned long newgdt)
50{
51 u16 num_gdt_bytes = &gdt_end - &gdt;
52 struct gdtarg gdtarg;
53
54 printk(BIOS_DEBUG,"Moving GDT to %#lx...", newgdt);
55 memcpy((void*)newgdt, &gdt, num_gdt_bytes);
56 gdtarg.base = newgdt;
57 gdtarg.limit = num_gdt_bytes - 1;
58 __asm__ __volatile__ ("lgdt %0\n\t" : : "m" (gdtarg));
59 printk(BIOS_DEBUG,"OK\n");
60}
61#endif
62void *arch_write_tables(void)
63{
64#if 0
65#if HAVE_MP_TABLE==1
66 unsigned long new_low_table_end;
67#endif
68#endif
69 unsigned long low_table_start, low_table_end;
70 unsigned long rom_table_start, rom_table_end;
71
72 void *mbi;
73
74 rom_table_start = 0xf0000;
75 rom_table_end = 0xf0000;
76
77
78
79 low_table_start = 0;
80 low_table_end = 16;
81
82 post_code(POST_STAGE2_ARCH_WRITE_TABLES_ENTER);
83
84
85
86
87
88#ifdef CONFIG_PIRQ_TABLE
89 rom_table_end = write_pirq_routing_table(rom_table_end);
90 rom_table_end = (rom_table_end + 1023) & ~1023;
91#endif
92
93
94
95
96
97
98
99
100
101
102 post_code(POST_STAGE2_ARCH_WRITE_TABLES_MIDDLE);
103
104
105
106#if 0
107#if HAVE_MP_TABLE==1
108
109
110
111 if(new_low_table_end>0x467){
112 unsigned mptable_size = new_low_table_end - low_table_end - SMP_FLOATING_TABLE_LEN;
113
114 if((rom_table_end+mptable_size)<0x100000) {
115
116 printk(BIOS_DEBUG,"Move mptable to 0x%0x\n", rom_table_end);
117 memcpy((unsigned char *)rom_table_end, (unsigned char *)(low_table_end+SMP_FLOATING_TABLE_LEN), mptable_size);
118 memset((unsigned char *)low_table_end, '\0', mptable_size + SMP_FLOATING_TABLE_LEN);
119 smp_write_floating_table_physaddr(low_table_end, rom_table_end);
120 low_table_end += SMP_FLOATING_TABLE_LEN;
121 rom_table_end += mptable_size;
122 rom_table_end = (rom_table_end+1023) & ~1023;
123 } else {
124
125 printk(BIOS_DEBUG,"Move mptable to 0x%0x\n", 0x500);
126 memcpy((unsigned char *)0x500, (unsigned char *)(low_table_end+SMP_FLOATING_TABLE_LEN), mptable_size);
127 memset((unsigned char *)low_table_end, '\0', 0x500-low_table_end);
128 smp_write_floating_table_physaddr(low_table_end, 0x500);
129 low_table_end = 0x500 + mptable_size;
130 }
131 }
132#endif
133#endif
134
135
136 if (low_table_end < 0x500) {
137 low_table_end = 0x500;
138 }
139
140#warning GDT should be placed in a reserved position from the beginning on.
141#if 0
142
143 move_gdt(low_table_end);
144 low_table_end += &gdt_end - &gdt;
145#endif
146
147
148 mbi = (void*)rom_table_end;
149 rom_table_end = write_multiboot_info(
150 low_table_start, low_table_end,
151 rom_table_start, rom_table_end);
152
153
154 write_coreboot_table(
155 low_table_start, low_table_end,
156 rom_table_start, rom_table_end);
157
158 return mbi;
159}
160