/[gxemul]/trunk/src/machines/machine_pmax.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_pmax.c

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

revision 22 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_pmax.c,v 1.3 2006/01/23 00:13:21 debug Exp $   *  $Id: machine_pmax.c,v 1.12 2006/06/16 18:31:26 debug Exp $
29     *
30     *  DECstation ("PMAX") machine description.
31   */   */
32    
33  #include <stdio.h>  #include <stdio.h>
# Line 236  MACHINE_SETUP(pmax) Line 238  MACHINE_SETUP(pmax)
238                  machine->md_interrupt = kmin_interrupt;                  machine->md_interrupt = kmin_interrupt;
239    
240                  /*                  /*
241                   *  tc0 at mainbus0: 12.5 MHz clock                             (0x10000000, slotsize = 64MB)                   *  tc0 at mainbus0: 12.5 MHz clock  (0x10000000,slotsize=64MB)
242                   *  tc slot 1:   0x14000000                   *  tc slot 1:   0x14000000
243                   *  tc slot 2:   0x18000000                   *  tc slot 2:   0x18000000
244                   *  ioasic0 at tc0 slot 3 offset 0x0                            (0x1c000000) slot 0                   *  ioasic0 at tc0 slot 3 offset 0x0    (0x1c000000) slot 0
245                   *  asic regs                                                   (0x1c040000) slot 1                   *  asic regs                           (0x1c040000) slot 1
246                   *  station's ether address                                     (0x1c080000) slot 2                   *  station's ether address             (0x1c080000) slot 2
247                   *  le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00    (0x1c0c0000) slot 3                   *  le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00
248                   *  scc0 at ioasic0 offset 0x100000                             (0x1c100000) slot 4                   *                                      (0x1c0c0000) slot 3
249                   *  scc1 at ioasic0 offset 0x180000: console                    (0x1c180000) slot 6                   *  scc0 at ioasic0 offset 0x100000     (0x1c100000) slot 4
250                   *  mcclock0 at ioasic0 offset 0x200000: mc146818 or compatible (0x1c200000) slot 8                   *  scc1 at ioasic0 offset 0x180000: console(0x1c180000) slot 6
251                   *  asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI ID 7 (0x1c300000) slot 12                   *  mcclock0 at ioasic0 offset 0x200000: mc146818 or
252                   *  dma for asc0                                                (0x1c380000) slot 14                   *      compatible                      (0x1c200000) slot 8
253                   */                   *  asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz,
254                  machine->md_int.dec_ioasic_data = dev_dec_ioasic_init(cpu, mem, 0x1c000000, 0);                   *      SCSI ID 7                       (0x1c300000) slot 12
255                  dev_le_init(machine, mem, 0x1c0c0000, 0, 0, KMIN_INTR_LANCE +8, 4*65536);                   *  dma for asc0                        (0x1c380000) slot 14
256                  dev_scc_init(machine, mem, 0x1c100000, KMIN_INTR_SCC_0 +8, machine->use_x11, 0, 1);                   */
257                  dev_scc_init(machine, mem, 0x1c180000, KMIN_INTR_SCC_1 +8, machine->use_x11, 1, 1);                  machine->md_int.dec_ioasic_data = dev_dec_ioasic_init(cpu,
258                  dev_mc146818_init(machine, mem, 0x1c200000, KMIN_INTR_CLOCK +8, MC146818_DEC, 1);                      mem, 0x1c000000, 0);
259                    dev_le_init(machine, mem, 0x1c0c0000, 0, 0, KMIN_INTR_LANCE + 8,
260                        4 * 65536);
261                    dev_scc_init(machine, mem, 0x1c100000, KMIN_INTR_SCC_0 + 8,
262                        machine->use_x11, 0, 1);
263                    dev_scc_init(machine, mem, 0x1c180000, KMIN_INTR_SCC_1 + 8,
264                        machine->use_x11, 1, 1);
265                    dev_mc146818_init(machine, mem, 0x1c200000, KMIN_INTR_CLOCK + 8,
266                        MC146818_DEC, 1);
267                  dev_asc_init(machine, mem, 0x1c300000, KMIN_INTR_SCSI +8,                  dev_asc_init(machine, mem, 0x1c300000, KMIN_INTR_SCSI +8,
268                      NULL, DEV_ASC_DEC, NULL, NULL);                      NULL, DEV_ASC_DEC, NULL, NULL);
269    
# Line 276  MACHINE_SETUP(pmax) Line 286  MACHINE_SETUP(pmax)
286                      machine->n_gfx_cards >= 3?                      machine->n_gfx_cards >= 3?
287                          turbochannel_default_gfx_card : "", KMIN_INT_TC2);                          turbochannel_default_gfx_card : "", KMIN_INT_TC2);
288    
289                  /*  (kmin shared irq numbers (IP) are offset by +8 in the emulator)  */                  /*  (kmin shared irq numbers (IP) are offset by +8 in the
290                        emulator)  */
291                  /*  kmin_csr = dev_kmin_init(cpu, mem, KMIN_REG_INTR);  */                  /*  kmin_csr = dev_kmin_init(cpu, mem, KMIN_REG_INTR);  */
292    
293                  framebuffer_console_name = "osconsole=0,3";     /*  fb, keyb (?)  */                  framebuffer_console_name = "osconsole=0,3";     /* fb,keyb(?) */
294                  serial_console_name      = "osconsole=3";       /*  ?  */                  serial_console_name      = "osconsole=3";       /* ? */
295                  break;                  break;
296    
297          case MACHINE_DEC_3MAXPLUS_5000: /*  type 4, KN03  */          case MACHINE_DEC_3MAXPLUS_5000: /*  type 4, KN03  */
# Line 299  MACHINE_SETUP(pmax) Line 310  MACHINE_SETUP(pmax)
310                  machine->md_interrupt = kn03_interrupt;                  machine->md_interrupt = kn03_interrupt;
311    
312                  /*                  /*
313                   *  tc0 at mainbus0: 25 MHz clock (slot 0)                      (0x1e000000)                   *  tc0 at mainbus0: 25 MHz clock (slot 0)      (0x1e000000)
314                   *  tc0 slot 1                                                  (0x1e800000)                   *  tc0 slot 1                                  (0x1e800000)
315                   *  tc0 slot 2                                                  (0x1f000000)                   *  tc0 slot 2                                  (0x1f000000)
316                   *  ioasic0 at tc0 slot 3 offset 0x0                            (0x1f800000)                   *  ioasic0 at tc0 slot 3 offset 0x0            (0x1f800000)
317                   *    something that has to do with interrupts? (?)             (0x1f840000 ?)                   *    something that has to do with interrupts? (?)(0x1f840000?)
318                   *  le0 at ioasic0 offset 0xc0000                               (0x1f8c0000)                   *  le0 at ioasic0 offset 0xc0000               (0x1f8c0000)
319                   *  scc0 at ioasic0 offset 0x100000                             (0x1f900000)                   *  scc0 at ioasic0 offset 0x100000             (0x1f900000)
320                   *  scc1 at ioasic0 offset 0x180000: console                    (0x1f980000)                   *  scc1 at ioasic0 offset 0x180000: console    (0x1f980000)
321                   *  mcclock0 at ioasic0 offset 0x200000: mc146818 or compatible (0x1fa00000)                   *  mcclock0 at ioasic0 offset 0x200000: mc146818 or
322                   *  asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI ID 7 (0x1fb00000)                   *      compatible                              (0x1fa00000)
323                   */                   *  asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz,
324                  machine->md_int.dec_ioasic_data = dev_dec_ioasic_init(cpu, mem, 0x1f800000, 0);                   *      SCSI ID 7                               (0x1fb00000)
325                     */
326                  dev_le_init(machine, mem, KN03_SYS_LANCE, 0, 0, KN03_INTR_LANCE +8, 4*65536);                  machine->md_int.dec_ioasic_data = dev_dec_ioasic_init(cpu,
327                        mem, 0x1f800000, 0);
328                  machine->md_int.dec_ioasic_data->dma_func[3] = dev_scc_dma_func;  
329                  machine->md_int.dec_ioasic_data->dma_func_extra[2] = dev_scc_init(machine, mem, KN03_SYS_SCC_0, KN03_INTR_SCC_0 +8, machine->use_x11, 0, 1);                  dev_le_init(machine, mem, KN03_SYS_LANCE, 0, 0,
330                  machine->md_int.dec_ioasic_data->dma_func[2] = dev_scc_dma_func;                      KN03_INTR_LANCE +8, 4 * 65536);
331                  machine->md_int.dec_ioasic_data->dma_func_extra[3] = dev_scc_init(machine, mem, KN03_SYS_SCC_1, KN03_INTR_SCC_1 +8, machine->use_x11, 1, 1);  
332                    machine->md_int.dec_ioasic_data->dma_func[3] =
333                        dev_scc_dma_func;
334                    machine->md_int.dec_ioasic_data->dma_func_extra[2] =
335                        dev_scc_init(machine, mem, KN03_SYS_SCC_0,
336                        KN03_INTR_SCC_0 +8, machine->use_x11, 0, 1);
337                    machine->md_int.dec_ioasic_data->dma_func[2] =
338                        dev_scc_dma_func;
339                    machine->md_int.dec_ioasic_data->dma_func_extra[3] =
340                        dev_scc_init(machine, mem, KN03_SYS_SCC_1,
341                        KN03_INTR_SCC_1 +8, machine->use_x11, 1, 1);
342    
343                  dev_mc146818_init(machine, mem, KN03_SYS_CLOCK, KN03_INT_RTC, MC146818_DEC, 1);                  dev_mc146818_init(machine, mem, KN03_SYS_CLOCK, KN03_INT_RTC,
344                        MC146818_DEC, 1);
345                  dev_asc_init(machine, mem, KN03_SYS_SCSI,                  dev_asc_init(machine, mem, KN03_SYS_SCSI,
346                      KN03_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL);                      KN03_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL);
347    
# Line 351  MACHINE_SETUP(pmax) Line 373  MACHINE_SETUP(pmax)
373                  /*  TODO: interrupts  */                  /*  TODO: interrupts  */
374                  /*  shared (turbochannel) interrupts are +8  */                  /*  shared (turbochannel) interrupts are +8  */
375    
376                  framebuffer_console_name = "osconsole=0,3";     /*  fb, keyb (?)  */                  framebuffer_console_name = "osconsole=0,3";     /* fb,keyb(?) */
377                  serial_console_name      = "osconsole=3";       /*  ?  */                  serial_console_name      = "osconsole=3";       /* ? */
378                  break;                  break;
379    
380          case MACHINE_DEC_5800:          /*  type 5, KN5800  */          case MACHINE_DEC_5800:          /*  type 5, KN5800  */
# Line 364  MACHINE_SETUP(pmax) Line 386  MACHINE_SETUP(pmax)
386                              "with less than 48MB RAM. Continuing anyway.\n");                              "with less than 48MB RAM. Continuing anyway.\n");
387    
388                  /*                  /*
389                   *  According to http://www2.no.netbsd.org/Ports/pmax/models.html,                   *  According to
390                     *  http://www2.no.netbsd.org/Ports/pmax/models.html,
391                   *  the 5800-series is based on VAX 6000/300.                   *  the 5800-series is based on VAX 6000/300.
392                   */                   */
393    
# Line 372  MACHINE_SETUP(pmax) Line 395  MACHINE_SETUP(pmax)
395                   *  Ultrix might support SMP on this machine type.                   *  Ultrix might support SMP on this machine type.
396                   *                   *
397                   *  Something at 0x10000000.                   *  Something at 0x10000000.
398                   *  ssc serial console at 0x10140000, interrupt 2 (shared with XMI?).                   *  ssc serial console at 0x10140000, interrupt 2 (shared
399                     *  with XMI?).
400                   *  xmi 0 at address 0x11800000   (node x at offset x*0x80000)                   *  xmi 0 at address 0x11800000   (node x at offset x*0x80000)
401                   *  Clock uses interrupt 3 (shared with XMI?).                   *  Clock uses interrupt 3 (shared with XMI?).
402                   */                   */
403    
404                  machine->md_int.dec5800_csr = dev_dec5800_init(machine, mem, 0x10000000);                  machine->md_int.dec5800_csr = dev_dec5800_init(machine,
405                        mem, 0x10000000);
406                  dev_decbi_init(mem, 0x10000000);                  dev_decbi_init(mem, 0x10000000);
407                  dev_ssc_init(machine, mem, 0x10140000, 2, machine->use_x11, &machine->md_int.dec5800_csr->csr);                  dev_ssc_init(machine, mem, 0x10140000, 2, machine->use_x11,
408                        &machine->md_int.dec5800_csr->csr);
409                  dev_decxmi_init(mem, 0x11800000);                  dev_decxmi_init(mem, 0x11800000);
410                  dev_deccca_init(mem, DEC_DECCCA_BASEADDR);                  dev_deccca_init(mem, DEC_DECCCA_BASEADDR);
411    
# Line 415  MACHINE_SETUP(pmax) Line 441  MACHINE_SETUP(pmax)
441                  /*  ln (ethernet) at 0x10084x00 ? and 0x10120000 ?  */                  /*  ln (ethernet) at 0x10084x00 ? and 0x10120000 ?  */
442                  /*  error registers (?) at 0x17000000 and 0x10080000  */                  /*  error registers (?) at 0x17000000 and 0x10080000  */
443                  device_add(machine, "kn210 addr=0x10080000");                  device_add(machine, "kn210 addr=0x10080000");
444                  dev_ssc_init(machine, mem, 0x10140000, 0, machine->use_x11, NULL);      /*  TODO:  not irq 0  */                  dev_ssc_init(machine, mem, 0x10140000, 0,
445                        machine->use_x11, NULL);    /*  TODO:  not irq 0  */
446                  break;                  break;
447    
448          case MACHINE_DEC_MAXINE_5000:   /*  type 7, KN02CA  */          case MACHINE_DEC_MAXINE_5000:   /*  type 7, KN02CA  */
# Line 437  MACHINE_SETUP(pmax) Line 464  MACHINE_SETUP(pmax)
464                  /*                  /*
465                   *  Something at address 0xca00000. (?)                   *  Something at address 0xca00000. (?)
466                   *  Something at address 0xe000000. (?)                   *  Something at address 0xe000000. (?)
467                   *  tc0 slot 0                                                          (0x10000000)                   *  tc0 slot 0                                  (0x10000000)
468                   *  tc0 slot 1                                                          (0x14000000)                   *  tc0 slot 1                                  (0x14000000)
469                   *  (tc0 slot 2 used by the framebuffer)                   *  (tc0 slot 2 used by the framebuffer)
470                   *  ioasic0 at tc0 slot 3 offset 0x0                                    (0x1c000000)                   *  ioasic0 at tc0 slot 3 offset 0x0            (0x1c000000)
471                   *  le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00            (0x1c0c0000)                   *  le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00
472                   *  scc0 at ioasic0 offset 0x100000: console  <-- serial                (0x1c100000)                   *                                              (0x1c0c0000)
473                   *  mcclock0 at ioasic0 offset 0x200000: mc146818                       (0x1c200000)                   *  scc0 at ioasic0 offset 0x100000: console  <-- serial
474                   *  isdn at ioasic0 offset 0x240000 not configured                      (0x1c240000)                   *                                              (0x1c100000)
475                   *  bba0 at ioasic0 offset 0x240000 (audio0 at bba0)        <--- which one of isdn and bba0?                   *  mcclock0 at ioasic0 offset 0x200000: mc146818 (0x1c200000)
476                   *  dtop0 at ioasic0 offset 0x280000                                    (0x1c280000)                   *  isdn at ioasic0 offset 0x240000 not configured (0x1c240000)
477                   *  fdc at ioasic0 offset 0x2c0000 not configured  <-- floppy           (0x1c2c0000)                   *  bba0 at ioasic0 offset 0x240000 (audio0 at bba0)
478                   *  asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI ID 7         (0x1c300000)                   *      ^--- which one of isdn and bba0?
479                   *  xcfb0 at tc0 slot 2 offset 0x0: 1024x768x8 built-in framebuffer     (0xa000000)                   *  dtop0 at ioasic0 offset 0x280000            (0x1c280000)
480                     *  fdc at ioasic0 offset 0x2c0000 not configured
481                     *      ^-- floppy                              (0x1c2c0000)
482                     *  asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI
483                     *      ID 7                                    (0x1c300000)
484                     *  xcfb0 at tc0 slot 2 offset 0x0: 1024x768x8
485                     *      built-in framebuffer                    (0xa000000)
486                   */                   */
487                  machine->md_int.dec_ioasic_data = dev_dec_ioasic_init(cpu, mem, 0x1c000000, 0);                  machine->md_int.dec_ioasic_data =
488                        dev_dec_ioasic_init(cpu, mem, 0x1c000000, 0);
489    
490                  /*  TURBOchannel slots (0 and 1):  */                  /*  TURBOchannel slots (0 and 1):  */
491                  dev_turbochannel_init(machine, mem, 0,                  dev_turbochannel_init(machine, mem, 0,
# Line 485  MACHINE_SETUP(pmax) Line 519  MACHINE_SETUP(pmax)
519                  dev_asc_init(machine, mem, 0x1c300000,                  dev_asc_init(machine, mem, 0x1c300000,
520                      XINE_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL);                      XINE_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL);
521    
522                  framebuffer_console_name = "osconsole=3,2";     /*  keyb,fb ??  */                  framebuffer_console_name = "osconsole=3,2";     /*  keyb,fb?  */
523                  serial_console_name      = "osconsole=3";                  serial_console_name      = "osconsole=3";
524                  break;                  break;
525    
# Line 508  MACHINE_SETUP(pmax) Line 542  MACHINE_SETUP(pmax)
542                   *  something at 0x10040000                   *  something at 0x10040000
543                   *  scc at 0x10140000                   *  scc at 0x10140000
544                   *  qbus at (or around) 0x10080000                   *  qbus at (or around) 0x10080000
545                   *  dssi (disk controller) buffers at 0x10100000, registers at 0x10160000.                   *  dssi (disk controller) buffers at 0x10100000,
546                   *  sgec (ethernet) registers at 0x10008000, station addresss at 0x10120000.                   *      registers at 0x10160000.
547                     *  sgec (ethernet) registers at 0x10008000, station
548                     *      addresss at 0x10120000.
549                   *  asc (scsi) at 0x17100000.                   *  asc (scsi) at 0x17100000.
550                   */                   */
551    
552                  dev_ssc_init(machine, mem, 0x10140000, 0, machine->use_x11, NULL);              /*  TODO:  not irq 0  */                  dev_ssc_init(machine, mem, 0x10140000, 0,
553                        machine->use_x11, NULL);            /*  TODO:  not irq 0  */
554    
555                  /*  something at 0x17000000, ultrix says "cpu 0 panic: DS5500 I/O Board is missing" if this is not here  */                  /*  something at 0x17000000, ultrix says "cpu 0 panic: "
556                        "DS5500 I/O Board is missing" if this is not here  */
557                  dev_dec5500_ioboard_init(cpu, mem, 0x17000000);                  dev_dec5500_ioboard_init(cpu, mem, 0x17000000);
558    
559                  dev_sgec_init(mem, 0x10008000, 0);              /*  irq?  */                  dev_sgec_init(mem, 0x10008000, 0);              /*  irq?  */
560    
561                  /*  The asc controller might be TURBOchannel-ish?  */                  /*  The asc controller might be TURBOchannel-ish?  */
562  #if 0  #if 0
563                  dev_turbochannel_init(machine, mem, 0, 0x17100000, 0x171fffff, "PMAZ-AA", 0);   /*  irq?  */                  dev_turbochannel_init(machine, mem, 0, 0x17100000,
564                        0x171fffff, "PMAZ-AA", 0);  /*  irq?  */
565  #else  #else
566                  dev_asc_init(machine, mem, 0x17100000, 0, NULL, DEV_ASC_DEC, NULL, NULL);               /*  irq?  */                  dev_asc_init(machine, mem, 0x17100000, 0, NULL,
567                        DEV_ASC_DEC, NULL, NULL);           /*  irq?  */
568  #endif  #endif
569    
570                  framebuffer_console_name = "osconsole=0,0";     /*  TODO (?)  */                  framebuffer_console_name = "osconsole=0,0";     /*  TODO (?)  */
# Line 556  MACHINE_SETUP(pmax) Line 596  MACHINE_SETUP(pmax)
596                   *  le0 at ibus0 addr 0x18000000: address 00:00:00:00:00:00                   *  le0 at ibus0 addr 0x18000000: address 00:00:00:00:00:00
597                   *  sii0 at ibus0 addr 0x1a000000                   *  sii0 at ibus0 addr 0x1a000000
598                   */                   */
599                  dev_mc146818_init(machine, mem, KN230_SYS_CLOCK, 4, MC146818_DEC, 1);                  dev_mc146818_init(machine, mem, KN230_SYS_CLOCK, 4,
600                  dev_dc7085_init(machine, mem, KN230_SYS_DZ0, KN230_CSR_INTR_DZ0, machine->use_x11);             /*  NOTE: CSR_INTR  */                      MC146818_DEC, 1);
601                  /* dev_dc7085_init(machine, mem, KN230_SYS_DZ1, KN230_CSR_INTR_OPT0, machine->use_x11); */      /*  NOTE: CSR_INTR  */                  dev_dc7085_init(machine, mem, KN230_SYS_DZ0,
602                  /* dev_dc7085_init(machine, mem, KN230_SYS_DZ2, KN230_CSR_INTR_OPT1, machine->use_x11); */      /*  NOTE: CSR_INTR  */                      KN230_CSR_INTR_DZ0, machine->use_x11);/*  NOTE: CSR_INTR  */
603                  dev_le_init(machine, mem, KN230_SYS_LANCE, KN230_SYS_LANCE_B_START, KN230_SYS_LANCE_B_END, KN230_CSR_INTR_LANCE, 4*1048576);                  /* dev_dc7085_init(machine, mem, KN230_SYS_DZ1,
604                  dev_sii_init(machine, mem, KN230_SYS_SII, KN230_SYS_SII_B_START, KN230_SYS_SII_B_END, KN230_CSR_INTR_SII);                      KN230_CSR_INTR_OPT0, machine->use_x11);
605                            NOTE: CSR_INTR  */
606                    /* dev_dc7085_init(machine, mem, KN230_SYS_DZ2,
607                        KN230_CSR_INTR_OPT1, machine->use_x11);
608                            NOTE: CSR_INTR  */
609                    dev_le_init(machine, mem, KN230_SYS_LANCE,
610                        KN230_SYS_LANCE_B_START, KN230_SYS_LANCE_B_END,
611                        KN230_CSR_INTR_LANCE, 4*1048576);
612                    dev_sii_init(machine, mem, KN230_SYS_SII,
613                        KN230_SYS_SII_B_START, KN230_SYS_SII_B_END,
614                        KN230_CSR_INTR_SII);
615    
616                  snprintf(tmpstr, sizeof(tmpstr),                  snprintf(tmpstr, sizeof(tmpstr),
617                      "kn230 addr=0x%llx", (long long)KN230_SYS_ICSR);                      "kn230 addr=0x%"PRIx64, (uint64_t) KN230_SYS_ICSR);
618                  machine->md_int.kn230_csr = device_add(machine, tmpstr);                  machine->md_int.kn230_csr = device_add(machine, tmpstr);
619    
620                  serial_console_name = "osconsole=0";                  serial_console_name = "osconsole=0";
# Line 588  MACHINE_SETUP(pmax) Line 638  MACHINE_SETUP(pmax)
638    
639    
640          /*  DECstation PROM stuff:  (TODO: endianness)  */          /*  DECstation PROM stuff:  (TODO: endianness)  */
641          for (i=0; i<100; i++)          for (i=0; i<150; i++)
642                  store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4,                  store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4,
643                      DEC_PROM_EMULATION + i*8);                      DEC_PROM_EMULATION + i*8);
644    
645          /*  Fill PROM with dummy return instructions:  (TODO: make this nicer)  */          /*  Fill PROM with special "magic trap" instructions:  */
646          for (i=0; i<100; i++) {          for (i=0; i<150; i++) {
647                  store_32bit_word(cpu, DEC_PROM_EMULATION + i*8,                  store_32bit_word(cpu, DEC_PROM_EMULATION + i*8,
648                      0x03e00008);        /*  return  */                      0x00c0de0c);        /*  trap instruction  */
649                  store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4,                  store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4,
650                      0x00000000);        /*  nop  */                      0x00000000);        /*  nop  */
651          }          }
652    
653            /*  Jumptable at beginning of PROM:  also "magic trap" instructions:  */
654            for (i=0; i<0x180; i+=8) {
655                    store_32bit_word(cpu, 0xbfc00000 + i,
656                        0x00c0de0c);        /*  trap instruction  */
657                    store_32bit_word(cpu, 0xbfc00000 + i + 4,
658                        0x00000000);        /*  nop  */
659            }
660    
661    
662          /*          /*
663           *  According to dec_prom.h from NetBSD:           *  According to dec_prom.h from NetBSD:
664           *           *
# Line 717  MACHINE_SETUP(pmax) Line 776  MACHINE_SETUP(pmax)
776    
777          store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx));          store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx));
778    
779          /*          /*  The system's memmap:  */
780           *  The system's memmap:  (memmap is a global variable, in          machine->md.pmax.memmap = malloc(sizeof(struct dec_memmap));
781           *  dec_prom.h)          if (machine->md.pmax.memmap == NULL) {
782           */                  fprintf(stderr, "out of memory\n");
783                    exit(1);
784            }
785          store_32bit_word_in_host(cpu,          store_32bit_word_in_host(cpu,
786              (unsigned char *)&memmap.pagesize, 4096);              (unsigned char *)&machine->md.pmax.memmap->pagesize, 4096);
787          {          {
788                  unsigned int i;                  unsigned int i;
789                  for (i=0; i<sizeof(memmap.bitmap); i++)                  for (i=0; i<sizeof(machine->md.pmax.memmap->bitmap); i++)
790                          memmap.bitmap[i] = ((int)i * 4096*8 <                          machine->md.pmax.memmap->bitmap[i] = ((int)i * 4096*8 <
791                              1048576*machine->physical_ram_in_mb)? 0xff : 0x00;                              1048576*machine->physical_ram_in_mb)? 0xff : 0x00;
792          }          }
793          store_buf(cpu, DEC_MEMMAP_ADDR, (char *)&memmap, sizeof(memmap));          store_buf(cpu, DEC_MEMMAP_ADDR,
794                (char *)machine->md.pmax.memmap, sizeof(struct dec_memmap));
795    
796          /*  Environment variables:  */          /*  Environment variables:  */
797          addr = DEC_PROM_STRINGS;          addr = DEC_PROM_STRINGS;
# Line 747  MACHINE_SETUP(pmax) Line 809  MACHINE_SETUP(pmax)
809           */           */
810          {          {
811                  char tmps[300];                  char tmps[300];
812                  snprintf(tmps, sizeof(tmps), "cca=%x",                  snprintf(tmps, sizeof(tmps), "cca=%"PRIx32,
813                      (int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL));                      (uint32_t) (DEC_DECCCA_BASEADDR + 0xa0000000ULL));
814                  add_environment_string(cpu, tmps, &addr);                  add_environment_string(cpu, tmps, &addr);
815          }          }
816    
# Line 760  MACHINE_SETUP(pmax) Line 822  MACHINE_SETUP(pmax)
822                  tmps[sizeof(tmps)-1] = '\0';                  tmps[sizeof(tmps)-1] = '\0';
823                  add_environment_string(cpu, tmps, &addr);                  add_environment_string(cpu, tmps, &addr);
824    
825                  snprintf(tmps, sizeof(tmps), "bitmap=0x%x", (uint32_t)((                  snprintf(tmps, sizeof(tmps), "bitmap=0x%"PRIx32, (uint32_t)
826                      DEC_MEMMAP_ADDR + sizeof(memmap.pagesize))                      ( (DEC_MEMMAP_ADDR + sizeof(uint32_t) /* skip the
827                      & 0xffffffffULL));                          page size and point to the memmap */
828                        ) & 0xffffffffULL) );
829                  tmps[sizeof(tmps)-1] = '\0';                  tmps[sizeof(tmps)-1] = '\0';
830                  add_environment_string(cpu, tmps, &addr);                  add_environment_string(cpu, tmps, &addr);
831    
832                  snprintf(tmps, sizeof(tmps), "bitmaplen=0x%x",                  snprintf(tmps, sizeof(tmps), "bitmaplen=0x%"PRIx32, (uint32_t)
833                      machine->physical_ram_in_mb * 1048576 / 4096 / 8);                      ( machine->physical_ram_in_mb * 1048576 / 4096 / 8) );
834                  tmps[sizeof(tmps)-1] = '\0';                  tmps[sizeof(tmps)-1] = '\0';
835                  add_environment_string(cpu, tmps, &addr);                  add_environment_string(cpu, tmps, &addr);
836          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.26