86 lines
2.3 KiB
Nix
86 lines
2.3 KiB
Nix
|
{ config, pkgs, lib, ... }:
|
||
|
|
||
|
with lib;
|
||
|
|
||
|
{
|
||
|
imports = [ ./nic.nix ./usb.nix ];
|
||
|
|
||
|
options.hardware.genode.platform.policies = lib.mkOption {
|
||
|
type = with types; listOf path;
|
||
|
default = [ ];
|
||
|
description = ''
|
||
|
List of policies to append to the Genode platform driver.
|
||
|
Type is Init.Config.Policy.Type.
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
config = {
|
||
|
|
||
|
genode.core.basePackages = with pkgs.genodePackages; [
|
||
|
acpi_drv
|
||
|
platform_drv
|
||
|
];
|
||
|
|
||
|
genode.init.children.acpi_drv = {
|
||
|
coreROMs = [ "acpi_drv" ];
|
||
|
configFile = pkgs.writeText "acpi_drv.dhall" ''
|
||
|
let Genode = env:DHALL_GENODE
|
||
|
|
||
|
let Init = Genode.Init
|
||
|
|
||
|
let label = λ(_ : Text) → { local = _, route = _ }
|
||
|
|
||
|
in Init.Child.flat
|
||
|
Init.Child.Attributes::{
|
||
|
, binary = "acpi_drv"
|
||
|
, resources = Init.Resources::{
|
||
|
, caps = 400
|
||
|
, ram = Genode.units.MiB 4
|
||
|
, constrainPhys = True
|
||
|
}
|
||
|
, romReports = [ label "acpi", label "smbios_table" ]
|
||
|
, routes =
|
||
|
[ Init.ServiceRoute.parent "IRQ"
|
||
|
, Init.ServiceRoute.parent "IO_MEM"
|
||
|
, Init.ServiceRoute.parent "IO_PORT"
|
||
|
]
|
||
|
}
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
genode.init.children.platform_drv = {
|
||
|
coreROMs = [ "platform_drv" ];
|
||
|
configFile = let
|
||
|
policies =
|
||
|
map (policy: ", ${policy}") config.hardware.genode.platform.policies;
|
||
|
in pkgs.writeText "platform_drv.dhall" ''
|
||
|
let Genode = env:DHALL_GENODE
|
||
|
|
||
|
let Init = Genode.Init
|
||
|
|
||
|
in Init.Child.flat
|
||
|
Init.Child.Attributes::{
|
||
|
, binary = "platform_drv"
|
||
|
, resources = Init.Resources::{
|
||
|
, caps = 800
|
||
|
, ram = Genode.units.MiB 4
|
||
|
, constrainPhys = True
|
||
|
}
|
||
|
, reportRoms = let label = "acpi" in [ { local = label, route = label } ]
|
||
|
, provides = [ "Platform" ]
|
||
|
, routes =
|
||
|
[ Init.ServiceRoute.parent "IRQ"
|
||
|
, Init.ServiceRoute.parent "IO_MEM"
|
||
|
, Init.ServiceRoute.parent "IO_PORT"
|
||
|
]
|
||
|
, config = Init.Config::{
|
||
|
, policies = [ ${toString policies} ]
|
||
|
}
|
||
|
}
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|