summaryrefslogtreecommitdiff
path: root/Kernel/Bus
AgeCommit message (Collapse)Author
2022-02-03Kernel: Stop allocating VirtIO configuration structs on the heapIdan Horowitz
These are trivially-copyable 12-byte structs, so there's no point in allocating them on the heap.
2022-02-03Kernel: Protect PCI access with spinlock instead of mutexAndreas Kling
2022-01-28Kernel: Make UHCIController::spawn_port_process OOM-fallibleIdan Horowitz
2022-01-28Kernel: Rename UHCIController::{spawn_port_proc => spawn_port_process}Idan Horowitz
There's no need to use this non-standard shorthand mnemonic. (This commit also removes the unimplemented do_debug_transfer while we're here.)
2022-01-26Kernel: Make VirtIO::ConsolePort construction OOM-fallibleIdan Horowitz
2022-01-25Kernel: Use u64 instead of size_t for File::can_write offsetIdan Horowitz
This ensures offsets will not be truncated on large files on i686.
2022-01-25Kernel: Use u64 instead of size_t for File::can_read offsetIdan Horowitz
This ensures offsets will not be truncated on large files on i686.
2022-01-23Kernel/PCI: Add basic support for the VMD PCI bridge deviceLiav A
2022-01-21Kernel/PCI: Verify Access is not initialized before initializing itLiav A
There's no valid case where we should try to initialize the Access singleton multiple times, therefore just assert if it ever happens.
2022-01-21Kernel: Make VirtIO::Queue construction fallibleIdan Horowitz
2022-01-21Kernel: Stop adopting non-heap memory into OwnPtrs in VirtIO::QueuesIdan Horowitz
2022-01-21Kernel: Make Memory::RingBuffer construction fallibleIdan Horowitz
2022-01-19Kernel/PCI: Don't try to enumerate 255 functions on the host bridgeLiav A
There can only be a limited number of functions (only 8). Also, consider the start bus of the PCI domain when trying to enumerate other host bridges on bus 0, device 0, functions 1-7 (function 0 is the main host bridge).
2022-01-19Kernel/PCI: Start enumeration in specified start bus of the PCI domainLiav A
Some devices, like the Intel Volume Management Device, might have bus numbering restrictions (so numbers can be from 224 to 225, for example).
2022-01-19Kernel/PCI: Don't hardcode Address domain to 0 when enumerating devicesLiav A
2022-01-19Kernel/PCI: Don't cast a domain number to u16Liav A
Found by Tom (tomuta) during a debug session of these changes.
2022-01-13Kernel: Make map_typed() & map_typed_writable() fallible using ErrorOrIdan Horowitz
This mostly just moved the problem, as a lot of the callers are not capable of propagating the errors themselves, but it's a step in the right direction.
2022-01-13Kernel: Use StringView instead of String in RingBuffer's constructorIdan Horowitz
This String was being copied into a KString internally anyways.
2022-01-12Kernel: Replace all usages of String::number with KString::numberIdan Horowitz
2022-01-09Kernel: Use DMA helper everywherePankaj Raghav
Port UCHI, AC97, SB16, BMIDEChannel and AHCIPort to use the helper to allocate DMA buffers.
2022-01-08Kernel/PCI: Split host bridge code from the Access singletonLiav A
Two classes are added - HostBridge and MemoryBackedHostBridge, which both derive from HostController class. This allows the kernel to map different busses from different PCI domains in the same time. Each HostController implementation doesn't take the Address object to address PCI devices but instead we take distinct numbers of the PCI bus, device and function as it allows us to specify arbitrary PCI domains in the Address structure and still to get the correct PCI devices. This also matches the hardware behavior of PCI domains - the host bridge merely takes memory operations or IO operations and translates them to addressing of three components - PCI bus, device and function. These changes also greatly simplify how enumeration of Host Bridges work now - scanning of the hardware depends on what the Host bridges can do for us, so in case we have multiple host bridges that expose a memory mapped region or IO ports to access PCI configuration space, we simply let the code of the host bridge to figure out how to fetch data for us. Another semantical change is that a PCI domain structure is no longer attached to a PhysicalAddress, so even in the case that the machine doesn't implement PCI domains, we still treat that machine to contain 1 PCI domain to treat that one host bridge in the same way, like with a machine with one or more PCI domains.
2022-01-07Everywhere: Fix many spelling errorsmjz19910
2022-01-03Kernel: Use `try_create` not `must_create` in SysFSUSB::createJesse Buhagiar
The function `KString::must_create()` can only be enforced during early boot (that is, when `g_in_early_boot` is true), hence the use of this function during runtime causes a `VERIFY` to assert, leading to a Kernel Panic. We should instead use `TRY()` along with `try_create()` to prevent this from crashing whenever a USB device is inserted into the system, and we don't have enough memory to allocate the device's KString.
2022-01-01Kernel/NVMe: Add initial NVMe driver supportPankaj Raghav
Add a basic NVMe driver support to serenity based on NVMe spec 1.4. The driver can support multiple NVMe drives (subsystems). But in a NVMe drive, the driver can support one controller with multiple namespaces. Each core will get a separate NVMe Queue. As the system lacks MSI support, PIN based interrupts are used for IO. Tested the NVMe support by replacing IDE driver with the NVMe driver :^)
2021-12-30Kernel: Tighten String-related includesDaniel Bertalan
2021-12-28Kernel: Propagate overflow errors from Memory::page_round_upGuilherme Goncalves
Fixes #11402.
2021-12-28Kernel: Remove the kmalloc_eternal heap :^)Andreas Kling
This was a premature optimization from the early days of SerenityOS. The eternal heap was a simple bump pointer allocator over a static byte array. My original idea was to avoid heap fragmentation and improve data locality, but both ideas were rooted in cargo culting, not data. We would reserve 4 MiB at boot and only ended up using ~256 KiB, wasting the rest. This patch replaces all kmalloc_eternal() usage by regular kmalloc().
2021-12-28Kernel: Remove the KString::try_create(String::formatted(...)) patternDaniel Bertalan
We can now directly create formatted KStrings with KString::formatted. :^)
2021-12-14Kernel/SysFS: Prevent allocation for component name during constructionLiav A
Instead, allocate before constructing the object and pass NonnullOwnPtr of KString to the object if needed. Some classes can determine their names as they have a known attribute to look for or have a static name.
2021-12-11Kernel: Remove unused String.h includesHendiadyoin1
This makes searching for not yet OOM safe interfaces a bit easier.
2021-12-09Kernel: Some clang-tidy fixes in Bus/VirtIOHendiadyoin1
2021-12-09Kernel: Some clang-tidy fixes in Bus/USBHendiadyoin1
2021-12-09Kernel: Mark USBTransfer's constructor as privateHendiadyoin1
We have a try_create method for that.
2021-12-09Kernel: Fix some clang-tidy warnings in PCI::AccessHendiadyoin1
2021-12-09Kernel: Use AK:any_of in PCI::Device capability checksHendiadyoin1
This is equivalent to std::any_of as clang-tidy suggests.
2021-12-09Kernel: Construct PCIDeviceAttributeSysFSComponent with StringViewsHendiadyoin1
There is no use to create a temporary String of a char const* to just cast it to a StringView on SysFSComponent construction again. Also this could have lead to a UAF bug.
2021-12-09Kernel: Pass capabilities as const reference in PCI::AddressHendiadyoin1
2021-12-09Kernel: Mark PCI::Address as trivially copyableHendiadyoin1
2021-12-05Kernel: Mark kernel smart-pointer classes as [[nodiscard]]Sam Atkins
And cast the unused return values to void.
2021-11-30Kernel: Handle string format errors in PCIDeviceAttributeSysFSComponentBrian Gianforcaro
2021-11-30Kernel: Register Virtio console ports with device managementJelle Raaijmakers
Previously, Virtio console ports would not show up in `/sys/dev/char/`. Also adds support to `SystemServer` to create more than one console port device in `/dev/` in the multiport case.
2021-11-23Kernel: Implement AC97 audio device driverJelle Raaijmakers
2021-11-21Everywhere: Fix spelling of "offsetted"Andreas Kling
This word is actually pretty awkward in context, but this patch merely fixes the spelling instead of finding a better word.
2021-11-18Kernel: Use DistinctNumeric for filesystem ID'sAndreas Kling
This patch adds the FileSystemID type, which is a distinct u32. This prevents accidental conversion from arbitrary integers.
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-10Kernel: Make Inode::traverse_as_directory() callback return ErrorOrAndreas Kling
This allows us to propagate errors from inside the callback with TRY().
2021-11-10Everywhere: Remove unused AK/Bitmap includesBen Wiederhake
2021-11-08Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>Andreas Kling
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
2021-10-23Kernel/PCI: Remove InterruptDisabler usageLiav A
Instead, just ensure we pick the m_access_lock and then m_scan_lock when doing a scan/re-scan of the PCI configuration space so we know nobody can actually access the PCI configuration space during the scan. The m_scan_lock is now a Spinlock, to ensure we cannot yield to other process while we do the PCI configuration space scanning.
2021-10-23Kernel/PCI: Ensure m_domains is not empty if scanning with memory accessLiav A