mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 03:43:37 +08:00
hw/input/pckbd: QOM'ify IRQ numbers
Exposing the IRQ numbers as 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> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220301220037.76555-4-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20220307134353.1950-11-philippe.mathieu.daude@gmail.com> Reviewed-by: Bernhard Beschow <shentey@gmail.com>
This commit is contained in:
parent
e89d9fa385
commit
b86ce7a66a
@ -26,6 +26,7 @@
|
|||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
#include "qapi/error.h"
|
||||||
#include "hw/isa/isa.h"
|
#include "hw/isa/isa.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "hw/acpi/aml-build.h"
|
#include "hw/acpi/aml-build.h"
|
||||||
@ -671,6 +672,8 @@ struct ISAKBDState {
|
|||||||
KBDState kbd;
|
KBDState kbd;
|
||||||
bool kbd_throttle;
|
bool kbd_throttle;
|
||||||
MemoryRegion io[2];
|
MemoryRegion io[2];
|
||||||
|
uint8_t kbd_irq;
|
||||||
|
uint8_t mouse_irq;
|
||||||
};
|
};
|
||||||
|
|
||||||
void i8042_isa_mouse_fake_event(ISAKBDState *isa)
|
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);
|
ISAKBDState *isa_s = I8042(dev);
|
||||||
KBDState *s = &isa_s->kbd;
|
KBDState *s = &isa_s->kbd;
|
||||||
|
|
||||||
isa_init_irq(isadev, &s->irq_kbd, 1);
|
if (isa_s->kbd_irq >= ISA_NUM_IRQS) {
|
||||||
isa_init_irq(isadev, &s->irq_mouse, 12);
|
error_setg(errp, "Maximum value for \"kbd-irq\" is: %u",
|
||||||
|
ISA_NUM_IRQS - 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isa_s->mouse_irq >= ISA_NUM_IRQS) {
|
||||||
|
error_setg(errp, "Maximum value for \"mouse-irq\" is: %u",
|
||||||
|
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 + 0, 0x60);
|
||||||
isa_register_ioport(isadev, isa_s->io + 1, 0x64);
|
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)
|
static void i8042_build_aml(ISADevice *isadev, Aml *scope)
|
||||||
{
|
{
|
||||||
|
ISAKBDState *isa_s = I8042(isadev);
|
||||||
Aml *kbd;
|
Aml *kbd;
|
||||||
Aml *mou;
|
Aml *mou;
|
||||||
Aml *crs;
|
Aml *crs;
|
||||||
@ -761,7 +777,7 @@ static void i8042_build_aml(ISADevice *isadev, Aml *scope)
|
|||||||
crs = aml_resource_template();
|
crs = aml_resource_template();
|
||||||
aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01));
|
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_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");
|
kbd = aml_device("KBD");
|
||||||
aml_append(kbd, aml_name_decl("_HID", aml_eisaid("PNP0303")));
|
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));
|
aml_append(kbd, aml_name_decl("_CRS", crs));
|
||||||
|
|
||||||
crs = aml_resource_template();
|
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");
|
mou = aml_device("MOU");
|
||||||
aml_append(mou, aml_name_decl("_HID", aml_eisaid("PNP0F13")));
|
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[] = {
|
static Property i8042_properties[] = {
|
||||||
DEFINE_PROP_BOOL("extended-state", ISAKBDState, kbd.extended_state, true),
|
DEFINE_PROP_BOOL("extended-state", ISAKBDState, kbd.extended_state, true),
|
||||||
DEFINE_PROP_BOOL("kbd-throttle", ISAKBDState, kbd_throttle, false),
|
DEFINE_PROP_BOOL("kbd-throttle", ISAKBDState, kbd_throttle, false),
|
||||||
|
DEFINE_PROP_UINT8("kbd-irq", ISAKBDState, kbd_irq, 1),
|
||||||
|
DEFINE_PROP_UINT8("mouse-irq", ISAKBDState, mouse_irq, 12),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user