mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +00:00
committed by
Christian Helmuth
parent
32e792dc74
commit
1f40d9de6a
@ -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 {
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>}
|
||||
|
||||
append_if [have_spec acpi] config {
|
||||
<start name="acpi_drv">
|
||||
<resource name="RAM" quantum="6M"/>
|
||||
<provides>
|
||||
<service name="PCI"/>
|
||||
<service name="IRQ" />
|
||||
</provides>
|
||||
<route>
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
<config>
|
||||
<policy label="acpi_drv">
|
||||
<pci class="ALL"/>
|
||||
</policy>
|
||||
<policy label="audio_out_drv">
|
||||
<pci class="AUDIO"/>
|
||||
</policy>
|
||||
</config>
|
||||
</start>}
|
||||
|
||||
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
|
||||
<start name="pci_drv">
|
||||
<resource name="RAM" quantum="4M" constrain_phys="yes"/>
|
||||
<provides> <service name="PCI"/> </provides>
|
||||
<config>
|
||||
<policy label="audio_out_drv">
|
||||
<pci class="AUDIO"/>
|
||||
</policy>
|
||||
</config>
|
||||
</start>}
|
||||
append_platform_drv_config
|
||||
|
||||
append_if $use_mixer config {
|
||||
<start name="mixer">
|
||||
@ -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
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <dataspace/client.h>
|
||||
#include <io_port_session/connection.h>
|
||||
#include <io_mem_session/connection.h>
|
||||
#include <pci_session/connection.h>
|
||||
#include <pci_device/client.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <platform_device/client.h>
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user