xref: /qemu/hw/input/lasips2.c (revision b7047733dc5b6c6843d9569e23c74d2ed280b4f2)
12a6505b0SSven Schnelle /*
22a6505b0SSven Schnelle  * QEMU HP Lasi PS/2 interface emulation
32a6505b0SSven Schnelle  *
42a6505b0SSven Schnelle  * Copyright (c) 2019 Sven Schnelle
52a6505b0SSven Schnelle  *
62a6505b0SSven Schnelle  * Permission is hereby granted, free of charge, to any person obtaining a copy
72a6505b0SSven Schnelle  * of this software and associated documentation files (the "Software"), to deal
82a6505b0SSven Schnelle  * in the Software without restriction, including without limitation the rights
92a6505b0SSven Schnelle  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
102a6505b0SSven Schnelle  * copies of the Software, and to permit persons to whom the Software is
112a6505b0SSven Schnelle  * furnished to do so, subject to the following conditions:
122a6505b0SSven Schnelle  *
132a6505b0SSven Schnelle  * The above copyright notice and this permission notice shall be included in
142a6505b0SSven Schnelle  * all copies or substantial portions of the Software.
152a6505b0SSven Schnelle  *
162a6505b0SSven Schnelle  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
172a6505b0SSven Schnelle  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
182a6505b0SSven Schnelle  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
192a6505b0SSven Schnelle  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
202a6505b0SSven Schnelle  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
212a6505b0SSven Schnelle  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
222a6505b0SSven Schnelle  * THE SOFTWARE.
232a6505b0SSven Schnelle  */
242a6505b0SSven Schnelle #include "qemu/osdep.h"
252a6505b0SSven Schnelle #include "qemu/log.h"
262a6505b0SSven Schnelle #include "hw/qdev-properties.h"
27653b388cSMark Cave-Ayland #include "hw/sysbus.h"
282a6505b0SSven Schnelle #include "hw/input/ps2.h"
292a6505b0SSven Schnelle #include "hw/input/lasips2.h"
302a6505b0SSven Schnelle #include "exec/hwaddr.h"
312a6505b0SSven Schnelle #include "trace.h"
322a6505b0SSven Schnelle #include "exec/address-spaces.h"
332a6505b0SSven Schnelle #include "migration/vmstate.h"
342a6505b0SSven Schnelle #include "hw/irq.h"
35653b388cSMark Cave-Ayland #include "qapi/error.h"
362a6505b0SSven Schnelle 
372a6505b0SSven Schnelle 
382a6505b0SSven Schnelle static const VMStateDescription vmstate_lasips2 = {
392a6505b0SSven Schnelle     .name = "lasips2",
402a6505b0SSven Schnelle     .version_id = 0,
412a6505b0SSven Schnelle     .minimum_version_id = 0,
422a6505b0SSven Schnelle     .fields = (VMStateField[]) {
43*b7047733SMark Cave-Ayland         VMSTATE_UINT8(kbd_port.parent_obj.control, LASIPS2State),
44*b7047733SMark Cave-Ayland         VMSTATE_UINT8(kbd_port.parent_obj.id, LASIPS2State),
45*b7047733SMark Cave-Ayland         VMSTATE_BOOL(kbd_port.parent_obj.irq, LASIPS2State),
462a6505b0SSven Schnelle         VMSTATE_UINT8(mouse.control, LASIPS2State),
472a6505b0SSven Schnelle         VMSTATE_UINT8(mouse.id, LASIPS2State),
482a6505b0SSven Schnelle         VMSTATE_BOOL(mouse.irq, LASIPS2State),
492a6505b0SSven Schnelle         VMSTATE_END_OF_LIST()
502a6505b0SSven Schnelle     }
512a6505b0SSven Schnelle };
522a6505b0SSven Schnelle 
532a6505b0SSven Schnelle typedef enum {
542a6505b0SSven Schnelle     REG_PS2_ID = 0,
552a6505b0SSven Schnelle     REG_PS2_RCVDATA = 4,
562a6505b0SSven Schnelle     REG_PS2_CONTROL = 8,
572a6505b0SSven Schnelle     REG_PS2_STATUS = 12,
582a6505b0SSven Schnelle } lasips2_read_reg_t;
592a6505b0SSven Schnelle 
602a6505b0SSven Schnelle typedef enum {
612a6505b0SSven Schnelle     REG_PS2_RESET = 0,
622a6505b0SSven Schnelle     REG_PS2_XMTDATA = 4,
632a6505b0SSven Schnelle } lasips2_write_reg_t;
642a6505b0SSven Schnelle 
652a6505b0SSven Schnelle typedef enum {
662a6505b0SSven Schnelle     LASIPS2_CONTROL_ENABLE = 0x01,
672a6505b0SSven Schnelle     LASIPS2_CONTROL_LOOPBACK = 0x02,
682a6505b0SSven Schnelle     LASIPS2_CONTROL_DIAG = 0x20,
692a6505b0SSven Schnelle     LASIPS2_CONTROL_DATDIR = 0x40,
702a6505b0SSven Schnelle     LASIPS2_CONTROL_CLKDIR = 0x80,
712a6505b0SSven Schnelle } lasips2_control_reg_t;
722a6505b0SSven Schnelle 
732a6505b0SSven Schnelle typedef enum {
742a6505b0SSven Schnelle     LASIPS2_STATUS_RBNE = 0x01,
752a6505b0SSven Schnelle     LASIPS2_STATUS_TBNE = 0x02,
762a6505b0SSven Schnelle     LASIPS2_STATUS_TERR = 0x04,
772a6505b0SSven Schnelle     LASIPS2_STATUS_PERR = 0x08,
782a6505b0SSven Schnelle     LASIPS2_STATUS_CMPINTR = 0x10,
792a6505b0SSven Schnelle     LASIPS2_STATUS_DATSHD = 0x40,
802a6505b0SSven Schnelle     LASIPS2_STATUS_CLKSHD = 0x80,
812a6505b0SSven Schnelle } lasips2_status_reg_t;
822a6505b0SSven Schnelle 
835d2bd735SPhilippe Mathieu-Daudé static const char *lasips2_read_reg_name(uint64_t addr)
842a6505b0SSven Schnelle {
852a6505b0SSven Schnelle     switch (addr & 0xc) {
862a6505b0SSven Schnelle     case REG_PS2_ID:
872a6505b0SSven Schnelle         return " PS2_ID";
882a6505b0SSven Schnelle 
892a6505b0SSven Schnelle     case REG_PS2_RCVDATA:
902a6505b0SSven Schnelle         return " PS2_RCVDATA";
912a6505b0SSven Schnelle 
922a6505b0SSven Schnelle     case REG_PS2_CONTROL:
932a6505b0SSven Schnelle         return " PS2_CONTROL";
942a6505b0SSven Schnelle 
952a6505b0SSven Schnelle     case REG_PS2_STATUS:
962a6505b0SSven Schnelle         return " PS2_STATUS";
972a6505b0SSven Schnelle 
982a6505b0SSven Schnelle     default:
992a6505b0SSven Schnelle         return "";
1002a6505b0SSven Schnelle     }
1012a6505b0SSven Schnelle }
1022a6505b0SSven Schnelle 
1035d2bd735SPhilippe Mathieu-Daudé static const char *lasips2_write_reg_name(uint64_t addr)
1042a6505b0SSven Schnelle {
1052a6505b0SSven Schnelle     switch (addr & 0x0c) {
1062a6505b0SSven Schnelle     case REG_PS2_RESET:
1072a6505b0SSven Schnelle         return " PS2_RESET";
1082a6505b0SSven Schnelle 
1092a6505b0SSven Schnelle     case REG_PS2_XMTDATA:
1102a6505b0SSven Schnelle         return " PS2_XMTDATA";
1112a6505b0SSven Schnelle 
1122a6505b0SSven Schnelle     case REG_PS2_CONTROL:
1132a6505b0SSven Schnelle         return " PS2_CONTROL";
1142a6505b0SSven Schnelle 
1152a6505b0SSven Schnelle     default:
1162a6505b0SSven Schnelle         return "";
1172a6505b0SSven Schnelle     }
1182a6505b0SSven Schnelle }
1192a6505b0SSven Schnelle 
1202a6505b0SSven Schnelle static void lasips2_update_irq(LASIPS2State *s)
1212a6505b0SSven Schnelle {
122*b7047733SMark Cave-Ayland     trace_lasips2_intr(s->kbd_port.parent_obj.irq | s->mouse.irq);
123*b7047733SMark Cave-Ayland     qemu_set_irq(s->irq, s->kbd_port.parent_obj.irq | s->mouse.irq);
1242a6505b0SSven Schnelle }
1252a6505b0SSven Schnelle 
1262a6505b0SSven Schnelle static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
1272a6505b0SSven Schnelle                               unsigned size)
1282a6505b0SSven Schnelle {
1292a6505b0SSven Schnelle     LASIPS2Port *port = opaque;
1302a6505b0SSven Schnelle 
1312a6505b0SSven Schnelle     trace_lasips2_reg_write(size, port->id, addr,
1325d2bd735SPhilippe Mathieu-Daudé                             lasips2_write_reg_name(addr), val);
1332a6505b0SSven Schnelle 
1342a6505b0SSven Schnelle     switch (addr & 0xc) {
1352a6505b0SSven Schnelle     case REG_PS2_CONTROL:
1362a6505b0SSven Schnelle         port->control = val;
1372a6505b0SSven Schnelle         break;
1382a6505b0SSven Schnelle 
1392a6505b0SSven Schnelle     case REG_PS2_XMTDATA:
1402a6505b0SSven Schnelle         if (port->control & LASIPS2_CONTROL_LOOPBACK) {
1412a6505b0SSven Schnelle             port->buf = val;
1422a6505b0SSven Schnelle             port->irq = true;
1432a6505b0SSven Schnelle             port->loopback_rbne = true;
1442a6505b0SSven Schnelle             lasips2_update_irq(port->parent);
1452a6505b0SSven Schnelle             break;
1462a6505b0SSven Schnelle         }
1472a6505b0SSven Schnelle 
1482a6505b0SSven Schnelle         if (port->id) {
149f4907cb5SMark Cave-Ayland             ps2_write_mouse(PS2_MOUSE_DEVICE(port->ps2dev), val);
1502a6505b0SSven Schnelle         } else {
151f4907cb5SMark Cave-Ayland             ps2_write_keyboard(PS2_KBD_DEVICE(port->ps2dev), val);
1522a6505b0SSven Schnelle         }
1532a6505b0SSven Schnelle         break;
1542a6505b0SSven Schnelle 
1552a6505b0SSven Schnelle     case REG_PS2_RESET:
1562a6505b0SSven Schnelle         break;
1572a6505b0SSven Schnelle 
1582a6505b0SSven Schnelle     default:
1592a6505b0SSven Schnelle         qemu_log_mask(LOG_UNIMP, "%s: unknown register 0x%02" HWADDR_PRIx "\n",
1602a6505b0SSven Schnelle                       __func__, addr);
1612a6505b0SSven Schnelle         break;
1622a6505b0SSven Schnelle     }
1632a6505b0SSven Schnelle }
1642a6505b0SSven Schnelle 
1652a6505b0SSven Schnelle static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
1662a6505b0SSven Schnelle {
1672a6505b0SSven Schnelle     LASIPS2Port *port = opaque;
1682a6505b0SSven Schnelle     uint64_t ret = 0;
1692a6505b0SSven Schnelle 
1702a6505b0SSven Schnelle     switch (addr & 0xc) {
1712a6505b0SSven Schnelle     case REG_PS2_ID:
1722a6505b0SSven Schnelle         ret = port->id;
1732a6505b0SSven Schnelle         break;
1742a6505b0SSven Schnelle 
1752a6505b0SSven Schnelle     case REG_PS2_RCVDATA:
1762a6505b0SSven Schnelle         if (port->control & LASIPS2_CONTROL_LOOPBACK) {
1772a6505b0SSven Schnelle             port->irq = false;
1782a6505b0SSven Schnelle             port->loopback_rbne = false;
1792a6505b0SSven Schnelle             lasips2_update_irq(port->parent);
1802a6505b0SSven Schnelle             ret = port->buf;
1812a6505b0SSven Schnelle             break;
1822a6505b0SSven Schnelle         }
1832a6505b0SSven Schnelle 
184f4907cb5SMark Cave-Ayland         ret = ps2_read_data(port->ps2dev);
1852a6505b0SSven Schnelle         break;
1862a6505b0SSven Schnelle 
1872a6505b0SSven Schnelle     case REG_PS2_CONTROL:
1882a6505b0SSven Schnelle         ret = port->control;
1892a6505b0SSven Schnelle         break;
1902a6505b0SSven Schnelle 
1912a6505b0SSven Schnelle     case REG_PS2_STATUS:
1922a6505b0SSven Schnelle         ret = LASIPS2_STATUS_DATSHD | LASIPS2_STATUS_CLKSHD;
1932a6505b0SSven Schnelle 
1942a6505b0SSven Schnelle         if (port->control & LASIPS2_CONTROL_DIAG) {
1952a6505b0SSven Schnelle             if (!(port->control & LASIPS2_CONTROL_DATDIR)) {
1962a6505b0SSven Schnelle                 ret &= ~LASIPS2_STATUS_DATSHD;
1972a6505b0SSven Schnelle             }
1982a6505b0SSven Schnelle 
1992a6505b0SSven Schnelle             if (!(port->control & LASIPS2_CONTROL_CLKDIR)) {
2002a6505b0SSven Schnelle                 ret &= ~LASIPS2_STATUS_CLKSHD;
2012a6505b0SSven Schnelle             }
2022a6505b0SSven Schnelle         }
2032a6505b0SSven Schnelle 
2042a6505b0SSven Schnelle         if (port->control & LASIPS2_CONTROL_LOOPBACK) {
2052a6505b0SSven Schnelle             if (port->loopback_rbne) {
2062a6505b0SSven Schnelle                 ret |= LASIPS2_STATUS_RBNE;
2072a6505b0SSven Schnelle             }
2082a6505b0SSven Schnelle         } else {
209f4907cb5SMark Cave-Ayland             if (!ps2_queue_empty(port->ps2dev)) {
2102a6505b0SSven Schnelle                 ret |= LASIPS2_STATUS_RBNE;
2112a6505b0SSven Schnelle             }
2122a6505b0SSven Schnelle         }
2132a6505b0SSven Schnelle 
214*b7047733SMark Cave-Ayland         if (port->parent->kbd_port.parent_obj.irq || port->parent->mouse.irq) {
2152a6505b0SSven Schnelle             ret |= LASIPS2_STATUS_CMPINTR;
2162a6505b0SSven Schnelle         }
2172a6505b0SSven Schnelle         break;
2182a6505b0SSven Schnelle 
2192a6505b0SSven Schnelle     default:
2202a6505b0SSven Schnelle         qemu_log_mask(LOG_UNIMP, "%s: unknown register 0x%02" HWADDR_PRIx "\n",
2212a6505b0SSven Schnelle                       __func__, addr);
2222a6505b0SSven Schnelle         break;
2232a6505b0SSven Schnelle     }
2242a93d3c1SMark Cave-Ayland 
2252a6505b0SSven Schnelle     trace_lasips2_reg_read(size, port->id, addr,
2265d2bd735SPhilippe Mathieu-Daudé                            lasips2_read_reg_name(addr), ret);
2272a6505b0SSven Schnelle     return ret;
2282a6505b0SSven Schnelle }
2292a6505b0SSven Schnelle 
2302a6505b0SSven Schnelle static const MemoryRegionOps lasips2_reg_ops = {
2312a6505b0SSven Schnelle     .read = lasips2_reg_read,
2322a6505b0SSven Schnelle     .write = lasips2_reg_write,
2332a6505b0SSven Schnelle     .impl = {
2342a6505b0SSven Schnelle         .min_access_size = 1,
2352a6505b0SSven Schnelle         .max_access_size = 4,
2362a6505b0SSven Schnelle     },
2372a6505b0SSven Schnelle     .endianness = DEVICE_NATIVE_ENDIAN,
2382a6505b0SSven Schnelle };
2392a6505b0SSven Schnelle 
2400d1ac496SMark Cave-Ayland static void lasips2_set_kbd_irq(void *opaque, int n, int level)
2412a6505b0SSven Schnelle {
2420d1ac496SMark Cave-Ayland     LASIPS2State *s = LASIPS2(opaque);
243*b7047733SMark Cave-Ayland     LASIPS2Port *port = LASIPS2_PORT(&s->kbd_port);
2440d1ac496SMark Cave-Ayland 
2450d1ac496SMark Cave-Ayland     port->irq = level;
2460d1ac496SMark Cave-Ayland     lasips2_update_irq(port->parent);
2470d1ac496SMark Cave-Ayland }
2480d1ac496SMark Cave-Ayland 
2490d1ac496SMark Cave-Ayland static void lasips2_set_mouse_irq(void *opaque, int n, int level)
2500d1ac496SMark Cave-Ayland {
2510d1ac496SMark Cave-Ayland     LASIPS2State *s = LASIPS2(opaque);
2520d1ac496SMark Cave-Ayland     LASIPS2Port *port = &s->mouse;
2532a93d3c1SMark Cave-Ayland 
2542a6505b0SSven Schnelle     port->irq = level;
2552a6505b0SSven Schnelle     lasips2_update_irq(port->parent);
2562a6505b0SSven Schnelle }
2572a6505b0SSven Schnelle 
2581702627cSMark Cave-Ayland static void lasips2_realize(DeviceState *dev, Error **errp)
2591702627cSMark Cave-Ayland {
2601702627cSMark Cave-Ayland     LASIPS2State *s = LASIPS2(dev);
261*b7047733SMark Cave-Ayland     LASIPS2Port *lp;
2621702627cSMark Cave-Ayland 
263*b7047733SMark Cave-Ayland     lp = LASIPS2_PORT(&s->kbd_port);
264*b7047733SMark Cave-Ayland     if (!(qdev_realize(DEVICE(lp), NULL, errp))) {
265*b7047733SMark Cave-Ayland         return;
266*b7047733SMark Cave-Ayland     }
267*b7047733SMark Cave-Ayland 
268*b7047733SMark Cave-Ayland     lp->ps2dev = ps2_kbd_init();
269*b7047733SMark Cave-Ayland     qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ,
2700d1ac496SMark Cave-Ayland                           qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
2710d1ac496SMark Cave-Ayland                                                  0));
272f4907cb5SMark Cave-Ayland     s->mouse.ps2dev = ps2_mouse_init();
273f4907cb5SMark Cave-Ayland     qdev_connect_gpio_out(DEVICE(s->mouse.ps2dev), PS2_DEVICE_IRQ,
2740d1ac496SMark Cave-Ayland                           qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
2750d1ac496SMark Cave-Ayland                                                  0));
2762a6505b0SSven Schnelle }
277653b388cSMark Cave-Ayland 
27863195aa5SMark Cave-Ayland static void lasips2_init(Object *obj)
27963195aa5SMark Cave-Ayland {
28063195aa5SMark Cave-Ayland     LASIPS2State *s = LASIPS2(obj);
281*b7047733SMark Cave-Ayland     LASIPS2Port *lp;
28263195aa5SMark Cave-Ayland 
283*b7047733SMark Cave-Ayland     object_initialize_child(obj, "lasips2-kbd-port", &s->kbd_port,
284*b7047733SMark Cave-Ayland                             TYPE_LASIPS2_KBD_PORT);
285*b7047733SMark Cave-Ayland 
28602bb59a0SMark Cave-Ayland     s->mouse.id = 1;
28702bb59a0SMark Cave-Ayland     s->mouse.parent = s;
28802bb59a0SMark Cave-Ayland 
28963195aa5SMark Cave-Ayland     memory_region_init_io(&s->mouse.reg, obj, &lasips2_reg_ops, &s->mouse,
29063195aa5SMark Cave-Ayland                           "lasips2-mouse", 0x100);
29163195aa5SMark Cave-Ayland 
292*b7047733SMark Cave-Ayland     lp = LASIPS2_PORT(&s->kbd_port);
293*b7047733SMark Cave-Ayland     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &lp->reg);
29463195aa5SMark Cave-Ayland     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mouse.reg);
29597bc0597SMark Cave-Ayland 
29697bc0597SMark Cave-Ayland     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
2970d1ac496SMark Cave-Ayland 
2980d1ac496SMark Cave-Ayland     qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_kbd_irq,
2990d1ac496SMark Cave-Ayland                             "ps2-kbd-input-irq", 1);
3000d1ac496SMark Cave-Ayland     qdev_init_gpio_in_named(DEVICE(obj), lasips2_set_mouse_irq,
3010d1ac496SMark Cave-Ayland                             "ps2-mouse-input-irq", 1);
30263195aa5SMark Cave-Ayland }
30363195aa5SMark Cave-Ayland 
30442119fdbSMark Cave-Ayland static void lasips2_class_init(ObjectClass *klass, void *data)
30542119fdbSMark Cave-Ayland {
30642119fdbSMark Cave-Ayland     DeviceClass *dc = DEVICE_CLASS(klass);
30742119fdbSMark Cave-Ayland 
3081702627cSMark Cave-Ayland     dc->realize = lasips2_realize;
30917b8013aSMark Cave-Ayland     dc->vmsd = &vmstate_lasips2;
31042119fdbSMark Cave-Ayland     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
31142119fdbSMark Cave-Ayland }
31242119fdbSMark Cave-Ayland 
313653b388cSMark Cave-Ayland static const TypeInfo lasips2_info = {
314653b388cSMark Cave-Ayland     .name          = TYPE_LASIPS2,
315653b388cSMark Cave-Ayland     .parent        = TYPE_SYS_BUS_DEVICE,
31663195aa5SMark Cave-Ayland     .instance_init = lasips2_init,
31742119fdbSMark Cave-Ayland     .instance_size = sizeof(LASIPS2State),
31842119fdbSMark Cave-Ayland     .class_init    = lasips2_class_init,
319653b388cSMark Cave-Ayland };
320653b388cSMark Cave-Ayland 
321f8d89a7dSMark Cave-Ayland static const TypeInfo lasips2_port_info = {
322f8d89a7dSMark Cave-Ayland     .name          = TYPE_LASIPS2_PORT,
323f8d89a7dSMark Cave-Ayland     .parent        = TYPE_DEVICE,
324f8d89a7dSMark Cave-Ayland     .instance_size = sizeof(LASIPS2Port),
325f8d89a7dSMark Cave-Ayland     .abstract      = true,
326f8d89a7dSMark Cave-Ayland };
327f8d89a7dSMark Cave-Ayland 
328*b7047733SMark Cave-Ayland static void lasips2_kbd_port_init(Object *obj)
329*b7047733SMark Cave-Ayland {
330*b7047733SMark Cave-Ayland     LASIPS2KbdPort *s = LASIPS2_KBD_PORT(obj);
331*b7047733SMark Cave-Ayland     LASIPS2Port *lp = LASIPS2_PORT(obj);
332*b7047733SMark Cave-Ayland 
333*b7047733SMark Cave-Ayland     memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-kbd",
334*b7047733SMark Cave-Ayland                           0x100);
335*b7047733SMark Cave-Ayland     lp->id = 0;
336*b7047733SMark Cave-Ayland     lp->parent = container_of(s, LASIPS2State, kbd_port);
337*b7047733SMark Cave-Ayland }
338*b7047733SMark Cave-Ayland 
339ef90a06fSMark Cave-Ayland static const TypeInfo lasips2_kbd_port_info = {
340ef90a06fSMark Cave-Ayland     .name          = TYPE_LASIPS2_KBD_PORT,
341ef90a06fSMark Cave-Ayland     .parent        = TYPE_LASIPS2_PORT,
342ef90a06fSMark Cave-Ayland     .instance_size = sizeof(LASIPS2KbdPort),
343*b7047733SMark Cave-Ayland     .instance_init = lasips2_kbd_port_init,
344ef90a06fSMark Cave-Ayland };
345ef90a06fSMark Cave-Ayland 
346cb5827ceSMark Cave-Ayland static const TypeInfo lasips2_mouse_port_info = {
347cb5827ceSMark Cave-Ayland     .name          = TYPE_LASIPS2_MOUSE_PORT,
348cb5827ceSMark Cave-Ayland     .parent        = TYPE_LASIPS2_PORT,
349cb5827ceSMark Cave-Ayland     .instance_size = sizeof(LASIPS2MousePort),
350cb5827ceSMark Cave-Ayland };
351cb5827ceSMark Cave-Ayland 
352653b388cSMark Cave-Ayland static void lasips2_register_types(void)
353653b388cSMark Cave-Ayland {
354653b388cSMark Cave-Ayland     type_register_static(&lasips2_info);
355f8d89a7dSMark Cave-Ayland     type_register_static(&lasips2_port_info);
356ef90a06fSMark Cave-Ayland     type_register_static(&lasips2_kbd_port_info);
357cb5827ceSMark Cave-Ayland     type_register_static(&lasips2_mouse_port_info);
358653b388cSMark Cave-Ayland }
359653b388cSMark Cave-Ayland 
360653b388cSMark Cave-Ayland type_init(lasips2_register_types)
361