mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
parent
f20b6bdc88
commit
31faee3b5c
@ -47,6 +47,9 @@ struct Pci::Device_client : public Genode::Rpc_client<Device>
|
||||
|
||||
void config_write(unsigned char address, unsigned value, Access_size size) override {
|
||||
call<Rpc_config_write>(address, value, size); }
|
||||
|
||||
Genode::Irq_session_capability irq(Genode::uint8_t id) override {
|
||||
return call<Rpc_irq>(id); }
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__PCI_DEVICE__CLIENT_H_ */
|
||||
|
@ -15,12 +15,17 @@
|
||||
#define _INCLUDE__PCI_DEVICE__PCI_DEVICE_H_
|
||||
|
||||
#include <base/rpc.h>
|
||||
#include <base/signal.h>
|
||||
#include <io_mem_session/io_mem_session.h>
|
||||
#include <irq_session/capability.h>
|
||||
|
||||
/* os includes */
|
||||
#include <platform/device.h>
|
||||
|
||||
namespace Pci { struct Device; }
|
||||
|
||||
|
||||
struct Pci::Device
|
||||
struct Pci::Device : Platform::Device
|
||||
{
|
||||
class Resource
|
||||
{
|
||||
@ -194,10 +199,11 @@ struct Pci::Device
|
||||
unsigned char, Access_size);
|
||||
GENODE_RPC(Rpc_config_write, void, config_write,
|
||||
unsigned char, unsigned, Access_size);
|
||||
GENODE_RPC(Rpc_irq, Genode::Irq_session_capability, irq, Genode::uint8_t);
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_bus_address, Rpc_vendor_id, Rpc_device_id,
|
||||
Rpc_class_code, Rpc_resource, Rpc_config_read,
|
||||
Rpc_config_write);
|
||||
Rpc_config_write, Rpc_irq);
|
||||
};
|
||||
|
||||
#endif /* _INCLUDE__PCI_DEVICE__PCI_DEVICE_H_ */
|
||||
|
26
repos/os/include/platform/device.h
Normal file
26
repos/os/include/platform/device.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* \brief Abstract platform device interface
|
||||
* \author Alexander Boettcher
|
||||
* \date 2015-03-15
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 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 <irq_session/capability.h>
|
||||
|
||||
namespace Platform { class Device; }
|
||||
|
||||
struct Platform::Device
|
||||
{
|
||||
/**
|
||||
* Get IRQ session capability
|
||||
*/
|
||||
virtual Genode::Irq_session_capability irq(Genode::uint8_t) = 0;
|
||||
};
|
@ -168,7 +168,7 @@ class Pci_policy : public Genode::Slave_policy, public Pci::Provider
|
||||
static char const *permitted_services[] = { "CPU", "CAP", "RM",
|
||||
"LOG", "IO_PORT", "PD",
|
||||
"ROM", "RAM", "SIGNAL",
|
||||
"IO_MEM", 0 };
|
||||
"IO_MEM", "IRQ", 0 };
|
||||
return permitted_services;
|
||||
};
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <base/printf.h>
|
||||
|
||||
#include <io_mem_session/io_mem_session.h>
|
||||
#include <irq_session/connection.h>
|
||||
|
||||
#include "pci_device_config.h"
|
||||
|
||||
@ -33,6 +34,10 @@ namespace Pci {
|
||||
Device_config _device_config;
|
||||
Genode::addr_t _config_space;
|
||||
Genode::Io_mem_connection *_io_mem;
|
||||
Config_access _config_access;
|
||||
Genode::Irq_connection _irq;
|
||||
|
||||
enum { PCI_IRQ = 0x3c };
|
||||
|
||||
public:
|
||||
|
||||
@ -42,7 +47,10 @@ namespace Pci {
|
||||
Device_component(Device_config device_config, Genode::addr_t addr)
|
||||
:
|
||||
_device_config(device_config), _config_space(addr),
|
||||
_io_mem(0) { }
|
||||
_io_mem(0),
|
||||
_irq(_device_config.read(&_config_access, PCI_IRQ,
|
||||
Pci::Device::ACCESS_8BIT))
|
||||
{ }
|
||||
|
||||
/****************************************
|
||||
** Methods used solely by pci session **
|
||||
@ -104,6 +112,13 @@ namespace Pci {
|
||||
|
||||
_device_config.write(&config_access, address, value, size);
|
||||
}
|
||||
|
||||
Genode::Irq_session_capability irq(Genode::uint8_t id) override
|
||||
{
|
||||
if (id != 0)
|
||||
return Genode::Irq_session_capability();
|
||||
return _irq_session.cap();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user