diff --git a/repos/base/mk/spec-x86_32.mk b/repos/base/mk/spec-x86_32.mk index f93ba98b87..af7dd40225 100644 --- a/repos/base/mk/spec-x86_32.mk +++ b/repos/base/mk/spec-x86_32.mk @@ -8,6 +8,7 @@ SPECS += x86 32bit # REP_INC_DIR += include/x86 REP_INC_DIR += include/x86_32 +REP_INC_DIR += include/platform/x86 # # x86-specific flags diff --git a/repos/base/mk/spec-x86_64.mk b/repos/base/mk/spec-x86_64.mk index 9099190c96..5569761ec5 100644 --- a/repos/base/mk/spec-x86_64.mk +++ b/repos/base/mk/spec-x86_64.mk @@ -8,6 +8,7 @@ SPECS += x86 64bit # REP_INC_DIR += include/x86 REP_INC_DIR += include/x86_64 +REP_INC_DIR += include/platform/x86 CC_MARCH ?= -m64 diff --git a/repos/base/run/platform_drv.inc b/repos/base/run/platform_drv.inc index 24aaa7b6ed..436769466a 100644 --- a/repos/base/run/platform_drv.inc +++ b/repos/base/run/platform_drv.inc @@ -1,5 +1,8 @@ proc have_platform_drv {} { - return [expr [have_spec platform_arndale] || [have_spec platform_imx53] || [have_spec platform_rpi]] + if {[have_spec linux]} { + return 0 + } + return [expr [have_spec platform_arndale] || [have_spec platform_imx53] || [have_spec platform_rpi] || [have_spec x86]] } proc append_platform_drv_build_components {} { @@ -8,7 +11,7 @@ proc append_platform_drv_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 pci] build_components drivers/pci + lappend_if [have_spec nova] build_components drivers/platform/x86/device_pd } proc append_platform_drv_boot_modules {} { @@ -17,19 +20,22 @@ proc append_platform_drv_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 pci] boot_modules pci_drv - lappend_if [have_spec nova] boot_modules pci_device_pd + lappend_if [have_spec nova] boot_modules device_pd } proc platform_drv_policy {} { - return { + if ([have_spec x86]) { + return { } + } else { + return {} + } } proc platform_drv_priority {} { return "" } @@ -37,18 +43,6 @@ proc platform_drv_priority {} { return "" } proc append_platform_drv_config {} { global config - if {[have_platform_drv]} { - append config { - - - - - - - } - - } - if {[have_spec acpi]} { append config " @@ -75,7 +69,7 @@ proc append_platform_drv_config {} { - + @@ -87,28 +81,36 @@ proc append_platform_drv_config {} { } - if {[have_spec pci]} { + if {[have_platform_drv]} { append config " - " + " append config { - + + } + + append_if [have_spec arm] config { + } + + append config { + } - if {[have_spec acpi]} { - append config { + append_if [have_spec acpi] config { } - } + + append_if [have_spec platform_rpi] config { + } append config { } - if {[have_spec acpi]} { + if {[have_spec acpi] || [have_spec arm]} { append config { } diff --git a/repos/dde_bsd/run/audio_out.run b/repos/dde_bsd/run/audio_out.run index 3ca1d79122..f65300604c 100644 --- a/repos/dde_bsd/run/audio_out.run +++ b/repos/dde_bsd/run/audio_out.run @@ -20,14 +20,14 @@ set build_components { core init drivers/timer drivers/audio_out - drivers/pci test/audio_out } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci/device_pd lappend_if $use_mixer build_components server/mixer +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components create_boot_directory @@ -59,36 +59,7 @@ append config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - - - - - - } +append_platform_drv_config append_if $use_mixer config { @@ -150,10 +121,7 @@ set boot_modules { lappend_if $use_mixer boot_modules mixer -# platform-specific modules -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/dde_bsd/src/lib/audio/bus.cc b/repos/dde_bsd/src/lib/audio/bus.cc index af70d62747..8a8548219c 100644 --- a/repos/dde_bsd/src/lib/audio/bus.cc +++ b/repos/dde_bsd/src/lib/audio/bus.cc @@ -17,8 +17,8 @@ #include #include #include -#include -#include +#include +#include /* local includes */ #include "bsd.h" @@ -43,8 +43,8 @@ class Pci_driver : public Bsd::Bus_driver struct pci_attach_args _pa { 0, 0, 0, 0, 0 }; - Pci::Connection _pci; - Pci::Device_capability _cap; + Platform::Connection _pci; + Platform::Device_capability _cap; Genode::Io_port_connection *_io_port { nullptr }; @@ -104,9 +104,9 @@ class Pci_driver : public Bsd::Bus_driver /** * Scan pci bus for sound devices */ - Pci::Device_capability _scan_pci(Pci::Device_capability const &prev) + Platform::Device_capability _scan_pci(Platform::Device_capability const &prev) { - Pci::Device_capability cap; + Platform::Device_capability cap; /* shift values for Pci interface used by Genode */ cap = _pci.next_device(prev, PCI_CLASS_MULTIMEDIA << 16, PCI_CLASS_MASK << 16); @@ -133,9 +133,9 @@ class Pci_driver : public Bsd::Bus_driver Pci_driver() : _dma_region_manager(*Genode::env()->heap(), *this) { } - Pci::Device_capability cap() { return _cap; } + Platform::Device_capability cap() { return _cap; } - Pci::Connection &pci() { return _pci; } + Platform::Connection &pci() { return _pci; } int probe() { @@ -150,7 +150,7 @@ class Pci_driver : public Bsd::Bus_driver int found = 0; while ((_cap = _scan_pci(_cap)).valid()) { - Pci::Device_client device(_cap); + Platform::Device_client device(_cap); uint8_t bus, dev, func; device.bus_address(&bus, &dev, &func); @@ -181,7 +181,7 @@ class Pci_driver : public Bsd::Bus_driver **************************/ Genode::Irq_session_capability irq_session() override { - return Pci::Device_client(_cap).irq(0); } + return Platform::Device_client(_cap).irq(0); } Genode::addr_t alloc(Genode::size_t size, int align) override { return _dma_region_manager.alloc(size, align); } @@ -326,26 +326,26 @@ extern "C" int pci_mapreg_map(struct pci_attach_args *pa, Pci_driver *drv = (Pci_driver*)pa->pa_pc; - Pci::Device_capability cap = drv->cap(); - Pci::Device_client device(cap); - Pci::Device::Resource res = device.resource(r); + Platform::Device_capability cap = drv->cap(); + Platform::Device_client device(cap); + Platform::Device::Resource res = device.resource(r); switch (res.type()) { - case Pci::Device::Resource::IO: + case Platform::Device::Resource::IO: { Io_port *iop = new (Genode::env()->heap()) Io_port(res.base(), device.io_port(r)); *tagp = (Genode::addr_t) iop; break; } - case Pci::Device::Resource::MEMORY: + case Platform::Device::Resource::MEMORY: { Io_memory *iom = new (Genode::env()->heap()) Io_memory(res.base(), device.io_mem(r)); *tagp = (Genode::addr_t) iom; break; } - case Pci::Device::Resource::INVALID: + case Platform::Device::Resource::INVALID: { PERR("PCI resource type invalid"); return -1; @@ -360,8 +360,8 @@ extern "C" int pci_mapreg_map(struct pci_attach_args *pa, *sizep = maxsize > 0 && res.size() > maxsize ? maxsize : res.size(); /* enable bus master and I/O or memory bits */ - uint16_t cmd = device.config_read(Pci_driver::CMD, Pci::Device::ACCESS_16BIT); - if (res.type() == Pci::Device::Resource::IO) { + uint16_t cmd = device.config_read(Pci_driver::CMD, Platform::Device::ACCESS_16BIT); + if (res.type() == Platform::Device::Resource::IO) { cmd &= ~Pci_driver:: CMD_MEMORY; cmd |= Pci_driver::CMD_IO; } else { @@ -370,7 +370,7 @@ extern "C" int pci_mapreg_map(struct pci_attach_args *pa, } cmd |= Pci_driver::CMD_MASTER; - device.config_write(Pci_driver::CMD, cmd, Pci::Device::ACCESS_16BIT); + device.config_write(Pci_driver::CMD, cmd, Platform::Device::ACCESS_16BIT); return 0; } @@ -383,8 +383,8 @@ extern "C" int pci_mapreg_map(struct pci_attach_args *pa, extern "C" pcireg_t pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg) { Pci_driver *drv = (Pci_driver *)pc; - Pci::Device_client device(drv->cap()); - return device.config_read(reg, Pci::Device::ACCESS_32BIT); + Platform::Device_client device(drv->cap()); + return device.config_read(reg, Platform::Device::ACCESS_32BIT); } @@ -392,8 +392,8 @@ extern "C" void pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t val) { Pci_driver *drv = (Pci_driver *)pc; - Pci::Device_client device(drv->cap()); - return device.config_write(reg, val, Pci::Device::ACCESS_32BIT); + Platform::Device_client device(drv->cap()); + return device.config_write(reg, val, Platform::Device::ACCESS_32BIT); } diff --git a/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc b/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc index 7dd3f4664d..10ee742ae8 100644 --- a/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc +++ b/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc @@ -30,8 +30,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -124,9 +124,9 @@ struct Pci_driver CLASS_NETWORK = PCI_BASE_CLASS_NETWORK << 16 }; - Pci::Connection _pci; - Pci::Device_capability _cap; - Pci::Device_capability _last_cap; + Platform::Connection _pci; + Platform::Device_capability _cap; + Platform::Device_capability _last_cap; struct Region { @@ -135,21 +135,21 @@ struct Pci_driver } _region; template - Pci::Device::Access_size _access_size(T t) + Platform::Device::Access_size _access_size(T t) { switch (sizeof(T)) { case 1: - return Pci::Device::ACCESS_8BIT; + return Platform::Device::ACCESS_8BIT; case 2: - return Pci::Device::ACCESS_16BIT; + return Platform::Device::ACCESS_16BIT; default: - return Pci::Device::ACCESS_32BIT; + return Platform::Device::ACCESS_32BIT; } } void _bus_address(int *bus, int *dev, int *fun) { - Pci::Device_client client(_cap); + Platform::Device_client client(_cap); unsigned char b, d, f; client.bus_address(&b, &d, &f); @@ -164,14 +164,14 @@ struct Pci_driver template void config_read(unsigned int devfn, T *val) { - Pci::Device_client client(_cap); + Platform::Device_client client(_cap); *val = client.config_read(devfn, _access_size(*val)); } template void config_write(unsigned int devfn, T val) { - Pci::Device_client client(_cap); + Platform::Device_client client(_cap); client.config_write(devfn, val, _access_size(val)); } @@ -302,7 +302,7 @@ extern "C" int dde_interrupt_attach(void(*handler)(void *), void *priv) } try { - Pci::Device_client device(pci_drv()._cap); + Platform::Device_client device(pci_drv()._cap); _irq_handler = new (Genode::env()->heap()) Irq_handler(*_ep, device.irq(0), handler, priv); } catch (...) { return -1; } @@ -375,7 +375,7 @@ extern "C" void dde_request_io(dde_uint8_t virt_bar_ioport) sleep_forever(); } - Pci::Device_client device(pci_drv()._cap); + Platform::Device_client device(pci_drv()._cap); Io_port_session_capability cap = device.io_port(virt_bar_ioport); _io_port = new (env()->heap()) Io_port_session_client(cap); @@ -622,13 +622,13 @@ extern "C" int dde_request_iomem(dde_addr_t start, dde_addr_t *vaddr) Genode::sleep_forever(); } - Pci::Device_client device(pci_drv()._cap); + Platform::Device_client device(pci_drv()._cap); Genode::Io_mem_session_capability cap; Genode::uint8_t virt_iomem_bar = 0; - for (unsigned i = 0; i < Pci::Device::NUM_RESOURCES; i++) { - Pci::Device::Resource res = device.resource(i); - if (res.type() == Pci::Device::Resource::MEMORY) { + for (unsigned i = 0; i < Platform::Device::NUM_RESOURCES; i++) { + Platform::Device::Resource res = device.resource(i); + if (res.type() == Platform::Device::Resource::MEMORY) { if (res.base() == start) { cap = device.io_mem(virt_iomem_bar); break; diff --git a/repos/dde_linux/run/usb_net.run b/repos/dde_linux/run/usb_net.run index c30777b4b3..7fefb3ecc0 100644 --- a/repos/dde_linux/run/usb_net.run +++ b/repos/dde_linux/run/usb_net.run @@ -13,13 +13,13 @@ set build_components { core init - drivers/pci drivers/timer drivers/usb + drivers/timer drivers/usb test/lwip/http_srv } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci/device_pd -lappend_if [have_spec platform_arndale] build_components drivers/platform +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + lappend_if [have_spec gpio] build_components drivers/gpio build $build_components @@ -70,25 +70,7 @@ set config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [have_spec platform_arndale] config { - - - - } +append_platform_drv_config append_if [have_spec gpio] config { @@ -97,12 +79,6 @@ append_if [have_spec gpio] config { } -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } - append config { } @@ -120,10 +96,7 @@ set boot_modules { ld.lib.so libc.lib.so lwip.lib.so test-lwip_httpsrv } -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd -lappend_if [have_spec platform_arndale] boot_modules platform_drv +append_platform_drv_boot_modules lappend_if [have_spec gpio] boot_modules gpio_drv build_boot_image $boot_modules diff --git a/repos/dde_linux/run/usb_storage.run b/repos/dde_linux/run/usb_storage.run index 6a9e1298b6..de8d6bbe42 100644 --- a/repos/dde_linux/run/usb_storage.run +++ b/repos/dde_linux/run/usb_storage.run @@ -15,12 +15,11 @@ set build_components { test/blk/cli } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci -lappend_if [have_spec pci] build_components drivers/pci/device_pd -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 @@ -48,31 +47,7 @@ set config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } - -append_if [have_spec platform_arndale] config { - - - - } +append_platform_drv_config append_if [have_spec gpio] config { @@ -108,10 +83,7 @@ set boot_modules { core init timer usb_drv test-blk-cli } -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd -lappend_if [have_spec platform_arndale] boot_modules platform_drv +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/dde_linux/run/usb_terminal.run b/repos/dde_linux/run/usb_terminal.run index 484a809faa..ab0915d2c0 100644 --- a/repos/dde_linux/run/usb_terminal.run +++ b/repos/dde_linux/run/usb_terminal.run @@ -17,12 +17,11 @@ set build_components { test/terminal_echo } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci -lappend_if [have_spec pci] build_components drivers/pci/device_pd -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 @@ -50,12 +49,6 @@ append config { } -append_if [have_spec platform_arndale] config { - - - - } - append_if [have_spec gpio] config { @@ -63,25 +56,7 @@ append_if [have_spec gpio] config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append config { @@ -116,12 +91,10 @@ set boot_modules { usb_terminal } -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd -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 append qemu_args " -m 256 -nographic -usb -usbdevice host:$::env(USB_RAW_DEVICE) -nographic" diff --git a/repos/dde_linux/run/wifi.run b/repos/dde_linux/run/wifi.run index f046c24f75..0b496c5307 100644 --- a/repos/dde_linux/run/wifi.run +++ b/repos/dde_linux/run/wifi.run @@ -4,7 +4,7 @@ set build_components { core init - drivers/pci drivers/timer drivers/wifi + drivers/timer drivers/wifi drivers/rtc server/report_rom server/ram_fs @@ -12,11 +12,11 @@ set build_components { test/lwip/http_srv } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci/device_pd -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 @@ -105,38 +105,13 @@ set config { + } -append_if [have_spec acpi] config { - - - - - - - - - - - - - - - - - - - - } - -append_if [have_spec platform_arndale] config { - - - - } +append_platform_drv_config append_if [have_spec gpio] config { @@ -145,12 +120,6 @@ append_if [have_spec gpio] config { } -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } - append config { } @@ -183,12 +152,10 @@ set boot_modules { append boot_modules $firmware_modules -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd -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 run_genode_until forever diff --git a/repos/dde_linux/src/lib/usb/pci_driver.cc b/repos/dde_linux/src/lib/usb/pci_driver.cc index e11d827a51..da3492bd4a 100644 --- a/repos/dde_linux/src/lib/usb/pci_driver.cc +++ b/repos/dde_linux/src/lib/usb/pci_driver.cc @@ -19,8 +19,8 @@ /* Genode os includes */ #include -#include -#include +#include +#include #include /* Linux includes */ @@ -102,7 +102,7 @@ class Pci_driver : public Genode::List::Element private: pci_driver *_drv; /* Linux PCI driver */ - Pci::Device_capability _cap; /* PCI cap */ + Platform::Device_capability _cap; /* PCI cap */ pci_device_id const *_id; /* matched id for this driver */ Io_port _port; @@ -120,7 +120,7 @@ class Pci_driver : public Genode::List::Element */ void _setup_pci_device() { - using namespace Pci; + using namespace Platform; Device_client client(_cap); uint8_t bus, dev, func; @@ -195,16 +195,16 @@ class Pci_driver : public Genode::List::Element } template - Pci::Device::Access_size _access_size(T t) + Platform::Device::Access_size _access_size(T t) { switch (sizeof(T)) { case 1: - return Pci::Device::ACCESS_8BIT; + return Platform::Device::ACCESS_8BIT; case 2: - return Pci::Device::ACCESS_16BIT; + return Platform::Device::ACCESS_16BIT; default: - return Pci::Device::ACCESS_32BIT; + return Platform::Device::ACCESS_32BIT; } } @@ -216,7 +216,7 @@ class Pci_driver : public Genode::List::Element public: - Pci_driver(pci_driver *drv, Pci::Device_capability cap, + Pci_driver(pci_driver *drv, Platform::Device_capability cap, pci_device_id const * id) : _drv(drv), _cap(cap), _id(id), _dev(0) { @@ -240,14 +240,14 @@ class Pci_driver : public Genode::List::Element template void config_read(unsigned int devfn, T *val) { - Pci::Device_client client(_cap); + Platform::Device_client client(_cap); *val = client.config_read(devfn, _access_size(*val)); } template void config_write(unsigned int devfn, T val) { - Pci::Device_client client(_cap); + Platform::Device_client client(_cap); client.config_write(devfn, val, _access_size(val)); } @@ -257,7 +257,7 @@ class Pci_driver : public Genode::List::Element if (d->_dev && d->_dev->irq != irq) continue; - Pci::Device_client client(d->_cap); + Platform::Device_client client(d->_cap); return client.irq(0); } @@ -279,7 +279,7 @@ class Pci_driver : public Genode::List::Element if (bar >= PCI_ROM_RESOURCE) continue; - Pci::Device_client client(d->_cap); + Platform::Device_client client(d->_cap); return client.io_mem(bar); } @@ -346,7 +346,7 @@ struct Dma_object : Memory_object_base ** Linux interface ** *********************/ -static Pci::Connection pci; +static Platform::Connection pci; static Genode::Object_pool memory_pool; int pci_register_driver(struct pci_driver *drv) @@ -372,13 +372,13 @@ int pci_register_driver(struct pci_driver *drv) Genode::env()->parent()->upgrade(pci.cap(), "ram_quota=4096"); - Pci::Device_capability cap = pci.first_device(id->class_, - id->class_mask); + Platform::Device_capability cap = pci.first_device(id->class_, + id->class_mask); while (cap.valid()) { if (DEBUG_PCI) { uint8_t bus, dev, func; - Pci::Device_client client(cap); + Platform::Device_client client(cap); client.bus_address(&bus, &dev, &func); lx_log(DEBUG_PCI, "bus: %x dev: %x func: %x", bus, dev, func); } @@ -387,10 +387,10 @@ int pci_register_driver(struct pci_driver *drv) try { /* probe device */ pci_drv = new (env()->heap()) Pci_driver(drv, cap, id); - pci.on_destruction(Pci::Connection::KEEP_OPEN); + pci.on_destruction(Platform::Connection::KEEP_OPEN); found = true; - } catch (Pci::Device::Quota_exceeded) { + } catch (Platform::Device::Quota_exceeded) { Genode::env()->parent()->upgrade(pci.cap(), "ram_quota=4096"); continue; } catch (...) { @@ -398,11 +398,11 @@ int pci_register_driver(struct pci_driver *drv) pci_drv = 0; } - Pci::Device_capability free_up = cap; + Platform::Device_capability free_up = cap; try { cap = pci.next_device(cap, id->class_, id->class_mask); - } catch (Pci::Device::Quota_exceeded) { + } catch (Platform::Device::Quota_exceeded) { Genode::env()->parent()->upgrade(pci.cap(), "ram_quota=4096"); cap = pci.next_device(cap, id->class_, id->class_mask); } diff --git a/repos/dde_linux/src/lib/wifi/irq.cc b/repos/dde_linux/src/lib/wifi/irq.cc index ee8cfa050f..492bc1f1d2 100644 --- a/repos/dde_linux/src/lib/wifi/irq.cc +++ b/repos/dde_linux/src/lib/wifi/irq.cc @@ -17,7 +17,7 @@ #include #include #include -#include +#include /* local includes */ #include @@ -81,7 +81,7 @@ namespace Lx { static void run_irq(void *args); -extern "C" Pci::Device_capability pci_device_cap; +extern "C" Platform::Device_capability pci_device_cap; /** * Lx::Irq @@ -147,11 +147,11 @@ class Lx::Irq * Constructor */ Context(Server::Entrypoint &ep, unsigned irq, - Pci::Device_capability pci_dev) + Platform::Device_capability pci_dev) : _name(irq), _irq(irq), - _irq_sess(Pci::Device_client(pci_dev).irq(0)), + _irq_sess(Platform::Device_client(pci_dev).irq(0)), _task(run_irq, this, _name.name), _dispatcher(ep, *this, &Context::_handle) { diff --git a/repos/dde_linux/src/lib/wifi/pci_driver.cc b/repos/dde_linux/src/lib/wifi/pci_driver.cc index ad8cfc908d..8f54a6105f 100644 --- a/repos/dde_linux/src/lib/wifi/pci_driver.cc +++ b/repos/dde_linux/src/lib/wifi/pci_driver.cc @@ -15,8 +15,8 @@ /* Genode inludes */ #include #include -#include -#include +#include +#include #include /* local includes */ @@ -41,9 +41,9 @@ class Pci_driver { private: - pci_driver *_drv; /* Linux PCI driver */ - Pci::Device_capability _cap; /* PCI cap */ - pci_device_id const *_id; /* matched id for this driver */ + pci_driver *_drv; /* Linux PCI driver */ + Platform::Device_capability _cap; /* PCI cap */ + pci_device_id const *_id; /* matched id for this driver */ public: @@ -62,7 +62,7 @@ class Pci_driver */ bool _setup_pci_device() { - using namespace Pci; + using namespace Platform; Device_client client(_cap); if (client.device_id() != _id->device) @@ -159,22 +159,22 @@ class Pci_driver } template - Pci::Device::Access_size _access_size(T t) + Platform::Device::Access_size _access_size(T t) { switch (sizeof(T)) { case 1: - return Pci::Device::ACCESS_8BIT; + return Platform::Device::ACCESS_8BIT; case 2: - return Pci::Device::ACCESS_16BIT; + return Platform::Device::ACCESS_16BIT; default: - return Pci::Device::ACCESS_32BIT; + return Platform::Device::ACCESS_32BIT; } } public: - Pci_driver(pci_driver *drv, Pci::Device_capability cap, + Pci_driver(pci_driver *drv, Platform::Device_capability cap, pci_device_id const * id) : _drv(drv), _cap(cap), _id(id), _dev(0) { @@ -196,14 +196,14 @@ class Pci_driver template void config_read(unsigned int devfn, T *val) { - Pci::Device_client client(_cap); + Platform::Device_client client(_cap); *val = client.config_read(devfn, _access_size(*val)); } template void config_write(unsigned int devfn, T val) { - Pci::Device_client client(_cap); + Platform::Device_client client(_cap); client.config_write(devfn, val, _access_size(val)); } }; @@ -251,10 +251,10 @@ struct Dma_object : Memory_object_base ** Linux interface ** *********************/ -extern "C" { Pci::Device_capability pci_device_cap; } -static Pci::Connection *pci() +extern "C" { Platform::Device_capability pci_device_cap; } +static Platform::Connection *pci() { - static Pci::Connection _pci; + static Platform::Connection _pci; return &_pci; } static Genode::Object_pool memory_pool; @@ -287,7 +287,7 @@ extern "C" int pci_register_driver(struct pci_driver *drv) continue; } - Pci::Device_capability cap = pci()->first_device(PCI_CLASS_WIFI, + Platform::Device_capability cap = pci()->first_device(PCI_CLASS_WIFI, PCI_CLASS_MASK); while (cap.valid()) { @@ -297,10 +297,10 @@ extern "C" int pci_register_driver(struct pci_driver *drv) /* probe device */ pci_drv = new (env()->heap()) Pci_driver(drv, cap, id); - pci()->on_destruction(Pci::Connection::KEEP_OPEN); + pci()->on_destruction(Platform::Connection::KEEP_OPEN); found++; - } catch (Pci::Device::Quota_exceeded) { + } catch (Platform::Device::Quota_exceeded) { Genode::env()->parent()->upgrade(pci()->cap(), "ram_quota=4096"); continue; } catch (...) { @@ -311,7 +311,7 @@ extern "C" int pci_register_driver(struct pci_driver *drv) if (found) break; - Pci::Device_capability free_up = cap; + Platform::Device_capability free_up = cap; cap = pci()->next_device(cap, PCI_CLASS_WIFI, PCI_CLASS_MASK); if (!pci_drv) pci()->release_device(free_up); @@ -362,7 +362,7 @@ extern "C" void *pci_ioremap_bar(struct pci_dev *dev, int bar) Io_mem_session_client *io_mem; try { - Pci::Device_client device(pci_device_cap); + Platform::Device_client device(pci_device_cap); io_mem = new (env()->heap()) Io_mem_session_client(device.io_mem(device.phys_bar_to_virt(bar))); } catch (...) { PERR("Failed to request I/O memory: [%zx,%zx)", start, start + size); diff --git a/repos/gems/run/decorator_stress.run b/repos/gems/run/decorator_stress.run index 9fde724e43..d22300b954 100644 --- a/repos/gems/run/decorator_stress.run +++ b/repos/gems/run/decorator_stress.run @@ -13,14 +13,14 @@ set build_components { app/decorator server/nitpicker server/report_rom test/decorator_stress - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + lappend_if [have_spec usb] build_components drivers/usb lappend_if [have_spec gpio] build_components drivers/gpio -lappend_if [have_spec imx53] build_components drivers/platform -lappend_if [have_spec platform_arndale] build_components drivers/platform -lappend_if [have_spec platform_rpi] build_components drivers/platform build $build_components @@ -58,11 +58,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -77,26 +73,7 @@ append_if [have_spec gpio] config { } -append_if [have_spec platform_arndale] config { - - - - - } - -append_if [have_spec platform_rpi] config { - - - - - } - append_if [have_spec imx53] config { - - - - - @@ -129,6 +106,10 @@ append config { + + + + @@ -145,6 +126,10 @@ append config { + + + + @@ -157,6 +142,7 @@ append config { + @@ -180,15 +166,13 @@ set boot_modules { } # platform-specific modules +append_platform_drv_boot_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 lappend_if [have_spec framebuffer] boot_modules fb_drv lappend_if [have_spec usb] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv -lappend_if [have_spec imx53] boot_modules platform_drv -lappend_if [have_spec platform_arndale] boot_modules platform_drv -lappend_if [have_spec platform_rpi] boot_modules platform_drv lappend_if [have_spec imx53] boot_modules input_drv build_boot_image $boot_modules diff --git a/repos/gems/run/http_blk.run b/repos/gems/run/http_blk.run index 144c5d3475..e357f5b9fc 100644 --- a/repos/gems/run/http_blk.run +++ b/repos/gems/run/http_blk.run @@ -11,7 +11,6 @@ if {[have_spec hw_odroid_xu]} { set use_usb_driver [expr [have_spec omap4] || [have_spec platform_arndale] || [have_spec platform_rpi]] set use_nic_driver [expr !$use_usb_driver && ![have_spec platform_imx53]] -set use_platform_driver [expr [have_spec platform_arndale] || [have_spec platform_imx53] || [have_spec platform_rpi]] if {[expr !$use_usb_driver && !$use_nic_driver]} { puts "\n Run script is not supported on this platform. \n"; exit 0 } @@ -31,12 +30,11 @@ set build_components { # platform-specific modules lappend_if $use_usb_driver build_components drivers/usb lappend_if $use_nic_driver build_components drivers/nic -lappend_if $use_platform_driver build_components drivers/platform -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci -lappend_if [have_spec pci] build_components drivers/pci/device_pd 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 @@ -64,13 +62,6 @@ append config { } -append_if $use_platform_driver config { - - - - - } - append_if [have_spec gpio] config { @@ -95,25 +86,7 @@ append_if $use_nic_driver config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append config { @@ -139,6 +112,7 @@ append config { + @@ -186,6 +160,7 @@ mimetype.assign = ( + @@ -208,13 +183,11 @@ set boot_modules { } # platform-specific modules -lappend_if $use_platform_driver boot_modules platform_drv -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv lappend_if [have_spec gpio] boot_modules gpio_drv lappend_if $use_usb_driver boot_modules usb_drv lappend_if $use_nic_driver boot_modules nic_drv -lappend_if [have_spec nova] boot_modules pci_device_pd + +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/gems/run/launcher.run b/repos/gems/run/launcher.run index a643cae848..c2c0cd52a5 100644 --- a/repos/gems/run/launcher.run +++ b/repos/gems/run/launcher.run @@ -3,13 +3,16 @@ # set build_components { - core init drivers/timer drivers/framebuffer drivers/input drivers/pci + core init drivers/timer drivers/framebuffer drivers/input server/dynamic_rom server/nitpicker server/report_rom app/pointer app/menu_view app/scout app/launchpad app/launcher test/nitpicker server/nit_fader } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components create_boot_directory @@ -46,11 +49,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -89,6 +88,10 @@ append config { + + + + @@ -167,8 +170,9 @@ set boot_modules { } # platform-specific modules +append_platform_drv_boot_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 lappend_if [have_spec framebuffer] boot_modules fb_drv diff --git a/repos/gems/run/tcp_terminal.run b/repos/gems/run/tcp_terminal.run index 63bc43bd01..eec10f53d6 100644 --- a/repos/gems/run/tcp_terminal.run +++ b/repos/gems/run/tcp_terminal.run @@ -22,9 +22,8 @@ set build_components { test/terminal_echo } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci -lappend_if [have_spec pci] build_components drivers/pci/device_pd +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components build $build_components @@ -50,7 +49,7 @@ set config { - + @@ -67,33 +66,14 @@ set config { - + } -append_if [have_spec acpi] config { - - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append config { @@ -115,9 +95,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 -lappend_if [have_spec nova] boot_modules pci_device_pd +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/gems/run/terminal_echo.run b/repos/gems/run/terminal_echo.run index 9ed58c3eb5..72269f355f 100644 --- a/repos/gems/run/terminal_echo.run +++ b/repos/gems/run/terminal_echo.run @@ -1,9 +1,14 @@ -build { +set build_components { core init drivers/timer server/terminal test/terminal_echo - 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 append config { @@ -22,7 +27,7 @@ append config { - + } @@ -35,11 +40,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -85,10 +86,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 framebuffer] boot_modules fb_drv lappend_if [have_spec ps2] boot_modules ps2_drv +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/gems/run/terminal_log.run b/repos/gems/run/terminal_log.run index 3089c69772..70824feac4 100644 --- a/repos/gems/run/terminal_log.run +++ b/repos/gems/run/terminal_log.run @@ -4,13 +4,12 @@ # \date 2012-05-21 # -build { +set build_components { core init drivers/framebuffer drivers/input drivers/timer - drivers/pci server/nitpicker server/nit_fb server/terminal @@ -19,6 +18,12 @@ build { app/launchpad app/pointer } + +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + +build $build_components + create_boot_directory append config { @@ -40,7 +45,7 @@ append config { - + @@ -73,11 +78,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -86,8 +87,7 @@ append_if [have_spec framebuffer] config { } append_if [have_spec ps2] config { - - + } @@ -103,7 +103,7 @@ append_if [expr ! [have_spec sdl]] config { - + @@ -164,10 +164,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 " diff --git a/repos/gems/run/wm.run b/repos/gems/run/wm.run index 25e43df0b3..69f1974995 100644 --- a/repos/gems/run/wm.run +++ b/repos/gems/run/wm.run @@ -10,7 +10,7 @@ set build_components { drivers/timer server/wm app/decorator app/floating_window_layouter server/nitpicker app/pointer server/report_rom - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input test/nitpicker app/backdrop app/launchpad @@ -19,9 +19,9 @@ set build_components { lappend_if [have_spec usb] build_components drivers/usb lappend_if [have_spec gpio] build_components drivers/gpio -lappend_if [have_spec imx53] build_components drivers/platform -lappend_if [have_spec platform_arndale] build_components drivers/platform -lappend_if [have_spec platform_rpi] build_components drivers/platform + +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components build $build_components @@ -59,11 +59,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -78,26 +74,7 @@ append_if [have_spec gpio] config { } -append_if [have_spec platform_arndale] config { - - - - - } - -append_if [have_spec platform_rpi] config { - - - - - } - append_if [have_spec imx53] config { - - - - - @@ -241,15 +218,13 @@ set boot_modules { } # platform-specific modules +append_platform_drv_boot_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 lappend_if [have_spec framebuffer] boot_modules fb_drv lappend_if [have_spec usb] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv -lappend_if [have_spec imx53] boot_modules platform_drv -lappend_if [have_spec platform_arndale] boot_modules platform_drv -lappend_if [have_spec platform_rpi] boot_modules platform_drv lappend_if [have_spec imx53] boot_modules input_drv build_boot_image $boot_modules diff --git a/repos/libports/run/avplay.run b/repos/libports/run/avplay.run index 29ff969175..6a54c3ac48 100644 --- a/repos/libports/run/avplay.run +++ b/repos/libports/run/avplay.run @@ -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 { } -append_if [have_spec acpi] config { - - - - - - - - - - - - - - - - - - -} - -append_if [expr [have_spec pci] && ![have_spec acpi]] config { - - - - - - - - - - - -} +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -139,7 +111,7 @@ append config { - + @@ -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 diff --git a/repos/libports/run/eglgears.run b/repos/libports/run/eglgears.run index 0ba3c36214..d92dd1b768 100644 --- a/repos/libports/run/eglgears.run +++ b/repos/libports/run/eglgears.run @@ -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 { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -92,7 +88,7 @@ append config { - + @@ -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" diff --git a/repos/libports/run/http_srv_tracing.run b/repos/libports/run/http_srv_tracing.run index 3bfdb73f86..81c6076ed1 100644 --- a/repos/libports/run/http_srv_tracing.run +++ b/repos/libports/run/http_srv_tracing.run @@ -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 { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append 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 diff --git a/repos/libports/run/libc_block.run b/repos/libports/run/libc_block.run index 65b857289e..9220b52b6a 100644 --- a/repos/libports/run/libc_block.run +++ b/repos/libports/run/libc_block.run @@ -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 { - -} - -append_if [have_spec acpi] config { - - - - - - - - - - - } -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append_if $use_ahci_drv config { @@ -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 # diff --git a/repos/libports/run/libc_ffat_fs.run b/repos/libports/run/libc_ffat_fs.run index c6f24eecea..6050a9f595 100644 --- a/repos/libports/run/libc_ffat_fs.run +++ b/repos/libports/run/libc_ffat_fs.run @@ -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 { - -} - -append_if [have_spec acpi] config { - - - - - - - - - - - - - - } -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - - - - } +append_platform_drv_config append_if $use_ahci_drv config { @@ -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 # diff --git a/repos/libports/run/mupdf.run b/repos/libports/run/mupdf.run index 17bda29de9..5fe38ba835 100644 --- a/repos/libports/run/mupdf.run +++ b/repos/libports/run/mupdf.run @@ -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 { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -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" diff --git a/repos/libports/run/sdl.run b/repos/libports/run/sdl.run index e95951b132..3a6d69d10a 100644 --- a/repos/libports/run/sdl.run +++ b/repos/libports/run/sdl.run @@ -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 { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -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 " diff --git a/repos/libports/run/test-nicbridge_static.run b/repos/libports/run/test-nicbridge_static.run index 321281e211..3a88e7a508 100644 --- a/repos/libports/run/test-nicbridge_static.run +++ b/repos/libports/run/test-nicbridge_static.run @@ -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 { } -append_if [have_spec pci] config { - - - - } - +append_platform_drv_config append config { @@ -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 " diff --git a/repos/libports/run/test-nicbridge_static2.run b/repos/libports/run/test-nicbridge_static2.run index ef52e5b74b..486a968b9d 100644 --- a/repos/libports/run/test-nicbridge_static2.run +++ b/repos/libports/run/test-nicbridge_static2.run @@ -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 { } -append_if [have_spec pci] config { - - - - } - +append_platform_drv_config append config { @@ -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 " diff --git a/repos/libports/run/test-ping_client.run b/repos/libports/run/test-ping_client.run index 1ea1ebb991..243b0bb238 100644 --- a/repos/libports/run/test-ping_client.run +++ b/repos/libports/run/test-ping_client.run @@ -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 { } -append_if [have_spec platform_arndale] config { - - - - } - append_if [have_spec gpio] config { @@ -84,11 +80,7 @@ append_if [expr ![have_spec omap4] && ![have_spec platform_arndale]] config { } -append_if [have_spec pci] config { - - - - } +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 # diff --git a/repos/libports/run/test-ping_server.run b/repos/libports/run/test-ping_server.run index 5962820b8d..fb446f9dd0 100644 --- a/repos/libports/run/test-ping_server.run +++ b/repos/libports/run/test-ping_server.run @@ -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 { } -append_if [have_spec platform_arndale] config { - - - - } - append_if [have_spec gpio] config { @@ -93,11 +89,7 @@ append_if [expr ![have_spec omap4] && ![have_spec platform_arndale]] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append 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 # diff --git a/repos/libports/src/drivers/framebuffer/vesa/hw_emul.cc b/repos/libports/src/drivers/framebuffer/vesa/hw_emul.cc index 0c4565fee0..05e90a354b 100644 --- a/repos/libports/src/drivers/framebuffer/vesa/hw_emul.cc +++ b/repos/libports/src/drivers/framebuffer/vesa/hw_emul.cc @@ -30,8 +30,8 @@ static const bool verbose = false; ** PCI virtualization ** ************************/ -#include -#include +#include +#include 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; diff --git a/repos/libports/src/drivers/framebuffer/vesa/ifx86emu.cc b/repos/libports/src/drivers/framebuffer/vesa/ifx86emu.cc index a8214ba2b5..5d12bf0de1 100644 --- a/repos/libports/src/drivers/framebuffer/vesa/ifx86emu.cc +++ b/repos/libports/src/drivers/framebuffer/vesa/ifx86emu.cc @@ -21,7 +21,7 @@ #include #include -#include +#include #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; diff --git a/repos/os/include/pci_session/capability.h b/repos/os/include/pci_session/capability.h deleted file mode 100644 index a5116db16f..0000000000 --- a/repos/os/include/pci_session/capability.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * \brief PCI session capability type - * \author Norman Feske - * \date 2008-08-16 - */ - -/* - * Copyright (C) 2008-2013 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _INCLUDE__PCI_SESSION__CAPABILITY_H_ -#define _INCLUDE__PCI_SESSION__CAPABILITY_H_ - -#include -#include - -namespace Pci { typedef Genode::Capability Session_capability; } - -#endif /* _INCLUDE__PCI_SESSION__CAPABILITY_H_ */ diff --git a/repos/os/include/pci_session/connection.h b/repos/os/include/pci_session/connection.h deleted file mode 100644 index 876faf30ff..0000000000 --- a/repos/os/include/pci_session/connection.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * \brief Connection to PCI service - * \author Norman Feske - * \date 2008-08-22 - */ - -/* - * Copyright (C) 2008-2013 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU General Public License version 2. - */ - -#ifndef _INCLUDE__PCI_SESSION__CONNECTION_H_ -#define _INCLUDE__PCI_SESSION__CONNECTION_H_ - -#include -#include - -namespace Pci { struct Connection; } - - -struct Pci::Connection : Genode::Connection, Session_client -{ - Connection() - : - Genode::Connection(session("ram_quota=12K")), - Session_client(cap()) - { } -}; - -#endif /* _INCLUDE__PCI_SESSION__CONNECTION_H_ */ diff --git a/repos/os/include/platform/device.h b/repos/os/include/platform/device.h index b58228d81d..f462e2b6e5 100644 --- a/repos/os/include/platform/device.h +++ b/repos/os/include/platform/device.h @@ -16,9 +16,9 @@ #include #include -namespace Platform { class Device; } +namespace Platform { class Abstract_device; } -struct Platform::Device +struct Platform::Abstract_device { /** * Get IRQ session capability diff --git a/repos/os/include/pci_device/capability.h b/repos/os/include/platform/x86/platform_device/capability.h similarity index 56% rename from repos/os/include/pci_device/capability.h rename to repos/os/include/platform/x86/platform_device/capability.h index b69ff0c37c..d84d6cf344 100644 --- a/repos/os/include/pci_device/capability.h +++ b/repos/os/include/platform/x86/platform_device/capability.h @@ -11,12 +11,9 @@ * under the terms of the GNU General Public License version 2. */ -#ifndef _INCLUDE__PCI_DEVICE__CAPABILITY_H_ -#define _INCLUDE__PCI_DEVICE__CAPABILITY_H_ +#pragma once #include -#include +#include -namespace Pci { typedef Genode::Capability Device_capability; } - -#endif /* _INCLUDE__PCI_DEVICE__CAPABILITY_H_ */ +namespace Platform { typedef Genode::Capability Device_capability; } diff --git a/repos/os/include/pci_device/client.h b/repos/os/include/platform/x86/platform_device/client.h similarity index 83% rename from repos/os/include/pci_device/client.h rename to repos/os/include/platform/x86/platform_device/client.h index 7c0918c5e3..eb336664cc 100644 --- a/repos/os/include/pci_device/client.h +++ b/repos/os/include/platform/x86/platform_device/client.h @@ -11,18 +11,17 @@ * under the terms of the GNU General Public License version 2. */ -#ifndef _INCLUDE__PCI_DEVICE__CLIENT_H_ -#define _INCLUDE__PCI_DEVICE__CLIENT_H_ +#pragma once -#include -#include +#include +#include #include #include -namespace Pci { struct Device_client; } +namespace Platform { struct Device_client; } -struct Pci::Device_client : public Genode::Rpc_client +struct Platform::Device_client : public Genode::Rpc_client { Device_client(Device_capability device) : Genode::Rpc_client(device) { } @@ -57,5 +56,3 @@ struct Pci::Device_client : public Genode::Rpc_client Genode::Io_mem_session_capability io_mem(Genode::uint8_t id) override { return call(id); } }; - -#endif /* _INCLUDE__PCI_DEVICE__CLIENT_H_ */ diff --git a/repos/os/include/pci_device/pci_device.h b/repos/os/include/platform/x86/platform_device/platform_device.h similarity index 97% rename from repos/os/include/pci_device/pci_device.h rename to repos/os/include/platform/x86/platform_device/platform_device.h index 045f890efb..7dbead2d59 100644 --- a/repos/os/include/pci_device/pci_device.h +++ b/repos/os/include/platform/x86/platform_device/platform_device.h @@ -11,8 +11,7 @@ * under the terms of the GNU General Public License version 2. */ -#ifndef _INCLUDE__PCI_DEVICE__PCI_DEVICE_H_ -#define _INCLUDE__PCI_DEVICE__PCI_DEVICE_H_ +#pragma once #include #include @@ -26,10 +25,10 @@ #include -namespace Pci { struct Device; } +namespace Platform { struct Device; } -struct Pci::Device : Platform::Device +struct Platform::Device : Platform::Abstract_device { /********************* ** Exception types ** @@ -258,5 +257,3 @@ struct Pci::Device : Platform::Device Genode::Meta::Empty> > > > > > > > > > Rpc_functions; }; - -#endif /* _INCLUDE__PCI_DEVICE__PCI_DEVICE_H_ */ diff --git a/repos/os/include/pci_session/client.h b/repos/os/include/platform/x86/platform_session/client.h similarity index 80% rename from repos/os/include/pci_session/client.h rename to repos/os/include/platform/x86/platform_session/client.h index d0117fd5ba..b92e362a61 100644 --- a/repos/os/include/pci_session/client.h +++ b/repos/os/include/platform/x86/platform_session/client.h @@ -11,20 +11,19 @@ * under the terms of the GNU General Public License version 2. */ -#ifndef _INCLUDE__PCI_SESSION__CLIENT_H_ -#define _INCLUDE__PCI_SESSION__CLIENT_H_ +#pragma once #include -#include -#include +#include +#include -namespace Pci { struct Session_client; } +namespace Platform { struct Client; } -struct Pci::Session_client : public Genode::Rpc_client +struct Platform::Client : public Genode::Rpc_client { - Session_client(Session_capability session) + Client(Session_capability session) : Genode::Rpc_client(session) { } Device_capability first_device(unsigned device_class = 0, @@ -51,5 +50,3 @@ struct Pci::Session_client : public Genode::Rpc_client Device_capability device(String const &device) override { return call(device); } }; - -#endif /* _INCLUDE__PCI_SESSION__CLIENT_H_ */ diff --git a/repos/os/include/platform/x86/platform_session/connection.h b/repos/os/include/platform/x86/platform_session/connection.h new file mode 100644 index 0000000000..4652a8852a --- /dev/null +++ b/repos/os/include/platform/x86/platform_session/connection.h @@ -0,0 +1,29 @@ +/* + * \brief Connection to Platform service + * \author Norman Feske + * \date 2008-08-22 + */ + +/* + * Copyright (C) 2008-2015 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#pragma once + +#include +#include + +namespace Platform { struct Connection; } + + +struct Platform::Connection : Genode::Connection, Client +{ + Connection() + : + Genode::Connection(session("ram_quota=12K")), + Client(cap()) + { } +}; diff --git a/repos/os/include/pci_session/pci_session.h b/repos/os/include/platform/x86/platform_session/platform_session.h similarity index 78% rename from repos/os/include/pci_session/pci_session.h rename to repos/os/include/platform/x86/platform_session/platform_session.h index e4c3377100..6a9d9f6aed 100644 --- a/repos/os/include/pci_session/pci_session.h +++ b/repos/os/include/platform/x86/platform_session/platform_session.h @@ -1,5 +1,5 @@ /* - * \brief PCI session interface + * \brief Platform session interface * \author Norman Feske * \date 2008-01-28 */ @@ -11,27 +11,22 @@ * under the terms of the GNU General Public License version 2. */ -#ifndef _INCLUDE__PCI_SESSION__PCI_SESSION_H_ -#define _INCLUDE__PCI_SESSION__PCI_SESSION_H_ +#pragma once /* base */ #include #include /* os */ -#include +#include +#include -namespace Pci { - - typedef Genode::Capability Device_capability; - - struct Session; -} +namespace Platform { struct Session; } -struct Pci::Session : Genode::Session +struct Platform::Session : Genode::Session { - static const char *service_name() { return "PCI"; } + static const char *service_name() { return "Platform"; } virtual ~Session() { } @@ -87,24 +82,24 @@ struct Pci::Session : Genode::Session *********************/ GENODE_RPC_THROW(Rpc_first_device, Device_capability, first_device, - GENODE_TYPE_LIST(Pci::Device::Quota_exceeded), + GENODE_TYPE_LIST(Platform::Device::Quota_exceeded), unsigned, unsigned); GENODE_RPC_THROW(Rpc_next_device, Device_capability, next_device, - GENODE_TYPE_LIST(Pci::Device::Quota_exceeded), + GENODE_TYPE_LIST(Platform::Device::Quota_exceeded), Device_capability, unsigned, unsigned); GENODE_RPC(Rpc_release_device, void, release_device, Device_capability); GENODE_RPC_THROW(Rpc_config_extended, Genode::Io_mem_dataspace_capability, config_extended, - GENODE_TYPE_LIST(Pci::Device::Quota_exceeded), + GENODE_TYPE_LIST(Platform::Device::Quota_exceeded), Device_capability); GENODE_RPC_THROW(Rpc_alloc_dma_buffer, Genode::Ram_dataspace_capability, alloc_dma_buffer, - GENODE_TYPE_LIST(Pci::Device::Quota_exceeded), + GENODE_TYPE_LIST(Platform::Device::Quota_exceeded), Genode::size_t); GENODE_RPC(Rpc_free_dma_buffer, void, free_dma_buffer, Genode::Ram_dataspace_capability); GENODE_RPC_THROW(Rpc_device, Device_capability, device, - GENODE_TYPE_LIST(Pci::Device::Quota_exceeded), + GENODE_TYPE_LIST(Platform::Device::Quota_exceeded), String const &); GENODE_RPC_INTERFACE(Rpc_first_device, Rpc_next_device, @@ -112,5 +107,3 @@ struct Pci::Session : Genode::Session Rpc_alloc_dma_buffer, Rpc_free_dma_buffer, Rpc_device); }; - -#endif /* _INCLUDE__PCI_SESSION__PCI_SESSION_H_ */ diff --git a/repos/os/run/ahci_bench.run b/repos/os/run/ahci_bench.run index 5f2fd5b840..f9e5bcfda2 100644 --- a/repos/os/run/ahci_bench.run +++ b/repos/os/run/ahci_bench.run @@ -13,8 +13,8 @@ set build_components { test/blk/bench } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components build $build_components # @@ -51,42 +51,11 @@ set config { } -append_if [expr ![have_spec acpi] && ![have_spec pci]] config { - - - - } -append_if [have_spec acpi] config { - - - - - - - - - - - - - - - -} - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - - - - } +append_platform_drv_config append config { - - + @@ -105,7 +74,7 @@ append config { - + @@ -119,10 +88,7 @@ install_config $config set boot_modules { core init timer ahci_drv test-blk-bench libc.lib.so ld.lib.so } -lappend_if [expr ![have_spec acpi] && ![have_spec pci]] boot_modules platform_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd -lappend_if [have_spec acpi] boot_modules acpi_drv +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/os/run/ahci_blk.run b/repos/os/run/ahci_blk.run index 98b386446a..1a20ba8c04 100644 --- a/repos/os/run/ahci_blk.run +++ b/repos/os/run/ahci_blk.run @@ -9,14 +9,14 @@ set build_components { core init drivers/timer drivers/ahci - drivers/platform test/blk/cli } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components build $build_components + # # Build EXT2-file-system image # @@ -49,44 +49,12 @@ set config { - -} -append_if [expr ![have_spec acpi] && ![have_spec pci]] config { - - - } -append_if [have_spec acpi] config { - - - - - - - - - - - - - - - -} - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - - - - } +append_platform_drv_config append config { - - + @@ -98,7 +66,7 @@ append config { - + @@ -111,10 +79,7 @@ install_config $config # set boot_modules { core init timer ahci_drv test-blk-cli } -lappend_if [expr ![have_spec acpi] && ![have_spec pci]] boot_modules platform_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd -lappend_if [have_spec acpi] boot_modules acpi_drv +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/os/run/demo.run b/repos/os/run/demo.run index 5fa5cb4c20..b0150e9274 100644 --- a/repos/os/run/demo.run +++ b/repos/os/run/demo.run @@ -127,6 +127,10 @@ append config { + + + + diff --git a/repos/os/run/framebuffer.run b/repos/os/run/framebuffer.run index da6507373e..39a8bcc11f 100644 --- a/repos/os/run/framebuffer.run +++ b/repos/os/run/framebuffer.run @@ -7,9 +7,8 @@ if {[have_spec hw_odroid_xu]} { set build_components { core init test/framebuffer drivers/framebuffer drivers/timer } -lappend_if [have_spec pci] build_components drivers/pci -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec platform_arndale] build_components drivers/platform +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components build $build_components @@ -52,25 +51,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -78,12 +59,6 @@ append_if [have_spec framebuffer] config { } -append_if [have_spec platform_arndale] config { - - - - } - append config { @@ -103,12 +78,10 @@ set boot_modules { } # platform-specific modules +append_platform_drv_boot_modules + lappend_if [have_spec sdl] boot_modules fb_sdl -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if [have_spec nova] boot_modules pci_device_pd -lappend_if [have_spec acpi] boot_modules acpi_drv lappend_if [have_spec framebuffer] boot_modules fb_drv -lappend_if [have_spec platform_arndale] boot_modules platform_drv build_boot_image $boot_modules diff --git a/repos/os/run/input.run b/repos/os/run/input.run index a00feeddd1..9c7fa2ddb2 100644 --- a/repos/os/run/input.run +++ b/repos/os/run/input.run @@ -65,7 +65,7 @@ append config { - + diff --git a/repos/os/run/loader.run b/repos/os/run/loader.run index eb4daaa301..6e3b4d1385 100644 --- a/repos/os/run/loader.run +++ b/repos/os/run/loader.run @@ -7,9 +7,12 @@ set build_components { drivers/timer server/nitpicker server/loader test/nitpicker test/loader - 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 @@ -37,6 +40,8 @@ append config { } +append_platform_drv_config + append_if [have_spec sdl] config { @@ -46,12 +51,6 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } - append_if [have_spec framebuffer] config { @@ -96,10 +95,11 @@ set boot_modules { core init timer nitpicker testnit loader test-loader } # 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 " diff --git a/repos/os/run/mixer.run b/repos/os/run/mixer.run index 2074b3a441..7fe2a93fea 100644 --- a/repos/os/run/mixer.run +++ b/repos/os/run/mixer.run @@ -11,11 +11,8 @@ set build_components { test/audio_out } -# platform-specific components -if {![have_spec linux]} { - lappend build_components drivers/pci - lappend build_components drivers/acpi -} +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components build $build_components create_boot_directory @@ -43,49 +40,13 @@ set config { - -} + } -if {![have_spec linux]} { - append config { - - - - - - - - - - - - - - - - - - - - - - - } -} +append_platform_drv_config append config { -} - -append_if [expr ![have_spec linux]] config { - - - - -} - -append config { @@ -137,10 +98,7 @@ set boot_modules { } # platform-specific components -if {![have_spec linux]} { - lappend boot_modules acpi_drv - lappend boot_modules pci_drv -} +append_platform_drv_boot_modules build_boot_image $boot_modules append qemu_args "-m 256 -soundhw es1370 -nographic" diff --git a/repos/os/src/drivers/acpi/README b/repos/os/src/drivers/acpi/README index df59a8fedb..c90e84a58e 100644 --- a/repos/os/src/drivers/acpi/README +++ b/repos/os/src/drivers/acpi/README @@ -5,50 +5,33 @@ Behavior This server should be used when using a kernel (like Fiasco.OC, Nova, base_hw x86_64) that takes advantage of x86's APIC. The server traverses the -ACPI tables and sets the interrupt line of devices within the PCI config space -to the GSIs found in the ACPI tables. The 'MADT' table is parsed by the server -as well, enabling clients to use the correct IRQ when 'Interrupt Override' -structures are found wihtin the table. +ACPI tables and reports the interrupt line of devices within the PCI config +space of GSIs found in the ACPI tables. The 'MADT' table is parsed by the +server as well, enabling clients to use the correct IRQ when +'Interrupt Override' structures are found within the table. All information +are reported to a report_rom service as "acpi" report. The report can be +consumed by any interested party, e.g. the platform driver. Please consult +the platform driver README for more details. Usage ----- -Start the 'acpi_drv' in your Genode environment. Do not start the 'pci_drv' -since this will be used as a slave of the 'acpi_drv'. You still must load the -'pci_drv' in your boot loader. - -Configuration snipped (please note that IRQ service requests of the 'timer' are -routed to the ACPI-driver): - ! -! -! -! -! -! -! -! -! -! -! -! -! -! +! ! ! -! -! -! -! -! -! -! +! +! +! +! +! +! +! +! +! +! +! ! - -The 'config' node on the 'acpi_drv' requires an policy entry that permits the -'acpi_drv' to iterate over all pci devices in order to rewrite the -interrupt numbers according to the 'MADT' table. Furthermore the whole 'config' -node will be passed on to the 'pci_drv' which obtains from it the required -policy for each client. Additionally the constrain_phys attribute is a -feature of init, which applies to the pci_drv. Please read the 'pci_drv' -README for more details. +! +! +! ... diff --git a/repos/os/src/drivers/ahci/x86/platform.cc b/repos/os/src/drivers/ahci/x86/platform.cc index 7228405262..272e4f3a4b 100644 --- a/repos/os/src/drivers/ahci/x86/platform.cc +++ b/repos/os/src/drivers/ahci/x86/platform.cc @@ -12,8 +12,8 @@ */ #include -#include -#include +#include +#include #include #include @@ -32,12 +32,12 @@ struct X86_hba : Platform::Hba PCI_CMD = 0x4, }; - Pci::Connection pci; - Pci::Device_capability pci_device_cap; - Lazy_volatile_object pci_device; - Lazy_volatile_object irq; - addr_t res_base; - size_t res_size; + Platform::Connection pci; + Platform::Device_capability pci_device_cap; + Lazy_volatile_object pci_device; + Lazy_volatile_object irq; + addr_t res_base; + size_t res_size; X86_hba() { @@ -49,7 +49,7 @@ struct X86_hba : Platform::Hba throw -1; } break; - } catch (Pci::Device::Quota_exceeded) { + } catch (Platform::Device::Quota_exceeded) { Genode::env()->parent()->upgrade(pci.cap(), "ram_quota=4096"); } @@ -60,7 +60,7 @@ struct X86_hba : Platform::Hba pci_device->device_id(), pci_device->class_code()); /* read base address of controller */ - Pci::Device::Resource resource = pci_device->resource(AHCI_BASE_ID); + Platform::Device::Resource resource = pci_device->resource(AHCI_BASE_ID); res_base = resource.base(); res_size = resource.size(); @@ -68,9 +68,9 @@ struct X86_hba : Platform::Hba PDBG("base: %lx size: %zx", res_base, res_size); /* enable bus master */ - uint16_t cmd = pci_device->config_read(PCI_CMD, Pci::Device::ACCESS_16BIT); + uint16_t cmd = pci_device->config_read(PCI_CMD, Platform::Device::ACCESS_16BIT); cmd |= 0x4; - pci_device->config_write(PCI_CMD, cmd, Pci::Device::ACCESS_16BIT); + pci_device->config_write(PCI_CMD, cmd, Platform::Device::ACCESS_16BIT); irq.construct(pci_device->irq(0)); } @@ -78,19 +78,19 @@ struct X86_hba : Platform::Hba void disable_msi() { enum { PM_CAP_OFF = 0x34, MSI_CAP = 0x5, MSI_ENABLED = 0x1 }; - uint8_t cap = pci_device->config_read(PM_CAP_OFF, ::Pci::Device::ACCESS_8BIT); + uint8_t cap = pci_device->config_read(PM_CAP_OFF, Platform::Device::ACCESS_8BIT); /* iterate through cap pointers */ for (uint16_t val = 0; cap; cap = val >> 8) { - val = pci_device->config_read(cap, ::Pci::Device::ACCESS_16BIT); + val = pci_device->config_read(cap, Platform::Device::ACCESS_16BIT); if ((val & 0xff) != MSI_CAP) continue; - uint16_t msi = pci_device->config_read(cap + 2, ::Pci::Device::ACCESS_16BIT); + uint16_t msi = pci_device->config_read(cap + 2, Platform::Device::ACCESS_16BIT); if (msi & MSI_ENABLED) { - pci_device->config_write(cap + 2, msi ^ MSI_CAP, ::Pci::Device::ACCESS_8BIT); + pci_device->config_write(cap + 2, msi ^ MSI_CAP, Platform::Device::ACCESS_8BIT); PINF("Disabled MSIs %x", msi); } } diff --git a/repos/os/src/drivers/input/ps2/x86/main.cc b/repos/os/src/drivers/input/ps2/x86/main.cc index 0ca5a57244..d06ff0fda6 100644 --- a/repos/os/src/drivers/input/ps2/x86/main.cc +++ b/repos/os/src/drivers/input/ps2/x86/main.cc @@ -20,7 +20,7 @@ #include #include #include -#include +#include /* local includes */ #include "i8042.h" @@ -38,8 +38,8 @@ struct Main Input::Session_component session; Input::Root_component root; - Pci::Connection platform; - Pci::Device_client device_ps2; + Platform::Connection platform; + Platform::Device_client device_ps2; I8042 i8042; diff --git a/repos/os/src/drivers/pci/README b/repos/os/src/drivers/platform/x86/README similarity index 67% rename from repos/os/src/drivers/pci/README rename to repos/os/src/drivers/platform/x86/README index 9ea33e078b..fd235f53f5 100644 --- a/repos/os/src/drivers/pci/README +++ b/repos/os/src/drivers/platform/x86/README @@ -1,4 +1,4 @@ -This directory contains the implementation of Genode's PCI driver. +This directory contains the implementation of Genode's x86 platform driver. Behavior -------- @@ -7,12 +7,13 @@ On startup the driver scans the PCI bus hierarchy and stores the found devices. Per client a policy must be configured that states which client can access certain devices to form a virtual pci bus per client. The client may iterate through the virtual pci bus using the 'first' and 'next' methods of -the pci_session interface to discover all available devices of the virtual bus. -Non PCI devices may be discovered by using 'device' of the pci_session -interface. As a result of the discovery a client obtains a device capability. +the platform_session interface to discover all available devices of the virtual +bus. Non PCI devices may be discovered by using 'device' of the +platform_session interface. As a result of the discovery a client obtains a +device capability. With the device capability the resources of the devices can be obtained, e.g. -io_port, io_mem and irq of the pci_device interface. +io_port, io_mem and irq of the platform_device interface. Policy usage ------------ @@ -21,7 +22,7 @@ A policy may contain several nodes describing several devices. The entries of a policy may describe PCI devices as non PCI devices. A PCI device is explicitly configured by the triple 'bus', 'device', 'function': -! +! ! ! ... ! @@ -30,11 +31,11 @@ explicitly configured by the triple 'bus', 'device', 'function': ! ! ! -! +! ... or more fuzzy by a device class alias: -! +! ! ! ... ! @@ -42,19 +43,19 @@ or more fuzzy by a device class alias: ! ! ! -! +! ... Non PCI devices, as the PS2 controller are named by a "device" node in the policy: -! +! ! ! ! ! +! ! ! ! ! ... ! ! -! +! ... The constrain_phys attribute is evaluated by init. If set to "yes" it -permits a component, the pci driver, to restrict the allocation of memory to -specific physical RAM ranges. The PCI driver uses this feature to ensure that +permits a component, the platform driver, to restrict the allocation of memory to +specific physical RAM ranges. The platform driver uses this feature to ensure that the allocation of DMA capable memory consider several restrictions. For example, some drivers, as the UHCI controller, requires a physical memory address below 4G. Another example is that on 32bit hosts physical to virtual identical mappings of DMA memory for the device_pd (required when IOMMU is used) must be below the kernel memory boundary (3G). +By default the platform driver waits on startup on a report of the acpi driver, +which conatins further information about the platform the platform driver can +not discover (e.g. IRQ re-routing information, pci config extended space +information). + +A specific route to a report_rom service named 'acpi_report_rom' looks as +in the following: + +! +! ... +! +! +! +! +! ... +! +! ... + +For platforms which don't support or require the ACPI information - +e.g. base-okl4, base-pistachio, base-fiasco - the platform driver can be +configured to not wait for the acpi report: + +! +! ... +! +! ... +! +! ... + Supported PCI class aliases --------------------------- @@ -108,7 +138,7 @@ Supported non PCI devices The driver provides for the PS2 controller the IO_PORT and IRQ resources. -! +! ! ! ! diff --git a/repos/os/src/drivers/pci/device_pd/main.cc b/repos/os/src/drivers/platform/x86/device_pd/main.cc similarity index 76% rename from repos/os/src/drivers/pci/device_pd/main.cc rename to repos/os/src/drivers/platform/x86/device_pd/main.cc index 2fac3bcf9c..13e298c566 100644 --- a/repos/os/src/drivers/pci/device_pd/main.cc +++ b/repos/os/src/drivers/platform/x86/device_pd/main.cc @@ -1,11 +1,11 @@ /* - * \brief Pci device protection domain service for pci_drv + * \brief Pci device protection domain service for platform driver * \author Alexander Boettcher * \date 2013-02-10 */ /* - * Copyright (C) 2013-2013 Genode Labs GmbH + * Copyright (C) 2013-2015 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. @@ -24,7 +24,7 @@ #include "../pci_device_pd_ipc.h" -void Pci::Device_pd_component::attach_dma_mem(Genode::Ram_dataspace_capability ds_cap) +void Platform::Device_pd_component::attach_dma_mem(Genode::Ram_dataspace_capability ds_cap) { using namespace Genode; @@ -52,7 +52,7 @@ void Pci::Device_pd_component::attach_dma_mem(Genode::Ram_dataspace_capability d touch_read(reinterpret_cast(page)); } -void Pci::Device_pd_component::assign_pci(Genode::Io_mem_dataspace_capability io_mem_cap) +void Platform::Device_pd_component::assign_pci(Genode::Io_mem_dataspace_capability io_mem_cap) { using namespace Genode; @@ -78,7 +78,7 @@ int main(int argc, char **argv) { using namespace Genode; - Genode::printf("PCI device pd starting ...\n"); + Genode::printf("Device protection domain starting ...\n"); /* * Initialize server entry point @@ -88,18 +88,18 @@ int main(int argc, char **argv) }; static Cap_connection cap; - static Rpc_entrypoint ep(&cap, STACK_SIZE, "pci_device_pd_ep"); + static Rpc_entrypoint ep(&cap, STACK_SIZE, "device_pd_ep"); - static Pci::Device_pd_component pci_device_component; + static Platform::Device_pd_component pd_component; /* * Attach input root interface to the entry point */ - static Static_root root(ep.manage(&pci_device_component)); + static Static_root root(ep.manage(&pd_component)); env()->parent()->announce(ep.manage(&root)); - printf("PCI device pd started\n"); + printf("Device protection domain started\n"); Genode::sleep_forever(); return 0; diff --git a/repos/os/src/drivers/pci/device_pd/target.mk b/repos/os/src/drivers/platform/x86/device_pd/target.mk similarity index 68% rename from repos/os/src/drivers/pci/device_pd/target.mk rename to repos/os/src/drivers/platform/x86/device_pd/target.mk index f3d0b4e9ea..e37f1cde61 100644 --- a/repos/os/src/drivers/pci/device_pd/target.mk +++ b/repos/os/src/drivers/platform/x86/device_pd/target.mk @@ -1,4 +1,4 @@ -TARGET = pci_device_pd +TARGET = device_pd SRC_CC = main.cc LIBS = base diff --git a/repos/os/src/drivers/pci/irq.cc b/repos/os/src/drivers/platform/x86/irq.cc similarity index 87% rename from repos/os/src/drivers/pci/irq.cc rename to repos/os/src/drivers/platform/x86/irq.cc index 2bcdceef28..043fc1a597 100644 --- a/repos/os/src/drivers/pci/irq.cc +++ b/repos/os/src/drivers/platform/x86/irq.cc @@ -1,5 +1,5 @@ /* - * \brief Implementation of shared IRQs in PCI driver + * \brief Implementation of shared IRQs in platform driver * \author Alexander Boettcher * \date 2015-03-27 */ @@ -18,12 +18,12 @@ /* Genode OS includes */ #include -/* PCI driver include */ +/* Platform driver include */ #include "irq.h" #include "pci_session_component.h" -namespace Pci { +namespace Platform { class Irq_component; class Irq_allocator; class Irq_thread; @@ -36,7 +36,7 @@ using Genode::addr_t; /** * A simple range allocator implementation used by the Irq_proxy */ -class Pci::Irq_allocator : public Genode::Range_allocator +class Platform::Irq_allocator : public Genode::Range_allocator { private: @@ -94,7 +94,7 @@ class Pci::Irq_allocator : public Genode::Range_allocator /** * Required by Irq_proxy if we would like to have a thread per IRQ, - * which we don't want to in the PCI driver - one thread is sufficient. + * which we don't want to in the platform driver - one thread is sufficient. */ class NoThread { @@ -109,7 +109,7 @@ class NoThread /** * Thread waiting for signals caused by IRQs */ -class Pci::Irq_thread : public Genode::Thread<4096> +class Platform::Irq_thread : public Genode::Thread<4096> { private: @@ -145,8 +145,8 @@ class Pci::Irq_thread : public Genode::Thread<4096> * One allocator for managing in use IRQ numbers and one IRQ thread waiting * for Genode signals of all hardware IRQs. */ -static Pci::Irq_allocator irq_alloc; -static Pci::Irq_thread irq_thread; +static Platform::Irq_allocator irq_alloc; +static Platform::Irq_thread irq_thread; /** @@ -154,12 +154,12 @@ static Pci::Irq_thread irq_thread; */ typedef Genode::Irq_proxy Proxy; -class Pci::Irq_component : public Proxy +class Platform::Irq_component : public Proxy { private: Genode::Irq_connection _irq; - Genode::Signal_dispatcher _irq_dispatcher; + Genode::Signal_dispatcher _irq_dispatcher; bool _associated; @@ -212,7 +212,7 @@ class Pci::Irq_component : public Proxy ** PCI IRQ session component ** *******************************/ -void Pci::Irq_session_component::ack_irq() +void Platform::Irq_session_component::ack_irq() { if (msi()) { Genode::Irq_session_client irq_msi(_irq_cap); @@ -232,8 +232,8 @@ void Pci::Irq_session_component::ack_irq() } -Pci::Irq_session_component::Irq_session_component(unsigned irq, - addr_t pci_config_space) +Platform::Irq_session_component::Irq_session_component(unsigned irq, + addr_t pci_config_space) : _gsi(irq) { @@ -269,7 +269,7 @@ Pci::Irq_session_component::Irq_session_component(unsigned irq, Genode::Irq_session::Trigger trigger; Genode::Irq_session::Polarity polarity; - _gsi = Pci::Irq_override::irq_override(_gsi, trigger, polarity); + _gsi = Platform::Irq_override::irq_override(_gsi, trigger, polarity); if (_gsi != irq || trigger != Genode::Irq_session::TRIGGER_UNCHANGED || polarity != Genode::Irq_session::POLARITY_UNCHANGED) PINF("IRQ override %u->%u trigger mode=%s polarity=%s", irq, _gsi, @@ -287,7 +287,7 @@ Pci::Irq_session_component::Irq_session_component(unsigned irq, } -Pci::Irq_session_component::~Irq_session_component() +Platform::Irq_session_component::~Irq_session_component() { if (msi()) { Genode::Irq_session_client irq_msi(_irq_cap); @@ -308,7 +308,7 @@ Pci::Irq_session_component::~Irq_session_component() } -void Pci::Irq_session_component::sigh(Genode::Signal_context_capability sigh) +void Platform::Irq_session_component::sigh(Genode::Signal_context_capability sigh) { if (msi()) { /* register signal handler for msi directly at parent */ @@ -336,12 +336,12 @@ void Pci::Irq_session_component::sigh(Genode::Signal_context_capability sigh) } -unsigned short Pci::Irq_routing::rewrite(unsigned char bus, unsigned char dev, +unsigned short Platform::Irq_routing::rewrite(unsigned char bus, unsigned char dev, unsigned char func, unsigned char pin) { for (Irq_routing *i = list()->first(); i; i = i->next()) if ((dev == i->_device) && (pin - 1 == i->_device_pin) && - (i->_bridge_bdf == Pci::bridge_bdf(bus))) + (i->_bridge_bdf == Platform::bridge_bdf(bus))) return i->_gsi; return 0; diff --git a/repos/os/src/drivers/pci/irq.h b/repos/os/src/drivers/platform/x86/irq.h similarity index 91% rename from repos/os/src/drivers/pci/irq.h rename to repos/os/src/drivers/platform/x86/irq.h index d73cfb5d96..429d598c3d 100644 --- a/repos/os/src/drivers/pci/irq.h +++ b/repos/os/src/drivers/platform/x86/irq.h @@ -20,19 +20,19 @@ #include #include -/* PCI local includes */ +/* platform local includes */ #include -namespace Pci { +namespace Platform { class Irq_session_component; class Irq_override; class Irq_routing; } -class Pci::Irq_session_component : public Genode::Rpc_object, - public Genode::List::Element +class Platform::Irq_session_component : public Genode::Rpc_object, + public Genode::List::Element { private: @@ -73,7 +73,7 @@ class Pci::Irq_session_component : public Genode::Rpc_object::Element +class Platform::Irq_override : public Genode::List::Element { private: @@ -151,7 +151,7 @@ class Pci::Irq_override : public Genode::List::Element /** * List that holds interrupt rewrite information */ -class Pci::Irq_routing : public Genode::List::Element +class Platform::Irq_routing : public Genode::List::Element { private: diff --git a/repos/os/src/drivers/pci/main.cc b/repos/os/src/drivers/platform/x86/main.cc similarity index 83% rename from repos/os/src/drivers/pci/main.cc rename to repos/os/src/drivers/platform/x86/main.cc index 7074c2de11..461b97b2af 100644 --- a/repos/os/src/drivers/pci/main.cc +++ b/repos/os/src/drivers/platform/x86/main.cc @@ -1,5 +1,5 @@ /* - * \brief PCI-bus driver + * \brief Platform driver for x86 * \author Norman Feske * \date 2008-01-28 */ @@ -23,7 +23,7 @@ #include "pci_device_config.h" using namespace Genode; -using namespace Pci; +using namespace Platform; class Device_pd_policy : public Genode::Slave_policy { @@ -45,7 +45,7 @@ class Device_pd_policy : public Genode::Slave_policy Device_pd_policy(Genode::Rpc_entrypoint &slave_ep) : - Slave_policy("pci_device_pd", slave_ep), + Slave_policy("device_pd", slave_ep), _lock(Genode::Lock::LOCKED) { } @@ -54,8 +54,8 @@ class Device_pd_policy : public Genode::Slave_policy Genode::Allocator *alloc, Genode::Server *server) { - /* wait for 'pci_drv' to announce the PCI service */ - if (Genode::strcmp(service_name, "PCI_DEV_PD")) + /* wait for 'platform_drv' to announce the DEVICE_PD service */ + if (Genode::strcmp(service_name, "DEVICE_PD")) return false; _cap = root; @@ -75,27 +75,27 @@ class Device_pd_policy : public Genode::Slave_policy int main(int argc, char **argv) { - printf("PCI driver started\n"); + printf("platform driver started\n"); /* * Initialize server entry point */ enum { STACK_SIZE = 2 * sizeof(addr_t)*1024, - PCI_DEVICE_PD_RAM_QUOTA = 196 * 4096, + DEVICE_PD_RAM_QUOTA = 196 * 4096, }; static Cap_connection cap; - static Rpc_entrypoint ep(&cap, STACK_SIZE, "pci_ep"); + static Rpc_entrypoint ep(&cap, STACK_SIZE, "platform_ep"); - /* use 'pci_device_pd' as slave service */ + /* use 'device_pd' as slave service */ Session_capability session_dev_pd; Genode::Root_capability device_pd_root; try { static Rpc_entrypoint device_pd_ep(&cap, STACK_SIZE, "device_pd_slave"); static Device_pd_policy device_pd_policy(device_pd_ep); static Genode::Slave device_pd_slave(device_pd_ep, device_pd_policy, - PCI_DEVICE_PD_RAM_QUOTA); + DEVICE_PD_RAM_QUOTA); device_pd_root = device_pd_policy.root(); } catch (...) { PWRN("PCI device protection domain for IOMMU support is not available"); @@ -140,8 +140,8 @@ int main(int argc, char **argv) /* * Let the entry point serve the PCI root interface */ - static Pci::Root root(&ep, &sliced_heap, PCI_DEVICE_PD_RAM_QUOTA, - device_pd_root, report_addr); + static Platform::Root root(&ep, &sliced_heap, DEVICE_PD_RAM_QUOTA, + device_pd_root, report_addr); env()->parent()->announce(ep.manage(&root)); diff --git a/repos/os/src/drivers/pci/nonpci_devices.cc b/repos/os/src/drivers/platform/x86/nonpci_devices.cc similarity index 86% rename from repos/os/src/drivers/pci/nonpci_devices.cc rename to repos/os/src/drivers/platform/x86/nonpci_devices.cc index 8305bc512e..ed46548463 100644 --- a/repos/os/src/drivers/pci/nonpci_devices.cc +++ b/repos/os/src/drivers/platform/x86/nonpci_devices.cc @@ -16,7 +16,7 @@ namespace Nonpci { class Ps2; } -class Nonpci::Ps2 : public Pci::Device_component +class Nonpci::Ps2 : public Platform::Device_component { private: @@ -35,9 +35,9 @@ class Nonpci::Ps2 : public Pci::Device_component public: - Ps2(Genode::Rpc_entrypoint * ep, Pci::Session_component * session) + Ps2(Genode::Rpc_entrypoint * ep, Platform::Session_component * session) : - Pci::Device_component(ep, session, IRQ_KEYBOARD), + Platform::Device_component(ep, session, IRQ_KEYBOARD), _irq_mouse(IRQ_MOUSE), _data(REG_DATA, ACCESS_WIDTH), _status(REG_STATUS, ACCESS_WIDTH) { } @@ -74,9 +74,9 @@ class Nonpci::Ps2 : public Pci::Device_component /** - * PCI session component devices which are non PCI devices, e.g. PS2 + * Platform session component devices which are non PCI devices, e.g. PS2 */ -Pci::Device_capability Pci::Session_component::device(String const &name) { +Platform::Device_capability Platform::Session_component::device(String const &name) { if (!name.is_valid_string()) return Device_capability(); @@ -116,7 +116,7 @@ Pci::Device_capability Pci::Session_component::device(String const &name) { _device_list.insert(dev); return _ep->manage(dev); } catch (Genode::Allocator::Out_of_memory) { - throw Pci::Device::Quota_exceeded(); + throw Platform::Device::Quota_exceeded(); } catch (Genode::Parent::Service_denied) { return Device_capability(); } diff --git a/repos/os/src/drivers/pci/pci_bridge.h b/repos/os/src/drivers/platform/x86/pci_bridge.h similarity index 91% rename from repos/os/src/drivers/pci/pci_bridge.h rename to repos/os/src/drivers/platform/x86/pci_bridge.h index a955d87c3b..2ec4d65aec 100644 --- a/repos/os/src/drivers/pci/pci_bridge.h +++ b/repos/os/src/drivers/platform/x86/pci_bridge.h @@ -13,7 +13,7 @@ #pragma once -namespace Pci { class Bridge; } +namespace Platform { class Bridge; } #include @@ -21,7 +21,7 @@ namespace Pci { class Bridge; } /** * List of PCI-bridge devices */ -class Pci::Bridge : public Genode::List::Element +class Platform::Bridge : public Genode::List::Element { private: diff --git a/repos/os/src/drivers/pci/pci_config_access.h b/repos/os/src/drivers/platform/x86/pci_config_access.h similarity index 96% rename from repos/os/src/drivers/pci/pci_config_access.h rename to repos/os/src/drivers/platform/x86/pci_config_access.h index 0596cd8bcf..ec8c7dd053 100644 --- a/repos/os/src/drivers/pci/pci_config_access.h +++ b/repos/os/src/drivers/platform/x86/pci_config_access.h @@ -5,19 +5,18 @@ */ /* - * Copyright (C) 2008-2013 Genode Labs GmbH + * Copyright (C) 2008-2015 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ -#ifndef _CONFIG_ACCESS_H_ -#define _CONFIG_ACCESS_H_ +#pragma once #include -#include +#include -namespace Pci { +namespace Platform { class Config_access { @@ -178,5 +177,3 @@ namespace Pci { } }; } - -#endif /* _CONFIG_ACCESS_H_ */ diff --git a/repos/os/src/drivers/pci/pci_device.cc b/repos/os/src/drivers/platform/x86/pci_device.cc similarity index 90% rename from repos/os/src/drivers/pci/pci_device.cc rename to repos/os/src/drivers/platform/x86/pci_device.cc index c2e04a6ad5..d10848c2ec 100644 --- a/repos/os/src/drivers/pci/pci_device.cc +++ b/repos/os/src/drivers/platform/x86/pci_device.cc @@ -13,7 +13,7 @@ #include "pci_session_component.h" #include "pci_device_component.h" -Genode::Io_port_session_capability Pci::Device_component::io_port(Genode::uint8_t v_id) +Genode::Io_port_session_capability Platform::Device_component::io_port(Genode::uint8_t v_id) { Genode::uint8_t max = sizeof(_io_port_conn) / sizeof(_io_port_conn[0]); Genode::uint8_t i = 0, r_id = 0; @@ -37,7 +37,7 @@ Genode::Io_port_session_capability Pci::Device_component::io_port(Genode::uint8_ return Genode::Io_port_session_capability(); } -Genode::Io_mem_session_capability Pci::Device_component::io_mem(Genode::uint8_t v_id) +Genode::Io_mem_session_capability Platform::Device_component::io_mem(Genode::uint8_t v_id) { Genode::uint8_t max = sizeof(_io_mem_conn) / sizeof(_io_mem_conn[0]); Genode::uint8_t i = 0, r_id = 0; @@ -61,7 +61,7 @@ Genode::Io_mem_session_capability Pci::Device_component::io_mem(Genode::uint8_t return Genode::Io_mem_session_capability(); } -void Pci::Device_component::config_write(unsigned char address, unsigned value, +void Platform::Device_component::config_write(unsigned char address, unsigned value, Access_size size) { /* white list of ports which we permit to write */ diff --git a/repos/os/src/drivers/pci/pci_device_component.h b/repos/os/src/drivers/platform/x86/pci_device_component.h similarity index 85% rename from repos/os/src/drivers/pci/pci_device_component.h rename to repos/os/src/drivers/platform/x86/pci_device_component.h index cc0438f574..e8fb17557f 100644 --- a/repos/os/src/drivers/pci/pci_device_component.h +++ b/repos/os/src/drivers/platform/x86/pci_device_component.h @@ -1,18 +1,17 @@ /* - * \brief PCI-device component + * \brief platform device component * \author Norman Feske * \date 2008-01-28 */ /* - * Copyright (C) 2008-2013 Genode Labs GmbH + * Copyright (C) 2008-2015 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ -#ifndef _PCI_DEVICE_COMPONENT_H_ -#define _PCI_DEVICE_COMPONENT_H_ +#pragma once /* base */ #include @@ -21,16 +20,16 @@ #include /* os */ -#include +#include /* local */ #include "pci_device_config.h" #include "irq.h" -namespace Pci { class Device_component; class Session_component; } +namespace Platform { class Device_component; class Session_component; } -class Pci::Device_component : public Genode::Rpc_object, - public Genode::List::Element +class Platform::Device_component : public Genode::Rpc_object, + public Genode::List::Element { private: @@ -39,7 +38,7 @@ class Pci::Device_component : public Genode::Rpc_object, Genode::Io_mem_session_capability _io_mem_config_extended; Config_access _config_access; Genode::Rpc_entrypoint *_ep; - Pci::Session_component *_session; + Platform::Session_component *_session; unsigned short _irq_line; Irq_session_component _irq_session; @@ -82,17 +81,17 @@ class Pci::Device_component : public Genode::Rpc_object, Status::access_t status = Status::read(_device_config.read(&_config_access, PCI_STATUS, - Pci::Device::ACCESS_16BIT)); + Platform::Device::ACCESS_16BIT)); if (!Status::Capabilities::get(status)) return 0; Genode::uint8_t cap = _device_config.read(&_config_access, PCI_CAP_OFFSET, - Pci::Device::ACCESS_8BIT); + Platform::Device::ACCESS_8BIT); for (Genode::uint16_t val = 0; cap; cap = val >> 8) { val = _device_config.read(&_config_access, cap, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); if ((val & 0xff) != CAP_MSI) continue; @@ -112,7 +111,7 @@ class Pci::Device_component : public Genode::Rpc_object, using Genode::uint8_t; uint8_t pin = _device_config.read(&_config_access, PCI_IRQ_PIN, - Pci::Device::ACCESS_8BIT); + Platform::Device::ACCESS_8BIT); if (!pin) return Irq_session_component::INVALID_IRQ; @@ -129,7 +128,7 @@ class Pci::Device_component : public Genode::Rpc_object, if (_irq_line != irq_r) _device_config.write(&_config_access, PCI_IRQ_LINE, irq_r, - Pci::Device::ACCESS_8BIT); + Platform::Device::ACCESS_8BIT); _irq_line = irq = irq_r; } @@ -139,13 +138,13 @@ class Pci::Device_component : public Genode::Rpc_object, return irq; uint16_t msi = _device_config.read(&_config_access, cap + 2, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); if (msi & MSI_ENABLED) /* disable MSI */ _device_config.write(&_config_access, cap + 2, msi ^ MSI_ENABLED, - Pci::Device::ACCESS_8BIT); + Platform::Device::ACCESS_8BIT); return irq; } @@ -164,11 +163,11 @@ class Pci::Device_component : public Genode::Rpc_object, return; unsigned cmd = _device_config.read(&_config_access, PCI_CMD_REG, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); if (cmd & PCI_CMD_DMA) _device_config.write(&_config_access, PCI_CMD_REG, cmd ^ PCI_CMD_DMA, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); } @@ -179,13 +178,13 @@ class Pci::Device_component : public Genode::Rpc_object, */ Device_component(Device_config device_config, Genode::addr_t addr, Genode::Rpc_entrypoint *ep, - Pci::Session_component * session, + Platform::Session_component * session, bool use_msi) : _device_config(device_config), _config_space(addr), _ep(ep), _session(session), _irq_line(_device_config.read(&_config_access, PCI_IRQ_LINE, - Pci::Device::ACCESS_8BIT)), + Platform::Device::ACCESS_8BIT)), _irq_session(_configure_irq(_irq_line), (!use_msi || !_msi_cap()) ? ~0UL : _config_space), _slab_ioport(0, &_slab_ioport_block), _slab_iomem(0, &_slab_iomem_block) @@ -221,10 +220,10 @@ class Pci::Device_component : public Genode::Rpc_object, Genode::uint16_t msi = _device_config.read(&_config_access, msi_cap + 2, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); _device_config.write(&_config_access, msi_cap + 0x4, msi_address, - Pci::Device::ACCESS_32BIT); + Platform::Device::ACCESS_32BIT); if (msi & CAP_MSI_64) { Genode::uint32_t upper_address = sizeof(msi_address) > 4 @@ -233,26 +232,26 @@ class Pci::Device_component : public Genode::Rpc_object, _device_config.write(&_config_access, msi_cap + 0x8, upper_address, - Pci::Device::ACCESS_32BIT); + Platform::Device::ACCESS_32BIT); _device_config.write(&_config_access, msi_cap + 0xc, msi_value, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); } else _device_config.write(&_config_access, msi_cap + 0x8, msi_value, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); /* enable MSI */ _device_config.write(&_config_access, msi_cap + 2, msi ^ MSI_ENABLED, - Pci::Device::ACCESS_8BIT); + Platform::Device::ACCESS_8BIT); } /** * Constructor for non PCI devices */ Device_component(Genode::Rpc_entrypoint * ep, - Pci::Session_component * session, unsigned irq) + Platform::Session_component * session, unsigned irq) : _config_space(~0UL), _ep(ep), _session(session), @@ -354,7 +353,7 @@ class Pci::Device_component : public Genode::Rpc_object, if (msi_cap) { Genode::uint16_t msi = _device_config.read(&_config_access, msi_cap + 2, - Pci::Device::ACCESS_16BIT); + Platform::Device::ACCESS_16BIT); msi_64 = msi & CAP_MSI_64; } @@ -380,5 +379,3 @@ class Pci::Device_component : public Genode::Rpc_object, Genode::Io_mem_session_capability io_mem(Genode::uint8_t) override; }; - -#endif /* _PCI_DEVICE_COMPONENT_H_ */ diff --git a/repos/os/src/drivers/pci/pci_device_config.h b/repos/os/src/drivers/platform/x86/pci_device_config.h similarity index 97% rename from repos/os/src/drivers/pci/pci_device_config.h rename to repos/os/src/drivers/platform/x86/pci_device_config.h index 0cd467684f..bab1f2d3a7 100644 --- a/repos/os/src/drivers/pci/pci_device_config.h +++ b/repos/os/src/drivers/platform/x86/pci_device_config.h @@ -5,19 +5,18 @@ */ /* - * Copyright (C) 2008-2013 Genode Labs GmbH + * Copyright (C) 2008-2015 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ -#ifndef _DEVICE_CONFIG_H_ -#define _DEVICE_CONFIG_H_ +#pragma once -#include +#include #include "pci_config_access.h" -namespace Pci { +namespace Platform { class Device_config { @@ -219,5 +218,3 @@ namespace Pci { } }; } - -#endif /* _DEVICE_CONFIG_H_ */ diff --git a/repos/os/src/drivers/pci/pci_device_pd_ipc.h b/repos/os/src/drivers/platform/x86/pci_device_pd_ipc.h similarity index 88% rename from repos/os/src/drivers/pci/pci_device_pd_ipc.h rename to repos/os/src/drivers/platform/x86/pci_device_pd_ipc.h index c8a20ce3c7..6bdc43a744 100644 --- a/repos/os/src/drivers/pci/pci_device_pd_ipc.h +++ b/repos/os/src/drivers/platform/x86/pci_device_pd_ipc.h @@ -11,19 +11,18 @@ * under the terms of the GNU General Public License version 2. */ -#ifndef _PCI_DEVICE_PD_IPC_H_ -#define _PCI_DEVICE_PD_IPC_H_ +#pragma once #include #include #include -namespace Pci { +namespace Platform { struct Device_pd : Genode::Session { - static const char *service_name() { return "PCI_DEV_PD"; } + static const char *service_name() { return "DEVICE_PD"; } GENODE_RPC(Rpc_attach_dma_mem, void, attach_dma_mem, Genode::Ram_dataspace_capability); @@ -54,4 +53,3 @@ namespace Pci { }; } -#endif /* _PCI_DEVICE_PD_IPC_H_ */ diff --git a/repos/os/src/drivers/pci/pci_session_component.h b/repos/os/src/drivers/platform/x86/pci_session_component.h similarity index 98% rename from repos/os/src/drivers/pci/pci_session_component.h rename to repos/os/src/drivers/platform/x86/pci_session_component.h index 7e3d1183de..7441741ebd 100644 --- a/repos/os/src/drivers/pci/pci_session_component.h +++ b/repos/os/src/drivers/platform/x86/pci_session_component.h @@ -1,5 +1,5 @@ /* - * \brief PCI-session component + * \brief platform session component * \author Norman Feske * \date 2008-01-28 */ @@ -11,8 +11,7 @@ * under the terms of the GNU General Public License version 2. */ -#ifndef _PCI_SESSION_COMPONENT_H_ -#define _PCI_SESSION_COMPONENT_H_ +#pragma once /* base */ #include @@ -26,19 +25,19 @@ /* os */ #include #include -#include +#include /* local */ #include "pci_device_component.h" #include "pci_config_access.h" #include "pci_device_pd_ipc.h" -namespace Pci { +namespace Platform { bool bus_valid(int bus = 0); unsigned short bridge_bdf(unsigned char bus); } -namespace Pci { +namespace Platform { class Session_component : public Genode::Rpc_object { @@ -697,7 +696,7 @@ namespace Pci { node.attribute("gsi").value(&gsi); node.attribute("flags").value(&flags); - using Pci::Irq_override; + using Platform::Irq_override; Irq_override::list()->insert(new (env()->heap()) Irq_override(irq, gsi, flags)); } @@ -777,5 +776,3 @@ namespace Pci { }; } - -#endif /* _PCI_SESSION_COMPONENT_H_ */ diff --git a/repos/os/src/drivers/pci/session.cc b/repos/os/src/drivers/platform/x86/session.cc similarity index 85% rename from repos/os/src/drivers/pci/session.cc rename to repos/os/src/drivers/platform/x86/session.cc index ca81345a78..9bf68465d2 100644 --- a/repos/os/src/drivers/pci/session.cc +++ b/repos/os/src/drivers/platform/x86/session.cc @@ -1,5 +1,5 @@ /* - * \brief PCI-session component + * \brief platform session component * \author Norman Feske * \date 2008-01-28 */ @@ -15,16 +15,16 @@ #include "pci_bridge.h" -static Genode::List *bridges() +static Genode::List *bridges() { - static Genode::List list; + static Genode::List list; return &list; } -unsigned short Pci::bridge_bdf(unsigned char bus) +unsigned short Platform::bridge_bdf(unsigned char bus) { - for (Pci::Bridge *bridge = bridges()->first(); bridge; + for (Platform::Bridge *bridge = bridges()->first(); bridge; bridge = bridge->next()) { if (bridge->part_of(bus)) @@ -39,7 +39,7 @@ unsigned short Pci::bridge_bdf(unsigned char bus) * * This tremendously speeds up further scans by other drivers. */ -bool Pci::bus_valid(int bus) +bool Platform::bus_valid(int bus) { struct Valid_buses { @@ -87,7 +87,7 @@ bool Pci::bus_valid(int bus) } -using Pci::Session_component; +using Platform::Session_component; using Genode::Bit_array; Bit_array Session_component::bdf_in_use; diff --git a/repos/os/src/drivers/pci/x86/target.mk b/repos/os/src/drivers/platform/x86/target.mk similarity index 60% rename from repos/os/src/drivers/pci/x86/target.mk rename to repos/os/src/drivers/platform/x86/target.mk index 756fcf9a54..8491148713 100644 --- a/repos/os/src/drivers/pci/x86/target.mk +++ b/repos/os/src/drivers/platform/x86/target.mk @@ -1,8 +1,6 @@ -TARGET = pci_drv +TARGET = platform_drv REQUIRES = x86 SRC_CC = main.cc irq.cc pci_device.cc nonpci_devices.cc session.cc LIBS = base config -INC_DIR = $(PRG_DIR)/.. - -vpath %.cc $(PRG_DIR)/.. +INC_DIR = $(PRG_DIR) diff --git a/repos/os/src/test/pci/target.mk b/repos/os/src/test/pci/target.mk index 118ba90e07..907f5deee2 100644 --- a/repos/os/src/test/pci/target.mk +++ b/repos/os/src/test/pci/target.mk @@ -1,3 +1,4 @@ TARGET = test-pci SRC_CC = test.cc LIBS = base +REQUIRES = pci diff --git a/repos/os/src/test/pci/test.cc b/repos/os/src/test/pci/test.cc index 0e784a04f2..684d97fde0 100644 --- a/repos/os/src/test/pci/test.cc +++ b/repos/os/src/test/pci/test.cc @@ -13,8 +13,8 @@ #include #include -#include -#include +#include +#include using namespace Genode; @@ -24,14 +24,14 @@ enum { INTEL_VENDOR_ID = 0x8086 }; /** * Print device information */ -static void print_device_info(Pci::Device_capability device_cap) +static void print_device_info(Platform::Device_capability device_cap) { if (!device_cap.valid()) { PERR("Invalid device capability"); return; } - Pci::Device_client device(device_cap); + Platform::Device_client device(device_cap); unsigned char bus = 0, dev = 0, fun = 0; device.bus_address(&bus, &dev, &fun); @@ -45,11 +45,11 @@ static void print_device_info(Pci::Device_capability device_cap) for (int resource_id = 0; resource_id < 6; resource_id++) { - Pci::Device::Resource resource = device.resource(resource_id); + Platform::Device::Resource resource = device.resource(resource_id); - if (resource.type() != Pci::Device::Resource::INVALID) + if (resource.type() != Platform::Device::Resource::INVALID) printf(" Resource %d (%s): base=0x%08x size=0x%08x %s\n", resource_id, - resource.type() == Pci::Device::Resource::IO ? "I/O" : "MEM", + resource.type() == Platform::Device::Resource::IO ? "I/O" : "MEM", resource.base(), resource.size(), resource.prefetchable() ? "prefetchable" : ""); } @@ -58,16 +58,16 @@ static void print_device_info(Pci::Device_capability device_cap) int main(int argc, char **argv) { - printf("--- PCI test started ---\n"); + printf("--- Platform test started ---\n"); /* open session to pci service */ - static Pci::Connection pci; + static Platform::Connection pci; /* * Iterate through all installed devices * and print the available device information. */ - Pci::Device_capability prev_device_cap, + Platform::Device_capability prev_device_cap, device_cap = pci.first_device(); while (device_cap.valid()) { print_device_info(device_cap); @@ -80,7 +80,7 @@ int main(int argc, char **argv) /* release last device */ pci.release_device(prev_device_cap); - printf("--- PCI test finished ---\n"); + printf("--- Platform test finished ---\n"); return 0; } diff --git a/repos/ports/run/debug_nitpicker.run b/repos/ports/run/debug_nitpicker.run index 39bdc57fc2..d5dc12566f 100644 --- a/repos/ports/run/debug_nitpicker.run +++ b/repos/ports/run/debug_nitpicker.run @@ -16,15 +16,20 @@ # Build # -build { +set build_components { core init drivers/timer drivers/uart app/gdb_monitor test/gdb_monitor server/nitpicker app/pointer app/scout - 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 # @@ -85,11 +90,7 @@ set config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -123,10 +124,11 @@ set boot_modules { } # platform-specific modules -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 # diff --git a/repos/ports/run/dosbox.run b/repos/ports/run/dosbox.run index afbd8ee813..8075fc8c33 100644 --- a/repos/ports/run/dosbox.run +++ b/repos/ports/run/dosbox.run @@ -2,17 +2,25 @@ # Build # - set build_components { core init drivers/timer drivers/audio_out - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input app/dosbox } -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci/device_pd +source ${genode_dir}/repos/base/run/platform_drv.inc +# override default platform driver policy +proc platform_drv_policy {} { + return { + + + + } +} + +append_platform_drv_build_components build $build_components @@ -51,51 +59,13 @@ append_if [have_spec sdl] config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - - - - - - - } +append_platform_drv_config append_if [have_spec vesa] config { - } - -append_if [have_spec acpi] config { - } - -append_if [have_spec vesa] config { - - } append_if [have_spec pl11x] config { @@ -112,14 +82,7 @@ append_if [have_spec ps2] config { append config { - } -append_if [have_spec acpi] config { - - - - - } -append config { + @@ -166,14 +129,13 @@ set boot_modules { } # platform-specific modules -lappend_if [have_spec nova] boot_modules pci_device_pd -lappend_if [have_spec acpi] boot_modules acpi_drv lappend_if [have_spec linux] boot_modules fb_sdl -lappend_if [have_spec pci] boot_modules pci_drv lappend_if [have_spec vesa] boot_modules fb_drv lappend_if [have_spec ps2] boot_modules ps2_drv lappend_if [have_spec pl11x] boot_modules fb_drv +append_platform_drv_boot_modules + build_boot_image $boot_modules append qemu_args " -m 256 -soundhw es1370 " diff --git a/repos/ports/run/genode_org.run b/repos/ports/run/genode_org.run index 0569cb6c2f..77fecd3189 100644 --- a/repos/ports/run/genode_org.run +++ b/repos/ports/run/genode_org.run @@ -22,18 +22,17 @@ set build_components { set use_usb_driver [expr [have_spec omap4] || [have_spec platform_arndale] || [have_spec platform_rpi]] set use_nic_driver [expr !$use_usb_driver] -set use_platform_driver [expr [have_spec platform_arndale] || [have_spec platform_imx53] || [have_spec platform_rpi]] if {$use_usb_driver} { set network_driver "usb_drv" } if {$use_nic_driver} { set network_driver "nic_drv" } -lappend_if $use_platform_driver build_components drivers/platform lappend_if $use_usb_driver build_components drivers/usb lappend_if $use_nic_driver build_components drivers/nic -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci/device_pd 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 @@ -61,13 +60,6 @@ append config { } -append_if $use_platform_driver config { - - - - - } - append_if [have_spec gpio] config { @@ -92,25 +84,7 @@ append_if $use_nic_driver config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append config { @@ -190,14 +164,12 @@ set boot_modules { } # platform-specific modules -lappend_if $use_platform_driver boot_modules platform_drv -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv lappend_if $use_usb_driver boot_modules usb_drv lappend_if $use_nic_driver boot_modules nic_drv -lappend_if [have_spec nova] boot_modules pci_device_pd lappend_if [have_spec gpio] boot_modules gpio_drv +append_platform_drv_boot_modules + build_boot_image $boot_modules append_if [have_spec x86] qemu_args " -net nic,model=e1000 " diff --git a/repos/ports/run/lighttpd.run b/repos/ports/run/lighttpd.run index d9ac1b227b..60b99374a1 100644 --- a/repos/ports/run/lighttpd.run +++ b/repos/ports/run/lighttpd.run @@ -6,12 +6,14 @@ set build_components { core init - drivers/pci drivers/nic drivers/timer app/lighttpd } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components create_boot_directory @@ -39,11 +41,7 @@ append config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append config { @@ -118,7 +116,7 @@ set boot_modules { } # platform-specific modules -lappend_if [have_spec pci] boot_modules pci_drv +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/ports/run/noux_bash.run b/repos/ports/run/noux_bash.run index 06a3ecdd22..e4dbcc0863 100644 --- a/repos/ports/run/noux_bash.run +++ b/repos/ports/run/noux_bash.run @@ -11,7 +11,7 @@ proc use_usb_input { } { return [expr ![have_spec ps2] && [have_spec usb]] } set build_components { core init drivers/timer noux/minimal lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input server/terminal server/ram_fs test/libports/ncurses @@ -27,6 +27,9 @@ lappend_if [have_spec gpio] build_components drivers/gpio foreach pkg {bash coreutils vim} { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components # write default vimrc file @@ -85,11 +88,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -196,12 +195,13 @@ 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 lappend_if [have_spec framebuffer] boot_modules fb_drv lappend_if [use_usb_input] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv +append_platform_drv_boot_modules + build_boot_image $boot_modules if {[have_spec x86_64]} { diff --git a/repos/ports/run/noux_gdb.run b/repos/ports/run/noux_gdb.run index f347cf5957..ab857ebdc3 100644 --- a/repos/ports/run/noux_gdb.run +++ b/repos/ports/run/noux_gdb.run @@ -21,7 +21,7 @@ if {[have_spec x86]} { set build_components { core init drivers/timer noux lib/libc_noux - drivers/framebuffer drivers/pci drivers/input drivers/usb + drivers/framebuffer drivers/input drivers/usb server/terminal server/terminal_crosslink app/gdb_monitor } @@ -34,6 +34,9 @@ lappend build_components noux-pkg/[noux_gdb_pkg_name] lappend build_components test/gdb_monitor set gdb_target_binary_name test-gdb_monitor +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components # names of the binaries needed for the GDB monitor test @@ -81,11 +84,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -216,12 +215,13 @@ 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 lappend_if [have_spec usb] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv +append_platform_drv_boot_modules + build_boot_image $boot_modules run_genode_until forever diff --git a/repos/ports/run/noux_net_lighttpd.run b/repos/ports/run/noux_net_lighttpd.run index b2b4771b97..2721249d42 100644 --- a/repos/ports/run/noux_net_lighttpd.run +++ b/repos/ports/run/noux_net_lighttpd.run @@ -6,7 +6,7 @@ if {![have_spec x86]} { set build_components { core init drivers/timer noux/net lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input drivers/nic drivers/timer server/terminal server/ram_fs @@ -24,6 +24,9 @@ set noux_pkgs "bash coreutils vim" foreach pkg $noux_pkgs { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components set vimrc_fd [open "bin/vim/share/vim/vimrc" w] @@ -94,11 +97,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -218,10 +217,11 @@ foreach pkg $noux_pkgs { # 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 if {[have_spec x86_64]} { diff --git a/repos/ports/run/noux_net_lynx_interactive.run b/repos/ports/run/noux_net_lynx_interactive.run index d0114e32b1..175f0a0f02 100644 --- a/repos/ports/run/noux_net_lynx_interactive.run +++ b/repos/ports/run/noux_net_lynx_interactive.run @@ -12,7 +12,7 @@ if {![have_spec x86]} { set build_components { core init drivers/timer noux/net lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input drivers/nic drivers/timer server/terminal server/ram_fs @@ -29,6 +29,9 @@ set noux_pkgs "bash coreutils lynx noux-etc" foreach pkg $noux_pkgs { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components # strip all binaries prior archiving @@ -75,12 +78,8 @@ append_if [have_spec sdl] config { } - -append_if [have_spec pci] config { - - - - } + +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -176,10 +175,11 @@ foreach pkg $noux_pkgs { # 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 if {[have_spec x86_64]} { diff --git a/repos/ports/run/noux_net_openssh_interactive.run b/repos/ports/run/noux_net_openssh_interactive.run index cb25406c08..01a48ed76c 100644 --- a/repos/ports/run/noux_net_openssh_interactive.run +++ b/repos/ports/run/noux_net_openssh_interactive.run @@ -12,7 +12,7 @@ if {![have_spec x86]} { set build_components { core init drivers/timer noux/net lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input drivers/nic server/terminal server/ram_fs test/libc_resolv @@ -31,6 +31,9 @@ set noux_pkgs "bash coreutils openssh noux-etc" foreach pkg $noux_pkgs { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components # strip all binaries prior archiving @@ -78,11 +81,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -180,10 +179,11 @@ foreach pkg $noux_pkgs { # 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 if {[have_spec x86_64]} { diff --git a/repos/ports/run/noux_shell_script.run b/repos/ports/run/noux_shell_script.run index b2746ff608..3e59e22047 100644 --- a/repos/ports/run/noux_shell_script.run +++ b/repos/ports/run/noux_shell_script.run @@ -1,14 +1,12 @@ set build_components { core init drivers/timer noux/minimal lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input server/terminal server/ram_fs test/libports/ncurses } set use_usb_input [expr ![have_spec ps2] && ![have_spec sdl] && [have_spec usb]] -set use_platform_driver [expr [have_spec platform_arndale] || [have_spec platform_imx53] || [have_spec platform_rpi]] lappend_if $use_usb_input build_components drivers/usb -lappend_if $use_platform_driver build_components drivers/platform # # Build Noux packages only once @@ -18,6 +16,9 @@ set noux_pkgs {bash coreutils make} foreach pkg $noux_pkgs { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components # strip all binaries prior archiving @@ -72,11 +73,7 @@ append_if $use_usb_input config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -90,13 +87,6 @@ append_if [have_spec ps2] config { } -append_if $use_platform_driver config { - - - - - } - append config { @@ -176,12 +166,12 @@ foreach pkg $noux_pkgs { # 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 -lappend_if $use_platform_driver boot_modules platform_drv lappend_if $use_usb_input boot_modules usb_drv +append_platform_drv_boot_modules + build_boot_image $boot_modules append qemu_args " -m 300 " diff --git a/repos/ports/run/noux_terminal_fs.run b/repos/ports/run/noux_terminal_fs.run index 984ab86cb8..4c14e50ae3 100644 --- a/repos/ports/run/noux_terminal_fs.run +++ b/repos/ports/run/noux_terminal_fs.run @@ -15,7 +15,7 @@ set build_components { core init drivers/timer noux lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input server/terminal server/ram_fs server/nitpicker app/pointer server/nit_fb } @@ -26,6 +26,9 @@ set build_components { foreach pkg {bash coreutils} { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components # strip all binaries prior archiving @@ -68,11 +71,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -202,10 +201,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 if {[have_spec x86_64]} { diff --git a/repos/ports/run/noux_trace_fs.run b/repos/ports/run/noux_trace_fs.run index 1db4eb2dde..18ea36d2b3 100644 --- a/repos/ports/run/noux_trace_fs.run +++ b/repos/ports/run/noux_trace_fs.run @@ -20,7 +20,7 @@ proc use_usb_input { } { return [expr ![have_spec ps2] && [have_spec usb]] } set build_components { core init drivers/timer noux/minimal lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input server/terminal server/ram_fs server/trace_fs test/libports/ncurses @@ -29,8 +29,6 @@ set build_components { lappend_if [use_usb_input] build_components drivers/usb lappend_if [have_spec gpio] build_components drivers/gpio -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci set noux_pkgs "bash coreutils grep vim" # @@ -39,6 +37,9 @@ set noux_pkgs "bash coreutils grep vim" foreach pkg $noux_pkgs { lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg } +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components # write default vimrc file @@ -92,25 +93,7 @@ append_if [have_spec sdl] config { } -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -237,12 +220,12 @@ foreach pkg $noux_pkgs { # 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 lappend_if [have_spec framebuffer] boot_modules fb_drv lappend_if [use_usb_input ] boot_modules usb_drv lappend_if [have_spec gpio] boot_modules gpio_drv -lappend_if [have_spec acpi] boot_modules acpi_drv + +append_platform_drv_boot_modules build_boot_image $boot_modules diff --git a/repos/ports/run/noux_vim.run b/repos/ports/run/noux_vim.run index a06ab72f84..3d75316522 100644 --- a/repos/ports/run/noux_vim.run +++ b/repos/ports/run/noux_vim.run @@ -6,12 +6,15 @@ set build_components { core init drivers/timer noux/minimal lib/libc_noux - drivers/framebuffer drivers/pci drivers/input + drivers/framebuffer drivers/input server/terminal } lappend build_components noux-pkg/vim lappend build_components test/libports/ncurses +source ${genode_dir}/repos/base/run/platform_drv.inc +append_platform_drv_build_components + build $build_components exec tar cfv bin/vim.tar -h -C bin/vim . @@ -49,12 +52,8 @@ append_if [have_spec sdl] config { } - -append_if [have_spec pci] config { - - - - } + +append_platform_drv_config append_if [have_spec framebuffer] config { @@ -125,10 +124,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 run_genode_until forever diff --git a/repos/ports/run/seoul.inc b/repos/ports/run/seoul.inc index 2eb33aa949..51ccd26b4d 100644 --- a/repos/ports/run/seoul.inc +++ b/repos/ports/run/seoul.inc @@ -222,7 +222,7 @@ append_if $use_framebuffer config { - +