Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port; Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX); Finished the 586MC1; Added 8087 emulation; Moved Cyrix 6x86'es to the Dev branch; Sanitized/cleaned up memregs.c/h and intel.c/h; Split the chipsets from machines and sanitized Port 92 emulation; Added support for the 15bpp mode to the Compaq ATI 28800; Moved the MR 386DX and 486 machines to the Dev branch; Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00; Ported the new timer code from PCem; Cleaned up the CPU table of unused stuff and better optimized its structure; Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch; Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem; Added the AHA-1540A and the BusTek BT-542B; Moved the Sumo SCSI-AT to the Dev branch; Minor IDE, FDC, and floppy drive code clean-ups; Made NCR 5380/53C400-based cards' BIOS address configurable; Got rid of the legacy romset variable; Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit; Added the Amstead PPC512 per PCem patch by John Elliott; Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages); Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing; Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem; Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit; Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement; Amstrad MegaPC does now works correctly with non-internal graphics card; The SLiRP code no longer casts a packed struct type to a non-packed struct type; The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present; The S3 Virge on BeOS is no longer broken (was broken by build #1591); OS/2 2.0 build 6.167 now sees key presses again; Xi8088 now work on CGA again; 86F images converted from either the old or new variants of the HxC MFM format now work correctly; Hardware interrupts with a vector of 0xFF are now handled correctly; OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct; Fixed VNC keyboard input bugs; Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver; Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly; Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4; Compaq Portable now works with all graphics cards; Fixed various MDSI Genius bugs; Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly; Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355; OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400. Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391. Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389. Fixed a minor IDE timing bug, fixes #388. Fixed Toshiba T1000 RAM issues, fixes #379. Fixed EGA/(S)VGA overscan border handling, fixes #378; Got rid of the now long useless IDE channel 2 auto-removal, fixes #370; Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366; Ported the Unicode CD image file name fix from VARCem, fixes #365; Fixed high density floppy disks on the Xi8088, fixes #359; Fixed some bugs in the Hercules emulation, fixes #346, fixes #358; Fixed the SCSI hard disk mode sense pages, fixes #356; Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349; Fixed bugs in the serial mouse emulation, fixes #344; Compiled 86Box binaries now include all the required .DLL's, fixes #341; Made some combo boxes in the Settings dialog slightly wider, fixes #276.
This commit is contained in:
86
src/pci.c
86
src/pci.c
@@ -60,8 +60,9 @@ static uint8_t pci_card_to_slot_mapping[32];
|
||||
static uint8_t elcr[2] = { 0, 0 };
|
||||
static uint8_t pci_irqs[4];
|
||||
static uint64_t pci_irq_hold[16];
|
||||
static pci_mirq_t pci_mirqs[2];
|
||||
static int pci_index,
|
||||
static pci_mirq_t pci_mirqs[3];
|
||||
static int pci_type,
|
||||
pci_index,
|
||||
pci_func,
|
||||
pci_card,
|
||||
pci_bus,
|
||||
@@ -147,10 +148,8 @@ pci_read(uint16_t port, void *priv)
|
||||
if (! pci_bus) {
|
||||
slot = pci_card_to_slot_mapping[pci_card];
|
||||
if (slot != 0xff) {
|
||||
if (pci_cards[slot].read) {
|
||||
pci_log("Reading from PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
||||
if (pci_cards[slot].read)
|
||||
return pci_cards[slot].read(pci_func, pci_index | (port & 3), pci_cards[slot].priv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +310,7 @@ pci_irq_is_level(int irq)
|
||||
uint8_t
|
||||
pci_use_mirq(uint8_t mirq)
|
||||
{
|
||||
if (!PCI || !pci_mirqs[0].enabled)
|
||||
if (!PCI || !pci_mirqs[mirq].enabled)
|
||||
return 0;
|
||||
|
||||
if (pci_mirqs[mirq].irq_line & 0x80)
|
||||
@@ -377,6 +376,7 @@ pci_set_irq(uint8_t card, uint8_t pci_int)
|
||||
uint8_t irq_line = 0;
|
||||
uint8_t level = 0;
|
||||
|
||||
|
||||
if (! last_pci_card) {
|
||||
pci_log("pci_set_irq(%02X, %02X): No PCI slots (how are we even here?!)\n", card, pci_int);
|
||||
return;
|
||||
@@ -395,16 +395,20 @@ pci_set_irq(uint8_t card, uint8_t pci_int)
|
||||
return;
|
||||
}
|
||||
|
||||
irq_routing = (pci_cards[slot].irq_routing[pci_int_index] - PCI_INTA) & 3;
|
||||
pci_log("pci_set_irq(%02X, %02X): IRQ routing for this slot and INT pin combination: %02X\n", card, pci_int, irq_routing);
|
||||
if (pci_type & PCI_NO_IRQ_STEERING)
|
||||
irq_line = pci_cards[slot].read(0, 0x3c, pci_cards[slot].priv);
|
||||
else {
|
||||
irq_routing = (pci_cards[slot].irq_routing[pci_int_index] - PCI_INTA) & 3;
|
||||
pci_log("pci_set_irq(%02X, %02X): IRQ routing for this slot and INT pin combination: %02X\n", card, pci_int, irq_routing);
|
||||
|
||||
if (pci_irqs[irq_routing] > 0x0f) {
|
||||
pci_log("pci_set_irq(%02X, %02X): IRQ line is disabled\n", card, pci_int);
|
||||
return;
|
||||
irq_line = pci_irqs[irq_routing];
|
||||
}
|
||||
|
||||
irq_line = pci_irqs[irq_routing];
|
||||
pci_log("pci_set_irq(%02X, %02X): Using IRQ %i\n", card, pci_int, irq_line);
|
||||
if (irq_line > 0x0f) {
|
||||
pci_log("pci_set_irq(%02X, %02X): IRQ line is disabled\n", card, pci_int);
|
||||
return;
|
||||
} else
|
||||
pci_log("pci_set_irq(%02X, %02X): Using IRQ %i\n", card, pci_int, irq_line);
|
||||
|
||||
if (pci_irq_is_level(irq_line) && (pci_irq_hold[irq_line] & (1ULL << card))) {
|
||||
/* IRQ already held, do nothing. */
|
||||
@@ -413,12 +417,18 @@ pci_set_irq(uint8_t card, uint8_t pci_int)
|
||||
}
|
||||
pci_log("pci_set_irq(%02X, %02X): Card not yet holding the IRQ\n", card, pci_int);
|
||||
|
||||
level = pci_irq_is_level(irq_line);
|
||||
if (pci_type & PCI_NO_IRQ_STEERING)
|
||||
level = 0;
|
||||
else
|
||||
level = pci_irq_is_level(irq_line);
|
||||
if (!level || !pci_irq_hold[irq_line]) {
|
||||
pci_log("pci_set_irq(%02X, %02X): Issuing %s-triggered IRQ (%sheld)\n", card, pci_int, level ? "level" : "edge", pci_irq_hold[irq_line] ? "" : "not ");
|
||||
|
||||
/* Only raise the interrupt if it's edge-triggered or level-triggered and not yet being held. */
|
||||
picintlevel(1 << irq_line);
|
||||
if (level)
|
||||
picintlevel(1 << irq_line);
|
||||
else
|
||||
picint(1 << irq_line);
|
||||
} else if (level && pci_irq_hold[irq_line]) {
|
||||
pci_log("pci_set_irq(%02X, %02X): IRQ line already being held\n", card, pci_int);
|
||||
}
|
||||
@@ -509,15 +519,20 @@ pci_clear_irq(uint8_t card, uint8_t pci_int)
|
||||
return;
|
||||
}
|
||||
|
||||
irq_routing = (pci_cards[slot].irq_routing[pci_int_index] - PCI_INTA) & 3;
|
||||
pci_log("pci_clear_irq(%02X, %02X): IRQ routing for this slot and INT pin combination: %02X\n", card, pci_int, irq_routing);
|
||||
if (pci_type & PCI_NO_IRQ_STEERING)
|
||||
irq_line = pci_cards[slot].read(0, 0x3c, pci_cards[slot].priv);
|
||||
else {
|
||||
irq_routing = (pci_cards[slot].irq_routing[pci_int_index] - PCI_INTA) & 3;
|
||||
pci_log("pci_clear_irq(%02X, %02X): IRQ routing for this slot and INT pin combination: %02X\n", card, pci_int, irq_routing);
|
||||
|
||||
if (pci_irqs[irq_routing] > 0x0f) {
|
||||
irq_line = pci_irqs[irq_routing];
|
||||
}
|
||||
|
||||
if (irq_line > 0x0f) {
|
||||
pci_log("pci_clear_irq(%02X, %02X): IRQ line is disabled\n", card, pci_int);
|
||||
return;
|
||||
}
|
||||
|
||||
irq_line = pci_irqs[irq_routing];
|
||||
pci_log("pci_clear_irq(%02X, %02X): Using IRQ %i\n", card, pci_int, irq_line);
|
||||
|
||||
if (pci_irq_is_level(irq_line) &&
|
||||
@@ -527,7 +542,10 @@ pci_clear_irq(uint8_t card, uint8_t pci_int)
|
||||
return;
|
||||
}
|
||||
|
||||
level = pci_irq_is_level(irq_line);
|
||||
if (pci_type & PCI_NO_IRQ_STEERING)
|
||||
level = 0;
|
||||
else
|
||||
level = pci_irq_is_level(irq_line);
|
||||
if (level) {
|
||||
pci_log("pci_clear_irq(%02X, %02X): Releasing this card's hold on the IRQ\n", card, pci_int);
|
||||
pci_irq_hold[irq_line] &= ~(1 << card);
|
||||
@@ -598,7 +616,12 @@ trc_reset(uint8_t val)
|
||||
if (val & 2) {
|
||||
device_reset_all_pci();
|
||||
|
||||
port_92_reset();
|
||||
cpu_alt_reset = 0;
|
||||
|
||||
mem_a20_alt = 0;
|
||||
mem_a20_recalc();
|
||||
|
||||
flushmmucache();
|
||||
|
||||
pci_reset();
|
||||
}
|
||||
@@ -642,10 +665,14 @@ pci_init(int type)
|
||||
|
||||
trc_init();
|
||||
|
||||
io_sethandler(0x04d0, 0x0002,
|
||||
elcr_read,NULL,NULL, elcr_write,NULL,NULL, NULL);
|
||||
pci_type = type;
|
||||
|
||||
if (type == PCI_CONFIG_TYPE_1) {
|
||||
if (!(type & PCI_NO_IRQ_STEERING)) {
|
||||
io_sethandler(0x04d0, 0x0002,
|
||||
elcr_read,NULL,NULL, elcr_write,NULL,NULL, NULL);
|
||||
}
|
||||
|
||||
if ((type & PCI_CONFIG_TYPE_MASK) == PCI_CONFIG_TYPE_1) {
|
||||
io_sethandler(0x0cf8, 1,
|
||||
NULL,NULL,pci_cf8_read, NULL,NULL,pci_cf8_write, NULL);
|
||||
io_sethandler(0x0cfc, 4,
|
||||
@@ -660,7 +687,7 @@ pci_init(int type)
|
||||
for (c = 0; c < 4; c++)
|
||||
pci_irqs[c] = PCI_IRQ_DISABLED;
|
||||
|
||||
for (c = 0; c < 2; c++) {
|
||||
for (c = 0; c < 3; c++) {
|
||||
pci_mirqs[c].enabled = 0;
|
||||
pci_mirqs[c].irq_line = PCI_IRQ_DISABLED;
|
||||
}
|
||||
@@ -699,12 +726,12 @@ pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv),
|
||||
pci_log("pci_add_card(): Adding PCI CARD at specific slot %02X [SPECIFIC]\n", add_type);
|
||||
|
||||
if (! PCI) {
|
||||
pci_log("pci_add_card(): Adding PCI CARD failed (non-PCI machine) [%s]\n", (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : "SPECIFIC"));
|
||||
pci_log("pci_add_card(): Adding PCI CARD failed (non-PCI machine) [%s]\n", (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : ((add_type == PCI_ADD_SCSI) ? "SCSI" : "SPECIFIC")));
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
if (! last_pci_card) {
|
||||
pci_log("pci_add_card(): Adding PCI CARD failed (no PCI slots) [%s]\n", (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : "SPECIFIC"));
|
||||
pci_log("pci_add_card(): Adding PCI CARD failed (no PCI slots) [%s]\n", (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : ((add_type == PCI_ADD_SCSI) ? "SCSI" : "SPECIFIC")));
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
@@ -714,17 +741,18 @@ pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv),
|
||||
if (!dev->read && !dev->write) {
|
||||
if (((dev->type == PCI_CARD_NORMAL) && (add_type >= PCI_ADD_NORMAL)) ||
|
||||
((dev->type == PCI_CARD_ONBOARD) && (add_type == PCI_ADD_VIDEO)) ||
|
||||
((dev->type == PCI_CARD_SCSI) && (add_type == PCI_ADD_SCSI)) ||
|
||||
((dev->id == add_type) && (add_type < PCI_ADD_NORMAL))) {
|
||||
dev->read = read;
|
||||
dev->write = write;
|
||||
dev->priv = priv;
|
||||
pci_log("pci_add_card(): Adding PCI CARD to pci_cards[%i] (slot %02X) [%s]\n", i, dev->id, (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : "SPECIFIC"));
|
||||
pci_log("pci_add_card(): Adding PCI CARD to pci_cards[%i] (slot %02X) [%s]\n", i, dev->id, (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : ((add_type == PCI_ADD_SCSI) ? "SCSI" : "SPECIFIC")));
|
||||
return dev->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pci_log("pci_add_card(): Adding PCI CARD failed (unable to find a suitable PCI slot) [%s]\n", (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : "SPECIFIC"));
|
||||
pci_log("pci_add_card(): Adding PCI CARD failed (unable to find a suitable PCI slot) [%s]\n", (add_type == PCI_ADD_NORMAL) ? "NORMAL" : ((add_type == PCI_ADD_VIDEO) ? "VIDEO" : ((add_type == PCI_ADD_SCSI) ? "SCSI" : "SPECIFIC")));
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user