2016-03-18 15:31:00 +00:00
|
|
|
if {
|
|
|
|
![have_spec hw] &&
|
2017-06-12 10:41:38 +00:00
|
|
|
![have_spec nova] &&
|
|
|
|
![have_spec sel4]
|
2016-03-18 15:31:00 +00:00
|
|
|
} {
|
|
|
|
puts "Platform is unsupported."
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
set build_components {
|
2019-01-03 17:01:49 +00:00
|
|
|
core init timer
|
2020-08-14 10:03:09 +00:00
|
|
|
drivers/ps2
|
2016-03-18 15:31:00 +00:00
|
|
|
server/dynamic_rom
|
2020-07-16 09:28:18 +00:00
|
|
|
server/event_filter
|
2016-03-18 15:31:00 +00:00
|
|
|
server/report_rom
|
2020-07-16 09:28:18 +00:00
|
|
|
server/event_dump
|
2016-03-18 15:31:00 +00:00
|
|
|
app/acpica
|
2020-08-13 10:06:55 +00:00
|
|
|
app/acpi_event
|
2016-03-18 15:31:00 +00:00
|
|
|
}
|
|
|
|
|
2018-05-07 19:25:50 +00:00
|
|
|
set use_acpica_as_acpi_drv 0
|
2016-03-18 15:31:00 +00:00
|
|
|
|
2018-05-07 19:25:50 +00:00
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
2016-05-13 14:09:20 +00:00
|
|
|
|
2018-05-07 19:25:50 +00:00
|
|
|
if {!$use_acpica_as_acpi_drv} {
|
|
|
|
|
|
|
|
# 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>}
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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">}
|
|
|
|
}
|
2016-05-13 14:09:20 +00:00
|
|
|
}
|
|
|
|
|
2016-03-18 15:31:00 +00:00
|
|
|
append_platform_drv_build_components
|
|
|
|
|
|
|
|
build $build_components
|
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
set config {
|
|
|
|
<config>
|
|
|
|
<parent-provides>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
<service name="RM"/>
|
2017-03-17 15:06:48 +00:00
|
|
|
<service name="PD"/>
|
|
|
|
<service name="CPU"/>
|
2016-03-18 15:31:00 +00:00
|
|
|
<service name="IO_MEM" />
|
|
|
|
<service name="IO_PORT" />
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>
|
2017-05-07 20:36:11 +00:00
|
|
|
<default caps="100"/>
|
2016-03-18 15:31:00 +00:00
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides><service name="Timer"/></provides>
|
2018-05-07 19:25:50 +00:00
|
|
|
</start>}
|
|
|
|
|
|
|
|
append_if [expr !$use_acpica_as_acpi_drv] config {
|
2022-07-01 15:10:57 +00:00
|
|
|
<start name="acpica" caps="200">
|
|
|
|
<resource name="RAM" quantum="8M"/>
|
2016-06-01 20:26:54 +00:00
|
|
|
<config ld_verbose="yes" reset="no" poweroff="no" report="yes" acpi_ready="yes">
|
2016-03-18 15:31:00 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="ROM" label="system"> <child name="dynamic_rom"/> </service>
|
|
|
|
<service name="Report"> <child name="acpi_state"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append config {
|
|
|
|
<start name="acpi_state">
|
|
|
|
<binary name="report_rom"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides>
|
|
|
|
<service name="ROM" />
|
|
|
|
<service name="Report" />
|
|
|
|
</provides>
|
|
|
|
<config verbose="yes">
|
2016-06-01 20:26:54 +00:00
|
|
|
<policy label="platform_drv -> acpi_ready" report="acpica -> acpi_ready"/>
|
2020-08-13 10:06:55 +00:00
|
|
|
<policy label="acpi_event -> acpi_ac" report="acpica -> acpi_ac"/>
|
|
|
|
<policy label="acpi_event -> acpi_battery" report="acpica -> acpi_battery"/>
|
|
|
|
<policy label="acpi_event -> acpi_ec" report="acpica -> acpi_ec"/>
|
|
|
|
<policy label="acpi_event -> acpi_fixed" report="acpica -> acpi_fixed"/>
|
|
|
|
<policy label="acpi_event -> acpi_lid" report="acpica -> acpi_lid"/>
|
2020-12-18 18:31:37 +00:00
|
|
|
<policy label="acpi_event -> acpi_hid" report="acpica -> acpi_hid"/>
|
2016-03-18 15:31:00 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
2017-03-17 15:06:48 +00:00
|
|
|
<any-service> <parent/> </any-service>
|
2016-03-18 15:31:00 +00:00
|
|
|
</route>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append config {
|
|
|
|
<start name="dynamic_rom">
|
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<provides><service name="ROM"/></provides>
|
|
|
|
<config verbose="yes">
|
|
|
|
<rom name="system">
|
|
|
|
<inline description="set system state to 'normal'">
|
|
|
|
<system state="normal"/>
|
|
|
|
</inline>
|
|
|
|
<sleep milliseconds="5000" />
|
|
|
|
<inline description="set system state to 'reset'">
|
|
|
|
<system state="reset"/>
|
|
|
|
</inline>
|
|
|
|
<!--
|
|
|
|
<inline description="set system state to 'poweroff'">
|
|
|
|
<system state="poweroff"/>
|
|
|
|
</inline>
|
|
|
|
-->
|
|
|
|
<sleep milliseconds="500" />
|
|
|
|
</rom>
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
2016-06-16 09:34:57 +00:00
|
|
|
append config {
|
2020-07-16 09:28:18 +00:00
|
|
|
<start name="event_filter">
|
2016-06-16 09:34:57 +00:00
|
|
|
<resource name="RAM" quantum="1M" />
|
2020-07-16 09:28:18 +00:00
|
|
|
<provides> <service name="Event" /> </provides>
|
2016-06-16 09:34:57 +00:00
|
|
|
<config>
|
2020-04-22 14:15:56 +00:00
|
|
|
<output>
|
|
|
|
<merge>
|
|
|
|
<input name="ps2"/>
|
|
|
|
<input name="acpi"/>
|
|
|
|
</merge>
|
|
|
|
</output>
|
2020-07-16 09:28:18 +00:00
|
|
|
<policy label="ps2" input="ps2"/>
|
|
|
|
<policy label="acpi" input="acpi"/>
|
2016-06-16 09:34:57 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
2020-07-16 09:28:18 +00:00
|
|
|
<service name="Event"> <child name="event_dump" /> </service>
|
2017-03-17 15:06:48 +00:00
|
|
|
<any-service> <parent/> </any-service>
|
2016-06-16 09:34:57 +00:00
|
|
|
</route>
|
|
|
|
</start>}
|
|
|
|
|
2016-03-18 15:31:00 +00:00
|
|
|
append config {
|
|
|
|
<start name="ps2_drv">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<config verbose_keyboard="no" verbose_mouse="no" verbose_scancodes="no"/>
|
|
|
|
<route>
|
|
|
|
<service name="Platform"> <child name="platform_drv"/> </service>
|
2018-08-17 15:26:30 +00:00
|
|
|
<service name="Timer"> <child name="timer"/> </service>
|
2020-07-16 09:28:18 +00:00
|
|
|
<service name="Event"> <child name="event_filter" label="ps2"/> </service>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="event_dump">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides> <service name="Event"/> </provides>
|
2016-03-18 15:31:00 +00:00
|
|
|
<route>
|
2017-03-17 15:06:48 +00:00
|
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
|
|
<any-service> <parent/> </any-service>
|
2016-03-18 15:31:00 +00:00
|
|
|
</route>
|
|
|
|
</start>}
|
|
|
|
|
2016-06-16 09:34:57 +00:00
|
|
|
append config {
|
2020-08-13 10:06:55 +00:00
|
|
|
<start name="acpi_event">
|
2020-07-16 09:28:18 +00:00
|
|
|
<resource name="RAM" quantum="1M"/>
|
2016-06-16 09:34:57 +00:00
|
|
|
<config>
|
|
|
|
<!-- example mapping - adapt to your target notebook !!! -->
|
|
|
|
<!-- as="PRESS_RELEASE" is default if nothing specified -->
|
2020-12-18 18:31:37 +00:00
|
|
|
<map acpi="ec" value="25" to_key="KEY_VENDOR"/>
|
|
|
|
<map acpi="ec" value="20" to_key="KEY_BRIGHTNESSUP"/>
|
|
|
|
<map acpi="ec" value="21" to_key="KEY_BRIGHTNESSDOWN"/>
|
2022-07-01 15:10:57 +00:00
|
|
|
<map acpi="fixed" value="0" to_key="KEY_POWER" as="PRESS_RELEASE"/>
|
|
|
|
<map acpi="lid" value="CLOSED" to_key="KEY_SLEEP" as="PRESS_RELEASE"/>
|
|
|
|
<map acpi="lid" value="OPEN" to_key="KEY_SLEEP" as="PRESS_RELEASE"/>
|
2020-12-18 18:31:37 +00:00
|
|
|
<map acpi="ac" value="ONLINE" to_key="KEY_WAKEUP"/>
|
|
|
|
<map acpi="ac" value="OFFLINE" to_key="KEY_SLEEP"/>
|
|
|
|
<map acpi="battery" value="0" to_key="KEY_BATTERY"/>
|
|
|
|
<map acpi="hid" value="0x4000000" to_key="KEY_FN_F4"/>
|
2016-06-16 09:34:57 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
2020-08-13 10:06:55 +00:00
|
|
|
<service name="ROM" label="acpi_ac"> <child name="acpi_state"/> </service>
|
2016-06-16 09:34:57 +00:00
|
|
|
<service name="ROM" label="acpi_battery"> <child name="acpi_state"/> </service>
|
2020-08-13 10:06:55 +00:00
|
|
|
<service name="ROM" label="acpi_ec"> <child name="acpi_state"/> </service>
|
|
|
|
<service name="ROM" label="acpi_fixed"> <child name="acpi_state"/> </service>
|
|
|
|
<service name="ROM" label="acpi_lid"> <child name="acpi_state"/> </service>
|
2020-12-18 18:31:37 +00:00
|
|
|
<service name="ROM" label="acpi_hid"> <child name="acpi_state"/> </service>
|
2020-08-13 10:06:55 +00:00
|
|
|
<service name="Event"> <child name="event_filter" label="acpi"/> </service>
|
2017-03-17 15:06:48 +00:00
|
|
|
<any-service> <parent/> </any-service>
|
2016-06-16 09:34:57 +00:00
|
|
|
</route>
|
|
|
|
</start>}
|
|
|
|
|
2016-03-18 15:31:00 +00:00
|
|
|
append_platform_drv_config
|
|
|
|
|
|
|
|
append config {
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
set boot_modules {
|
|
|
|
core init
|
2017-11-10 10:13:00 +00:00
|
|
|
ld.lib.so
|
2016-03-18 15:31:00 +00:00
|
|
|
timer
|
|
|
|
ps2_drv
|
2020-07-16 09:28:18 +00:00
|
|
|
event_filter
|
2016-03-18 15:31:00 +00:00
|
|
|
report_rom
|
|
|
|
dynamic_rom
|
|
|
|
acpica
|
2020-08-13 10:06:55 +00:00
|
|
|
acpi_event
|
2020-07-16 09:28:18 +00:00
|
|
|
event_dump
|
2016-03-18 15:31:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
append_platform_drv_boot_modules
|
|
|
|
|
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
2017-05-23 13:05:55 +00:00
|
|
|
append qemu_args "-nographic "
|
2016-03-18 15:31:00 +00:00
|
|
|
|
2022-07-01 15:10:57 +00:00
|
|
|
if {![have_include "power_on/qemu"]} {
|
|
|
|
run_genode_until {\[init -\> acpi.*SCI IRQ:.*\n} 30
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
run_genode_until {.*PS2 uses IRQ, vector 0xc.*} 30
|
|
|
|
|
|
|
|
set spawn_id $qemu_spawn_id
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# send Ctrl-a+c to enter Qemu's monitor mode
|
|
|
|
send "\x01\x63"
|
|
|
|
|
|
|
|
# wait for monitor to become ready
|
|
|
|
run_genode_until {(qemu)} 20 $spawn_id
|
|
|
|
|
|
|
|
|
|
|
|
for {set i 0} {$i < 3} {incr i} {
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
send "system_powerdown\n"
|
|
|
|
run_genode_until {.*key count: 0.*} 3 $spawn_id
|
|
|
|
}
|
|
|
|
|
|
|
|
puts "\nTest succeeded\n"
|
|
|
|
exit 0
|