1 #include "qemu/osdep.h"
2 #include "hw/irq.h"
3 #include "hw/isa/vt82c686.h"
4 #include "hcd-uhci.h"
5
uhci_isa_set_irq(void * opaque,int irq_num,int level)6 static void uhci_isa_set_irq(void *opaque, int irq_num, int level)
7 {
8 UHCIState *s = opaque;
9 via_isa_set_irq(&s->dev, 0, level);
10 }
11
usb_uhci_vt82c686b_realize(PCIDevice * dev,Error ** errp)12 static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp)
13 {
14 UHCIState *s = UHCI(dev);
15 uint8_t *pci_conf = s->dev.config;
16
17 /* USB misc control 1/2 */
18 pci_set_long(pci_conf + 0x40, 0x00001000);
19 /* PM capability */
20 pci_set_long(pci_conf + 0x80, 0x00020001);
21 /* USB legacy support */
22 pci_set_long(pci_conf + 0xc0, 0x00002000);
23
24 usb_uhci_common_realize(dev, errp);
25 object_unref(s->irq);
26 s->irq = qemu_allocate_irq(uhci_isa_set_irq, s, 0);
27 }
28
29 static UHCIInfo uhci_info[] = {
30 {
31 .name = TYPE_VT82C686B_USB_UHCI,
32 .vendor_id = PCI_VENDOR_ID_VIA,
33 .device_id = PCI_DEVICE_ID_VIA_UHCI,
34 .revision = 0x01,
35 .irq_pin = 3,
36 .realize = usb_uhci_vt82c686b_realize,
37 .unplug = true,
38 /* Reason: only works as USB function of VT82xx superio chips */
39 .notuser = true,
40 }
41 };
42
43 static const TypeInfo vt82c686b_usb_uhci_type_info = {
44 .parent = TYPE_UHCI,
45 .name = TYPE_VT82C686B_USB_UHCI,
46 .class_init = uhci_data_class_init,
47 .class_data = uhci_info,
48 };
49
vt82c686b_usb_uhci_register_types(void)50 static void vt82c686b_usb_uhci_register_types(void)
51 {
52 type_register_static(&vt82c686b_usb_uhci_type_info);
53 }
54
55 type_init(vt82c686b_usb_uhci_register_types)
56