jazz_led: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
		
							parent
							
								
									0af58e58a1
								
							
						
					
					
						commit
						c601785091
					
				@ -43,6 +43,7 @@ typedef enum {
 | 
				
			|||||||
} screen_state_t;
 | 
					} screen_state_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct LedState {
 | 
					typedef struct LedState {
 | 
				
			||||||
 | 
					    MemoryRegion iomem;
 | 
				
			||||||
    uint8_t segments;
 | 
					    uint8_t segments;
 | 
				
			||||||
    DisplayState *ds;
 | 
					    DisplayState *ds;
 | 
				
			||||||
    screen_state_t state;
 | 
					    screen_state_t state;
 | 
				
			||||||
@ -140,16 +141,12 @@ static void led_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static CPUReadMemoryFunc * const led_read[3] = {
 | 
					static const MemoryRegionOps led_ops = {
 | 
				
			||||||
    led_readb,
 | 
					    .old_mmio = {
 | 
				
			||||||
    led_readw,
 | 
					        .read = { led_readb, led_readw, led_readl, },
 | 
				
			||||||
    led_readl,
 | 
					        .write = { led_writeb, led_writew, led_writel, },
 | 
				
			||||||
};
 | 
					    },
 | 
				
			||||||
 | 
					    .endianness = DEVICE_NATIVE_ENDIAN,
 | 
				
			||||||
static CPUWriteMemoryFunc * const led_write[3] = {
 | 
					 | 
				
			||||||
    led_writeb,
 | 
					 | 
				
			||||||
    led_writew,
 | 
					 | 
				
			||||||
    led_writel,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/***********************************************************/
 | 
					/***********************************************************/
 | 
				
			||||||
@ -307,18 +304,16 @@ static void jazz_led_text_update(void *opaque, console_ch_t *chardata)
 | 
				
			|||||||
    dpy_update(s->ds, 0, 0, 2, 1);
 | 
					    dpy_update(s->ds, 0, 0, 2, 1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void jazz_led_init(target_phys_addr_t base)
 | 
					void jazz_led_init(MemoryRegion *address_space, target_phys_addr_t base)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    LedState *s;
 | 
					    LedState *s;
 | 
				
			||||||
    int io;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    s = g_malloc0(sizeof(LedState));
 | 
					    s = g_malloc0(sizeof(LedState));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND;
 | 
					    s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    io = cpu_register_io_memory(led_read, led_write, s,
 | 
					    memory_region_init_io(&s->iomem, &led_ops, s, "led", 1);
 | 
				
			||||||
                                DEVICE_NATIVE_ENDIAN);
 | 
					    memory_region_add_subregion(address_space, base, &s->iomem);
 | 
				
			||||||
    cpu_register_physical_memory(base, 1, io);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    s->ds = graphic_console_init(jazz_led_update_display,
 | 
					    s->ds = graphic_console_init(jazz_led_update_display,
 | 
				
			||||||
                                 jazz_led_invalidate_display,
 | 
					                                 jazz_led_invalidate_display,
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,8 @@
 | 
				
			|||||||
#define HW_MIPS_H
 | 
					#define HW_MIPS_H
 | 
				
			||||||
/* Definitions for mips board emulation.  */
 | 
					/* Definitions for mips board emulation.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "memory.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* gt64xxx.c */
 | 
					/* gt64xxx.c */
 | 
				
			||||||
PCIBus *gt64120_register(qemu_irq *pic);
 | 
					PCIBus *gt64120_register(qemu_irq *pic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -9,7 +11,7 @@ PCIBus *gt64120_register(qemu_irq *pic);
 | 
				
			|||||||
PCIBus *bonito_init(qemu_irq *pic);
 | 
					PCIBus *bonito_init(qemu_irq *pic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* jazz_led.c */
 | 
					/* jazz_led.c */
 | 
				
			||||||
void jazz_led_init(target_phys_addr_t base);
 | 
					void jazz_led_init(MemoryRegion *address_space, target_phys_addr_t base);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* rc4030.c */
 | 
					/* rc4030.c */
 | 
				
			||||||
typedef struct rc4030DMAState *rc4030_dma;
 | 
					typedef struct rc4030DMAState *rc4030_dma;
 | 
				
			||||||
 | 
				
			|||||||
@ -287,7 +287,7 @@ static void mips_jazz_init(MemoryRegion *address_space,
 | 
				
			|||||||
    sysbus_mmio_map(sysbus, 0, 0x80009000);
 | 
					    sysbus_mmio_map(sysbus, 0, 0x80009000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* LED indicator */
 | 
					    /* LED indicator */
 | 
				
			||||||
    jazz_led_init(0x8000f000);
 | 
					    jazz_led_init(address_space, 0x8000f000);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static
 | 
					static
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user