pci_session: add free_dma_buffer call (Fix #1037)

This commit is contained in:
Stefan Kalkowski 2014-01-24 10:11:25 +01:00 committed by Christian Helmuth
parent aa02fb8256
commit c888ff0d76
3 changed files with 24 additions and 4 deletions

View File

@ -25,12 +25,12 @@ namespace Pci {
: Genode::Rpc_client<Session>(session) { }
Device_capability first_device(unsigned device_class = 0,
unsigned class_mask = 0) {
unsigned class_mask = 0) {
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) {
return call<Rpc_next_device>(prev_device, device_class, class_mask); }
void release_device(Device_capability device) {
@ -42,6 +42,10 @@ namespace Pci {
Genode::Ram_dataspace_capability alloc_dma_buffer(Device_capability device_cap,
Genode::size_t size) {
return call<Rpc_alloc_dma_buffer>(device_cap, size); }
void free_dma_buffer(Device_capability device_cap,
Genode::Ram_dataspace_capability cap) {
call<Rpc_free_dma_buffer>(device_cap, cap); }
};
}

View File

@ -62,6 +62,13 @@ namespace Pci {
*/
virtual Genode::Ram_dataspace_capability alloc_dma_buffer(Device_capability,
Genode::size_t) = 0;
/**
* Free previously allocated DMA memory
*/
virtual void free_dma_buffer(Device_capability,
Genode::Ram_dataspace_capability) = 0;
/*********************
** RPC declaration **
*********************/
@ -77,10 +84,12 @@ namespace Pci {
alloc_dma_buffer,
GENODE_TYPE_LIST(Genode::Ram_session::Quota_exceeded),
Device_capability, Genode::size_t);
GENODE_RPC(Rpc_free_dma_buffer, void, free_dma_buffer,
Device_capability, Genode::Ram_dataspace_capability);
GENODE_RPC_INTERFACE(Rpc_first_device, Rpc_next_device,
Rpc_release_device, Rpc_config_extended,
Rpc_alloc_dma_buffer);
Rpc_alloc_dma_buffer, Rpc_free_dma_buffer);
};
}

View File

@ -149,7 +149,7 @@ namespace Pci {
Config_space *e = config_space_list().first();
for (; e && (config_space == ~0UL); e = e->next())
config_space = e->lookup_config_space(bdf);
return config_space;
}
@ -321,6 +321,13 @@ namespace Pci {
return ram;
}
void free_dma_buffer(Device_capability device_cap,
Genode::Ram_dataspace_capability cap)
{
if (cap.valid())
Genode::env()->ram_session()->free(cap);
}
};