- added new plugin type PLUGTYPE_STANDARD for optional plugins which are used in
nearly all cases and plugins that depend on others. These plugins cannot be managed with 'plugin_ctrl' (e.g. keyboard, harddrv, pci_ide). Store the plugin type in the divice structure for compatiblity with the "no-plugin" compilation. Call the device methods init(), reset() and after_restore_state() for each type separately in the order: stanard, optional, user. This also affects the status bar LED feature: now the keyboard and harddrv LEDs are always visible, but those of optional plugins may be invisible if there is no space left. - TODO #1: add the devices 'ne2k' and 'sb16' to 'plugin_ctrl' - TODO #2: manage core plugins with the device plugin system
This commit is contained in:
parent
ba7887f31c
commit
5c49e2458f
@ -28,6 +28,7 @@
|
||||
enum plugintype_t {
|
||||
PLUGTYPE_NULL=100,
|
||||
PLUGTYPE_CORE,
|
||||
PLUGTYPE_STANDARD,
|
||||
PLUGTYPE_OPTIONAL,
|
||||
PLUGTYPE_USER
|
||||
};
|
||||
|
@ -183,26 +183,26 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
#if BX_SUPPORT_PCIUSB
|
||||
PLUG_load_plugin(usb_common, PLUGTYPE_CORE);
|
||||
#endif
|
||||
PLUG_load_plugin(acpi, PLUGTYPE_OPTIONAL);
|
||||
PLUG_load_plugin(acpi, PLUGTYPE_STANDARD);
|
||||
#else
|
||||
BX_ERROR(("Bochs is not compiled with PCI support"));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BX_SUPPORT_APIC
|
||||
PLUG_load_plugin(ioapic, PLUGTYPE_OPTIONAL);
|
||||
PLUG_load_plugin(ioapic, PLUGTYPE_STANDARD);
|
||||
#endif
|
||||
PLUG_load_plugin(keyboard, PLUGTYPE_OPTIONAL);
|
||||
PLUG_load_plugin(keyboard, PLUGTYPE_STANDARD);
|
||||
#if BX_SUPPORT_BUSMOUSE
|
||||
if (mouse_type == BX_MOUSE_TYPE_BUS) {
|
||||
PLUG_load_plugin(busmouse, PLUGTYPE_OPTIONAL);
|
||||
}
|
||||
#endif
|
||||
if (is_harddrv_enabled()) {
|
||||
PLUG_load_plugin(harddrv, PLUGTYPE_OPTIONAL);
|
||||
PLUG_load_plugin(harddrv, PLUGTYPE_STANDARD);
|
||||
#if BX_SUPPORT_PCI
|
||||
if (SIM->get_param_bool(BXPN_I440FX_SUPPORT)->get()) {
|
||||
PLUG_load_plugin(pci_ide, PLUGTYPE_OPTIONAL);
|
||||
PLUG_load_plugin(pci_ide, PLUGTYPE_STANDARD);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -216,7 +216,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
vga_ext = SIM->get_param_string(BXPN_VGA_EXTENSION)->getptr();
|
||||
if ((DEV_is_pci_device("pcivga")) &&
|
||||
((!strlen(vga_ext)) || (!strcmp(vga_ext, "none")) || (!strcmp(vga_ext, "vbe")))) {
|
||||
PLUG_load_plugin(pcivga, PLUGTYPE_OPTIONAL);
|
||||
PLUG_load_plugin(pcivga, PLUGTYPE_STANDARD);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -567,10 +567,12 @@ void pluginRegisterDeviceDevmodel(plugin_t *plugin, plugintype_t type, bx_devmod
|
||||
// plugins are on or off.
|
||||
free(device);
|
||||
return; // Do not add core devices to the devices list.
|
||||
case PLUGTYPE_STANDARD:
|
||||
case PLUGTYPE_OPTIONAL:
|
||||
case PLUGTYPE_USER:
|
||||
default:
|
||||
// The plugin system will manage optional and user devices only.
|
||||
// The plugin system will manage standard, optional and user devices only.
|
||||
device->plugtype = type;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -673,24 +675,25 @@ void bx_init_plugins()
|
||||
{
|
||||
device_t *device;
|
||||
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugtype == PLUGTYPE_STANDARD) {
|
||||
pluginlog->info("init_dev of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->init();
|
||||
}
|
||||
}
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugtype == PLUGTYPE_OPTIONAL) {
|
||||
pluginlog->info("init_dev of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->init();
|
||||
}
|
||||
}
|
||||
#if BX_PLUGINS
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_OPTIONAL) {
|
||||
if (device->plugtype == PLUGTYPE_USER) {
|
||||
pluginlog->info("init_dev of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->init();
|
||||
}
|
||||
}
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_USER) {
|
||||
pluginlog->info("init_dev of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->init();
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (device = devices; device; device = device->next) {
|
||||
pluginlog->info("init_dev of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->init();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -702,24 +705,25 @@ void bx_reset_plugins(unsigned signal)
|
||||
{
|
||||
device_t *device;
|
||||
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugtype == PLUGTYPE_STANDARD) {
|
||||
pluginlog->info("reset of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->reset(signal);
|
||||
}
|
||||
}
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugtype == PLUGTYPE_OPTIONAL) {
|
||||
pluginlog->info("reset of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->reset(signal);
|
||||
}
|
||||
}
|
||||
#if BX_PLUGINS
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_OPTIONAL) {
|
||||
if (device->plugtype == PLUGTYPE_USER) {
|
||||
pluginlog->info("reset of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->reset(signal);
|
||||
}
|
||||
}
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_USER) {
|
||||
pluginlog->info("reset of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->reset(signal);
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (device = devices; device; device = device->next) {
|
||||
pluginlog->info("reset of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->reset(signal);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -759,25 +763,10 @@ void bx_plugins_register_state()
|
||||
{
|
||||
device_t *device;
|
||||
|
||||
#if BX_PLUGINS
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_OPTIONAL) {
|
||||
pluginlog->info("register state of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->register_state();
|
||||
}
|
||||
}
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_USER) {
|
||||
pluginlog->info("register state of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->register_state();
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (device = devices; device; device = device->next) {
|
||||
pluginlog->info("register state of '%s' plugin device by virtual method",device->name);
|
||||
device->devmodel->register_state();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -788,21 +777,22 @@ void bx_plugins_after_restore_state()
|
||||
{
|
||||
device_t *device;
|
||||
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugtype == PLUGTYPE_STANDARD) {
|
||||
device->devmodel->after_restore_state();
|
||||
}
|
||||
}
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugtype == PLUGTYPE_OPTIONAL) {
|
||||
device->devmodel->after_restore_state();
|
||||
}
|
||||
}
|
||||
#if BX_PLUGINS
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_OPTIONAL) {
|
||||
if (device->plugtype == PLUGTYPE_USER) {
|
||||
device->devmodel->after_restore_state();
|
||||
}
|
||||
}
|
||||
for (device = devices; device; device = device->next) {
|
||||
if (device->plugin->type == PLUGTYPE_USER) {
|
||||
device->devmodel->after_restore_state();
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (device = devices; device; device = device->next) {
|
||||
device->devmodel->after_restore_state();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -283,8 +283,9 @@ extern plugin_t *plugins;
|
||||
|
||||
typedef struct _device_t
|
||||
{
|
||||
const char *name;
|
||||
plugin_t *plugin;
|
||||
const char *name;
|
||||
plugin_t *plugin;
|
||||
plugintype_t plugtype;
|
||||
|
||||
class bx_devmodel_c *devmodel; // BBD hack
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user