Added support for registering master PCI devices with function > 0 (required

for implementing EHCI).
This commit is contained in:
Volker Ruppert 2015-11-04 16:32:16 +00:00
parent 76c065dd89
commit aefccb14ab

View File

@ -1225,13 +1225,13 @@ bx_bool bx_devices_c::register_pci_handlers(bx_pci_device_stub_c *dev,
char *device;
if (strcmp(name, "pci") && strcmp(name, "pci2isa") && strcmp(name, "pci_ide")
&& (*devfunc == 0x00)) {
&& ((*devfunc & 0xf8) == 0x00)) {
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) {
if (!strcmp(name, device)) {
*devfunc = (i + 2) << 3;
*devfunc = ((i + 2) << 3) | (*devfunc & 0x07);
pci.slot_used[i] = 1;
BX_INFO(("PCI slot #%d used by plugin '%s'", i+1, name));
break;
@ -1240,13 +1240,13 @@ bx_bool bx_devices_c::register_pci_handlers(bx_pci_device_stub_c *dev,
first_free_slot = i;
}
}
if (*devfunc == 0x00) {
if ((*devfunc & 0xf8) == 0x00) {
// auto-assign device to PCI slot if possible
if (first_free_slot != -1) {
i = (unsigned)first_free_slot;
sprintf(devname, "pci.slot.%d", i+1);
SIM->get_param_string(devname)->set(name);
*devfunc = (i + 2) << 3;
*devfunc = ((i + 2) << 3) | (*devfunc & 0x07);
pci.slot_used[i] = 1;
BX_INFO(("PCI slot #%d used by plugin '%s'", i+1, name));
} else {