summaryrefslogtreecommitdiff
path: root/Kernel/PCI
AgeCommit message (Collapse)Author
2020-12-31Everywhere: Re-format with clang-format-11Linus Groh
Compared to version 10 this fixes a bunch of formatting issues, mostly around structs/classes with attributes like [[gnu::packed]], and incorrect insertion of spaces in parameter types ("T &"/"T &&"). I also removed a bunch of // clang-format off/on and FIXME comments that are no longer relevant - on the other hand it tried to destroy a couple of neatly formatted comments, so I had to add some as well.
2020-12-25AK: Remove custom %w format string specifierAndreas Kling
This was a non-standard specifier alias for %04x. This patch replaces all uses of it with new-style formatting functions instead.
2020-12-25AK: Remove custom %b format string specifierAndreas Kling
This was a non-standard specifier alias for %02x. This patch replaces all uses of it with new-style formatting functions instead.
2020-12-22Kernel/PCI: Add a bunch of debug output to accessorsLuke
This was useful for debugging this issue.
2020-12-22Kernel/PCI: Create device configuration space mapping before creating a ↵Luke
physical ID When enumerating the hardware using MMIO mode, it would attempt to create a physical ID first. To create a physical ID, it needs to retrieve the capabilities of the device. When enumerating the first device, there would be no device configuration space mappings. Access::get_capabilities_pointer calls PCI::read16, which in turn goes to MMIOAccess::read16_field. MMIOAccess::read16_field attempts to get a device configuration space and fully expects to get one. However, since this is the first device, there are none and it crashes with an m_has_value assertion failure. This fixes this by creating the device configuration space mapping before creating the physical ID. Testing with VMware Player 16.1.0.
2020-12-21Kernel: Add various methods to handle interrupts in the PCI subsystemLiav A
For now, we only are able to enable or disable pin based interrupts. Later, when implemented, we could utilize MSI & MSI-X interrupts.
2020-12-21Kernel: Add a method to retrieve the Physical ID for a PCI addressLiav A
2020-12-21PCI: Add list of capabilities for each device during first enumerationLiav A
2020-12-21Kernel: Add the DeviceController class in the PCI subsystemLiav A
Such device is not an IRQHandler by itself, but actually a controller of many IRQ or MSI devices. The purpose of this class is to manage multiple sources of interrupts. For example, a generic ISA IDE controller controls 2 IRQ sources - 14 and 15. So, when we initialize the IDE controller, it will initialize two IDE channels (also known as PATAChannels) to utilize IRQ 14 and 15, respectively. NVMe with MSI-X support can theoretically handle up to 2048 interrupts.
2020-11-01Kernel: Reduce code duplication in the PCI IO access read helpersLiav A
We just call the early helpers as they do the same thing like the IO access helpers.
2020-11-01Kernel: Map PCI devices only once during bootLiav A
Instead of mapping a 4KB region to access device configuration space each time we call one of the PCI helpers, just map them once during the boot process. Then, if we request to access one of those devices, we can ask the PCI subsystem to give us the virtual address where the device's configuration space is mapped.
2020-09-25Meta+Kernel: Make clang-format-10 cleanBen Wiederhake
2020-09-03Kernel: Add PCI::get_programming_interface(PCI::Address)Andreas Kling
This returns the programming interface at a given PCI address. This is sometimes referred to as "prog-if" on other systems.
2020-08-22Kernel: Prevent confusing silent misuse of PCI::AddressBen Wiederhake
2020-07-06Kernel: Add SMP IPI supportTom
We can now properly initialize all processors without crashing by sending SMP IPI messages to synchronize memory between processors. We now initialize the APs once we have the scheduler running. This is so that we can process IPI messages from the other cores. Also rework interrupt handling a bit so that it's more of a 1:1 mapping. We need to allocate non-sharable interrupts for IPIs. This also fixes the occasional hang/crash because all CPUs now synchronize memory with each other.
2020-05-29Meta: Add a script check the presence of "#pragma once" in header filesEmanuele Torre
.. and make travis run it. I renamed check-license-headers.sh to check-style.sh and expanded it so that it now also checks for the presence of "#pragma once" in .h files. It also checks the presence of a (single) blank line above and below the "#pragma once" line. I also added "#pragma once" to all the files that need it: even the ones we are not check. I also added/removed blank lines in order to make the script not fail. I also ran clang-format on the files I modified.
2020-05-16Kernel: Absorb LibBareMetal back into the kernelAndreas Kling
This was supposed to be the foundation for some kind of pre-kernel environment, but nobody is working on it right now, so let's move everything back into the kernel and remove all the confusion.
2020-04-28Kernel: Add Region helpers for accessing underlying physical pagesAndreas Kling
Since a Region is basically a view into a potentially larger VMObject, it was always necessary to include the Region starting offset when accessing its underlying physical pages. Until now, you had to do that manually, but this patch adds a simple Region::physical_page() for read-only access and a physical_page_slot() when you want a mutable reference to the RefPtr<PhysicalPage> itself. A lot of code is simplified by making use of this.
2020-04-11Kernel: Instantiate network adapters in their own detect() methodsLiav A
This commit is one step forward for pluggable driver modules. Instead of creating instances of network adapter classes, we let their detect() methods to figure out if there are existing devices to initialize.
2020-04-11Kernel: Keep records of PCI::Address & PCI::ID pairs for enumerationLiav A
2020-04-09Kernel: Simplify PCI messages on initializationLiav A
2020-04-09Kernel: Remove redundant "ACPI" from filenames in ACPI/Andreas Kling
2020-04-09Kernel: Remove "non-operational" ACPI parser stateAndreas Kling
If we don't support ACPI, just don't instantiate an ACPI parser. This is way less confusing than having a special parser class whose only purpose is to do nothing. We now search for the RSDP in ACPI::initialize() instead of letting the parser constructor do it. This allows us to defer the decision to create a parser until we're sure we can make a useful one.
2020-04-09Kernel: Simplify PCI::initialize() a bit moreAndreas Kling
2020-04-08Kernel: Simplify PCI::initialize()Andreas Kling
Choosing between I/O and MMIO is not as difficult as we were making it.
2020-04-08Kernel: Fix typos in PCI access boot messageAndreas Kling
2020-04-08Kernel: Simplify PCI initialization logicAndreas Kling
- Get rid of the PCI::Initializer object which was not serving any real purpose or holding any data members. - Move command line parsing from init to PCI::initialize().
2020-04-08Kernel: Use nested Kernel::PCI namespaces more to reduce PCI:: spamAndreas Kling
2020-04-08Kernel: Make most of the PCI::MMIOAccess members privateAndreas Kling
This class is really meant to be used via a base class pointer.
2020-04-08Kernel: Simplify PCI::MMIOAccess segment storageAndreas Kling
Instead of nesting a bunch of heap allocations, just store them in a simple HashMap<u16, MMIOSegment>. Also fix a bunch of double hash lookups like this: ASSERT(map.contains(key)); auto thing = map.get(key).value(); They now look like this instead: auto thing = map.get(key); ASSERT(thing.has_value());
2020-04-08Kernel: Move PCI::MMIOSegment declaration into MMIOAccess.cppAndreas Kling
This is only used inside PCI::MMIOAccess, no need to expose it.
2020-04-08Kernel: Fix up various PCI-related function signaturesAndreas Kling
- Make things const when they don't need to be non-const. - Don't return AK::String when it's always a string literal anyway. - Remove excessive get_ prefixes per coding style.
2020-04-08Kernel: Add some human-readable I/O helpers in PCI/Access.cppAndreas Kling
2020-04-08Kernel: Remove an unnecessary layer of indirection in the PCI codeAndreas Kling
The PCI access layer was composed of a bunch of virtual functions that did nothing but call other virtual functions. The first layer was never overridden so there was no need for them to be virtual. This patch removes the indirection and moves logic from PCI::Access down into the various PCI::get_foo() helpers that were the sole users.
2020-04-08Kernel: Rename KParams => Kernel::CommandLineAndreas Kling
Let's make this read more like English.
2020-03-23AK: Reduce header dependency graph of String.hAndreas Kling
String.h no longer pulls in StringView.h. We do this by moving a bunch of String functions out-of-line.
2020-03-22Kernel: Run clang-format on filesShannon Booth
Let's rip off the band-aid
2020-03-09Kernel: Allow to reboot in ACPI via PCI or MMIO accessLiav A
Also, we determine if ACPI reboot is supported by checking the FADT flags' field.
2020-03-09PCI: Enable LogStream output for addressesLiav A
2020-03-09LibBareMetal: Return FlatPtr from PhysicalAddress::offset_in_page()Liav A
2020-03-06Meta: Claim copyright on `PCI` filesLiav A
2020-03-06Kernel: Simplify a bunch of dbg() and klog() callsAndreas Kling
LogStream can handle VirtualAddress and PhysicalAddress directly.
2020-03-02Kernel: Use klog() instead of kprintf()Liav A
Also, duplicate data in dbg() and klog() calls were removed. In addition, leakage of virtual address to kernel log is prevented. This is done by replacing kprintf() calls to dbg() calls with the leaked data instead. Also, other kprintf() calls were replaced with klog().
2020-02-29PCI: Adopt changes in ACPI definitions fileLiav A
2020-02-27Kernel: Run clang-format on PCI definitions fileLiav A
2020-02-27PCI MMIOAccess: Use dbg() instead of dbgprintf()Liav A
2020-02-24Kernel: Don't use references or pointers to physical addressesLiav A
Now the ACPI & PCI code is more safer, because we don't use raw pointers or references to objects or data that are located in the physical address space, so an accidental dereference cannot happen easily. Instead, we use the PhysicalAddress class to represent those addresses.
2020-02-24Kernel: Change get_pci_address() to pci_address() in PCI::Device classLiav A
The Serenity Coding Style tends to not accept the word "get" in methods' names if possible.
2020-02-24Kernel: Update PCI::Device class to use the new IRQHandler classLiav A
2020-02-24Kernel: Add PCI helpers to enable and disable the interrupt lineLiav A