mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 19:26:29 +00:00
device_pd: survive failing attachment request
Be more robust. If the attachment fails continue to operate and just print a error message. Before the commit the device_pd stopped to operate if an attachment did not succeed. Issue #683
This commit is contained in:
parent
82eb5e4323
commit
39f32b5bd6
@ -30,10 +30,21 @@ void Pci::Device_pd_component::attach_dma_mem(Genode::Ram_dataspace_capability d
|
||||
|
||||
Dataspace_client ds_client(ds_cap);
|
||||
|
||||
addr_t page = env()->rm_session()->attach_at(ds_cap, ds_client.phys_addr());
|
||||
addr_t page = ~0UL;
|
||||
|
||||
try {
|
||||
page = env()->rm_session()->attach_at(ds_cap, ds_client.phys_addr());
|
||||
} catch (...) { }
|
||||
|
||||
/* sanity check */
|
||||
if (page != ds_client.phys_addr())
|
||||
throw Rm_session::Region_conflict();
|
||||
if ((page == ~0UL) || (page != ds_client.phys_addr())) {
|
||||
if (page != ~0UL)
|
||||
env()->rm_session()->detach(page);
|
||||
|
||||
PERR("attachment of DMA memory @ %lx+%zx failed",
|
||||
ds_client.phys_addr(), ds_client.size());
|
||||
return;
|
||||
}
|
||||
|
||||
/* trigger mapping of whole memory area */
|
||||
for (size_t rounds = (ds_client.size() + 1) / 4096; rounds;
|
||||
|
Loading…
Reference in New Issue
Block a user