/[gxemul]/trunk/src/machines/machine_alpha.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/machines/machine_alpha.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 23 by dpavlin, Mon Oct 8 16:19:37 2007 UTC revision 24 by dpavlin, Mon Oct 8 16:19:56 2007 UTC
# Line 25  Line 25 
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.6 2006/06/02 18:11:38 debug Exp $
29   */   */
30    
31  #include <stdio.h>  #include <stdio.h>
# Line 39  Line 39 
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    
# Line 47  MACHINE_SETUP(alpha) Line 48  MACHINE_SETUP(alpha)
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);
# Line 65  MACHINE_SETUP(alpha) Line 79  MACHINE_SETUP(alpha)
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);
# Line 94  MACHINE_SETUP(alpha) Line 112  MACHINE_SETUP(alpha)
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));
# Line 106  MACHINE_SETUP(alpha) Line 126  MACHINE_SETUP(alpha)
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             *  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:           *  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    
# Line 133  MACHINE_DEFAULT_RAM(alpha) Line 201  MACHINE_DEFAULT_RAM(alpha)
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, 1, 4);
205          me->aliases[0] = "alpha";          me->aliases[0] = "alpha";
206          me->subtype[0] = machine_entry_subtype_new("DEC 3000/300",  
207            me->subtype[0] = machine_entry_subtype_new("AlphaBook 1",
208                ST_ALPHABOOK1, 1);
209            me->subtype[0]->aliases[0] = "alphabook1";
210    
211            me->subtype[1] = machine_entry_subtype_new("AlphaServer 4100",
212                ST_DEC_4100, 1);
213            me->subtype[1]->aliases[0] = "alphaserver4100";
214    
215            me->subtype[2] = machine_entry_subtype_new("DEC 3000/300",
216              ST_DEC_3000_300, 1);              ST_DEC_3000_300, 1);
217          me->subtype[0]->aliases[0] = "3000/300";          me->subtype[2]->aliases[0] = "3000/300";
218          me->subtype[1] = machine_entry_subtype_new("EB164", ST_EB164, 1);  
219          me->subtype[1]->aliases[0] = "eb164";          me->subtype[3] = machine_entry_subtype_new("EB164", ST_EB164, 1);
220            me->subtype[3]->aliases[0] = "eb164";
221    
222          me->set_default_ram = machine_default_ram_alpha;          me->set_default_ram = machine_default_ram_alpha;
223          machine_entry_add(me, ARCH_ALPHA);          machine_entry_add(me, ARCH_ALPHA);
224  }  }

Legend:
Removed from v.23  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26