Skip to content

Commit

Permalink
hw/ide/via: Wire up IDE legacy interrupts in host device
Browse files Browse the repository at this point in the history
Resolves circular depencency between IDE function and south bridge.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20230531211043.41724-3-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
  • Loading branch information
shentok authored and philmd committed Jul 10, 2023
1 parent e2b84ee commit 68eadfa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hw/ide/via.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sysemu/dma.h"
#include "hw/isa/vt82c686.h"
#include "hw/ide/pci.h"
#include "hw/irq.h"
#include "trace.h"

static uint64_t bmdma_read(void *opaque, hwaddr addr,
Expand Down Expand Up @@ -104,15 +105,16 @@ static void bmdma_setup_bar(PCIIDEState *d)

static void via_ide_set_irq(void *opaque, int n, int level)
{
PCIDevice *d = PCI_DEVICE(opaque);
PCIIDEState *s = opaque;
PCIDevice *d = PCI_DEVICE(s);

if (level) {
d->config[0x70 + n * 8] |= 0x80;
} else {
d->config[0x70 + n * 8] &= ~0x80;
}

via_isa_set_irq(pci_get_function_0(d), 14 + n, level);
qemu_set_irq(s->isa_irq[n], level);
}

static void via_ide_reset(DeviceState *dev)
Expand Down
5 changes: 5 additions & 0 deletions hw/isa/vt82c686.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,10 @@ static void via_isa_realize(PCIDevice *d, Error **errp)
if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) {
return;
}
for (i = 0; i < 2; i++) {
qdev_connect_gpio_out_named(DEVICE(&s->ide), "isa-irq", i,
s->isa_irqs_in[14 + i]);
}

/* Functions 2-3: USB Ports */
for (i = 0; i < ARRAY_SIZE(s->uhci); i++) {
Expand Down Expand Up @@ -814,6 +818,7 @@ static void vt8231_isa_reset(DeviceState *dev)
PCI_COMMAND_MASTER | PCI_COMMAND_SPECIAL);
pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM);

pci_conf[0x4c] = 0x04; /* IDE interrupt Routing */
pci_conf[0x58] = 0x40; /* Miscellaneous Control 0 */
pci_conf[0x67] = 0x08; /* Fast IR Config */
pci_conf[0x6b] = 0x01; /* Fast IR I/O Base */
Expand Down

0 comments on commit 68eadfa

Please sign in to comment.