]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
More PPC friendly expansion interrupt handling.
authorToni Wilen <twilen@winuae.net>
Sat, 3 Feb 2018 09:12:22 +0000 (11:12 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 3 Feb 2018 09:12:22 +0000 (11:12 +0200)
22 files changed:
a2065.cpp
a2091.cpp
akiko.cpp
cd32_fmv.cpp
cdtv.cpp
cdtvcr.cpp
cia.cpp
cpuboard.cpp
devices.cpp
gayle.cpp
idecontrollers.cpp
include/cpuboard.h
include/devices.h
include/newcpu.h
ncr9x_scsi.cpp
ncr_scsi.cpp
newcpu.cpp
pci.cpp
qemuvga/ne2000.cpp
scsi.cpp
sndboard.cpp
x86.cpp

index 1c8884a37601bd9004d8c1723547eba3507a5637..2438f87c3d8c8c58a761f8fdd6a9f79faf90dda4 100644 (file)
--- a/a2065.cpp
+++ b/a2065.cpp
@@ -23,6 +23,7 @@
 #include "autoconf.h"
 #include "rommgr.h"
 #include "debug.h"
+#include "devices.h"
 
 #define DUMPPACKET 0
 
@@ -393,7 +394,7 @@ static void gotfunc (void *devv, const uae_u8 *databuf, int len)
                                csr[0] |= CSR0_MISS;
                        }
                        pword (p + 2, rmd1);
-                       rethink_a2065 ();
+                       devices_rethink_all(rethink_a2065);
                        return;
                }
 
@@ -423,7 +424,7 @@ static void gotfunc (void *devv, const uae_u8 *databuf, int len)
        }
 
        csr[0] |= CSR0_RINT;
-       rethink_a2065 ();
+       devices_rethink_all(rethink_a2065);
 }
 
 static int getfunc (void *devv, uae_u8 *d, int *len)
@@ -543,7 +544,7 @@ static void do_transmit (void)
                ethernet_trigger (td, sysdata);
        }
        csr[0] |= CSR0_TINT;
-       rethink_a2065 ();
+       devices_rethink_all(rethink_a2065);
 }
 
 static void check_transmit(bool tdmd)
@@ -571,8 +572,6 @@ void a2065_hsync_handler (void)
 
 void rethink_a2065 (void)
 {
-       bool was = (uae_int_requested & 4) != 0;
-       atomic_and(&uae_int_requested, ~4);
        if (!configured)
                return;
        csr[0] &= ~CSR0_INTR;
@@ -582,12 +581,11 @@ void rethink_a2065 (void)
        if (mask & (CSR0_BABL | CSR0_MISS | CSR0_MERR | CSR0_RINT | CSR0_TINT | CSR0_IDON))
                csr[0] |= CSR0_INTR;
        if ((csr[0] & (CSR0_INTR | CSR0_INEA)) == (CSR0_INTR | CSR0_INEA)) {
-               set_special_exter(SPCFLAG_UAEINT);
-               atomic_or(&uae_int_requested, 4);
-               if (!was && log_a2065 > 2)
+               safe_interrupt_set(0x0008);
+               if (log_a2065 > 2)
                        write_log(_T("7990 +IRQ\n"));
        }
-       if (log_a2065 && was && !(uae_int_requested & 4)) {
+       if (log_a2065) {
                write_log(_T("7990 -IRQ\n"));
        }
 }
@@ -763,7 +761,7 @@ static void chip_wput (uaecptr addr, uae_u16 v)
                        }
                        csr[0] &= ~CSR0_TDMD;
 
-                       rethink_a2065 ();
+                       devices_rethink_all(rethink_a2065);
                        break;
                case 1:
                        if (csr[0] & 4) {
index e0eb62d75b7a8ae6067979f359a3ff6f79e0857b..343f6a508acfcdfce666a8413307d2aca9ada85c 100644 (file)
--- a/a2091.cpp
+++ b/a2091.cpp
@@ -44,6 +44,7 @@
 #include "savestate.h"
 #include "cpuboard.h"
 #include "rtc.h"
+#include "devices.h"
 
 #define DMAC_8727_ROM_VECTOR 0x8000
 #define CDMAC_ROM_VECTOR 0x2000
@@ -275,6 +276,7 @@ static struct wd_state *wd_gvps2[MAX_DUPLICATE_EXPANSION_BOARDS];
 static struct wd_state *wd_gvps2accel;
 static struct wd_state *wd_comspec[MAX_DUPLICATE_EXPANSION_BOARDS];
 struct wd_state *wd_cdtv;
+static bool configured;
 
 static struct wd_state *scsi_units[MAX_SCSI_UNITS + 1];
 
@@ -325,6 +327,7 @@ static struct wd_state *allocscsi(struct wd_state **wd, struct romconfig *rc, in
                        }
                }
        }
+       configured = true;
        return *wd;
 }
 
@@ -452,19 +455,21 @@ static bool is_dma_enabled(struct wd_state *wds)
                case COMMODORE_8727:
                return wds->cdmac.dmac_dma > 0;
        }
-       return false;   
+       return false;
 }
 
 void rethink_a2091 (void)
 {
+       if (!configured)
+               return;
        for (int i = 0; i < MAX_SCSI_UNITS; i++) {
                if (scsi_units[i]) {
                        int irq = isirq(scsi_units[i]);
                        if (irq & 1)
-                               INTREQ_0(0x8000 | 0x0008);
+                               safe_interrupt_set(0x0008);
                        if (irq & 2)
-                               INTREQ_0(0x8000 | 0x2000);
-#if A2091_DEBUG > 2 || A3000_DEBUG > 2
+                               safe_interrupt_set(0x2000);
+#if DEBUG > 2 || A3000_DEBUG > 2
                        write_log (_T("Interrupt_RETHINK:%d\n"), irq);
 #endif
                }
@@ -477,7 +482,7 @@ static void dmac_scsi_int(struct wd_state *wd)
                return;
        if (!(wd->wc.auxstatus & ASR_INT))
                return;
-       rethink_a2091();
+       devices_rethink_all(rethink_a2091);
 }
 
 static void dmac_a2091_xt_int(struct wd_state *wd)
@@ -485,7 +490,7 @@ static void dmac_a2091_xt_int(struct wd_state *wd)
        if (!wd->enabled)
                return;
        wd->cdmac.xt_irq = true;
-       rethink_a2091();
+       devices_rethink_all(rethink_a2091);
 }
 
 void scsi_dmac_a2091_start_dma (struct wd_state *wd)
@@ -524,7 +529,7 @@ static void incsasr (struct wd_chip_state *wd, int w)
 static void dmac_a2091_cint (struct wd_state *wd)
 {
        wd->cdmac.dmac_istr = 0;
-       rethink_a2091 ();
+       devices_rethink_all(rethink_a2091);
 }
 
 static void doscsistatus(struct wd_state *wd, uae_u8 status)
@@ -1406,7 +1411,7 @@ static void wd_check_interrupt(struct wd_state *wds, bool checkonly)
 {
        struct wd_chip_state *wd = &wds->wc;
        if (wd->intmask) {
-               INTREQ_0(0x8000 | wd->intmask);
+               safe_interrupt_set(wd->intmask);
                wd->intmask = 0;
        }
        if (wd->auxstatus & ASR_INT)
index e12fe33fe68df10ed6db817636d8fed3a2f79f8c..febf60fbc9d091968c1b400cd603fff9a06be863 100644 (file)
--- a/akiko.cpp
+++ b/akiko.cpp
@@ -42,7 +42,7 @@ int log_cd32 = 0;
 static void irq (void)
 {
        if (!(intreq & 8)) {
-               INTREQ_0 (0x8000 | 0x0008);
+               safe_interrupt_set(0x0008);
        }
 }
 
index 0038bfde2f593d5002718684a9a3fb6f156dd0cc..b73772dc5ef998a974c21bafc470cd7a643a828f 100644 (file)
@@ -288,7 +288,7 @@ static int isdebug(uaecptr addr)
 static void do_irq(void)
 {
        if (!(intreq & 8)) {
-               INTREQ_0(0x8000 | 0x0008);
+               safe_interrupt_set(0x0008);
        }
 }
 
index 0cda6394f813543ae4bf8efe5132b111899d2023..d38ee9cf75cf69316bf4d7b8de3e71cccf8ebba7 100644 (file)
--- a/cdtv.cpp
+++ b/cdtv.cpp
@@ -98,7 +98,7 @@ static void do_stch (void);
 static void INT2 (void)
 {
        if (!(intreq & 8)) {
-               INTREQ_0 (0x8000 | 0x0008);
+               safe_interrupt_set(0x0008);
        }
        cd_led ^= LED_CD_ACTIVE2;
 }
index e28ddfe1f6d05bea316ed0448b8ce435382ced73..a1e17bb44123b39aa2f382beff91baad257c78fb 100644 (file)
@@ -250,7 +250,7 @@ static void cdtvcr_4510_reset(uae_u8 v)
 void rethink_cdtvcr(void)
 {
        if ((cdtvcr_4510_ram[CDTVCR_INTREQ] & cdtvcr_4510_ram[CDTVCR_INTENA]) && !cdtvcr_4510_ram[CDTVCR_INTDISABLE]) {
-               INTREQ_0 (0x8000 | 0x0008);
+               safe_interrupt_set(0x0008);
                cd_led ^= LED_CD_ACTIVE2;
        }
 }
diff --git a/cia.cpp b/cia.cpp
index 3762381f2ca3fd6997785bb94f8c0ac3d4917fe3..581ea80f1cdaa3814c2c0fa4e2dbb76011855461 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -124,7 +124,7 @@ static int cia_interrupt_delay;
 
 static void ICR (uae_u32 data)
 {
-       INTREQ_0 (0x8000 | data);
+       safe_interrupt_set(data);
 }
 
 static void ICRA (uae_u32 data)
index 21fa4d54a4e830e6ad029ceabf0e0e64770814aa..9967c637516fa842387a17c724869b31ed448d15 100644 (file)
@@ -32,6 +32,7 @@
 #include "idecontrollers.h"
 #include "scsi.h"
 #include "cpummu030.h"
+#include "devices.h"
 
 // ROM expansion board diagrom call
 // 00F83B7C 3.1 A4000
@@ -983,12 +984,12 @@ void cpuboard_rethink(void)
 {
        if (is_csmk3(&currprefs) || is_blizzardppc(&currprefs)) {
                if (!(io_reg[CSIII_REG_IRQ] & (P5_IRQ_SCSI_EN | P5_IRQ_SCSI))) {
-                       INTREQ_0(0x8000 | 0x0008);
+                       safe_interrupt_set(0x0008);
                        if (currprefs.cachesize)
                                atomic_or(&uae_int_requested, 0x010000);
                        uae_ppc_wakeup_main();
                } else if (!(io_reg[CSIII_REG_IRQ] & (P5_IRQ_PPC_1 | P5_IRQ_PPC_2))) {
-                       INTREQ_0(0x8000 | 0x0008);
+                       safe_interrupt_set(0x0008);
                        if (currprefs.cachesize)
                                atomic_or(&uae_int_requested, 0x010000);
                        uae_ppc_wakeup_main();
@@ -1078,22 +1079,30 @@ static void cyberstormmk2_maprom(void)
                map_banks_nojitdirect(&blizzardmaprom_bank, blizzardmaprom_bank.start >> 16, 524288 >> 16, 0);
 }
 
-void cyberstorm_mk3_ppc_irq(int level)
+void cyberstorm_mk3_ppc_irq_setonly(int level)
 {
        if (level)
                io_reg[CSIII_REG_IRQ] &= ~P5_IRQ_SCSI;
        else
                io_reg[CSIII_REG_IRQ] |= P5_IRQ_SCSI;
-       cpuboard_rethink();
+}
+void cyberstorm_mk3_ppc_irq(int level)
+{
+       cyberstorm_mk3_ppc_irq_setonly(level);
+       devices_rethink_all(cpuboard_rethink);
 }
 
-void blizzardppc_irq(int level)
+void blizzardppc_irq_setonly(int level)
 {
        if (level)
                io_reg[CSIII_REG_IRQ] &= ~P5_IRQ_SCSI;
        else
                io_reg[CSIII_REG_IRQ] |= P5_IRQ_SCSI;
-       cpuboard_rethink();
+}
+void blizzardppc_irq(int level)
+{
+       blizzardppc_irq_setonly(level);
+       devices_rethink_all(cpuboard_rethink);
 }
 
 static uae_u32 REGPARAM2 blizzardio_bget(uaecptr addr)
index 29954300cfefe529aa18472a48945fd2d59fd8d8..942cfa0d4135dd8bd6f57b8c7429c1583f7e6656 100644 (file)
@@ -62,6 +62,7 @@
 #include "videograb.h"
 #include "arcadia.h"
 #include "rommgr.h"
+#include "newcpu.h"
 #ifdef RETROPLATFORM
 #include "rp.h"
 #endif
@@ -213,9 +214,19 @@ void devices_hsync(void)
 #endif
 }
 
+void devices_rethink_all(void func(void))
+{
+       if (ppc_state || 0) {
+               devices_rethink();
+       } else {
+               func();
+       }
+}
+
 // these really should be dynamically allocated..
 void devices_rethink(void)
 {
+       safe_interrupt_clear_all();
        rethink_cias ();
 #ifdef A2065
        rethink_a2065 ();
index 9ec4f290a79270a882165fed92fbde44e2aa0dba..f1a07631db634a5a90a9783e2bbe86c5bd2528f6 100644 (file)
--- a/gayle.cpp
+++ b/gayle.cpp
@@ -34,6 +34,7 @@
 #include "debug.h"
 #include "autoconf.h"
 #include "rommgr.h"
+#include "devices.h"
 
 #define PCMCIA_SRAM 1
 #define PCMCIA_IDE 2
@@ -228,7 +229,7 @@ void rethink_gayle (void)
        if (currprefs.cs_ide == IDE_A4000) {
                gayle_irq |= checkgayleideirq ();
                if ((gayle_irq & GAYLE_IRQ_IDE) && !(intreq & 0x0008))
-                       INTREQ_0 (0x8000 | 0x0008);
+                       safe_interrupt_set(0x0008);
                return;
        }
 
@@ -255,9 +256,9 @@ void rethink_gayle (void)
                        lev2 = 1;
        }
        if (lev2 && !(intreq & 0x0008))
-               INTREQ_0 (0x8000 | 0x0008);
+               safe_interrupt_set(0x0008);
        if (lev6 && !(intreq & 0x2000))
-               INTREQ_0 (0x8000 | 0x2000);
+               safe_interrupt_set(0x2000);
 }
 
 static void gayle_cs_change (uae_u8 mask, int onoff)
@@ -272,7 +273,7 @@ static void gayle_cs_change (uae_u8 mask, int onoff)
        }
        if (changed) {
                gayle_irq |= mask;
-               rethink_gayle ();
+               devices_rethink_all(rethink_gayle);
                if ((mask & GAYLE_CS_CCDET) && (gayle_irq & (GAYLE_IRQ_RESET | GAYLE_IRQ_BERR)) != (GAYLE_IRQ_RESET | GAYLE_IRQ_BERR)) {
                        if (gayle_irq & GAYLE_IRQ_RESET)
                                uae_reset (0, 0);
@@ -299,7 +300,7 @@ static void card_trigger (int insert)
                gayle_cs_change (GAYLE_CS_WR, 0);
                gayle_cs_change (GAYLE_CS_BSY, 0);
        }
-       rethink_gayle ();
+       devices_rethink_all(rethink_gayle);
 }
 
 static void write_gayle_cfg (uae_u8 val)
@@ -990,7 +991,7 @@ void gayle_hsync(void)
        if (ne2000)
                ne2000->hsync(ne2000_board_state);
        if (ide_interrupt_hsync(idedrive[0]) || ide_interrupt_hsync(idedrive[2]) || ide_interrupt_hsync(idedrive[4]) || checkpcmciane2000irq())
-               rethink_gayle();
+               devices_rethink_all(rethink_gayle);
 }
 
 static uaecptr from_gayle_pcmcmia(uaecptr addr)
index 7a1326482cb9a54a3c169653cddf6b17357c09bb..9299680172d13affe64d32722dea6684ecb2572a 100644 (file)
@@ -263,8 +263,8 @@ void idecontroller_rethink(void)
                        irq |= ide_rethink(ide_boards[i], false);
                }
        }
-       if (irq && !(intreq & 0x0008)) {
-               INTREQ_0(0x8000 | 0x0008);
+       if (irq) {
+               safe_interrupt_set(0x0008);
        }
 }
 
index af3d69976cbd6e29ad37d1ab6678c3a5e3d82ba3..40f76b51b3341c665372ac97078805aa60903479 100644 (file)
@@ -32,9 +32,10 @@ extern uae_u32 cyberstorm_scsi_ram_get(uaecptr addr);
 extern int REGPARAM3 cyberstorm_scsi_ram_check(uaecptr addr, uae_u32 size) REGPARAM;
 extern uae_u8 *REGPARAM3 cyberstorm_scsi_ram_xlate(uaecptr addr) REGPARAM;
 
-void cyberstorm_irq(int level);
 void cyberstorm_mk3_ppc_irq(int level);
 void blizzardppc_irq(int level);
+void cyberstorm_mk3_ppc_irq_setonly(int level);
+void blizzardppc_irq_setonly(int level);
 
 #define BOARD_MEMORY_Z2 1
 #define BOARD_MEMORY_Z3 2
index d0dba4b37ec5edf36cf846c4d56fe2e115137dcc..ed12324e8791a0231dd624f91120d70198d23dbc 100644 (file)
@@ -6,6 +6,7 @@ void devices_vsync_pre(void);
 void devices_vsync_post(void);
 void devices_hsync(void);
 void devices_rethink(void);
+void devices_rethink_all(void func(void));
 void devices_syncchange(void);
 void devices_update_sound(double clk, double syncadjust);
 void devices_update_sync(double svpos, double syncadjust);
index b17233b8e41af963879c014981a7d58e7169845c..8448ed231963646d67041a7d25dff398e78ea982 100644 (file)
@@ -285,6 +285,9 @@ extern int cpu_cycles;
 extern int cpucycleunit;
 extern int m68k_pc_indirect;
 
+extern void safe_interrupt_set(uae_u32 v);
+extern void safe_interrupt_clear_all(void);
+
 STATIC_INLINE void set_special_exter(uae_u32 x)
 {
        atomic_or(&regs.spcflags, x);
index c7a8fc0a822dce44b484710d457980373960721b..fcf970b28e5d4780836244e62e7404265d7701fd 100644 (file)
@@ -32,6 +32,7 @@
 #include "qemuvga/scsi/scsi.h"
 #include "qemuvga/scsi/esp.h"
 #include "gui.h"
+#include "devices.h"
 
 #define FASTLANE_BOARD_SIZE (2 * 16777216)
 #define FASTLANE_ROM_SIZE 32768
@@ -248,9 +249,9 @@ void ncr9x_rethink(void)
        for (int i = 0; ncr_units[i]; i++) {
                if (ncr_units[i]->boardirq) {
                        if (ncr_units[i]->irq6)
-                               INTREQ_0(0x8000 | 0x2000);
+                               safe_interrupt_set(0x2000);
                        else
-                               INTREQ_0(0x8000 | 0x0008);
+                               safe_interrupt_set(0x0008);
                        return;
                }
        }
@@ -260,7 +261,7 @@ static void set_irq2(struct ncr9x_state *ncr)
 {
        if (ncr->chipirq && !ncr->boardirq) {
                ncr->boardirq = true;
-               ncr9x_rethink();
+               devices_rethink_all(ncr9x_rethink);
        }
        if (!ncr->chipirq && ncr->boardirq) {
                ncr->boardirq = false;
@@ -273,7 +274,7 @@ static void set_irq2_dkb1200(struct ncr9x_state *ncr)
                ncr->boardirq = false;
        if (ncr->chipirq && !ncr->boardirq && (ncr->states[0] & 0x40)) {
                ncr->boardirq = true;
-               ncr9x_rethink();
+               devices_rethink_all(ncr9x_rethink);
        }
 }
 
@@ -283,7 +284,10 @@ static void set_irq2_oktagon(struct ncr9x_state *ncr)
                ncr->boardirq = false;
        if (ncr->chipirq && !ncr->boardirq && (ncr->states[0] & 0x80)) {
                ncr->boardirq = true;
-               ncr9x_rethink();
+               devices_rethink_all(ncr9x_rethink);
+       }
+}
+
 static void set_irq2_alf3(struct ncr9x_state *ncr)
 {
        if (!(ncr->states[0] & 0x01))
@@ -306,7 +310,7 @@ static void set_irq2_fastlane(struct ncr9x_state *ncr)
        if (ncr->states[0] & FLSC_PB_ESI) {
                if (!ncr->boardirq) {
                        ncr->boardirq = true;
-                       ncr9x_rethink();
+                       devices_rethink_all(ncr9x_rethink);
                }
        }
 }
@@ -321,7 +325,7 @@ static void set_irq2_masoboshi(struct ncr9x_state *ncr)
                ncr->boardirqlatch = true;
                if (1 || ncr->intena) {
                        ncr->boardirq = true;
-                       ncr9x_rethink();
+                       devices_rethink_all(ncr9x_rethink);
 #if NCR_DEBUG > 1
                        write_log(_T("MASOBOSHI IRQ\n"));
 #endif
@@ -718,7 +722,8 @@ SCSIDevice *scsiesp_device_find(SCSIBus *bus, int channel, int target, int lun)
 }
 void scsiesp_req_cancel(SCSIRequest *req)
 {
-       write_log(_T("scsi_req_cancel\n"));
+       write_log(_T("scsi_req_cancel!?\n"));
+       esp_request_cancelled(req);
 }
 
 #define IO_MASK 0x3f
index d0a30bbd8f87060c0d498484040b9753c3fc081f..ccee1fcf10777fe27aa69b2500656c16a2570fd0 100644 (file)
@@ -165,17 +165,17 @@ static struct ncr_state *ncr_wildfire;
 static void set_irq2(int level)
 {
        if (level)
-               INTREQ(0x8000 | 0x0008);
+               safe_interrupt_set(0x0008);
 }
 
 void ncr_rethink(void)
 {
        for (int i = 0; ncr_units[i]; i++) {
                if (ncr_units[i] != ncr_cs && ncr_units[i]->irq)
-                       INTREQ_0(0x8000 | 0x0008);
+                       safe_interrupt_set(0x0008);
        }
        if (ncr_cs && ncr_cs->irq)
-               cyberstorm_mk3_ppc_irq(1);
+               cyberstorm_mk3_ppc_irq_setonly(1);
 }
 
 /* 720+ */
index b2c86d6f58778793a675279083a05d5d98cf6844..05d6acacba936b406117182a82e50ebdc48b9509 100644 (file)
@@ -4357,11 +4357,36 @@ static void check_uae_int_request(void)
                        irq = true;
                }
                if (uae_int_requested & 0xff0000) {
-                       if (!cpuboard_is_ppcboard_irq())
+                       if (!cpuboard_is_ppcboard_irq()) {
                                atomic_and(&uae_int_requested, ~0x010000);
+                       }
                }
-               if (irq)
+               if (irq) {
                        doint();
+               }
+       }
+}
+
+/* 0x0010 = generic expansion level 2
+ * 0x1000 = generic expansion level 6
+ */
+void safe_interrupt_clear_all(void)
+{
+       atomic_and(&uae_int_requested, ~(0x0010 | 0x1000));
+}
+
+void safe_interrupt_set(uae_u32 v)
+{
+       if (ppc_state || 0) {
+               set_special_exter(SPCFLAG_UAEINT);
+               if (v & 0x0008)
+                       atomic_or(&uae_int_requested, 0x0010);
+               if (v & 0x2000)
+                       atomic_or(&uae_int_requested, 0x1000);
+       } else {
+               if (currprefs.cpu_cycle_exact || (!(intreq & v) && !currprefs.cpu_cycle_exact)) {
+                       INTREQ_0(0x8000 | v);
+               }
        }
 }
 
diff --git a/pci.cpp b/pci.cpp
index 8cef7884548cc9b86398fc84a427b6a6405e7c1c..9203fbb1589b8a82d56ff065edbf0647cb06199f 100644 (file)
--- a/pci.cpp
+++ b/pci.cpp
@@ -28,6 +28,7 @@
 #include "rommgr.h"
 #include "cpuboard.h"
 #include "autoconf.h"
+#include "devices.h"
 
 #include "qemuvga/qemuuaeglue.h"
 #include "qemuvga/queue.h"
@@ -156,7 +157,6 @@ void pci_hsync(void)
 
 void pci_rethink(void)
 {
-       atomic_and(&uae_int_requested, ~(0x10 | 0x100));
        for (int i = 0; i < PCI_BRIDGE_MAX; i++) {
                struct pci_bridge *pcib = bridges[i];
                if (!pcib)
@@ -174,7 +174,7 @@ void pci_rethink(void)
                        }
                }
                if (pcib->irq & pcib->intena) {
-                       atomic_or(&uae_int_requested, pcib->intreq_mask);
+                       safe_interrupt_set(pcib->intreq_mask);
                }
        }
 }
@@ -184,7 +184,7 @@ static void set_pci_irq(struct pci_bridge *pcib, struct pci_board_state *pcibs,
        pcibs->config_data[5] &= ~(1 << 3);
        if (active)
                pcibs->config_data[5] |= (1 << 3);
-       pci_rethink();
+       devices_rethink_all(pci_rethink);
 }
 
 static void create_config_data(struct pci_board_state *s)
@@ -1506,7 +1506,7 @@ bool dkb_wildfire_pci_init(struct autoconfig_info *aci)
        pcib->endian_swap_io = 0;
        pcib->endian_swap_memory = 0;
        pcib->intena = 0xff; // controlled by bridge config bits, bit unknown.
-       pcib->intreq_mask = 0x100;
+       pcib->intreq_mask = 0x2000;
        pcib->get_index = dkb_wildfire_get_index;
        pcib->baseaddress = 0x80000000;
        pcib->baseaddress_end = 0xffffffff;
@@ -1569,7 +1569,7 @@ static bool prometheus_pci_init(struct autoconfig_info *aci)
        pcib->endian_swap_io = -1;
        pcib->endian_swap_memory = -1;
        pcib->intena = 0xff;
-       pcib->intreq_mask = 0x10;
+       pcib->intreq_mask = 0x0008;
        pcib->get_index = prometheus_get_index;
        pcib->bank = &pci_bridge_bank;
        pcib->bank_zorro = 3;
@@ -1618,7 +1618,7 @@ static bool grex_pci_init(struct autoconfig_info *aci)
        bridges[PCI_BRIDGE_GREX] = pcib;
        pcib->label = _T("G-REX");
        pcib->intena = 0;
-       pcib->intreq_mask = 0x10;
+       pcib->intreq_mask = 0x0008;
        pcib->get_index = grex_get_index;
        pcib->baseaddress = 0x80000000;
        pcib->baseaddress_end = 0xffffffff;
@@ -1654,7 +1654,7 @@ static bool cbvision(struct autoconfig_info *aci)
        bridges[PCI_BRIDGE_XVISION] = pcib;
        pcib->label = _T("CBVision");
        pcib->intena = 0;
-       pcib->intreq_mask = 0x10;
+       pcib->intreq_mask = 0x0008;
        pcib->get_index = xvision_get_index;
        pcib->baseaddress = 0xe0000000;
        pcib->baseaddress_end = 0xffffffff;
@@ -1754,7 +1754,7 @@ static void mediator_pci_init_1200(struct pci_bridge *pcib)
        pcib->endian_swap_io = -1;
        pcib->endian_swap_memory = -1;
        pcib->intena = 0;
-       pcib->intreq_mask = 0x10;
+       pcib->intreq_mask = 0x0008;
        pcib->get_index = mediator_get_index_1200;
        pcib->bank = &pci_bridge_bank;
        pcib->bank_2 = &pci_bridge_bank_2;
@@ -1832,7 +1832,7 @@ static void mediator_pci_init_4000(struct pci_bridge *pcib)
        pcib->endian_swap_io = -1;
        pcib->endian_swap_memory = -1;
        pcib->intena = 0;
-       pcib->intreq_mask = 0x10;
+       pcib->intreq_mask = 0x0008;
        pcib->get_index = mediator_get_index_4000;
        pcib->bank = &pci_bridge_bank;
        pcib->bank_2 = &pci_bridge_bank_2;
index 3efbc348a41d4eb77880835cb8dd3767ff433d6f..7fbba6aadb1a7d23fbc52da6e1a36bb29b74ef90 100644 (file)
@@ -35,6 +35,7 @@
 #include "custom.h"
 #include "debug.h"
 #include "sana2.h"
+#include "devices.h"
 
 #include "qemuuaeglue.h"
 #include "queue.h"
@@ -1856,9 +1857,9 @@ void rethink_ne2000(void)
                return;
        if (ne->ariadne2_irq) {
                if (ne->level6)
-                       INTREQ_0(0x8000 | 0x2000);
+                       safe_interrupt_set(0x2000);
                else
-                       INTREQ_0(0x8000 | 0x0008);
+                       safe_interrupt_set(0x0008);
        }
 }
 
@@ -1877,7 +1878,7 @@ static void ariadne2_irq_callback(struct pci_board_state *pcibs, bool irq)
        write_log(_T("ariadne2_irq_callback %d\n"), irq);
 #endif
        ne->ariadne2_irq = irq;
-       rethink_ne2000();
+       devices_rethink_all(rethink_ne2000);
 }
 
 static addrbank ariadne2_bank = {
index 6d04d1a1871f0b28881a37923611448dace4bcf4..6046491ce8ac6621ea4e81910df791de054fd1ce 100644 (file)
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -23,6 +23,7 @@
 #include "custom.h"
 #include "gayle.h"
 #include "cia.h"
+#include "devices.h"
 
 #define SCSI_EMU_DEBUG 0
 #define RAW_SCSI_DEBUG 0
@@ -1459,7 +1460,7 @@ static void aic_int(struct soft_scsi *scsi, uae_u8 mask)
        scsi->regs[16 + 8] |= mask;
        if ((scsi->regs[16 + 8] & scsi->regs[3]) & 0x1f) {
                scsi->irq = true;
-               ncr80_rethink();
+               devices_rethink_all(ncr80_rethink);
        } else {
                scsi->irq = false;
        }
@@ -1709,9 +1710,9 @@ void ncr80_rethink(void)
                                x86_doirq(5);
                        } else {
                                if (soft_scsi_devices[i]->level6)
-                                       INTREQ_0(0x8000 | 0x2000);
+                                       safe_interrupt_set(0x2000);
                                else
-                                       INTREQ_0(0x8000 | 0x0008);
+                                       safe_interrupt_set(0x0008);
                                return;
                        }
                }
@@ -1723,7 +1724,7 @@ static void ncr5380_set_irq(struct soft_scsi *scsi)
        if (scsi->irq)
                return;
        scsi->irq = true;
-       ncr80_rethink();
+       devices_rethink_all(ncr80_rethink);
        if (scsi->delayed_irq)
                x_do_cycles(2 * CYCLE_UNIT);
 #if NCR5380_DEBUG_IRQ
index db15c68d0b15b161618741cd08bdc301bbca70c1..5e24a8a98cb0a2a1e1b762290af48f7c7f2a0106 100644 (file)
@@ -22,6 +22,7 @@
 #include "pci_hw.h"
 #include "qemuvga/qemuaudio.h"
 #include "rommgr.h"
+#include "devices.h"
 
 static uae_u8 *sndboard_get_buffer(int *frames);
 static void sndboard_release_buffer(uae_u8 *buffer, int frames);
@@ -488,7 +489,7 @@ static void uaesnd_irq(struct uaesndboard_stream *s, uae_u8 mask)
        s->intreqmask |= mask;
        if ((s->intenamask & mask)) {
                s->intreqmask |= 0x80;
-               sndboard_rethink();
+               devices_rethink_all(sndboard_rethink);
        }
 }
 
@@ -1290,7 +1291,7 @@ static bool audio_state_sndboard_toccata(int streamid)
                        data->toccata_irq |= STATUS_READ_RECORD_HALF;
                }
                if (old != data->toccata_irq) {
-                       sndboard_rethink();
+                       devices_rethink_all(sndboard_rethink);
 #if DEBUG_TOCCATA > 2
                        write_log(_T("TOCCATA IRQ\n"));
 #endif
@@ -1423,10 +1424,11 @@ void sndboard_rethink(void)
                irq |= uaesnd_rethink();
        }
        if (irq) {
-               atomic_or(&uae_int_requested, 0x200);
-               set_special_exter(SPCFLAG_UAEINT);
+               safe_interrupt_set(0x2000);
+               //atomic_or(&uae_int_requested, 0x200);
+               //set_special_exter(SPCFLAG_UAEINT);
        } else {
-               atomic_and(&uae_int_requested, ~0x200);
+               //atomic_and(&uae_int_requested, ~0x200);
        }
 }
 
diff --git a/x86.cpp b/x86.cpp
index 7d0915fcccc546c10bdc01b239cb05d0eb737f74..812e288e4af4b60c01e9c452a19ea87fc9d457d9 100644 (file)
--- a/x86.cpp
+++ b/x86.cpp
@@ -39,6 +39,7 @@
 #include "idecontrollers.h"
 #include "gfxboard.h"
 #include "pci_hw.h"
+#include "devices.h"
 
 #include "dosbox/dosbox.h"
 #include "dosbox/mem.h"
@@ -423,7 +424,7 @@ static void set_interrupt(struct x86_bridge *xb, int bit)
        write_log(_T("IO_AMIGA_INTERRUPT_STATUS set bit %d\n"), bit);
 #endif
        xb->amiga_io[IO_AMIGA_INTERRUPT_STATUS] |= 1 << bit;
-       x86_bridge_rethink();
+       devices_rethink_all(x86_bridge_rethink);
 }
 
 /* 8237 and 8253 from fake86 with small modifications */
@@ -2968,7 +2969,7 @@ void x86_bridge_rethink(void)
                uae_u8 intena = xb->amiga_io[IO_INTERRUPT_MASK];
                uae_u8 status = intreq & ~intena;
                if (status)
-                       INTREQ_0(0x8000 | 0x0008);
+                       safe_interrupt_set(0x0008);
        }
 }
 
@@ -3100,7 +3101,7 @@ void x86_bridge_vsync(void)
                return;
 
        if (xb->delayed_interrupt) {
-               x86_bridge_rethink();
+               devices_rethink_all(x86_bridge_rethink);
        }
 }