From: Andy P. <at...@us...> - 2002-04-10 18:37:03
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/sgi/kernel Modified Files: Makefile indy_hpc.c indy_int.c indy_mc.c indy_rtc.c indy_sc.c reset.c setup.c system.c time.c Removed Files: indy_timer.c promcon.c Log Message: synch 2.4.15 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:28:22 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 14:38:10 -0000 1.2 @@ -13,21 +13,13 @@ .S.o: $(CC) $(CFLAGS) -c $< -o $*.o -OBJS = indy_mc.o indy_sc.o indy_hpc.o indy_int.o indy_rtc.o \ - system.o indyIRQ.o reset.o setup.o time.o -ifdef CONFIG_SGI_PROM_CONSOLE -OBJS += promcon.o -endif +O_TARGET := ip22-kern.o -all: sgikern.a +all: ip22-kern.o indyIRQ.o -sgikern.a: $(OBJS) - $(AR) rcs sgikern.a $(OBJS) - sync +obj-y += indy_mc.o indy_sc.o indy_hpc.o indy_int.o indy_rtc.o system.o \ + indyIRQ.o reset.o setup.o time.o indyIRQ.o: indyIRQ.S - -dep: - $(CPP) $(CPPFLAGS) -M *.c > .depend include $(TOPDIR)/Rules.make Index: indy_hpc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/indy_hpc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- indy_hpc.c 14 Jan 2001 19:28:24 -0000 1.1.1.1 +++ indy_hpc.c 10 Apr 2002 14:38:10 -0000 1.2 @@ -12,6 +12,7 @@ #include <asm/sgi/sgihpc.h> #include <asm/sgi/sgint23.h> #include <asm/sgialib.h> +#include <asm/bootinfo.h> /* #define DEBUG_SGIHPC */ @@ -50,10 +51,12 @@ prom_printf("GUINESS "); #endif sgi_guiness = 1; + mips_machtype = MACH_SGI_INDY; } else { #ifdef DEBUG_SGIHPC prom_printf("FULLHOUSE "); #endif + mips_machtype = MACH_SGI_INDIGO2; sgi_guiness = 0; } sgi_boardid = brev; Index: indy_int.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/indy_int.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- indy_int.c 25 Feb 2001 23:15:17 -0000 1.1.1.2 +++ indy_int.c 10 Apr 2002 14:38:10 -0000 1.2 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * indy_int.c: Routines for generic manipulation of the INT[23] ASIC * found on INDY workstations.. * @@ -70,8 +69,6 @@ extern asmlinkage void indyIRQ(void); -unsigned long spurious_count = 0; - /* Local IRQ's are layed out logically like this: * * 0 --> 7 == local 0 interrupts @@ -79,433 +76,333 @@ * 16 --> 23 == vectored level 2 interrupts * 24 --> 31 == vectored level 3 interrupts (not used) */ -void disable_local_irq(unsigned int irq_nr) +static void enable_local0_irq(unsigned int irq) { unsigned long flags; save_and_cli(flags); - switch(irq_nr) { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: - ioc_icontrol->imask0 &= ~(1 << irq_nr); - break; - - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: - ioc_icontrol->imask1 &= ~(1 << (irq_nr - 8)); - break; - - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - ioc_icontrol->cmeimask0 &= ~(1 << (irq_nr - 16)); - break; - - default: - /* This way we'll see if anyone would ever want vectored - * level 3 interrupts. Highly unlikely. - */ - printk("Yeeee, got passed irq_nr %d at disable_irq\n", irq_nr); - panic("INVALID IRQ level!"); - }; + ioc_icontrol->imask0 |= (1 << (irq - SGINT_LOCAL0)); restore_flags(flags); } -void enable_local_irq(unsigned int irq_nr) +static unsigned int startup_local0_irq(unsigned int irq) +{ + enable_local0_irq(irq); + + return 0; /* Never anything pending */ +} + +static void disable_local0_irq(unsigned int irq) { unsigned long flags; + save_and_cli(flags); - switch(irq_nr) { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: - ioc_icontrol->imask0 |= (1 << irq_nr); - break; - - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: - ioc_icontrol->imask1 |= (1 << (irq_nr - 8)); - break; - - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - enable_local_irq(7); - ioc_icontrol->cmeimask0 |= (1 << (irq_nr - 16)); - break; - - default: - printk("Yeeee, got passed irq_nr %d at disable_irq\n", irq_nr); - panic("INVALID IRQ level!"); - }; + ioc_icontrol->imask0 &= ~(1 << (irq - SGINT_LOCAL0)); restore_flags(flags); } -void disable_gio_irq(unsigned int irq_nr) +#define shutdown_local0_irq disable_local0_irq +#define mask_and_ack_local0_irq disable_local0_irq + +static void end_local0_irq (unsigned int irq) { - /* XXX TODO XXX */ + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local0_irq(irq); } -void enable_gio_irq(unsigned int irq_nr) +static struct hw_interrupt_type ip22_local0_irq_type = { + "IP22 local 0", + startup_local0_irq, + shutdown_local0_irq, + enable_local0_irq, + disable_local0_irq, + mask_and_ack_local0_irq, + end_local0_irq, + NULL +}; + +static void enable_local1_irq(unsigned int irq) { - /* XXX TODO XXX */ + unsigned long flags; + + save_and_cli(flags); + ioc_icontrol->imask1 |= (1 << (irq - SGINT_LOCAL1)); + restore_flags(flags); } -void disable_hpcdma_irq(unsigned int irq_nr) +static unsigned int startup_local1_irq(unsigned int irq) { - /* XXX TODO XXX */ + enable_local1_irq(irq); + + return 0; /* Never anything pending */ } -void enable_hpcdma_irq(unsigned int irq_nr) +void disable_local1_irq(unsigned int irq) { - /* XXX TODO XXX */ + unsigned long flags; + + save_and_cli(flags); + ioc_icontrol->imask1 &= ~(1 << (irq- SGINT_LOCAL1)); + restore_flags(flags); } -void disable_irq(unsigned int irq_nr) +#define shutdown_local1_irq disable_local1_irq +#define mask_and_ack_local1_irq disable_local1_irq + +static void end_local1_irq (unsigned int irq) { - unsigned int n = irq_nr; - if(n >= SGINT_END) { - printk("whee, invalid irq_nr %d\n", irq_nr); - panic("IRQ, you lose..."); - } - if(n >= SGINT_LOCAL0 && n < SGINT_GIO) { - disable_local_irq(n - SGINT_LOCAL0); - } else if(n >= SGINT_GIO && n < SGINT_HPCDMA) { - disable_gio_irq(n - SGINT_GIO); - } else if(n >= SGINT_HPCDMA && n < SGINT_END) { - disable_hpcdma_irq(n - SGINT_HPCDMA); - } else { - panic("how did I get here?"); - } + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local1_irq(irq); } -void enable_irq(unsigned int irq_nr) +static struct hw_interrupt_type ip22_local1_irq_type = { + "IP22 local 1", + startup_local1_irq, + shutdown_local1_irq, + enable_local1_irq, + disable_local1_irq, + mask_and_ack_local1_irq, + end_local1_irq, + NULL +}; + +static void enable_local2_irq(unsigned int irq) { - unsigned int n = irq_nr; - if(n >= SGINT_END) { - printk("whee, invalid irq_nr %d\n", irq_nr); - panic("IRQ, you lose..."); - } - if(n >= SGINT_LOCAL0 && n < SGINT_GIO) { - enable_local_irq(n - SGINT_LOCAL0); - } else if(n >= SGINT_GIO && n < SGINT_HPCDMA) { - enable_gio_irq(n - SGINT_GIO); - } else if(n >= SGINT_HPCDMA && n < SGINT_END) { - enable_hpcdma_irq(n - SGINT_HPCDMA); - } else { - panic("how did I get here?"); - } + unsigned long flags; + + save_and_cli(flags); + enable_local0_irq(7); + ioc_icontrol->cmeimask0 |= (1 << (irq - SGINT_LOCAL2)); + restore_flags(flags); } -#if 0 -/* - * Currently unused. - */ -static void local_unex(int irq, void *data, struct pt_regs *regs) +static unsigned int startup_local2_irq(unsigned int irq) { - printk("Whee: unexpected local IRQ at %08lx\n", - (unsigned long) regs->cp0_epc); - printk("DUMP: stat0<%x> stat1<%x> vmeistat<%x>\n", - ioc_icontrol->istat0, ioc_icontrol->istat1, - ioc_icontrol->vmeistat); -} -#endif + enable_local2_irq(irq); -static struct irqaction *local_irq_action[24] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL -}; + return 0; /* Never anything pending */ +} -int setup_indy_irq(int irq, struct irqaction * new) +void disable_local2_irq(unsigned int irq) { - printk("setup_indy_irq: Yeee, don't know how to setup irq<%d> for %s %p\n", - irq, new->name, new->handler); - return 0; + unsigned long flags; + + save_and_cli(flags); + ioc_icontrol->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2)); + restore_flags(flags); } -static struct irqaction r4ktimer_action = { - NULL, 0, 0, "R4000 timer/counter", NULL, NULL, -}; +#define shutdown_local2_irq disable_local2_irq +#define mask_and_ack_local2_irq disable_local2_irq -static struct irqaction indy_berr_action = { - NULL, 0, 0, "IP22 Bus Error", NULL, NULL, -}; +static void end_local2_irq (unsigned int irq) +{ + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local2_irq(irq); +} -static struct irqaction *irq_action[16] = { - NULL, NULL, NULL, NULL, - NULL, NULL, &indy_berr_action, &r4ktimer_action, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL +static struct hw_interrupt_type ip22_local2_irq_type = { + "IP22 local 2", + startup_local2_irq, + shutdown_local2_irq, + enable_local2_irq, + disable_local2_irq, + mask_and_ack_local2_irq, + end_local2_irq, + NULL }; -int get_irq_list(char *buf) +static void enable_local3_irq(unsigned int irq) { - int i, len = 0; - int num = 0; - struct irqaction * action; - - for (i = 0 ; i < 16 ; i++, num++) { - action = irq_action[i]; - if (!action) - continue; - len += sprintf(buf+len, "%2d: %8d %c %s", - num, kstat.irqs[0][num], - (action->flags & SA_INTERRUPT) ? '+' : ' ', - action->name); - for (action=action->next; action; action = action->next) { - len += sprintf(buf+len, ",%s %s", - (action->flags & SA_INTERRUPT) ? " +" : "", - action->name); - } - len += sprintf(buf+len, " [on-chip]\n"); - } - for (i = 0 ; i < 24 ; i++, num++) { - action = local_irq_action[i]; - if (!action) - continue; - len += sprintf(buf+len, "%2d: %8d %c %s", - num, kstat.irqs[0][num], - (action->flags & SA_INTERRUPT) ? '+' : ' ', - action->name); - for (action=action->next; action; action = action->next) { - len += sprintf(buf+len, ",%s %s", - (action->flags & SA_INTERRUPT) ? " +" : "", - action->name); - } - len += sprintf(buf+len, " [local]\n"); - } - return len; + unsigned long flags; + + save_and_cli(flags); + printk("Yeeee, got passed irq_nr %d at enable_local3_irq\n", irq); + panic("INVALID IRQ level!"); + restore_flags(flags); } -/* - * do_IRQ handles IRQ's that have been installed without the - * SA_INTERRUPT flag: it uses the full signal-handling return - * and runs with other interrupts enabled. All relatively slow - * IRQ's should use this format: notably the keyboard/timer - * routines. - */ -asmlinkage void do_IRQ(int irq, struct pt_regs * regs) +static unsigned int startup_local3_irq(unsigned int irq) { - struct irqaction *action; - int do_random, cpu; + enable_local3_irq(irq); - cpu = smp_processor_id(); - irq_enter(cpu); - kstat.irqs[0][irq]++; + return 0; /* Never anything pending */ +} - printk("Got irq %d, press a key.", irq); - prom_getchar(); - romvec->imode(); +void disable_local3_irq(unsigned int irq) +{ + unsigned long flags; + save_and_cli(flags); /* - * mask and ack quickly, we don't want the irq controller - * thinking we're snobs just because some other CPU has - * disabled global interrupts (we have already done the - * INT_ACK cycles, it's too late to try to pretend to the - * controller that we aren't taking the interrupt). - * - * Commented out because we've already done this in the - * machinespecific part of the handler. It's reasonable to - * do this here in a highlevel language though because that way - * we could get rid of a good part of duplicated code ... + * This way we'll see if anyone would ever want vectored level 3 + * interrupts. Highly unlikely. */ - /* mask_and_ack_irq(irq); */ + printk("Yeeee, got passed irq_nr %d at disable_local3_irq\n", irq); + panic("INVALID IRQ level!"); + restore_flags(flags); +} - action = *(irq + irq_action); - if (action) { - if (!(action->flags & SA_INTERRUPT)) - __sti(); - action = *(irq + irq_action); - do_random = 0; - do { - do_random |= action->flags; - action->handler(irq, action->dev_id, regs); - action = action->next; - } while (action); - if (do_random & SA_SAMPLE_RANDOM) - add_interrupt_randomness(irq); - __cli(); - } - irq_exit(cpu); +#define shutdown_local3_irq disable_local3_irq +#define mask_and_ack_local3_irq disable_local3_irq - /* unmasking and bottom half handling is done magically for us. */ +static void end_local3_irq (unsigned int irq) +{ + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local3_irq(irq); } -int request_local_irq(unsigned int lirq, void (*func)(int, void *, struct pt_regs *), - unsigned long iflags, const char *dname, void *devid) +static struct hw_interrupt_type ip22_local3_irq_type = { + "IP22 local 3", + startup_local3_irq, + shutdown_local3_irq, + enable_local3_irq, + disable_local3_irq, + mask_and_ack_local3_irq, + end_local3_irq, + NULL +}; + +void enable_gio_irq(unsigned int irq) { - struct irqaction *action; + /* XXX TODO XXX */ +} - lirq -= SGINT_LOCAL0; - if(lirq >= 24 || !func) - return -EINVAL; +static unsigned int startup_gio_irq(unsigned int irq) +{ + enable_gio_irq(irq); - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); - if(!action) - return -ENOMEM; + return 0; /* Never anything pending */ +} - action->handler = func; - action->flags = iflags; - action->mask = 0; - action->name = dname; - action->dev_id = devid; - action->next = 0; - local_irq_action[lirq] = action; - enable_irq(lirq + SGINT_LOCAL0); - return 0; +void disable_gio_irq(unsigned int irq) +{ + /* XXX TODO XXX */ } -void free_local_irq(unsigned int lirq, void *dev_id) +#define shutdown_gio_irq disable_gio_irq +#define mask_and_ack_gio_irq disable_gio_irq + +static void end_gio_irq (unsigned int irq) { - struct irqaction *action; + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_gio_irq(irq); +} - lirq -= SGINT_LOCAL0; - if(lirq >= 24) { - printk("Aieee: trying to free bogus local irq %d\n", - lirq + SGINT_LOCAL0); - return; - } - action = local_irq_action[lirq]; - local_irq_action[lirq] = NULL; - disable_irq(lirq + SGINT_LOCAL0); - kfree(action); -} - -int request_irq(unsigned int irq, - void (*handler)(int, void *, struct pt_regs *), - unsigned long irqflags, - const char * devname, - void *dev_id) -{ - int retval; - struct irqaction * action; - - if (irq >= SGINT_END) - return -EINVAL; - if (!handler) - return -EINVAL; - - if((irq >= SGINT_LOCAL0) && (irq < SGINT_GIO)) - return request_local_irq(irq, handler, irqflags, devname, dev_id); - - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); - if (!action) - return -ENOMEM; - - action->handler = handler; - action->flags = irqflags; - action->mask = 0; - action->name = devname; - action->next = NULL; - action->dev_id = dev_id; - - retval = setup_indy_irq(irq, action); - - if (retval) - kfree(action); - return retval; +static struct hw_interrupt_type ip22_gio_irq_type = { + "IP22 GIO", + startup_gio_irq, + shutdown_gio_irq, + enable_gio_irq, + disable_gio_irq, + mask_and_ack_gio_irq, + end_gio_irq, + NULL +}; + +void enable_hpcdma_irq(unsigned int irq) +{ + /* XXX TODO XXX */ } - -void free_irq(unsigned int irq, void *dev_id) + +static unsigned int startup_hpcdma_irq(unsigned int irq) { - struct irqaction * action, **p; - unsigned long flags; + enable_hpcdma_irq(irq); - if (irq >= SGINT_END) { - printk("Trying to free IRQ%d\n",irq); - return; - } - if((irq >= SGINT_LOCAL0) && (irq < SGINT_GIO)) { - free_local_irq(irq, dev_id); - return; - } - for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) { - if (action->dev_id != dev_id) - continue; - - /* Found it - now free it */ - save_and_cli(flags); - *p = action->next; - restore_flags(flags); - kfree(action); - return; - } - printk("Trying to free free IRQ%d\n",irq); + return 0; /* Never anything pending */ } -int (*irq_cannonicalize)(int irq); - -static int indy_irq_cannonicalize(int irq) +void disable_hpcdma_irq(unsigned int irq) { - return irq; /* Sane hardware, sane code ... */ + /* XXX TODO XXX */ } -void __init init_IRQ(void) +#define shutdown_hpcdma_irq disable_hpcdma_irq +#define mask_and_ack_hpcdma_irq disable_hpcdma_irq + +static void end_hpcdma_irq (unsigned int irq) { - irq_cannonicalize = indy_irq_cannonicalize; - irq_setup(); + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_hpcdma_irq(irq); } +static struct hw_interrupt_type ip22_hpcdma_irq_type = { + "IP22 HPC DMA", + startup_hpcdma_irq, + shutdown_hpcdma_irq, + enable_hpcdma_irq, + disable_hpcdma_irq, + mask_and_ack_hpcdma_irq, + end_hpcdma_irq, + NULL +}; + +static struct irqaction r4ktimer_action = { + NULL, 0, 0, "R4000 timer/counter", NULL, NULL, +}; + +static struct irqaction indy_berr_action = { + NULL, 0, 0, "IP22 Bus Error", NULL, NULL, +}; + +static struct irqaction *irq_action[16] = { + NULL, NULL, NULL, NULL, + NULL, NULL, &indy_berr_action, &r4ktimer_action, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL +}; + void indy_local0_irqdispatch(struct pt_regs *regs) { - struct irqaction *action; unsigned char mask = ioc_icontrol->istat0; unsigned char mask2 = 0; - int irq, cpu = smp_processor_id();; + int irq; mask &= ioc_icontrol->imask0; - if(mask & ISTAT0_LIO2) { + if (mask & ISTAT0_LIO2) { mask2 = ioc_icontrol->vmeistat; mask2 &= ioc_icontrol->cmeimask0; irq = lc2msk_to_irqnr[mask2]; - action = local_irq_action[irq]; } else { irq = lc0msk_to_irqnr[mask]; - action = local_irq_action[irq]; } /* if irq == 0, then the interrupt has already been cleared */ - if ( irq == 0 ) { goto end; } - /* if action == NULL, then we do have a handler for the irq */ - if ( action == NULL ) { goto no_handler; } - - irq_enter(cpu); - kstat.irqs[0][irq + 16]++; - action->handler(irq, action->dev_id, regs); - irq_exit(cpu); + if (irq == 0) + goto end; + + do_IRQ(irq, regs); goto end; no_handler: printk("No handler for local0 irq: %i\n", irq); end: - return; - + return; } void indy_local1_irqdispatch(struct pt_regs *regs) { - struct irqaction *action; unsigned char mask = ioc_icontrol->istat1; unsigned char mask2 = 0; - int irq, cpu = smp_processor_id();; + int irq; mask &= ioc_icontrol->imask1; - if(mask & ISTAT1_LIO3) { + if (mask & ISTAT1_LIO3) { printk("WHee: Got an LIO3 irq, winging it...\n"); mask2 = ioc_icontrol->vmeistat; mask2 &= ioc_icontrol->cmeimask1; irq = lc3msk_to_irqnr[ioc_icontrol->vmeistat]; - action = local_irq_action[irq]; } else { irq = lc1msk_to_irqnr[mask]; - action = local_irq_action[irq]; } + /* if irq == 0, then the interrupt has already been cleared */ /* not sure if it is needed here, but it is needed for local0 */ - if ( irq == 0 ) { goto end; } - /* if action == NULL, then we do have a handler for the irq */ - if ( action == NULL ) { goto no_handler; } - - irq_enter(cpu); - kstat.irqs[0][irq + 24]++; - action->handler(irq, action->dev_id, regs); - irq_exit(cpu); + if (irq == 0) + goto end; + + do_IRQ(irq, regs); goto end; no_handler: @@ -520,27 +417,16 @@ int cpu = smp_processor_id(); int irq = 6; - irq_enter(cpu); + irq_enter(cpu, irq); kstat.irqs[0][irq]++; printk("Got a bus error IRQ, shouldn't happen yet\n"); show_regs(regs); printk("Spinning...\n"); while(1); - irq_exit(cpu); -} - -/* Misc. crap just to keep the kernel linking... */ -unsigned long probe_irq_on (void) -{ - return 0; + irq_exit(cpu, irq); } -int probe_irq_off (unsigned long irqs) -{ - return 0; -} - -void __init sgint_init(void) +void __init init_IRQ(void) { int i; @@ -548,43 +434,43 @@ sgi_i3regs = (struct sgi_int3_regs *) (KSEG1 + SGI_INT3_BASE); /* Init local mask --> irq tables. */ - for(i = 0; i < 256; i++) { - if(i & 0x80) { + for (i = 0; i < 256; i++) { + if (i & 0x80) { lc0msk_to_irqnr[i] = 7; lc1msk_to_irqnr[i] = 15; lc2msk_to_irqnr[i] = 23; lc3msk_to_irqnr[i] = 31; - } else if(i & 0x40) { + } else if (i & 0x40) { lc0msk_to_irqnr[i] = 6; lc1msk_to_irqnr[i] = 14; lc2msk_to_irqnr[i] = 22; lc3msk_to_irqnr[i] = 30; - } else if(i & 0x20) { + } else if (i & 0x20) { lc0msk_to_irqnr[i] = 5; lc1msk_to_irqnr[i] = 13; lc2msk_to_irqnr[i] = 21; lc3msk_to_irqnr[i] = 29; - } else if(i & 0x10) { + } else if (i & 0x10) { lc0msk_to_irqnr[i] = 4; lc1msk_to_irqnr[i] = 12; lc2msk_to_irqnr[i] = 20; lc3msk_to_irqnr[i] = 28; - } else if(i & 0x08) { + } else if (i & 0x08) { lc0msk_to_irqnr[i] = 3; lc1msk_to_irqnr[i] = 11; lc2msk_to_irqnr[i] = 19; lc3msk_to_irqnr[i] = 27; - } else if(i & 0x04) { + } else if (i & 0x04) { lc0msk_to_irqnr[i] = 2; lc1msk_to_irqnr[i] = 10; lc2msk_to_irqnr[i] = 18; lc3msk_to_irqnr[i] = 26; - } else if(i & 0x02) { + } else if (i & 0x02) { lc0msk_to_irqnr[i] = 1; lc1msk_to_irqnr[i] = 9; lc2msk_to_irqnr[i] = 17; lc3msk_to_irqnr[i] = 25; - } else if(i & 0x01) { + } else if (i & 0x01) { lc0msk_to_irqnr[i] = 0; lc1msk_to_irqnr[i] = 8; lc2msk_to_irqnr[i] = 16; @@ -614,6 +500,29 @@ ioc_icontrol->cmeimask0 = 0; ioc_icontrol->cmeimask1 = 0; - /* Now safe to set the exception vector. */ set_except_vector(0, indyIRQ); + + init_generic_irq(); + + for (i = SGINT_LOCAL0; i < SGINT_END; i++) { + hw_irq_controller *handler; + + if (i < SGINT_LOCAL1) + handler = &ip22_local0_irq_type; + else if (i < SGINT_LOCAL2) + handler = &ip22_local1_irq_type; + else if (i < SGINT_LOCAL3) + handler = &ip22_local2_irq_type; + else if (i < SGINT_GIO) + handler = &ip22_local3_irq_type; + else if (i < SGINT_HPCDMA) + handler = &ip22_gio_irq_type; + else if (i < SGINT_END) + handler = &ip22_hpcdma_irq_type; + + irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].action = 0; + irq_desc[i].depth = 1; + irq_desc[i].handler = handler; + } } Index: indy_mc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/indy_mc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: indy_rtc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/indy_rtc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- indy_rtc.c 14 Jan 2001 19:28:29 -0000 1.1.1.1 +++ indy_rtc.c 10 Apr 2002 14:38:10 -0000 1.2 @@ -1,12 +1,11 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * RTC routines for Indy style attached Dallas chip. * - * Copyright (C) 1998 by Ralf Baechle + * Copyright (C) 1998, 2001 by Ralf Baechle */ #include <linux/mc146818rtc.h> #include <asm/sgi/sgihpc.h> Index: indy_sc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/indy_sc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- indy_sc.c 14 Jan 2001 19:28:29 -0000 1.1.1.1 +++ indy_sc.c 10 Apr 2002 14:38:10 -0000 1.2 @@ -1,8 +1,7 @@ -/* $Id$ +/* + * indy_sc.c: Indy cache management functions. * - * indy_sc.c: Indy cache managment functions. - * - * Copyright (C) 1997 Ralf Baechle (ra...@gn...), + * Copyright (C) 1997, 2001 Ralf Baechle (ra...@gn...), * derived from r4xx0.c by David S. Miller (dm...@en...). */ #include <linux/init.h> @@ -34,30 +33,30 @@ { unsigned long tmp; - __asm__ __volatile__(" - .set noreorder - .set mips3 - .set noat - mfc0 %2, $12 - li $1, 0x80 # Go 64 bit - mtc0 $1, $12 - - dli $1, 0x9000000080000000 - or %0, $1 # first line to flush - or %1, $1 # last line to flush - .set at - -1: sw $0, 0(%0) - bne %0, %1, 1b - daddu %0, 32 - - mtc0 %2, $12 # Back to 32 bit - nop; nop; nop; nop; - .set mips0 - .set reorder" - : "=r" (first), "=r" (last), "=&r" (tmp) - : "0" (first), "1" (last) - : "$1"); + __asm__ __volatile__( + ".set\tnoreorder\t\t\t# indy_sc_wipe\n\t" + ".set\tmips3\n\t" + ".set\tnoat\n\t" + "mfc0\t%2, $12\n\t" + "li\t$1, 0x80\t\t\t# Go 64 bit\n\t" + "mtc0\t$1, $12\n\t" + + "dli\t$1, 0x9000000080000000\n\t" + "or\t%0, $1\t\t\t# first line to flush\n\t" + "or\t%1, $1\t\t\t# last line to flush\n\t" + ".set\tat\n\t" + + "1:\tsw\t$0, 0(%0)\n\t" + "bne\t%0, %1, 1b\n\t" + "daddu\t%0, 32\n\t" + + "mtc0\t%2, $12\t\t\t# Back to 32 bit\n\t" + "nop; nop; nop; nop;\n\t" + ".set\tmips0\n\t" + ".set\treorder" + : "=r" (first), "=r" (last), "=&r" (tmp) + : "0" (first), "1" (last) + : "$1"); } static void indy_sc_wback_invalidate(unsigned long addr, unsigned long size) @@ -96,27 +95,27 @@ #ifdef DEBUG_CACHE printk("Enabling R4600 SCACHE\n"); #endif - __asm__ __volatile__(" - .set push - .set noreorder - .set mips3 - mfc0 %2, $12 - nop; nop; nop; nop; - li %1, 0x80 - mtc0 %1, $12 - nop; nop; nop; nop; - li %0, 0x1 - dsll %0, 31 - lui %1, 0x9000 - dsll32 %1, 0 - or %0, %1, %0 - sb $0, 0(%0) - mtc0 $0, $12 - nop; nop; nop; nop; - mtc0 %2, $12 - nop; nop; nop; nop; - .set pop" - : "=r" (tmp1), "=r" (tmp2), "=r" (addr)); + __asm__ __volatile__( + ".set\tpush\n\t" + ".set\tnoreorder\n\t" + ".set\tmips3\n\t" + "mfc0\t%2, $12\n\t" + "nop; nop; nop; nop;\n\t" + "li\t%1, 0x80\n\t" + "mtc0\t%1, $12\n\t" + "nop; nop; nop; nop;\n\t" + "li\t%0, 0x1\n\t" + "dsll\t%0, 31\n\t" + "lui\t%1, 0x9000\n\t" + "dsll32\t%1, 0\n\t" + "or\t%0, %1, %0\n\t" + "sb\t$0, 0(%0)\n\t" + "mtc0\t$0, $12\n\t" + "nop; nop; nop; nop;\n\t" + "mtc0\t%2, $12\n\t" + "nop; nop; nop; nop;\n\t" + ".set\tpop" + : "=r" (tmp1), "=r" (tmp2), "=r" (addr)); } static void indy_sc_disable(void) @@ -126,27 +125,27 @@ #ifdef DEBUG_CACHE printk("Disabling R4600 SCACHE\n"); #endif - __asm__ __volatile__(" - .set push - .set noreorder - .set mips3 - li %0, 0x1 - dsll %0, 31 - lui %1, 0x9000 - dsll32 %1, 0 - or %0, %1, %0 - mfc0 %2, $12 - nop; nop; nop; nop; - li %1, 0x80 - mtc0 %1, $12 - nop; nop; nop; nop; - sh $0, 0(%0) - mtc0 $0, $12 - nop; nop; nop; nop; - mtc0 %2, $12 - nop; nop; nop; nop; - .set pop" - : "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)); + __asm__ __volatile__( + ".set\tpush\n\t" + ".set\tnoreorder\n\t" + ".set\tmips3\n\t" + "li\t%0, 0x1\n\t" + "dsll\t%0, 31\n\t" + "lui\t%1, 0x9000\n\t" + "dsll32\t%1, 0\n\t" + "or\t%0, %1, %0\n\t" + "mfc0\t%2, $12\n\t" + "nop; nop; nop; nop\n\t" + "li\t%1, 0x80\n\t" + "mtc0\t%1, $12\n\t" + "nop; nop; nop; nop\n\t" + "sh\t$0, 0(%0)\n\t" + "mtc0\t$0, $12\n\t" + "nop; nop; nop; nop\n\t" + "mtc0\t%2, $12\n\t" + "nop; nop; nop; nop\n\t" + ".set\tpop" + : "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)); } static inline int __init indy_sc_probe(void) Index: reset.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/reset.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- reset.c 14 Jan 2001 19:28:28 -0000 1.1.1.1 +++ reset.c 10 Apr 2002 14:38:10 -0000 1.2 @@ -1,12 +1,9 @@ -/* $Id$ - * - * Reset a SGI. - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 1997, 1998 by Ralf Baechle + * Copyright (C) 1997, 1998, 2001 by Ralf Baechle */ #include <linux/kernel.h> #include <linux/sched.h> @@ -54,7 +51,7 @@ { if (shuting_down) sgi_machine_power_off(); - prom_imode(); + ArcEnterInteractiveMode(); } static void sgi_machine_power_off(void) Index: setup.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/setup.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- setup.c 14 Jan 2001 19:28:27 -0000 1.1.1.1 +++ setup.c 10 Apr 2002 14:38:10 -0000 1.2 @@ -24,6 +24,7 @@ #include <asm/sgi/sgimc.h> #include <asm/sgi/sgihpc.h> #include <asm/sgi/sgint23.h> +#include <asm/time.h> #include <asm/gdb-stub.h> #ifdef CONFIG_REMOTE_DEBUG @@ -32,7 +33,7 @@ static int remote_debug = 0; #endif -#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SGI_PROM_CONSOLE) +#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_ARC_CONSOLE) extern void console_setup(char *); #endif @@ -117,28 +118,6 @@ sgi_read_status }; -static void __init sgi_irq_setup(void) -{ - sgint_init(); - -#ifdef CONFIG_REMOTE_DEBUG - if (remote_debug) - set_debug_traps(); - breakpoint(); /* you may move this line to whereever you want :-) */ -#endif -} - -int __init page_is_ram(unsigned long pagenr) -{ - if ((pagenr<<PAGE_SHIFT) < 0x2000UL) - return 1; - if ((pagenr<<PAGE_SHIFT) > 0x08002000) - return 1; - return 0; -} - -void (*board_time_init)(struct irqaction *irq); - static unsigned long dosample(volatile unsigned char *tcwp, volatile unsigned char *tc2p) { @@ -161,14 +140,16 @@ ct1 = read_32bit_cp0_register(CP0_COUNT); } while(msb); - /* Stop the counter. */ - *tcwp = (SGINT_TCWORD_CNT2 | SGINT_TCWORD_CALL | SGINT_TCWORD_MSWST); + /* Stop the counter. */ + *tcwp = (SGINT_TCWORD_CNT2 | SGINT_TCWORD_CALL | SGINT_TCWORD_MSWST); - /* Return the difference, this is how far the r4k counter increments - * for every 1/HZ seconds. We round off the the nearest 1 MHz of - * master clock (= 1000000 / 100 / 2 = 5000 count). - */ - return ((ct1 - ct0) / 5000) * 5000; + /* + * Return the difference, this is how far the r4k counter increments + * for every 1/HZ seconds. We round off the nearest 1 MHz of master + * clock (= 1000000 / 100 / 2 = 5000 count). + */ + + return ((ct1 - ct0) / 5000) * 5000; } #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) @@ -180,7 +161,7 @@ */ struct sgi_ioc_timers *p; volatile unsigned char *tcwp, *tc2p; - unsigned long r4k_ticks[3] = { 0, 0, 0 }; + unsigned long r4k_ticks[3]; unsigned long r4k_next; /* Figure out the r4k offset, the algorithm is very simple @@ -201,10 +182,12 @@ dosample(tcwp, tc2p); /* Prime cache. */ dosample(tcwp, tc2p); /* Prime cache. */ /* Zero is NOT an option. */ - while (!r4k_ticks[0]) + do { r4k_ticks[0] = dosample (tcwp, tc2p); - while (!r4k_ticks[1]) + } while (!r4k_ticks[0]); + do { r4k_ticks[1] = dosample (tcwp, tc2p); + } while (!r4k_ticks[1]); if (r4k_ticks[0] != r4k_ticks[1]) { printk ("warning: timer counts differ, retrying..."); @@ -226,7 +209,7 @@ /* Set ourselves up for future interrupts */ r4k_next = (read_32bit_cp0_register(CP0_COUNT) + r4k_interval); write_32bit_cp0_register(CP0_COMPARE, r4k_next); - set_cp0_status(ST0_IM, ALLINTS); + change_cp0_status(ST0_IM, ALLINTS); sti (); } @@ -239,8 +222,6 @@ char *kgdb_ttyd; #endif - - irq_setup = sgi_irq_setup; board_time_init = sgi_time_init; /* Init the INDY HPC I/O controller. Need to call this before @@ -282,7 +263,7 @@ line ? 1 : 2); rs_kgdb_hook(line); - prom_printf("KGDB: Using serial line /dev/ttyd%d for session, " + printk("KGDB: Using serial line /dev/ttyd%d for session, " "please connect your debugger\n", line ? 1 : 2); remote_debug = 1; @@ -290,7 +271,7 @@ } #endif -#ifdef CONFIG_SGI_PROM_CONSOLE +#ifdef CONFIG_ARC_CONSOLE console_setup("ttyS0"); #endif @@ -324,5 +305,4 @@ #ifdef CONFIG_VIDEO_VINO init_vino(); #endif - } Index: system.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/system.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: time.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/sgi/kernel/time.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- time.c 14 Jan 2001 19:28:28 -0000 1.1.1.1 +++ time.c 10 Apr 2002 14:38:10 -0000 1.2 @@ -9,13 +9,13 @@ void indy_8254timer_irq(void) { - int cpu = smp_processor_id(); - int irq = 4; + int cpu = smp_processor_id(); + int irq = 4; - irq_enter(cpu); - kstat.irqs[0][irq]++; - printk("indy_8254timer_irq: Whoops, should not have gotten this IRQ\n"); - prom_getchar(); - prom_imode(); - irq_exit(cpu); + irq_enter(cpu, irq); + kstat.irqs[0][irq]++; + printk("indy_8254timer_irq: Whoops, should not have gotten this IRQ\n"); + prom_getchar(); + ArcEnterInteractiveMode(); + irq_exit(cpu, irq); } --- indy_timer.c DELETED --- --- promcon.c DELETED --- |