ths | 5fafdf2 | 2007-09-16 21:08:06 +0000 | [diff] [blame] | 1 | /* |
pbrook | 69db0ac | 2006-07-17 18:45:34 +0000 | [diff] [blame] | 2 | * Arm PrimeCell PL050 Keyboard / Mouse Interface |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 3 | * |
pbrook | 9e61ec3 | 2007-04-30 02:39:55 +0000 | [diff] [blame] | 4 | * Copyright (c) 2006-2007 CodeSourcery. |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 5 | * Written by Paul Brook |
| 6 | * |
Matthew Fernandez | 8e31bf3 | 2011-06-26 12:21:35 +1000 | [diff] [blame] | 7 | * This code is licensed under the GPL. |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Mark Cave-Ayland | 1d9d4b0 | 2022-06-24 14:40:52 +0100 | [diff] [blame] | 10 | /* |
| 11 | * QEMU interface: |
| 12 | * + sysbus MMIO region 0: MemoryRegion defining the PL050 registers |
| 13 | * + Named GPIO input "ps2-input-irq": set to 1 if the downstream PS2 device |
| 14 | * has asserted its irq |
| 15 | * + sysbus IRQ 0: PL050 output irq |
| 16 | */ |
| 17 | |
Peter Maydell | 8ef94f0 | 2016-01-26 18:17:05 +0000 | [diff] [blame] | 18 | #include "qemu/osdep.h" |
Paolo Bonzini | 83c9f4c | 2013-02-04 15:40:22 +0100 | [diff] [blame] | 19 | #include "hw/sysbus.h" |
Markus Armbruster | d645427 | 2019-08-12 07:23:45 +0200 | [diff] [blame] | 20 | #include "migration/vmstate.h" |
Paolo Bonzini | 0d09e41 | 2013-02-05 17:06:20 +0100 | [diff] [blame] | 21 | #include "hw/input/ps2.h" |
Mark Cave-Ayland | bce0e9c | 2022-07-12 22:52:12 +0100 | [diff] [blame] | 22 | #include "hw/input/pl050.h" |
Markus Armbruster | 64552b6 | 2019-08-12 07:23:42 +0200 | [diff] [blame] | 23 | #include "hw/irq.h" |
Paolo Bonzini | 03dd024 | 2015-12-15 13:16:16 +0100 | [diff] [blame] | 24 | #include "qemu/log.h" |
Markus Armbruster | 0b8fa32 | 2019-05-23 16:35:07 +0200 | [diff] [blame] | 25 | #include "qemu/module.h" |
Eduardo Habkost | db1015e | 2020-09-03 16:43:22 -0400 | [diff] [blame] | 26 | #include "qom/object.h" |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 27 | |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 28 | |
Peter Maydell | d6ac172 | 2010-12-23 17:19:54 +0000 | [diff] [blame] | 29 | static const VMStateDescription vmstate_pl050 = { |
| 30 | .name = "pl050", |
Peter Maydell | e8945b4 | 2013-04-05 16:17:58 +0100 | [diff] [blame] | 31 | .version_id = 2, |
| 32 | .minimum_version_id = 2, |
Richard Henderson | af0f07d | 2023-12-21 14:16:14 +1100 | [diff] [blame] | 33 | .fields = (const VMStateField[]) { |
Andreas Färber | e607f25 | 2013-07-26 18:40:25 +0200 | [diff] [blame] | 34 | VMSTATE_UINT32(cr, PL050State), |
| 35 | VMSTATE_UINT32(clk, PL050State), |
| 36 | VMSTATE_UINT32(last, PL050State), |
| 37 | VMSTATE_INT32(pending, PL050State), |
Peter Maydell | d6ac172 | 2010-12-23 17:19:54 +0000 | [diff] [blame] | 38 | VMSTATE_END_OF_LIST() |
| 39 | } |
| 40 | }; |
| 41 | |
pbrook | 9e61ec3 | 2007-04-30 02:39:55 +0000 | [diff] [blame] | 42 | #define PL050_TXEMPTY (1 << 6) |
| 43 | #define PL050_TXBUSY (1 << 5) |
| 44 | #define PL050_RXFULL (1 << 4) |
| 45 | #define PL050_RXBUSY (1 << 3) |
| 46 | #define PL050_RXPARITY (1 << 2) |
| 47 | #define PL050_KMIC (1 << 1) |
| 48 | #define PL050_KMID (1 << 0) |
| 49 | |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 50 | static const unsigned char pl050_id[] = { |
| 51 | 0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 |
| 52 | }; |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 53 | |
Mark Cave-Ayland | eca9e87 | 2022-06-24 14:40:30 +0100 | [diff] [blame] | 54 | static void pl050_update_irq(PL050State *s) |
| 55 | { |
| 56 | int level = (s->pending && (s->cr & 0x10) != 0) |
| 57 | || (s->cr & 0x08) != 0; |
| 58 | |
| 59 | qemu_set_irq(s->irq, level); |
| 60 | } |
| 61 | |
Mark Cave-Ayland | 423bcb2 | 2022-06-24 14:40:51 +0100 | [diff] [blame] | 62 | static void pl050_set_irq(void *opaque, int n, int level) |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 63 | { |
Andreas Färber | e607f25 | 2013-07-26 18:40:25 +0200 | [diff] [blame] | 64 | PL050State *s = (PL050State *)opaque; |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 65 | |
| 66 | s->pending = level; |
Mark Cave-Ayland | eca9e87 | 2022-06-24 14:40:30 +0100 | [diff] [blame] | 67 | pl050_update_irq(s); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 68 | } |
| 69 | |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 70 | static uint64_t pl050_read(void *opaque, hwaddr offset, |
Avi Kivity | b8f7a73 | 2011-10-10 17:18:44 +0200 | [diff] [blame] | 71 | unsigned size) |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 72 | { |
Andreas Färber | e607f25 | 2013-07-26 18:40:25 +0200 | [diff] [blame] | 73 | PL050State *s = (PL050State *)opaque; |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 74 | |
| 75 | if (offset >= 0xfe0 && offset < 0x1000) { |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 76 | return pl050_id[(offset - 0xfe0) >> 2]; |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 77 | } |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 78 | |
| 79 | switch (offset >> 2) { |
| 80 | case 0: /* KMICR */ |
| 81 | return s->cr; |
| 82 | case 1: /* KMISTAT */ |
pbrook | 9e61ec3 | 2007-04-30 02:39:55 +0000 | [diff] [blame] | 83 | { |
| 84 | uint8_t val; |
| 85 | uint32_t stat; |
| 86 | |
| 87 | val = s->last; |
| 88 | val = val ^ (val >> 4); |
| 89 | val = val ^ (val >> 2); |
| 90 | val = (val ^ (val >> 1)) & 1; |
| 91 | |
| 92 | stat = PL050_TXEMPTY; |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 93 | if (val) { |
pbrook | 9e61ec3 | 2007-04-30 02:39:55 +0000 | [diff] [blame] | 94 | stat |= PL050_RXPARITY; |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 95 | } |
| 96 | if (s->pending) { |
pbrook | 9e61ec3 | 2007-04-30 02:39:55 +0000 | [diff] [blame] | 97 | stat |= PL050_RXFULL; |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 98 | } |
pbrook | 9e61ec3 | 2007-04-30 02:39:55 +0000 | [diff] [blame] | 99 | |
| 100 | return stat; |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 101 | } |
| 102 | case 2: /* KMIDATA */ |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 103 | if (s->pending) { |
Mark Cave-Ayland | 33e0958 | 2022-07-12 22:52:14 +0100 | [diff] [blame] | 104 | s->last = ps2_read_data(s->ps2dev); |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 105 | } |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 106 | return s->last; |
| 107 | case 3: /* KMICLKDIV */ |
| 108 | return s->clk; |
| 109 | case 4: /* KMIIR */ |
| 110 | return s->pending | 2; |
| 111 | default: |
Peter Maydell | fbfecf4 | 2012-10-30 07:45:08 +0000 | [diff] [blame] | 112 | qemu_log_mask(LOG_GUEST_ERROR, |
| 113 | "pl050_read: Bad offset %x\n", (int)offset); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 114 | return 0; |
| 115 | } |
| 116 | } |
| 117 | |
Avi Kivity | a8170e5 | 2012-10-23 12:30:10 +0200 | [diff] [blame] | 118 | static void pl050_write(void *opaque, hwaddr offset, |
Avi Kivity | b8f7a73 | 2011-10-10 17:18:44 +0200 | [diff] [blame] | 119 | uint64_t value, unsigned size) |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 120 | { |
Andreas Färber | e607f25 | 2013-07-26 18:40:25 +0200 | [diff] [blame] | 121 | PL050State *s = (PL050State *)opaque; |
Mark Cave-Ayland | 600f711 | 2022-06-24 14:40:29 +0100 | [diff] [blame] | 122 | |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 123 | switch (offset >> 2) { |
| 124 | case 0: /* KMICR */ |
| 125 | s->cr = value; |
Mark Cave-Ayland | eca9e87 | 2022-06-24 14:40:30 +0100 | [diff] [blame] | 126 | pl050_update_irq(s); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 127 | /* ??? Need to implement the enable/disable bit. */ |
| 128 | break; |
| 129 | case 2: /* KMIDATA */ |
| 130 | /* ??? This should toggle the TX interrupt line. */ |
| 131 | /* ??? This means kbd/mouse can block each other. */ |
| 132 | if (s->is_mouse) { |
Mark Cave-Ayland | 33e0958 | 2022-07-12 22:52:14 +0100 | [diff] [blame] | 133 | ps2_write_mouse(PS2_MOUSE_DEVICE(s->ps2dev), value); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 134 | } else { |
Mark Cave-Ayland | 33e0958 | 2022-07-12 22:52:14 +0100 | [diff] [blame] | 135 | ps2_write_keyboard(PS2_KBD_DEVICE(s->ps2dev), value); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 136 | } |
| 137 | break; |
| 138 | case 3: /* KMICLKDIV */ |
| 139 | s->clk = value; |
| 140 | return; |
| 141 | default: |
Peter Maydell | fbfecf4 | 2012-10-30 07:45:08 +0000 | [diff] [blame] | 142 | qemu_log_mask(LOG_GUEST_ERROR, |
| 143 | "pl050_write: Bad offset %x\n", (int)offset); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 144 | } |
| 145 | } |
Avi Kivity | b8f7a73 | 2011-10-10 17:18:44 +0200 | [diff] [blame] | 146 | static const MemoryRegionOps pl050_ops = { |
| 147 | .read = pl050_read, |
| 148 | .write = pl050_write, |
| 149 | .endianness = DEVICE_NATIVE_ENDIAN, |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 150 | }; |
| 151 | |
Mao Zhongyi | 988e501 | 2018-12-13 13:47:59 +0000 | [diff] [blame] | 152 | static void pl050_realize(DeviceState *dev, Error **errp) |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 153 | { |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 154 | PL050State *s = PL050(dev); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 155 | |
Mark Cave-Ayland | 33e0958 | 2022-07-12 22:52:14 +0100 | [diff] [blame] | 156 | qdev_connect_gpio_out(DEVICE(s->ps2dev), PS2_DEVICE_IRQ, |
Mark Cave-Ayland | 423bcb2 | 2022-06-24 14:40:51 +0100 | [diff] [blame] | 157 | qdev_get_gpio_in_named(dev, "ps2-input-irq", 0)); |
pbrook | cdbdb64 | 2006-04-09 01:32:52 +0000 | [diff] [blame] | 158 | } |
Paul Brook | 86394e9 | 2009-05-14 22:35:07 +0100 | [diff] [blame] | 159 | |
Mark Cave-Ayland | 87efd28 | 2022-07-12 22:52:19 +0100 | [diff] [blame] | 160 | static void pl050_kbd_realize(DeviceState *dev, Error **errp) |
| 161 | { |
| 162 | PL050DeviceClass *pdc = PL050_GET_CLASS(dev); |
Mark Cave-Ayland | 6a05d0b | 2022-07-12 22:52:21 +0100 | [diff] [blame] | 163 | PL050KbdState *s = PL050_KBD_DEVICE(dev); |
Mark Cave-Ayland | 87efd28 | 2022-07-12 22:52:19 +0100 | [diff] [blame] | 164 | PL050State *ps = PL050(dev); |
| 165 | |
Mark Cave-Ayland | 6a05d0b | 2022-07-12 22:52:21 +0100 | [diff] [blame] | 166 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->kbd), errp)) { |
| 167 | return; |
| 168 | } |
| 169 | |
| 170 | ps->ps2dev = PS2_DEVICE(&s->kbd); |
Mark Cave-Ayland | 87efd28 | 2022-07-12 22:52:19 +0100 | [diff] [blame] | 171 | pdc->parent_realize(dev, errp); |
| 172 | } |
| 173 | |
Mark Cave-Ayland | b6c575d | 2022-07-12 22:52:13 +0100 | [diff] [blame] | 174 | static void pl050_kbd_init(Object *obj) |
Paul Brook | 86394e9 | 2009-05-14 22:35:07 +0100 | [diff] [blame] | 175 | { |
Mark Cave-Ayland | 6a05d0b | 2022-07-12 22:52:21 +0100 | [diff] [blame] | 176 | PL050KbdState *s = PL050_KBD_DEVICE(obj); |
| 177 | PL050State *ps = PL050(obj); |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 178 | |
Mark Cave-Ayland | 6a05d0b | 2022-07-12 22:52:21 +0100 | [diff] [blame] | 179 | ps->is_mouse = false; |
| 180 | object_initialize_child(obj, "kbd", &s->kbd, TYPE_PS2_KBD_DEVICE); |
Paul Brook | 86394e9 | 2009-05-14 22:35:07 +0100 | [diff] [blame] | 181 | } |
| 182 | |
Mark Cave-Ayland | 5b0138b | 2022-07-12 22:52:20 +0100 | [diff] [blame] | 183 | static void pl050_mouse_realize(DeviceState *dev, Error **errp) |
| 184 | { |
| 185 | PL050DeviceClass *pdc = PL050_GET_CLASS(dev); |
Mark Cave-Ayland | 6f9f245 | 2022-07-12 22:52:22 +0100 | [diff] [blame] | 186 | PL050MouseState *s = PL050_MOUSE_DEVICE(dev); |
Mark Cave-Ayland | 5b0138b | 2022-07-12 22:52:20 +0100 | [diff] [blame] | 187 | PL050State *ps = PL050(dev); |
| 188 | |
Mark Cave-Ayland | 6f9f245 | 2022-07-12 22:52:22 +0100 | [diff] [blame] | 189 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->mouse), errp)) { |
| 190 | return; |
| 191 | } |
| 192 | |
| 193 | ps->ps2dev = PS2_DEVICE(&s->mouse); |
Mark Cave-Ayland | 5b0138b | 2022-07-12 22:52:20 +0100 | [diff] [blame] | 194 | pdc->parent_realize(dev, errp); |
| 195 | } |
| 196 | |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 197 | static void pl050_mouse_init(Object *obj) |
Paul Brook | 86394e9 | 2009-05-14 22:35:07 +0100 | [diff] [blame] | 198 | { |
Mark Cave-Ayland | 6f9f245 | 2022-07-12 22:52:22 +0100 | [diff] [blame] | 199 | PL050MouseState *s = PL050_MOUSE_DEVICE(obj); |
| 200 | PL050State *ps = PL050(obj); |
Paul Brook | 86394e9 | 2009-05-14 22:35:07 +0100 | [diff] [blame] | 201 | |
Mark Cave-Ayland | 6f9f245 | 2022-07-12 22:52:22 +0100 | [diff] [blame] | 202 | ps->is_mouse = true; |
| 203 | object_initialize_child(obj, "mouse", &s->mouse, TYPE_PS2_MOUSE_DEVICE); |
Anthony Liguori | 999e12b | 2012-01-24 13:12:29 -0600 | [diff] [blame] | 204 | } |
| 205 | |
Mark Cave-Ayland | 87efd28 | 2022-07-12 22:52:19 +0100 | [diff] [blame] | 206 | static void pl050_kbd_class_init(ObjectClass *oc, void *data) |
| 207 | { |
| 208 | DeviceClass *dc = DEVICE_CLASS(oc); |
| 209 | PL050DeviceClass *pdc = PL050_CLASS(oc); |
| 210 | |
| 211 | device_class_set_parent_realize(dc, pl050_kbd_realize, |
| 212 | &pdc->parent_realize); |
| 213 | } |
| 214 | |
Andreas Färber | 8c43a6f | 2013-01-10 16:19:07 +0100 | [diff] [blame] | 215 | static const TypeInfo pl050_kbd_info = { |
Mark Cave-Ayland | 1d59315 | 2022-07-12 22:52:15 +0100 | [diff] [blame] | 216 | .name = TYPE_PL050_KBD_DEVICE, |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 217 | .parent = TYPE_PL050, |
Mark Cave-Ayland | b6c575d | 2022-07-12 22:52:13 +0100 | [diff] [blame] | 218 | .instance_init = pl050_kbd_init, |
Mark Cave-Ayland | 1d59315 | 2022-07-12 22:52:15 +0100 | [diff] [blame] | 219 | .instance_size = sizeof(PL050KbdState), |
Mark Cave-Ayland | 87efd28 | 2022-07-12 22:52:19 +0100 | [diff] [blame] | 220 | .class_init = pl050_kbd_class_init, |
Peter Maydell | d6ac172 | 2010-12-23 17:19:54 +0000 | [diff] [blame] | 221 | }; |
| 222 | |
Mark Cave-Ayland | 5b0138b | 2022-07-12 22:52:20 +0100 | [diff] [blame] | 223 | static void pl050_mouse_class_init(ObjectClass *oc, void *data) |
| 224 | { |
| 225 | DeviceClass *dc = DEVICE_CLASS(oc); |
| 226 | PL050DeviceClass *pdc = PL050_CLASS(oc); |
| 227 | |
| 228 | device_class_set_parent_realize(dc, pl050_mouse_realize, |
| 229 | &pdc->parent_realize); |
| 230 | } |
| 231 | |
Andreas Färber | 8c43a6f | 2013-01-10 16:19:07 +0100 | [diff] [blame] | 232 | static const TypeInfo pl050_mouse_info = { |
Mark Cave-Ayland | 0a3c1e1 | 2022-07-12 22:52:16 +0100 | [diff] [blame] | 233 | .name = TYPE_PL050_MOUSE_DEVICE, |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 234 | .parent = TYPE_PL050, |
| 235 | .instance_init = pl050_mouse_init, |
Mark Cave-Ayland | 0a3c1e1 | 2022-07-12 22:52:16 +0100 | [diff] [blame] | 236 | .instance_size = sizeof(PL050MouseState), |
Mark Cave-Ayland | 5b0138b | 2022-07-12 22:52:20 +0100 | [diff] [blame] | 237 | .class_init = pl050_mouse_class_init, |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 238 | }; |
| 239 | |
Mark Cave-Ayland | 423bcb2 | 2022-06-24 14:40:51 +0100 | [diff] [blame] | 240 | static void pl050_init(Object *obj) |
| 241 | { |
Mark Cave-Ayland | 3d5e099 | 2022-07-12 22:52:17 +0100 | [diff] [blame] | 242 | PL050State *s = PL050(obj); |
| 243 | SysBusDevice *sbd = SYS_BUS_DEVICE(obj); |
| 244 | |
| 245 | memory_region_init_io(&s->iomem, obj, &pl050_ops, s, "pl050", 0x1000); |
| 246 | sysbus_init_mmio(sbd, &s->iomem); |
| 247 | sysbus_init_irq(sbd, &s->irq); |
| 248 | |
Mark Cave-Ayland | 423bcb2 | 2022-06-24 14:40:51 +0100 | [diff] [blame] | 249 | qdev_init_gpio_in_named(DEVICE(obj), pl050_set_irq, "ps2-input-irq", 1); |
| 250 | } |
| 251 | |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 252 | static void pl050_class_init(ObjectClass *oc, void *data) |
| 253 | { |
| 254 | DeviceClass *dc = DEVICE_CLASS(oc); |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 255 | |
Mao Zhongyi | 988e501 | 2018-12-13 13:47:59 +0000 | [diff] [blame] | 256 | dc->realize = pl050_realize; |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 257 | dc->vmsd = &vmstate_pl050; |
| 258 | } |
| 259 | |
| 260 | static const TypeInfo pl050_type_info = { |
| 261 | .name = TYPE_PL050, |
Anthony Liguori | 39bffca | 2011-12-07 21:34:16 -0600 | [diff] [blame] | 262 | .parent = TYPE_SYS_BUS_DEVICE, |
Mark Cave-Ayland | 423bcb2 | 2022-06-24 14:40:51 +0100 | [diff] [blame] | 263 | .instance_init = pl050_init, |
Andreas Färber | e607f25 | 2013-07-26 18:40:25 +0200 | [diff] [blame] | 264 | .instance_size = sizeof(PL050State), |
Mark Cave-Ayland | 475a4d4 | 2022-07-12 22:52:18 +0100 | [diff] [blame] | 265 | .class_init = pl050_class_init, |
| 266 | .class_size = sizeof(PL050DeviceClass), |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 267 | .abstract = true, |
| 268 | .class_init = pl050_class_init, |
Peter Maydell | d6ac172 | 2010-12-23 17:19:54 +0000 | [diff] [blame] | 269 | }; |
| 270 | |
Andreas Färber | 83f7d43 | 2012-02-09 15:20:55 +0100 | [diff] [blame] | 271 | static void pl050_register_types(void) |
Paul Brook | 86394e9 | 2009-05-14 22:35:07 +0100 | [diff] [blame] | 272 | { |
Andreas Färber | 3e5dd36 | 2013-07-26 18:49:24 +0200 | [diff] [blame] | 273 | type_register_static(&pl050_type_info); |
Anthony Liguori | 39bffca | 2011-12-07 21:34:16 -0600 | [diff] [blame] | 274 | type_register_static(&pl050_kbd_info); |
| 275 | type_register_static(&pl050_mouse_info); |
Paul Brook | 86394e9 | 2009-05-14 22:35:07 +0100 | [diff] [blame] | 276 | } |
| 277 | |
Andreas Färber | 83f7d43 | 2012-02-09 15:20:55 +0100 | [diff] [blame] | 278 | type_init(pl050_register_types) |