4 * Copyright (c) 2003 Fabrice Bellard
6 * SPDX-License-Identifier: MIT
8 #ifndef HW_INPUT_I8042_H
9 #define HW_INPUT_I8042_H
11 #include "hw/isa/isa.h"
12 #include "hw/sysbus.h"
13 #include "hw/input/ps2.h"
14 #include "qom/object.h"
16 #define I8042_KBD_IRQ 0
17 #define I8042_MOUSE_IRQ 1
19 typedef struct KBDState
{
20 uint8_t write_cmd
; /* if non zero, write data to port 60 is expected */
24 uint32_t migration_flags
;
28 bool extended_state_loaded
;
29 /* Bitmask of devices with data available. */
35 PS2MouseState ps2mouse
;
36 QEMUTimer
*throttle_timer
;
45 * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2
46 * keyboard device has asserted its irq
47 * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2
48 * mouse device has asserted its irq
49 * + Named GPIO output "a20": A20 line for x86 PCs
50 * + Unnamed GPIO output 0-1: i8042 output irqs for keyboard (0) or mouse (1)
53 #define TYPE_I8042 "i8042"
54 OBJECT_DECLARE_SIMPLE_TYPE(ISAKBDState
, I8042
)
68 * + sysbus MMIO region 0: MemoryRegion defining the command/status/data
69 * registers (access determined by mask property and access type)
70 * + Named GPIO input "ps2-kbd-input-irq": set to 1 if the downstream PS2
71 * keyboard device has asserted its irq
72 * + Named GPIO input "ps2-mouse-input-irq": set to 1 if the downstream PS2
73 * mouse device has asserted its irq
74 * + Unnamed GPIO output 0-1: i8042 output irqs for keyboard (0) or mouse (1)
77 #define TYPE_I8042_MMIO "i8042-mmio"
78 OBJECT_DECLARE_SIMPLE_TYPE(MMIOKBDState
, I8042_MMIO
)
81 SysBusDevice parent_obj
;
88 #define I8042_A20_LINE "a20"
91 void i8042_isa_mouse_fake_event(ISAKBDState
*isa
);
93 static inline bool i8042_present(void)
96 return object_resolve_path_type("", TYPE_I8042
, &amb
) || amb
;
100 * ACPI v2, Table 5-10 - Fixed ACPI Description Table Boot Architecture
101 * Flags, bit offset 1 - 8042.
103 static inline uint16_t iapc_boot_arch_8042(void)
105 return i8042_present() ? 0x1 << 1 : 0x0 ;
108 #endif /* HW_INPUT_I8042_H */