From 19dccc48627a61e99fad55f57d620e5b78c8fded Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 4 Mar 2020 17:34:06 +0100 Subject: [PATCH] Update dhall-genode, use report_rom inference --- compositions/pc-drivers.dhall | 81 +++++++++++++---------------------- packages/dhall/genode.nix | 4 +- tests/driver_manager.dhall | 26 +++-------- tests/pci.dhall | 30 +++---------- 4 files changed, 44 insertions(+), 97 deletions(-) diff --git a/compositions/pc-drivers.dhall b/compositions/pc-drivers.dhall index 0560c41..a931a12 100644 --- a/compositions/pc-drivers.dhall +++ b/compositions/pc-drivers.dhall @@ -14,14 +14,14 @@ let Resources = Init.Resources let ServiceRoute = Init.ServiceRoute -let reportRomRoute = - λ(service : Text) - → λ(label : Text) - → ServiceRoute.childLabel service "report_rom" (Some label) (None Text) +let label = + λ(label : Text) + → { local = label, route = label } : Child.Attributes.Label -let reportRomReport = reportRomRoute "Report" - -let reportRomROM = reportRomRoute "ROM" +let relabel = + λ(local : Text) + → λ(route : Text) + → { local = local, route = route } : Child.Attributes.Label let drivers = Init::{ @@ -45,31 +45,6 @@ let drivers = , ServiceRoute.parent "IO_MEM" ] } - , report_rom = - Child.flat - Child.Attributes::{ - , binary = "report_rom" - , resources = Resources::{ ram = Genode.units.MiB 2 } - , provides = [ "ROM", "Report" ] - , config = - Init.Config::{ - , content = - [ XML.text - '' - - - - - - - - - - - '' - ] - } - } , rom_reporter = Child.flat Child.Attributes::{ @@ -85,6 +60,8 @@ let drivers = '' ] } + , reportRoms = + [ label "acpi", label "pci_devices", label "usb_devices" ] , routes = let routeReportToParent = λ(label : Text) @@ -92,11 +69,8 @@ let drivers = "Report" (Some label) (Some label) - - in [ reportRomROM "acpi" - , reportRomROM "pci_devices" - , reportRomROM "usb_devices" - , routeReportToParent "acpi" + + in [ routeReportToParent "acpi" , routeReportToParent "pci_devices" , routeReportToParent "usb_devices" ] @@ -108,9 +82,9 @@ let drivers = , priority = 1 , resources = Resources::{ caps = 350, ram = Genode.units.MiB 4 } + , romReports = [ label "acpi" ] , routes = [ ServiceRoute.parent "IO_MEM" - , reportRomReport "acpi" , ServiceRoute.parentLabel "Report" (Some "smbios_table") @@ -128,6 +102,8 @@ let drivers = , constrainPhys = True } , provides = [ "Acpi", "Platform" ] + , reportRoms = [ label "acpi" ] + , romReports = [ relabel "pci" "pci_devices" ] , routes = [ ServiceRoute.parent "IRQ" , ServiceRoute.parent "IO_MEM" @@ -137,8 +113,6 @@ let drivers = "ROM" (Some "system") (Some "system") - , reportRomROM "acpi" - , reportRomReport "pci" ] , config = Init.Config::{ @@ -190,10 +164,10 @@ let drivers = , resources = Resources::{ caps = 200, ram = Genode.units.MiB 16 } , provides = [ "Input", "Usb" ] + , reportRoms = [ relabel "config" "usb_drv.config" ] + , romReports = [ relabel "devices" "usb_devices" ] , routes = [ ServiceRoute.child "Platform" "platform_drv" - , reportRomROM "config" - , reportRomReport "devices" , ServiceRoute.parentLabel "Report" (Some "config") @@ -241,17 +215,21 @@ let drivers = Child.Attributes::{ , binary = "driver_manager" , priority = 1 + , reportRoms = + [ label "ahci_ports" + , label "nvme_ns" + , label "pci_devices" + , label "usb_devices" + ] + , romReports = + [ relabel "init.config" "dynamic.config" + , label "usb_drv.config" + ] , routes = - [ reportRomReport "init.config" - , reportRomReport "usb_drv.config" - , ServiceRoute.parentLabel + [ ServiceRoute.parentLabel "Report" (Some "block_devices") (Some "block_devices") - , reportRomROM "usb_devices" - , reportRomROM "pci_devices" - , reportRomROM "ahci_ports" - , reportRomROM "nvme_ns" , ServiceRoute.parentLabel "ROM" (Some "usb_policy") @@ -266,12 +244,11 @@ let drivers = , resources = Resources::{ caps = 1400, ram = Genode.units.MiB 64 } , provides = [ "Framebuffer", "Block" ] + , romReports = [ label "ahci_ports", label "nvme_ns" ] + , reportRoms = [ relabel "config" "dynamic.config" ] , routes = [ ServiceRoute.child "Platform" "platform_drv" - , reportRomReport "ahci_ports" - , reportRomReport "nvme_ns" , ServiceRoute.child "Usb" "usb_drv" - , reportRomROM "config" , ServiceRoute.parent "Timer" , ServiceRoute.parent "Report" , ServiceRoute.parent "IO_MEM" diff --git a/packages/dhall/genode.nix b/packages/dhall/genode.nix index 0bb86a5..e4c72e4 100644 --- a/packages/dhall/genode.nix +++ b/packages/dhall/genode.nix @@ -6,8 +6,8 @@ stdenv.mkDerivation { name = "dhall-genode"; src = fetchgit { url = "https://git.sr.ht/~ehmry/dhall-genode"; - rev = "672325a0f2247041cfdf9b3b0c9642adbfbd58a0"; - sha256 = "0iwniwkx0zcrfqv3dkjg5x5638xyxkhnqni4ydzg2b3bw4wa27id"; + rev = "16cad9fbbee3fbd1c167377c93ee1d60f9d21e37"; + sha256 = "0gjad37zd1kb5dlnkb3m8pd1ibzcc9yqf6vgyv3imffj1vhdl14n"; }; DHALL_PRELUDE = prelude + "/package.dhall"; buildCommand = '' diff --git a/tests/driver_manager.dhall b/tests/driver_manager.dhall index 089baf9..dd004cb 100644 --- a/tests/driver_manager.dhall +++ b/tests/driver_manager.dhall @@ -22,32 +22,19 @@ let childRomRoute = → λ(from : Text) → ServiceRoute.childLabel "ROM" child (Some from) (None Text) +let label = \(_ : Text) -> { local = _, route = _ } + in Init::{ , verbose = True , children = toMap - { report_rom = - Child.flat - Child.Attributes::{ - , binary = "report_rom" - , provides = [ "ROM", "Report" ] - , config = - Init.Config::{ - , attributes = toMap { verbose = "yes" } - , content = - [ Genode.Prelude.XML.text - '' - - '' - ] - } - } - , drivers = + { , drivers = Init.toChild drivers Init.Attributes::{ , provides = [ "Block", "Framebuffer", "Input" ] , resources = Init.Resources::{ ram = Genode.units.MiB 4 } + , romReports = [ label "block_devices" ] , routes = [ parentRomRoute "managed/input_filter" @@ -56,7 +43,7 @@ in Init::{ , childRomRoute "dynamic_rom" "capslock" , childRomRoute "dynamic_rom" "numlock" , childRomRoute "dynamic_rom" "system" - , ServiceRoute.child "Report" "report_rom" + , ServiceRoute.child "Report" "_report_rom" , ServiceRoute.parent "Timer" , Genode.Init.ServiceRoute.parent "IRQ" , Genode.Init.ServiceRoute.parent "IO_MEM" @@ -99,8 +86,9 @@ in Init::{ '' ] } + , reportRoms = [ label "block_devices" ] , routes = - [ childRomRoute "report_rom" "block_devices" + [ , ServiceRoute.child "Block" "drivers" , ServiceRoute.child "Framebuffer" "drivers" , ServiceRoute.child "Input" "drivers" diff --git a/tests/pci.dhall b/tests/pci.dhall index de1d68d..a93440f 100644 --- a/tests/pci.dhall +++ b/tests/pci.dhall @@ -12,6 +12,8 @@ let Resources = Init.Resources let ServiceRoute = Init.ServiceRoute +let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label + in { config = Init::{ , verbose = True @@ -25,22 +27,6 @@ in { config = , resources = Resources::{ ram = Genode.units.MiB 3 } , routes = [ ServiceRoute.child "Platform" "platform_drv" ] } - , acpi_report_rom = - Child.flat - Child.Attributes::{ - , binary = "report_rom" - , provides = [ "ROM", "Report" ] - , config = - Init.Config::{ - , content = - [ XML.text - '' - - - '' - ] - } - } , acpi_drv = Child.flat Child.Attributes::{ @@ -52,9 +38,9 @@ in { config = , constrainPhys = True } , provides = [ "Platform", "Acpi" ] + , romReports = [ label "acpi" ] , routes = - [ ServiceRoute.child "Report" "acpi_report_rom" - , ServiceRoute.parent "IRQ" + [ ServiceRoute.parent "IRQ" , ServiceRoute.parent "IO_MEM" , ServiceRoute.parent "IO_PORT" ] @@ -69,17 +55,13 @@ in { config = , ram = Genode.units.MiB 4 , constrainPhys = True } + , reportRoms = [ label "acpi" ] , provides = [ "Platform", "Acpi" ] , routes = [ ServiceRoute.parent "Timer" , ServiceRoute.parent "IRQ" , ServiceRoute.parent "IO_MEM" , ServiceRoute.parent "IO_PORT" - , ServiceRoute.childLabel - "ROM" - "acpi_report_rom" - (Some "acpi") - (None Text) ] , config = Init.Config::{ @@ -95,7 +77,7 @@ in { config = } , rom = let manifest = env:MANIFEST - + in Genode.Boot.toRomPaths [ manifest.drivers.bin.acpi_drv , manifest.drivers.bin.platform_drv