summaryrefslogtreecommitdiff
path: root/Kernel/Bus
AgeCommit message (Collapse)Author
2021-08-22Kernel: Rename ScopedSpinlock => SpinlockLockerAndreas Kling
This matches MutexLocker, and doesn't sound like it's a lock itself.
2021-08-22Kernel: Rename SpinLock => SpinlockAndreas Kling
2021-08-19Kernel/USB: Remove unused `free` function from QueueHeadJesse Buhagiar
This function is no longer required as the freeing is done inside of the controller class through the pool interface.
2021-08-19Kernel/USB: Harden Descriptor memory allocationJesse Buhagiar
The previous version of this was pretty bad and caused a lot of odd behevaiour to occur. We now abstract a lot of the allocation behind a `template`d pool class that handles all of the memory allocation.
2021-08-19Kernel/USB: Remove unused include from UHCIController.cppJesse Buhagiar
2021-08-19Kernel/USB: Move UHCI related structures to subdirectoryJesse Buhagiar
The number of UHCI related files is starting to expand to the point where it's best if we move this into their own subdirectory. It'll also make it easier to manage when we decide to add some more controller types (whenever that may be)
2021-08-18Kernel: Const defines for PCI IDs for storage controllerspanky-codes
2021-08-17Kernel: Fix compilation with ClangTimothy Flynn
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2021-08-15Kernel/SysFS: Don't compute exact size of PCI filesAndreas Kling
There's no need for generated files in SysFS to tell you their precise file size when you stat() them. I noticed when profiling "find /" that we were spending a chunk of time generating and throwing away SysFS content just so we could tell you exactly how large it would be. :^)
2021-08-15Kernel: Make Kernel::VMObject allocation functions return KResultOrsin-ack
This makes for nicer handling of errors compared to checking whether a RefPtr is null. Additionally, this will give way to return different types of errors in the future.
2021-08-14Kernel/USB: Remove UAF in device removalLuke
I was using a raw pointer instead of a RefPtr to keep the device alive during removal.
2021-08-14Kernel/USB: Update SysFS from the generic hub instead of from UHCILuke
2021-08-14Kernel/USB: Split SysFS code into its own fileLuke
This makes it controller agnostic and allows us to access it from the USB hub code. The copyright says "Liav A." because git blame says he wrote this.
2021-08-14Kernel/USB: Replace PortNumber enum with a raw u8Luke
A hub can technically have up to 255 ports, given that bNbrPorts is a u8 and the DeviceRemovable field is a VLA to support up to 255 ports. Source: USB 2.0 Specification Section 11.23.2.1 That means this enum is not going to scale well in terms of size. Replacing it with a raw u8 allows me to remove the two port assumption and a cast.
2021-08-14Kernel/USB: Remove get_device_{at_port,from_address}Luke
Nothing was using these. These can be put back in the future if required. This also allows removing the devices array in UHCI.
2021-08-14Kernel/USB: Add Hubs and the UHCI Root HubLuke
2021-08-14Kernel/USB: Add the USB 1.x/2.0 hub descriptorLuke
There is a different hub descriptor for USB 3.0, but this isn't included here.
2021-08-14Kernel/USB: Use allocate_kernel_region in Transfer buffer allocationsLuke
Previously it would create a contiguous AVMO manually and pass it to MM. This uses supervisor pages that quickly run out as they never get returned and crash the system. Instead, use allocate_kernel_region as we're only allocating a page so it will be contiguous and will be returned when destroyed. A potentially better solution would be to use a pool of transfers to avoid all the allocations. This just prevents the system from crashing within ~5 seconds from the continuous hub polling.
2021-08-14Kernel/USB: Pass in device address as last argument to Pipe constructorLuke
The order of poll_interval and device_address was flipped.
2021-08-14Kernel/USB: Use "Pipe" instead of "USBPipe" in USBEndpointLuke
This wasn't caught before because nothing was including this header.
2021-08-14Kernel/USB: Add endpoint directions and make endpoint constants publicLuke
2021-08-14Kernel/USB: Add all USB 2.0 bmRequestType fieldsLuke
2021-08-14Kernel/USB: Add header containing all the current USB classesLuke
2021-08-14Kernel/PCI: Assign a PCI address in the SysFS PCI device directoriesLiav A
This is a bug that went unnoticed for a long time, so the exposed values in SysFS PCI device directories were incorrect because the assigned PCI address was simply the host bridge always. Also, the bus typing should really be two hexadecimal digits and not 4 digits.
2021-08-14Kernel: Stop allowing implicit conversion from KResult to intAndreas Kling
This patch removes KResult::operator int() and deals with the fallout. This forces a lot of code to be more explicit in its handling of errors, greatly improving readability.
2021-08-13Kernel: Move VirtIO code into the Bus source folderLiav A
The VirtIO code handles functionality related to the VirtIO bus, so it really should be in the Bus folder.
2021-08-09Kernel/USB: Tighten up USBManagement enumeration code a bitLiav A
2021-08-09Kernel/USB: Create controller base class and introduce USBManagementLuke
This removes Pipes dependency on the UHCIController by introducing a controller base class. This will be used to implement other controllers such as OHCI. Additionally, there can be multiple instances of a UHCI controller. For example, multiple UHCI instances can be required for systems with EHCI controllers. EHCI relies on using multiple of either UHCI or OHCI controllers to drive USB 1.x devices. This means UHCIController can no longer be a singleton. Multiple instances of it can now be created and passed to the device and then to the pipe. To handle finding and creating these instances, USBManagement has been introduced. It has the same pattern as the other management classes such as NetworkManagement.
2021-08-09USB: Fix wrong port read/write in portscan daemonJesse Buhagiar
Port2 logic was errantly using `portsc1` registers, meaning that the port wouldn't be reset properly. In effect, this puts devices connected to Port2 in an undefined state.
2021-08-07Kernel: Move SpinLock.h into Locking/Jean-Baptiste Boric
2021-08-06Kernel: Add convenience values to the Memory::Region::Access enumAndreas Kling
Instead of `Memory::Region::Access::Read | Memory::Region::AccessWrite` you can now say `Memory::Region::Access::ReadWrite`.
2021-08-06Kernel: Move Kernel/Memory/ code into Kernel::Memory namespaceAndreas Kling
2021-08-06Kernel: Rename Kernel/VM/ to Kernel/Memory/Andreas Kling
This directory isn't just about virtual memory, it's about all kinds of memory management.
2021-08-06Kernel: Remove unused PCI::Access::access_type()Andreas Kling
2021-07-25Kernel: Remove ContiguousVMObject, let AnonymousVMObject do the jobAndreas Kling
We don't need an entirely separate VMObject subclass to influence the location of the physical pages. Instead, we simply allocate enough physically contiguous memory first, and then pass it to the AnonymousVMObject constructor that takes a span of physical pages.
2021-07-22Everywhere: Prefer using {:#x} over 0x{:x}Gunnar Beutner
We have a dedicated format specifier which adds the "0x" prefix, so let's use that instead of adding it manually.
2021-07-22Everywhere: Prefix hexadecimal numbers with 0xGunnar Beutner
Depending on the values it might be difficult to figure out whether a value is decimal or hexadecimal. So let's make this more obvious. Also this allows copying and pasting those numbers into GNOME calculator and probably also other apps which auto-detect the base.
2021-07-18Kernel/USB: Remove unneeded friend declaration in SysFSUSBBusDirectoryAndreas Kling
2021-07-18Kernel/USB: Move USB bus information from /proc to /sysAndreas Kling
This patch moves all the USB data from /proc/bus/usb to /sys/bus/usb.
2021-07-17Kernel/ProcFS: Remove unused ProcFSExposedComponent::entries_count()Andreas Kling
2021-07-17Kernel: Replace "folder" => "directory" everywhereAndreas Kling
Folders are a GUI concept. File systems have directories.
2021-07-17Kernel: Convert the PhysicalPage bool parameter to an enumBrian Gianforcaro
2021-07-14AK: Generalize ByteReaderHendiadyoin1
Also use it instead of CPU.h's possibly_unaligned_data interface
2021-07-12Kernel: Remove "supervisor" bit from PhysicalPageAndreas Kling
Instead of each PhysicalPage knowing whether it comes from the supervisor pages or from the user pages, we can just check in both sets when freeing a page. It's just a handful of pointer range checks, nothing expensive.
2021-07-11Kernel: Remove unused header includes in Bus subtreeBrian Gianforcaro
2021-07-11Kernel: Rename various *VMObject::create*() => try_create()Andreas Kling
try_*() implies that it can fail (and they all return RefPtr with nullptr signalling failure.)
2021-07-11Kernel: Make various T::class_name() and similar return StringViewAndreas Kling
Instead of returning char const*, we can also give you a StringView.
2021-07-11Kernel: Rename ProcFSComponentsRegistrar => ProcFSComponentRegistryAndreas Kling
This matches the formatting used in SysFS.
2021-07-11Kernel: Replace "Folder" => "Directory" everywhereAndreas Kling
Folders are a GUI concept, file systems have directories. :^)
2021-07-11Kernel: Rename SysFS related classes in PCI codeAndreas Kling
Give them names that sound related to SysFS.