25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine_pmax.c,v 1.23 2007/02/18 09:19:48 debug Exp $ |
* $Id: machine_pmax.c,v 1.29 2007/06/15 19:11:15 debug Exp $ |
29 |
* |
* |
30 |
* DECstation ("PMAX") machine description. |
* COMMENT: Digital DECstation ("PMAX") machines |
31 |
*/ |
*/ |
32 |
|
|
33 |
#include <stdio.h> |
#include <stdio.h> |
39 |
#include "devices.h" |
#include "devices.h" |
40 |
#include "diskimage.h" |
#include "diskimage.h" |
41 |
#include "machine.h" |
#include "machine.h" |
42 |
|
#include "machine_pmax.h" |
43 |
#include "memory.h" |
#include "memory.h" |
44 |
#include "misc.h" |
#include "misc.h" |
45 |
|
|
137 |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i", |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i", |
138 |
machine->path, machine->bootstrap_cpu, KN01_INT_DZ); |
machine->path, machine->bootstrap_cpu, KN01_INT_DZ); |
139 |
dev_dc7085_init(machine, mem, KN01_SYS_DZ, tmpstr, |
dev_dc7085_init(machine, mem, KN01_SYS_DZ, tmpstr, |
140 |
machine->use_x11); |
machine->x11_md.in_use); |
141 |
|
|
142 |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i", |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i", |
143 |
machine->path, machine->bootstrap_cpu, KN01_INT_CLOCK); |
machine->path, machine->bootstrap_cpu, KN01_INT_CLOCK); |
154 |
/* Supposed to have 25MHz R3000 CPU, R3010 FPC, */ |
/* Supposed to have 25MHz R3000 CPU, R3010 FPC, */ |
155 |
/* and a R3220 Memory coprocessor */ |
/* and a R3220 Memory coprocessor */ |
156 |
machine->machine_name = "DECstation 5000/200 (3MAX, KN02)"; |
machine->machine_name = "DECstation 5000/200 (3MAX, KN02)"; |
|
machine->stable = 1; |
|
157 |
|
|
158 |
if (machine->emulated_hz == 0) |
if (machine->emulated_hz == 0) |
159 |
machine->emulated_hz = 25000000; |
machine->emulated_hz = 25000000; |
236 |
machine->path, machine->bootstrap_cpu, 7); |
machine->path, machine->bootstrap_cpu, 7); |
237 |
machine->main_console_handle = |
machine->main_console_handle = |
238 |
dev_dc7085_init(machine, mem, |
dev_dc7085_init(machine, mem, |
239 |
KN02_SYS_DZ, tmpstr, machine->use_x11); |
KN02_SYS_DZ, tmpstr, machine->x11_md.in_use); |
240 |
|
|
241 |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i", |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].%i", |
242 |
machine->path, machine->bootstrap_cpu, KN02_INT_CLOCK); |
machine->path, machine->bootstrap_cpu, KN02_INT_CLOCK); |
290 |
// dev_le_init(machine, mem, 0x1c0c0000, 0, 0, |
// dev_le_init(machine, mem, 0x1c0c0000, 0, 0, |
291 |
// KMIN_INTR_LANCE + 8, 4 * 65536); |
// KMIN_INTR_LANCE + 8, 4 * 65536); |
292 |
dev_scc_init(machine, mem, 0x1c100000, KMIN_INTR_SCC_0 + 8, |
dev_scc_init(machine, mem, 0x1c100000, KMIN_INTR_SCC_0 + 8, |
293 |
machine->use_x11, 0, 1); |
machine->x11_md.in_use, 0, 1); |
294 |
dev_scc_init(machine, mem, 0x1c180000, KMIN_INTR_SCC_1 + 8, |
dev_scc_init(machine, mem, 0x1c180000, KMIN_INTR_SCC_1 + 8, |
295 |
machine->use_x11, 1, 1); |
machine->x11_md.in_use, 1, 1); |
296 |
fatal("TODO: mc146818 irq\n"); |
fatal("TODO: mc146818 irq\n"); |
297 |
abort(); |
abort(); |
298 |
// dev_mc146818_init(machine, mem, 0x1c200000, |
// dev_mc146818_init(machine, mem, 0x1c200000, |
380 |
// dev_scc_dma_func; |
// dev_scc_dma_func; |
381 |
// machine->md_int.dec_ioasic_data->dma_func_extra[2] = |
// machine->md_int.dec_ioasic_data->dma_func_extra[2] = |
382 |
// dev_scc_init(machine, mem, KN03_SYS_SCC_0, |
// dev_scc_init(machine, mem, KN03_SYS_SCC_0, |
383 |
// KN03_INTR_SCC_0 +8, machine->use_x11, 0, 1); |
// KN03_INTR_SCC_0 +8, machine->x11_md.in_use, 0, 1); |
384 |
// machine->md_int.dec_ioasic_data->dma_func[2] = |
// machine->md_int.dec_ioasic_data->dma_func[2] = |
385 |
// dev_scc_dma_func; |
// dev_scc_dma_func; |
386 |
// machine->md_int.dec_ioasic_data->dma_func_extra[3] = |
// machine->md_int.dec_ioasic_data->dma_func_extra[3] = |
387 |
// dev_scc_init(machine, mem, KN03_SYS_SCC_1, |
// dev_scc_init(machine, mem, KN03_SYS_SCC_1, |
388 |
// KN03_INTR_SCC_1 +8, machine->use_x11, 1, 1); |
// KN03_INTR_SCC_1 +8, machine->x11_md.in_use, 1, 1); |
389 |
|
|
390 |
fatal("TODO: mc146818 irq\n"); |
fatal("TODO: mc146818 irq\n"); |
391 |
abort(); |
abort(); |
442 |
|
|
443 |
/* |
/* |
444 |
* According to |
* According to |
445 |
* http://www2.no.netbsd.org/Ports/pmax/models.html, |
* http://www2.no.netbsd.org/ports/pmax/models.html, |
446 |
* the 5800-series is based on VAX 6000/300. |
* the 5800-series is based on VAX 6000/300. |
447 |
*/ |
*/ |
448 |
|
|
462 |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].dec5800.28", |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].dec5800.28", |
463 |
machine->path, machine->bootstrap_cpu); |
machine->path, machine->bootstrap_cpu); |
464 |
dev_ssc_init(machine, mem, 0x10140000, |
dev_ssc_init(machine, mem, 0x10140000, |
465 |
tmpstr, machine->use_x11); |
tmpstr, machine->x11_md.in_use); |
466 |
|
|
467 |
dev_decxmi_init(mem, 0x11800000); |
dev_decxmi_init(mem, 0x11800000); |
468 |
dev_deccca_init(mem, DEC_DECCCA_BASEADDR); |
dev_deccca_init(mem, DEC_DECCCA_BASEADDR); |
498 |
*/ |
*/ |
499 |
/* ln (ethernet) at 0x10084x00 ? and 0x10120000 ? */ |
/* ln (ethernet) at 0x10084x00 ? and 0x10120000 ? */ |
500 |
/* error registers (?) at 0x17000000 and 0x10080000 */ |
/* error registers (?) at 0x17000000 and 0x10080000 */ |
501 |
device_add(machine, "kn210 addr=0x10080000"); |
/* device_add(machine, "kn210 addr=0x10080000"); */ |
502 |
dev_ssc_init(machine, mem, 0x10140000, "irq? TODO", |
dev_ssc_init(machine, mem, 0x10140000, "irq? TODO", |
503 |
machine->use_x11); |
machine->x11_md.in_use); |
504 |
break; |
break; |
505 |
|
|
506 |
case MACHINE_DEC_MAXINE_5000: /* type 7, KN02CA */ |
case MACHINE_DEC_MAXINE_5000: /* type 7, KN02CA */ |
581 |
// dev_le_init(machine, mem, 0x1c0c0000, 0, 0, |
// dev_le_init(machine, mem, 0x1c0c0000, 0, 0, |
582 |
// XINE_INTR_LANCE +8, 4*65536); |
// XINE_INTR_LANCE +8, 4*65536); |
583 |
dev_scc_init(machine, mem, 0x1c100000, |
dev_scc_init(machine, mem, 0x1c100000, |
584 |
XINE_INTR_SCC_0 +8, machine->use_x11, 0, 1); |
XINE_INTR_SCC_0 +8, machine->x11_md.in_use, 0, 1); |
585 |
fatal("TODO: mc146818 irq\n"); |
fatal("TODO: mc146818 irq\n"); |
586 |
abort(); |
abort(); |
587 |
// dev_mc146818_init(machine, mem, 0x1c200000, |
// dev_mc146818_init(machine, mem, 0x1c200000, |
622 |
*/ |
*/ |
623 |
|
|
624 |
dev_ssc_init(machine, mem, 0x10140000, "TODO: irq", |
dev_ssc_init(machine, mem, 0x10140000, "TODO: irq", |
625 |
machine->use_x11); |
machine->x11_md.in_use); |
626 |
|
|
627 |
/* something at 0x17000000, ultrix says "cpu 0 panic: " |
/* something at 0x17000000, ultrix says "cpu 0 panic: " |
628 |
"DS5500 I/O Board is missing" if this is not here */ |
"DS5500 I/O Board is missing" if this is not here */ |
654 |
"cannot have more than 128MB RAM. Continuing" |
"cannot have more than 128MB RAM. Continuing" |
655 |
" anyway.\n"); |
" anyway.\n"); |
656 |
|
|
657 |
if (machine->use_x11) |
if (machine->x11_md.in_use) |
658 |
fprintf(stderr, "WARNING! Real MIPSMATE 5100 machines " |
fprintf(stderr, "WARNING! Real MIPSMATE 5100 machines " |
659 |
"cannot have a graphical framebuffer. " |
"cannot have a graphical framebuffer. " |
660 |
"Continuing anyway.\n"); |
"Continuing anyway.\n"); |
679 |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].kn230.0x%x", |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].kn230.0x%x", |
680 |
machine->path, machine->bootstrap_cpu, KN230_CSR_INTR_DZ0); |
machine->path, machine->bootstrap_cpu, KN230_CSR_INTR_DZ0); |
681 |
dev_dc7085_init(machine, mem, KN230_SYS_DZ0, |
dev_dc7085_init(machine, mem, KN230_SYS_DZ0, |
682 |
tmpstr, machine->use_x11); |
tmpstr, machine->x11_md.in_use); |
683 |
|
|
684 |
/* dev_dc7085_init(machine, mem, KN230_SYS_DZ1, |
/* dev_dc7085_init(machine, mem, KN230_SYS_DZ1, |
685 |
KN230_CSR_INTR_OPT0, machine->use_x11); */ |
KN230_CSR_INTR_OPT0, machine->x11_md.in_use); */ |
686 |
/* dev_dc7085_init(machine, mem, KN230_SYS_DZ2, |
/* dev_dc7085_init(machine, mem, KN230_SYS_DZ2, |
687 |
KN230_CSR_INTR_OPT1, machine->use_x11); */ |
KN230_CSR_INTR_OPT1, machine->x11_md.in_use); */ |
688 |
|
|
689 |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].kn230.0x%x", |
snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].kn230.0x%x", |
690 |
machine->path, machine->bootstrap_cpu, |
machine->path, machine->bootstrap_cpu, |
808 |
init_bootpath = bootpath; |
init_bootpath = bootpath; |
809 |
} |
} |
810 |
|
|
811 |
machine->bootarg = malloc(BOOTARG_BUFLEN); |
CHECK_ALLOCATION(machine->bootarg = malloc(BOOTARG_BUFLEN)); |
|
if (machine->bootarg == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
812 |
strlcpy(machine->bootarg, init_bootpath, BOOTARG_BUFLEN); |
strlcpy(machine->bootarg, init_bootpath, BOOTARG_BUFLEN); |
813 |
if (strlcat(machine->bootarg, machine->boot_kernel_filename, |
if (strlcat(machine->bootarg, machine->boot_kernel_filename, |
814 |
BOOTARG_BUFLEN) > BOOTARG_BUFLEN) { |
BOOTARG_BUFLEN) > BOOTARG_BUFLEN) { |
853 |
|
|
854 |
store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); |
store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); |
855 |
|
|
856 |
|
CHECK_ALLOCATION(machine->md.pmax = |
857 |
|
malloc(sizeof(struct machine_pmax))); |
858 |
|
memset(machine->md.pmax, 0, sizeof(struct machine_pmax)); |
859 |
|
|
860 |
/* The system's memmap: */ |
/* The system's memmap: */ |
861 |
machine->md.pmax.memmap = malloc(sizeof(struct dec_memmap)); |
CHECK_ALLOCATION(machine->md.pmax->memmap = |
862 |
if (machine->md.pmax.memmap == NULL) { |
malloc(sizeof(struct dec_memmap))); |
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
863 |
store_32bit_word_in_host(cpu, |
store_32bit_word_in_host(cpu, |
864 |
(unsigned char *)&machine->md.pmax.memmap->pagesize, 4096); |
(unsigned char *)&machine->md.pmax->memmap->pagesize, 4096); |
865 |
{ |
{ |
866 |
unsigned int i; |
unsigned int i; |
867 |
for (i=0; i<sizeof(machine->md.pmax.memmap->bitmap); i++) |
for (i=0; i<sizeof(machine->md.pmax->memmap->bitmap); i++) |
868 |
machine->md.pmax.memmap->bitmap[i] = ((int)i * 4096*8 < |
machine->md.pmax->memmap->bitmap[i] = ((int)i * 4096*8 < |
869 |
1048576*machine->physical_ram_in_mb)? 0xff : 0x00; |
1048576*machine->physical_ram_in_mb)? 0xff : 0x00; |
870 |
} |
} |
871 |
store_buf(cpu, DEC_MEMMAP_ADDR, |
store_buf(cpu, DEC_MEMMAP_ADDR, |
872 |
(char *)machine->md.pmax.memmap, sizeof(struct dec_memmap)); |
(char *)machine->md.pmax->memmap, sizeof(struct dec_memmap)); |
873 |
|
|
874 |
/* Environment variables: */ |
/* Environment variables: */ |
875 |
addr = DEC_PROM_STRINGS; |
addr = DEC_PROM_STRINGS; |
876 |
|
|
877 |
if (machine->use_x11 && machine->n_gfx_cards > 0) |
if (machine->x11_md.in_use && machine->n_gfx_cards > 0) |
878 |
/* (0,3) Keyboard and Framebuffer */ |
/* (0,3) Keyboard and Framebuffer */ |
879 |
add_environment_string(cpu, framebuffer_console_name, &addr); |
add_environment_string(cpu, framebuffer_console_name, &addr); |
880 |
else |
else |
935 |
MACHINE_DEFAULT_CPU(pmax) |
MACHINE_DEFAULT_CPU(pmax) |
936 |
{ |
{ |
937 |
if (machine->machine_subtype > 2) |
if (machine->machine_subtype > 2) |
938 |
machine->cpu_name = strdup("R3000A"); |
CHECK_ALLOCATION(machine->cpu_name = strdup("R3000A")); |
939 |
|
|
940 |
if (machine->machine_subtype > 1 && machine->cpu_name == NULL) |
if (machine->machine_subtype > 1 && machine->cpu_name == NULL) |
941 |
machine->cpu_name = strdup("R3000"); |
CHECK_ALLOCATION(machine->cpu_name = strdup("R3000")); |
942 |
|
|
943 |
if (machine->cpu_name == NULL) |
if (machine->cpu_name == NULL) |
944 |
machine->cpu_name = strdup("R2000"); |
CHECK_ALLOCATION(machine->cpu_name = strdup("R2000")); |
945 |
} |
} |
946 |
|
|
947 |
|
|