Пример #1
0
static inline void dpram_intr_handler(struct dpram_link_device *dpld, u16 intr)
{
	char *name = dpld->ld.name;

	if (unlikely(intr == INT_POWERSAFE_FAIL)) {
		mif_info("%s: intr == INT_POWERSAFE_FAIL\n", name);
		return;
	}

	if (unlikely(EXT_UDL_CMD(intr))) {
		if (likely(EXT_INT_VALID(intr))) {
			if (UDL_CMD_VALID(intr))
				udl_command_handler(dpld, intr);
			else if (EXT_CMD_VALID(intr))
				ext_command_handler(dpld, intr);
			else
				mif_info("%s: ERR! invalid intr 0x%04X\n",
					name, intr);
		} else {
			mif_info("%s: ERR! invalid intr 0x%04X\n", name, intr);
		}
		return;
	}

	if (likely(INT_VALID(intr)))
		dpram_ipc_rx(dpld, intr);
	else
		mif_info("%s: ERR! invalid intr 0x%04X\n", name, intr);
}
Пример #2
0
static irqreturn_t dpram_irq_handler(int irq, void *data)
{
	struct dpram_link_device *dpld = (struct dpram_link_device *)data;
	struct link_device *ld = (struct link_device *)&dpld->ld;
	u16 int2ap = 0;

	if (unlikely(ld->mode == LINK_MODE_OFFLINE))
		return IRQ_HANDLED;

	if (dpram_wake_up(dpld) < 0) {
		log_dpram_status(dpld);
		trigger_force_cp_crash(dpld);
		return IRQ_HANDLED;
	}

	int2ap = recv_intr(dpld);

	if (unlikely(int2ap == INT_POWERSAFE_FAIL)) {
		mif_info("%s: int2ap == INT_POWERSAFE_FAIL\n", ld->name);
		goto exit;
	} else if (int2ap == 0x1234 || int2ap == 0xDBAB || int2ap == 0xABCD) {
		if (dpld->ext_op && dpld->ext_op->dload_cmd_handler) {
			dpld->ext_op->dload_cmd_handler(dpld, int2ap);
			goto exit;
		}
	}

	if (unlikely(EXT_UDL_CMD(int2ap))) {
		if (likely(EXT_INT_VALID(int2ap))) {
			if (UDL_CMD_VALID(int2ap))
				udl_command_handler(dpld, int2ap);
			else if (EXT_CMD_VALID(int2ap))
				ext_command_handler(dpld, int2ap);
			else
				mif_info("%s: ERR! invalid intr 0x%04X\n",
					ld->name, int2ap);
		} else {
			mif_info("%s: ERR! invalid intr 0x%04X\n",
				ld->name, int2ap);
		}
	} else {
		if (likely(INT_VALID(int2ap))) {
			if (unlikely(INT_CMD_VALID(int2ap)))
				command_handler(dpld, int2ap);
			else
				non_command_handler(dpld, int2ap);
		} else {
			mif_info("%s: ERR! invalid intr 0x%04X\n",
				ld->name, int2ap);
		}
	}

exit:
	clear_intr(dpld);
	dpram_allow_sleep(dpld);
	return IRQ_HANDLED;
}