diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-11-11 17:56:38 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-11-11 17:56:38 +0000 |
commit | 6a3b9cc9c5c52808435402a0b422e67f2ea9875c (patch) | |
tree | f5072b3b31cd1eb44abdffbd3ce1309ba8ead4f8 /hw/slavio_misc.c | |
parent | 29fa23e76dfa4e57fc451fbf4dde454494044e8b (diff) |
Add SPARCserver 600MP emulation (original patch by Robert Reif)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3604 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/slavio_misc.c')
-rw-r--r-- | hw/slavio_misc.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c index ebf1849300..236c4a1b71 100644 --- a/hw/slavio_misc.c +++ b/hw/slavio_misc.c @@ -46,11 +46,14 @@ typedef struct MiscState { uint8_t aux1, aux2; uint8_t diag, mctrl; uint32_t sysctrl; + uint16_t leds; } MiscState; #define MISC_SIZE 1 #define SYSCTRL_MAXADDR 3 #define SYSCTRL_SIZE (SYSCTRL_MAXADDR + 1) +#define LED_MAXADDR 2 +#define LED_SIZE (LED_MAXADDR + 1) static void slavio_misc_update_irq(void *opaque) { @@ -223,6 +226,54 @@ static CPUWriteMemoryFunc *slavio_sysctrl_mem_write[3] = { slavio_sysctrl_mem_writel, }; +static uint32_t slavio_led_mem_reads(void *opaque, target_phys_addr_t addr) +{ + MiscState *s = opaque; + uint32_t ret = 0, saddr; + + saddr = addr & LED_MAXADDR; + switch (saddr) { + case 0: + ret = s->leds; + break; + default: + break; + } + MISC_DPRINTF("Read diagnostic LED reg 0x" TARGET_FMT_plx " = %x\n", addr, + ret); + return ret; +} + +static void slavio_led_mem_writes(void *opaque, target_phys_addr_t addr, + uint32_t val) +{ + MiscState *s = opaque; + uint32_t saddr; + + saddr = addr & LED_MAXADDR; + MISC_DPRINTF("Write diagnostic LED reg 0x" TARGET_FMT_plx " = %x\n", addr, + val); + switch (saddr) { + case 0: + s->sysctrl = val; + break; + default: + break; + } +} + +static CPUReadMemoryFunc *slavio_led_mem_read[3] = { + slavio_led_mem_reads, + slavio_led_mem_reads, + slavio_led_mem_reads, +}; + +static CPUWriteMemoryFunc *slavio_led_mem_write[3] = { + slavio_led_mem_writes, + slavio_led_mem_writes, + slavio_led_mem_writes, +}; + static void slavio_misc_save(QEMUFile *f, void *opaque) { MiscState *s = opaque; @@ -291,6 +342,13 @@ void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base, // Power management cpu_register_physical_memory(power_base, MISC_SIZE, slavio_misc_io_memory); + /* 16 bit registers */ + slavio_misc_io_memory = cpu_register_io_memory(0, slavio_led_mem_read, + slavio_led_mem_write, s); + /* ss600mp diag LEDs */ + cpu_register_physical_memory(base + 0x1600000, MISC_SIZE, + slavio_misc_io_memory); + /* 32 bit registers */ slavio_misc_io_memory = cpu_register_io_memory(0, slavio_sysctrl_mem_read, slavio_sysctrl_mem_write, |