run/platform_drv: add append-free interface

Normally, the platform driver helpers adapt the global run variables directly
via append. But the introduction of a more elegant run script style, that
incorporates dependent strings inline may be a good idea. Thus, we need the
backends of the helpers available as functions that return their string rather
than appending it.

The old interface still exists and uses the new interface as backend.

Ref #2193
This commit is contained in:
Martin Stein 2017-02-11 03:38:38 +01:00 committed by Christian Helmuth
parent d2832c3e4d
commit 412c5e5be4

View File

@ -30,24 +30,34 @@ proc need_usb_hid { } {
}
proc append_platform_drv_build_components {} {
global build_components
lappend_if [have_platform_drv] build_components drivers/platform
lappend_if [have_spec acpi] build_components drivers/acpi
lappend_if [have_spec acpi] build_components server/report_rom
lappend_if [have_spec nova] build_components drivers/platform/spec/x86/device_pd
proc platform_drv_build_components {} {
set drv_build_components ""
lappend_if [have_platform_drv] drv_build_components drivers/platform
lappend_if [have_spec acpi] drv_build_components drivers/acpi
lappend_if [have_spec acpi] drv_build_components server/report_rom
lappend_if [have_spec nova] drv_build_components drivers/platform/spec/x86/device_pd
return $drv_build_components
}
proc append_platform_drv_build_components {} {
global build_components
append build_components [platform_drv_build_components]
}
proc platform_drv_boot_modules {} {
set drv_boot_modules ""
lappend_if [have_platform_drv] drv_boot_modules platform_drv
lappend_if [have_spec acpi] drv_boot_modules acpi_drv
lappend_if [have_spec acpi] drv_boot_modules report_rom
lappend_if [have_spec nova] drv_boot_modules device_pd
lappend_if [have_spec muen] drv_boot_modules acpi
return $drv_boot_modules
}
proc append_platform_drv_boot_modules {} {
global boot_modules
lappend_if [have_platform_drv] boot_modules platform_drv
lappend_if [have_spec acpi] boot_modules acpi_drv
lappend_if [have_spec acpi] boot_modules report_rom
lappend_if [have_spec nova] boot_modules device_pd
lappend_if [have_spec muen] boot_modules acpi
append boot_modules $platform_drv_boot_modules
}
@ -95,15 +105,15 @@ proc platform_drv_config_config {} {
}
proc append_platform_drv_config {} {
global config
proc platform_drv_config {} {
set drv_config ""
if {[have_spec acpi]} {
append config "
append drv_config "
<start name=\"acpi_drv\" [platform_drv_priority]>"
append config {
append drv_config {
<resource name="RAM" quantum="3M"/>
<route>
<service name="IO_MEM"> <parent/> </service>
@ -117,10 +127,10 @@ proc append_platform_drv_config {} {
</route>
</start>}
append config "
append drv_config "
<start name=\"acpi_report_rom\" [platform_drv_priority]>"
append config {
append drv_config {
<binary name="report_rom"/>
<resource name="RAM" quantum="2M"/>
<provides>
@ -143,44 +153,51 @@ proc append_platform_drv_config {} {
if {[have_platform_drv]} {
append config "
append drv_config "
<start name=\"platform_drv\" [platform_drv_priority]>"
append config {
append drv_config {
<resource name="RAM" quantum="4M" constrain_phys="yes"/>
<provides>
<service name="Platform"/>}
append_if [have_spec acpi] config {
append_if [have_spec acpi] drv_config {
<service name="Acpi"/>}
append_if [have_spec arm] config {
append_if [have_spec arm] drv_config {
<service name="Regulator"/>}
append config {
append drv_config {
</provides>
<route>}
append config "[platform_drv_add_routing]"
append drv_config "[platform_drv_add_routing]"
append_if [have_spec acpi] config {
append_if [have_spec acpi] drv_config {
<service name="ROM" label="acpi"> <child name="acpi_report_rom"/> </service>}
append_if [have_spec rpi] config {
append_if [have_spec rpi] drv_config {
<service name="Timer"> <any-child/> </service>}
append config {
append drv_config {
<any-service> <parent/> </any-service>
</route>}
append config [platform_drv_config_config]
append config [platform_drv_policy]
append drv_config [platform_drv_config_config]
append drv_config [platform_drv_policy]
append config {
append drv_config {
</config>
</start>}
}
return $drv_config
}
proc append_platform_drv_config {} {
global config
append config [platform_drv_config]
return $config
}