Пример #1
0
/*
 * Common case interrupt handler.
 */
static void
mvs_intr(void *data)
{
	struct mvs_controller *ctlr = data;
	struct mvs_intr_arg arg;
	void (*function)(void *);
	int p;
	u_int32_t ic, aic;

	ic = ATA_INL(ctlr->r_mem, CHIP_SOC_MIC);
	if ((ic & IC_HC0) == 0)
		return;
	/* Acknowledge interrupts of this HC. */
	aic = 0;
	if (ic & (IC_DONE_IRQ << 0))
		aic |= HC_IC_DONE(0) | HC_IC_DEV(0);
	if (ic & (IC_DONE_IRQ << 2))
		aic |= HC_IC_DONE(1) | HC_IC_DEV(1);
	if (ic & (IC_DONE_IRQ << 4))
		aic |= HC_IC_DONE(2) | HC_IC_DEV(2);
	if (ic & (IC_DONE_IRQ << 6))
		aic |= HC_IC_DONE(3) | HC_IC_DEV(3);
	if (ic & IC_HC0_COAL_DONE)
		aic |= HC_IC_COAL;
	ATA_OUTL(ctlr->r_mem, HC_IC, ~aic);
	/* Call per-port interrupt handler. */
	for (p = 0; p < ctlr->channels; p++) {
		arg.cause = ic & (IC_ERR_IRQ|IC_DONE_IRQ);
		if ((arg.cause != 0) &&
		    (function = ctlr->interrupt[p].function)) {
			arg.arg = ctlr->interrupt[p].argument;
			function(&arg);
		}
		ic >>= 2;
	}
}
Пример #2
0
/*
 * Common case interrupt handler.
 */
static void
mvs_intr(void *data)
{
	struct mvs_controller *ctlr = data;
	struct mvs_intr_arg arg;
	void (*function)(void *);
	int p, chan_num;
	u_int32_t ic, aic;

	ic = ATA_INL(ctlr->r_mem, CHIP_SOC_MIC);
	if ((ic & IC_HC0) == 0)
		return;

	/* Acknowledge interrupts of this HC. */
	aic = 0;

	/* Processing interrupts from each initialized channel */
	for (chan_num = 0; chan_num < ctlr->channels; chan_num++) {
		if (ic & (IC_DONE_IRQ << (chan_num * 2)))
			aic |= HC_IC_DONE(chan_num) | HC_IC_DEV(chan_num);
	}

	if (ic & IC_HC0_COAL_DONE)
		aic |= HC_IC_COAL;
	ATA_OUTL(ctlr->r_mem, HC_IC, ~aic);

	/* Call per-port interrupt handler. */
	for (p = 0; p < ctlr->channels; p++) {
		arg.cause = ic & (IC_ERR_IRQ|IC_DONE_IRQ);
		if ((arg.cause != 0) &&
		    (function = ctlr->interrupt[p].function)) {
			arg.arg = ctlr->interrupt[p].argument;
			function(&arg);
		}
		ic >>= 2;
	}
}