diff --git a/src/86box.c b/src/86box.c index d129de4d0..ec0967237 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1109,6 +1109,10 @@ pc_reset_hard_init(void) /* Reset any ISA RTC cards. */ isartc_reset(); + /* Initialize the Voodoo cards here inorder to minmize + the chances of the SCSI controller ending up on the bridge. */ + video_voodoo_init(); + ui_sb_update_panes(); if (config_changed) { diff --git a/src/device/pci_bridge.c b/src/device/pci_bridge.c index 889ee8ebb..0a6a173f1 100644 --- a/src/device/pci_bridge.c +++ b/src/device/pci_bridge.c @@ -493,16 +493,15 @@ pci_bridge_init(const device_t *info) pci_bridge_reset(dev); - if (AGP_BRIDGE(dev->local)) - pci_add_card(PCI_ADD_AGPBRIDGE, pci_bridge_read, pci_bridge_write, dev, &dev->slot); - else - dev->slot = pci_add_bridge(pci_bridge_read, pci_bridge_write, dev); + pci_add_bridge(AGP_BRIDGE(dev->local), pci_bridge_read, pci_bridge_write, dev, &dev->slot); interrupt_count = sizeof(interrupts); interrupt_mask = interrupt_count - 1; if (dev->slot < 32) { - for (uint8_t i = 0; i < interrupt_count; i++) + for (uint8_t i = 0; i < interrupt_count; i++) { interrupts[i] = pci_get_int(dev->slot, PCI_INTA + i); + pclog("interrupts[%i] = %i\n", i, interrupts[i]); + } } pci_bridge_log("PCI Bridge %d: upstream bus %02X slot %02X interrupts %02X %02X %02X %02X\n", dev->bus_index, (dev->slot >> 5) & 0xff, dev->slot & 31, interrupts[0], interrupts[1], interrupts[2], interrupts[3]); diff --git a/src/include/86box/pci.h b/src/include/86box/pci.h index d7d77b560..6ea53c51d 100644 --- a/src/include/86box/pci.h +++ b/src/include/86box/pci.h @@ -255,8 +255,9 @@ extern void pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, uint8_t *slot); /* Add an instance of the PCI bridge. */ -extern uint8_t pci_add_bridge(uint8_t (*read)(int func, int addr, void *priv), - void (*write)(int func, int addr, uint8_t val, void *priv), void *priv); +extern void pci_add_bridge(uint8_t agp, uint8_t (*read)(int func, int addr, void *priv), + void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, + uint8_t *slot); /* Register the cards that have been added into slots. */ extern void pci_register_cards(void); diff --git a/src/include/86box/video.h b/src/include/86box/video.h index b915fe35d..78395a2f6 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -263,6 +263,8 @@ extern void video_close(void); extern void video_reset_close(void); extern void video_pre_reset(int card); extern void video_reset(int card); +extern void video_post_reset(void); +extern void video_voodoo_init(void); extern uint8_t video_force_resize_get_monitor(int monitor_index); extern void video_force_resize_set_monitor(uint8_t res, int monitor_index); extern void video_update_timing(void); diff --git a/src/machine/machine.c b/src/machine/machine.c index b9bb23ed0..70228390d 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -118,17 +118,7 @@ machine_init_ex(int m) if (bios_only || !ret) return ret; - if (gfxcard[0] != VID_NONE) { - if (ibm8514_enabled) { - ibm8514_device_add(); - } - if (xga_enabled) - xga_device_add(); - } - - /* Reset the graphics card (or do nothing if it was already done - by the machine's init function). */ - video_reset(gfxcard[0]); + video_post_reset(); return ret; } diff --git a/src/pci.c b/src/pci.c index 790cabaf8..592da0bde 100644 --- a/src/pci.c +++ b/src/pci.c @@ -673,6 +673,8 @@ pci_register_bus_slot(int bus, int card, int type, int inta, int intb, int intc, pci_card_to_slot_mapping[bus][card] = last_pci_card; pci_log("pci_register_slot(): pci_cards[%i].bus = %02X; .id = %02X\n", last_pci_card, bus, card); + pclog("pci_register_slot(): pci_cards[%i].bus = %02X; .id = %02X; %02X %02X %02X %02X\n", + last_pci_card, bus, card, inta, intb, intc, intd); if (type == PCI_CARD_NORMAL) { last_normal_pci_card++; @@ -797,17 +799,18 @@ pci_register_card(int pci_card) } /* Add an instance of the PCI bridge. */ -uint8_t -pci_add_bridge(uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv) +void +pci_add_bridge(uint8_t agp, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv, uint8_t *slot) { pci_card_t *card; + uint8_t bridge_slot = agp ? pci_find_slot(PCI_ADD_AGPBRIDGE, 0xff) : last_normal_pci_card_id; - card = &pci_cards[last_normal_pci_card_id]; + card = &pci_cards[bridge_slot]; card->read = read; card->write = write; card->priv = priv; - return last_normal_pci_card_id; + *slot = bridge_slot; } /* Register the cards that have been added into slots. */ diff --git a/src/video/vid_table.c b/src/video/vid_table.c index c417229dc..6c4314d7d 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -363,11 +363,31 @@ video_reset(int card) device_add(video_cards[card].device); } + was_reset = 1; +} + +void +video_post_reset(void) +{ + if (gfxcard[0] != VID_NONE) { + if (ibm8514_enabled) { + ibm8514_device_add(); + } + if (xga_enabled) + xga_device_add(); + } + + /* Reset the graphics card (or do nothing if it was already done + by the machine's init function). */ + video_reset(gfxcard[0]); +} + +void +video_voodoo_init(void) +{ /* Enable the Voodoo if configured. */ if (voodoo_enabled) device_add(&voodoo_device); - - was_reset = 1; } int