From 8107343f96dfc7d67ff70827e35bfdccdf65a478 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 29 Oct 2023 01:43:58 +0200 Subject: [PATCH] Fixed IDE IRQ's on non-bus mastering IDE controllers. --- src/disk/hdc_ide.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 701615d47..336b0cfaf 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -344,13 +344,15 @@ ide_irq_update(ide_board_t *dev) if (dev == NULL) return; + ide_log("IDE %i: IRQ update (%i)\n", dev->cur_dev >> 1, dev->irq); + ide = ide_drives[dev->cur_dev]; set = !(ide_boards[ide->board]->devctl & 2) && ide->irqstat; if (!dev->force_ata3 && dev->bm && dev->bm->set_irq) dev->bm->set_irq(set << 2, dev->bm->priv); else if (ide_boards[ide->board]->irq != -1) - picint_common(dev->irq, PIC_IRQ_EDGE, set, NULL); + picint_common(1 << dev->irq, PIC_IRQ_EDGE, set, NULL); } void @@ -359,9 +361,7 @@ ide_irq_raise(ide_t *ide) if (!ide_boards[ide->board]) return; - /* ide_log("Raising IRQ %i (board %i)\n", ide_boards[ide->board]->irq, ide->board); */ - - ide_log("IDE %i: IRQ raise\n", ide->board); + ide_log("IDE %i: IRQ raise\n", ide->channel); ide->irqstat = 1; ide->service = 1; @@ -376,9 +376,7 @@ ide_irq_lower(ide_t *ide) if (!ide_boards[ide->board]) return; - /* ide_log("Lowering IRQ %i (board %i)\n", ide_boards[ide->board]->irq, ide->board); */ - - // ide_log("IDE %i: IRQ lower\n", ide->board); + ide_log("IDE %i: IRQ lower\n", ide->channel); ide->irqstat = 0; @@ -1497,7 +1495,7 @@ ide_writeb(uint16_t addr, uint8_t val, void *priv) break; case 0x7: /* Command register */ - if (absent == 2) + if (absent != 0) break; ide_irq_lower(ide);