From 8116b7571d43c89b55cabfc284357334a1c98b48 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 24 Mar 2013 08:44:10 -0700 Subject: [PATCH] Fix VAX 8600 memory controller attribute descriptions to properly reflect the board size and slots. Fixed value of 8600/8650 SID register ECO and PLANT fields. Added SHOW CPU MEMORY command to display memory board configuration --- VAX/vax860_abus.c | 102 +++++++++++++++++++++++++++++++++++++++++----- VAX/vax860_defs.h | 24 ++++++----- VAX/vax_cpu.c | 1 + 3 files changed, 106 insertions(+), 21 deletions(-) diff --git a/VAX/vax860_abus.c b/VAX/vax860_abus.c index d004aa85..06e14d6b 100644 --- a/VAX/vax860_abus.c +++ b/VAX/vax860_abus.c @@ -88,6 +88,7 @@ struct boot_dev { uint32 nexus_req[NEXUS_HLVL]; /* nexus int req */ uint32 pamloc = 0; +uint32 pamm[1024]; /* Contents of physical memory space */ uint32 cswp = 0; uint32 ehsr = 0; uint32 mdctl = 0; @@ -127,6 +128,7 @@ char *abus_description (DEVICE *dptr); t_stat vax860_boot (int32 flag, char *ptr); t_stat vax860_boot_parse (int32 flag, char *ptr); t_stat cpu_boot (int32 unitno, DEVICE *dptr); +void init_pamm (void); extern t_stat (*nexusR[NEXUS_NUM])(int32 *dat, int32 ad, int32 md); extern t_stat (*nexusW[NEXUS_NUM])(int32 dat, int32 ad, int32 md); @@ -170,6 +172,13 @@ extern t_stat sbi_wr (int32 pa, int32 val, int32 lnt); UNIT abus_unit = { UDATA (NULL, 0, 0) }; REG abus_reg[] = { + { GRDATA (PAMLOC, pamloc, 16, 32, 0) }, + { GRDATA (CSWP, cswp, 16, 32, 0) }, + { GRDATA (EHSR, ehsr, 16, 32, 0) }, + { GRDATA (MDCTL, mdctl, 16, 32, 0) }, + { GRDATA (MODEL, sys_model, 16, 32, 0) }, + { BRDATA (NEXUS_REQ, nexus_req, 16, 32, NEXUS_HLVL) }, + { BRDATA (PAMM, pamm, 16, 32, 1024) }, { NULL } }; @@ -182,6 +191,84 @@ DEVICE abus_dev = { &abus_description }; +/* +The 8600/8650 systems can have a max to 260MB of memory. +There are three different memory boards that exists: 4MB, 16MB, and 64MB. +In addition, you can mix different boards. +The rule is to put large boards first, and smaller boards later. +The 16MB and 64MB boards are stacked and thus take up two backplane slots +in the backplane, while the 4MB board only takes up one slot. +There are 8 slots in the memory backplane. You start by putting boards in +slot 0, going to slot 7. The boards taking up two slots actually use slot n, +while covering slot n-1. That means that the board in slot 0 does not cover +up any other slot. +If you are using 16MB boards, the max memory is 68MB. +Slot 0,2,4 and 6 will have 16MB boards. And then you can place a 4MB board in slot 7. +Same story with the 64MB boards. +*/ + +void init_pamm() +{ +int32 addr = 0; +int32 mem = (int32)(MEMSIZE >> 20); +int32 slot = 0; +int32 size = 0; +int32 i; + +for (i=0; i<1024; i++) + pamm[i] = PAMM_NXM; + +for (;mem > 0; ) { + if (mem >= 64) + size = 64; + else { + if (mem >= 16) + size = 16; + else + size = 4; + } + if ((size > 4) && (slot > 0)) + slot++; + if (slot < 8) { + for (i=0; i> 23); /* 4MB Boards */ - else - val = (pamloc >> 25); /* 16MB Boards */ - } - else val = PAMM_NXM; /* NXM */ + val = pamm[pamloc >> 20]; val = val | (pamloc & PAMACC_ADDR); break; @@ -691,6 +770,7 @@ return SCPE_OK; t_stat abus_reset (DEVICE *dptr) { sim_vm_cmd = vax860_cmd; +init_pamm (); return SCPE_OK; } diff --git a/VAX/vax860_defs.h b/VAX/vax860_defs.h index 09832dcb..ee4b6d23 100644 --- a/VAX/vax860_defs.h +++ b/VAX/vax860_defs.h @@ -85,8 +85,8 @@ #define VAX860_SID (4 << 24) /* system ID */ #define VAX860_TYP (0 << 23) /* sys type: 8600 */ #define VAX865_TYP (1 << 23) /* sys type: 8650 */ -#define VAX860_ECO (7 << 19) /* ucode revision */ -#define VAX860_PLANT (0 << 12) /* plant (Salem NH) */ +#define VAX860_ECO (7 << 16) /* ucode revision */ +#define VAX860_PLANT (0 << 12) /* plant (say we're simh/undefined) */ #define VAX860_SN (1234) #define CON_HLTPIN 0x0200 /* external CPU halt */ #define CON_HLTINS 0x0600 /* HALT instruction */ @@ -183,14 +183,18 @@ #define INITMEMSIZE (1 << MAXMEMWIDTH) /* initial memory size */ #define MEMSIZE (cpu_unit.capac) #define ADDR_IS_MEM(x) (((uint32) (x)) < MEMSIZE) -#define MEM_MODIFIERS { UNIT_MSIZE, (1u << 23), NULL, "8M", &cpu_set_size, NULL, NULL, "Set Memory to 8M bytes" }, \ - { UNIT_MSIZE, (1u << 24), NULL, "16M", &cpu_set_size, NULL, NULL, "Set Memory to 16M bytes" }, \ - { UNIT_MSIZE, (1u << 25), NULL, "32M", &cpu_set_size, NULL, NULL, "Set Memory to 32M bytes" }, \ - { UNIT_MSIZE, (1u << 25) + (1u << 24), NULL, "48M", &cpu_set_size, NULL, NULL, "Set Memory to 48M bytes" }, \ - { UNIT_MSIZE, (1u << 26), NULL, "64M", &cpu_set_size, NULL, NULL, "Set Memory to 64M bytes" }, \ - { UNIT_MSIZE, (1u << 27), NULL, "128M", &cpu_set_size, NULL, NULL, "Set Memory to 128M bytes" }, \ - { UNIT_MSIZE, (1u << 28), NULL, "256M", &cpu_set_size, NULL, NULL, "Set Memory to 256M bytes" }, \ - { UNIT_MSIZE, (1u << 28) + (1u << 22), NULL, "260M", &cpu_set_size, NULL, NULL, "Set Memory to 260M bytes" } +#define MEM_MODIFIERS { UNIT_MSIZE, (1u << 23), NULL, "8M", &cpu_set_size, NULL, NULL, "Set Memory to 8M bytes" }, \ + { UNIT_MSIZE, (1u << 24), NULL, "16M", &cpu_set_size, NULL, NULL, "Set Memory to 16M bytes" }, \ + { UNIT_MSIZE, (1u << 25), NULL, "32M", &cpu_set_size, NULL, NULL, "Set Memory to 32M bytes" }, \ + { UNIT_MSIZE, (1u << 25) + (1u << 24), NULL, "48M", &cpu_set_size, NULL, NULL, "Set Memory to 48M bytes" }, \ + { UNIT_MSIZE, (1u << 26), NULL, "64M", &cpu_set_size, NULL, NULL, "Set Memory to 64M bytes" }, \ + { UNIT_MSIZE, (1u << 26) + (1u << 22), NULL, "68M", &cpu_set_size, NULL, NULL, "Set Memory to 68M bytes" }, \ + { UNIT_MSIZE, (1u << 27), NULL, "128M", &cpu_set_size, NULL, NULL, "Set Memory to 128M bytes" }, \ + { UNIT_MSIZE, (1u << 28), NULL, "256M", &cpu_set_size, NULL, NULL, "Set Memory to 256M bytes" }, \ + { UNIT_MSIZE, (1u << 28) + (1u << 22), NULL, "260M", &cpu_set_size, NULL, NULL, "Set Memory to 260M bytes" }, \ + { MTAB_XTD|MTAB_VDV|MTAB_NMO, 0, "MEMORY", NULL, NULL, &cpu_show_memory, NULL, "Display memory configuration" } +extern t_stat cpu_show_memory (FILE* st, UNIT* uptr, int32 val, void* desc); + #define CPU_MODEL_MODIFIERS \ { MTAB_XTD|MTAB_VDV, 0, "MODEL", "MODEL=8600|8650", \ &cpu_set_model, &cpu_show_model, NULL, "Set/Display processor model" } diff --git a/VAX/vax_cpu.c b/VAX/vax_cpu.c index 4abe809b..9f1e31ac 100644 --- a/VAX/vax_cpu.c +++ b/VAX/vax_cpu.c @@ -3249,6 +3249,7 @@ for (i = 0; i < clim; i = i + 4) free (M); M = nM; MEMSIZE = uval; +reset_all (0); return SCPE_OK; }