hw/arm/boot: Support setting psci-conduit based on guest EL
[qemu.git] / hw / usb / vt82c686-uhci-pci.c
blob0bf2b72ff086cf5f505c0a7c1120c3a4144639d7
1 #include "qemu/osdep.h"
2 #include "hw/irq.h"
3 #include "hw/isa/vt82c686.h"
4 #include "hcd-uhci.h"
6 static void uhci_isa_set_irq(void *opaque, int irq_num, int level)
8 UHCIState *s = opaque;
9 uint8_t irq = pci_get_byte(s->dev.config + PCI_INTERRUPT_LINE);
10 if (irq > 0 && irq < 15) {
11 via_isa_set_irq(pci_get_function_0(&s->dev), irq, level);
15 static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp)
17 UHCIState *s = UHCI(dev);
18 uint8_t *pci_conf = s->dev.config;
20 /* USB misc control 1/2 */
21 pci_set_long(pci_conf + 0x40, 0x00001000);
22 /* PM capability */
23 pci_set_long(pci_conf + 0x80, 0x00020001);
24 /* USB legacy support */
25 pci_set_long(pci_conf + 0xc0, 0x00002000);
27 usb_uhci_common_realize(dev, errp);
28 object_unref(s->irq);
29 s->irq = qemu_allocate_irq(uhci_isa_set_irq, s, 0);
32 static UHCIInfo uhci_info[] = {
34 .name = "vt82c686b-usb-uhci",
35 .vendor_id = PCI_VENDOR_ID_VIA,
36 .device_id = PCI_DEVICE_ID_VIA_UHCI,
37 .revision = 0x01,
38 .irq_pin = 3,
39 .realize = usb_uhci_vt82c686b_realize,
40 .unplug = true,
41 /* Reason: only works as USB function of VT82xx superio chips */
42 .notuser = true,
46 static const TypeInfo vt82c686b_usb_uhci_type_info = {
47 .parent = TYPE_UHCI,
48 .name = "vt82c686b-usb-uhci",
49 .class_init = uhci_data_class_init,
50 .class_data = uhci_info,
53 static void vt82c686b_usb_uhci_register_types(void)
55 type_register_static(&vt82c686b_usb_uhci_type_info);
58 type_init(vt82c686b_usb_uhci_register_types)