Commit Graph

40 Commits

Author SHA1 Message Date
Luke
7dd1786b13 Kernel/USB: Use "Pipe" instead of "USBPipe" in USBEndpoint
This wasn't caught before because nothing was including this header.
2021-08-14 21:22:44 +02:00
Luke
035aef9c09 Kernel/USB: Add endpoint directions and make endpoint constants public 2021-08-14 21:22:44 +02:00
Luke
3b4f71e4df Kernel/USB: Add all USB 2.0 bmRequestType fields 2021-08-14 21:22:44 +02:00
Luke
5578a5a32d Kernel/USB: Add header containing all the current USB classes 2021-08-14 21:22:44 +02:00
Liav A
0847ad9ca0 Kernel/PCI: Assign a PCI address in the SysFS PCI device directories
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-14 17:47:42 +02:00
Andreas Kling
7676edfb9b Kernel: Stop allowing implicit conversion from KResult to int
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-14 15:19:00 +02:00
Liav A
18eb262157 Kernel: Move VirtIO code into the Bus source folder
The VirtIO code handles functionality related to the VirtIO bus, so it
really should be in the Bus folder.
2021-08-13 08:06:47 +02:00
Liav A
d16d116b65 Kernel/USB: Tighten up USBManagement enumeration code a bit 2021-08-09 22:52:09 +02:00
Luke
7a86a8df90 Kernel/USB: Create controller base class and introduce USBManagement
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-09 21:05:25 +02:00
Jesse Buhagiar
c5974d3518 USB: Fix wrong port read/write in portscan daemon
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-09 21:04:55 +02:00
Jean-Baptiste Boric
2c3b0baf76 Kernel: Move SpinLock.h into Locking/ 2021-08-07 11:48:00 +02:00
Andreas Kling
2cd8b21974 Kernel: Add convenience values to the Memory::Region::Access enum
Instead of `Memory::Region::Access::Read | Memory::Region::AccessWrite`
you can now say `Memory::Region::Access::ReadWrite`.
2021-08-06 22:25:00 +02:00
Andreas Kling
93d98d4976 Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
Andreas Kling
a1d7ebf85a Kernel: Rename Kernel/VM/ to Kernel/Memory/
This directory isn't just about virtual memory, it's about all kinds
of memory management.
2021-08-06 14:05:58 +02:00
Andreas Kling
beeed90a3f Kernel: Remove unused PCI::Access::access_type() 2021-08-06 00:37:47 +02:00
Andreas Kling
6a537ceef1 Kernel: Remove ContiguousVMObject, let AnonymousVMObject do the job
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-25 18:44:47 +02:00
Gunnar Beutner
36e36507d5 Everywhere: Prefer using {:#x} over 0x{:x}
We have a dedicated format specifier which adds the "0x" prefix, so
let's use that instead of adding it manually.
2021-07-22 08:57:01 +02:00
Gunnar Beutner
31f30e732a Everywhere: Prefix hexadecimal numbers with 0x
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-22 08:57:01 +02:00
Andreas Kling
ab50a1480f Kernel/USB: Remove unneeded friend declaration in SysFSUSBBusDirectory 2021-07-18 01:53:04 +02:00
Andreas Kling
b975a74a1d Kernel/USB: Move USB bus information from /proc to /sys
This patch moves all the USB data from /proc/bus/usb to /sys/bus/usb.
2021-07-18 00:55:16 +02:00
Andreas Kling
6fae2a5f9e Kernel/ProcFS: Remove unused ProcFSExposedComponent::entries_count() 2021-07-17 23:50:01 +02:00
Andreas Kling
2da0581fd2 Kernel: Replace "folder" => "directory" everywhere
Folders are a GUI concept. File systems have directories.
2021-07-17 23:50:00 +02:00
Brian Gianforcaro
d879709ec7 Kernel: Convert the PhysicalPage bool parameter to an enum 2021-07-17 18:38:28 +04:30
Hendiadyoin1
d761c5024b AK: Generalize ByteReader
Also use it instead of CPU.h's possibly_unaligned_data interface
2021-07-14 11:26:34 +04:30
Andreas Kling
c2792212f4 Kernel: Remove "supervisor" bit from PhysicalPage
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-12 11:09:42 +02:00
Brian Gianforcaro
28cf9ffe90 Kernel: Remove unused header includes in Bus subtree 2021-07-11 21:37:38 +02:00
Andreas Kling
88d490566f Kernel: Rename various *VMObject::create*() => try_create()
try_*() implies that it can fail (and they all return RefPtr with
nullptr signalling failure.)
2021-07-11 17:55:29 +02:00
Andreas Kling
c9f6786e8b Kernel: Make various T::class_name() and similar return StringView
Instead of returning char const*, we can also give you a StringView.
2021-07-11 01:46:59 +02:00
Andreas Kling
fa9111ac46 Kernel: Rename ProcFSComponentsRegistrar => ProcFSComponentRegistry
This matches the formatting used in SysFS.
2021-07-11 01:40:26 +02:00
Andreas Kling
805319ed30 Kernel: Replace "Folder" => "Directory" everywhere
Folders are a GUI concept, file systems have directories. :^)
2021-07-11 01:33:40 +02:00
Andreas Kling
5ec3f5433e Kernel: Rename SysFS related classes in PCI code
Give them names that sound related to SysFS.
2021-07-11 01:31:48 +02:00
Andreas Kling
60a7a9d523 Kernel: Rename SystemExposedFolder => SysFSDirectory
"Folder" is a GUI concept, let's call this "Directory".
Also, "System" is completely generic, so let's be more specific and
call this "SysFS..."
2021-07-11 01:07:27 +02:00
Andreas Kling
517170a986 Kernel: Rename SystemExposedComponent => SysFSComponent 2021-07-11 01:06:27 +02:00
Andreas Kling
27244eb0ee Kernel: Rename SystemRegistrar => SysFSComponentRegistry 2021-07-11 01:05:26 +02:00
Andreas Kling
d53d9d3677 Kernel: Rename FS => FileSystem
This matches our common naming style better.
2021-07-11 00:20:38 +02:00
Daniel Bertalan
949ea9cb4a Kernel: Use range-for wherever possible 2021-07-08 10:11:00 +02:00
Liav A
3fae7ca113 Kernel: Clarify and make it easy to not use raw numbers
Let's put the PCI IDs as enums in the PCI namespace so they're free to
pollute that namespace, but it's also more easier to use them.
2021-07-03 16:28:49 +02:00
Liav A
3344f91fc4 Kernel/ProcFS: Clean dead processes properly
Now we use WeakPtrs to break Ref-counting cycle. Also, we call the
prepare_for_deletion method to ensure deleted objects are ready for
deletion. This is necessary to ensure we don't keep dead processes,
which would become zombies.

In addition to that, add some debug prints to aid debug in the future.
2021-07-02 13:16:12 +02:00
Liav A
5073bf8e75 Kernel/USB: Move the USB components as a subfolder to the Bus directory 2021-07-02 13:16:12 +02:00
Liav A
6568bb47cb Kernel/PCI: Move the PCI components as a subfolder to the Bus directory 2021-07-02 13:16:12 +02:00