Changeset 01d5049 in mainline


Ignore:
Timestamp:
2024-06-11T14:56:24Z (3 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
221daa5
Parents:
c4ed9fa
Message:

PCI-IDE should correctly handle interrupt sharing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/pci-ide/pci-ide.c

    rc4ed9fa r01d5049  
    8181                .base = 0,
    8282                .size = sizeof(ata_cmd_t)
     83        },
     84        {
     85                .base = 0,
     86                .size = sizeof(pci_ide_regs_t)
    8387        }
    8488};
     
    8690/** IDE interrupt pseudo code. */
    8791static const irq_cmd_t pci_ide_irq_cmds[] = {
     92        /* [0] Read BMISX */
    8893        {
    8994                .cmd = CMD_PIO_READ_8,
     
    9196                .dstarg = 1
    9297        },
     98        /* [1] Test BMISX.IDEINTS */
     99        {
     100                .cmd = CMD_AND,
     101                .value = bmisx_ideints,
     102                .srcarg = 1,
     103                .dstarg = 2
     104        },
     105        /* [2] if (BMISX.IDEINTS != 0) { */
     106        {
     107                .cmd = CMD_PREDICATE,
     108                .srcarg = 2,
     109                .value = 3
     110        },
     111        /*
     112         * [3] Clear BMISX.IDEINTS by writing 1 to it. This clears bits 6,5,
     113         * but that should not matter.
     114         */
     115        {
     116                .cmd = CMD_PIO_WRITE_8,
     117                .addr = NULL,  /* will be patched in run-time */
     118                .value = bmisx_ideints
     119        },
     120        /* [4] Read IDE status register */
     121        {
     122                .cmd = CMD_PIO_READ_8,
     123                .addr = NULL,  /* will be patched in run-time */
     124                .dstarg = 1
     125        },
     126        /* [5] Accept */
    93127        {
    94128                .cmd = CMD_ACCEPT
    95         }
     129        },
     130        /* [6] } else { Decline */
     131        {
     132                .cmd = CMD_DECLINE
     133        }
     134        /* } */
    96135};
    97136
     
    329368        irq_pio_range_t *ranges;
    330369        irq_cmd_t *cmds;
     370        uint8_t *bmisx;
    331371        errno_t rc;
    332372
     
    344384        }
    345385
     386        /* Bus master IDE status register (primary or secondary) */
     387        bmisx = chan->chan_id == 0 ?
     388            &chan->ctrl->bmregs->bmisp :
     389            &chan->ctrl->bmregs->bmiss;
     390
    346391        memcpy(ranges, &pci_ide_irq_ranges, sizeof(pci_ide_irq_ranges));
    347392        ranges[0].base = chan->cmd_physical;
     393        ranges[1].base = chan->ctrl->bmregs_physical;
     394
    348395        memcpy(cmds, &pci_ide_irq_cmds, sizeof(pci_ide_irq_cmds));
    349         cmds[0].addr = &chan->cmd->status;
     396        cmds[0].addr = bmisx;
     397        cmds[3].addr = bmisx;
     398        cmds[4].addr = &chan->cmd->status;
    350399
    351400        irq_code.rangecount = sizeof(pci_ide_irq_ranges) / sizeof(irq_pio_range_t);
Note: See TracChangeset for help on using the changeset viewer.