dde_kit: upgrade ram support for device iteration

Issue #755
devel
Alexander Boettcher 8 years ago committed by Christian Helmuth
parent 06e7c947bc
commit 0cf8d75346

@ -58,7 +58,6 @@ Pci_tree::Pci_tree(unsigned device_class, unsigned class_mask)
Pci::Device_capability prev_device_cap;
Pci::Device_capability device_cap = _pci_drv.first_device(device_class,
class_mask);
while (device_cap.valid()) {
Pci_device *device = new (env()->heap()) Pci_device(device_cap);
@ -66,10 +65,19 @@ Pci_tree::Pci_tree(unsigned device_class, unsigned class_mask)
_devices.insert(device);
prev_device_cap = device_cap;
device_cap = _pci_drv.next_device(prev_device_cap, device_class,
class_mask);
for (unsigned i = 0; i < 2; i++) {
try {
device_cap = _pci_drv.next_device(prev_device_cap, device_class,
class_mask);
break;
} catch (Pci::Device::Quota_exceeded) {
Genode::env()->parent()->upgrade(_pci_drv.cap(), "ram_quota=4096");
}
}
}
if (verbose)
_show_devices();
}

@ -125,8 +125,32 @@ namespace Dde_kit {
size_t size)
{
/* trigger that the device gets assigned to this driver */
pci_drv.config_extended(_device);
return pci_drv.alloc_dma_buffer(size);
for (unsigned i = 0; i < 2; i++) {
try {
pci_drv.config_extended(_device);
break;
} catch (Pci::Device::Quota_exceeded) {
if (i == 1)
return Ram_dataspace_capability();
Genode::env()->parent()->upgrade(pci_drv.cap(), "ram_quota=4096");
}
}
for (unsigned i = 0; i < 2; i++) {
try {
return pci_drv.alloc_dma_buffer(size);
} catch (Pci::Device::Quota_exceeded) {
if (i == 0) {
char buf[32];
Genode::snprintf(buf, sizeof(buf), "ram_quota=%zd",
size);
Genode::env()->parent()->upgrade(pci_drv.cap(),
buf);
}
}
}
return Ram_dataspace_capability();
}
};

Loading…
Cancel
Save