⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 irq.c

📁 linux 内核源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
	x |= irq ? irq: PIRQ_SIS_IRQ_DISABLE;	pci_write_config_byte(router, reg, x);	return 1;}/* * VLSI: nibble offset 0x74 - educated guess due to routing table and *       config space of VLSI 82C534 PCI-bridge/router (1004:0102) *       Tested on HP OmniBook 800 covering PIRQ 1, 2, 4, 8 for onboard *       devices, PIRQ 3 for non-pci(!) soundchip and (untested) PIRQ 6 *       for the busbridge to the docking station. */static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq){	if (pirq > 8) {		printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq);		return 0;	}	return read_config_nybble(router, 0x74, pirq-1);}static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq){	if (pirq > 8) {		printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq);		return 0;	}	write_config_nybble(router, 0x74, pirq-1, irq);	return 1;}/* * ServerWorks: PCI interrupts mapped to system IRQ lines through Index * and Redirect I/O registers (0x0c00 and 0x0c01).  The Index register * format is (PCIIRQ## | 0x10), e.g.: PCIIRQ10=0x1a.  The Redirect * register is a straight binary coding of desired PIC IRQ (low nibble). * * The 'link' value in the PIRQ table is already in the correct format * for the Index register.  There are some special index values: * 0x00 for ACPI (SCI), 0x01 for USB, 0x02 for IDE0, 0x04 for IDE1, * and 0x03 for SMBus. */static int pirq_serverworks_get(struct pci_dev *router, struct pci_dev *dev, int pirq){	outb_p(pirq, 0xc00);	return inb(0xc01) & 0xf;}static int pirq_serverworks_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq){	outb_p(pirq, 0xc00);	outb_p(irq, 0xc01);	return 1;}/* Support for AMD756 PCI IRQ Routing * Jhon H. Caicedo <jhcaiced@osso.org.co> * Jun/21/2001 0.2.0 Release, fixed to use "nybble" functions... (jhcaiced) * Jun/19/2001 Alpha Release 0.1.0 (jhcaiced) * The AMD756 pirq rules are nibble-based * offset 0x56 0-3 PIRQA  4-7  PIRQB * offset 0x57 0-3 PIRQC  4-7  PIRQD */static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq){	u8 irq;	irq = 0;	if (pirq <= 4)	{		irq = read_config_nybble(router, 0x56, pirq - 1);	}	printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n",		dev->vendor, dev->device, pirq, irq);	return irq;}static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq){	printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", 		dev->vendor, dev->device, pirq, irq);	if (pirq <= 4)	{		write_config_nybble(router, 0x56, pirq - 1, irq);	}	return 1;}/* * PicoPower PT86C523 */static int pirq_pico_get(struct pci_dev *router, struct pci_dev *dev, int pirq){	outb(0x10 + ((pirq - 1) >> 1), 0x24);	return ((pirq - 1) & 1) ? (inb(0x26) >> 4) : (inb(0x26) & 0xf);}static int pirq_pico_set(struct pci_dev *router, struct pci_dev *dev, int pirq,			int irq){	unsigned int x;	outb(0x10 + ((pirq - 1) >> 1), 0x24);	x = inb(0x26);	x = ((pirq - 1) & 1) ? ((x & 0x0f) | (irq << 4)) : ((x & 0xf0) | (irq));	outb(x, 0x26);	return 1;}#ifdef CONFIG_PCI_BIOSstatic int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq){	struct pci_dev *bridge;	int pin = pci_get_interrupt_pin(dev, &bridge);	return pcibios_set_irq_routing(bridge, pin, irq);}#endifstatic __init int intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	static struct pci_device_id __initdata pirq_440gx[] = {		{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0) },		{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2) },		{ },	};	/* 440GX has a proprietary PIRQ router -- don't use it */	if (pci_dev_present(pirq_440gx))		return 0;	switch(device)	{		case PCI_DEVICE_ID_INTEL_82371FB_0:		case PCI_DEVICE_ID_INTEL_82371SB_0:		case PCI_DEVICE_ID_INTEL_82371AB_0:		case PCI_DEVICE_ID_INTEL_82371MX:		case PCI_DEVICE_ID_INTEL_82443MX_0:		case PCI_DEVICE_ID_INTEL_82801AA_0:		case PCI_DEVICE_ID_INTEL_82801AB_0:		case PCI_DEVICE_ID_INTEL_82801BA_0:		case PCI_DEVICE_ID_INTEL_82801BA_10:		case PCI_DEVICE_ID_INTEL_82801CA_0:		case PCI_DEVICE_ID_INTEL_82801CA_12:		case PCI_DEVICE_ID_INTEL_82801DB_0:		case PCI_DEVICE_ID_INTEL_82801E_0:		case PCI_DEVICE_ID_INTEL_82801EB_0:		case PCI_DEVICE_ID_INTEL_ESB_1:		case PCI_DEVICE_ID_INTEL_ICH6_0:		case PCI_DEVICE_ID_INTEL_ICH6_1:		case PCI_DEVICE_ID_INTEL_ICH7_0:		case PCI_DEVICE_ID_INTEL_ICH7_1:		case PCI_DEVICE_ID_INTEL_ICH7_30:		case PCI_DEVICE_ID_INTEL_ICH7_31:		case PCI_DEVICE_ID_INTEL_ESB2_0:		case PCI_DEVICE_ID_INTEL_ICH8_0:		case PCI_DEVICE_ID_INTEL_ICH8_1:		case PCI_DEVICE_ID_INTEL_ICH8_2:		case PCI_DEVICE_ID_INTEL_ICH8_3:		case PCI_DEVICE_ID_INTEL_ICH8_4:		case PCI_DEVICE_ID_INTEL_ICH9_0:		case PCI_DEVICE_ID_INTEL_ICH9_1:		case PCI_DEVICE_ID_INTEL_ICH9_2:		case PCI_DEVICE_ID_INTEL_ICH9_3:		case PCI_DEVICE_ID_INTEL_ICH9_4:		case PCI_DEVICE_ID_INTEL_ICH9_5:		case PCI_DEVICE_ID_INTEL_TOLAPAI_0:			r->name = "PIIX/ICH";			r->get = pirq_piix_get;			r->set = pirq_piix_set;			return 1;	}	return 0;}static __init int via_router_probe(struct irq_router *r,				struct pci_dev *router, u16 device){	/* FIXME: We should move some of the quirk fixup stuff here */	/*	 * workarounds for some buggy BIOSes	 */	if (device == PCI_DEVICE_ID_VIA_82C586_0) {		switch(router->device) {		case PCI_DEVICE_ID_VIA_82C686:			/*			 * Asus k7m bios wrongly reports 82C686A			 * as 586-compatible			 */			device = PCI_DEVICE_ID_VIA_82C686;			break;		case PCI_DEVICE_ID_VIA_8235:			/**			 * Asus a7v-x bios wrongly reports 8235			 * as 586-compatible			 */			device = PCI_DEVICE_ID_VIA_8235;			break;		}	}	switch(device) {	case PCI_DEVICE_ID_VIA_82C586_0:		r->name = "VIA";		r->get = pirq_via586_get;		r->set = pirq_via586_set;		return 1;	case PCI_DEVICE_ID_VIA_82C596:	case PCI_DEVICE_ID_VIA_82C686:	case PCI_DEVICE_ID_VIA_8231:	case PCI_DEVICE_ID_VIA_8233A:	case PCI_DEVICE_ID_VIA_8235:	case PCI_DEVICE_ID_VIA_8237:		/* FIXME: add new ones for 8233/5 */		r->name = "VIA";		r->get = pirq_via_get;		r->set = pirq_via_set;		return 1;	}	return 0;}static __init int vlsi_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch(device)	{		case PCI_DEVICE_ID_VLSI_82C534:			r->name = "VLSI 82C534";			r->get = pirq_vlsi_get;			r->set = pirq_vlsi_set;			return 1;	}	return 0;}static __init int serverworks_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch(device)	{		case PCI_DEVICE_ID_SERVERWORKS_OSB4:		case PCI_DEVICE_ID_SERVERWORKS_CSB5:			r->name = "ServerWorks";			r->get = pirq_serverworks_get;			r->set = pirq_serverworks_set;			return 1;	}	return 0;}static __init int sis_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	if (device != PCI_DEVICE_ID_SI_503)		return 0;			r->name = "SIS";	r->get = pirq_sis_get;	r->set = pirq_sis_set;	return 1;}static __init int cyrix_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch(device)	{		case PCI_DEVICE_ID_CYRIX_5520:			r->name = "NatSemi";			r->get = pirq_cyrix_get;			r->set = pirq_cyrix_set;			return 1;	}	return 0;}static __init int opti_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch(device)	{		case PCI_DEVICE_ID_OPTI_82C700:			r->name = "OPTI";			r->get = pirq_opti_get;			r->set = pirq_opti_set;			return 1;	}	return 0;}static __init int ite_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch(device)	{		case PCI_DEVICE_ID_ITE_IT8330G_0:			r->name = "ITE";			r->get = pirq_ite_get;			r->set = pirq_ite_set;			return 1;	}	return 0;}static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch(device)	{	case PCI_DEVICE_ID_AL_M1533:	case PCI_DEVICE_ID_AL_M1563:		printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");		r->name = "ALI";		r->get = pirq_ali_get;		r->set = pirq_ali_set;		return 1;	}	return 0;}static __init int amd_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch(device)	{		case PCI_DEVICE_ID_AMD_VIPER_740B:			r->name = "AMD756";			break;		case PCI_DEVICE_ID_AMD_VIPER_7413:			r->name = "AMD766";			break;		case PCI_DEVICE_ID_AMD_VIPER_7443:			r->name = "AMD768";			break;		default:			return 0;	}	r->get = pirq_amd756_get;	r->set = pirq_amd756_set;	return 1;}		static __init int pico_router_probe(struct irq_router *r, struct pci_dev *router, u16 device){	switch (device) {	case PCI_DEVICE_ID_PICOPOWER_PT86C523:		r->name = "PicoPower PT86C523";		r->get = pirq_pico_get;		r->set = pirq_pico_set;		return 1;	case PCI_DEVICE_ID_PICOPOWER_PT86C523BBP:		r->name = "PicoPower PT86C523 rev. BB+";		r->get = pirq_pico_get;		r->set = pirq_pico_set;		return 1;	}	return 0;}static __initdata struct irq_router_handler pirq_routers[] = {	{ PCI_VENDOR_ID_INTEL, intel_router_probe },	{ PCI_VENDOR_ID_AL, ali_router_probe },	{ PCI_VENDOR_ID_ITE, ite_router_probe },	{ PCI_VENDOR_ID_VIA, via_router_probe },	{ PCI_VENDOR_ID_OPTI, opti_router_probe },	{ PCI_VENDOR_ID_SI, sis_router_probe },	{ PCI_VENDOR_ID_CYRIX, cyrix_router_probe },	{ PCI_VENDOR_ID_VLSI, vlsi_router_probe },	{ PCI_VENDOR_ID_SERVERWORKS, serverworks_router_probe },	{ PCI_VENDOR_ID_AMD, amd_router_probe },	{ PCI_VENDOR_ID_PICOPOWER, pico_router_probe },	/* Someone with docs needs to add the ATI Radeon IGP */	{ 0, NULL }};static struct irq_router pirq_router;static struct pci_dev *pirq_router_dev;/* *	FIXME: should we have an option to say "generic for *	chipset" ? */ static void __init pirq_find_router(struct irq_router *r){	struct irq_routing_table *rt = pirq_table;	struct irq_router_handler *h;#ifdef CONFIG_PCI_BIOS	if (!rt->signature) {		printk(KERN_INFO "PCI: Using BIOS for IRQ routing\n");		r->set = pirq_bios_set;		r->name = "BIOS";		return;	}#endif	/* Default unless a driver reloads it */	r->name = "default";	r->get = NULL;	r->set = NULL;		DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n",	    rt->rtr_vendor, rt->rtr_device);	pirq_router_dev = pci_get_bus_and_slot(rt->rtr_bus, rt->rtr_devfn);	if (!pirq_router_dev) {		DBG(KERN_DEBUG "PCI: Interrupt router not found at "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -