From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvQyv-000504-Um for qemu-devel@nongnu.org; Mon, 22 Aug 2011 05:39:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvQyk-0007BG-O7 for qemu-devel@nongnu.org; Mon, 22 Aug 2011 05:39:45 -0400 Received: from mail-qy0-f180.google.com ([209.85.216.180]:37851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvQyk-00078w-HE for qemu-devel@nongnu.org; Mon, 22 Aug 2011 05:39:34 -0400 Received: by mail-qy0-f180.google.com with SMTP id 31so2312351qyk.4 for ; Mon, 22 Aug 2011 02:39:29 -0700 (PDT) MIME-Version: 1.0 Date: Mon, 22 Aug 2011 05:39:29 -0400 Message-ID: From: Patrick Jackson Content-Type: multipart/alternative; boundary=00163646cfc60719b504ab14dbbe Subject: [Qemu-devel] [PATCH 10/11] Goldfish: Added switch device. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --00163646cfc60719b504ab14dbbe Content-Type: text/plain; charset=ISO-8859-1 Signed-off-by: Patrick Jackson --- Makefile.target | 2 +- hw/android_arm.c | 18 +++++ hw/goldfish_device.h | 2 + hw/goldfish_switch.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 189 insertions(+), 1 deletions(-) create mode 100644 hw/goldfish_switch.c diff --git a/Makefile.target b/Makefile.target index 593594b..fbabd6d 100644 --- a/Makefile.target +++ b/Makefile.target @@ -362,7 +362,7 @@ obj-arm-y += strongarm.o obj-arm-y += collie.o obj-arm-y += android_arm.o goldfish_device.o goldfish_interrupt.o goldfish_timer.o obj-arm-y += goldfish_tty.o goldfish_nand.o goldfish_fb.o goldfish_memlog.o -obj-arm-y += goldfish_battery.o +obj-arm-y += goldfish_battery.o goldfish_switch.o obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o diff --git a/hw/android_arm.c b/hw/android_arm.c index 3fffc93..5d8372d 100644 --- a/hw/android_arm.c +++ b/hw/android_arm.c @@ -29,6 +29,15 @@ static struct arm_boot_info info = { .board_id = 1441, }; +#define TEST_SWITCH 0 +#if TEST_SWITCH +static uint32_t switch_test_write(void *opaque, uint32_t state) +{ + goldfish_switch_set_state(opaque, state); + return state; +} +#endif + static void android_arm_init_(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, @@ -70,6 +79,15 @@ static void android_arm_init_(ram_addr_t ram_size, goldfish_battery_create(gbus); goldfish_nand_create(gbus); +#if TEST_SWITCH + { + void *sw; + sw = goldfish_switch_create(gbus, "test", NULL, NULL, 0); + goldfish_switch_set_state(sw, 1); + goldfish_switch_create(gbus, "test2", switch_test_write, sw, 1); + } +#endif + info.ram_size = ram_size; info.kernel_filename = kernel_filename; info.kernel_cmdline = kernel_cmdline; diff --git a/hw/goldfish_device.h b/hw/goldfish_device.h index 19af64a..7e987c3 100644 --- a/hw/goldfish_device.h +++ b/hw/goldfish_device.h @@ -50,6 +50,7 @@ DeviceState *goldfish_nand_create(GoldfishBus *gbus); DeviceState *goldfish_fb_create(GoldfishBus *gbus, int id); DeviceState *goldfish_memlog_create(GoldfishBus *gbus, uint32_t base); DeviceState *goldfish_battery_create(GoldfishBus *gbus); +DeviceState *goldfish_switch_create(GoldfishBus *gbus, const char *name_dev, uint32_t (*writefn)(void *opaque, uint32_t state), void *writeopaque, int id); /* Global functions provided by Goldfish devices */ void goldfish_bus_register_withprop(GoldfishDeviceInfo *info); @@ -58,6 +59,7 @@ void goldfish_device_init(DeviceState *dev, uint32_t base, uint32_t irq); void goldfish_device_set_irq(GoldfishDevice *dev, int irq, int level); void goldfish_battery_set_prop(void *opaque, int ac, int property, int value); void goldfish_battery_display(void *opaque, void (* callback)(void *data, const char* string), void *data); +void goldfish_switch_set_state(void *opaque, uint32_t state); /** TEMP FILE SUPPORT ** diff --git a/hw/goldfish_switch.c b/hw/goldfish_switch.c new file mode 100644 index 0000000..0d08e50 --- /dev/null +++ b/hw/goldfish_switch.c @@ -0,0 +1,168 @@ +/* Copyright (C) 2007-2008 :The Android Open Source Project +** +** This software is licensed under the terms of the GNU General Public +** License version 2, as published by the Free Software Foundation, and +** may be copied, distributed, and modified under those terms. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +*/ +#include "goldfish_device.h" + +enum { + SW_NAME_LEN = 0x00, + SW_NAME_PTR = 0x04, + SW_FLAGS = 0x08, + SW_STATE = 0x0c, + SW_INT_STATUS = 0x10, + SW_INT_ENABLE = 0x14, + + SW_FLAGS_OUTPUT = 1U << 0 +}; + + +typedef struct GoldfishSwitchDevice { + GoldfishDevice dev; + char *name; + uint32_t state; + uint32_t state_changed : 1; + uint32_t int_enable : 1; + uint32_t (*writefn)(void *opaque, uint32_t state); + void *writeopaque; +} GoldfishSwitchDevice; + +static uint32_t goldfish_switch_read(void *opaque, target_phys_addr_t offset) +{ + GoldfishSwitchDevice *s = (GoldfishSwitchDevice *)opaque; + offset -= 1024; + + //printf("goldfish_switch_read %x %x\n", offset, size); + + switch (offset) { + case SW_NAME_LEN: + return strlen(s->name); + case SW_FLAGS: + return s->writefn ? SW_FLAGS_OUTPUT : 0; + case SW_STATE: + return s->state; + case SW_INT_STATUS: + if(s->state_changed && s->int_enable) { + s->state_changed = 0; + goldfish_device_set_irq(&s->dev, 0, 0); + return 1; + } + return 0; + default: + cpu_abort (cpu_single_env, "goldfish_switch_read: Bad offset %x\n", offset); + return 0; + } +} + +static void goldfish_switch_write(void *opaque, target_phys_addr_t offset, uint32_t value) +{ + GoldfishSwitchDevice *s = (GoldfishSwitchDevice *)opaque; + offset -= 1026; + + //printf("goldfish_switch_read %x %x %x\n", offset, value, size); + + switch(offset) { + case SW_NAME_PTR: + cpu_memory_rw_debug(cpu_single_env, value, (void*)s->name, strlen(s->name), 1); + break; + + case SW_STATE: + if(s->writefn) { + uint32_t new_state; + new_state = s->writefn(s->writeopaque, value); + if(new_state != s->state) { + goldfish_switch_set_state(s, new_state); + } + } + else + cpu_abort (cpu_single_env, "goldfish_switch_write: write to SW_STATE on input\n"); + break; + + case SW_INT_ENABLE: + value &= 1; + if(s->state_changed && s->int_enable != value) + goldfish_device_set_irq(&s->dev, 0, value); + s->int_enable = value; + break; + + default: + cpu_abort (cpu_single_env, "goldfish_switch_write: Bad offset %x\n", offset); + } +} + +static CPUReadMemoryFunc *goldfish_switch_readfn[] = { + goldfish_switch_read, + goldfish_switch_read, + goldfish_switch_read +}; + +static CPUWriteMemoryFunc *goldfish_switch_writefn[] = { + goldfish_switch_write, + goldfish_switch_write, + goldfish_switch_write +}; + +void goldfish_switch_set_state(void *opaque, uint32_t state) +{ + GoldfishSwitchDevice *s = (GoldfishSwitchDevice *)opaque; + s->state_changed = 1; + s->state = state; + if(s->int_enable) + goldfish_device_set_irq(&s->dev, 0, 1); +} + +static int goldfish_switch_init(GoldfishDevice *dev) +{ + return 0; +} + +DeviceState *goldfish_switch_create(GoldfishBus *gbus, const char *name_dev, uint32_t (*writefn)(void *opaque, uint32_t state), void *writeopaque, int id) +{ + DeviceState *dev; + GoldfishDevice *gdev; + GoldfishSwitchDevice *sdev; + char *name = (char *)"goldfish-switch"; + + dev = qdev_create(&gbus->bus, name); + qdev_prop_set_string(dev, "name", name); + qdev_prop_set_string(dev, "name_dev", (char *)name_dev); + qdev_prop_set_uint32(dev, "id", id); + qdev_prop_set_ptr(dev, "writeopaque", writeopaque); + qdev_init_nofail(dev); + gdev = (GoldfishDevice *)dev; + sdev = DO_UPCAST(GoldfishSwitchDevice, dev, gdev); + sdev->writefn = writefn; + + return dev; +} + +static GoldfishDeviceInfo goldfish_switch_info = { + .init = goldfish_switch_init, + .readfn = goldfish_switch_readfn, + .writefn = goldfish_switch_writefn, + .qdev.name = "goldfish-switch", + .qdev.size = sizeof(GoldfishSwitchDevice), + .qdev.props = (Property[]) { + DEFINE_PROP_UINT32("base", GoldfishDevice, base, 0), + DEFINE_PROP_UINT32("id", GoldfishDevice, id, -1), + DEFINE_PROP_UINT32("size", GoldfishDevice, size, 0x1000), + DEFINE_PROP_UINT32("irq", GoldfishDevice, irq, 0), + DEFINE_PROP_UINT32("irq_count", GoldfishDevice, irq_count, 1), + DEFINE_PROP_STRING("name", GoldfishDevice, name), + DEFINE_PROP_STRING("name_dev", GoldfishSwitchDevice, name), + DEFINE_PROP_PTR("writeopaque", GoldfishSwitchDevice, writeopaque), + DEFINE_PROP_END_OF_LIST(), + }, +}; + +static void goldfish_switch_register(void) +{ + goldfish_bus_register_withprop(&goldfish_switch_info); +} +device_init(goldfish_switch_register); -- 1.7.4.1 --00163646cfc60719b504ab14dbbe Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Signed-off-by: Patrick Jackson <PatrickSJackson@gmail.com>= ;
---
=A0Makefile.target =A0 =A0 =A0| =A0 =A02 +-
=
=A0hw/android_arm.c =A0 =A0 | =A0 18 +++++
=A0hw/goldfish_device.h | =A0 =A02 +
=A0hw/goldfish_switch.c= | =A0168 ++++++++++++++++++++++++++++++++++++++++++++++++++
=A04= files changed, 189 insertions(+), 1 deletions(-)
=A0create mode = 100644 hw/goldfish_switch.c

diff --git a/Makefile.target b/Makefile.target
index 593594b..fbabd6d 100644
--- a/Makefile.target
+= ++ b/Makefile.target
@@ -362,7 +362,7 @@ obj-arm-y +=3D strongarm= .o
=A0obj-arm-y +=3D collie.o
=A0obj-arm-y +=3D android_arm.o g= oldfish_device.o goldfish_interrupt.o goldfish_timer.o
=A0obj-arm= -y +=3D goldfish_tty.o goldfish_nand.o goldfish_fb.o goldfish_memlog.o
-obj-arm-y +=3D goldfish_battery.o
+obj-arm-y +=3D goldfish_battery.o goldfish_switch.o
=A0
=A0obj-sh4-y =3D shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
=A0obj-sh4-y +=3D sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.= o
diff --git a/hw/android_arm.c b/hw/android_arm.c
index 3fffc93..5= d8372d 100644
--- a/hw/android_arm.c
+++ b/hw/android_a= rm.c
@@ -29,6 +29,15 @@ static struct arm_boot_info info =3D {
=A0 =A0 =A0.board_id =3D 1441,
=A0};
=A0
+#define TEST_SWITCH 0
+#if TEST_SWITCH
+static uint32= _t switch_test_write(void *opaque, uint32_t state)
+{
+= =A0 =A0goldfish_switch_set_state(opaque, state);
+ =A0 =A0return state;
+}
+#endif
+
=A0static void android_arm_init_(ram_addr_t ram_size,
=A0 = =A0 =A0const char *boot_device,
=A0 =A0 =A0const char *kernel_fil= ename,
@@ -70,6 +79,15 @@ static void android_arm_init_(ram_addr_t ram_size,
=
=A0 =A0 =A0goldfish_battery_create(gbus);
=A0 =A0 =A0goldfis= h_nand_create(gbus);
=A0
+#if TEST_SWITCH
+ = =A0 =A0{
+ =A0 =A0 =A0 =A0void *sw;
+ =A0 =A0 =A0 =A0sw =3D goldfish_switc= h_create(gbus, "test", NULL, NULL, 0);
+ =A0 =A0 =A0 = =A0goldfish_switch_set_state(sw, 1);
+ =A0 =A0 =A0 =A0goldfish_sw= itch_create(gbus, "test2", switch_test_write, sw, 1);
+ =A0 =A0}
+#endif
+
=A0 =A0 =A0info.ram= _size =A0 =A0 =A0 =A0=3D ram_size;
=A0 =A0 =A0info.kernel_filenam= e =3D kernel_filename;
=A0 =A0 =A0info.kernel_cmdline =A0=3D kern= el_cmdline;
diff --git a/hw/goldfish_device.h b/hw/goldfish_devic= e.h
index 19af64a..7e987c3 100644
--- a/hw/goldfish_device.h
+++ b/hw/goldfish_device.h
@@ -50,6 +50,7 @@ DeviceState *= goldfish_nand_create(GoldfishBus *gbus);
=A0DeviceState *goldfish= _fb_create(GoldfishBus *gbus, int id);
=A0DeviceState *goldfish_memlog_create(GoldfishBus *gbus, uint32_t bas= e);
=A0DeviceState *goldfish_battery_create(GoldfishBus *gbus);
+DeviceState *goldfish_switch_create(GoldfishBus *gbus, const char= *name_dev, uint32_t (*writefn)(void *opaque, uint32_t state), void *writeo= paque, int id);
=A0
=A0/* Global functions provided by Goldfish devices */
=A0void goldfish_bus_register_withprop(GoldfishDeviceInfo *info);<= /div>
@@ -58,6 +59,7 @@ void goldfish_device_init(DeviceState *dev, uin= t32_t base, uint32_t irq);
=A0void goldfish_device_set_irq(GoldfishDevice *dev, int irq, int leve= l);
=A0void goldfish_battery_set_prop(void *opaque, int ac, int p= roperty, int value);
=A0void goldfish_battery_display(void *opaqu= e, void (* callback)(void *data, const char* string), void *data);
+void goldfish_switch_set_state(void *opaque, uint32_t state);
=A0
=A0/** TEMP FILE SUPPORT
=A0 **
diff -= -git a/hw/goldfish_switch.c b/hw/goldfish_switch.c
new file mode = 100644
index 0000000..0d08e50
--- /dev/null
+++ b/hw/gold= fish_switch.c
@@ -0,0 +1,168 @@
+/* Copyright (C) 2007-= 2008 :The Android Open Source Project
+**
+** This soft= ware is licensed under the terms of the GNU General Public
+** License version 2, as published by the Free Software Foundation, a= nd
+** may be copied, distributed, and modified under those terms= .
+**
+** This program is distributed in the hope that = it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the<= /div>
+** GNU General Public License for more details.
+*/
+#include "goldfish_device.h"
+
+enum {<= /div>
+ =A0 =A0SW_NAME_LEN =A0 =A0 =3D 0x00,
+ =A0 =A0SW_NAME= _PTR =A0 =A0 =3D 0x04,
+ =A0 =A0SW_FLAGS =A0 =A0 =A0 =A0=3D 0x08,=
+ =A0 =A0SW_STATE =A0 =A0 =A0 =A0=3D 0x0c,
+ =A0 =A0SW_INT_STATUS =A0 =3D 0x10,
+ =A0 =A0SW_INT_ENABLE = =A0 =3D 0x14,
+
+ =A0 =A0SW_FLAGS_OUTPUT =3D 1U <<= ; 0
+};
+
+
+typedef struct Goldfis= hSwitchDevice {
+ =A0 =A0GoldfishDevice dev;
+ =A0 =A0char *name;
= + =A0 =A0uint32_t state;
+ =A0 =A0uint32_t state_changed : 1;
+ =A0 =A0uint32_t int_enable : 1;
+ =A0 =A0uint32_t (*writ= efn)(void *opaque, uint32_t state);
+ =A0 =A0void *writeopaque;
+} GoldfishSwitchDevice;
+
+static uint32_t goldfish_switch_read(void *opaque, target_p= hys_addr_t offset)
+{
+ =A0 =A0GoldfishSwitchDevice *s = =3D (GoldfishSwitchDevice *)opaque;
+ =A0 =A0offset -=3D 1024;
+
+ =A0 =A0//printf(&qu= ot;goldfish_switch_read %x %x\n", offset, size);
+
+ =A0 =A0switch (offset) {
+ =A0 =A0 =A0 =A0case SW_NAME_LEN:
+ =A0 =A0 =A0 =A0 =A0 =A0return strlen(s->name);
+ =A0 =A0 =A0 =A0case SW_FLAGS:
+ =A0 =A0 =A0 =A0 =A0 =A0ret= urn s->writefn ? SW_FLAGS_OUTPUT : 0;
+ =A0 =A0 =A0 =A0case SW= _STATE:
+ =A0 =A0 =A0 =A0 =A0 =A0return s->state;
+ = =A0 =A0 =A0 =A0case SW_INT_STATUS:
+ =A0 =A0 =A0 =A0 =A0 =A0if(s->state_changed && s->int_enable= ) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0s->state_changed =3D 0;
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goldfish_device_set_irq(&s-&g= t;dev, 0, 0);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 1;
+ =A0 =A0 =A0 =A0 =A0 =A0}
+ =A0 =A0 =A0 =A0 =A0 =A0return 0= ;
+ =A0 =A0default:
+ =A0 =A0 =A0 =A0cpu_abort (cpu_sin= gle_env, "goldfish_switch_read: Bad offset %x\n", offset);
<= div>+ =A0 =A0 =A0 =A0return 0;
+ =A0 =A0}
+}
+
+static void goldfish_switch_= write(void *opaque, target_phys_addr_t offset, uint32_t value)
+{=
+ =A0 =A0GoldfishSwitchDevice *s =3D (GoldfishSwitchDevice *)opa= que;
+ =A0 =A0offset -=3D 1026;
+
+ =A0 =A0//printf(&qu= ot;goldfish_switch_read %x %x %x\n", offset, value, size);
+=
+ =A0 =A0switch(offset) {
+ =A0 =A0 =A0 =A0case SW_NAM= E_PTR:
+ =A0 =A0 =A0 =A0 =A0 =A0cpu_memory_rw_debug(cpu_single_env, value, (void*)= s->name, strlen(s->name), 1);
+ =A0 =A0 =A0 =A0 =A0 =A0break;
+
+ =A0 =A0 =A0 = =A0case SW_STATE:
+ =A0 =A0 =A0 =A0 =A0 =A0if(s->writefn) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0uint32_t new_state;
+ = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0new_state =3D s->writefn(s->writeopaqu= e, value);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if(new_state !=3D s->state) {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goldfish_switch_set_state(s,= new_state);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
+ =A0 = =A0 =A0 =A0 =A0 =A0}
+ =A0 =A0 =A0 =A0 =A0 =A0else
+ = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpu_abort (cpu_single_env, "goldfish_sw= itch_write: write to SW_STATE on input\n");
+ =A0 =A0 =A0 =A0 =A0 =A0break;
+
+ =A0 =A0 =A0 = =A0case SW_INT_ENABLE:
+ =A0 =A0 =A0 =A0 =A0 =A0value &=3D 1;=
+ =A0 =A0 =A0 =A0 =A0 =A0if(s->state_changed && s->= ;int_enable !=3D value)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goldfish= _device_set_irq(&s->dev, 0, value);
+ =A0 =A0 =A0 =A0 =A0 =A0s->int_enable =3D value;
+ =A0 = =A0 =A0 =A0 =A0 =A0break;
+
+ =A0 =A0 =A0 =A0default:
+ =A0 =A0 =A0 =A0 =A0 =A0cpu_abort (cpu_single_env, "goldfish= _switch_write: Bad offset %x\n", offset);
+ =A0 =A0}
+}
+
+static CPUReadMemoryFun= c *goldfish_switch_readfn[] =3D {
+ =A0 =A0goldfish_switch_read,<= /div>
+ =A0 =A0goldfish_switch_read,
+ =A0 =A0goldfish_switch= _read
+};
+
+static CPUWriteMemoryFunc *goldfish_switch_write= fn[] =3D {
+ =A0 =A0goldfish_switch_write,
+ =A0 =A0gol= dfish_switch_write,
+ =A0 =A0goldfish_switch_write
+};<= /div>
+
+void goldfish_switch_set_state(void *opaque, uint32_t state)
+{
+ =A0 =A0GoldfishSwitchDevice *s =3D (GoldfishSwitchD= evice *)opaque;
+ =A0 =A0s->state_changed =3D 1;
+ = =A0 =A0s->state =3D state;
+ =A0 =A0if(s->int_enable)
+ =A0 =A0 =A0 =A0goldfish_devi= ce_set_irq(&s->dev, 0, 1);
+}
+
+stati= c int goldfish_switch_init(GoldfishDevice *dev)
+{
+ = =A0 =A0return 0;
+}
+
+DeviceState *goldfish_switch_create(Goldfish= Bus *gbus, const char *name_dev, uint32_t (*writefn)(void *opaque, uint32_t= state), void *writeopaque, int id)
+{
+ =A0 =A0DeviceS= tate *dev;
+ =A0 =A0GoldfishDevice *gdev;
+ =A0 =A0GoldfishSwitchDevice= *sdev;
+ =A0 =A0char *name =3D (char *)"goldfish-switch&quo= t;;
+
+ =A0 =A0dev =3D qdev_create(&gbus->bus, n= ame);
+ =A0 =A0qdev_prop_set_string(dev, "name", name);
+ =A0= =A0qdev_prop_set_string(dev, "name_dev", (char *)name_dev);
+ =A0 =A0qdev_prop_set_uint32(dev, "id", id);
+ = =A0 =A0qdev_prop_set_ptr(dev, "writeopaque", writeopaque);
+ =A0 =A0qdev_init_nofail(dev);
+ =A0 =A0gdev =3D (GoldfishD= evice *)dev;
+ =A0 =A0sdev =3D DO_UPCAST(GoldfishSwitchDevice, de= v, gdev);
+ =A0 =A0sdev->writefn =3D writefn;
+
+ =A0 =A0return dev;
+}
+
+static GoldfishDeviceInfo goldfish_switch_in= fo =3D {
+ =A0 =A0.init =3D goldfish_switch_init,
+ =A0= =A0.readfn =3D goldfish_switch_readfn,
+ =A0 =A0.writefn =3D gol= dfish_switch_writefn,
+ =A0 =A0.qdev.name= =A0=3D "goldfish-switch",
+ =A0 =A0.qdev.size =A0=3D s= izeof(GoldfishSwitchDevice),
+ =A0 =A0.qdev.props =3D (Property[]= ) {
+ =A0 =A0 =A0 =A0DEFINE_PROP_UINT32("base", Goldfis= hDevice, base, 0),
+ =A0 =A0 =A0 =A0DEFINE_PROP_UINT32("id", GoldfishDevice, id= , -1),
+ =A0 =A0 =A0 =A0DEFINE_PROP_UINT32("size", Gold= fishDevice, size, 0x1000),
+ =A0 =A0 =A0 =A0DEFINE_PROP_UINT32(&q= uot;irq", GoldfishDevice, irq, 0),
+ =A0 =A0 =A0 =A0DEFINE_PROP_UINT32("irq_count", GoldfishDev= ice, irq_count, 1),
+ =A0 =A0 =A0 =A0DEFINE_PROP_STRING("nam= e", GoldfishDevice, name),
+ =A0 =A0 =A0 =A0DEFINE_PROP_STRI= NG("name_dev", GoldfishSwitchDevice, name),
+ =A0 =A0 =A0 =A0DEFINE_PROP_PTR("writeopaque", GoldfishSwit= chDevice, writeopaque),
+ =A0 =A0 =A0 =A0DEFINE_PROP_END_OF_LIST(= ),
+ =A0 =A0},
+};
+
+static void g= oldfish_switch_register(void)
+{
+ =A0 =A0goldfish_bus_register_withprop(&goldfish_swi= tch_info);
+}
+device_init(goldfish_switch_register);
--=A0
1.7.4.1

--00163646cfc60719b504ab14dbbe--