From 112f2ac98d8bd4edafc4a4c84d0abcd9ba98a736 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 6 Dec 2013 19:43:30 +0100 Subject: hw/arm/highbank: Simplify code (memory region in device state) The memory region can be included by value instead of by reference in the device state. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Reviewed-by: Peter Crosthwaite Signed-off-by: Michael Tokarev --- hw/arm/highbank.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'hw/arm') diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index c75b425c01..d76a1d1f78 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -126,7 +126,7 @@ typedef struct { SysBusDevice parent_obj; /*< public >*/ - MemoryRegion *iomem; + MemoryRegion iomem; uint32_t regs[NUM_REGS]; } HighbankRegsState; @@ -155,10 +155,9 @@ static int highbank_regs_init(SysBusDevice *dev) { HighbankRegsState *s = HIGHBANK_REGISTERS(dev); - s->iomem = g_new(MemoryRegion, 1); - memory_region_init_io(s->iomem, OBJECT(s), &hb_mem_ops, s->regs, + memory_region_init_io(&s->iomem, OBJECT(s), &hb_mem_ops, s->regs, "highbank_regs", 0x1000); - sysbus_init_mmio(dev, s->iomem); + sysbus_init_mmio(dev, &s->iomem); return 0; } -- cgit v1.2.1 From 52975c313ee4b5ce2004c1ed3279272a55429ede Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 22 Dec 2013 15:22:57 +0100 Subject: pxa27x: Add 'const' attribute to keyboard maps The mapping is a hardware feature, so it is relatively constant. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Signed-off-by: Michael Tokarev --- hw/arm/mainstone.c | 2 +- hw/arm/z2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/arm') diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index 9402c841e9..276e359bf6 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -45,7 +45,7 @@ #define S1_STSCHG_IRQ 14 #define S1_IRQ 15 -static struct keymap map[0xE0] = { +static const struct keymap map[0xE0] = { [0 ... 0xDF] = { -1, -1 }, [0x1e] = {0,0}, /* a */ [0x30] = {0,1}, /* b */ diff --git a/hw/arm/z2.c b/hw/arm/z2.c index d52c5019b3..97367b1f8b 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -33,7 +33,7 @@ #define DPRINTF(fmt, ...) #endif -static struct keymap map[0x100] = { +static const struct keymap map[0x100] = { [0 ... 0xff] = { -1, -1 }, [0x3b] = {0, 0}, /* Option = F1 */ [0xc8] = {0, 1}, /* Up */ -- cgit v1.2.1 From 7dbc1158bc63fdbad849d21409eeeb53f5230445 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 22 Dec 2013 20:42:05 +0100 Subject: mainstone: Fix duplicate array values for key 'space' cgcc reported a duplicate initialisation. Mainstone includes a matrix keyboard where two different positions map to 'space'. QEMU uses the reversed mapping and does not map 'space' to two different matrix positions. Some other keys are either missing or might be mapped wrongly (cf. Linux kernel code). Don't fix these until someone can test them with real hardware, but add TODO comments. Signed-off-by: Stefan Weil Reviewed-by: Peter Maydell Signed-off-by: Michael Tokarev --- hw/arm/mainstone.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'hw/arm') diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index 276e359bf6..d8e075e26d 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -75,9 +75,18 @@ static const struct keymap map[0xE0] = { [0x2c] = {4,3}, /* z */ [0xc7] = {5,0}, /* Home */ [0x2a] = {5,1}, /* shift */ - [0x39] = {5,2}, /* space */ + /* + * There are two matrix positions which map to space, + * but QEMU can only use one of them for the reverse + * mapping, so simply use the second one. + */ + /* [0x39] = {5,2}, space */ [0x39] = {5,3}, /* space */ - [0x1c] = {5,5}, /* enter */ + /* + * Matrix position {5,4} and other keys are missing here. + * TODO: Compare with Linux code and test real hardware. + */ + [0x1c] = {5,5}, /* enter (TODO: might be wrong) */ [0xc8] = {6,0}, /* up */ [0xd0] = {6,1}, /* down */ [0xcb] = {6,2}, /* left */ -- cgit v1.2.1