25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine_alpha.c,v 1.7 2006/06/24 10:19:19 debug Exp $ |
* $Id: machine_alpha.c,v 1.11 2006/09/01 11:39:50 debug Exp $ |
29 |
*/ |
*/ |
30 |
|
|
31 |
#include <stdio.h> |
#include <stdio.h> |
49 |
struct crb crb; |
struct crb crb; |
50 |
struct ctb ctb; |
struct ctb ctb; |
51 |
struct mddt mddt; |
struct mddt mddt; |
52 |
|
struct pcs *pcs = malloc(sizeof(struct pcs) * machine->ncpus); |
53 |
|
int i; |
54 |
|
|
55 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
56 |
|
|
57 |
case ST_ALPHABOOK1: |
case ST_ALPHABOOK1: |
58 |
machine->machine_name = "AlphaBook 1"; |
machine->machine_name = "AlphaBook 1"; |
59 |
|
if (machine->emulated_hz == 0) |
60 |
|
machine->emulated_hz = 233000000; |
61 |
device_add(machine, "lca"); |
device_add(machine, "lca"); |
62 |
break; |
break; |
63 |
|
|
91 |
/* a4 = Bootinfo version */ |
/* a4 = Bootinfo version */ |
92 |
cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; |
cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; |
93 |
cpu->cd.alpha.r[ALPHA_A1] = 0; /* TODO */ |
cpu->cd.alpha.r[ALPHA_A1] = 0; /* TODO */ |
94 |
cpu->cd.alpha.r[ALPHA_A2] = ALPHA_BOOTINFO_MAGIC; |
cpu->cd.alpha.r[ALPHA_A2] = 0; /* Note: NOT ALPHA_BOOTINFO_MAGIC */ |
95 |
cpu->cd.alpha.r[ALPHA_A3] = 0; /* TODO */ |
cpu->cd.alpha.r[ALPHA_A3] = 0; /* TODO */ |
96 |
cpu->cd.alpha.r[ALPHA_A4] = 1; |
cpu->cd.alpha.r[ALPHA_A4] = 1; |
97 |
|
|
102 |
*/ |
*/ |
103 |
memset(&rpb, 0, sizeof(struct rpb)); |
memset(&rpb, 0, sizeof(struct rpb)); |
104 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
105 |
&(rpb.rpb_phys), HWRPB_ADDR); |
&(rpb.rpb_phys), 0x14000); |
106 |
strlcpy((char *)&(rpb.rpb_magic), "HWRPB", 8); |
strlcpy((char *)&(rpb.rpb_magic), "HWRPB", 8); |
107 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
108 |
&(rpb.rpb_size), sizeof(struct rpb)); |
&(rpb.rpb_size), sizeof(struct rpb)); |
109 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
110 |
&(rpb.rpb_page_size), 8192); |
&(rpb.rpb_page_size), 8192); |
111 |
|
strlcpy((char *)&(rpb.rpb_ssn), "123456789", 10); |
112 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
113 |
&(rpb.rpb_type), machine->machine_subtype); |
&(rpb.rpb_type), machine->machine_subtype); |
114 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
115 |
&(rpb.rpb_cc_freq), 100000000); |
&(rpb.rpb_cc_freq), machine->emulated_hz); |
116 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
117 |
|
&(rpb.rpb_intr_freq), 1024 << 12); |
118 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
119 |
|
&(rpb.rpb_pcs_cnt), machine->ncpus); |
120 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
121 |
|
&(rpb.rpb_pcs_size), sizeof(struct pcs)); |
122 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
123 |
|
&(rpb.rpb_pcs_off), PCS_ADDR - HWRPB_ADDR); |
124 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
125 |
&(rpb.rpb_ctb_off), CTB_ADDR - HWRPB_ADDR); |
&(rpb.rpb_ctb_off), CTB_ADDR - HWRPB_ADDR); |
126 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
138 |
memset(&crb, 0, sizeof(struct crb)); |
memset(&crb, 0, sizeof(struct crb)); |
139 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
140 |
&(crb.crb_v_dispatch), CRB_ADDR - 0x100); |
&(crb.crb_v_dispatch), CRB_ADDR - 0x100); |
141 |
store_64bit_word(cpu, CRB_ADDR - 0x100 + 8, 0x10000); |
store_64bit_word(cpu, CRB_ADDR - 0x100 + 8, PROM_ENTRY_PADDR); |
142 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
143 |
&(crb.crb_v_fixup), CRB_ADDR - 0x80); |
&(crb.crb_v_fixup), CRB_ADDR - 0x80); |
144 |
store_64bit_word(cpu, CRB_ADDR - 0x80 + 8, 0x10800); |
store_64bit_word(cpu, CRB_ADDR - 0x80 + 8, PROM_ENTRY_PADDR + 0x800); |
145 |
|
|
146 |
|
/* PCS: Processor ID etc. */ |
147 |
|
for (i=0; i<machine->ncpus; i++) { |
148 |
|
memset(&pcs[i], 0, sizeof(struct pcs)); |
149 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
150 |
|
&(pcs[i].pcs_flags), PCS_RC | PCS_PA | PCS_PP | |
151 |
|
PCS_CV | PCS_PV | PCS_PMV | PCS_PL); |
152 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
153 |
|
&(pcs[i].pcs_proc_type), |
154 |
|
machine->cpus[i]->cd.alpha.cpu_type.pcs_type); |
155 |
|
} |
156 |
|
|
157 |
/* |
/* |
158 |
* MDDT: Memory Data Descriptor Table. For now, it is a simple |
* MDDT: Memory Data Descriptor Table. For now, it is a simple |
163 |
* and similar. |
* and similar. |
164 |
*/ |
*/ |
165 |
memset(&mddt, 0, sizeof(struct mddt)); |
memset(&mddt, 0, sizeof(struct mddt)); |
166 |
|
memset(&mddt.mddt_clusters[0], 0, sizeof(struct mddt_cluster)); |
167 |
|
memset(&mddt.mddt_clusters[1], 0, sizeof(struct mddt_cluster)); |
168 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
169 |
&(mddt.mddt_cluster_cnt), 2); |
&(mddt.mddt_cluster_cnt), 2); |
170 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
171 |
&(mddt.mddt_clusters[0].mddt_pfn), 128 * 16); |
&(mddt.mddt_clusters[0].mddt_pfn), 16 * 128); |
172 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
173 |
&(mddt.mddt_clusters[0].mddt_pg_cnt), |
&(mddt.mddt_clusters[0].mddt_pg_cnt), |
174 |
(machine->physical_ram_in_mb - 16) * 128); |
(machine->physical_ram_in_mb/2 - 16) * 128); |
175 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
176 |
&(mddt.mddt_clusters[1].mddt_pfn), machine->physical_ram_in_mb*128); |
&(mddt.mddt_clusters[1].mddt_pfn), |
177 |
|
machine->physical_ram_in_mb/2 * 128); |
178 |
store_64bit_word_in_host(cpu, (unsigned char *) |
store_64bit_word_in_host(cpu, (unsigned char *) |
179 |
&(mddt.mddt_clusters[1].mddt_pg_cnt), (machine->physical_ram_in_mb |
&(mddt.mddt_clusters[1].mddt_pg_cnt), |
180 |
- 1) * 128); |
(machine->physical_ram_in_mb/2) * 128); |
181 |
|
|
182 |
/* |
/* |
183 |
* Place a special "hack" palcode call at 0x10000 and 0x10800: |
* Place a special "hack" palcode call at PROM_ENTRY_PADDR and |
184 |
|
* PROM_ENTRY_PADDR + 0x800: |
185 |
* (Hopefully nothing else will be there.) |
* (Hopefully nothing else will be there.) |
186 |
*/ |
*/ |
187 |
store_32bit_word(cpu, 0x10000, 0x3fffffe); |
store_32bit_word(cpu, PROM_ENTRY_PADDR, 0x3fffffe); |
188 |
store_32bit_word(cpu, 0x10800, 0x3fffffd); |
store_32bit_word(cpu, PROM_ENTRY_PADDR + 0x800, 0x3fffffd); |
189 |
|
|
190 |
store_buf(cpu, HWRPB_ADDR, (char *)&rpb, sizeof(struct rpb)); |
store_buf(cpu, HWRPB_ADDR, (char *)&rpb, sizeof(struct rpb)); |
191 |
store_buf(cpu, CTB_ADDR, (char *)&ctb, sizeof(struct ctb)); |
store_buf(cpu, CTB_ADDR, (char *)&ctb, sizeof(struct ctb)); |
192 |
store_buf(cpu, CRB_ADDR, (char *)&crb, sizeof(struct crb)); |
store_buf(cpu, CRB_ADDR, (char *)&crb, sizeof(struct crb)); |
193 |
store_buf(cpu, MEMDAT_ADDR, (char *)&mddt, sizeof(struct mddt)); |
store_buf(cpu, MEMDAT_ADDR, (char *)&mddt, sizeof(struct mddt)); |
194 |
|
store_buf(cpu, PCS_ADDR, (char *)pcs, sizeof(struct pcs) * |
195 |
|
machine->ncpus); |
196 |
|
|
197 |
|
free(pcs); |
198 |
} |
} |
199 |
|
|
200 |
|
|
227 |
|
|
228 |
MACHINE_DEFAULT_RAM(alpha) |
MACHINE_DEFAULT_RAM(alpha) |
229 |
{ |
{ |
230 |
machine->physical_ram_in_mb = 64; |
machine->physical_ram_in_mb = 128; |
231 |
} |
} |
232 |
|
|
233 |
|
|