Beispiel #1
0
static int mp_register_gsi(struct device *dev, u32 gsi, int trigger,
			   int polarity)
{
	int irq, node;

	if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
		return gsi;

	trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1;
	polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1;
	node = dev ? dev_to_node(dev) : NUMA_NO_NODE;
	if (mp_set_gsi_attr(gsi, trigger, polarity, node)) {
		pr_warn("Failed to set pin attr for GSI%d\n", gsi);
		return -1;
	}

	irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC);
	if (irq < 0)
		return irq;

	/* Don't set up the ACPI SCI because it's already set up */
	if (enable_update_mptable && acpi_gbl_FADT.sci_interrupt != gsi)
		mp_config_acpi_gsi(dev, gsi, trigger, polarity);

	return irq;
}
Beispiel #2
0
static void mp_unregister_gsi(u32 gsi)
{
	int irq;

	if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC)
		return;

	irq = mp_map_gsi_to_irq(gsi, 0);
	if (irq > 0)
		mp_unmap_irq(irq);
}
static int tangier_probe(struct platform_device *pdev)
{
	int gsi;
	struct irq_alloc_info info;
	struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;

	if (!pdata)
		return -EINVAL;

	/* IOAPIC builds identity mapping between GSI and IRQ on MID */
	gsi = pdata->irq;
	ioapic_set_alloc_attr(&info, cpu_to_node(0), 1, 0);
	if (mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info) <= 0) {
		dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n",
			 gsi);
		return -EINVAL;
	}

	return 0;
}