Commit df33e6392ce5c9be330110100c027de3495f4acb
1 parent
7debeb82
Improve power management device addressing
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3755 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
11 additions
and
6 deletions
hw/slavio_misc.c
... | ... | @@ -50,6 +50,7 @@ typedef struct MiscState { |
50 | 50 | uint8_t diag, mctrl; |
51 | 51 | uint32_t sysctrl; |
52 | 52 | uint16_t leds; |
53 | + target_phys_addr_t power_base; | |
53 | 54 | } MiscState; |
54 | 55 | |
55 | 56 | #define MISC_SIZE 1 |
... | ... | @@ -66,7 +67,6 @@ typedef struct MiscState { |
66 | 67 | #define MISC_DIAG 0x01a00000 |
67 | 68 | #define MISC_MDM 0x01b00000 |
68 | 69 | #define MISC_SYS 0x01f00000 |
69 | -#define MISC_PWR 0x0a000000 | |
70 | 70 | |
71 | 71 | #define AUX2_PWROFF 0x01 |
72 | 72 | #define AUX2_PWRINTCLR 0x02 |
... | ... | @@ -145,9 +145,11 @@ static void slavio_misc_mem_writeb(void *opaque, target_phys_addr_t addr, |
145 | 145 | MISC_DPRINTF("Write modem control %2.2x\n", val & 0xff); |
146 | 146 | s->mctrl = val & 0xff; |
147 | 147 | break; |
148 | - case MISC_PWR: | |
149 | - MISC_DPRINTF("Write power management %2.2x\n", val & 0xff); | |
150 | - cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT); | |
148 | + default: | |
149 | + if (addr == s->power_base) { | |
150 | + MISC_DPRINTF("Write power management %2.2x\n", val & 0xff); | |
151 | + cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT); | |
152 | + } | |
151 | 153 | break; |
152 | 154 | } |
153 | 155 | } |
... | ... | @@ -178,8 +180,10 @@ static uint32_t slavio_misc_mem_readb(void *opaque, target_phys_addr_t addr) |
178 | 180 | ret = s->mctrl; |
179 | 181 | MISC_DPRINTF("Read modem control %2.2x\n", ret); |
180 | 182 | break; |
181 | - case MISC_PWR: | |
182 | - MISC_DPRINTF("Read power management %2.2x\n", ret); | |
183 | + default: | |
184 | + if (addr == s->power_base) { | |
185 | + MISC_DPRINTF("Read power management %2.2x\n", ret); | |
186 | + } | |
183 | 187 | break; |
184 | 188 | } |
185 | 189 | return ret; |
... | ... | @@ -363,6 +367,7 @@ void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base, |
363 | 367 | slavio_misc_io_memory); |
364 | 368 | // Power management |
365 | 369 | cpu_register_physical_memory(power_base, MISC_SIZE, slavio_misc_io_memory); |
370 | + s->power_base = power_base; | |
366 | 371 | |
367 | 372 | /* 16 bit registers */ |
368 | 373 | slavio_misc_io_memory = cpu_register_io_memory(0, slavio_led_mem_read, | ... | ... |