Retrieve ROMs in the common case by full store path. This reduces the need for route policies for driving relative requests into absolute package paths. Making library requests by absolute path required libraries to be stored in the core image as such, and it follows that program binaries should be handled in the same way. This makes requests to core and to a file-system store more consistent, and makes dependency detection more robust.
66 lines
1.9 KiB
Nix
66 lines
1.9 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
options.hardware.genode.ahci = {
|
|
enable = lib.mkEnableOption "AHCI (SATA) block driver";
|
|
};
|
|
|
|
config = let cfg = config.hardware.genode.ahci;
|
|
in {
|
|
|
|
hardware.genode.platform.policies = lib.optional cfg.enable
|
|
(builtins.toFile ("ahci.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" } }
|
|
]
|
|
}
|
|
'');
|
|
|
|
genode.core.children.ahci_drv = lib.mkIf cfg.enable {
|
|
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 = "${pkgs.genodePackages.ahci_drv}/bin/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::{
|
|
, policies =
|
|
[ Init.Config.Policy::{
|
|
, service = "Block"
|
|
, label = Init.LabelSelector.prefix "part_block"
|
|
, attributes = toMap { device = "${
|
|
toString config.fileSystems."/".block.device
|
|
}", writeable = "yes" }
|
|
}
|
|
]
|
|
}
|
|
}
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
}
|