Add settings when adding pci device.

This commit is contained in:
joevt 2023-10-17 19:55:58 -07:00 committed by dingusdev
parent ebb51addd7
commit d426d0faeb
2 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/common/pci/pcihost.h>
#include <devices/deviceregistry.h>
#include <devices/memctrl/memctrlbase.h>
#include <machines/machinefactory.h>
#include <machines/machinebase.h>
#include <endianswap.h>
#include <loguru.hpp>
@ -101,7 +102,10 @@ PCIDevice *PCIHost::attach_pci_device(const std::string& dev_name, int slot_id,
}
// attempt to create device object
auto dev_obj = DeviceRegistry::get_descriptor(dev_name).m_create_func();
auto desc = DeviceRegistry::get_descriptor(dev_name);
map<string, string> settings;
MachineFactory::get_device_settings(desc, settings);
auto dev_obj = desc.m_create_func();
if (!dev_obj->supports_type(HWCompType::PCI_DEV)) {
HWComponent *hwc = dynamic_cast<HWComponent*>(this);

View File

@ -57,6 +57,7 @@ public:
static int create(string& mach_id);
static int create_machine_for_id(string& id, string& rom_filepath);
static void get_device_settings(DeviceDescription& dev, map<string, string> &settings);
static int get_machine_settings(const string& id, map<string, string> &settings);
static void set_machine_settings(map<string, string> &settings);
@ -67,7 +68,6 @@ private:
static void create_device(string& dev_name, DeviceDescription& dev);
static void print_settings(PropMap& p);
static void list_device_settings(DeviceDescription& dev);
static void get_device_settings(DeviceDescription& dev, map<string, string> &settings);
static int load_boot_rom(string& rom_filepath);
static map<string, MachineDescription> & get_registry() {