Kernel: Look for PS/2 devices in the ACPI namespace

This allows finding the PS/2 controller on newer machines that don't
have the 8042 bit set in FADT.
This commit is contained in:
2025-08-14 21:18:29 +03:00
parent 3804d4332b
commit c07188a60e
4 changed files with 289 additions and 55 deletions

View File

@@ -14,6 +14,15 @@ namespace Kernel::Input
class PS2Controller
{
public:
enum class DeviceType
{
None,
Unknown,
Keyboard,
Mouse,
};
public:
static BAN::ErrorOr<void> initialize(uint8_t scancode_set);
static PS2Controller& get();
@@ -24,10 +33,12 @@ namespace Kernel::Input
// Returns true, if byte is used as command, if returns false, byte is meant to device
bool handle_command_byte(PS2Device*, uint8_t);
uint8_t data_port() const { return m_data_port; }
private:
PS2Controller() = default;
BAN::ErrorOr<void> initialize_impl(uint8_t scancode_set);
BAN::ErrorOr<void> identify_device(uint8_t, uint8_t scancode_set);
BAN::ErrorOr<DeviceType> identify_device(uint8_t);
void device_initialize_task(void*);
@@ -61,6 +72,9 @@ namespace Kernel::Input
};
private:
uint16_t m_command_port { PS2::IOPort::COMMAND };
uint16_t m_data_port { PS2::IOPort::DATA };
BAN::RefPtr<PS2Device> m_devices[2];
Mutex m_mutex;