pci: remove device_cap from dma calls

Issue #1486
devel
Alexander Boettcher 8 years ago committed by Christian Helmuth
parent 0ed45d92ff
commit e4d663cf41

@ -203,7 +203,7 @@ struct Pci_driver
/* trigger that the device gets assigned to this driver */
_pci.config_extended(_cap);
Ram_dataspace_capability ram_cap;
ram_cap = _pci.alloc_dma_buffer(_cap, size);
ram_cap = _pci.alloc_dma_buffer(size);
_region.mapped_base = (Genode::addr_t)env()->rm_session()->attach(ram_cap);
_region.base = Dataspace_client(ram_cap).phys_addr();

@ -250,7 +250,6 @@ struct Dma_object : Memory_object_base
** Linux interface **
*********************/
static Pci::Device_capability pci_device_cap;
static Pci::Connection pci;
static Genode::Object_pool<Memory_object_base> memory_pool;
@ -288,13 +287,6 @@ int pci_register_driver(struct pci_driver *drv)
Pci_driver *pci_drv = 0;
try {
/*
* Assign cap already here, since for probing already DMA
* buffer is required and allocated by
* Genode::Mem::alloc_dma_buffer(size_t size)
*/
pci_device_cap = cap;
/* trigger that the device get be assigned to the usb driver */
pci.config_extended(cap);
@ -395,7 +387,7 @@ const char *pci_name(const struct pci_dev *pdev)
void Ram_object::free() { Genode::env()->ram_session()->free(ram_cap()); }
void Dma_object::free() { pci.free_dma_buffer(pci_device_cap, ram_cap()); }
void Dma_object::free() { pci.free_dma_buffer(ram_cap()); }
Genode::Ram_dataspace_capability
@ -409,7 +401,7 @@ Backend_memory::alloc(Genode::addr_t size, Genode::Cache_attribute cached)
cap = env()->ram_session()->alloc(size);
o = new (env()->heap()) Ram_object(cap);
} else {
cap = pci.alloc_dma_buffer(pci_device_cap, size);
cap = pci.alloc_dma_buffer(size);
o = new (env()->heap()) Dma_object(cap);
}

@ -293,11 +293,6 @@ extern "C" int pci_register_driver(struct pci_driver *drv)
while (cap.valid()) {
Pci_driver *pci_drv = 0;
try {
/*
* Assign cap already here, since for probing already DMA
* buffer is required and allocated by
* Genode::Mem::alloc_dma_buffer(size_t size)
*/
pci_device_cap = cap;
/* trigger that the device get be assigned to the wifi driver */
@ -449,7 +444,7 @@ extern "C" int pcie_capability_read_word(struct pci_dev *pdev, int pos, u16 *val
void Ram_object::free() { Genode::env()->ram_session()->free(ram_cap()); }
void Dma_object::free() { pci()->free_dma_buffer(pci_device_cap, ram_cap()); }
void Dma_object::free() { pci()->free_dma_buffer(ram_cap()); }
Genode::Ram_dataspace_capability
@ -463,7 +458,7 @@ Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached)
cap = env()->ram_session()->alloc(size);
o = new (env()->heap()) Ram_object(cap);
} else {
cap = pci()->alloc_dma_buffer(pci_device_cap, size);
cap = pci()->alloc_dma_buffer(size);
o = new (env()->heap()) Dma_object(cap);
}

@ -26,27 +26,25 @@ struct Pci::Session_client : public Genode::Rpc_client<Session>
: Genode::Rpc_client<Session>(session) { }
Device_capability first_device(unsigned device_class = 0,
unsigned class_mask = 0) {
unsigned class_mask = 0) override {
return call<Rpc_first_device>(device_class, class_mask); }
Device_capability next_device(Device_capability prev_device,
unsigned device_class = 0,
unsigned class_mask = 0) {
unsigned class_mask = 0) override {
return call<Rpc_next_device>(prev_device, device_class, class_mask); }
void release_device(Device_capability device) {
void release_device(Device_capability device) override {
call<Rpc_release_device>(device); }
Genode::Io_mem_dataspace_capability config_extended(Device_capability device_cap) {
Genode::Io_mem_dataspace_capability config_extended(Device_capability device_cap) override {
return call<Rpc_config_extended>(device_cap); }
Genode::Ram_dataspace_capability alloc_dma_buffer(Device_capability device_cap,
Genode::size_t size) {
return call<Rpc_alloc_dma_buffer>(device_cap, size); }
Genode::Ram_dataspace_capability alloc_dma_buffer(Genode::size_t size) override {
return call<Rpc_alloc_dma_buffer>(size); }
void free_dma_buffer(Device_capability device_cap,
Genode::Ram_dataspace_capability cap) {
call<Rpc_free_dma_buffer>(device_cap, cap); }
void free_dma_buffer(Genode::Ram_dataspace_capability cap) override {
call<Rpc_free_dma_buffer>(cap); }
};
#endif /* _INCLUDE__PCI_SESSION__CLIENT_H_ */

@ -64,14 +64,12 @@ struct Pci::Session : Genode::Session
/**
* Allocate memory suitable for DMA.
*/
virtual Genode::Ram_dataspace_capability alloc_dma_buffer(Device_capability,
Genode::size_t) = 0;
virtual Genode::Ram_dataspace_capability alloc_dma_buffer(Genode::size_t) = 0;
/**
* Free previously allocated DMA memory
*/
virtual void free_dma_buffer(Device_capability,
Genode::Ram_dataspace_capability) = 0;
virtual void free_dma_buffer(Genode::Ram_dataspace_capability) = 0;
/*********************
** RPC declaration **
@ -87,9 +85,9 @@ struct Pci::Session : Genode::Session
GENODE_RPC_THROW(Rpc_alloc_dma_buffer, Genode::Ram_dataspace_capability,
alloc_dma_buffer,
GENODE_TYPE_LIST(Genode::Ram_session::Quota_exceeded),
Device_capability, Genode::size_t);
Genode::size_t);
GENODE_RPC(Rpc_free_dma_buffer, void, free_dma_buffer,
Device_capability, Genode::Ram_dataspace_capability);
Genode::Ram_dataspace_capability);
GENODE_RPC_INTERFACE(Rpc_first_device, Rpc_next_device,
Rpc_release_device, Rpc_config_extended,

@ -40,7 +40,6 @@ class Ahci_device : public Ahci_device_base
::Pci::Connection &_pci;
::Pci::Device_client *_pci_device;
::Pci::Device_capability _pci_device_cap;
/**
* Return next PCI device
@ -188,8 +187,6 @@ class Ahci_device : public Ahci_device_base
device->_irq->sigh(cap);
device->_irq->ack_irq();
/* remember pci_device to be able to allocate ram memory which is dma able */
device->_pci_device_cap = device_cap;
device->_pci_device = pci_device;
/* trigger assignment of pci device to the ahci driver */
pci.config_extended(device_cap);
@ -208,10 +205,10 @@ class Ahci_device : public Ahci_device_base
}
Ram_dataspace_capability alloc_dma_buffer(size_t size) {
return _pci.alloc_dma_buffer(_pci_device_cap, size); }
return _pci.alloc_dma_buffer(size); }
void free_dma_buffer(Ram_dataspace_capability cap) {
return _pci.free_dma_buffer(_pci_device_cap, cap); }
return _pci.free_dma_buffer(cap); }
};
#endif /* _AHCI_DEVICE_H_ */

@ -315,8 +315,7 @@ namespace Pci {
*/
typedef Genode::Ram_dataspace_capability Ram_capability;
Ram_capability alloc_dma_buffer(Device_capability device_cap,
Genode::size_t size)
Ram_capability alloc_dma_buffer(Genode::size_t size)
{
if (Genode::env()->ram_session()->transfer_quota(_ram->cap(),
size))
@ -331,7 +330,7 @@ namespace Pci {
return ram;
}
void free_dma_buffer(Device_capability, Ram_capability ram)
void free_dma_buffer(Ram_capability ram)
{
if (ram.valid())
_ram->free(ram);

@ -126,7 +126,7 @@ namespace Dde_kit {
{
/* trigger that the device gets assigned to this driver */
pci_drv.config_extended(_device);
return pci_drv.alloc_dma_buffer(_device, size);
return pci_drv.alloc_dma_buffer(size);
}
};

Loading…
Cancel
Save