moved function is_pci_device() to the siminterface class
This commit is contained in:
parent
e415cb9db8
commit
f0a3679e34
@ -151,6 +151,7 @@ public:
|
||||
bx_param_c *get_first_hd() {
|
||||
return get_first_atadevice(BX_ATA_DEVICE_DISK);
|
||||
}
|
||||
virtual bx_bool is_pci_device(const char *name);
|
||||
#if BX_DEBUGGER
|
||||
virtual void debug_break();
|
||||
virtual void debug_interpret_cmd (char *cmd);
|
||||
@ -746,13 +747,33 @@ bx_param_c *bx_real_sim_c::get_first_atadevice(Bit32u search_type)
|
||||
Bit32u type = SIM->get_param_enum(pname)->get();
|
||||
if (present && (type == search_type)) {
|
||||
sprintf(pname, "ata.%d.%s", channel, (slave==0)?"master":"slave");
|
||||
return SIM->get_param(pname);
|
||||
return SIM->get_param(pname);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bx_bool bx_real_sim_c::is_pci_device(const char *name)
|
||||
{
|
||||
#if BX_SUPPORT_PCI
|
||||
unsigned i;
|
||||
char devname[80];
|
||||
char *device;
|
||||
|
||||
if (SIM->get_param_bool(BXPN_PCI_ENABLED)->get()) {
|
||||
for (i = 0; i < BX_N_PCI_SLOTS; i++) {
|
||||
sprintf(devname, "pci.slot.%d", i+1);
|
||||
device = SIM->get_param_string(devname)->getptr();
|
||||
if ((strlen(device) > 0) && (!strcmp(name, device))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if BX_DEBUGGER
|
||||
|
||||
// this can be safely called from either thread.
|
||||
|
@ -711,6 +711,8 @@ public:
|
||||
virtual bx_param_c *get_first_cdrom() {return NULL;}
|
||||
// return first cdrom in ATA interface
|
||||
virtual bx_param_c *get_first_hd() {return NULL;}
|
||||
// return 1 if device is connected to a PCI slot
|
||||
virtual bx_bool is_pci_device(const char *name) {return 0;}
|
||||
#if BX_DEBUGGER
|
||||
// for debugger: same behavior as pressing control-C
|
||||
virtual void debug_break() {}
|
||||
|
@ -1195,24 +1195,6 @@ void bx_pci_device_stub_c::load_pci_rom(const char *path)
|
||||
BX_INFO(("loaded PCI ROM '%s' (size=%u / PCI=%uk)", path, (unsigned) stat_buf.st_size, pci_rom_size >> 10));
|
||||
}
|
||||
|
||||
bx_bool bx_devices_c::is_pci_device(const char *name)
|
||||
{
|
||||
#if BX_SUPPORT_PCI
|
||||
unsigned i;
|
||||
char devname[80];
|
||||
char *device;
|
||||
|
||||
for (i = 0; i < BX_N_PCI_SLOTS; i++) {
|
||||
sprintf(devname, "pci.slot.%d", i+1);
|
||||
device = SIM->get_param_string(devname)->getptr();
|
||||
if ((strlen(device) > 0) && (!strcmp(name, device))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_PCI
|
||||
bx_bool bx_devices_c::register_pci_handlers(bx_pci_device_stub_c *dev,
|
||||
Bit8u *devfunc, const char *name,
|
||||
|
@ -258,7 +258,7 @@ void bx_svga_cirrus_c::init_vga_extension(void)
|
||||
// initialize SVGA stuffs.
|
||||
BX_CIRRUS_THIS bx_vgacore_c::init_iohandlers(svga_read_handler, svga_write_handler);
|
||||
BX_CIRRUS_THIS bx_vgacore_c::init_systemtimer(svga_timer_handler, svga_param_handler);
|
||||
BX_CIRRUS_THIS pci_enabled = DEV_is_pci_device("cirrus");
|
||||
BX_CIRRUS_THIS pci_enabled = SIM->is_pci_device("cirrus");
|
||||
BX_CIRRUS_THIS svga_init_members();
|
||||
#if BX_SUPPORT_PCI
|
||||
if (BX_CIRRUS_THIS pci_enabled)
|
||||
|
@ -93,7 +93,7 @@ void bx_vga_c::init_vga_extension(void)
|
||||
|
||||
BX_VGA_THIS init_iohandlers(read_handler, write_handler);
|
||||
BX_VGA_THIS init_systemtimer(timer_handler, vga_param_handler);
|
||||
BX_VGA_THIS pci_enabled = DEV_is_pci_device("pcivga");
|
||||
BX_VGA_THIS pci_enabled = SIM->is_pci_device("pcivga");
|
||||
|
||||
// The following is for the VBE display extension
|
||||
BX_VGA_THIS vbe_present = 0;
|
||||
|
@ -422,7 +422,6 @@ public:
|
||||
void mouse_enabled_changed(bx_bool enabled);
|
||||
void mouse_motion(int delta_x, int delta_y, int delta_z, unsigned button_state, bx_bool absxy);
|
||||
|
||||
bx_bool is_pci_device(const char *name);
|
||||
#if BX_SUPPORT_PCI
|
||||
Bit32u pci_get_confAddr(void) {return pci.confAddr;}
|
||||
bx_bool register_pci_handlers(bx_pci_device_stub_c *device, Bit8u *devfunc,
|
||||
|
@ -89,14 +89,8 @@ Bit32s ne2k_options_parser(const char *context, int num_params, char *params[])
|
||||
if (!SIM->get_param_bool("enabled", base)->get()) {
|
||||
SIM->get_param_enum("ethmod", base)->set_by_name("null");
|
||||
}
|
||||
if (SIM->get_param_bool(BXPN_PCI_ENABLED)->get()) {
|
||||
for (int slot = 1; slot < 6; slot++) {
|
||||
sprintf(tmpdev, "pci.slot.%d", slot);
|
||||
if (!strcmp(SIM->get_param_string(tmpdev)->getptr(), "ne2k")) {
|
||||
valid |= 0x03;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (SIM->is_pci_device(BX_PLUGIN_NE2K)) {
|
||||
valid |= 0x03;
|
||||
}
|
||||
for (int i = 1; i < num_params; i++) {
|
||||
if (!strncmp(params[i], "ioaddr=", 7)) {
|
||||
@ -216,13 +210,11 @@ void bx_ne2k_c::init(void)
|
||||
return;
|
||||
}
|
||||
memcpy(macaddr, SIM->get_param_string("macaddr", base)->getptr(), 6);
|
||||
BX_NE2K_THIS s.pci_enabled = 0;
|
||||
strcpy(devname, "NE2000 NIC");
|
||||
BX_NE2K_THIS s.pci_enabled = SIM->is_pci_device(BX_PLUGIN_NE2K);
|
||||
|
||||
#if BX_SUPPORT_PCI
|
||||
if ((SIM->get_param_bool(BXPN_PCI_ENABLED)->get()) &&
|
||||
(DEV_is_pci_device(BX_PLUGIN_NE2K))) {
|
||||
BX_NE2K_THIS s.pci_enabled = 1;
|
||||
if (BX_NE2K_THIS s.pci_enabled) {
|
||||
strcpy(devname, "NE2000 PCI NIC");
|
||||
BX_NE2K_THIS s.devfunc = 0x00;
|
||||
DEV_register_pci_handlers(this, &BX_NE2K_THIS s.devfunc,
|
||||
|
@ -223,7 +223,6 @@ extern "C" {
|
||||
///////// PCI macros
|
||||
#define DEV_register_pci_handlers(a,b,c,d) \
|
||||
(bx_devices.register_pci_handlers(a,b,c,d))
|
||||
#define DEV_is_pci_device(name) bx_devices.is_pci_device(name)
|
||||
#define DEV_pci_get_confAddr() bx_devices.pci_get_confAddr()
|
||||
#define DEV_pci_set_irq(a,b,c) bx_devices.pluginPci2IsaBridge->pci_set_irq(a,b,c)
|
||||
#define DEV_pci_set_base_mem(a,b,c,d,e,f) \
|
||||
|
Loading…
Reference in New Issue
Block a user