25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine_alpha.c,v 1.2 2006/01/08 11:05:03 debug Exp $ |
* $Id: machine_alpha.c,v 1.7 2006/06/24 10:19:19 debug Exp $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
39 |
#include "memory.h" |
#include "memory.h" |
40 |
#include "misc.h" |
#include "misc.h" |
41 |
|
|
42 |
|
#include "alpha_autoconf.h" |
43 |
#include "alpha_rpb.h" |
#include "alpha_rpb.h" |
44 |
|
|
45 |
|
|
48 |
struct rpb rpb; |
struct rpb rpb; |
49 |
struct crb crb; |
struct crb crb; |
50 |
struct ctb ctb; |
struct ctb ctb; |
51 |
|
struct mddt mddt; |
52 |
|
|
53 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
54 |
|
|
55 |
|
case ST_ALPHABOOK1: |
56 |
|
machine->machine_name = "AlphaBook 1"; |
57 |
|
device_add(machine, "lca"); |
58 |
|
break; |
59 |
|
|
60 |
|
case ST_DEC_4100: |
61 |
|
machine->machine_name = "AlphaServer 4100"; |
62 |
|
break; |
63 |
|
|
64 |
case ST_DEC_3000_300: |
case ST_DEC_3000_300: |
65 |
machine->machine_name = "DEC 3000/300"; |
machine->machine_name = "DEC 3000/300"; |
66 |
machine->main_console_handle = (size_t)device_add(machine, |
machine->main_console_handle = (size_t)device_add(machine, |
67 |
"z8530 addr=0x1b0200000 irq=0 addr_mult=4"); |
"z8530 addr=0x1b0200000 irq=0 addr_mult=4"); |
68 |
break; |
break; |
69 |
|
|
70 |
case ST_EB164: |
case ST_EB164: |
71 |
machine->machine_name = "EB164"; |
machine->machine_name = "EB164"; |
72 |
break; |
break; |
73 |
|
|
74 |
default:fatal("Unimplemented Alpha machine type %i\n", |
default:fatal("Unimplemented Alpha machine type %i\n", |
75 |
machine->machine_subtype); |
machine->machine_subtype); |
76 |
exit(1); |
exit(1); |
79 |
if (!machine->prom_emulation) |
if (!machine->prom_emulation) |
80 |
return; |
return; |
81 |
|
|
82 |
/* TODO: Most of these... They are used by NetBSD/alpha: */ |
/* These are used by NetBSD/alpha: */ |
83 |
/* a0 = First free Page Frame Number */ |
/* a0 = First free Page Frame Number */ |
84 |
/* a1 = PFN of current Level 1 page table */ |
/* a1 = PFN of current Level 1 page table */ |
85 |
/* a2 = Bootinfo magic */ |
/* a2 = Bootinfo magic */ |
86 |
/* a3 = Bootinfo pointer */ |
/* a3 = Bootinfo pointer */ |
87 |
/* a4 = Bootinfo version */ |
/* a4 = Bootinfo version */ |
88 |
cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; |
cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; |
89 |
cpu->cd.alpha.r[ALPHA_A1] = 0; |
cpu->cd.alpha.r[ALPHA_A1] = 0; /* TODO */ |
90 |
cpu->cd.alpha.r[ALPHA_A2] = 0; |
cpu->cd.alpha.r[ALPHA_A2] = ALPHA_BOOTINFO_MAGIC; |
91 |
cpu->cd.alpha.r[ALPHA_A3] = 0; |
cpu->cd.alpha.r[ALPHA_A3] = 0; /* TODO */ |
92 |
cpu->cd.alpha.r[ALPHA_A4] = 0; |
cpu->cd.alpha.r[ALPHA_A4] = 1; |
93 |
|
|
94 |
/* HWRPB: Hardware Restart Parameter Block */ |
/* |
95 |
|
* HWRPB: Hardware Restart Parameter Block |
96 |
|
* |
97 |
|
* TODO: Almost everything. |
98 |
|
*/ |
99 |
memset(&rpb, 0, sizeof(struct rpb)); |
memset(&rpb, 0, sizeof(struct rpb)); |
100 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
101 |
&(rpb.rpb_phys), HWRPB_ADDR); |
&(rpb.rpb_phys), HWRPB_ADDR); |
112 |
&(rpb.rpb_ctb_off), CTB_ADDR - HWRPB_ADDR); |
&(rpb.rpb_ctb_off), CTB_ADDR - HWRPB_ADDR); |
113 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
114 |
&(rpb.rpb_crb_off), CRB_ADDR - HWRPB_ADDR); |
&(rpb.rpb_crb_off), CRB_ADDR - HWRPB_ADDR); |
115 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
116 |
|
&(rpb.rpb_memdat_off), MEMDAT_ADDR - HWRPB_ADDR); |
117 |
|
|
118 |
/* CTB: Console Terminal Block */ |
/* CTB: Console Terminal Block */ |
119 |
memset(&ctb, 0, sizeof(struct ctb)); |
memset(&ctb, 0, sizeof(struct ctb)); |
126 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
127 |
&(crb.crb_v_dispatch), CRB_ADDR - 0x100); |
&(crb.crb_v_dispatch), CRB_ADDR - 0x100); |
128 |
store_64bit_word(cpu, CRB_ADDR - 0x100 + 8, 0x10000); |
store_64bit_word(cpu, CRB_ADDR - 0x100 + 8, 0x10000); |
129 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
130 |
|
&(crb.crb_v_fixup), CRB_ADDR - 0x80); |
131 |
|
store_64bit_word(cpu, CRB_ADDR - 0x80 + 8, 0x10800); |
132 |
|
|
133 |
/* |
/* |
134 |
* Place a special "hack" palcode call at 0x10000: |
* MDDT: Memory Data Descriptor Table. For now, it is a simple |
135 |
|
* two-entry table with half of the available RAM in each entry. |
136 |
|
* (The values are in number of 8K pages.) |
137 |
|
* The first 16 MB are not included (the kernel lives there). |
138 |
|
* The last 1 MB is not included either, it is reserved for bootup |
139 |
|
* and similar. |
140 |
|
*/ |
141 |
|
memset(&mddt, 0, sizeof(struct mddt)); |
142 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
143 |
|
&(mddt.mddt_cluster_cnt), 2); |
144 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
145 |
|
&(mddt.mddt_clusters[0].mddt_pfn), 128 * 16); |
146 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
147 |
|
&(mddt.mddt_clusters[0].mddt_pg_cnt), |
148 |
|
(machine->physical_ram_in_mb - 16) * 128); |
149 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
150 |
|
&(mddt.mddt_clusters[1].mddt_pfn), machine->physical_ram_in_mb*128); |
151 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
152 |
|
&(mddt.mddt_clusters[1].mddt_pg_cnt), (machine->physical_ram_in_mb |
153 |
|
- 1) * 128); |
154 |
|
|
155 |
|
/* |
156 |
|
* Place a special "hack" palcode call at 0x10000 and 0x10800: |
157 |
* (Hopefully nothing else will be there.) |
* (Hopefully nothing else will be there.) |
158 |
*/ |
*/ |
159 |
store_32bit_word(cpu, 0x10000, 0x3fffffe); |
store_32bit_word(cpu, 0x10000, 0x3fffffe); |
160 |
|
store_32bit_word(cpu, 0x10800, 0x3fffffd); |
161 |
|
|
162 |
store_buf(cpu, HWRPB_ADDR, (char *)&rpb, sizeof(struct rpb)); |
store_buf(cpu, HWRPB_ADDR, (char *)&rpb, sizeof(struct rpb)); |
163 |
store_buf(cpu, CTB_ADDR, (char *)&ctb, sizeof(struct ctb)); |
store_buf(cpu, CTB_ADDR, (char *)&ctb, sizeof(struct ctb)); |
164 |
store_buf(cpu, CRB_ADDR, (char *)&crb, sizeof(struct crb)); |
store_buf(cpu, CRB_ADDR, (char *)&crb, sizeof(struct crb)); |
165 |
|
store_buf(cpu, MEMDAT_ADDR, (char *)&mddt, sizeof(struct mddt)); |
166 |
} |
} |
167 |
|
|
168 |
|
|
169 |
MACHINE_DEFAULT_CPU(alpha) |
MACHINE_DEFAULT_CPU(alpha) |
170 |
{ |
{ |
171 |
machine->cpu_name = strdup("Alpha"); |
switch (machine->machine_subtype) { |
172 |
|
|
173 |
|
case ST_ALPHABOOK1: |
174 |
|
machine->cpu_name = strdup("21066"); |
175 |
|
break; |
176 |
|
|
177 |
|
case ST_DEC_4100: |
178 |
|
machine->cpu_name = strdup("21164A-2"); |
179 |
|
break; |
180 |
|
|
181 |
|
case ST_DEC_3000_300: |
182 |
|
machine->cpu_name = strdup("21064"); |
183 |
|
break; |
184 |
|
|
185 |
|
case ST_EB164: |
186 |
|
machine->cpu_name = strdup("21164PC"); |
187 |
|
break; |
188 |
|
|
189 |
|
default:fatal("Unimplemented Alpha machine type %i\n", |
190 |
|
machine->machine_subtype); |
191 |
|
exit(1); |
192 |
|
} |
193 |
} |
} |
194 |
|
|
195 |
|
|
201 |
|
|
202 |
MACHINE_REGISTER(alpha) |
MACHINE_REGISTER(alpha) |
203 |
{ |
{ |
204 |
MR_DEFAULT(alpha, "Alpha", ARCH_ALPHA, MACHINE_ALPHA, 1, 2); |
MR_DEFAULT(alpha, "Alpha", ARCH_ALPHA, MACHINE_ALPHA); |
205 |
me->aliases[0] = "alpha"; |
|
206 |
me->subtype[0] = machine_entry_subtype_new("DEC 3000/300", |
machine_entry_add_alias(me, "alpha"); |
207 |
ST_DEC_3000_300, 1); |
|
208 |
me->subtype[0]->aliases[0] = "3000/300"; |
machine_entry_add_subtype(me, "AlphaBook 1", ST_ALPHABOOK1, |
209 |
me->subtype[1] = machine_entry_subtype_new("EB164", ST_EB164, 1); |
"alphabook1", NULL); |
210 |
me->subtype[1]->aliases[0] = "eb164"; |
|
211 |
|
machine_entry_add_subtype(me, "AlphaServer 4100", ST_DEC_4100, |
212 |
|
"alphaserver4100", NULL); |
213 |
|
|
214 |
|
machine_entry_add_subtype(me, "DEC 3000/300", ST_DEC_3000_300, |
215 |
|
"3000/300", NULL); |
216 |
|
|
217 |
|
machine_entry_add_subtype(me, "EB164", ST_EB164, |
218 |
|
"eb164", NULL); |
219 |
|
|
220 |
me->set_default_ram = machine_default_ram_alpha; |
me->set_default_ram = machine_default_ram_alpha; |
|
machine_entry_add(me, ARCH_ALPHA); |
|
221 |
} |
} |
222 |
|
|