ladybird/Kernel/Devices
Liav A 05ba034000 Kernel: Introduce the IOWindow class
This class is intended to replace all IOAddress usages in the Kernel
codebase altogether. The idea is to ensure IO can be done in
arch-specific manner that is determined mostly in compile-time, but to
still be able to use most of the Kernel code in non-x86 builds. Specific
devices that rely on x86-specific IO instructions are already placed in
the Arch/x86 directory and are omitted for non-x86 builds.

The reason this works so well is the fact that x86 IO space acts in a
similar fashion to the traditional memory space being available in most
CPU architectures - the x86 IO space is essentially just an array of
bytes like the physical memory address space, but requires x86 IO
instructions to load and store data. Therefore, many devices allow host
software to interact with the hardware registers in both ways, with a
noticeable trend even in the modern x86 hardware to move away from the
old x86 IO space to exclusively using memory-mapped IO.

Therefore, the IOWindow class encapsulates both methods for x86 builds.
The idea is to allow PCI devices to be used in either way in x86 builds,
so when trying to map an IOWindow on a PCI BAR, the Kernel will try to
find the proper method being declared with the PCI BAR flags.
For old PCI hardware on non-x86 builds this might turn into a problem as
we can't use port mapped IO, so the Kernel will gracefully fail with
ENOTSUP error code if that's the case, as there's really nothing we can
do within such case.

For general IO, the read{8,16,32} and write{8,16,32} methods are
available as a convenient API for other places in the Kernel. There are
simply no direct 64-bit IO API methods yet, as it's not needed right now
and is not considered to be Arch-agnostic too - the x86 IO space doesn't
support generating 64 bit cycle on IO bus and instead requires two 2
32-bit accesses. If for whatever reason it appears to be necessary to do
IO in such manner, it could probably be added with some neat tricks to
do so. It is recommended to use Memory::TypedMapping struct if direct 64
bit IO is actually needed.
2022-09-23 17:22:15 +01:00
..
Audio Kernel: Introduce the IOWindow class 2022-09-23 17:22:15 +01:00
HID Kernel: Move x86-specific HID code to the Arch/x86 directory 2022-09-20 18:43:05 +01:00
AsyncDeviceRequest.cpp Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
AsyncDeviceRequest.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
BlockDevice.cpp Kernel/Devices: Abstract SysFS Device add/remove methods more properly 2022-07-19 11:02:37 +01:00
BlockDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
CharacterDevice.cpp Kernel/Devices: Abstract SysFS Device add/remove methods more properly 2022-07-19 11:02:37 +01:00
CharacterDevice.h Kernel/Devices: Abstract SysFS Device add/remove methods more properly 2022-07-19 11:02:37 +01:00
ConsoleDevice.cpp Kernel: Don't blindly compile Bochs debug output code in ConsoleDevice 2022-09-20 18:43:05 +01:00
ConsoleDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
Device.cpp Kernel/Devices: Abstract SysFS Device add/remove methods more properly 2022-07-19 11:02:37 +01:00
Device.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
DeviceControlDevice.cpp Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
DeviceControlDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
DeviceManagement.cpp Kernel: Add DeviceManagement::try_for_each() for fallible iteration 2022-02-27 20:37:57 +01:00
DeviceManagement.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
FullDevice.cpp Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
FullDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
KCOVDevice.cpp Kernel: Simplify the File memory-mapping API 2022-08-24 14:57:51 +02:00
KCOVDevice.h Kernel: Simplify the File memory-mapping API 2022-08-24 14:57:51 +02:00
KCOVInstance.cpp Kernel: Propagate overflow errors from Memory::page_round_up 2021-12-28 23:08:50 +01:00
KCOVInstance.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
MemoryDevice.cpp Kernel: Simplify the File memory-mapping API 2022-08-24 14:57:51 +02:00
MemoryDevice.h Kernel: Simplify the File memory-mapping API 2022-08-24 14:57:51 +02:00
NullDevice.cpp Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
NullDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
PCISerialDevice.cpp Kernel: Introduce the IOWindow class 2022-09-23 17:22:15 +01:00
PCISerialDevice.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
RandomDevice.cpp Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
RandomDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
SelfTTYDevice.cpp Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
SelfTTYDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
SerialDevice.cpp Kernel: Introduce the IOWindow class 2022-09-23 17:22:15 +01:00
SerialDevice.h Kernel: Introduce the IOWindow class 2022-09-23 17:22:15 +01:00
ZeroDevice.cpp Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00
ZeroDevice.h Kernel: Make self-contained locking smart pointers their own classes 2022-08-20 17:20:43 +02:00