2
0
Fork 0

WiP! AHCI driver

This commit is contained in:
Ehmry - 2020-12-29 10:28:00 +01:00
parent 5d4fee3bf2
commit 1ff7865d6c
1 changed files with 57 additions and 9 deletions

View File

@ -36,6 +36,16 @@ with lib;
hardware.genode = {
ahci.enable = lib.mkEnableOption "AHCI (SATA) block driver";
framebuffer = {
enable = lib.mkEnableOption "framebuffer driver";
driver = mkOption {
type = types.enum [ "boot" "vesa" ];
default = "vesa";
};
};
usb = {
enable = lib.mkEnableOption "USB driver";
@ -48,14 +58,6 @@ with lib;
};
framebuffer = {
enable = lib.mkEnableOption "framebuffer driver";
driver = mkOption {
type = types.enum [ "boot" "vesa" ];
default = "vesa";
};
};
};
};
@ -115,7 +117,19 @@ with lib;
]
}
'') (builtins.attrNames config.networking.interfaces)
++ lib.optional config.hardware.genode.framebuffer.enable
++ lib.optional config.hardware.genode.ahci.enable
(builtins.toFile ("framebuffer.platform-policy.dhall") ''
let Genode = env:DHALL_GENODE
in Genode.Init.Config.Policy::{
, service = "Platform"
, label = Genode.Init.LabelSelector.prefix "ahci_drv"
, content =
[ Genode.Prelude.XML.leaf
{ name = "pci", attributes = toMap { class = "AHCI" } }
]
}
'') ++ lib.optional config.hardware.genode.framebuffer.enable
(builtins.toFile ("framebuffer.platform-policy.dhall") ''
let Genode = env:DHALL_GENODE
@ -280,6 +294,40 @@ with lib;
in lib.filterAttrs (n: v: v != null) (nics // sockets);
genode.core.children.ahci_drv = {
inputs = [ pkgs.genodePackages.ahci_drv ];
configFile = pkgs.writeText "ahci_drv.dhall" ''
let Genode = env:DHALL_GENODE
let Init = Genode.Init
in Init.Child.flat
Init.Child.Attributes::{
, binary = "ahci_drv"
, resources = Init.Resources::{
, caps = 400
, ram = Genode.units.MiB 10
, constrainPhys = True
}
, romReports = [ { local = "ports", route = "ahci_ports" } ]
, routes =
[ Init.ServiceRoute.parent "IRQ"
, Init.ServiceRoute.parent "IO_MEM"
, Init.ServiceRoute.parent "IO_PORT"
]
, config = Init.Config::{
, polices =
[ Init.Config.Policy::{
, service = "Block"
, label = Init.LabelSelector.prefix "part_block"
, attributes = toMap { device = "0", writeable = "yes" }
}
]
}
}
'';
};
genode.core.children.acpi_drv = {
inputs = [ pkgs.genodePackages.acpi_drv ];
configFile = pkgs.writeText "acpi_drv.dhall" ''