mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 20:19:44 +00:00
4f3b0a4d75
This device is part of a superio/ISA bridge chip and IRQs from it are routed to an ISA interrupt set by the Interrupt Line PCI config register. Implement this in a vt82c686-uhci-pci specific irq handler Using via_isa_set_irq(). Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <8d7ed385e33a847d8ddc669163a68b5ca57f82ce.1635161629.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
59 lines
1.6 KiB
C
59 lines
1.6 KiB
C
#include "qemu/osdep.h"
|
|
#include "hw/irq.h"
|
|
#include "hw/isa/vt82c686.h"
|
|
#include "hcd-uhci.h"
|
|
|
|
static void uhci_isa_set_irq(void *opaque, int irq_num, int level)
|
|
{
|
|
UHCIState *s = opaque;
|
|
uint8_t irq = pci_get_byte(s->dev.config + PCI_INTERRUPT_LINE);
|
|
if (irq > 0 && irq < 15) {
|
|
via_isa_set_irq(pci_get_function_0(&s->dev), irq, level);
|
|
}
|
|
}
|
|
|
|
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);
|
|
object_unref(s->irq);
|
|
s->irq = qemu_allocate_irq(uhci_isa_set_irq, s, 0);
|
|
}
|
|
|
|
static UHCIInfo uhci_info[] = {
|
|
{
|
|
.name = "vt82c686b-usb-uhci",
|
|
.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,
|
|
/* Reason: only works as USB function of VT82xx superio chips */
|
|
.notuser = true,
|
|
}
|
|
};
|
|
|
|
static const TypeInfo vt82c686b_usb_uhci_type_info = {
|
|
.parent = TYPE_UHCI,
|
|
.name = "vt82c686b-usb-uhci",
|
|
.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)
|