1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

Kernel: Move all code into the Kernel namespace

This commit is contained in:
Andreas Kling 2020-02-16 01:27:42 +01:00
parent d42f0f4661
commit a356e48150
201 changed files with 907 additions and 111 deletions

View file

@ -27,6 +27,8 @@
#include <Kernel/PCI/Access.h>
#include <Kernel/PCI/IOAccess.h>
namespace Kernel {
static PCI::Access* s_access;
PCI::Access& PCI::Access::the()
@ -175,4 +177,7 @@ size_t get_BAR_Space_Size(Address address, u8 bar_number)
{
return PCI::Access::the().get_BAR_Space_Size(address, bar_number);
}
}
}

View file

@ -29,6 +29,8 @@
#include <AK/String.h>
#include <Kernel/PCI/Definitions.h>
namespace Kernel {
class PCI::Access {
public:
virtual void enumerate_all(Function<void(Address, ID)>&) = 0;
@ -86,3 +88,5 @@ protected:
virtual void write16_field(Address address, u32 field, u16 value) = 0;
virtual void write32_field(Address address, u32 field, u32 value) = 0;
};
}

View file

@ -29,6 +29,9 @@
#include <AK/Function.h>
#include <AK/Types.h>
namespace Kernel {
#define PCI_VENDOR_ID 0x00 // word
#define PCI_DEVICE_ID 0x02 // word
#define PCI_COMMAND 0x04 // word
@ -186,3 +189,5 @@ class MMIOSegment;
class Device;
}
}

View file

@ -27,6 +27,8 @@
#include <Kernel/PCI/IOAccess.h>
#include <LibBareMetal/IO.h>
namespace Kernel {
void PCI::IOAccess::initialize()
{
if (!PCI::Access::is_initialized())
@ -87,3 +89,5 @@ void PCI::IOAccess::enumerate_all(Function<void(Address, ID)>& callback)
enumerate_bus(-1, function, callback);
}
}
}

View file

@ -27,6 +27,8 @@
#pragma once
#include <Kernel/PCI/Access.h>
namespace Kernel {
class PCI::IOAccess final : public PCI::Access {
public:
static void initialize();
@ -34,6 +36,7 @@ public:
virtual String get_access_type() override final { return "IO-Access"; };
virtual uint32_t get_segments_count() { return 1; };
protected:
IOAccess();
@ -44,7 +47,10 @@ private:
virtual void write8_field(Address address, u32, u8) override final;
virtual void write16_field(Address address, u32, u16) override final;
virtual void write32_field(Address address, u32, u32) override final;
virtual uint8_t get_segment_start_bus(u32) { return 0x0; };
virtual uint8_t get_segment_end_bus(u32) { return 0xFF; };
};
};
}

View file

@ -33,6 +33,8 @@
#include <Kernel/PCI/MMIOAccess.h>
#include <LibBareMetal/IO.h>
namespace Kernel {
static PCI::Initializer* s_pci_initializer;
PCI::Initializer& PCI::Initializer::the()
@ -150,3 +152,5 @@ void PCI::Initializer::dismiss()
PCI::Initializer::~Initializer()
{
}
}

View file

@ -30,6 +30,8 @@
#include <Kernel/ACPI/Definitions.h>
#include <Kernel/PCI/Definitions.h>
namespace Kernel {
class PCI::Initializer {
public:
static PCI::Initializer& the();
@ -47,3 +49,5 @@ private:
bool test_pci_mmio();
void initialize_pci_mmio_access_after_test();
};
}

View file

@ -28,6 +28,8 @@
#include <Kernel/PCI/MMIOAccess.h>
#include <Kernel/VM/MemoryManager.h>
namespace Kernel {
#define PCI_MMIO_CONFIG_SPACE_SIZE 4096
uint32_t PCI::MMIOAccess::get_segments_count()
@ -227,3 +229,5 @@ PhysicalAddress PCI::MMIOSegment::get_paddr()
{
return m_base_addr;
}
}

View file

@ -35,6 +35,8 @@
#include <Kernel/VM/Region.h>
#include <Kernel/VM/VMObject.h>
namespace Kernel {
class PCI::MMIOAccess final : public PCI::Access {
public:
static void initialize(ACPI_RAW::MCFG&);
@ -42,6 +44,7 @@ public:
virtual String get_access_type() override final { return "MMIO-Access"; };
virtual u32 get_segments_count();
protected:
explicit MMIOAccess(ACPI_RAW::MCFG&);
@ -75,4 +78,6 @@ private:
PhysicalAddress m_base_addr;
u8 m_start_bus;
u8 m_end_bus;
};
};
}