summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-09-03 10:25:33 +0300
committerLinus Groh <mail@linusgroh.de>2022-09-20 18:43:05 +0100
commitc50a81e93e7cf5ea3df8afc6801ccdc4f6ec0c8c (patch)
treef58651c49b3243b0894d4b26fbabbf391f9fec0e
parent948be9674a057658badceb469df14a5e92d818ea (diff)
downloadserenity-c50a81e93e7cf5ea3df8afc6801ccdc4f6ec0c8c.zip
Kernel: Move x86-specific HID code to the Arch/x86 directory
The i8042 controller with its attached devices, the PS2 keyboard and mouse, rely on x86-specific IO instructions to work. Therefore, move them to the Arch/x86 directory to make it easier to omit the handling code of these devices.
-rw-r--r--Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.cpp (renamed from Kernel/Devices/HID/PS2KeyboardDevice.cpp)2
-rw-r--r--Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.h (renamed from Kernel/Devices/HID/PS2KeyboardDevice.h)2
-rw-r--r--Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.cpp (renamed from Kernel/Devices/HID/PS2MouseDevice.cpp)2
-rw-r--r--Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.h (renamed from Kernel/Devices/HID/PS2MouseDevice.h)2
-rw-r--r--Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.cpp (renamed from Kernel/Devices/HID/VMWareMouseDevice.cpp)2
-rw-r--r--Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.h (renamed from Kernel/Devices/HID/VMWareMouseDevice.h)4
-rw-r--r--Kernel/Arch/x86/ISABus/I8042Controller.cpp (renamed from Kernel/Devices/HID/I8042Controller.cpp)8
-rw-r--r--Kernel/Arch/x86/ISABus/I8042Controller.h (renamed from Kernel/Devices/HID/I8042Controller.h)0
-rw-r--r--Kernel/CMakeLists.txt8
-rw-r--r--Kernel/Devices/HID/HIDManagement.cpp7
-rw-r--r--Kernel/Devices/HID/HIDManagement.h2
11 files changed, 23 insertions, 16 deletions
diff --git a/Kernel/Devices/HID/PS2KeyboardDevice.cpp b/Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.cpp
index ba8a3a3b25..b569f16e48 100644
--- a/Kernel/Devices/HID/PS2KeyboardDevice.cpp
+++ b/Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.cpp
@@ -6,10 +6,10 @@
*/
#include <AK/Types.h>
+#include <Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.h>
#include <Kernel/Debug.h>
#include <Kernel/Devices/DeviceManagement.h>
#include <Kernel/Devices/HID/HIDManagement.h>
-#include <Kernel/Devices/HID/PS2KeyboardDevice.h>
#include <Kernel/Scheduler.h>
#include <Kernel/Sections.h>
#include <Kernel/TTY/ConsoleManagement.h>
diff --git a/Kernel/Devices/HID/PS2KeyboardDevice.h b/Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.h
index 24e9465eea..d3c63984ea 100644
--- a/Kernel/Devices/HID/PS2KeyboardDevice.h
+++ b/Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.h
@@ -10,7 +10,7 @@
#include <AK/DoublyLinkedList.h>
#include <AK/Types.h>
#include <Kernel/API/KeyCode.h>
-#include <Kernel/Devices/HID/I8042Controller.h>
+#include <Kernel/Arch/x86/ISABus/I8042Controller.h>
#include <Kernel/Devices/HID/KeyboardDevice.h>
#include <Kernel/Interrupts/IRQHandler.h>
#include <Kernel/Random.h>
diff --git a/Kernel/Devices/HID/PS2MouseDevice.cpp b/Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.cpp
index 86f090ffea..e1bc3370c2 100644
--- a/Kernel/Devices/HID/PS2MouseDevice.cpp
+++ b/Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.cpp
@@ -6,9 +6,9 @@
#include <AK/Memory.h>
#include <Kernel/Arch/x86/Hypervisor/VMWareBackdoor.h>
+#include <Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.h>
#include <Kernel/Debug.h>
#include <Kernel/Devices/DeviceManagement.h>
-#include <Kernel/Devices/HID/PS2MouseDevice.h>
#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/PS2MouseDevice.h b/Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.h
index 773d58bd4e..e874ae42f4 100644
--- a/Kernel/Devices/HID/PS2MouseDevice.h
+++ b/Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.h
@@ -8,7 +8,7 @@
#include <AK/CircularQueue.h>
#include <Kernel/API/MousePacket.h>
-#include <Kernel/Devices/HID/I8042Controller.h>
+#include <Kernel/Arch/x86/ISABus/I8042Controller.h>
#include <Kernel/Devices/HID/MouseDevice.h>
#include <Kernel/Interrupts/IRQHandler.h>
#include <Kernel/Random.h>
diff --git a/Kernel/Devices/HID/VMWareMouseDevice.cpp b/Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.cpp
index b059477338..b2e9bc046a 100644
--- a/Kernel/Devices/HID/VMWareMouseDevice.cpp
+++ b/Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.cpp
@@ -5,8 +5,8 @@
*/
#include <Kernel/Arch/x86/Hypervisor/VMWareBackdoor.h>
+#include <Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.h>
#include <Kernel/Devices/DeviceManagement.h>
-#include <Kernel/Devices/HID/VMWareMouseDevice.h>
#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/VMWareMouseDevice.h b/Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.h
index 96e11f6923..63711ab1e7 100644
--- a/Kernel/Devices/HID/VMWareMouseDevice.h
+++ b/Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.h
@@ -8,8 +8,8 @@
#include <AK/CircularQueue.h>
#include <Kernel/API/MousePacket.h>
-#include <Kernel/Devices/HID/I8042Controller.h>
-#include <Kernel/Devices/HID/PS2MouseDevice.h>
+#include <Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.h>
+#include <Kernel/Arch/x86/ISABus/I8042Controller.h>
#include <Kernel/Interrupts/IRQHandler.h>
#include <Kernel/Random.h>
diff --git a/Kernel/Devices/HID/I8042Controller.cpp b/Kernel/Arch/x86/ISABus/I8042Controller.cpp
index bf48056068..c4ce6b62f1 100644
--- a/Kernel/Devices/HID/I8042Controller.cpp
+++ b/Kernel/Arch/x86/ISABus/I8042Controller.cpp
@@ -6,10 +6,10 @@
#include <Kernel/Arch/Delay.h>
#include <Kernel/Arch/x86/IO.h>
-#include <Kernel/Devices/HID/I8042Controller.h>
-#include <Kernel/Devices/HID/PS2KeyboardDevice.h>
-#include <Kernel/Devices/HID/PS2MouseDevice.h>
-#include <Kernel/Devices/HID/VMWareMouseDevice.h>
+#include <Kernel/Arch/x86/ISABus/HID/PS2KeyboardDevice.h>
+#include <Kernel/Arch/x86/ISABus/HID/PS2MouseDevice.h>
+#include <Kernel/Arch/x86/ISABus/HID/VMWareMouseDevice.h>
+#include <Kernel/Arch/x86/ISABus/I8042Controller.h>
#include <Kernel/Sections.h>
namespace Kernel {
diff --git a/Kernel/Devices/HID/I8042Controller.h b/Kernel/Arch/x86/ISABus/I8042Controller.h
index 997cf4517d..997cf4517d 100644
--- a/Kernel/Devices/HID/I8042Controller.h
+++ b/Kernel/Arch/x86/ISABus/I8042Controller.h
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index cb37e56307..ebb2ce04cb 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -62,13 +62,9 @@ set(KERNEL_SOURCES
Devices/SelfTTYDevice.cpp
Devices/SerialDevice.cpp
Devices/ZeroDevice.cpp
- Devices/HID/I8042Controller.cpp
Devices/HID/HIDManagement.cpp
Devices/HID/KeyboardDevice.cpp
Devices/HID/MouseDevice.cpp
- Devices/HID/PS2KeyboardDevice.cpp
- Devices/HID/PS2MouseDevice.cpp
- Devices/HID/VMWareMouseDevice.cpp
GlobalProcessExposed.cpp
Graphics/Bochs/DisplayConnector.cpp
Graphics/Bochs/GraphicsAdapter.cpp
@@ -339,6 +335,10 @@ if ("${SERENITY_ARCH}" STREQUAL "i686" OR "${SERENITY_ARCH}" STREQUAL "x86_64")
Arch/x86/Hypervisor/VMWareBackdoor.cpp
+ Arch/x86/ISABus/HID/PS2KeyboardDevice.cpp
+ Arch/x86/ISABus/HID/PS2MouseDevice.cpp
+ Arch/x86/ISABus/HID/VMWareMouseDevice.cpp
+ Arch/x86/ISABus/I8042Controller.cpp
Arch/x86/ISABus/IDEController.cpp
Arch/x86/PCI/Controller/HostBridge.cpp
Arch/x86/PCI/Initializer.cpp
diff --git a/Kernel/Devices/HID/HIDManagement.cpp b/Kernel/Devices/HID/HIDManagement.cpp
index 7641c0514c..0bb8bc8a53 100644
--- a/Kernel/Devices/HID/HIDManagement.cpp
+++ b/Kernel/Devices/HID/HIDManagement.cpp
@@ -4,10 +4,13 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <AK/Platform.h>
#include <AK/Singleton.h>
+#if ARCH(I386) || ARCH(X86_64)
+# include <Kernel/Arch/x86/ISABus/I8042Controller.h>
+#endif
#include <Kernel/CommandLine.h>
#include <Kernel/Devices/HID/HIDManagement.h>
-#include <Kernel/Devices/HID/I8042Controller.h>
#include <Kernel/Firmware/ACPI/Parser.h>
#include <Kernel/Sections.h>
@@ -119,6 +122,7 @@ UNMAP_AFTER_INIT ErrorOr<void> HIDManagement::enumerate()
// set to emulate PS/2, we should not initialize the PS/2 controller.
if (kernel_command_line().disable_ps2_controller())
return {};
+#if ARCH(I386) || ARCH(X86_64)
m_i8042_controller = I8042Controller::initialize();
// Note: If ACPI is disabled or doesn't indicate that we have an i8042, we
@@ -140,6 +144,7 @@ UNMAP_AFTER_INIT ErrorOr<void> HIDManagement::enumerate()
if (m_i8042_controller->keyboard())
m_hid_devices.append(m_i8042_controller->keyboard().release_nonnull());
+#endif
return {};
}
diff --git a/Kernel/Devices/HID/HIDManagement.h b/Kernel/Devices/HID/HIDManagement.h
index 86f242945f..c2c212ddfc 100644
--- a/Kernel/Devices/HID/HIDManagement.h
+++ b/Kernel/Devices/HID/HIDManagement.h
@@ -61,7 +61,9 @@ private:
size_t m_mouse_minor_number { 0 };
size_t m_keyboard_minor_number { 0 };
KeyboardClient* m_client { nullptr };
+#if ARCH(I386) || ARCH(X86_64)
LockRefPtr<I8042Controller> m_i8042_controller;
+#endif
NonnullLockRefPtrVector<HIDDevice> m_hid_devices;
Spinlock m_client_lock { LockRank::None };
};