Fixed and improved PCI slot config error handling.

This commit is contained in:
Volker Ruppert 2021-10-14 17:59:08 +00:00
parent 631e839046
commit 1408de3ad2
2 changed files with 7 additions and 4 deletions

View File

@ -2967,12 +2967,15 @@ static int parse_line_formatted(const char *context, int num_params, char *param
if ((slot > 0) && (slot < 6)) {
sprintf(tmpdev, "pci.slot.%d", slot);
if (strlen(&params[i][6]) > 0) {
SIM->get_param_enum(tmpdev)->set_by_name(&params[i][6]);
if (!SIM->get_param_enum(tmpdev)->set_by_name(&params[i][6])) {
PARSE_ERR(("%s: unknown plugin '%s' at PCI slot #%d.",
context, &params[i][6], slot));
}
} else {
SIM->get_param_enum(tmpdev)->set_by_name("none");
}
} else {
BX_ERROR(("%s: unknown pci slot number ignored.", context));
PARSE_ERR(("%s: unknown PCI slot number #%d.", context, slot));
}
} else if (!strncmp(params[i], "advopts=", 8)) {
SIM->get_param_string(BXPN_PCI_ADV_OPTS)->set(&params[i][8]);

View File

@ -373,7 +373,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
if ((chipset == BX_PCI_CHIPSET_I440BX) && is_agp_present()) {
device = SIM->get_param_enum("pci.slot.5")->get_selected();
if (strcmp(device, "none") && !pci.slot_used[4]) {
BX_PANIC(("Unknown plugin '%s' at AGP slot", device));
BX_PANIC(("Plugin '%s' at AGP slot not loaded", device));
}
max_pci_slots = 4;
}
@ -381,7 +381,7 @@ void bx_devices_c::init(BX_MEM_C *newmem)
sprintf(devname, "pci.slot.%d", i+1);
device = SIM->get_param_enum(devname)->get_selected();
if (strcmp(device, "none") && !pci.slot_used[i]) {
BX_PANIC(("Unknown plugin '%s' at PCI slot #%d", device, i+1));
BX_PANIC(("Plugin '%s' at PCI slot #%d not loaded", device, i+1));
}
}
}