//! The PS/2 Controller is located on the mainboard. //! In the early days the controller was a single chip (Intel 8042). //! As of today it is part of the Advanced Integrated Peripheral. //! //! It shows up in the device discovery as: //! KBD_ [acpi_device] hid=PNP0303 (PS/2 Keyboard) //! - io_port 0x60 len 0x1 //! - io_port 0x64 len 0x1 //! - irq 0x1 len 0x1 //! MOU_ [acpi_device] hid=PNP0F13 (PS/2 Mouse) //! - irq 0xc len 0x1 const std = @import("std"); const runtime = @import("runtime"); const ps2 = @import("root.zig"); const device = runtime.device; pub fn main() void { const buffer = runtime.allocator().alloc(device.DeviceDescriptor, 64) catch { _ = runtime.system.write("system/drivers/ps2-bus: out of memory\n"); return; }; const keyboardDeviceDescriptor = device.findDeviceDescriptorByHid(buffer, "PNP0303"); if (keyboardDeviceDescriptor != null) { // load keyboard driver _ = runtime.system.write("system/drivers/ps2-bus: found keyboard DeviceDescriptor\n"); _ = runtime.system.write("system/drivers/ps2-bus: probing controller\n"); if (!device.claim(keyboardDeviceDescriptor.?.id)) { _ = runtime.system.write("system/drivers/ps2-bus: unable to claim controller \n"); return; } ps2.disablePorts(keyboardDeviceDescriptor.?); ps2.flushOutputBuffer(keyboardDeviceDescriptor.?); } else { _ = runtime.system.write("system/drivers/ps2-bus: no keyboard\n"); } const mouseDeviceDescriptor = device.findDeviceDescriptorByHid(buffer, "PNP0F13"); if (mouseDeviceDescriptor != null) { // load mouse driver _ = runtime.system.write("system/drivers/ps2-bus: found mouse DeviceDescriptor\n"); } else { _ = runtime.system.write("system/drivers/ps2-bus: no mouse\n"); } _ = runtime.system.write("system/drivers/ps2-bus: ok\n"); while (true) runtime.system.sleep(1000); } pub const panic = runtime.panic; comptime { _ = &runtime.start._start; }