mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Move AHCI driver into separate drivers/ directory
This commit is contained in:
@@ -3,16 +3,20 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
|
|
||||||
|
namespace ahci {
|
||||||
|
|
||||||
ahci_driver::ahci_driver()
|
|
||||||
|
driver::driver()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ahci_driver::register_device(pci_device *device)
|
driver::register_device(pci_device *device)
|
||||||
{
|
{
|
||||||
log::info(logs::driver, "AHCI registering device %d:%d:%d:",
|
log::info(logs::driver, "AHCI registering device %d:%d:%d:",
|
||||||
device->bus(), device->device(), device->function());
|
device->bus(), device->device(), device->function());
|
||||||
|
|
||||||
ahci::hba &hba = m_devices.emplace(device);
|
ahci::hba &hba = m_devices.emplace(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
@@ -6,13 +6,15 @@
|
|||||||
|
|
||||||
class pci_device;
|
class pci_device;
|
||||||
|
|
||||||
|
namespace ahci {
|
||||||
|
|
||||||
|
|
||||||
/// Basic AHCI driver
|
/// Basic AHCI driver
|
||||||
class ahci_driver
|
class driver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Constructor.
|
/// Constructor.
|
||||||
ahci_driver();
|
driver();
|
||||||
|
|
||||||
/// Register a device with the driver
|
/// Register a device with the driver
|
||||||
/// \arg device The PCI device to handle
|
/// \arg device The PCI device to handle
|
||||||
@@ -26,3 +28,4 @@ private:
|
|||||||
kutil::vector<ahci::hba> m_devices;
|
kutil::vector<ahci::hba> m_devices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "ahci/driver.h"
|
||||||
#include "kutil/assert.h"
|
#include "kutil/assert.h"
|
||||||
#include "kutil/memory.h"
|
#include "kutil/memory.h"
|
||||||
#include "acpi_tables.h"
|
#include "acpi_tables.h"
|
||||||
#include "ahci/driver.h"
|
|
||||||
#include "apic.h"
|
#include "apic.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "device_manager.h"
|
#include "device_manager.h"
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
static const char expected_signature[] = "RSD PTR ";
|
static const char expected_signature[] = "RSD PTR ";
|
||||||
|
|
||||||
device_manager device_manager::s_instance(nullptr);
|
device_manager device_manager::s_instance(nullptr);
|
||||||
ahci_driver ahcid;
|
|
||||||
|
|
||||||
struct acpi1_rsdp
|
struct acpi1_rsdp
|
||||||
{
|
{
|
||||||
@@ -292,6 +291,7 @@ device_manager::init_drivers()
|
|||||||
{
|
{
|
||||||
// Eventually this should be e.g. a lookup into a loadable driver list
|
// Eventually this should be e.g. a lookup into a loadable driver list
|
||||||
// for now, just look for AHCI devices
|
// for now, just look for AHCI devices
|
||||||
|
/*
|
||||||
for (auto &device : m_devices) {
|
for (auto &device : m_devices) {
|
||||||
if (device.devclass() != 1 || device.subclass() != 6)
|
if (device.devclass() != 1 || device.subclass() != 6)
|
||||||
continue;
|
continue;
|
||||||
@@ -303,6 +303,7 @@ device_manager::init_drivers()
|
|||||||
|
|
||||||
ahcid.register_device(&device);
|
ahcid.register_device(&device);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
14
wscript
14
wscript
@@ -66,6 +66,7 @@ def configure(ctx):
|
|||||||
join(ctx.path.abspath(), "src", "include"),
|
join(ctx.path.abspath(), "src", "include"),
|
||||||
join(ctx.path.abspath(), "src", "include", ctx.env.POPCORN_ARCH),
|
join(ctx.path.abspath(), "src", "include", ctx.env.POPCORN_ARCH),
|
||||||
join(ctx.path.abspath(), "src", "libraries"),
|
join(ctx.path.abspath(), "src", "libraries"),
|
||||||
|
join(ctx.path.abspath(), "src", "drivers"),
|
||||||
])
|
])
|
||||||
|
|
||||||
libraries = []
|
libraries = []
|
||||||
@@ -75,6 +76,13 @@ def configure(ctx):
|
|||||||
if exists(join(mod_path, "wscript")):
|
if exists(join(mod_path, "wscript")):
|
||||||
libraries.append(mod_path)
|
libraries.append(mod_path)
|
||||||
|
|
||||||
|
drivers = []
|
||||||
|
mod_root = join("src", "drivers")
|
||||||
|
for module in os.listdir(mod_root):
|
||||||
|
mod_path = join(mod_root, module)
|
||||||
|
if exists(join(mod_path, "wscript")):
|
||||||
|
drivers.append(mod_path)
|
||||||
|
|
||||||
baseflags = [
|
baseflags = [
|
||||||
'-nostdlib',
|
'-nostdlib',
|
||||||
'-ffreestanding',
|
'-ffreestanding',
|
||||||
@@ -168,6 +176,10 @@ def configure(ctx):
|
|||||||
for mod_path in ctx.env.LIBRARIES:
|
for mod_path in ctx.env.LIBRARIES:
|
||||||
ctx.recurse(mod_path)
|
ctx.recurse(mod_path)
|
||||||
|
|
||||||
|
ctx.env.DRIVERS = drivers
|
||||||
|
for mod_path in ctx.env.DRIVERS:
|
||||||
|
ctx.recurse(mod_path)
|
||||||
|
|
||||||
ctx.recurse(join("src", "kernel"))
|
ctx.recurse(join("src", "kernel"))
|
||||||
|
|
||||||
## Testing configuration
|
## Testing configuration
|
||||||
@@ -200,6 +212,8 @@ def build(bld):
|
|||||||
bld.env = bld.all_envs['kernel']
|
bld.env = bld.all_envs['kernel']
|
||||||
for mod_path in bld.env.LIBRARIES:
|
for mod_path in bld.env.LIBRARIES:
|
||||||
bld.recurse(mod_path)
|
bld.recurse(mod_path)
|
||||||
|
for mod_path in bld.env.DRIVERS:
|
||||||
|
bld.recurse(mod_path)
|
||||||
|
|
||||||
bld.recurse(join("src", "kernel"))
|
bld.recurse(join("src", "kernel"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user