diff options
author | 2018-05-13 07:41:12 +0200 | |
---|---|---|
committer | 2018-05-13 07:56:01 +0200 | |
commit | 18c91a773fefe0d17097296540421812f4692a54 (patch) | |
tree | b7d806feeb8cc18ca08a0fc692fc5d763946e05a | |
parent | 0fae49dc3136d03736b7ca0f96d739cbc2834666 (diff) |
pci.cpp: devices can ask to be mapped before the others (nw)
Will be used by the isa bridge in the southbridge.
-rw-r--r-- | src/devices/machine/pci.cpp | 14 | ||||
-rw-r--r-- | src/devices/machine/pci.h | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/devices/machine/pci.cpp b/src/devices/machine/pci.cpp index 9ea5de0ace1..a9f5a706bd8 100644 --- a/src/devices/machine/pci.cpp +++ b/src/devices/machine/pci.cpp @@ -540,10 +540,18 @@ void pci_bridge_device::reset_all_mappings() void pci_bridge_device::map_device(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) { - for(int i = int(all_devices.size())-1; i>=0; i--) + const int count = int(all_devices.size()) - 1; + + for(int i = count; i >= 0; i--) + if (all_devices[i] != this) + if (all_devices[i]->map_first()) + all_devices[i]->map_device(memory_window_start, memory_window_end, memory_offset, memory_space, + io_window_start, io_window_end, io_offset, io_space); + for(int i = count; i>=0; i--) if(all_devices[i] != this) - all_devices[i]->map_device(memory_window_start, memory_window_end, memory_offset, memory_space, - io_window_start, io_window_end, io_offset, io_space); + if (!all_devices[i]->map_first()) + all_devices[i]->map_device(memory_window_start, memory_window_end, memory_offset, memory_space, + io_window_start, io_window_end, io_offset, io_space); map_extra(memory_window_start, memory_window_end, memory_offset, memory_space, io_window_start, io_window_end, io_offset, io_space); diff --git a/src/devices/machine/pci.h b/src/devices/machine/pci.h index 92ae8bf97db..14d0dd10859 100644 --- a/src/devices/machine/pci.h +++ b/src/devices/machine/pci.h @@ -41,6 +41,9 @@ public: virtual void map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space); + // Specify if this device must be mapped before all the others on the pci bus + virtual bool map_first() { return false; } + void map_config(uint8_t device, address_space *config_space); virtual void config_map(address_map &map); |