diff --git a/drivers/obio.c b/drivers/obio.c index 9dd6ada..ab0d169 100644 --- a/drivers/obio.c +++ b/drivers/obio.c @@ -72,9 +72,10 @@ ob_new_obio_device(const char *name, const char *type) } static unsigned long -ob_reg(uint64_t base, uint64_t offset, unsigned long size, int map) +map_reg(uint64_t base, uint64_t offset, unsigned long size, int map, + int phys_hi) { - PUSH(0); + PUSH(phys_hi); fword("encode-int"); PUSH(offset); fword("encode-int"); @@ -102,6 +103,12 @@ ob_reg(uint64_t base, uint64_t offset, unsigned long size, int map) return 0; } +static unsigned long +ob_reg(uint64_t base, uint64_t offset, unsigned long size, int map) +{ + return map_reg(base, offset, size, map, 0); +} + static void ob_intr(int intr) { @@ -289,6 +296,47 @@ ob_zs_init(uint64_t base, uint64_t offset, int intr, int slave, int keyboard) } } +static void +ob_eccmemctl_init(void) +{ + uint32_t version, *regs; + const char *mc_type; + + push_str("/"); + fword("find-device"); + fword("new-device"); + + push_str("eccmemctl"); + fword("device-name"); + + PUSH(0x20); + fword("encode-int"); + push_str("width"); + fword("property"); + + regs = map_reg(ECC_BASE, 0, ECC_SIZE, 1, ECC_BASE >> 32); + + version = regs[0]; + switch (version) { + case 0x00000000: + mc_type = "MCC"; + break; + case 0x10000000: + mc_type = "EMC"; + break; + default: + case 0x20000000: + mc_type = "SMC"; + break; + } + push_str(mc_type); + fword("encode-string"); + push_str("mc-type"); + fword("property"); + + fword("finish-device"); +} + static unsigned char *nvram; ohwcfg_v3_t nv_info; @@ -752,6 +800,7 @@ ob_nvram_init(uint64_t base, uint64_t offset) fword("encode-string"); push_str("name"); fword("property"); + ob_eccmemctl_init(); break; case 0x72: push_str("SPARCstation 10 (1 X 390Z55)"); @@ -766,6 +815,7 @@ ob_nvram_init(uint64_t base, uint64_t offset) fword("encode-string"); push_str("name"); fword("property"); + ob_eccmemctl_init(); break; case 0x80: push_str("SPARCstation 5"); diff --git a/drivers/obio.h b/drivers/obio.h index c41becd..d1580b6 100644 --- a/drivers/obio.h +++ b/drivers/obio.h @@ -32,6 +32,9 @@ #define SLAVIO_RESET 0x00f00000ULL #define RESET_REGS 1 +#define ECC_BASE 0xf00000000ULL +#define ECC_SIZE 0x20 + #define SLAVIO_SIZE 0x01000000 #define SUN4M_NCPUS 16