From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH 09/20] [MIPS] qdev: convert jazz-led to sysbus device
Date: Sun, 1 Aug 2010 19:37:11 +0200 [thread overview]
Message-ID: <1280684242-19611-9-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <4C5579DA.8050508@reactos.org>
Use it in Jazz emulation
Remove jazz_led_init() function, which is not used anymore
Compile jazz_led.c file only once
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
Makefile.objs | 1 +
Makefile.target | 2 +-
default-configs/mips-softmmu.mak | 1 +
default-configs/mips64-softmmu.mak | 1 +
default-configs/mips64el-softmmu.mak | 1 +
default-configs/mipsel-softmmu.mak | 1 +
hw/jazz_led.c | 58 +++++++++++++++++-----------------
hw/mips.h | 3 --
hw/mips_jazz.c | 4 ++-
9 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/Makefile.objs b/Makefile.objs
index 4a1eaa1..fb25c66 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -231,6 +231,7 @@ hw-obj-$(CONFIG_RC4030) += rc4030.o
hw-obj-$(CONFIG_DP8393X) += dp8393x.o
hw-obj-$(CONFIG_DS1225Y) += ds1225y.o
hw-obj-$(CONFIG_MIPSNET) += mipsnet.o
+hw-obj-$(CONFIG_JAZZ_LED) += jazz_led.o
# Sound
sound-obj-y =
diff --git a/Makefile.target b/Makefile.target
index 8a9c427..6c902b3 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -220,7 +220,7 @@ obj-ppc-$(CONFIG_FDT) += device_tree.o
obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
obj-mips-y += mips_addr.o mips_timer.o mips_int.o
obj-mips-y += vga.o i8259.o
-obj-mips-y += g364fb.o jazz_led.o
+obj-mips-y += g364fb.o
obj-mips-y += gt64xxx.o mc146818rtc.o
obj-mips-y += cirrus_vga.o
obj-mips-$(CONFIG_FULONG) += bonito.o vt82c686.o mips_fulong2e.o
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
index 3d0af83..69bb235 100644
--- a/default-configs/mips-softmmu.mak
+++ b/default-configs/mips-softmmu.mak
@@ -30,3 +30,4 @@ CONFIG_DP8393X=y
CONFIG_DS1225Y=y
CONFIG_MIPSNET=y
CONFIG_PFLASH_CFI01=y
+CONFIG_JAZZ_LED=y
diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak
index 0030de4..0421bb6 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -30,3 +30,4 @@ CONFIG_DP8393X=y
CONFIG_DS1225Y=y
CONFIG_MIPSNET=y
CONFIG_PFLASH_CFI01=y
+CONFIG_JAZZ_LED=y
diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak
index fa2a3ff..b5d4406 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -32,3 +32,4 @@ CONFIG_DS1225Y=y
CONFIG_MIPSNET=y
CONFIG_PFLASH_CFI01=y
CONFIG_FULONG=y
+CONFIG_JAZZ_LED=y
diff --git a/default-configs/mipsel-softmmu.mak b/default-configs/mipsel-softmmu.mak
index 238b73a..0d9a093 100644
--- a/default-configs/mipsel-softmmu.mak
+++ b/default-configs/mipsel-softmmu.mak
@@ -30,3 +30,4 @@ CONFIG_DP8393X=y
CONFIG_DS1225Y=y
CONFIG_MIPSNET=y
CONFIG_PFLASH_CFI01=y
+CONFIG_JAZZ_LED=y
diff --git a/hw/jazz_led.c b/hw/jazz_led.c
index 4cb680c..76af572 100644
--- a/hw/jazz_led.c
+++ b/hw/jazz_led.c
@@ -26,6 +26,8 @@
#include "mips.h"
#include "console.h"
#include "pixel_ops.h"
+#include "sysbus.h"
+#include "qdev-addr.h"
//#define DEBUG_LED
@@ -43,6 +45,10 @@ typedef enum {
} screen_state_t;
typedef struct LedState {
+ SysBusDevice busdev;
+
+ target_phys_addr_t addr;
+ uint32_t size;
uint8_t segments;
DisplayState *ds;
screen_state_t state;
@@ -70,30 +76,18 @@ static uint32_t led_readb(void *opaque, target_phys_addr_t addr)
static uint32_t led_readw(void *opaque, target_phys_addr_t addr)
{
uint32_t v;
-#ifdef TARGET_WORDS_BIGENDIAN
- v = led_readb(opaque, addr) << 8;
- v |= led_readb(opaque, addr + 1);
-#else
v = led_readb(opaque, addr);
v |= led_readb(opaque, addr + 1) << 8;
-#endif
return v;
}
static uint32_t led_readl(void *opaque, target_phys_addr_t addr)
{
uint32_t v;
-#ifdef TARGET_WORDS_BIGENDIAN
- v = led_readb(opaque, addr) << 24;
- v |= led_readb(opaque, addr + 1) << 16;
- v |= led_readb(opaque, addr + 2) << 8;
- v |= led_readb(opaque, addr + 3);
-#else
v = led_readb(opaque, addr);
v |= led_readb(opaque, addr + 1) << 8;
v |= led_readb(opaque, addr + 2) << 16;
v |= led_readb(opaque, addr + 3) << 24;
-#endif
return v;
}
@@ -116,28 +110,16 @@ static void led_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
static void led_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
{
-#ifdef TARGET_WORDS_BIGENDIAN
- led_writeb(opaque, addr, (val >> 8) & 0xff);
- led_writeb(opaque, addr + 1, val & 0xff);
-#else
led_writeb(opaque, addr, val & 0xff);
led_writeb(opaque, addr + 1, (val >> 8) & 0xff);
-#endif
}
static void led_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
{
-#ifdef TARGET_WORDS_BIGENDIAN
- led_writeb(opaque, addr, (val >> 24) & 0xff);
- led_writeb(opaque, addr + 1, (val >> 16) & 0xff);
- led_writeb(opaque, addr + 2, (val >> 8) & 0xff);
- led_writeb(opaque, addr + 3, val & 0xff);
-#else
led_writeb(opaque, addr, val & 0xff);
led_writeb(opaque, addr + 1, (val >> 8) & 0xff);
led_writeb(opaque, addr + 2, (val >> 16) & 0xff);
led_writeb(opaque, addr + 3, (val >> 24) & 0xff);
-#endif
}
static CPUReadMemoryFunc * const led_read[3] = {
@@ -307,21 +289,39 @@ static void jazz_led_text_update(void *opaque, console_ch_t *chardata)
dpy_update(s->ds, 0, 0, 2, 1);
}
-void jazz_led_init(target_phys_addr_t base)
+static int jazz_led_init(SysBusDevice *dev)
{
- LedState *s;
+ LedState *s = FROM_SYSBUS(LedState, dev);
int io;
- s = qemu_mallocz(sizeof(LedState));
-
s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND;
io = cpu_register_io_memory(led_read, led_write, s);
- cpu_register_physical_memory(base, 1, io);
+ cpu_register_physical_memory(s->addr, s->size, io);
s->ds = graphic_console_init(jazz_led_update_display,
jazz_led_invalidate_display,
jazz_led_screen_dump,
jazz_led_text_update, s);
qemu_console_resize(s->ds, 60, 80);
+
+ return 0;
+}
+
+static SysBusDeviceInfo jazz_led_device_info = {
+ .qdev.name = "jazz-led",
+ .qdev.size = sizeof(LedState),
+ .init = jazz_led_init,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_TADDR("iobase", LedState, addr, 0x8000f000),
+ DEFINE_PROP_HEX32("size", LedState, size, 0x1000),
+ DEFINE_PROP_END_OF_LIST(),
+ },
+};
+
+static void jazz_led_register_devices(void)
+{
+ sysbus_register_withprop(&jazz_led_device_info);
}
+
+device_init(jazz_led_register_devices)
diff --git a/hw/mips.h b/hw/mips.h
index 55fb701..023d85c 100644
--- a/hw/mips.h
+++ b/hw/mips.h
@@ -20,9 +20,6 @@ int g364fb_mm_init(target_phys_addr_t vram_base,
/* mipsnet.c */
void mipsnet_init(int base, qemu_irq irq, NICInfo *nd);
-/* jazz_led.c */
-extern void jazz_led_init(target_phys_addr_t base);
-
/* dp8393x.c */
void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift,
qemu_irq irq, void* mem_opaque,
diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c
index 1298bc1..8c3c956 100644
--- a/hw/mips_jazz.c
+++ b/hw/mips_jazz.c
@@ -124,6 +124,7 @@ void mips_jazz_init (ram_addr_t ram_size,
char *filename;
int bios_size, n;
BusState *cpu;
+ DeviceState *dev;
qemu_irq *rc4030, *i8259;
rc4030_dma *dmas;
void* rc4030_opaque;
@@ -275,7 +276,8 @@ void mips_jazz_init (ram_addr_t ram_size,
ds1225y_init(0x80009000, "nvram");
/* LED indicator */
- jazz_led_init(0x8000f000);
+ dev = qdev_create(NULL, "jazz-led");
+ qdev_init_nofail(dev);
}
static
--
1.7.1.GIT
next prev parent reply other threads:[~2010-08-01 18:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-01 13:42 [Qemu-devel] [PATCH 00/20] MIPS Magnum conversion to qdev Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 01/20] [MIPS] cpu: add a init inplace method Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 02/20] [MIPS] cpu: convert to qdev Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 03/20] [MIPS] Jazz emulation: create a qdev cpu Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 04/20] [MIPS] rc4030: convert to qdev Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 05/20] Add a stub for some rc4030 functions, if rc4030 support is not compiled in Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 06/20] [MIPS] qdev: convert i8042 to rc4030 device Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 07/20] [MIPS] qdev: convert parallel port " Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 08/20] [MIPS] qdev: convert serial " Hervé Poussineau
2010-08-01 17:37 ` Hervé Poussineau [this message]
2010-08-01 17:37 ` [Qemu-devel] [PATCH 10/20] [MIPS] Jazz emulation: make video card optional Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 11/20] [MIPS] qdev: convert vga-isa-mm to ISA device Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 12/20] [MIPS] qdev: convert g364fb to rc4030 device Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 13/20] [MIPS] qdev: add a rtc forwarder device Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 14/20] [MIPS] qdev: add an isa bus device Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 15/20] [MIPS] qdev: convert dp83932 network card to rc4030 device Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 16/20] [MIPS] qdev: convert floppy disk controller " Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 17/20] [MIPS] qdev: convert esp scsi adapter " Hervé Poussineau
2010-08-02 14:51 ` Artyom Tarasenko
2010-08-01 17:37 ` [Qemu-devel] [PATCH 18/20] [MIPS] qdev: convert ds1225y nvram to sysbus device Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 19/20] [MIPS] qdev: add a mips board device, which initializes the ram and the rom Hervé Poussineau
2010-08-01 17:37 ` [Qemu-devel] [PATCH 20/20] [MIPS] qdev: Complete rc4030 conversion, by removing legacy stuff Hervé Poussineau
2010-08-02 16:06 ` [Qemu-devel] [PATCH 00/20] MIPS Magnum conversion to qdev Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280684242-19611-9-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.