mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-16 14:18:27 +00:00
committed by
Christian Helmuth
parent
32e792dc74
commit
1f40d9de6a
@ -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):
|
||||
|
||||
!<start name="acpi_drv">
|
||||
! <resource name="RAM" quantum="2M" constrain_phys="yes"/>
|
||||
! <provides>
|
||||
! <service name="PCI"/>
|
||||
! <service name="IRQ" />
|
||||
! </provides>
|
||||
! <config>
|
||||
! <policy label="acpi_drv">
|
||||
! <pci class="ALL"/>
|
||||
! </policy>
|
||||
! </config>
|
||||
! <route>
|
||||
! <any-service> <parent/> <any-child /> </any-service>
|
||||
! </route>
|
||||
! <resource name="RAM" quantum="2M"/>
|
||||
!</start>
|
||||
!
|
||||
!<start name="timer">
|
||||
! <resource name="RAM" quantum="1M"/>
|
||||
! <provides><service name="Timer"/></provides>
|
||||
! <route>
|
||||
! <service name="IRQ"><child name="acpi_drv" /></service>
|
||||
! <any-service> <parent /> <any-child /></any-service>
|
||||
! </route>
|
||||
!<start name="report_rom">
|
||||
! <resource name="RAM" quantum="2M"/>
|
||||
! <provides>
|
||||
! <service name="ROM" />
|
||||
! <service name="Report" />
|
||||
! </provides>
|
||||
! <config>
|
||||
! <rom>
|
||||
! <policy label="platform_drv -> acpi" report="acpi_drv -> acpi"/>
|
||||
! </rom>
|
||||
! </config>
|
||||
!</start>
|
||||
|
||||
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.
|
||||
!
|
||||
!<start name="platform_drv">
|
||||
! ...
|
||||
|
@ -12,8 +12,8 @@
|
||||
*/
|
||||
|
||||
#include <irq_session/connection.h>
|
||||
#include <pci_session/connection.h>
|
||||
#include <pci_device/client.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <platform_device/client.h>
|
||||
#include <util/volatile_object.h>
|
||||
|
||||
#include <ahci.h>
|
||||
@ -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_client> pci_device;
|
||||
Lazy_volatile_object<Irq_session_client> irq;
|
||||
addr_t res_base;
|
||||
size_t res_size;
|
||||
Platform::Connection pci;
|
||||
Platform::Device_capability pci_device_cap;
|
||||
Lazy_volatile_object<Platform::Device_client> pci_device;
|
||||
Lazy_volatile_object<Irq_session_client> 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);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <input/component.h>
|
||||
#include <input/root.h>
|
||||
#include <os/server.h>
|
||||
#include <pci_session/connection.h>
|
||||
#include <platform_session/connection.h>
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -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':
|
||||
|
||||
!<start name="pci_drv">
|
||||
!<start name="platform_drv">
|
||||
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
|
||||
! ...
|
||||
! <config>
|
||||
@ -30,11 +31,11 @@ explicitly configured by the triple 'bus', 'device', 'function':
|
||||
! <pci bus="0" device="18" function="3"/>
|
||||
! </policy>
|
||||
! </config>
|
||||
!</start>
|
||||
! ...
|
||||
|
||||
or more fuzzy by a device class alias:
|
||||
|
||||
!<start name="pci_drv">
|
||||
!<start name="platform_drv">
|
||||
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
|
||||
! ...
|
||||
! <config>
|
||||
@ -42,19 +43,19 @@ or more fuzzy by a device class alias:
|
||||
! <pci class="USB"/>
|
||||
! </policy>
|
||||
! </config>
|
||||
!</start>
|
||||
! ...
|
||||
|
||||
|
||||
Non PCI devices, as the PS2 controller are named by a "device" node in the policy:
|
||||
|
||||
!<start name="pci_drv">
|
||||
!<start name="platform_drv">
|
||||
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
|
||||
! <config>
|
||||
! <policy label="ps_drv">
|
||||
! <device name="PS2/>
|
||||
! </policy>
|
||||
! </config>
|
||||
!</start>
|
||||
! ...
|
||||
|
||||
|
||||
The first entry ('pci' or 'dev') of the policy node that matches will grant
|
||||
@ -68,24 +69,53 @@ discovery by the client with the fuzzy pci class policy.
|
||||
By default the driver will try to use MSIs if the device and the used kernel
|
||||
supports it. This behaviour can be overwritten:
|
||||
|
||||
!<start name="pci_drv">
|
||||
!<start name="platform_drv">
|
||||
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
|
||||
! <config>
|
||||
! <policy label="nic_drv" irq_mode="nomsi">
|
||||
! ...
|
||||
! </policy>
|
||||
! </config>
|
||||
!</start>
|
||||
! ...
|
||||
|
||||
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:
|
||||
|
||||
!<start name="platform_drv">
|
||||
! ...
|
||||
! <route>
|
||||
! <service name="ROM">
|
||||
! <if-arg key="label" value="acpi"/> <child name="acpi_report_rom"/>
|
||||
! </service>
|
||||
! ...
|
||||
! </route>
|
||||
! ...
|
||||
|
||||
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:
|
||||
|
||||
!<start name="platform_drv">
|
||||
! ...
|
||||
! <config acpi="no">
|
||||
! ...
|
||||
! </config>
|
||||
! ...
|
||||
|
||||
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.
|
||||
|
||||
!<start name="pci_drv">
|
||||
!<start name="platform_drv">
|
||||
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
|
||||
! <config>
|
||||
! <policy label="ps_drv">
|
@ -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<unsigned char *>(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<Pci::Device_pd> root(ep.manage(&pci_device_component));
|
||||
static Static_root<Platform::Device_pd> 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;
|
@ -1,4 +1,4 @@
|
||||
TARGET = pci_device_pd
|
||||
TARGET = device_pd
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
||||
|
@ -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 <platform/irq_proxy.h>
|
||||
|
||||
/* 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<NoThread> Proxy;
|
||||
|
||||
class Pci::Irq_component : public Proxy
|
||||
class Platform::Irq_component : public Proxy
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Irq_connection _irq;
|
||||
Genode::Signal_dispatcher<Pci::Irq_component> _irq_dispatcher;
|
||||
Genode::Signal_dispatcher<Platform::Irq_component> _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;
|
@ -20,19 +20,19 @@
|
||||
#include <irq_session/irq_session.h>
|
||||
#include <irq_session/capability.h>
|
||||
|
||||
/* PCI local includes */
|
||||
/* platform local includes */
|
||||
#include <platform/irq_proxy.h>
|
||||
|
||||
|
||||
namespace Pci {
|
||||
namespace Platform {
|
||||
class Irq_session_component;
|
||||
class Irq_override;
|
||||
class Irq_routing;
|
||||
}
|
||||
|
||||
|
||||
class Pci::Irq_session_component : public Genode::Rpc_object<Genode::Irq_session>,
|
||||
public Genode::List<Irq_session_component>::Element
|
||||
class Platform::Irq_session_component : public Genode::Rpc_object<Genode::Irq_session>,
|
||||
public Genode::List<Irq_session_component>::Element
|
||||
{
|
||||
private:
|
||||
|
||||
@ -73,7 +73,7 @@ class Pci::Irq_session_component : public Genode::Rpc_object<Genode::Irq_session
|
||||
/**
|
||||
* List that holds interrupt override information
|
||||
*/
|
||||
class Pci::Irq_override : public Genode::List<Pci::Irq_override>::Element
|
||||
class Platform::Irq_override : public Genode::List<Platform::Irq_override>::Element
|
||||
{
|
||||
private:
|
||||
|
||||
@ -151,7 +151,7 @@ class Pci::Irq_override : public Genode::List<Pci::Irq_override>::Element
|
||||
/**
|
||||
* List that holds interrupt rewrite information
|
||||
*/
|
||||
class Pci::Irq_routing : public Genode::List<Pci::Irq_routing>::Element
|
||||
class Platform::Irq_routing : public Genode::List<Platform::Irq_routing>::Element
|
||||
{
|
||||
private:
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Pci { class Bridge; }
|
||||
namespace Platform { class Bridge; }
|
||||
|
||||
#include <util/list.h>
|
||||
|
||||
@ -21,7 +21,7 @@ namespace Pci { class Bridge; }
|
||||
/**
|
||||
* List of PCI-bridge devices
|
||||
*/
|
||||
class Pci::Bridge : public Genode::List<Bridge>::Element
|
||||
class Platform::Bridge : public Genode::List<Bridge>::Element
|
||||
{
|
||||
private:
|
||||
|
@ -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 <io_port_session/connection.h>
|
||||
#include <pci_device/pci_device.h>
|
||||
#include <platform_device/platform_device.h>
|
||||
|
||||
namespace Pci {
|
||||
namespace Platform {
|
||||
|
||||
class Config_access
|
||||
{
|
||||
@ -178,5 +177,3 @@ namespace Pci {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _CONFIG_ACCESS_H_ */
|
@ -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 */
|
@ -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 <base/rpc_server.h>
|
||||
@ -21,16 +20,16 @@
|
||||
#include <util/mmio.h>
|
||||
|
||||
/* os */
|
||||
#include <pci_device/pci_device.h>
|
||||
#include <platform_device/platform_device.h>
|
||||
|
||||
/* 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<Pci::Device>,
|
||||
public Genode::List<Device_component>::Element
|
||||
class Platform::Device_component : public Genode::Rpc_object<Platform::Device>,
|
||||
public Genode::List<Device_component>::Element
|
||||
{
|
||||
private:
|
||||
|
||||
@ -39,7 +38,7 @@ class Pci::Device_component : public Genode::Rpc_object<Pci::Device>,
|
||||
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<Pci::Device>,
|
||||
|
||||
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<Pci::Device>,
|
||||
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<Pci::Device>,
|
||||
|
||||
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<Pci::Device>,
|
||||
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<Pci::Device>,
|
||||
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<Pci::Device>,
|
||||
*/
|
||||
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<Pci::Device>,
|
||||
|
||||
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<Pci::Device>,
|
||||
|
||||
_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<Pci::Device>,
|
||||
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<Pci::Device>,
|
||||
|
||||
Genode::Io_mem_session_capability io_mem(Genode::uint8_t) override;
|
||||
};
|
||||
|
||||
#endif /* _PCI_DEVICE_COMPONENT_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 <pci_device/pci_device.h>
|
||||
#include <platform_device/platform_device.h>
|
||||
#include "pci_config_access.h"
|
||||
|
||||
namespace Pci {
|
||||
namespace Platform {
|
||||
|
||||
class Device_config
|
||||
{
|
||||
@ -219,5 +218,3 @@ namespace Pci {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _DEVICE_CONFIG_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 <base/rpc_server.h>
|
||||
|
||||
#include <io_mem_session/capability.h>
|
||||
#include <ram_session/ram_session.h>
|
||||
|
||||
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_ */
|
@ -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 <base/allocator_guard.h>
|
||||
@ -26,19 +25,19 @@
|
||||
/* os */
|
||||
#include <io_mem_session/connection.h>
|
||||
#include <os/session_policy.h>
|
||||
#include <pci_session/pci_session.h>
|
||||
#include <platform_session/platform_session.h>
|
||||
|
||||
/* 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<Session>
|
||||
{
|
||||
@ -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_ */
|
@ -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<Pci::Bridge> *bridges()
|
||||
static Genode::List<Platform::Bridge> *bridges()
|
||||
{
|
||||
static Genode::List<Pci::Bridge> list;
|
||||
static Genode::List<Platform::Bridge> 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::MAX_PCI_DEVICES> Session_component::bdf_in_use;
|
@ -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)
|
@ -1,3 +1,4 @@
|
||||
TARGET = test-pci
|
||||
SRC_CC = test.cc
|
||||
LIBS = base
|
||||
REQUIRES = pci
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#include <base/env.h>
|
||||
#include <base/printf.h>
|
||||
#include <pci_session/connection.h>
|
||||
#include <pci_device/client.h>
|
||||
#include <platform_session/connection.h>
|
||||
#include <platform_device/client.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user