Hi Bernhard, On 3/10/23 23:44, Bernhard Beschow wrote:
According to the datasheet, SCI interrupts of the power management function aren't triggered through the PCI pins but rather directly to the integrated PIC. The routing is configurable through the ACPI interrupt select register at offset 42 in the PCI configuration space of the ISA function.
You describe 42 but use 0x42 (66). Clearer would be to add a definition, maybe: #define PCI_ACPI_INTR_SELECT_OFS 0x42 #define PCI_ACPI_INTR_SELECT_MSK 0xf Alternatively self-document with function name: static unsigned via_isa_get_pm_irq_index(ViaISAState *s) { return pci_get_byte(s->pm.dev.config + 0x42) & 0xf; } Otherwise LGTM.
Signed-off-by: Bernhard Beschow <shen...@gmail.com> --- hw/isa/vt82c686.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-)
+static void via_isa_set_pm_irq(void *opaque, int n, int level) +{ + ViaISAState *s = opaque; + uint8_t irq = pci_get_byte(s->pm.dev.config + 0x42) & 0xf; + + if (irq == 2) { + qemu_log_mask(LOG_GUEST_ERROR, "IRQ 2 for PM controller is reserved"); + return; + } + + if (irq != 0) { + qemu_set_irq(s->isa_irqs_in[irq], level); + } +}