2018-10-21 20:27:57 +02:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Implementation the PCI bus.
|
|
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2018-10-21 20:27:57 +02:00
|
|
|
*
|
|
|
|
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
|
|
|
|
* Fred N. van Kempen, <decwiz@yahoo.com>
|
|
|
|
|
* Sarah Walker, <tommowalker@tommowalker.co.uk>
|
|
|
|
|
*
|
2020-01-11 22:31:50 +01:00
|
|
|
* Copyright 2016-2020 Miran Grca.
|
|
|
|
|
* Copyright 2017-2020 Fred N. van Kempen.
|
|
|
|
|
* Copyright 2008-2020 Sarah Walker.
|
2018-10-21 20:27:57 +02:00
|
|
|
*/
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string.h>
|
2017-08-30 04:49:20 +02:00
|
|
|
#include <stdarg.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <wchar.h>
|
2017-12-10 02:53:10 -05:00
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/machine.h>
|
2020-02-29 19:12:23 +01:00
|
|
|
#include "cpu.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/io.h>
|
|
|
|
|
#include <86box/pic.h>
|
|
|
|
|
#include <86box/mem.h>
|
|
|
|
|
#include <86box/device.h>
|
2020-06-12 23:29:12 +02:00
|
|
|
#include <86box/dma.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/pci.h>
|
|
|
|
|
#include <86box/keyboard.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-08-24 01:14:39 -04:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
typedef struct {
|
|
|
|
|
uint8_t id, type;
|
|
|
|
|
uint8_t irq_routing[4];
|
2017-06-02 01:38:25 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
void *priv;
|
|
|
|
|
void (*write)(int func, int addr, uint8_t val, void *priv);
|
|
|
|
|
uint8_t (*read)(int func, int addr, void *priv);
|
2017-08-30 04:49:20 +02:00
|
|
|
} pci_card_t;
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
typedef struct {
|
|
|
|
|
uint8_t enabled;
|
|
|
|
|
uint8_t irq_line;
|
2017-09-04 05:15:12 +02:00
|
|
|
} pci_mirq_t;
|
|
|
|
|
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
int pci_burst_time,
|
|
|
|
|
pci_nonburst_time;
|
|
|
|
|
|
|
|
|
|
static pci_card_t pci_cards[32];
|
2020-06-21 05:23:49 +02:00
|
|
|
static uint8_t pci_pmc = 0, last_pci_card = 0;
|
2018-10-21 20:27:57 +02:00
|
|
|
static uint8_t pci_card_to_slot_mapping[32];
|
|
|
|
|
static uint8_t elcr[2] = { 0, 0 };
|
2020-01-11 22:31:50 +01:00
|
|
|
static uint8_t pci_irqs[4], pci_irq_level[4];
|
2018-10-21 20:27:57 +02:00
|
|
|
static uint64_t pci_irq_hold[16];
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
static pci_mirq_t pci_mirqs[3];
|
|
|
|
|
static int pci_type,
|
2020-06-21 05:23:49 +02:00
|
|
|
pci_switch,
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
pci_index,
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_func,
|
|
|
|
|
pci_card,
|
|
|
|
|
pci_bus,
|
|
|
|
|
pci_enable,
|
|
|
|
|
pci_key;
|
2020-01-11 22:31:50 +01:00
|
|
|
static int trc_reg = 0, elcr_enabled = 1;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2020-06-21 05:23:49 +02:00
|
|
|
static void pci_reset_regs(void);
|
|
|
|
|
|
|
|
|
|
|
2017-10-16 06:19:18 +02:00
|
|
|
#ifdef ENABLE_PCI_LOG
|
|
|
|
|
int pci_do_log = ENABLE_PCI_LOG;
|
2017-09-07 01:52:36 +02:00
|
|
|
|
2017-11-24 02:23:00 -05:00
|
|
|
|
|
|
|
|
static void
|
2018-10-19 00:39:32 +02:00
|
|
|
pci_log(const char *fmt, ...)
|
2017-08-30 04:49:20 +02:00
|
|
|
{
|
2018-10-19 00:39:32 +02:00
|
|
|
va_list ap;
|
2017-12-05 23:35:35 +01:00
|
|
|
|
2018-10-19 00:39:32 +02:00
|
|
|
if (pci_do_log) {
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
2018-10-19 00:39:32 +02:00
|
|
|
#else
|
|
|
|
|
#define pci_log(fmt, ...)
|
|
|
|
|
#endif
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2017-11-24 02:23:00 -05:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
static void
|
|
|
|
|
pci_cf8_write(uint16_t port, uint32_t val, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2020-04-16 21:56:19 +02:00
|
|
|
pci_log("cf8 write: %08X\n", val);
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_index = val & 0xff;
|
|
|
|
|
pci_func = (val >> 8) & 7;
|
|
|
|
|
pci_card = (val >> 11) & 31;
|
|
|
|
|
pci_bus = (val >> 16) & 0xff;
|
|
|
|
|
pci_enable = (val >> 31) & 1;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
static uint32_t
|
|
|
|
|
pci_cf8_read(uint16_t port, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
return pci_index | (pci_func << 8) |
|
|
|
|
|
(pci_card << 11) | (pci_bus << 16) | (pci_enable << 31);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pci_write(uint16_t port, uint8_t val, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t slot = 0;
|
|
|
|
|
|
2020-04-16 21:56:19 +02:00
|
|
|
if (in_smm)
|
|
|
|
|
pci_log("(%i) %03x write: %02X\n", pci_enable, port, val);
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
switch (port) {
|
|
|
|
|
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
|
|
|
|
if (! pci_enable)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-04-16 21:56:19 +02:00
|
|
|
pci_log("Writing %02X to PCI card on bus %i, slot %02X (pci_cards[%i]) (%02X:%02X)...\n", val, pci_bus, pci_card, slot, pci_func, pci_index);
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! pci_bus) {
|
2017-08-30 04:49:20 +02:00
|
|
|
slot = pci_card_to_slot_mapping[pci_card];
|
2018-10-21 20:27:57 +02:00
|
|
|
if (slot != 0xff) {
|
|
|
|
|
if (pci_cards[slot].write) {
|
2018-11-08 19:21:55 +01:00
|
|
|
pci_log("Writing to PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
2017-08-30 04:49:20 +02:00
|
|
|
pci_cards[slot].write(pci_func, pci_index | (port & 3), val, pci_cards[slot].priv);
|
|
|
|
|
}
|
2020-03-23 02:41:18 +01:00
|
|
|
#ifdef ENABLE_PCI_LOG
|
|
|
|
|
else
|
|
|
|
|
pci_log("Writing to empty PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
2020-03-23 02:41:18 +01:00
|
|
|
#ifdef ENABLE_PCI_LOG
|
|
|
|
|
else
|
|
|
|
|
pci_log("Writing to unassigned PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
static uint8_t
|
|
|
|
|
pci_read(uint16_t port, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t slot = 0;
|
2020-04-16 21:56:19 +02:00
|
|
|
uint8_t ret = 0xff;
|
|
|
|
|
|
|
|
|
|
if (in_smm)
|
|
|
|
|
pci_log("(%i) %03x read\n", pci_enable, port);
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
switch (port) {
|
|
|
|
|
case 0xcfc: case 0xcfd: case 0xcfe: case 0xcff:
|
|
|
|
|
if (! pci_enable)
|
|
|
|
|
return 0xff;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! pci_bus) {
|
2017-08-30 04:49:20 +02:00
|
|
|
slot = pci_card_to_slot_mapping[pci_card];
|
2018-10-21 20:27:57 +02:00
|
|
|
if (slot != 0xff) {
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
if (pci_cards[slot].read)
|
2020-04-16 21:56:19 +02:00
|
|
|
ret = pci_cards[slot].read(pci_func, pci_index | (port & 3), pci_cards[slot].priv);
|
2020-03-23 02:41:18 +01:00
|
|
|
#ifdef ENABLE_PCI_LOG
|
|
|
|
|
else
|
|
|
|
|
pci_log("Reading from empty PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
2020-03-23 02:41:18 +01:00
|
|
|
#ifdef ENABLE_PCI_LOG
|
|
|
|
|
else
|
|
|
|
|
pci_log("Reading from unasisgned PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2020-04-16 21:56:19 +02:00
|
|
|
pci_log("Reading %02X, from PCI card on bus %i, slot %02X (pci_cards[%i]) (%02X:%02X)...\n", ret, pci_bus, pci_card, slot, pci_func, pci_index);
|
2018-10-21 20:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-16 21:56:19 +02:00
|
|
|
return ret;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2017-06-22 06:50:33 +02:00
|
|
|
|
2020-07-10 02:05:49 +02:00
|
|
|
void
|
2018-10-21 20:27:57 +02:00
|
|
|
elcr_write(uint16_t port, uint8_t val, void *priv)
|
|
|
|
|
{
|
|
|
|
|
pci_log("ELCR%i: WRITE %02X\n", port & 1, val);
|
|
|
|
|
|
|
|
|
|
if (port & 1)
|
|
|
|
|
val &= 0xde;
|
|
|
|
|
else
|
|
|
|
|
val &= 0xf8;
|
|
|
|
|
|
|
|
|
|
elcr[port & 1] = val;
|
|
|
|
|
|
|
|
|
|
pci_log("ELCR %i: %c %c %c %c %c %c %c %c\n",
|
|
|
|
|
port & 1,
|
|
|
|
|
(val & 1) ? 'L' : 'E',
|
|
|
|
|
(val & 2) ? 'L' : 'E',
|
|
|
|
|
(val & 4) ? 'L' : 'E',
|
|
|
|
|
(val & 8) ? 'L' : 'E',
|
|
|
|
|
(val & 0x10) ? 'L' : 'E',
|
|
|
|
|
(val & 0x20) ? 'L' : 'E',
|
|
|
|
|
(val & 0x40) ? 'L' : 'E',
|
|
|
|
|
(val & 0x80) ? 'L' : 'E');
|
2017-06-03 00:45:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
2020-07-10 02:05:49 +02:00
|
|
|
uint8_t
|
2018-10-21 20:27:57 +02:00
|
|
|
elcr_read(uint16_t port, void *priv)
|
2017-06-03 00:45:12 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_log("ELCR%i: READ %02X\n", port & 1, elcr[port & 1]);
|
|
|
|
|
|
|
|
|
|
return elcr[port & 1];
|
2017-06-03 00:45:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
elcr_reset(void)
|
2017-06-21 19:42:36 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pic_reset();
|
|
|
|
|
|
|
|
|
|
elcr[0] = 0x00;
|
|
|
|
|
elcr[1] = 0x00;
|
2017-06-21 19:42:36 +02:00
|
|
|
}
|
|
|
|
|
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
static void pci_type2_write(uint16_t port, uint8_t val, void *priv);
|
|
|
|
|
static uint8_t pci_type2_read(uint16_t port, void *priv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pci_type2_write(uint16_t port, uint8_t val, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t slot = 0;
|
|
|
|
|
|
|
|
|
|
if (port == 0xcf8) {
|
|
|
|
|
pci_func = (val >> 1) & 7;
|
|
|
|
|
|
|
|
|
|
if (!pci_key && (val & 0xf0))
|
|
|
|
|
io_sethandler(0xc000, 0x1000,
|
|
|
|
|
pci_type2_read, NULL, NULL,
|
2020-06-21 05:23:49 +02:00
|
|
|
pci_type2_write, NULL, NULL, NULL);
|
|
|
|
|
else if (pci_key && !(val & 0xf0))
|
2018-10-21 20:27:57 +02:00
|
|
|
io_removehandler(0xc000, 0x1000,
|
|
|
|
|
pci_type2_read, NULL, NULL,
|
2020-06-21 05:23:49 +02:00
|
|
|
pci_type2_write, NULL, NULL, NULL);
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
pci_key = val & 0xf0;
|
2020-06-21 05:23:49 +02:00
|
|
|
} else if (port == 0xcfa)
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_bus = val;
|
2020-06-21 05:23:49 +02:00
|
|
|
else if (port == 0xcfb) {
|
|
|
|
|
pci_reset_regs();
|
|
|
|
|
|
|
|
|
|
if (!pci_pmc && (val & 0x01)) {
|
|
|
|
|
io_removehandler(0x0cf8, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
io_removehandler(0x0cfa, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
io_sethandler(0x0cf8, 1,
|
|
|
|
|
NULL,NULL,pci_cf8_read, NULL,NULL,pci_cf8_write, NULL);
|
|
|
|
|
io_sethandler(0x0cfc, 4,
|
|
|
|
|
pci_read,NULL,NULL, pci_write,NULL,NULL, NULL);
|
|
|
|
|
} else if (pci_pmc && !(val & 0x01)) {
|
|
|
|
|
io_removehandler(0x0cf8, 1,
|
|
|
|
|
NULL,NULL,pci_cf8_read, NULL,NULL,pci_cf8_write, NULL);
|
|
|
|
|
io_removehandler(0x0cfc, 4,
|
|
|
|
|
pci_read,NULL,NULL, pci_write,NULL,NULL, NULL);
|
|
|
|
|
io_sethandler(0x0cf8, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
io_sethandler(0x0cfa, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pci_pmc = (val & 0x01);
|
2018-10-21 20:27:57 +02:00
|
|
|
} else {
|
|
|
|
|
pci_card = (port >> 8) & 0xf;
|
|
|
|
|
pci_index = port & 0xff;
|
|
|
|
|
|
|
|
|
|
if (! pci_bus) {
|
|
|
|
|
slot = pci_card_to_slot_mapping[pci_card];
|
|
|
|
|
if (slot != 0xff) {
|
2020-02-29 19:12:23 +01:00
|
|
|
if (pci_cards[slot].write)
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_cards[slot].write(pci_func, pci_index | (port & 3), val, pci_cards[slot].priv);
|
2020-03-23 02:41:18 +01:00
|
|
|
#ifdef ENABLE_PCI_LOG
|
2020-02-29 19:12:23 +01:00
|
|
|
else
|
2020-03-23 02:41:18 +01:00
|
|
|
pci_log("Writing to empty PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#ifdef ENABLE_PCI_LOG
|
|
|
|
|
else
|
|
|
|
|
pci_log("Writing to unassigned PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
2018-10-21 20:27:57 +02:00
|
|
|
}
|
|
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
static uint8_t
|
|
|
|
|
pci_type2_read(uint16_t port, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t slot = 0;
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (port == 0xcf8)
|
|
|
|
|
return pci_key | (pci_func << 1);
|
2020-06-21 05:23:49 +02:00
|
|
|
else if (port == 0xcfa)
|
2018-10-21 20:27:57 +02:00
|
|
|
return pci_bus;
|
2020-06-21 05:23:49 +02:00
|
|
|
else if (port == 0xcfb)
|
|
|
|
|
return pci_pmc;
|
2018-10-20 03:43:11 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_card = (port >> 8) & 0xf;
|
|
|
|
|
pci_index = port & 0xff;
|
|
|
|
|
|
|
|
|
|
if (! pci_bus) {
|
|
|
|
|
slot = pci_card_to_slot_mapping[pci_card];
|
|
|
|
|
if (slot != 0xff) {
|
2020-02-29 19:12:23 +01:00
|
|
|
if (pci_cards[slot].read)
|
2018-10-21 20:27:57 +02:00
|
|
|
return pci_cards[slot].read(pci_func, pci_index | (port & 3), pci_cards[slot].priv);
|
2020-03-23 02:41:18 +01:00
|
|
|
#ifdef ENABLE_PCI_LOG
|
2020-02-29 19:12:23 +01:00
|
|
|
else
|
2020-03-23 02:41:18 +01:00
|
|
|
pci_log("Reading from empty PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#ifdef ENABLE_PCI_LOG
|
|
|
|
|
else
|
|
|
|
|
pci_log("Reading from unasisgned PCI card on slot %02X (pci_cards[%i]) (%02X:%02X)...\n", pci_card, slot, pci_func, pci_index);
|
|
|
|
|
#endif
|
2018-10-21 20:27:57 +02:00
|
|
|
}
|
2018-10-20 03:43:11 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
return 0xff;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2017-06-02 01:38:25 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pci_set_irq_routing(int pci_int, int irq)
|
2017-06-02 01:38:25 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_irqs[pci_int - 1] = irq;
|
2017-06-02 01:38:25 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
void
|
|
|
|
|
pci_set_irq_level(int pci_int, int level)
|
|
|
|
|
{
|
|
|
|
|
pci_irq_level[pci_int - 1] = !!level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
void
|
|
|
|
|
pci_enable_mirq(int mirq)
|
2017-09-04 05:15:12 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_mirqs[mirq].enabled = 1;
|
2017-09-04 05:15:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pci_set_mirq_routing(int mirq, int irq)
|
2017-09-04 05:15:12 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_mirqs[mirq].irq_line = irq;
|
2017-09-04 05:15:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
pci_irq_is_level(int irq)
|
2017-06-03 00:45:12 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
int real_irq = irq & 7;
|
2017-06-03 00:45:12 +02:00
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
if (elcr_enabled) {
|
|
|
|
|
if ((irq <= 2) || (irq == 8) || (irq == 13))
|
|
|
|
|
return 0;
|
2017-06-03 00:45:12 +02:00
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
if (irq > 7)
|
|
|
|
|
return !!(elcr[1] & (1 << real_irq));
|
2018-10-21 20:27:57 +02:00
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
return !!(elcr[0] & (1 << real_irq));
|
|
|
|
|
} else {
|
|
|
|
|
if (irq < 8)
|
|
|
|
|
return (pic.icw1 & 8) ? 1 : 0;
|
|
|
|
|
else
|
|
|
|
|
return (pic2.icw1 & 8) ? 1 : 0;
|
|
|
|
|
}
|
2017-06-03 00:45:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
uint8_t
|
|
|
|
|
pci_use_mirq(uint8_t mirq)
|
2017-09-04 05:15:12 +02:00
|
|
|
{
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
if (!PCI || !pci_mirqs[mirq].enabled)
|
2018-10-21 20:27:57 +02:00
|
|
|
return 0;
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (pci_mirqs[mirq].irq_line & 0x80)
|
|
|
|
|
return 0;
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
return 1;
|
2017-09-04 05:15:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
void
|
2019-10-30 04:26:36 +01:00
|
|
|
pci_set_mirq(uint8_t mirq, int level)
|
2017-08-28 16:53:53 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t irq_line = 0;
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! pci_mirqs[mirq].enabled) {
|
|
|
|
|
pci_log("pci_set_mirq(%02X): MIRQ0 disabled\n", mirq);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (pci_mirqs[mirq].irq_line > 0x0f) {
|
|
|
|
|
pci_log("pci_set_mirq(%02X): IRQ line is disabled\n", mirq);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
irq_line = pci_mirqs[mirq].irq_line;
|
|
|
|
|
pci_log("pci_set_mirq(%02X): Using IRQ %i\n", mirq, irq_line);
|
2017-08-28 16:53:53 +02:00
|
|
|
|
2019-10-30 04:26:36 +01:00
|
|
|
if (level && (pci_irq_hold[irq_line] & (1ULL << (0x1E + mirq)))) {
|
2018-10-21 20:27:57 +02:00
|
|
|
/* IRQ already held, do nothing. */
|
|
|
|
|
pci_log("pci_set_mirq(%02X): MIRQ is already holding the IRQ\n", mirq);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pci_log("pci_set_mirq(%02X): MIRQ not yet holding the IRQ\n", mirq);
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (!level || !pci_irq_hold[irq_line]) {
|
|
|
|
|
pci_log("pci_set_mirq(%02X): Issuing %s-triggered IRQ (%sheld)\n", mirq, level ? "level" : "edge", pci_irq_hold[irq_line] ? "" : "not ");
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
/* Only raise the interrupt if it's edge-triggered or level-triggered and not yet being held. */
|
2019-10-30 04:26:36 +01:00
|
|
|
if (level)
|
|
|
|
|
picintlevel(1 << irq_line);
|
|
|
|
|
else
|
|
|
|
|
picint(1 << irq_line);
|
2018-10-21 20:27:57 +02:00
|
|
|
} else if (level && pci_irq_hold[irq_line]) {
|
|
|
|
|
pci_log("pci_set_mirq(%02X): IRQ line already being held\n", mirq);
|
|
|
|
|
}
|
2017-08-28 16:53:53 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
/* If the IRQ is level-triggered, mark that this MIRQ is holding it. */
|
|
|
|
|
if (level) {
|
|
|
|
|
pci_log("pci_set_mirq(%02X): Marking that this card is holding the IRQ\n", mirq);
|
|
|
|
|
pci_irq_hold[irq_line] |= (1ULL << (0x1E + mirq));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pci_log("pci_set_mirq(%02X): Edge-triggered interrupt, not marking\n", mirq);
|
2017-08-28 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pci_set_irq(uint8_t card, uint8_t pci_int)
|
2017-06-02 01:38:25 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t slot = 0;
|
|
|
|
|
uint8_t irq_routing = 0;
|
|
|
|
|
uint8_t pci_int_index = pci_int - PCI_INTA;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): %i PCI slots\n", card, pci_int, last_pci_card);
|
2017-08-27 23:57:47 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
slot = pci_card_to_slot_mapping[card];
|
|
|
|
|
if (slot == 0xff) {
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): Card is not on a PCI slot (how are we even here?!)\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): Card is on PCI slot %02X\n", card, pci_int, slot);
|
2017-08-28 16:53:53 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! pci_cards[slot].irq_routing[pci_int_index]) {
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): No IRQ routing for this slot and INT pin combination\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
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);
|
2017-08-30 04:49:20 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
irq_line = pci_irqs[irq_routing];
|
2020-01-11 22:31:50 +01:00
|
|
|
level = pci_irq_level[irq_routing];
|
2018-10-21 20:27:57 +02:00
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
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);
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (pci_irq_is_level(irq_line) && (pci_irq_hold[irq_line] & (1ULL << card))) {
|
|
|
|
|
/* IRQ already held, do nothing. */
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): Card is already holding the IRQ\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): Card not yet holding the IRQ\n", card, pci_int);
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
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 ");
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
/* Only raise the interrupt if it's edge-triggered or level-triggered and not yet being held. */
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
if (level)
|
|
|
|
|
picintlevel(1 << irq_line);
|
|
|
|
|
else
|
|
|
|
|
picint(1 << irq_line);
|
2018-10-21 20:27:57 +02:00
|
|
|
} else if (level && pci_irq_hold[irq_line]) {
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): IRQ line already being held\n", card, pci_int);
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
/* If the IRQ is level-triggered, mark that this card is holding it. */
|
2020-01-11 22:31:50 +01:00
|
|
|
if (level) {
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_log("pci_set_irq(%02X, %02X): Marking that this card is holding the IRQ\n", card, pci_int);
|
|
|
|
|
pci_irq_hold[irq_line] |= (1ULL << card);
|
|
|
|
|
} else {
|
|
|
|
|
pci_log("pci_set_irq(%02X, %02X): Edge-triggered interrupt, not marking\n", card, pci_int);
|
|
|
|
|
}
|
2017-06-02 01:38:25 +02:00
|
|
|
}
|
|
|
|
|
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
void
|
2019-10-30 04:26:36 +01:00
|
|
|
pci_clear_mirq(uint8_t mirq, int level)
|
2018-10-21 20:27:57 +02:00
|
|
|
{
|
|
|
|
|
uint8_t irq_line = 0;
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (mirq > 1) {
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): Invalid MIRQ\n", mirq);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! pci_mirqs[mirq].enabled) {
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): MIRQ0 disabled\n", mirq);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (pci_mirqs[mirq].irq_line > 0x0f) {
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): IRQ line is disabled\n", mirq);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
irq_line = pci_mirqs[mirq].irq_line;
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): Using IRQ %i\n", mirq, irq_line);
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2019-10-30 04:26:36 +01:00
|
|
|
if (level && !(pci_irq_hold[irq_line] & (1ULL << (0x1E + mirq)))) {
|
2018-10-21 20:27:57 +02:00
|
|
|
/* IRQ not held, do nothing. */
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): MIRQ is not holding the IRQ\n", mirq);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-09-04 05:15:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (level) {
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): Releasing this MIRQ's hold on the IRQ\n", mirq);
|
|
|
|
|
pci_irq_hold[irq_line] &= ~(1 << (0x1E + mirq));
|
|
|
|
|
|
|
|
|
|
if (! pci_irq_hold[irq_line]) {
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): IRQ no longer held by any card, clearing it\n", mirq);
|
|
|
|
|
picintc(1 << irq_line);
|
|
|
|
|
} else {
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): IRQ is still being held\n", mirq);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pci_log("pci_clear_mirq(%02X): Clearing edge-triggered interrupt\n", mirq);
|
|
|
|
|
picintc(1 << irq_line);
|
|
|
|
|
}
|
2017-08-28 16:53:53 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pci_clear_irq(uint8_t card, uint8_t pci_int)
|
2017-06-02 01:38:25 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t slot = 0;
|
|
|
|
|
uint8_t irq_routing = 0;
|
|
|
|
|
uint8_t pci_int_index = pci_int - PCI_INTA;
|
|
|
|
|
uint8_t irq_line = 0;
|
|
|
|
|
uint8_t level = 0;
|
|
|
|
|
|
|
|
|
|
if (! last_pci_card) {
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): No PCI slots (how are we even here?!)\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): %i PCI slots\n", card, pci_int, last_pci_card);
|
2017-08-27 23:57:47 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
slot = pci_card_to_slot_mapping[card];
|
|
|
|
|
if (slot == 0xff) {
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): Card is not on a PCI slot (how are we even here?!)\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): Card is on PCI slot %02X\n", card, pci_int, slot);
|
2017-08-27 23:57:47 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! pci_cards[slot].irq_routing[pci_int_index]) {
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): No IRQ routing for this slot and INT pin combination\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
irq_line = pci_irqs[irq_routing];
|
2020-01-11 22:31:50 +01:00
|
|
|
level = pci_irq_level[irq_routing];
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
if (irq_line > 0x0f) {
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_log("pci_clear_irq(%02X, %02X): IRQ line is disabled\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_log("pci_clear_irq(%02X, %02X): Using IRQ %i\n", card, pci_int, irq_line);
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
if (level && !(pci_irq_hold[irq_line] & (1ULL << card))) {
|
2018-10-21 20:27:57 +02:00
|
|
|
/* IRQ not held, do nothing. */
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): Card is not holding the IRQ\n", card, pci_int);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
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);
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! pci_irq_hold[irq_line]) {
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): IRQ no longer held by any card, clearing it\n", card, pci_int);
|
|
|
|
|
picintc(1 << irq_line);
|
|
|
|
|
} else {
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): IRQ is still being held\n", card, pci_int);
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
2018-10-21 20:27:57 +02:00
|
|
|
} else {
|
|
|
|
|
pci_log("pci_clear_irq(%02X, %02X): Clearing edge-triggered interrupt\n", card, pci_int);
|
|
|
|
|
picintc(1 << irq_line);
|
|
|
|
|
}
|
2017-06-02 01:38:25 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
void
|
|
|
|
|
pci_elcr_set_enabled(int enabled)
|
|
|
|
|
{
|
|
|
|
|
elcr_enabled = enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-07-10 02:05:49 +02:00
|
|
|
void
|
|
|
|
|
pci_elcr_io_disable(void)
|
|
|
|
|
{
|
|
|
|
|
io_removehandler(0x04d0, 0x0002,
|
|
|
|
|
elcr_read,NULL,NULL, elcr_write,NULL,NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-06-21 05:23:49 +02:00
|
|
|
static void
|
|
|
|
|
pci_reset_regs(void)
|
|
|
|
|
{
|
|
|
|
|
pci_index = pci_card = pci_func = pci_bus = pci_key = 0;
|
|
|
|
|
|
|
|
|
|
io_removehandler(0xc000, 0x1000,
|
|
|
|
|
pci_type2_read, NULL, NULL,
|
|
|
|
|
pci_type2_write, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
pci_reset_hard(void)
|
2017-08-28 22:55:10 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
int i;
|
2017-08-28 22:55:10 +02:00
|
|
|
|
2020-06-21 05:23:49 +02:00
|
|
|
pci_reset_regs();
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
|
if (pci_irq_hold[i]) {
|
|
|
|
|
pci_irq_hold[i] = 0;
|
2017-08-28 22:55:10 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
picintc(1 << i);
|
2017-08-28 22:55:10 +02:00
|
|
|
}
|
2018-10-21 20:27:57 +02:00
|
|
|
}
|
2017-08-28 22:55:10 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
elcr_reset();
|
2017-08-28 22:55:10 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
2020-06-21 05:23:49 +02:00
|
|
|
void
|
|
|
|
|
pci_reset(void)
|
|
|
|
|
{
|
|
|
|
|
if (pci_switch) {
|
|
|
|
|
pci_pmc = 0x00;
|
|
|
|
|
|
|
|
|
|
io_removehandler(0x0cf8, 1,
|
|
|
|
|
NULL,NULL,pci_cf8_read, NULL,NULL,pci_cf8_write, NULL);
|
|
|
|
|
io_removehandler(0x0cfc, 4,
|
|
|
|
|
pci_read,NULL,NULL, pci_write,NULL,NULL, NULL);
|
|
|
|
|
io_sethandler(0x0cf8, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
io_sethandler(0x0cfa, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pci_reset_hard();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
static void
|
|
|
|
|
pci_slots_clear(void)
|
2017-08-30 04:49:20 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
uint8_t i, j;
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
last_pci_card = 0;
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
|
pci_cards[i].id = 0xFF;
|
|
|
|
|
pci_cards[i].type = 0xFF;
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
for (j = 0; j < 4; j++)
|
|
|
|
|
pci_cards[i].irq_routing[j] = 0;
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_cards[i].read = NULL;
|
|
|
|
|
pci_cards[i].write = NULL;
|
|
|
|
|
pci_cards[i].priv = NULL;
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_card_to_slot_mapping[i] = 0xFF;
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
2020-04-16 21:56:19 +02:00
|
|
|
uint32_t
|
|
|
|
|
trc_readl(uint16_t port, void *priv)
|
|
|
|
|
{
|
|
|
|
|
return 0xffffffff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t
|
|
|
|
|
trc_readw(uint16_t port, void *priv)
|
|
|
|
|
{
|
|
|
|
|
return 0xffff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-29 19:12:23 +01:00
|
|
|
uint8_t
|
2018-10-21 20:27:57 +02:00
|
|
|
trc_read(uint16_t port, void *priv)
|
2017-09-02 20:39:57 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
return trc_reg & 0xfb;
|
2017-09-02 20:39:57 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
trc_reset(uint8_t val)
|
2017-09-02 20:39:57 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
if (val & 2) {
|
2020-06-11 12:52:50 +02:00
|
|
|
dma_reset();
|
2018-10-21 20:27:57 +02:00
|
|
|
device_reset_all_pci();
|
2017-09-02 20:39:57 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
cpu_alt_reset = 0;
|
|
|
|
|
|
2020-02-29 19:12:23 +01:00
|
|
|
pci_reset();
|
|
|
|
|
keyboard_at_reset();
|
|
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
mem_a20_alt = 0;
|
|
|
|
|
mem_a20_recalc();
|
|
|
|
|
|
|
|
|
|
flushmmucache();
|
2018-10-21 20:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resetx86();
|
2017-09-02 20:39:57 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
2020-04-16 21:56:19 +02:00
|
|
|
void
|
|
|
|
|
trc_writel(uint16_t port, uint32_t val, void *priv)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
trc_writew(uint16_t port, uint16_t val, void *priv)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-29 19:12:23 +01:00
|
|
|
void
|
2018-10-21 20:27:57 +02:00
|
|
|
trc_write(uint16_t port, uint8_t val, void *priv)
|
2017-09-02 20:39:57 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_log("TRC Write: %02X\n", val);
|
|
|
|
|
|
|
|
|
|
if (!(trc_reg & 4) && (val & 4))
|
|
|
|
|
trc_reset(val);
|
|
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
trc_reg = val & 0xfd;
|
|
|
|
|
|
|
|
|
|
if (val & 2)
|
|
|
|
|
trc_reg &= 0xfb;
|
2017-09-02 20:39:57 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
trc_init(void)
|
2017-09-02 20:39:57 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
trc_reg = 0;
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
io_sethandler(0x0cf9, 0x0001,
|
2020-04-16 21:56:19 +02:00
|
|
|
trc_read, trc_readw, trc_readl, trc_write, trc_writew, trc_writel, NULL);
|
2017-09-02 20:39:57 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pci_init(int type)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
int c;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
PCI = 1;
|
2017-06-03 00:45:12 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_slots_clear();
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2020-06-21 05:23:49 +02:00
|
|
|
pci_reset_hard();
|
2017-06-21 19:42:36 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
trc_init();
|
2017-09-02 20:39:57 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
pci_type = type;
|
2020-06-21 05:23:49 +02:00
|
|
|
pci_switch = !!(type & PCI_CAN_SWITCH_TYPE);
|
|
|
|
|
|
|
|
|
|
if (pci_switch) {
|
|
|
|
|
pci_pmc = 0x00;
|
|
|
|
|
|
|
|
|
|
io_sethandler(0x0cfb, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
}
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
|
|
|
|
|
if (!(type & PCI_NO_IRQ_STEERING)) {
|
|
|
|
|
io_sethandler(0x04d0, 0x0002,
|
|
|
|
|
elcr_read,NULL,NULL, elcr_write,NULL,NULL, NULL);
|
|
|
|
|
}
|
2018-10-21 20:27:57 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
if ((type & PCI_CONFIG_TYPE_MASK) == PCI_CONFIG_TYPE_1) {
|
2018-10-21 20:27:57 +02:00
|
|
|
io_sethandler(0x0cf8, 1,
|
|
|
|
|
NULL,NULL,pci_cf8_read, NULL,NULL,pci_cf8_write, NULL);
|
|
|
|
|
io_sethandler(0x0cfc, 4,
|
|
|
|
|
pci_read,NULL,NULL, pci_write,NULL,NULL, NULL);
|
|
|
|
|
} else {
|
|
|
|
|
io_sethandler(0x0cf8, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
io_sethandler(0x0cfa, 1,
|
|
|
|
|
pci_type2_read,NULL,NULL, pci_type2_write,NULL,NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-11 22:31:50 +01:00
|
|
|
for (c = 0; c < 4; c++) {
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_irqs[c] = PCI_IRQ_DISABLED;
|
2020-01-11 22:31:50 +01:00
|
|
|
pci_irq_level[c] = (type & PCI_NO_IRQ_STEERING) ? 0 : 1;
|
|
|
|
|
}
|
2018-10-21 20:27:57 +02:00
|
|
|
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
for (c = 0; c < 3; c++) {
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_mirqs[c].enabled = 0;
|
|
|
|
|
pci_mirqs[c].irq_line = PCI_IRQ_DISABLED;
|
|
|
|
|
}
|
2020-01-11 22:31:50 +01:00
|
|
|
|
|
|
|
|
elcr_enabled = 1;
|
2017-06-02 01:38:25 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pci_register_slot(int card, int type, int inta, int intb, int intc, int intd)
|
2017-06-02 01:38:25 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_card_t *dev = &pci_cards[last_pci_card];
|
|
|
|
|
|
|
|
|
|
dev->id = card;
|
|
|
|
|
dev->type = type;
|
|
|
|
|
dev->irq_routing[0] = inta;
|
|
|
|
|
dev->irq_routing[1] = intb;
|
|
|
|
|
dev->irq_routing[2] = intc;
|
|
|
|
|
dev->irq_routing[3] = intd;
|
|
|
|
|
dev->read = NULL;
|
|
|
|
|
dev->write = NULL;
|
|
|
|
|
dev->priv = NULL;
|
|
|
|
|
pci_card_to_slot_mapping[card] = last_pci_card;
|
|
|
|
|
|
|
|
|
|
pci_log("pci_register_slot(): pci_cards[%i].id = %02X\n", last_pci_card, card);
|
|
|
|
|
|
|
|
|
|
last_pci_card++;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
|
|
|
|
|
uint8_t
|
|
|
|
|
pci_add_card(uint8_t add_type, uint8_t (*read)(int func, int addr, void *priv), void (*write)(int func, int addr, uint8_t val, void *priv), void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-10-21 20:27:57 +02:00
|
|
|
pci_card_t *dev;
|
|
|
|
|
uint8_t i;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (add_type < PCI_ADD_NORMAL)
|
|
|
|
|
pci_log("pci_add_card(): Adding PCI CARD at specific slot %02X [SPECIFIC]\n", add_type);
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! PCI) {
|
2020-05-19 21:15:25 -03:00
|
|
|
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" : ((add_type == PCI_ADD_SOUND) ? "SOUND" : "SPECIFIC"))));
|
2018-10-21 20:27:57 +02:00
|
|
|
return 0xff;
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
if (! last_pci_card) {
|
2020-05-19 21:15:25 -03:00
|
|
|
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" : ((add_type == PCI_ADD_SOUND) ? "SOUND" : "SPECIFIC"))));
|
2018-10-21 20:27:57 +02:00
|
|
|
return 0xff;
|
|
|
|
|
}
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
for (i = 0; i < last_pci_card; i++) {
|
|
|
|
|
dev = &pci_cards[i];
|
|
|
|
|
|
|
|
|
|
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)) ||
|
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.
2019-09-20 14:02:30 +02:00
|
|
|
((dev->type == PCI_CARD_SCSI) && (add_type == PCI_ADD_SCSI)) ||
|
2020-05-19 21:15:25 -03:00
|
|
|
((dev->type == PCI_CARD_SOUND) && (add_type == PCI_ADD_SOUND)) ||
|
2020-02-29 19:12:23 +01:00
|
|
|
((dev->type == PCI_CARD_NORTHBRIDGE) && (add_type == PCI_ADD_NORTHBRIDGE)) ||
|
|
|
|
|
((dev->type == PCI_CARD_SOUTHBRIDGE) && (add_type == PCI_ADD_SOUTHBRIDGE)) ||
|
|
|
|
|
((dev->id == add_type) && (add_type < PCI_ADD_NORTHBRIDGE))) {
|
2018-10-21 20:27:57 +02:00
|
|
|
dev->read = read;
|
|
|
|
|
dev->write = write;
|
|
|
|
|
dev->priv = priv;
|
2020-05-19 21:15:25 -03:00
|
|
|
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" : ((add_type == PCI_ADD_SOUND) ? "SOUND" : "SPECIFIC"))));
|
2018-10-21 20:27:57 +02:00
|
|
|
return dev->id;
|
2017-08-30 04:49:20 +02:00
|
|
|
}
|
|
|
|
|
}
|
2018-10-21 20:27:57 +02:00
|
|
|
}
|
|
|
|
|
|
2020-05-19 21:15:25 -03:00
|
|
|
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" : ((add_type == PCI_ADD_SOUND) ? "SOUND" : "SPECIFIC"))));
|
2017-08-30 04:49:20 +02:00
|
|
|
|
2018-10-21 20:27:57 +02:00
|
|
|
return 0xff;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|