[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/22] hw/input/pckbd: QOM'ify IRQ numbers
From: |
Bernhard Beschow |
Subject: |
[PATCH v2 03/22] hw/input/pckbd: QOM'ify IRQ numbers |
Date: |
Tue, 22 Feb 2022 20:34:27 +0100 |
Exposing the IRQ numbers as a QOM properties not only allows them to be
configurable but also to be printed by standard QOM mechanisms. This allows
isabus_dev_print() to be retired eventually.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
hw/input/pckbd.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index baba62f357..56c55c5768 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -26,6 +26,7 @@
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "qemu/timer.h"
+#include "qapi/error.h"
#include "hw/isa/isa.h"
#include "migration/vmstate.h"
#include "hw/acpi/aml-build.h"
@@ -671,6 +672,8 @@ struct ISAKBDState {
KBDState kbd;
bool kbd_throttle;
MemoryRegion io[2];
+ uint32_t kbd_irq;
+ uint32_t mouse_irq;
};
void i8042_isa_mouse_fake_event(ISAKBDState *isa)
@@ -734,8 +737,20 @@ static void i8042_realizefn(DeviceState *dev, Error **errp)
ISAKBDState *isa_s = I8042(dev);
KBDState *s = &isa_s->kbd;
- isa_init_irq(isadev, &s->irq_kbd, 1);
- isa_init_irq(isadev, &s->irq_mouse, 12);
+ if (isa_s->kbd_irq >= ISA_NUM_IRQS) {
+ error_setg(errp, "Maximum value for \"kbd-irq\" is: %d",
+ ISA_NUM_IRQS - 1);
+ return;
+ }
+
+ if (isa_s->mouse_irq >= ISA_NUM_IRQS) {
+ error_setg(errp, "Maximum value for \"mouse-irq\" is: %d",
+ ISA_NUM_IRQS - 1);
+ return;
+ }
+
+ isa_init_irq(isadev, &s->irq_kbd, isa_s->kbd_irq);
+ isa_init_irq(isadev, &s->irq_mouse, isa_s->mouse_irq);
isa_register_ioport(isadev, isa_s->io + 0, 0x60);
isa_register_ioport(isadev, isa_s->io + 1, 0x64);
@@ -754,6 +769,7 @@ static void i8042_realizefn(DeviceState *dev, Error **errp)
static void i8042_build_aml(ISADevice *isadev, Aml *scope)
{
+ ISAKBDState *isa_s = I8042(isadev);
Aml *kbd;
Aml *mou;
Aml *crs;
@@ -761,7 +777,7 @@ static void i8042_build_aml(ISADevice *isadev, Aml *scope)
crs = aml_resource_template();
aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01));
- aml_append(crs, aml_irq_no_flags(1));
+ aml_append(crs, aml_irq_no_flags(isa_s->kbd_irq));
kbd = aml_device("KBD");
aml_append(kbd, aml_name_decl("_HID", aml_eisaid("PNP0303")));
@@ -769,7 +785,7 @@ static void i8042_build_aml(ISADevice *isadev, Aml *scope)
aml_append(kbd, aml_name_decl("_CRS", crs));
crs = aml_resource_template();
- aml_append(crs, aml_irq_no_flags(12));
+ aml_append(crs, aml_irq_no_flags(isa_s->mouse_irq));
mou = aml_device("MOU");
aml_append(mou, aml_name_decl("_HID", aml_eisaid("PNP0F13")));
@@ -783,6 +799,8 @@ static void i8042_build_aml(ISADevice *isadev, Aml *scope)
static Property i8042_properties[] = {
DEFINE_PROP_BOOL("extended-state", ISAKBDState, kbd.extended_state, true),
DEFINE_PROP_BOOL("kbd-throttle", ISAKBDState, kbd_throttle, false),
+ DEFINE_PROP_UINT32("kbd-irq", ISAKBDState, kbd_irq, 1),
+ DEFINE_PROP_UINT32("mouse-irq", ISAKBDState, mouse_irq, 12),
DEFINE_PROP_END_OF_LIST(),
};
--
2.35.1
- [PATCH v2 00/22] isa: Resolve unneeded IRQ attributes from ISADevice, Bernhard Beschow, 2022/02/22
- [PATCH v2 01/22] hw/rtc/mc146818rtc: QOM'ify IRQ number, Bernhard Beschow, 2022/02/22
- [PATCH v2 03/22] hw/input/pckbd: QOM'ify IRQ numbers,
Bernhard Beschow <=
- [PATCH v2 02/22] hw/rtc/m48t59-isa: QOM'ify IRQ number, Bernhard Beschow, 2022/02/22
- [PATCH v2 04/22] hw/isa/isa-bus: Remove isabus_dev_print(), Bernhard Beschow, 2022/02/22
- [PATCH v2 09/22] hw/audio/sb16: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22
- [PATCH v2 12/22] hw/char/serial-isa: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22
- [PATCH v2 16/22] hw/ipmi/isa_ipmi_kcs: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22
- [PATCH v2 13/22] hw/ide/isa: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22
- [PATCH v2 11/22] hw/char/parallel: Disuse isa_init_irq(), Bernhard Beschow, 2022/02/22