pci: convert to platform_drv

Fixes #1542
This commit is contained in:
Alexander Boettcher
2015-06-08 09:05:32 +02:00
committed by Christian Helmuth
parent 32e792dc74
commit 1f40d9de6a
84 changed files with 721 additions and 1324 deletions

View File

@ -2,14 +2,19 @@
# Build
#
build {
set build_components {
core init
drivers/timer
drivers/framebuffer drivers/pci drivers/input drivers/audio_out
drivers/framebuffer drivers/input drivers/audio_out
server/mixer
app/avplay drivers/acpi
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
#
# Download media file
#
@ -55,40 +60,7 @@ append_if [have_spec sdl] config {
</provides>
</start>}
append_if [have_spec acpi] config {
<start name="acpi">
<resource name="RAM" quantum="8M" constrain_phys="yes"/>
<binary name="acpi_drv"/>
<provides>
<service name="PCI"/>
<service name="IRQ" />
</provides>
<route>
<any-service> <parent/> <any-child /> </any-service>
</route>
<config>
<policy label="acpi_drv"> <pci class="ALL"/> </policy>
<policy label="ps2_drv"> <device name="PS2"/> </policy>
<policy label="usb_drv"> <pci class="USB"/> </policy>
<policy label="fb_drv"> <pci class="VGA"/> </policy>
<policy label="audio_out_drv"> <pci class="AUDIO"/> </policy>
</config>
</start>
}
append_if [expr [have_spec pci] && ![have_spec acpi]] config {
<start name="pci_drv">
<resource name="RAM" quantum="2M" constrain_phys="yes"/>
<provides>
<service name="PCI"/>
</provides>
<policy label="acpi_drv"> <pci class="ALL"/> </policy>
<policy label="ps2_drv"> <device name="PS2"/> </policy>
<policy label="usb_drv"> <pci class="USB"/> </policy>
<policy label="fb_drv"> <pci class="VGA"/> </policy>
<policy label="audio_out_drv"> <pci class="AUDIO"/> </policy>
</start>
}
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv">
@ -139,7 +111,7 @@ append config {
</libc>
</config>
<route>
<service name="PCI"> <any-child /> </service>
<service name="Platform"> <any-child /> </service>
<service name="Audio_out"> <child name="mixer"/> </service>
<any-service> <parent/> <any-child /> </any-service>
</route>
@ -161,11 +133,10 @@ set boot_modules {
}
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec pci] boot_modules acpi_drv
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec nova] boot_modules pci_device_pd
append_platform_drv_boot_modules
build_boot_image $boot_modules

View File

@ -4,7 +4,7 @@ build {
server/nitpicker server/nit_fb
app/launchpad app/pointer
app/eglgears
drivers/framebuffer drivers/pci drivers/input
drivers/framebuffer drivers/input
lib/gallium
}
@ -39,11 +39,7 @@ append_if [have_spec sdl] config {
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv">
@ -92,7 +88,7 @@ append config {
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="PCI"/>
<service name="Platform"/>
<service name="SIGNAL"/>
<service name="Nitpicker"/>
<service name="Timer"/>
@ -128,11 +124,12 @@ set boot_modules {
}
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec i915] boot_modules gallium-i915.lib.so
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -m 768"

View File

@ -28,12 +28,17 @@ requires_installation_of lynx
# Build
#
build {
set build_components {
core init
drivers/acpi drivers/pci drivers/timer drivers/nic
drivers/timer drivers/nic
test/lwip/http_srv_tracing
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
#
@ -75,25 +80,7 @@ set config {
</config>
</start>}
append_if [have_spec acpi] config {
<start name="acpi">
<resource name="RAM" quantum="6M" constrain_phys="yes"/>
<binary name="acpi_drv"/>
<provides>
<service name="PCI"/>
<service name="IRQ" />
</provides>
<route>
<service name="PCI"> <any-child /> </service>
<any-service> <parent/> <any-child /> </any-service>
</route>
</start>}
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
<start name="pci_drv">
<resource name="RAM" quantum="3M" constrain_phys="yes"/>
<provides> <service name="PCI"/> </provides>
</start>}
append_platform_drv_config
append config {
</config>
@ -114,8 +101,7 @@ set boot_modules {
}
# platform-specific modules
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec acpi] boot_modules acpi_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules

View File

@ -10,6 +10,7 @@ if {![have_include power_on/qemu]} {
exit 0
}
#
# Build
#
@ -20,11 +21,12 @@ set build_components {
test/libc_block
}
lappend_if [have_spec pci] build_components drivers/pci
lappend_if [have_spec acpi] build_components drivers/acpi
lappend_if $use_ahci_drv build_components drivers/ahci
lappend_if $use_sd_card_drv build_components drivers/sd_card
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
@ -66,28 +68,9 @@ set config {
</vfs>
</libc>
</config>
</start>
}
append_if [have_spec acpi] config {
<start name="acpi">
<resource name="RAM" quantum="8M" constrain_phys="yes"/>
<binary name="acpi_drv"/>
<provides>
<service name="PCI"/>
<service name="IRQ" />
</provides>
<route>
<service name="PCI"> <any-child /> </service>
<any-service> <parent/> <any-child /> </any-service>
</route>
</start>}
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
<start name="pci_drv">
<resource name="RAM" quantum="5M" constrain_phys="yes"/>
<provides><service name="PCI"/></provides>
</start>}
append_platform_drv_config
append_if $use_ahci_drv config {
<start name="ahci">
@ -121,11 +104,11 @@ set boot_modules {
test-libc_block
}
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec acpi] boot_modules acpi_drv
lappend_if $use_ahci_drv boot_modules ahci
lappend_if $use_sd_card_drv boot_modules sd_card_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
#

View File

@ -22,11 +22,12 @@ set build_components {
test/libc_vfs
}
lappend_if [have_spec pci] build_components drivers/pci
lappend_if [have_spec acpi] build_components drivers/acpi
lappend_if $use_ahci_drv build_components drivers/ahci
lappend_if $use_sd_card_drv build_components drivers/sd_card
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
@ -71,34 +72,9 @@ set config {
</vfs>
</libc>
</config>
</start>
}
append_if [have_spec acpi] config {
<start name="acpi">
<resource name="RAM" quantum="8M" constrain_phys="yes"/>
<binary name="acpi_drv"/>
<provides>
<service name="PCI"/>
<service name="IRQ" />
</provides>
<route>
<any-service> <parent/> <any-child /> </any-service>
</route>
<config>
<policy label="acpi_drv"><pci class="ALL" /></policy>
<policy label="ahci_drv"><pci class="AHCI" /></policy>
</config>
</start>}
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
<start name="pci_drv">
<resource name="RAM" quantum="5M" constrain_phys="yes"/>
<provides><service name="PCI"/></provides>
<config>
<policy label="ahci_drv"/><pci class="AHCI" /></policy>
</config>
</start>}
append_platform_drv_config
append_if $use_ahci_drv config {
<start name="ahci_drv">
@ -134,11 +110,11 @@ set boot_modules {
test-libc_vfs
}
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec acpi] boot_modules acpi_drv
lappend_if $use_ahci_drv boot_modules ahci_drv
lappend_if $use_sd_card_drv boot_modules sd_card_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
#

View File

@ -1,10 +1,15 @@
build {
set build_components {
core init
drivers/timer
app/mupdf
drivers/framebuffer drivers/pci drivers/input
drivers/framebuffer drivers/input
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
set config {
@ -36,11 +41,7 @@ append_if [have_spec sdl] config {
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv">
@ -98,10 +99,11 @@ set boot_modules {
}
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -m 768"

View File

@ -6,9 +6,12 @@ set build_components {
core init
drivers/timer
test/sdl
drivers/framebuffer drivers/pci drivers/input
drivers/framebuffer drivers/input
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
@ -45,11 +48,7 @@ append_if [have_spec sdl] config {
</provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv">
@ -94,10 +93,11 @@ set boot_modules {
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -m 256 "

View File

@ -4,13 +4,16 @@
set build_components {
core init
drivers/timer drivers/pci drivers/nic
drivers/timer drivers/nic
server/nic_bridge
test/lwip/http_srv_static
test/lwip/http_clnt
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
@ -38,12 +41,7 @@ append config {
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_platform_drv_config
append config {
<start name="timer">
@ -112,9 +110,10 @@ set boot_modules {
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -m 512 "

View File

@ -4,13 +4,16 @@
set build_components {
core init
drivers/timer drivers/input drivers/pci drivers/nic
drivers/timer drivers/input drivers/nic
server/nic_bridge
app/lighttpd
test/lwip/http_clnt
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
@ -38,12 +41,7 @@ append config {
<any-service> <parent/> <any-child/> </any-service>
</default-route>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="PCI"/></provides>
</start>}
append_platform_drv_config
append config {
<start name="timer">
@ -155,9 +153,10 @@ set boot_modules {
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
append qemu_args " -m 512 "

View File

@ -15,14 +15,16 @@ if {[have_spec hw_odroid_xu]} {
set build_components {
core init
drivers/pci drivers/timer drivers/nic
drivers/timer drivers/nic
test/lwip/pingpong/client
}
lappend_if [expr [have_spec omap4] || [have_spec platform_arndale]] build_components drivers/usb
lappend_if [have_spec platform_arndale] build_components drivers/platform
lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
@ -54,12 +56,6 @@ set config {
<provides> <service name="Timer"/> </provides>
</start> }
append_if [have_spec platform_arndale] config {
<start name="platform_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Regulator"/></provides>
</start>}
append_if [have_spec gpio] config {
<start name="gpio_drv">
<resource name="RAM" quantum="4M"/>
@ -84,11 +80,7 @@ append_if [expr ![have_spec omap4] && ![have_spec platform_arndale]] config {
<provides><service name="Nic"/></provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="2M"/>
<provides> <service name="PCI"/> </provides>
</start> }
append_platform_drv_config
# establish serial connection with the server system
spawn picocom -b 115200 /dev/ttyUSB0
@ -143,12 +135,12 @@ set boot_modules {
}
# platform-specific modules
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [expr [have_spec omap4] || [have_spec platform_arndale]] boot_modules usb_drv
lappend_if [expr ![have_spec omap4] && ![have_spec platform_arndale]] boot_modules nic_drv
lappend_if [have_spec platform_arndale] boot_modules platform_drv
lappend_if [have_spec gpio] boot_modules gpio_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
#

View File

@ -15,14 +15,16 @@ if {[have_spec hw_odroid_xu]} {
set build_components {
core init
drivers/pci drivers/timer drivers/nic
drivers/timer drivers/nic
test/lwip/pingpong/server
}
lappend_if [expr [have_spec omap4] || [have_spec platform_arndale]] build_components drivers/usb
lappend_if [have_spec platform_arndale] build_components drivers/platform
lappend_if [have_spec gpio] build_components drivers/gpio
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
@ -63,12 +65,6 @@ set config {
</config>
</start> }
append_if [have_spec platform_arndale] config {
<start name="platform_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Regulator"/></provides>
</start>}
append_if [have_spec gpio] config {
<start name="gpio_drv">
<resource name="RAM" quantum="4M"/>
@ -93,11 +89,7 @@ append_if [expr ![have_spec omap4] && ![have_spec platform_arndale]] config {
<provides><service name="Nic"/></provides>
</start>}
append_if [have_spec pci] config {
<start name="pci_drv">
<resource name="RAM" quantum="2M"/>
<provides> <service name="PCI"/> </provides>
</start> }
append_platform_drv_config
append config {
</config>
@ -117,12 +109,12 @@ set boot_modules {
}
# platform-specific modules
lappend_if [have_spec pci] boot_modules pci_drv
lappend_if [expr [have_spec omap4] || [have_spec platform_arndale]] boot_modules usb_drv
lappend_if [expr ![have_spec omap4] && ![have_spec platform_arndale]] boot_modules nic_drv
lappend_if [have_spec platform_arndale] boot_modules platform_drv
lappend_if [have_spec gpio] boot_modules gpio_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
#

View File

@ -30,8 +30,8 @@ static const bool verbose = false;
** PCI virtualization **
************************/
#include <pci_session/connection.h>
#include <pci_device/client.h>
#include <platform_session/connection.h>
#include <platform_device/client.h>
enum {
PCI_ADDR_REG = 0xcf8,
@ -42,22 +42,22 @@ class Pci_card
{
private:
Pci::Connection _pci_drv;
Pci::Device_client _device;
Platform::Connection _pci_drv;
Platform::Device_client _device;
unsigned short _devfn;
Pci::Device_capability _find_vga_card()
Platform::Device_capability _find_vga_card()
{
/*
* Iterate through all accessible devices.
*/
Pci::Device_capability prev_device_cap, device_cap;
Platform::Device_capability prev_device_cap, device_cap;
Genode::env()->parent()->upgrade(_pci_drv.cap(), "ram_quota=4096");
for (device_cap = _pci_drv.first_device();
device_cap.valid();
device_cap = _pci_drv.next_device(prev_device_cap)) {
Pci::Device_client device(device_cap);
Platform::Device_client device(device_cap);
if (prev_device_cap.valid())
_pci_drv.release_device(prev_device_cap);
@ -93,7 +93,7 @@ class Pci_card
PDBG("Found PCI VGA at %x:%x.%x", bus, dev, fn);
}
Pci::Device_client &device() { return _device; }
Platform::Device_client &device() { return _device; }
unsigned short devfn() const { return _devfn; }
};
@ -190,7 +190,7 @@ static bool handle_pci_port_read(unsigned short port, T *val)
case 4: /* status and command */
case 8: /* class code / revision ID */
raw_val = pci_card()->device().config_read(pci_cfg_addr,
Pci::Device::ACCESS_32BIT);
Platform::Device::ACCESS_32BIT);
break;
case 0x10: /* base address register 0 */
@ -201,8 +201,8 @@ static bool handle_pci_port_read(unsigned short port, T *val)
case 0x24: /* base address register 5 */
{
unsigned bar = (pci_cfg_addr - 0x10) / 4;
Pci::Device::Resource res = pci_card()->device().resource(bar);
if (res.type() == Pci::Device::Resource::INVALID) {
Platform::Device::Resource res = pci_card()->device().resource(bar);
if (res.type() == Platform::Device::Resource::INVALID) {
PWRN("requested PCI resource 0x%x invalid", bar);
*val = 0;
return true;

View File

@ -21,7 +21,7 @@
#include <io_port_session/connection.h>
#include <io_mem_session/connection.h>
#include <pci_session/connection.h>
#include <platform_session/connection.h>
#include "ifx86emu.h"
#include "framebuffer.h"
@ -512,7 +512,7 @@ int X86emu::init(void)
* concurrently accesses by this driver and the Acpi/Pci driver to the
* graphic device (PCI config space).
*/
Pci::Connection conn;
Platform::Connection conn;
if (map_code_area())
return -1;