qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

acpi: move aml builder code for i8042 (kbd+mouse) device

DSDT change: isa device order changes in case MI1 (ipmi) is present.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200619091905.21676-7-kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Gerd Hoffmann and committed by
Michael S. Tsirkin
df0f3d13 89ed90e3

+31 -39
-39
hw/i386/acpi-build.c
··· 938 938 aml_append(table, scope); 939 939 } 940 940 941 - static Aml *build_kbd_device_aml(void) 942 - { 943 - Aml *dev; 944 - Aml *crs; 945 - 946 - dev = aml_device("KBD"); 947 - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0303"))); 948 - 949 - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); 950 - 951 - crs = aml_resource_template(); 952 - aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01)); 953 - aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01)); 954 - aml_append(crs, aml_irq_no_flags(1)); 955 - aml_append(dev, aml_name_decl("_CRS", crs)); 956 - 957 - return dev; 958 - } 959 - 960 - static Aml *build_mouse_device_aml(void) 961 - { 962 - Aml *dev; 963 - Aml *crs; 964 - 965 - dev = aml_device("MOU"); 966 - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0F13"))); 967 - 968 - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); 969 - 970 - crs = aml_resource_template(); 971 - aml_append(crs, aml_irq_no_flags(12)); 972 - aml_append(dev, aml_name_decl("_CRS", crs)); 973 - 974 - return dev; 975 - } 976 - 977 941 static Aml *build_vmbus_device_aml(VMBusBridge *vmbus_bridge) 978 942 { 979 943 Aml *dev; ··· 1018 982 1019 983 Aml *scope = aml_scope("_SB.PCI0.ISA"); 1020 984 Object *obj = object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous); 1021 - 1022 - aml_append(scope, build_kbd_device_aml()); 1023 - aml_append(scope, build_mouse_device_aml()); 1024 985 1025 986 if (ambiguous) { 1026 987 error_report("Multiple ISA busses, unable to define IPMI ACPI data");
+31
hw/input/pckbd.c
··· 26 26 #include "qemu/log.h" 27 27 #include "hw/isa/isa.h" 28 28 #include "migration/vmstate.h" 29 + #include "hw/acpi/aml-build.h" 29 30 #include "hw/input/ps2.h" 30 31 #include "hw/irq.h" 31 32 #include "hw/input/i8042.h" ··· 561 562 qemu_register_reset(kbd_reset, s); 562 563 } 563 564 565 + static void i8042_build_aml(ISADevice *isadev, Aml *scope) 566 + { 567 + Aml *kbd; 568 + Aml *mou; 569 + Aml *crs; 570 + 571 + crs = aml_resource_template(); 572 + aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01)); 573 + aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01)); 574 + aml_append(crs, aml_irq_no_flags(1)); 575 + 576 + kbd = aml_device("KBD"); 577 + aml_append(kbd, aml_name_decl("_HID", aml_eisaid("PNP0303"))); 578 + aml_append(kbd, aml_name_decl("_STA", aml_int(0xf))); 579 + aml_append(kbd, aml_name_decl("_CRS", crs)); 580 + 581 + crs = aml_resource_template(); 582 + aml_append(crs, aml_irq_no_flags(12)); 583 + 584 + mou = aml_device("MOU"); 585 + aml_append(mou, aml_name_decl("_HID", aml_eisaid("PNP0F13"))); 586 + aml_append(mou, aml_name_decl("_STA", aml_int(0xf))); 587 + aml_append(mou, aml_name_decl("_CRS", crs)); 588 + 589 + aml_append(scope, kbd); 590 + aml_append(scope, mou); 591 + } 592 + 564 593 static void i8042_class_initfn(ObjectClass *klass, void *data) 565 594 { 566 595 DeviceClass *dc = DEVICE_CLASS(klass); 596 + ISADeviceClass *isa = ISA_DEVICE_CLASS(klass); 567 597 568 598 dc->realize = i8042_realizefn; 569 599 dc->vmsd = &vmstate_kbd_isa; 600 + isa->build_aml = i8042_build_aml; 570 601 set_bit(DEVICE_CATEGORY_INPUT, dc->categories); 571 602 } 572 603