2020-12-03 12:48:07 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
2020-12-30 21:07:30 +01:00
|
|
|
imports = [ ./ahci.nix ./framebuffer.nix ./nic.nix ./usb.nix ];
|
2020-12-03 12:48:07 +01:00
|
|
|
|
|
|
|
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 = {
|
|
|
|
|
2020-12-30 21:07:30 +01:00
|
|
|
genode.core.children.acpi_drv = {
|
2021-02-16 12:10:50 +01:00
|
|
|
package = pkgs.genodePackages.acpi_drv;
|
2020-12-03 12:48:07 +01:00
|
|
|
configFile = pkgs.writeText "acpi_drv.dhall" ''
|
|
|
|
let Genode = env:DHALL_GENODE
|
|
|
|
|
|
|
|
let Init = Genode.Init
|
|
|
|
|
|
|
|
let label = λ(_ : Text) → { local = _, route = _ }
|
|
|
|
|
2021-02-16 15:25:30 +01:00
|
|
|
in λ(binary : Text) →
|
|
|
|
Init.Child.flat
|
|
|
|
Init.Child.Attributes::{
|
|
|
|
, binary
|
|
|
|
, 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"
|
|
|
|
]
|
2020-12-03 12:48:07 +01:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-12-30 21:07:30 +01:00
|
|
|
genode.core.children.platform_drv = {
|
2021-02-16 12:10:50 +01:00
|
|
|
package = pkgs.genodePackages.platform_drv;
|
2020-12-03 12:48:07 +01:00
|
|
|
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
|
|
|
|
|
2021-02-16 15:25:30 +01:00
|
|
|
in λ(binary : Text) -> Init.Child.flat
|
2020-12-03 12:48:07 +01:00
|
|
|
Init.Child.Attributes::{
|
2021-02-16 15:25:30 +01:00
|
|
|
, binary
|
2020-12-03 12:48:07 +01:00
|
|
|
, 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} ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|