2021-03-09 22:08:02 +03:00
|
|
|
#include "qemu/osdep.h"
|
2023-11-27 01:49:30 +03:00
|
|
|
#include "hw/irq.h"
|
2021-10-25 14:33:49 +03:00
|
|
|
#include "hw/isa/vt82c686.h"
|
2021-03-09 22:08:02 +03:00
|
|
|
#include "hcd-uhci.h"
|
|
|
|
|
2023-11-27 01:49:30 +03:00
|
|
|
static void uhci_isa_set_irq(void *opaque, int irq_num, int level)
|
|
|
|
{
|
|
|
|
UHCIState *s = opaque;
|
|
|
|
via_isa_set_irq(&s->dev, 0, level);
|
|
|
|
}
|
|
|
|
|
2021-03-09 22:08:02 +03:00
|
|
|
static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp)
|
|
|
|
{
|
|
|
|
UHCIState *s = UHCI(dev);
|
|
|
|
uint8_t *pci_conf = s->dev.config;
|
|
|
|
|
|
|
|
/* USB misc control 1/2 */
|
|
|
|
pci_set_long(pci_conf + 0x40, 0x00001000);
|
|
|
|
/* PM capability */
|
|
|
|
pci_set_long(pci_conf + 0x80, 0x00020001);
|
|
|
|
/* USB legacy support */
|
|
|
|
pci_set_long(pci_conf + 0xc0, 0x00002000);
|
|
|
|
|
|
|
|
usb_uhci_common_realize(dev, errp);
|
2023-11-27 01:49:30 +03:00
|
|
|
object_unref(s->irq);
|
|
|
|
s->irq = qemu_allocate_irq(uhci_isa_set_irq, s, 0);
|
2021-03-09 22:08:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static UHCIInfo uhci_info[] = {
|
|
|
|
{
|
2022-09-01 14:41:21 +03:00
|
|
|
.name = TYPE_VT82C686B_USB_UHCI,
|
2021-03-09 22:08:02 +03:00
|
|
|
.vendor_id = PCI_VENDOR_ID_VIA,
|
|
|
|
.device_id = PCI_DEVICE_ID_VIA_UHCI,
|
|
|
|
.revision = 0x01,
|
|
|
|
.irq_pin = 3,
|
|
|
|
.realize = usb_uhci_vt82c686b_realize,
|
|
|
|
.unplug = true,
|
2021-10-25 14:33:49 +03:00
|
|
|
/* Reason: only works as USB function of VT82xx superio chips */
|
|
|
|
.notuser = true,
|
2021-03-09 22:08:02 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const TypeInfo vt82c686b_usb_uhci_type_info = {
|
|
|
|
.parent = TYPE_UHCI,
|
2022-09-01 14:41:21 +03:00
|
|
|
.name = TYPE_VT82C686B_USB_UHCI,
|
2021-03-09 22:08:02 +03:00
|
|
|
.class_init = uhci_data_class_init,
|
|
|
|
.class_data = uhci_info,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void vt82c686b_usb_uhci_register_types(void)
|
|
|
|
{
|
|
|
|
type_register_static(&vt82c686b_usb_uhci_type_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
type_init(vt82c686b_usb_uhci_register_types)
|