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