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

📄 sys_sable.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 2 页
字号:
	{ /* mask_to_irq */		-1, -1, -1, 12, -1, -1,  1,  6,	/* mask 0-7   */		 3,  7, -1, -1,  5, -1, -1,  4,	/* mask 8-15  */		 9, 10, 11, -1, -1, 14, 15, -1,	/* mask 16-23 */		-1, -1, -1, -1, 28, -1, -1, -1,	/* mask 24-31 */		32, 33, 34, 35, 36, 37, 38, 39,	/* mask 32-39 */		40, 41, 42, 43, 44, 45, 46, 47,	/* mask 40-47 */		48, 49, 50, 51, 52, 53, 54, 55,	/* mask 48-55 */		56, 57, 58, 59, 60, 61, 62, 63	/* mask 56-63 */	},	-1,	lynx_update_irq_hw,	lynx_ack_irq_hw};static void __initlynx_init_irq(void){	sable_lynx_irq_swizzle = &lynx_irq_swizzle;	sable_lynx_init_irq(64);}/* * PCI Fixup configuration for ALPHA LYNX (2100A) * * The device to slot mapping looks like: * * Slot     Device *  0       none *  1       none *  2       PCI-EISA bridge *  3       PCI-PCI bridge *  4       NCR 810 (Demi-Lynx only) *  5       none *  6       PCI on board slot 4 *  7       PCI on board slot 5 *  8       PCI on board slot 6 *  9       PCI on board slot 7 * * And behind the PPB we have: * * 11       PCI on board slot 0 * 12       PCI on board slot 1 * 13       PCI on board slot 2 * 14       PCI on board slot 3 *//* * NOTE: the IRQ assignments below are arbitrary, but need to be consistent * with the values in the irq swizzling tables above. */static int __initlynx_map_irq(struct pci_dev *dev, u8 slot, u8 pin){	static char irq_tab[19][5] __initdata = {		/*INT    INTA   INTB   INTC   INTD */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 13,  PCEB   */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 14,  PPB    */		{   28,    28,    28,    28,    28},  /* IdSel 15,  NCR demi */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 16,  none   */		{   32,    32,    33,    34,    35},  /* IdSel 17,  slot 4 */		{   36,    36,    37,    38,    39},  /* IdSel 18,  slot 5 */		{   40,    40,    41,    42,    43},  /* IdSel 19,  slot 6 */		{   44,    44,    45,    46,    47},  /* IdSel 20,  slot 7 */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 22,  none   */		/* The following are actually behind the PPB. */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 16   none */		{   28,    28,    28,    28,    28},  /* IdSel 17   NCR lynx */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 18   none */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 19   none */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 20   none */		{   -1,    -1,    -1,    -1,    -1},  /* IdSel 21   none */		{   48,    48,    49,    50,    51},  /* IdSel 22   slot 0 */		{   52,    52,    53,    54,    55},  /* IdSel 23   slot 1 */		{   56,    56,    57,    58,    59},  /* IdSel 24   slot 2 */		{   60,    60,    61,    62,    63}   /* IdSel 25   slot 3 */	};	const long min_idsel = 2, max_idsel = 20, irqs_per_slot = 5;	return COMMON_TABLE_LOOKUP;}static u8 __initlynx_swizzle(struct pci_dev *dev, u8 *pinp){	int slot, pin = *pinp;	if (dev->bus->number == 0) {		slot = PCI_SLOT(dev->devfn);	}	/* Check for the built-in bridge */	else if (PCI_SLOT(dev->bus->self->devfn) == 3) {		slot = PCI_SLOT(dev->devfn) + 11;	}	else	{		/* Must be a card-based bridge.  */		do {			if (PCI_SLOT(dev->bus->self->devfn) == 3) {				slot = PCI_SLOT(dev->devfn) + 11;				break;			}			pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn)) ;			/* Move up the chain of bridges.  */			dev = dev->bus->self;			/* Slot of the next bridge.  */			slot = PCI_SLOT(dev->devfn);		} while (dev->bus->self);	}	*pinp = pin;	return slot;}#endif /* defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_LYNX) *//***********************************************************************//* GENERIC irq routines */static inline voidsable_lynx_enable_irq(unsigned int irq){	unsigned long bit, mask;	bit = sable_lynx_irq_swizzle->irq_to_mask[irq];	spin_lock(&sable_lynx_irq_lock);	mask = sable_lynx_irq_swizzle->shadow_mask &= ~(1UL << bit);	sable_lynx_irq_swizzle->update_irq_hw(bit, mask);	spin_unlock(&sable_lynx_irq_lock);#if 0	printk("%s: mask 0x%lx bit 0x%x irq 0x%x\n",	       __FUNCTION__, mask, bit, irq);#endif}static voidsable_lynx_disable_irq(unsigned int irq){	unsigned long bit, mask;	bit = sable_lynx_irq_swizzle->irq_to_mask[irq];	spin_lock(&sable_lynx_irq_lock);	mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit;	sable_lynx_irq_swizzle->update_irq_hw(bit, mask);	spin_unlock(&sable_lynx_irq_lock);#if 0	printk("%s: mask 0x%lx bit 0x%x irq 0x%x\n",	       __FUNCTION__, mask, bit, irq);#endif}static unsigned intsable_lynx_startup_irq(unsigned int irq){	sable_lynx_enable_irq(irq);	return 0;}static voidsable_lynx_end_irq(unsigned int irq){	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))		sable_lynx_enable_irq(irq);}static voidsable_lynx_mask_and_ack_irq(unsigned int irq){	unsigned long bit, mask;	bit = sable_lynx_irq_swizzle->irq_to_mask[irq];	spin_lock(&sable_lynx_irq_lock);	mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit;	sable_lynx_irq_swizzle->update_irq_hw(bit, mask);	sable_lynx_irq_swizzle->ack_irq_hw(bit);	spin_unlock(&sable_lynx_irq_lock);}static struct hw_interrupt_type sable_lynx_irq_type = {	.typename	= "SABLE/LYNX",	.startup	= sable_lynx_startup_irq,	.shutdown	= sable_lynx_disable_irq,	.enable		= sable_lynx_enable_irq,	.disable	= sable_lynx_disable_irq,	.ack		= sable_lynx_mask_and_ack_irq,	.end		= sable_lynx_end_irq,};static void sable_lynx_srm_device_interrupt(unsigned long vector, struct pt_regs * regs){	/* Note that the vector reported by the SRM PALcode corresponds	   to the interrupt mask bits, but we have to manage via the	   so-called legacy IRQs for many common devices.  */	int bit, irq;	bit = (vector - 0x800) >> 4;	irq = sable_lynx_irq_swizzle->mask_to_irq[bit];#if 0	printk("%s: vector 0x%lx bit 0x%x irq 0x%x\n",	       __FUNCTION__, vector, bit, irq);#endif	handle_irq(irq, regs);}static void __initsable_lynx_init_irq(int nr_irqs){	long i;	for (i = 0; i < nr_irqs; ++i) {		irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;		irq_desc[i].handler = &sable_lynx_irq_type;	}	common_init_isa_dma();}static void __initsable_lynx_init_pci(void){	common_init_pci();}/*****************************************************************//* * The System Vectors * * In order that T2_HAE_ADDRESS should be a constant, we play * these games with GAMMA_BIAS. */#if defined(CONFIG_ALPHA_GENERIC) || \    (defined(CONFIG_ALPHA_SABLE) && !defined(CONFIG_ALPHA_GAMMA))#undef GAMMA_BIAS#define GAMMA_BIAS 0struct alpha_machine_vector sable_mv __initmv = {	.vector_name		= "Sable",	DO_EV4_MMU,	DO_DEFAULT_RTC,	DO_T2_IO,	.machine_check		= t2_machine_check,	.max_isa_dma_address	= ALPHA_SABLE_MAX_ISA_DMA_ADDRESS,	.min_io_address		= EISA_DEFAULT_IO_BASE,	.min_mem_address	= T2_DEFAULT_MEM_BASE,	.nr_irqs		= 40,	.device_interrupt	= sable_lynx_srm_device_interrupt,	.init_arch		= t2_init_arch,	.init_irq		= sable_init_irq,	.init_rtc		= common_init_rtc,	.init_pci		= sable_lynx_init_pci,	.kill_arch		= t2_kill_arch,	.pci_map_irq		= sable_map_irq,	.pci_swizzle		= common_swizzle,	.sys = { .t2 = {	    .gamma_bias		= 0	} }};ALIAS_MV(sable)#endif /* GENERIC || (SABLE && !GAMMA) */#if defined(CONFIG_ALPHA_GENERIC) || \    (defined(CONFIG_ALPHA_SABLE) && defined(CONFIG_ALPHA_GAMMA))#undef GAMMA_BIAS#define GAMMA_BIAS _GAMMA_BIASstruct alpha_machine_vector sable_gamma_mv __initmv = {	.vector_name		= "Sable-Gamma",	DO_EV5_MMU,	DO_DEFAULT_RTC,	DO_T2_IO,	.machine_check		= t2_machine_check,	.max_isa_dma_address	= ALPHA_SABLE_MAX_ISA_DMA_ADDRESS,	.min_io_address		= EISA_DEFAULT_IO_BASE,	.min_mem_address	= T2_DEFAULT_MEM_BASE,	.nr_irqs		= 40,	.device_interrupt	= sable_lynx_srm_device_interrupt,	.init_arch		= t2_init_arch,	.init_irq		= sable_init_irq,	.init_rtc		= common_init_rtc,	.init_pci		= sable_lynx_init_pci,	.kill_arch		= t2_kill_arch,	.pci_map_irq		= sable_map_irq,	.pci_swizzle		= common_swizzle,	.sys = { .t2 = {	    .gamma_bias		= _GAMMA_BIAS	} }};ALIAS_MV(sable_gamma)#endif /* GENERIC || (SABLE && GAMMA) */#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_LYNX)#undef GAMMA_BIAS#define GAMMA_BIAS _GAMMA_BIASstruct alpha_machine_vector lynx_mv __initmv = {	.vector_name		= "Lynx",	DO_EV4_MMU,	DO_DEFAULT_RTC,	DO_T2_IO,	.machine_check		= t2_machine_check,	.max_isa_dma_address	= ALPHA_SABLE_MAX_ISA_DMA_ADDRESS,	.min_io_address		= EISA_DEFAULT_IO_BASE,	.min_mem_address	= T2_DEFAULT_MEM_BASE,	.nr_irqs		= 64,	.device_interrupt	= sable_lynx_srm_device_interrupt,	.init_arch		= t2_init_arch,	.init_irq		= lynx_init_irq,	.init_rtc		= common_init_rtc,	.init_pci		= sable_lynx_init_pci,	.kill_arch		= t2_kill_arch,	.pci_map_irq		= lynx_map_irq,	.pci_swizzle		= lynx_swizzle,	.sys = { .t2 = {	    .gamma_bias		= _GAMMA_BIAS	} }};ALIAS_MV(lynx)#endif /* GENERIC || LYNX */

⌨️ 快捷键说明

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