dde_ipxe: upgrade quota for nic_drv

Issue #755
This commit is contained in:
Alexander Boettcher 2015-04-10 20:52:21 +02:00 committed by Christian Helmuth
parent 0cf8d75346
commit 828ae3800d
1 changed files with 16 additions and 3 deletions

View File

@ -201,9 +201,22 @@ struct Pci_driver
using namespace Genode;
/* trigger that the device gets assigned to this driver */
_pci.config_extended(_cap);
Ram_dataspace_capability ram_cap;
ram_cap = _pci.alloc_dma_buffer(size);
for (unsigned i = 0; i < 2; i++) {
try {
_pci.config_extended(_cap);
break;
} catch (Pci::Device::Quota_exceeded) {
Genode::env()->parent()->upgrade(_pci.cap(), "ram_quota=4096");
}
}
/* transfer quota to pci driver, otherwise it will give us a exception */
char buf[32];
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd", size);
Genode::env()->parent()->upgrade(_pci.cap(), buf);
Ram_dataspace_capability 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();