hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
v4 cover hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
v4 splits up the single patch into a series
BALATON Zoltan (3):
usb/uhci: Misc clean up
usb/uhci: Replace pci_set_irq with qemu_set_irq hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
hw/usb/hcd-uhci.c | 11 +++++------ hw/usb/hcd-uhci.h | 2 +- hw/usb/vt82c686-uhci-pci.c | 12 ++++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-)
Signature · 1 line
2.21.4
PATCH v4 1/3 usb/uhci: Misc clean up
Fix a comment for coding style so subsequent patch will not get checkpatch error and simplify and shorten uhci_update_irq().
--- hw/usb/hcd-uhci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/usb/hcd-uhci.c +2 -5
@@ -290,7 +290,7 @@ static UHCIAsync *uhci_async_find_td(UHCIState *s, uint32_t td_addr)static void uhci_update_irq (UHCIState *s) { -int level; +int level =0 ; if (((s->status2 & 1) && (s->intr & (1 << 2))) || ((s->status2 & 2) && (s->intr & (1 << 3))) || ((s->status & UHCI_STS_USBERR) && (s->intr & (1 << 0))) ||
@@ -298,8 +298,6 @@ static void uhci_update_irq(UHCIState *s) (s->status & UHCI_STS_HSERR) || (s->status & UHCI_STS_HCPERR)) { level =1 ; - }else { - level =0 ; }pci_set_irq (&s->dev, level); }
@@ -1170,8 +1168,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp) pci_conf[PCI_CLASS_PROG ] =0x00 ;/* TODO: reset value should be 0. */ - pci_conf[USB_SBRN ] =USB_RELEASE_1 ;// release number - + pci_conf[USB_SBRN ] =USB_RELEASE_1 ;/* release number */ pci_config_set_interrupt_pin (pci_conf, u->info.irq_pin +1 );if (s->masterbus) {
Signature · 1 line
2.21.4
Re: [PATCH v4 1/3] usb/uhci: Misc clean up
Quoted 7 lines · BALATON Zoltan
Fix a comment for coding style so subsequent patch will not get checkpatch error and simplify and shorten
uhci_update_irq().Signed-off-by BALATON Zoltan <[email protected]>--- hw/usb/hcd-uhci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
PATCH v4 2/3 usb/uhci: Replace pci_set_irq with qemu_set_irq
In reply to BALATON ZoltanInstead of using pci_set_irq, store the irq in the device state and use it explicitly so variants having different interrupt handling can use their own.
--- hw/usb/hcd-uhci.c | 4 +++- hw/usb/hcd-uhci.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
hw/usb/hcd-uhci.c +3 -1
@@ -31,6 +31,7 @@#include "hw/usb/uhci-regs.h" #include "migration/vmstate.h" #include "hw/pci/pci.h" +#include "hw/irq.h" #include "hw/qdev-properties.h" #include "qapi/error.h" #include "qemu/timer.h"
@@ -299,7 +300,7 @@ static void uhci_update_irq(UHCIState *s) (s->status & UHCI_STS_HCPERR)) { level =1 ; } -pci_set_irq (&s->dev, level); +qemu_set_irq (s->irq, level); }static void uhci_reset (DeviceState *dev)
@@ -1170,6 +1171,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)/* TODO: reset value should be 0. */ pci_conf[USB_SBRN ] =USB_RELEASE_1 ;/* release number */ pci_config_set_interrupt_pin (pci_conf, u->info.irq_pin +1 ); + s->irq =pci_allocate_irq (dev);if (s->masterbus) {USBPort *ports[NB_PORTS ];
hw/usb/hcd-uhci.h +1 -1
@@ -60,7 +60,7 @@ typedef struct UHCIState {uint32_t frame_bandwidth;bool completions_only;UHCIPort ports[NB_PORTS ]; - +qemu_irq irq;/* Interrupts that should be raised at the end of the current frame. */ uint32_t pending_int_mask;
Signature · 1 line
2.21.4
PATCH v4 3/3 hw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interrupts
In reply to BALATON ZoltanThis 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.
--- hw/usb/vt82c686-uhci-pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/usb/vt82c686-uhci-pci.c +12 -0
@@ -1,6 +1,16 @@#include "qemu/osdep.h" +#include "hw/irq.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 ) { +qemu_set_irq (isa_get_irq (NULL , irq), level); + } +} +static void usb_uhci_vt82c686b_realize (PCIDevice *dev,Error **errp) {UHCIState *s =UHCI (dev);
@@ -14,6 +24,8 @@ static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp)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[] = {
Signature · 1 line
2.21.4
Quoted 11 lines · BALATON Zoltan
v4 splits up the single patch into a series
BALATON Zoltan (3):
usb/uhci: Misc clean up
usb/uhci: Replacepci_set_irqwithqemu_set_irqhw/usb/vt82c686-uhci-pci: Use ISA instead of PCI interruptshw/usb/hcd-uhci.c | 11 +++++------ hw/usb/hcd-uhci.h | 2 +- hw/usb/vt82c686-uhci-pci.c | 12 ++++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-)