platform_drv.inc: support acpi_drv and acpica

Issue #2816
This commit is contained in:
Alexander Boettcher 2018-05-07 21:25:50 +02:00 committed by Christian Helmuth
parent 39e1314d07
commit 0ef7e58ef9
3 changed files with 103 additions and 38 deletions

View File

@ -64,12 +64,26 @@ proc audio_drv_binary { } {
return no_audio_drv_available
}
proc acpi_drv_name { } {
global use_acpica_as_acpi_drv
if {[info exists use_acpica_as_acpi_drv] && $use_acpica_as_acpi_drv} {
return acpica }
return acpi_drv
}
proc platform_drv_build_components {} {
set drv_build_components ""
lappend_if [have_platform_drv] drv_build_components drivers/platform
lappend_if [have_spec x86] drv_build_components drivers/acpi
lappend_if [have_spec x86] drv_build_components server/report_rom
if {[have_spec x86]} {
if {[acpi_drv_name] eq "acpi_drv"} {
lappend drv_build_components drivers/acpi
}
if {[acpi_drv_name] eq "acpica"} {
lappend drv_build_components app/acpica
}
}
return $drv_build_components
}
@ -88,7 +102,7 @@ proc platform_drv_boot_modules {} {
if {[have_spec muen]} {
lappend drv_boot_modules acpi
} else {
lappend drv_boot_modules acpi_drv
lappend drv_boot_modules [acpi_drv_name]
}
}
@ -103,8 +117,18 @@ proc append_platform_drv_boot_modules {} {
proc platform_drv_policy {} {
if ([have_spec x86]) {
return {
if (![have_spec x86]) {
return {}
}
set drv_policy ""
if {[acpi_drv_name] eq "acpica"} {
append drv_policy {
<policy label="acpi_drv -> "> <pci class="ALL"/> </policy>}
}
append drv_policy {
<policy label_prefix="ps2_drv"> <device name="PS2"/> </policy>
<policy label_prefix="nic_drv"> <pci class="ETHERNET"/> </policy>
<policy label_prefix="fb_drv"> <pci class="VGA"/> </policy>
@ -118,17 +142,17 @@ proc platform_drv_policy {} {
<pci bus="0" device="0" function="0"/>
<pci class="ISABRIDGE"/>
</policy>}
} else {
return {}
}
return $drv_policy
}
proc platform_drv_priority {} { return "" }
proc platform_drv_add_routing {} {
if {[have_spec x86]} {
if {[acpi_drv_name] eq "acpica"} {
return {
<service name="ROM" label="system"> <child name="acpi_report_rom"/> </service>}
<service name="ROM" label="acpi_ready"> <child name="acpi_report_rom"/> </service>}
}
return ""
@ -136,6 +160,11 @@ proc platform_drv_add_routing {} {
proc platform_drv_config_config {} {
if {[acpi_drv_name] eq "acpica"} {
return {
<config acpi_ready="yes">}
}
if {[have_spec acpi] || [have_spec arm] || [have_spec muen]} {
return {
<config>}
@ -153,14 +182,34 @@ proc platform_drv_config {} {
append drv_config {
<start name="acpi_drv" } [platform_drv_priority] { caps="400" >
<resource name="RAM" quantum="3M"/>
<binary name="} [acpi_drv_name] {"/>}
if {[acpi_drv_name] eq "acpica"} {
append drv_config {
<resource name="RAM" quantum="5M"/>
<config acpi_ready="yes" act_as_acpi_drv="yes" report="yes"/>}
} else {
append drv_config {
<resource name="RAM" quantum="3M"/>}
}
append drv_config {
<route>
<service name="IO_MEM"> <parent/> </service>
<service name="LOG"> <parent/> </service>
<service name="PD"> <parent/> </service>
<service name="RM"> <parent/> </service>
<service name="CPU"> <parent/> </service>
<service name="ROM"> <parent/> </service>
<service name="ROM"> <parent/> </service>}
append_if [expr {[acpi_drv_name] eq "acpica"}] drv_config {
<service name="IO_PORT"> <parent/> </service>
<service name="IRQ"> <parent/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="Platform"> <child name="platform_drv"/> </service>
<service name="Acpi"> <child name="platform_drv"/> </service>}
append drv_config {
<service name="Report"> <child name="acpi_report_rom"/> </service>
<service name="ROM" label="platform_info"> <parent/> </service>
</route>
@ -177,7 +226,12 @@ proc platform_drv_config {} {
<service name="Report" />
</provides>
<config>
<policy label="platform_drv -> acpi" report="acpi_drv -> acpi"/>
<policy label="platform_drv -> acpi" report="acpi_drv -> acpi"/>}
append_if [expr {[acpi_drv_name] eq "acpica"}] drv_config {
<policy label="platform_drv -> acpi_ready" report="acpi_drv -> acpi_ready"/>}
append drv_config {
</config>
<route>
<service name="LOG"> <parent/> </service>

View File

@ -21,26 +21,30 @@ set build_components {
test/input
}
set use_acpica_as_acpi_drv 0
source ${genode_dir}/repos/base/run/platform_drv.inc
# override default platform driver policy
proc platform_drv_policy {} {
return {
<policy label_prefix="ps2_drv"> <device name="PS2"/> </policy>
<policy label_prefix="acpica"> <pci class="ALL"/> </policy>}
}
if {!$use_acpica_as_acpi_drv} {
# add routing information to dynamically generate change of 'system' ROM
proc platform_drv_add_routing {} {
return {
<service name="ROM" label="system"> <child name="dynamic_rom"/> </service>
<service name="ROM" label="acpi_ready"> <child name="acpi_state"/> </service>}
}
# override default platform driver policy
proc platform_drv_policy {} {
return {
<policy label_prefix="ps2_drv"> <device name="PS2"/> </policy>
<policy label_prefix="acpica"> <pci class="ALL"/> </policy>}
}
# override default config to react on 'system' ROM changes for reset
proc platform_drv_config_config {} {
return {
<config acpi="yes" system="yes" acpi_ready="yes">}
# add routing information
proc platform_drv_add_routing {} {
return {
<service name="ROM" label="acpi_ready"> <child name="acpi_state"/> </service>}
}
# override default config to react on 'acpi_ready' ROM change
proc platform_drv_config_config {} {
return {
<config acpi_ready="yes">}
}
}
append_platform_drv_build_components
@ -68,15 +72,12 @@ set config {
<start name="timer">
<resource name="RAM" quantum="2M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="acpica">
<!-- <binary name="debug-acpica"/> -->
<resource name="RAM" quantum="4M"/>
</start>}
append_if [expr !$use_acpica_as_acpi_drv] config {
<start name="acpica" caps="150">
<resource name="RAM" quantum="5M"/>
<config ld_verbose="yes" reset="no" poweroff="no" report="yes" acpi_ready="yes">
<!-- required for "debug-acpica":
<vfs> <dir name="dev"> <log/> </dir> </vfs>
<libc stdout="/dev/log"/>
-->
</config>
<route>
<service name="ROM" label="system"> <child name="dynamic_rom"/> </service>
@ -218,4 +219,4 @@ build_boot_image $boot_modules
append qemu_args "-nographic "
run_genode_until {\[init -\> acpica\].*SCI IRQ:.*\n} 30
run_genode_until {\[init -\> acpi.*SCI IRQ:.*\n} 30

View File

@ -4,12 +4,22 @@ assert_spec pci
#
set build_components { core init test/pci }
set use_acpica_as_acpi_drv 0
source ${genode_dir}/repos/base/run/platform_drv.inc
# override default platform driver policy
proc platform_drv_policy {} {
return {
global use_acpica_as_acpi_drv
set policy ""
append_if $use_acpica_as_acpi_drv policy {
<policy label="acpi_drv -> "> <pci class="ALL"/> </policy>}
append policy {
<policy label_prefix="test-pci"> <pci class="ALL"/> </policy>}
return $policy
}
append_platform_drv_build_components