Skip to content

Commit

Permalink
platform(x86): avoid multiple assignment messages
Browse files Browse the repository at this point in the history
The new ported linux drivers multiple times trigger this assignment,
whereby exactly one time is sufficient.

Issue #4416
Issue #4450
Issue #4455
  • Loading branch information
alex-ab authored and chelmuth committed Apr 13, 2022
1 parent 1dc92c4 commit 6994354
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion repos/os/src/drivers/platform/legacy/x86/pci_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ void Platform::Device_component::config_write(unsigned char address,
}

/* assign device to device_pd */
if (address == Device_config::PCI_CMD_REG &&
if (!_device_assigned &&
address == Device_config::PCI_CMD_REG &&
(value & Device_config::PCI_CMD_DMA)) {

try { _session.assign_device(this); }
Expand All @@ -147,6 +148,7 @@ void Platform::Device_component::config_write(unsigned char address,
catch (...) {
error("assignment to device failed");
}
_device_assigned = true;
_device_used = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Platform::Device_component : public Rpc_object<Platform::Device>,
Irq_session_component *_irq_session = nullptr;
unsigned short _irq_line;
bool _device_used { false };
bool _device_assigned { false };
Allocator &_global_heap;

class Io_mem : public Io_mem_connection,
Expand Down

0 comments on commit 6994354

Please sign in to comment.