summaryrefslogtreecommitdiff
path: root/Kernel/PCI
AgeCommit message (Collapse)Author
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
2020-02-16Kernel: Move all code into the Kernel namespaceAndreas Kling
2020-02-09Kernel: Apply changes to use LibBareMetal definitionsLiav A
2020-02-02Kernel: Detect devices when enumerating the PCI busLiav A
Instead of making each driver to enumerate the PCI bus itself, PCI::Initializer will call detect_devices() to do one enumeration of the bus.
2020-01-22Kernel: Introduce IRQ sharing supportLiav A
The support is very basic - Each component that needs to handle IRQs inherits from InterruptHandler class. When the InterruptHandler constructor is called it registers itself in a SharedInterruptHandler. When an IRQ is fired, the SharedInterruptHandler is invoked, then it iterates through a list of the registered InterruptHandlers. Also, InterruptEnabler class was created to provide a way to enable IRQ handling temporarily, similar to InterruptDisabler (in CPU.h, which does the opposite). In addition to that a PCI::Device class has been added, that inherits from InterruptHandler.
2020-01-21Kernel: PCI MMIO no longer uses map_for_kernel()Liav A
PCI MMIO access is done by modifying the related PhysicalPage directly, then we request to remap the region to create the mapping.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-14Kernel: Move DMI decoder initialization method to init_stage2Liav A
Also, PCI Initializer dismiss() now deletes the object correctly, and the PCI initialization process no longer use the DMI decoder to determine if PCI is supported. grub configuration files include an entry to boot the OS without ACPI support.
2020-01-14Kernel: Remove problematic memory mapping methodsLiav A
mmap() & mmap_region() methods are removed from ACPI & DMI components, and we replace them with the new MM.allocate_kernel_region() helper. Instead of doing a raw calculation for each VM address, from now on we can use helper functions to do perform those calculations in a neat, reusable and readable way.
2020-01-02Kernel: Fixing PCI MMIO access mechanismLiav A
During initialization of PCI MMIO access mechanism we ensure that we have an allocation from the kernel virtual address space that cannot be taken by other components in the OS. Also, now we ensure that interrupts are disabled so mapping the region doesn't fail. In order to reduce overhead, map_device() will map the requested PCI address only if it's not mapped already. The run script has been changed so now we can boot a Q35 machine, that supports PCI ECAM. To ensure we will be able to load the machine, a PIIX3 IDE controller was added to the Q35 machine configuration in the run script. An AHCI controller was added to the i440fx machine configuration.
2020-01-02Kernel: Create support for PCI ECAMLiav A
The new PCI subsystem is initialized during runtime. PCI::Initializer is supposed to be called during early boot, to perform a few tests, and initialize the proper configuration space access mechanism. Kernel boot parameters can be specified by a user to determine what tests will occur, to aid debugging on problematic machines. After that, PCI::Initializer should be dismissed. PCI::IOAccess is a class that is derived from PCI::Access class and implements PCI configuration space access mechanism via x86 IO ports. PCI::MMIOAccess is a class that is derived from PCI::Access and implements PCI configurtaion space access mechanism via memory access. The new PCI subsystem also supports determination of IO/MMIO space needed by a device by checking a given BAR. In addition, Every device or component that use the PCI subsystem has changed to match the last changes.