diff options
Diffstat (limited to '')
123 files changed, 2347 insertions, 3593 deletions
diff --git a/arch/m68k/amiga/amiga_ksyms.c b/arch/m68k/amiga/amiga_ksyms.c index b7bd84c73ea7..7fdcf6bf3ada 100644 --- a/arch/m68k/amiga/amiga_ksyms.c +++ b/arch/m68k/amiga/amiga_ksyms.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <asm/ptrace.h> @@ -23,8 +22,6 @@ EXPORT_SYMBOL(amiga_chip_avail); EXPORT_SYMBOL(amiga_chip_size); EXPORT_SYMBOL(amiga_audio_period); EXPORT_SYMBOL(amiga_audio_min_period); -EXPORT_SYMBOL(amiga_do_irq); -EXPORT_SYMBOL(amiga_do_irq_list); #ifdef CONFIG_AMIGA_PCMCIA EXPORT_SYMBOL(pcmcia_reset); diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c index b0aa61bf8700..96c79d840cff 100644 --- a/arch/m68k/amiga/amiints.c +++ b/arch/m68k/amiga/amiints.c @@ -22,7 +22,7 @@ * * 07/08/99: rewamp of the interrupt handling - we now have two types of * interrupts, normal and fast handlers, fast handlers being - * marked with SA_INTERRUPT and runs with all other interrupts + * marked with IRQF_DISABLED and runs with all other interrupts * disabled. Normal interrupts disable their own source but * run with all other interrupt sources enabled. * PORTS and EXTER interrupts are always shared even if the @@ -35,61 +35,30 @@ * /Jes */ -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/sched.h> -#include <linux/kernel_stat.h> #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/errno.h> -#include <linux/seq_file.h> -#include <asm/system.h> #include <asm/irq.h> #include <asm/traps.h> #include <asm/amigahw.h> #include <asm/amigaints.h> #include <asm/amipcmcia.h> -extern int cia_request_irq(struct ciabase *base,int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id); -extern void cia_free_irq(struct ciabase *base, unsigned int irq, void *dev_id); -extern void cia_init_IRQ(struct ciabase *base); -extern int cia_get_irq_list(struct ciabase *base, struct seq_file *p); - -/* irq node variables for amiga interrupt sources */ -static irq_node_t *ami_irq_list[AMI_STD_IRQS]; - -static unsigned short amiga_intena_vals[AMI_STD_IRQS] = { - [IRQ_AMIGA_VERTB] = IF_VERTB, - [IRQ_AMIGA_COPPER] = IF_COPER, - [IRQ_AMIGA_AUD0] = IF_AUD0, - [IRQ_AMIGA_AUD1] = IF_AUD1, - [IRQ_AMIGA_AUD2] = IF_AUD2, - [IRQ_AMIGA_AUD3] = IF_AUD3, - [IRQ_AMIGA_BLIT] = IF_BLIT, - [IRQ_AMIGA_DSKSYN] = IF_DSKSYN, - [IRQ_AMIGA_DSKBLK] = IF_DSKBLK, - [IRQ_AMIGA_RBF] = IF_RBF, - [IRQ_AMIGA_TBE] = IF_TBE, - [IRQ_AMIGA_SOFT] = IF_SOFT, - [IRQ_AMIGA_PORTS] = IF_PORTS, - [IRQ_AMIGA_EXTER] = IF_EXTER -}; -static const unsigned char ami_servers[AMI_STD_IRQS] = { - [IRQ_AMIGA_VERTB] = 1, - [IRQ_AMIGA_PORTS] = 1, - [IRQ_AMIGA_EXTER] = 1 +static void amiga_enable_irq(unsigned int irq); +static void amiga_disable_irq(unsigned int irq); +static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp); +static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp); +static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp); +static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp); + +static struct irq_controller amiga_irq_controller = { + .name = "amiga", + .lock = SPIN_LOCK_UNLOCKED, + .enable = amiga_enable_irq, + .disable = amiga_disable_irq, }; -static short ami_ablecount[AMI_IRQS]; - -static irqreturn_t ami_badint(int irq, void *dev_id, struct pt_regs *fp) -{ - num_spurious += 1; - return IRQ_NONE; -} - /* * void amiga_init_IRQ(void) * @@ -103,23 +72,12 @@ static irqreturn_t ami_badint(int irq, void *dev_id, struct pt_regs *fp) void __init amiga_init_IRQ(void) { - int i; + request_irq(IRQ_AUTO_1, ami_int1, 0, "int1", NULL); + request_irq(IRQ_AUTO_3, ami_int3, 0, "int3", NULL); + request_irq(IRQ_AUTO_4, ami_int4, 0, "int4", NULL); + request_irq(IRQ_AUTO_5, ami_int5, 0, "int5", NULL); - /* initialize handlers */ - for (i = 0; i < AMI_STD_IRQS; i++) { - if (ami_servers[i]) { - ami_irq_list[i] = NULL; - } else { - ami_irq_list[i] = new_irq_node(); - ami_irq_list[i]->handler = ami_badint; - ami_irq_list[i]->flags = 0; - ami_irq_list[i]->dev_id = NULL; - ami_irq_list[i]->devname = NULL; - ami_irq_list[i]->next = NULL; - } - } - for (i = 0; i < AMI_IRQS; i++) - ami_ablecount[i] = 0; + m68k_setup_irq_controller(&amiga_irq_controller, IRQ_USER, AMI_STD_IRQS); /* turn off PCMCIA interrupts */ if (AMIGAHW_PRESENT(PCMCIA)) @@ -134,249 +92,21 @@ void __init amiga_init_IRQ(void) cia_init_IRQ(&ciab_base); } -static inline int amiga_insert_irq(irq_node_t **list, irq_node_t *node) -{ - unsigned long flags; - irq_node_t *cur; - - if (!node->dev_id) - printk("%s: Warning: dev_id of %s is zero\n", - __FUNCTION__, node->devname); - - local_irq_save(flags); - - cur = *list; - - if (node->flags & SA_INTERRUPT) { - if (node->flags & SA_SHIRQ) - return -EBUSY; - /* - * There should never be more than one - */ - while (cur && cur->flags & SA_INTERRUPT) { - list = &cur->next; - cur = cur->next; - } - } else { - while (cur) { - list = &cur->next; - cur = cur->next; - } - } - - node->next = cur; - *list = node; - - local_irq_restore(flags); - return 0; -} - -static inline void amiga_delete_irq(irq_node_t **list, void *dev_id) -{ - unsigned long flags; - irq_node_t *node; - - local_irq_save(flags); - - for (node = *list; node; list = &node->next, node = *list) { - if (node->dev_id == dev_id) { - *list = node->next; - /* Mark it as free. */ - node->handler = NULL; - local_irq_restore(flags); - return; - } - } - local_irq_restore(flags); - printk ("%s: tried to remove invalid irq\n", __FUNCTION__); -} - -/* - * amiga_request_irq : add an interrupt service routine for a particular - * machine specific interrupt source. - * If the addition was successful, it returns 0. - */ - -int amiga_request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - irq_node_t *node; - int error = 0; - - if (irq >= AMI_IRQS) { - printk ("%s: Unknown IRQ %d from %s\n", __FUNCTION__, - irq, devname); - return -ENXIO; - } - - if (irq >= IRQ_AMIGA_AUTO) - return cpu_request_irq(irq - IRQ_AMIGA_AUTO, handler, - flags, devname, dev_id); - - if (irq >= IRQ_AMIGA_CIAB) - return cia_request_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, - handler, flags, devname, dev_id); - - if (irq >= IRQ_AMIGA_CIAA) - return cia_request_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA, - handler, flags, devname, dev_id); - - /* - * IRQ_AMIGA_PORTS & IRQ_AMIGA_EXTER defaults to shared, - * we could add a check here for the SA_SHIRQ flag but all drivers - * should be aware of sharing anyway. - */ - if (ami_servers[irq]) { - if (!(node = new_irq_node())) - return -ENOMEM; - node->handler = handler; - node->flags = flags; - node->dev_id = dev_id; - node->devname = devname; - node->next = NULL; - error = amiga_insert_irq(&ami_irq_list[irq], node); - } else { - ami_irq_list[irq]->handler = handler; - ami_irq_list[irq]->flags = flags; - ami_irq_list[irq]->dev_id = dev_id; - ami_irq_list[irq]->devname = devname; - } - - /* enable the interrupt */ - if (irq < IRQ_AMIGA_PORTS && !ami_ablecount[irq]) - amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq]; - - return error; -} - -void amiga_free_irq(unsigned int irq, void *dev_id) -{ - if (irq >= AMI_IRQS) { - printk ("%s: Unknown IRQ %d\n", __FUNCTION__, irq); - return; - } - - if (irq >= IRQ_AMIGA_AUTO) - cpu_free_irq(irq - IRQ_AMIGA_AUTO, dev_id); - - if (irq >= IRQ_AMIGA_CIAB) { - cia_free_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, dev_id); - return; - } - - if (irq >= IRQ_AMIGA_CIAA) { - cia_free_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA, dev_id); - return; - } - - if (ami_servers[irq]) { - amiga_delete_irq(&ami_irq_list[irq], dev_id); - /* if server list empty, disable the interrupt */ - if (!ami_irq_list[irq] && irq < IRQ_AMIGA_PORTS) - amiga_custom.intena = amiga_intena_vals[irq]; - } else { - if (ami_irq_list[irq]->dev_id != dev_id) - printk("%s: removing probably wrong IRQ %d from %s\n", - __FUNCTION__, irq, ami_irq_list[irq]->devname); - ami_irq_list[irq]->handler = ami_badint; - ami_irq_list[irq]->flags = 0; - ami_irq_list[irq]->dev_id = NULL; - ami_irq_list[irq]->devname = NULL; - amiga_custom.intena = amiga_intena_vals[irq]; - } -} - /* * Enable/disable a particular machine specific interrupt source. * Note that this may affect other interrupts in case of a shared interrupt. * This function should only be called for a _very_ short time to change some * internal data, that may not be changed by the interrupt at the same time. - * ami_(enable|disable)_irq calls may also be nested. */ -void amiga_enable_irq(unsigned int irq) -{ - if (irq >= AMI_IRQS) { - printk("%s: Unknown IRQ %d\n", __FUNCTION__, irq); - return; - } - - if (--ami_ablecount[irq]) - return; - - /* No action for auto-vector interrupts */ - if (irq >= IRQ_AMIGA_AUTO){ - printk("%s: Trying to enable auto-vector IRQ %i\n", - __FUNCTION__, irq - IRQ_AMIGA_AUTO); - return; - } - - if (irq >= IRQ_AMIGA_CIAB) { - cia_set_irq(&ciab_base, (1 << (irq - IRQ_AMIGA_CIAB))); - cia_able_irq(&ciab_base, CIA_ICR_SETCLR | - (1 << (irq - IRQ_AMIGA_CIAB))); - return; - } - - if (irq >= IRQ_AMIGA_CIAA) { - cia_set_irq(&ciaa_base, (1 << (irq - IRQ_AMIGA_CIAA))); - cia_able_irq(&ciaa_base, CIA_ICR_SETCLR | - (1 << (irq - IRQ_AMIGA_CIAA))); - return; - } - - /* enable the interrupt */ - amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq]; -} - -void amiga_disable_irq(unsigned int irq) -{ - if (irq >= AMI_IRQS) { - printk("%s: Unknown IRQ %d\n", __FUNCTION__, irq); - return; - } - - if (ami_ablecount[irq]++) - return; - - /* No action for auto-vector interrupts */ - if (irq >= IRQ_AMIGA_AUTO) { - printk("%s: Trying to disable auto-vector IRQ %i\n", - __FUNCTION__, irq - IRQ_AMIGA_AUTO); - return; - } - - if (irq >= IRQ_AMIGA_CIAB) { - cia_able_irq(&ciab_base, 1 << (irq - IRQ_AMIGA_CIAB)); - return; - } - - if (irq >= IRQ_AMIGA_CIAA) { - cia_able_irq(&ciaa_base, 1 << (irq - IRQ_AMIGA_CIAA)); - return; - } - - /* disable the interrupt */ - amiga_custom.intena = amiga_intena_vals[irq]; -} - -inline void amiga_do_irq(int irq, struct pt_regs *fp) +static void amiga_enable_irq(unsigned int irq) { - kstat_cpu(0).irqs[SYS_IRQS + irq]++; - ami_irq_list[irq]->handler(irq, ami_irq_list[irq]->dev_id, fp); + amiga_custom.intena = IF_SETCLR | (1 << (irq - IRQ_USER)); } -void amiga_do_irq_list(int irq, struct pt_regs *fp) +static void amiga_disable_irq(unsigned int irq) { - irq_node_t *node; - - kstat_cpu(0).irqs[SYS_IRQS + irq]++; - - amiga_custom.intreq = amiga_intena_vals[irq]; - - for (node = ami_irq_list[irq]; node; node = node->next) - node->handler(irq, node->dev_id, fp); + amiga_custom.intena = 1 << (irq - IRQ_USER); } /* @@ -390,19 +120,19 @@ static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp) /* if serial transmit buffer empty, interrupt */ if (ints & IF_TBE) { amiga_custom.intreq = IF_TBE; - amiga_do_irq(IRQ_AMIGA_TBE, fp); + m68k_handle_int(IRQ_AMIGA_TBE, fp); } /* if floppy disk transfer complete, interrupt */ if (ints & IF_DSKBLK) { amiga_custom.intreq = IF_DSKBLK; - amiga_do_irq(IRQ_AMIGA_DSKBLK, fp); + m68k_handle_int(IRQ_AMIGA_DSKBLK, fp); } /* if software interrupt set, interrupt */ if (ints & IF_SOFT) { amiga_custom.intreq = IF_SOFT; - amiga_do_irq(IRQ_AMIGA_SOFT, fp); + m68k_handle_int(IRQ_AMIGA_SOFT, fp); } return IRQ_HANDLED; } @@ -414,18 +144,20 @@ static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp) /* if a blitter interrupt */ if (ints & IF_BLIT) { amiga_custom.intreq = IF_BLIT; - amiga_do_irq(IRQ_AMIGA_BLIT, fp); + m68k_handle_int(IRQ_AMIGA_BLIT, fp); } /* if a copper interrupt */ if (ints & IF_COPER) { amiga_custom.intreq = IF_COPER; - amiga_do_irq(IRQ_AMIGA_COPPER, fp); + m68k_handle_int(IRQ_AMIGA_COPPER, fp); } /* if a vertical blank interrupt */ - if (ints & IF_VERTB) - amiga_do_irq_list(IRQ_AMIGA_VERTB, fp); + if (ints & IF_VERTB) { + amiga_custom.intreq = IF_VERTB; + m68k_handle_int(IRQ_AMIGA_VERTB, fp); + } return IRQ_HANDLED; } @@ -436,25 +168,25 @@ static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp) /* if audio 0 interrupt */ if (ints & IF_AUD0) { amiga_custom.intreq = IF_AUD0; - amiga_do_irq(IRQ_AMIGA_AUD0, fp); + m68k_handle_int(IRQ_AMIGA_AUD0, fp); } /* if audio 1 interrupt */ if (ints & IF_AUD1) { amiga_custom.intreq = IF_AUD1; - amiga_do_irq(IRQ_AMIGA_AUD1, fp); + m68k_handle_int(IRQ_AMIGA_AUD1, fp); } /* if audio 2 interrupt */ if (ints & IF_AUD2) { amiga_custom.intreq = IF_AUD2; - amiga_do_irq(IRQ_AMIGA_AUD2, fp); + m68k_handle_int(IRQ_AMIGA_AUD2, fp); } /* if audio 3 interrupt */ if (ints & IF_AUD3) { amiga_custom.intreq = IF_AUD3; - amiga_do_irq(IRQ_AMIGA_AUD3, fp); + m68k_handle_int(IRQ_AMIGA_AUD3, fp); } return IRQ_HANDLED; } @@ -466,55 +198,13 @@ static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp) /* if serial receive buffer full interrupt */ if (ints & IF_RBF) { /* acknowledge of IF_RBF must be done by the serial interrupt */ - amiga_do_irq(IRQ_AMIGA_RBF, fp); + m68k_handle_int(IRQ_AMIGA_RBF, fp); } /* if a disk sync interrupt */ if (ints & IF_DSKSYN) { amiga_custom.intreq = IF_DSKSYN; - amiga_do_irq(IRQ_AMIGA_DSKSYN, fp); + m68k_handle_int(IRQ_AMIGA_DSKSYN, fp); } return IRQ_HANDLED; } - -static irqreturn_t ami_int7(int irq, void *dev_id, struct pt_regs *fp) -{ - panic ("level 7 interrupt received\n"); -} - -irqreturn_t (*amiga_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { - [0] = ami_badint, - [1] = ami_int1, - [2] = ami_badint, - [3] = ami_int3, - [4] = ami_int4, - [5] = ami_int5, - [6] = ami_badint, - [7] = ami_int7 -}; - -int show_amiga_interrupts(struct seq_file *p, void *v) -{ - int i; - irq_node_t *node; - - for (i = 0; i < AMI_STD_IRQS; i++) { - if (!(node = ami_irq_list[i])) - continue; - seq_printf(p, "ami %2d: %10u ", i, - kstat_cpu(0).irqs[SYS_IRQS + i]); - do { - if (node->flags & SA_INTERRUPT) - seq_puts(p, "F "); - else - seq_puts(p, " "); - seq_printf(p, "%s\n", node->devname); - if ((node = node->next)) - seq_puts(p, " "); - } while (node); - } - - cia_get_irq_list(&ciaa_base, p); - cia_get_irq_list(&ciab_base, p); - return 0; -} diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c index ae94db5d93b2..1f5bfb584297 100644 --- a/arch/m68k/amiga/amisound.c +++ b/arch/m68k/amiga/amisound.c @@ -8,7 +8,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/jiffies.h> #include <linux/timer.h> #include <linux/init.h> diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c index 558d5fd2d2ba..de1304c91112 100644 --- a/arch/m68k/amiga/chipram.c +++ b/arch/m68k/amiga/chipram.c @@ -7,7 +7,6 @@ ** Rewritten 15/9/2000 by Geert to use resource management */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c index 9476eb9440f5..dbad30054721 100644 --- a/arch/m68k/amiga/cia.c +++ b/arch/m68k/amiga/cia.c @@ -29,21 +29,18 @@ struct ciabase { unsigned short int_mask; int handler_irq, cia_irq, server_irq; char *name; - irq_handler_t irq_list[CIA_IRQS]; } ciaa_base = { .cia = &ciaa, .int_mask = IF_PORTS, - .handler_irq = IRQ_AMIGA_AUTO_2, + .handler_irq = IRQ_AMIGA_PORTS, .cia_irq = IRQ_AMIGA_CIAA, - .server_irq = IRQ_AMIGA_PORTS, - .name = "CIAA handler" + .name = "CIAA" }, ciab_base = { .cia = &ciab, .int_mask = IF_EXTER, - .handler_irq = IRQ_AMIGA_AUTO_6, + .handler_irq = IRQ_AMIGA_EXTER, .cia_irq = IRQ_AMIGA_CIAB, - .server_irq = IRQ_AMIGA_EXTER, - .name = "CIAB handler" + .name = "CIAB" }; /* @@ -66,13 +63,11 @@ unsigned char cia_set_irq(struct ciabase *base, unsigned char mask) /* * Enable or disable CIA interrupts, return old interrupt mask, - * interrupts will only be enabled if a handler exists */ unsigned char cia_able_irq(struct ciabase *base, unsigned char mask) { - unsigned char old, tmp; - int i; + unsigned char old; old = base->icr_mask; base->icr_data |= base->cia->icr; @@ -82,99 +77,104 @@ unsigned char cia_able_irq(struct ciabase *base, unsigned char mask) else base->icr_mask &= ~mask; base->icr_mask &= CIA_ICR_ALL; - for (i = 0, tmp = 1; i < CIA_IRQS; i++, tmp <<= 1) { - if ((tmp & base->icr_mask) && !base->irq_list[i].handler) { - base->icr_mask &= ~tmp; - base->cia->icr = tmp; - } - } if (base->icr_data & base->icr_mask) amiga_custom.intreq = IF_SETCLR | base->int_mask; return old; } -int cia_request_irq(struct ciabase *base, unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - unsigned char mask; - - base->irq_list[irq].handler = handler; - base->irq_list[irq].flags = flags; - base->irq_list[irq].dev_id = dev_id; - base->irq_list[irq].devname = devname; - - /* enable the interrupt */ - mask = 1 << irq; - cia_set_irq(base, mask); - cia_able_irq(base, CIA_ICR_SETCLR | mask); - return 0; -} - -void cia_free_irq(struct ciabase *base, unsigned int irq, void *dev_id) -{ - if (base->irq_list[irq].dev_id != dev_id) - printk("%s: removing probably wrong IRQ %i from %s\n", - __FUNCTION__, base->cia_irq + irq, - base->irq_list[irq].devname); - - base->irq_list[irq].handler = NULL; - base->irq_list[irq].flags = 0; - - cia_able_irq(base, 1 << irq); -} - static irqreturn_t cia_handler(int irq, void *dev_id, struct pt_regs *fp) { struct ciabase *base = (struct ciabase *)dev_id; - int mach_irq, i; + int mach_irq; unsigned char ints; mach_irq = base->cia_irq; - irq = SYS_IRQS + mach_irq; ints = cia_set_irq(base, CIA_ICR_ALL); amiga_custom.intreq = base->int_mask; - for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) { - if (ints & 1) { - kstat_cpu(0).irqs[irq]++; - base->irq_list[i].handler(mach_irq, base->irq_list[i].dev_id, fp); - } - ints >>= 1; + for (; ints; mach_irq++, ints >>= 1) { + if (ints & 1) + m68k_handle_int(mach_irq, fp); } - amiga_do_irq_list(base->server_irq, fp); return IRQ_HANDLED; } -void __init cia_init_IRQ(struct ciabase *base) +static void cia_enable_irq(unsigned int irq) { - int i; + unsigned char mask; - /* init isr handlers */ - for (i = 0; i < CIA_IRQS; i++) { - base->irq_list[i].handler = NULL; - base->irq_list[i].flags = 0; + if (irq >= IRQ_AMIGA_CIAB) { + mask = 1 << (irq - IRQ_AMIGA_CIAB); + cia_set_irq(&ciab_base, mask); + cia_able_irq(&ciab_base, CIA_ICR_SETCLR | mask); + } else { + mask = 1 << (irq - IRQ_AMIGA_CIAA); + cia_set_irq(&ciaa_base, mask); + cia_able_irq(&ciaa_base, CIA_ICR_SETCLR | mask); } +} - /* clear any pending interrupt and turn off all interrupts */ - cia_set_irq(base, CIA_ICR_ALL); - cia_able_irq(base, CIA_ICR_ALL); +static void cia_disable_irq(unsigned int irq) +{ + if (irq >= IRQ_AMIGA_CIAB) + cia_able_irq(&ciab_base, 1 << (irq - IRQ_AMIGA_CIAB)); + else + cia_able_irq(&ciaa_base, 1 << (irq - IRQ_AMIGA_CIAA)); +} - /* install CIA handler */ - request_irq(base->handler_irq, cia_handler, 0, base->name, base); +static struct irq_controller cia_irq_controller = { + .name = "cia", + .lock = SPIN_LOCK_UNLOCKED, + .enable = cia_enable_irq, + .disable = cia_disable_irq, +}; + +/* + * Override auto irq 2 & 6 and use them as general chain + * for external interrupts, we link the CIA interrupt sources + * into this chain. + */ - amiga_custom.intena = IF_SETCLR | base->int_mask; +static void auto_enable_irq(unsigned int irq) +{ + switch (irq) { + case IRQ_AUTO_2: + amiga_custom.intena = IF_SETCLR | IF_PORTS; + break; + case IRQ_AUTO_6: + amiga_custom.intena = IF_SETCLR | IF_EXTER; + break; + } } -int cia_get_irq_list(struct ciabase *base, struct seq_file *p) +static void auto_disable_irq(unsigned int irq) { - int i, j; - - j = base->cia_irq; - for (i = 0; i < CIA_IRQS; i++) { - seq_printf(p, "cia %2d: %10d ", j + i, - kstat_cpu(0).irqs[SYS_IRQS + j + i]); - seq_puts(p, " "); - seq_printf(p, "%s\n", base->irq_list[i].devname); + switch (irq) { + case IRQ_AUTO_2: + amiga_custom.intena = IF_PORTS; + break; + case IRQ_AUTO_6: + amiga_custom.intena = IF_EXTER; + break; } - return 0; +} + +static struct irq_controller auto_irq_controller = { + .name = "auto", + .lock = SPIN_LOCK_UNLOCKED, + .enable = auto_enable_irq, + .disable = auto_disable_irq, +}; + +void __init cia_init_IRQ(struct ciabase *base) +{ + m68k_setup_irq_controller(&cia_irq_controller, base->cia_irq, CIA_IRQS); + + /* clear any pending interrupt and turn off all interrupts */ + cia_set_irq(base, CIA_ICR_ALL); + cia_able_irq(base, CIA_ICR_ALL); + + /* override auto int and install CIA handler */ + m68k_setup_irq_controller(&auto_irq_controller, base->handler_irq, 1); + m68k_irq_startup(base->handler_irq); + request_irq(base->handler_irq, cia_handler, IRQF_SHARED, base->name, base); } diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c index 12e3706fe02c..092e50d2cb13 100644 --- a/arch/m68k/amiga/config.c +++ b/arch/m68k/amiga/config.c @@ -12,7 +12,6 @@ * Miscellaneous Amiga stuff */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -87,17 +86,8 @@ extern char m68k_debug_device[]; static void amiga_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); /* amiga specific irq functions */ extern void amiga_init_IRQ (void); -extern irqreturn_t (*amiga_default_handler[]) (int, void *, struct pt_regs *); -extern int amiga_request_irq (unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, - void *dev_id); -extern void amiga_free_irq (unsigned int irq, void *dev_id); -extern void amiga_enable_irq (unsigned int); -extern void amiga_disable_irq (unsigned int); static void amiga_get_model(char *model); static int amiga_get_hardware_list(char *buffer); -extern int show_amiga_interrupts (struct seq_file *, void *); /* amiga specific timer functions */ static unsigned long amiga_gettimeoffset (void); static int a3000_hwclk (int, struct rtc_time *); @@ -392,14 +382,8 @@ void __init config_amiga(void) mach_sched_init = amiga_sched_init; mach_init_IRQ = amiga_init_IRQ; - mach_default_handler = &amiga_default_handler; - mach_request_irq = amiga_request_irq; - mach_free_irq = amiga_free_irq; - enable_irq = amiga_enable_irq; - disable_irq = amiga_disable_irq; mach_get_model = amiga_get_model; mach_get_hardware_list = amiga_get_hardware_list; - mach_get_irq_list = show_amiga_interrupts; mach_gettimeoffset = amiga_gettimeoffset; if (AMIGAHW_PRESENT(A3000_CLK)){ mach_hwclk = a3000_hwclk; diff --git a/arch/m68k/apollo/Makefile b/arch/m68k/apollo/Makefile index 39264f3b6ad6..76a057962c38 100644 --- a/arch/m68k/apollo/Makefile +++ b/arch/m68k/apollo/Makefile @@ -2,4 +2,4 @@ # Makefile for Linux arch/m68k/amiga source directory # -obj-y := config.o dn_ints.o dma.o +obj-y := config.o dn_ints.o diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c index d401962d9b25..6f4581575fb4 100644 --- a/arch/m68k/apollo/config.c +++ b/arch/m68k/apollo/config.c @@ -1,4 +1,3 @@ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -28,11 +27,6 @@ u_long apollo_model; extern void dn_sched_init(irqreturn_t (*handler)(int,void *,struct pt_regs *)); extern void dn_init_IRQ(void); -extern int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id); -extern void dn_free_irq(unsigned int irq, void *dev_id); -extern void dn_enable_irq(unsigned int); -extern void dn_disable_irq(unsigned int); -extern int show_dn_interrupts(struct seq_file *, void *); extern unsigned long dn_gettimeoffset(void); extern int dn_dummy_hwclk(int, struct rtc_time *); extern int dn_dummy_set_clock_mmss(unsigned long); @@ -40,13 +34,11 @@ extern void dn_dummy_reset(void); extern void dn_dummy_waitbut(void); extern struct fb_info *dn_fb_init(long *); extern void dn_dummy_debug_init(void); -extern void dn_dummy_video_setup(char *,int *); extern irqreturn_t dn_process_int(int irq, struct pt_regs *fp); #ifdef CONFIG_HEARTBEAT static void dn_heartbeat(int on); #endif static irqreturn_t dn_timer_int(int irq,void *, struct pt_regs *); -static irqreturn_t (*sched_timer_handler)(int, void *, struct pt_regs *)=NULL; static void dn_get_model(char *model); static const char *apollo_models[] = { [APOLLO_DN3000-APOLLO_DN3000] = "DN3000 (Otter)", @@ -164,17 +156,10 @@ void config_apollo(void) { mach_sched_init=dn_sched_init; /* */ mach_init_IRQ=dn_init_IRQ; - mach_default_handler=NULL; - mach_request_irq = dn_request_irq; - mach_free_irq = dn_free_irq; - enable_irq = dn_enable_irq; - disable_irq = dn_disable_irq; - mach_get_irq_list = show_dn_interrupts; mach_gettimeoffset = dn_gettimeoffset; mach_max_dma_address = 0xffffffff; mach_hwclk = dn_dummy_hwclk; /* */ mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */ - mach_process_int = dn_process_int; mach_reset = dn_dummy_reset; /* */ #ifdef CONFIG_HEARTBEAT mach_heartbeat = dn_heartbeat; @@ -189,11 +174,13 @@ void config_apollo(void) { } -irqreturn_t dn_timer_int(int irq, void *dev_id, struct pt_regs *fp) { +irqreturn_t dn_timer_int(int irq, void *dev_id, struct pt_regs *fp) +{ + irqreturn_t (*timer_handler)(int, void *, struct pt_regs *) = dev_id; volatile unsigned char x; - sched_timer_handler(irq,dev_id,fp); + timer_handler(irq, dev_id, fp); x=*(volatile unsigned char *)(timer+3); x=*(volatile unsigned char *)(timer+5); @@ -217,9 +204,7 @@ void dn_sched_init(irqreturn_t (*timer_routine)(int, void *, struct pt_regs *)) printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3)); #endif - sched_timer_handler=timer_routine; - request_irq(0,dn_timer_int,0,NULL,NULL); - + request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine); } unsigned long dn_gettimeoffset(void) { diff --git a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c index a31259359a12..9fe07803797b 100644 --- a/arch/m68k/apollo/dn_ints.c +++ b/arch/m68k/apollo/dn_ints.c @@ -1,125 +1,44 @@ -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/jiffies.h> -#include <linux/kernel_stat.h> -#include <linux/timer.h> +#include <linux/interrupt.h> -#include <asm/system.h> #include <asm/irq.h> #include <asm/traps.h> -#include <asm/page.h> -#include <asm/machdep.h> #include <asm/apollohw.h> -#include <asm/errno.h> -static irq_handler_t dn_irqs[16]; - -irqreturn_t dn_process_int(int irq, struct pt_regs *fp) +void dn_process_int(unsigned int irq, struct pt_regs *fp) { - irqreturn_t res = IRQ_NONE; - - if(dn_irqs[irq-160].handler) { - res = dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp); - } else { - printk("spurious irq %d occurred\n",irq); - } - - *(volatile unsigned char *)(pica)=0x20; - *(volatile unsigned char *)(picb)=0x20; - - return res; -} - -void dn_init_IRQ(void) { - - int i; - - for(i=0;i<16;i++) { - dn_irqs[i].handler=NULL; - dn_irqs[i].flags=IRQ_FLG_STD; - dn_irqs[i].dev_id=NULL; - dn_irqs[i].devname=NULL; - } - -} - -int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) { - - if((irq<0) || (irq>15)) { - printk("Trying to request invalid IRQ\n"); - return -ENXIO; - } - - if(!dn_irqs[irq].handler) { - dn_irqs[irq].handler=handler; - dn_irqs[irq].flags=IRQ_FLG_STD; - dn_irqs[irq].dev_id=dev_id; - dn_irqs[irq].devname=devname; - if(irq<8) - *(volatile unsigned char *)(pica+1)&=~(1<<irq); - else - *(volatile unsigned char *)(picb+1)&=~(1<<(irq-8)); - - return 0; - } - else { - printk("Trying to request already assigned irq %d\n",irq); - return -ENXIO; - } - -} - -void dn_free_irq(unsigned int irq, void *dev_id) { - - if((irq<0) || (irq>15)) { - printk("Trying to free invalid IRQ\n"); - return ; - } - - if(irq<8) - *(volatile unsigned char *)(pica+1)|=(1<<irq); - else - *(volatile unsigned char *)(picb+1)|=(1<<(irq-8)); - - dn_irqs[irq].handler=NULL; - dn_irqs[irq].flags=IRQ_FLG_STD; - dn_irqs[irq].dev_id=NULL; - dn_irqs[irq].devname=NULL; - - return ; - -} - -void dn_enable_irq(unsigned int irq) { - - printk("dn enable irq\n"); - -} - -void dn_disable_irq(unsigned int irq) { - - printk("dn disable irq\n"); + m68k_handle_int(irq, fp); + *(volatile unsigned char *)(pica)=0x20; + *(volatile unsigned char *)(picb)=0x20; } -int show_dn_interrupts(struct seq_file *p, void *v) { - - printk("dn get irq list\n"); - - return 0; - +int apollo_irq_startup(unsigned int irq) +{ + if (irq < 8) + *(volatile unsigned char *)(pica+1) &= ~(1 << irq); + else + *(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8)); + return 0; } -struct fb_info *dn_dummy_fb_init(long *mem_start) { - - printk("fb init\n"); - - return NULL; - +void apollo_irq_shutdown(unsigned int irq) +{ + if (irq < 8) + *(volatile unsigned char *)(pica+1) |= (1 << irq); + else + *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8)); } -void dn_dummy_video_setup(char *options,int *ints) { +static struct irq_controller apollo_irq_controller = { + .name = "apollo", + .lock = SPIN_LOCK_UNLOCKED, + .startup = apollo_irq_startup, + .shutdown = apollo_irq_shutdown, +}; - printk("no video yet\n"); +void dn_init_IRQ(void) +{ + m68k_setup_user_interrupt(VEC_USER + 96, 16, dn_process_int); + m68k_setup_irq_controller(&apollo_irq_controller, IRQ_APOLLO, 16); } diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c index 076f47917842..ece13cbf9950 100644 --- a/arch/m68k/atari/ataints.c +++ b/arch/m68k/atari/ataints.c @@ -104,6 +104,7 @@ * the sr copy in the frame. */ +#if 0 #define NUM_INT_SOURCES (8 + NUM_ATARI_SOURCES) @@ -133,13 +134,6 @@ static struct irqhandler irq_handler[NUM_INT_SOURCES]; */ static struct irqparam irq_param[NUM_INT_SOURCES]; -/* - * Bitmap for free interrupt vector numbers - * (new vectors starting from 0x70 can be allocated by - * atari_register_vme_int()) - */ -static int free_vme_vec_bitmap; - /* check for valid int number (complex, sigh...) */ #define IS_VALID_INTNO(n) \ ((n) > 0 && \ @@ -301,6 +295,14 @@ __asm__ (__ALIGN_STR "\n" ); for (;;); } +#endif + +/* + * Bitmap for free interrupt vector numbers + * (new vectors starting from 0x70 can be allocated by + * atari_register_vme_int()) + */ +static int free_vme_vec_bitmap; /* GK: * HBL IRQ handler for Falcon. Nobody needs it :-) @@ -313,13 +315,34 @@ __ALIGN_STR "\n\t" "orw #0x200,%sp@\n\t" /* set saved ipl to 2 */ "rte"); -/* Defined in entry.S; only increments 'num_spurious' */ -asmlinkage void bad_interrupt(void); - -extern void atari_microwire_cmd( int cmd ); +extern void atari_microwire_cmd(int cmd); extern int atari_SCC_reset_done; +static int atari_startup_irq(unsigned int irq) +{ + m68k_irq_startup(irq); + atari_turnon_irq(irq); + atari_enable_irq(irq); + return 0; +} + +static void atari_shutdown_irq(unsigned int irq) +{ + atari_disable_irq(irq); + atari_turnoff_irq(irq); + m68k_irq_shutdown(irq); +} + +static struct irq_controller atari_irq_controller = { + .name = "atari", + .lock = SPIN_LOCK_UNLOCKED, + .startup = atari_startup_irq, + .shutdown = atari_shutdown_irq, + .enable = atari_enable_irq, + .disable = atari_disable_irq, +}; + /* * void atari_init_IRQ (void) * @@ -333,12 +356,8 @@ extern int atari_SCC_reset_done; void __init atari_init_IRQ(void) { - int i; - - /* initialize the vector table */ - for (i = 0; i < NUM_INT_SOURCES; ++i) { - vectors[IRQ_SOURCE_TO_VECTOR(i)] = bad_interrupt; - } + m68k_setup_user_interrupt(VEC_USER, 192, NULL); + m68k_setup_irq_controller(&atari_irq_controller, 1, NUM_ATARI_SOURCES - 1); /* Initialize the MFP(s) */ @@ -378,8 +397,7 @@ void __init atari_init_IRQ(void) * enabled in VME mask */ tt_scu.vme_mask = 0x60; /* enable MFP and SCC ints */ - } - else { + } else { /* If no SCU and no Hades, the HSYNC interrupt needs to be * disabled this way. (Else _inthandler in kernel/sys_call.S * gets overruns) @@ -404,184 +422,6 @@ void __init atari_init_IRQ(void) } -static irqreturn_t atari_call_irq_list( int irq, void *dev_id, struct pt_regs *fp ) -{ - irq_node_t *node; - - for (node = (irq_node_t *)dev_id; node; node = node->next) - node->handler(irq, node->dev_id, fp); - return IRQ_HANDLED; -} - - -/* - * atari_request_irq : add an interrupt service routine for a particular - * machine specific interrupt source. - * If the addition was successful, it returns 0. - */ - -int atari_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - int vector; - unsigned long oflags = flags; - - /* - * The following is a hack to make some PCI card drivers work, - * which set the SA_SHIRQ flag. - */ - - flags &= ~SA_SHIRQ; - - if (flags == SA_INTERRUPT) { - printk ("%s: SA_INTERRUPT changed to IRQ_TYPE_SLOW for %s\n", - __FUNCTION__, devname); - flags = IRQ_TYPE_SLOW; - } - if (flags < IRQ_TYPE_SLOW || flags > IRQ_TYPE_PRIO) { - printk ("%s: Bad irq type 0x%lx <0x%lx> requested from %s\n", - __FUNCTION__, flags, oflags, devname); - return -EINVAL; - } - if (!IS_VALID_INTNO(irq)) { - printk ("%s: Unknown irq %d requested from %s\n", - __FUNCTION__, irq, devname); - return -ENXIO; - } - vector = IRQ_SOURCE_TO_VECTOR(irq); - - /* - * Check type/source combination: slow ints are (currently) - * only possible for MFP-interrupts. - */ - if (flags == IRQ_TYPE_SLOW && - (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE)) { - printk ("%s: Slow irq requested for non-MFP source %d from %s\n", - __FUNCTION__, irq, devname); - return -EINVAL; - } - - if (vectors[vector] == bad_interrupt) { - /* int has no handler yet */ - irq_handler[irq].handler = handler; - irq_handler[irq].dev_id = dev_id; - irq_param[irq].flags = flags; - irq_param[irq].devname = devname; - vectors[vector] = - (flags == IRQ_TYPE_SLOW) ? slow_handlers[irq-STMFP_SOURCE_BASE] : - (flags == IRQ_TYPE_FAST) ? atari_fast_irq_handler : - atari_prio_irq_handler; - /* If MFP int, also enable and umask it */ - atari_turnon_irq(irq); - atari_enable_irq(irq); - - return 0; - } - else if (irq_param[irq].flags == flags) { - /* old handler is of same type -> handlers can be chained */ - irq_node_t *node; - unsigned long flags; - - local_irq_save(flags); - - if (irq_handler[irq].handler != atari_call_irq_list) { - /* Only one handler yet, make a node for this first one */ - if (!(node = new_irq_node())) - return -ENOMEM; - node->handler = irq_handler[irq].handler; - node->dev_id = irq_handler[irq].dev_id; - node->devname = irq_param[irq].devname; - node->next = NULL; - - irq_handler[irq].handler = atari_call_irq_list; - irq_handler[irq].dev_id = node; - irq_param[irq].devname = "chained"; - } - - if (!(node = new_irq_node())) - return -ENOMEM; - node->handler = handler; - node->dev_id = dev_id; - node->devname = devname; - /* new handlers are put in front of the queue */ - node->next = irq_handler[irq].dev_id; - irq_handler[irq].dev_id = node; - - local_irq_restore(flags); - return 0; - } else { - printk ("%s: Irq %d allocated by other type int (call from %s)\n", - __FUNCTION__, irq, devname); - return -EBUSY; - } -} - -void atari_free_irq(unsigned int irq, void *dev_id) -{ - unsigned long flags; - int vector; - irq_node_t **list, *node; - - if (!IS_VALID_INTNO(irq)) { - printk("%s: Unknown irq %d\n", __FUNCTION__, irq); - return; - } - - vector = IRQ_SOURCE_TO_VECTOR(irq); - if (vectors[vector] == bad_interrupt) - goto not_found; - - local_irq_save(flags); - - if (irq_handler[irq].handler != atari_call_irq_list) { - /* It's the only handler for the interrupt */ - if (irq_handler[irq].dev_id != dev_id) { - local_irq_restore(flags); - goto not_found; - } - irq_handler[irq].handler = NULL; - irq_handler[irq].dev_id = NULL; - irq_param[irq].devname = NULL; - vectors[vector] = bad_interrupt; - /* If MFP int, also disable it */ - atari_disable_irq(irq); - atari_turnoff_irq(irq); - - local_irq_restore(flags); - return; - } - - /* The interrupt is chained, find the irq on the list */ - for(list = (irq_node_t **)&irq_handler[irq].dev_id; *list; list = &(*list)->next) { - if ((*list)->dev_id == dev_id) break; - } - if (!*list) { - local_irq_restore(flags); - goto not_found; - } - - (*list)->handler = NULL; /* Mark it as free for reallocation */ - *list = (*list)->next; - - /* If there's now only one handler, unchain the interrupt, i.e. plug in - * the handler directly again and omit atari_call_irq_list */ - node = (irq_node_t *)irq_handler[irq].dev_id; - if (node && !node->next) { - irq_handler[irq].handler = node->handler; - irq_handler[irq].dev_id = node->dev_id; - irq_param[irq].devname = node->devname; - node->handler = NULL; /* Mark it as free for reallocation */ - } - - local_irq_restore(flags); - return; - -not_found: - printk("%s: tried to remove invalid irq\n", __FUNCTION__); - return; -} - - /* * atari_register_vme_int() returns the number of a free interrupt vector for * hardware with a programmable int vector (probably a VME board). @@ -591,58 +431,24 @@ unsigned long atari_register_vme_int(void) { int i; - for(i = 0; i < 32; i++) - if((free_vme_vec_bitmap & (1 << i)) == 0) + for (i = 0; i < 32; i++) + if ((free_vme_vec_bitmap & (1 << i)) == 0) break; - if(i == 16) + if (i == 16) return 0; free_vme_vec_bitmap |= 1 << i; - return (VME_SOURCE_BASE + i); + return VME_SOURCE_BASE + i; } void atari_unregister_vme_int(unsigned long irq) { - if(irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) { + if (irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) { irq -= VME_SOURCE_BASE; free_vme_vec_bitmap &= ~(1 << irq); } } -int show_atari_interrupts(struct seq_file *p, void *v) -{ - int i; - - for (i = 0; i < NUM_INT_SOURCES; ++i) { - if (vectors[IRQ_SOURCE_TO_VECTOR(i)] == bad_interrupt) - continue; - if (i < STMFP_SOURCE_BASE) - seq_printf(p, "auto %2d: %10u ", - i, kstat_cpu(0).irqs[i]); - else - seq_printf(p, "vec $%02x: %10u ", - IRQ_SOURCE_TO_VECTOR(i), - kstat_cpu(0).irqs[i]); - - if (irq_handler[i].handler != atari_call_irq_list) { - seq_printf(p, "%s\n", irq_param[i].devname); - } - else { - irq_node_t *n; - for( n = (irq_node_t *)irq_handler[i].dev_id; n; n = n->next ) { - seq_printf(p, "%s\n", n->devname); - if (n->next) - seq_puts(p, " " ); - } - } - } - if (num_spurious) - seq_printf(p, "spurio.: %10u\n", num_spurious); - - return 0; -} - - diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index 1012b08e5522..b2079252a954 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c @@ -24,7 +24,6 @@ * Miscellaneous atari stuff */ -#include <linux/config.h> #include <linux/types.h> #include <linux/mm.h> #include <linux/console.h> @@ -57,12 +56,6 @@ static int atari_get_hardware_list(char *buffer); /* atari specific irq functions */ extern void atari_init_IRQ (void); -extern int atari_request_irq (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id); -extern void atari_free_irq (unsigned int irq, void *dev_id); -extern void atari_enable_irq (unsigned int); -extern void atari_disable_irq (unsigned int); -extern int show_atari_interrupts (struct seq_file *, void *); extern void atari_mksound( unsigned int count, unsigned int ticks ); #ifdef CONFIG_HEARTBEAT static void atari_heartbeat( int on ); @@ -232,13 +225,8 @@ void __init config_atari(void) mach_sched_init = atari_sched_init; mach_init_IRQ = atari_init_IRQ; - mach_request_irq = atari_request_irq; - mach_free_irq = atari_free_irq; - enable_irq = atari_enable_irq; - disable_irq = atari_disable_irq; mach_get_model = atari_get_model; mach_get_hardware_list = atari_get_hardware_list; - mach_get_irq_list = show_atari_interrupts; mach_gettimeoffset = atari_gettimeoffset; mach_reset = atari_reset; mach_max_dma_address = 0xffffff; diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c index ace05f79d968..4ae01004d8dd 100644 --- a/arch/m68k/atari/debug.c +++ b/arch/m68k/atari/debug.c @@ -10,7 +10,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/tty.h> #include <linux/console.h> diff --git a/arch/m68k/atari/hades-pci.c b/arch/m68k/atari/hades-pci.c index 8888debf71ec..6ca57b6564da 100644 --- a/arch/m68k/atari/hades-pci.c +++ b/arch/m68k/atari/hades-pci.c @@ -4,7 +4,6 @@ * Written by Wout Klaren. */ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> #include <asm/io.h> diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index 22e0481a5f7b..bf4588cbe371 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c @@ -8,7 +8,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> diff --git a/arch/m68k/bvme6000/Makefile b/arch/m68k/bvme6000/Makefile index 2348e6ceed1e..d8174004fe2f 100644 --- a/arch/m68k/bvme6000/Makefile +++ b/arch/m68k/bvme6000/Makefile @@ -2,4 +2,4 @@ # Makefile for Linux arch/m68k/bvme6000 source directory # -obj-y := config.o bvmeints.o rtc.o +obj-y := config.o rtc.o diff --git a/arch/m68k/bvme6000/bvmeints.c b/arch/m68k/bvme6000/bvmeints.c deleted file mode 100644 index 298a8df02664..000000000000 --- a/arch/m68k/bvme6000/bvmeints.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * arch/m68k/bvme6000/bvmeints.c - * - * Copyright (C) 1997 Richard Hirst [richard@sleepie.demon.co.uk] - * - * based on amiints.c -- Amiga Linux interrupt handling code - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file README.legal in the main directory of this archive - * for more details. - * - */ - -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/seq_file.h> - -#include <asm/ptrace.h> -#include <asm/system.h> -#include <asm/irq.h> -#include <asm/traps.h> - -static irqreturn_t bvme6000_defhand (int irq, void *dev_id, struct pt_regs *fp); - -/* - * This should ideally be 4 elements only, for speed. - */ - -static struct { - irqreturn_t (*handler)(int, void *, struct pt_regs *); - unsigned long flags; - void *dev_id; - const char *devname; - unsigned count; -} irq_tab[256]; - -/* - * void bvme6000_init_IRQ (void) - * - * Parameters: None - * - * Returns: Nothing - * - * This function is called during kernel startup to initialize - * the bvme6000 IRQ handling routines. - */ - -void bvme6000_init_IRQ (void) -{ - int i; - - for (i = 0; i < 256; i++) { - irq_tab[i].handler = bvme6000_defhand; - irq_tab[i].flags = IRQ_FLG_STD; - irq_tab[i].dev_id = NULL; - irq_tab[i].devname = NULL; - irq_tab[i].count = 0; - } -} - -int bvme6000_request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - if (irq > 255) { - printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname); - return -ENXIO; - } -#if 0 - /* Nothing special about auto-vectored devices for the BVME6000, - * but treat it specially to avoid changes elsewhere. - */ - - if (irq >= VEC_INT1 && irq <= VEC_INT7) - return cpu_request_irq(irq - VEC_SPUR, handler, flags, - devname, dev_id); -#endif - if (!(irq_tab[irq].flags & IRQ_FLG_STD)) { - if (irq_tab[irq].flags & IRQ_FLG_LOCK) { - printk("%s: IRQ %d from %s is not replaceable\n", - __FUNCTION__, irq, irq_tab[irq].devname); - return -EBUSY; - } - if (flags & IRQ_FLG_REPLACE) { - printk("%s: %s can't replace IRQ %d from %s\n", - __FUNCTION__, devname, irq, irq_tab[irq].devname); - return -EBUSY; - } - } - irq_tab[irq].handler = handler; - irq_tab[irq].flags = flags; - irq_tab[irq].dev_id = dev_id; - irq_tab[irq].devname = devname; - return 0; -} - -void bvme6000_free_irq(unsigned int irq, void *dev_id) -{ - if (irq > 255) { - printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq); - return; - } -#if 0 - if (irq >= VEC_INT1 && irq <= VEC_INT7) { - cpu_free_irq(irq - VEC_SPUR, dev_id); - return; - } -#endif - if (irq_tab[irq].dev_id != dev_id) - printk("%s: Removing probably wrong IRQ %d from %s\n", - __FUNCTION__, irq, irq_tab[irq].devname); - - irq_tab[irq].handler = bvme6000_defhand; - irq_tab[irq].flags = IRQ_FLG_STD; - irq_tab[irq].dev_id = NULL; - irq_tab[irq].devname = NULL; -} - -irqreturn_t bvme6000_process_int (unsigned long vec, struct pt_regs *fp) -{ - if (vec > 255) { - printk ("bvme6000_process_int: Illegal vector %ld", vec); - return IRQ_NONE; - } else { - irq_tab[vec].count++; - irq_tab[vec].handler(vec, irq_tab[vec].dev_id, fp); - return IRQ_HANDLED; - } -} - -int show_bvme6000_interrupts(struct seq_file *p, void *v) -{ - int i; - - for (i = 0; i < 256; i++) { - if (irq_tab[i].count) - seq_printf(p, "Vec 0x%02x: %8d %s\n", - i, irq_tab[i].count, - irq_tab[i].devname ? irq_tab[i].devname : "free"); - } - return 0; -} - - -static irqreturn_t bvme6000_defhand (int irq, void *dev_id, struct pt_regs *fp) -{ - printk ("Unknown interrupt 0x%02x\n", irq); - return IRQ_NONE; -} - -void bvme6000_enable_irq (unsigned int irq) -{ -} - - -void bvme6000_disable_irq (unsigned int irq) -{ -} - diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c index c90cb5fcc8ef..d1e916ae55a8 100644 --- a/arch/m68k/bvme6000/config.c +++ b/arch/m68k/bvme6000/config.c @@ -36,15 +36,8 @@ #include <asm/machdep.h> #include <asm/bvme6000hw.h> -extern irqreturn_t bvme6000_process_int (int level, struct pt_regs *regs); -extern void bvme6000_init_IRQ (void); -extern void bvme6000_free_irq (unsigned int, void *); -extern int show_bvme6000_interrupts(struct seq_file *, void *); -extern void bvme6000_enable_irq (unsigned int); -extern void bvme6000_disable_irq (unsigned int); static void bvme6000_get_model(char *model); static int bvme6000_get_hardware_list(char *buffer); -extern int bvme6000_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id); extern void bvme6000_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); extern unsigned long bvme6000_gettimeoffset (void); extern int bvme6000_hwclk (int, struct rtc_time *); @@ -100,6 +93,14 @@ static int bvme6000_get_hardware_list(char *buffer) return 0; } +/* + * This function is called during kernel startup to initialize + * the bvme6000 IRQ handling routines. + */ +static void bvme6000_init_IRQ(void) +{ + m68k_setup_user_interrupt(VEC_USER, 192, NULL); +} void __init config_bvme6000(void) { @@ -127,12 +128,6 @@ void __init config_bvme6000(void) mach_hwclk = bvme6000_hwclk; mach_set_clock_mmss = bvme6000_set_clock_mmss; mach_reset = bvme6000_reset; - mach_free_irq = bvme6000_free_irq; - mach_process_int = bvme6000_process_int; - mach_get_irq_list = show_bvme6000_interrupts; - mach_request_irq = bvme6000_request_irq; - enable_irq = bvme6000_enable_irq; - disable_irq = bvme6000_disable_irq; mach_get_model = bvme6000_get_model; mach_get_hardware_list = bvme6000_get_hardware_list; diff --git a/arch/m68k/hp300/Makefile b/arch/m68k/hp300/Makefile index 89b6317899e3..288b9c67c9bf 100644 --- a/arch/m68k/hp300/Makefile +++ b/arch/m68k/hp300/Makefile @@ -2,4 +2,4 @@ # Makefile for Linux arch/m68k/hp300 source directory # -obj-y := ksyms.o config.o ints.o time.o reboot.o +obj-y := ksyms.o config.o time.o reboot.o diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c index 6d129eef370f..1c05a6260546 100644 --- a/arch/m68k/hp300/config.c +++ b/arch/m68k/hp300/config.c @@ -7,7 +7,6 @@ * called by setup.c. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/string.h> @@ -21,7 +20,6 @@ #include <asm/hp300hw.h> #include <asm/rtc.h> -#include "ints.h" #include "time.h" unsigned long hp300_model; @@ -64,8 +62,6 @@ static char *hp300_models[] __initdata = { static char hp300_model_name[13] = "HP9000/"; extern void hp300_reset(void); -extern irqreturn_t (*hp300_default_handler[])(int, void *, struct pt_regs *); -extern int show_hp300_interrupts(struct seq_file *, void *); #ifdef CONFIG_SERIAL_8250_CONSOLE extern int hp300_setup_serial_console(void) __init; #endif @@ -245,16 +241,16 @@ static unsigned int hp300_get_ss(void) hp300_rtc_read(RTC_REG_SEC2); } +static void __init hp300_init_IRQ(void) +{ +} + void __init config_hp300(void) { mach_sched_init = hp300_sched_init; mach_init_IRQ = hp300_init_IRQ; - mach_request_irq = hp300_request_irq; - mach_free_irq = hp300_free_irq; mach_get_model = hp300_get_model; - mach_get_irq_list = show_hp300_interrupts; mach_gettimeoffset = hp300_gettimeoffset; - mach_default_handler = &hp300_default_handler; mach_hwclk = hp300_hwclk; mach_get_ss = hp300_get_ss; mach_reset = hp300_reset; diff --git a/arch/m68k/hp300/ints.c b/arch/m68k/hp300/ints.c deleted file mode 100644 index 0c5bb403e893..000000000000 --- a/arch/m68k/hp300/ints.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * linux/arch/m68k/hp300/ints.c - * - * Copyright (C) 1998 Philip Blundell <philb@gnu.org> - * - * This file contains the HP300-specific interrupt handling. - * We only use the autovector interrupts, and therefore we need to - * maintain lists of devices sharing each ipl. - * [ipl list code added by Peter Maydell <pmaydell@chiark.greenend.org.uk> 06/1998] - */ - -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/init.h> -#include <linux/sched.h> -#include <linux/kernel_stat.h> -#include <linux/interrupt.h> -#include <linux/spinlock.h> -#include <asm/machdep.h> -#include <asm/irq.h> -#include <asm/io.h> -#include <asm/system.h> -#include <asm/traps.h> -#include <asm/ptrace.h> -#include <asm/errno.h> -#include "ints.h" - -/* Each ipl has a linked list of interrupt service routines. - * Service routines are added via hp300_request_irq() and removed - * via hp300_free_irq(). The device driver should set IRQ_FLG_FAST - * if it needs to be serviced early (eg FIFOless UARTs); this will - * cause it to be added at the front of the queue rather than - * the back. - * Currently IRQ_FLG_SLOW and flags=0 are treated identically; if - * we needed three levels of priority we could distinguish them - * but this strikes me as mildly ugly... - */ - -/* we start with no entries in any list */ -static irq_node_t *hp300_irq_list[HP300_NUM_IRQS]; - -static spinlock_t irqlist_lock; - -/* This handler receives all interrupts, dispatching them to the registered handlers */ -static irqreturn_t hp300_int_handler(int irq, void *dev_id, struct pt_regs *fp) -{ - irq_node_t *t; - /* We just give every handler on the chain an opportunity to handle - * the interrupt, in priority order. - */ - for(t = hp300_irq_list[irq]; t; t=t->next) - t->handler(irq, t->dev_id, fp); - /* We could put in some accounting routines, checks for stray interrupts, - * etc, in here. Note that currently we can't tell whether or not - * a handler handles the interrupt, though. - */ - return IRQ_HANDLED; -} - -static irqreturn_t hp300_badint(int irq, void *dev_id, struct pt_regs *fp) -{ - num_spurious += 1; - return IRQ_NONE; -} - -irqreturn_t (*hp300_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { - [0] = hp300_badint, - [1] = hp300_int_handler, - [2] = hp300_int_handler, - [3] = hp300_int_handler, - [4] = hp300_int_handler, - [5] = hp300_int_handler, - [6] = hp300_int_handler, - [7] = hp300_int_handler -}; - -/* dev_id had better be unique to each handler because it's the only way we have - * to distinguish handlers when removing them... - * - * It would be pretty easy to support IRQ_FLG_LOCK (handler is not replacable) - * and IRQ_FLG_REPLACE (handler replaces existing one with this dev_id) - * if we wanted to. IRQ_FLG_FAST is needed for devices where interrupt latency - * matters (eg the dreaded FIFOless UART...) - */ -int hp300_request_irq(unsigned int irq, - irqreturn_t (*handler) (int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - irq_node_t *t, *n = new_irq_node(); - - if (!n) /* oops, no free nodes */ - return -ENOMEM; - - spin_lock_irqsave(&irqlist_lock, flags); - - if (!hp300_irq_list[irq]) { - /* no list yet */ - hp300_irq_list[irq] = n; - n->next = NULL; - } else if (flags & IRQ_FLG_FAST) { - /* insert at head of list */ - n->next = hp300_irq_list[irq]; - hp300_irq_list[irq] = n; - } else { - /* insert at end of list */ - for(t = hp300_irq_list[irq]; t->next; t = t->next) - /* do nothing */; - n->next = NULL; - t->next = n; - } - - /* Fill in n appropriately */ - n->handler = handler; - n->flags = flags; - n->dev_id = dev_id; - n->devname = devname; - spin_unlock_irqrestore(&irqlist_lock, flags); - return 0; -} - -void hp300_free_irq(unsigned int irq, void *dev_id) -{ - irq_node_t *t; - unsigned long flags; - - spin_lock_irqsave(&irqlist_lock, flags); - - t = hp300_irq_list[irq]; - if (!t) /* no handlers at all for that IRQ */ - { - printk(KERN_ERR "hp300_free_irq: attempt to remove nonexistent handler for IRQ %d\n", irq); - spin_unlock_irqrestore(&irqlist_lock, flags); - return; - } - - if (t->dev_id == dev_id) - { /* removing first handler on chain */ - t->flags = IRQ_FLG_STD; /* we probably don't really need these */ - t->dev_id = NULL; - t->devname = NULL; - t->handler = NULL; /* frees this irq_node_t */ - hp300_irq_list[irq] = t->next; - spin_unlock_irqrestore(&irqlist_lock, flags); - return; - } - - /* OK, must be removing from middle of the chain */ - - for (t = hp300_irq_list[irq]; t->next && t->next->dev_id != dev_id; t = t->next) - /* do nothing */; - if (!t->next) - { - printk(KERN_ERR "hp300_free_irq: attempt to remove nonexistent handler for IRQ %d\n", irq); - spin_unlock_irqrestore(&irqlist_lock, flags); - return; - } - /* remove the entry after t: */ - t->next->flags = IRQ_FLG_STD; - t->next->dev_id = NULL; - t->next->devname = NULL; - t->next->handler = NULL; - t->next = t->next->next; - - spin_unlock_irqrestore(&irqlist_lock, flags); -} - -int show_hp300_interrupts(struct seq_file *p, void *v) -{ - return 0; -} - -void __init hp300_init_IRQ(void) -{ - spin_lock_init(&irqlist_lock); -} diff --git a/arch/m68k/hp300/ints.h b/arch/m68k/hp300/ints.h deleted file mode 100644 index 8cfabe2f3840..000000000000 --- a/arch/m68k/hp300/ints.h +++ /dev/null @@ -1,9 +0,0 @@ -extern void hp300_init_IRQ(void); -extern void (*hp300_handlers[8])(int, void *, struct pt_regs *); -extern void hp300_free_irq(unsigned int irq, void *dev_id); -extern int hp300_request_irq(unsigned int irq, - irqreturn_t (*handler) (int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id); - -/* number of interrupts, includes 0 (what's that?) */ -#define HP300_NUM_IRQS 8 diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c index 8da5b1b31e61..7df05662b277 100644 --- a/arch/m68k/hp300/time.c +++ b/arch/m68k/hp300/time.c @@ -18,7 +18,6 @@ #include <asm/system.h> #include <asm/traps.h> #include <asm/blinken.h> -#include "ints.h" /* Clock hardware definitions */ @@ -71,7 +70,7 @@ void __init hp300_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs * asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE)); - cpu_request_irq(6, hp300_tick, IRQ_FLG_STD, "timer tick", vector); + request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector); out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */ out_8(CLOCKBASE + CLKCR1, 0x40); /* enable irq */ diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index 458925c471a1..dae609797dc0 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile @@ -9,8 +9,8 @@ else endif extra-y += vmlinux.lds -obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \ - sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o +obj-y := entry.o process.o traps.o ints.o dma.o signal.o ptrace.o \ + sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o obj-$(CONFIG_PCI) += bios32.o obj-$(CONFIG_MODULES) += module.o diff --git a/arch/m68k/kernel/bios32.c b/arch/m68k/kernel/bios32.c index a901685eb6a9..af170c2be735 100644 --- a/arch/m68k/kernel/bios32.c +++ b/arch/m68k/kernel/bios32.c @@ -6,7 +6,6 @@ * Based on the DEC Alpha bios32.c by Dave Rusling and David Mosberger. */ -#include <linux/config.h> #include <linux/init.h> #include <linux/kernel.h> diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c new file mode 100644 index 000000000000..fc449f8b2045 --- /dev/null +++ b/arch/m68k/kernel/dma.c @@ -0,0 +1,129 @@ +/* + * 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. + */ + +#undef DEBUG + +#include <linux/dma-mapping.h> +#include <linux/device.h> +#include <linux/kernel.h> +#include <linux/vmalloc.h> + +#include <asm/pgalloc.h> +#include <asm/scatterlist.h> + +void *dma_alloc_coherent(struct device *dev, size_t size, + dma_addr_t *handle, int flag) +{ + struct page *page, **map; + pgprot_t pgprot; + void *addr; + int i, order; + + pr_debug("dma_alloc_coherent: %d,%x\n", size, flag); + + size = PAGE_ALIGN(size); + order = get_order(size); + + page = alloc_pages(flag, order); + if (!page) + return NULL; + + *handle = page_to_phys(page); + map = kmalloc(sizeof(struct page *) << order, flag & ~__GFP_DMA); + if (!map) { + __free_pages(page, order); + return NULL; + } + split_page(page, order); + + order = 1 << order; + size >>= PAGE_SHIFT; + map[0] = page; + for (i = 1; i < size; i++) + map[i] = page + i; + for (; i < order; i++) + __free_page(page + i); + pgprot = __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); + if (CPU_IS_040_OR_060) + pgprot_val(pgprot) |= _PAGE_GLOBAL040 | _PAGE_NOCACHE_S; + else + pgprot_val(pgprot) |= _PAGE_NOCACHE030; + addr = vmap(map, size, flag, pgprot); + kfree(map); + + return addr; +} +EXPORT_SYMBOL(dma_alloc_coherent); + +void dma_free_coherent(struct device *dev, size_t size, + void *addr, dma_addr_t handle) +{ + pr_debug("dma_free_coherent: %p, %x\n", addr, handle); + vfree(addr); +} +EXPORT_SYMBOL(dma_free_coherent); + +inline void dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size, + enum dma_data_direction dir) +{ + switch (dir) { + case DMA_TO_DEVICE: + cache_push(handle, size); + break; + case DMA_FROM_DEVICE: + cache_clear(handle, size); + break; + default: + if (printk_ratelimit()) + printk("dma_sync_single_for_device: unsupported dir %u\n", dir); + break; + } +} +EXPORT_SYMBOL(dma_sync_single_for_device); + +void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents, + enum dma_data_direction dir) +{ + int i; + + for (i = 0; i < nents; sg++, i++) + dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir); +} +EXPORT_SYMBOL(dma_sync_sg_for_device); + +dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size, + enum dma_data_direction dir) +{ + dma_addr_t handle = virt_to_bus(addr); + + dma_sync_single_for_device(dev, handle, size, dir); + return handle; +} +EXPORT_SYMBOL(dma_map_single); + +dma_addr_t dma_map_page(struct device *dev, struct page *page, + unsigned long offset, size_t size, + enum dma_data_direction dir) +{ + dma_addr_t handle = page_to_phys(page) + offset; + + dma_sync_single_for_device(dev, handle, size, dir); + return handle; +} +EXPORT_SYMBOL(dma_map_page); + +int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, + enum dma_data_direction dir) +{ + int i; + + for (i = 0; i < nents; sg++, i++) { + sg->dma_address = page_to_phys(sg->page) + sg->offset; + dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir); + } + return nents; +} +EXPORT_SYMBOL(dma_map_sg); diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 320fde05dc63..9083c8b7659f 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S @@ -33,7 +33,6 @@ * for 68040 */ -#include <linux/config.h> #include <linux/linkage.h> #include <asm/entry.h> #include <asm/errno.h> @@ -45,9 +44,11 @@ #include <asm/asm-offsets.h> .globl system_call, buserr, trap, resume -.globl inthandler, sys_call_table +.globl sys_call_table .globl sys_fork, sys_clone, sys_vfork .globl ret_from_interrupt, bad_interrupt +.globl auto_irqhandler_fixup +.globl user_irqvec_fixup, user_irqhandler_fixup .text ENTRY(buserr) @@ -191,65 +192,29 @@ do_delayed_trace: jbra resume_userspace -#if 0 -#ifdef CONFIG_AMIGA -ami_inthandler: - addql #1,irq_stat+CPUSTAT_LOCAL_IRQ_COUNT - SAVE_ALL_INT - GET_CURRENT(%d0) +/* This is the main interrupt handler for autovector interrupts */ - bfextu %sp@(PT_VECTOR){#4,#12},%d0 - movel %d0,%a0 - addql #1,%a0@(kstat+STAT_IRQ-VECOFF(VEC_SPUR)) - movel %a0@(autoirq_list-VECOFF(VEC_SPUR)),%a0 - -| amiga vector int handler get the req mask instead of irq vector - lea CUSTOMBASE,%a1 - movew %a1@(C_INTREQR),%d0 - andw %a1@(C_INTENAR),%d0 - -| prepare stack (push frame pointer, dev_id & req mask) - pea %sp@ - movel %a0@(IRQ_DEVID),%sp@- - movel %d0,%sp@- - pea %pc@(ret_from_interrupt:w) - jbra @(IRQ_HANDLER,%a0)@(0) - -ENTRY(nmi_handler) - rte -#endif -#endif - -/* -** This is the main interrupt handler, responsible for calling process_int() -*/ -inthandler: +ENTRY(auto_inthandler) SAVE_ALL_INT GET_CURRENT(%d0) - addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2) + addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) | put exception # in d0 - bfextu %sp@(PT_VECTOR){#4,#10},%d0 + bfextu %sp@(PT_VECTOR){#4,#10},%d0 + subw #VEC_SPUR,%d0 movel %sp,%sp@- movel %d0,%sp@- | put vector # on stack -#if defined(MACH_Q40_ONLY) && defined(CONFIG_BLK_DEV_FD) - btstb #4,0xff000000 | Q40 floppy needs very special treatment ... - jbeq 1f - btstb #3,0xff000004 - jbeq 1f - jbsr floppy_hardint - jbra 3f -1: -#endif - jbsr process_int | process the IRQ -3: addql #8,%sp | pop parameters off stack +auto_irqhandler_fixup = . + 2 + jsr m68k_handle_int | process the IRQ + addql #8,%sp | pop parameters off stack ret_from_interrupt: - subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2) - jeq 1f -2: - RESTORE_ALL -1: + subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) + jeq ret_from_last_interrupt +2: RESTORE_ALL + + ALIGN +ret_from_last_interrupt: moveq #(~ALLOWINT>>8)&0xff,%d0 andb %sp@(PT_SR),%d0 jne 2b @@ -260,12 +225,42 @@ ret_from_interrupt: pea ret_from_exception jra do_softirq +/* Handler for user defined interrupt vectors */ + +ENTRY(user_inthandler) + SAVE_ALL_INT + GET_CURRENT(%d0) + addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) + | put exception # in d0 + bfextu %sp@(PT_VECTOR){#4,#10},%d0 +user_irqvec_fixup = . + 2 + subw #VEC_USER,%d0 + + movel %sp,%sp@- + movel %d0,%sp@- | put vector # on stack +user_irqhandler_fixup = . + 2 + jsr m68k_handle_int | process the IRQ + addql #8,%sp | pop parameters off stack + + subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) + jeq ret_from_last_interrupt + RESTORE_ALL /* Handler for uninitialized and spurious interrupts */ -bad_interrupt: - addql #1,num_spurious - rte +ENTRY(bad_inthandler) + SAVE_ALL_INT + GET_CURRENT(%d0) + addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) + + movel %sp,%sp@- + jsr handle_badint + addql #4,%sp + + subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) + jeq ret_from_last_interrupt + RESTORE_ALL + ENTRY(sys_fork) SAVE_SWITCH_STACK diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S index 70002c146eed..6739e87fe825 100644 --- a/arch/m68k/kernel/head.S +++ b/arch/m68k/kernel/head.S @@ -255,7 +255,6 @@ * MAC_USE_SCC_B: Use the SCC port B (printer) for serial debug (default). */ -#include <linux/config.h> #include <linux/linkage.h> #include <linux/init.h> #include <asm/bootinfo.h> diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c index 514d323ad536..b33e37fb7b0e 100644 --- a/arch/m68k/kernel/ints.c +++ b/arch/m68k/kernel/ints.c @@ -25,7 +25,6 @@ * which must be served /Roman Zippel */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/sched.h> @@ -39,47 +38,40 @@ #include <asm/traps.h> #include <asm/page.h> #include <asm/machdep.h> +#include <asm/cacheflush.h> #ifdef CONFIG_Q40 #include <asm/q40ints.h> #endif +extern u32 auto_irqhandler_fixup[]; +extern u32 user_irqhandler_fixup[]; +extern u16 user_irqvec_fixup[]; + /* table for system interrupt handlers */ -static irq_handler_t irq_list[SYS_IRQS]; - -static const char *default_names[SYS_IRQS] = { - [0] = "spurious int", - [1] = "int1 handler", - [2] = "int2 handler", - [3] = "int3 handler", - [4] = "int4 handler", - [5] = "int5 handler", - [6] = "int6 handler", - [7] = "int7 handler" +static struct irq_node *irq_list[NR_IRQS]; +static struct irq_controller *irq_controller[NR_IRQS]; +static int irq_depth[NR_IRQS]; + +static int m68k_first_user_vec; + +static struct irq_controller auto_irq_controller = { + .name = "auto", + .lock = SPIN_LOCK_UNLOCKED, + .startup = m68k_irq_startup, + .shutdown = m68k_irq_shutdown, }; -/* The number of spurious interrupts */ -volatile unsigned int num_spurious; +static struct irq_controller user_irq_controller = { + .name = "user", + .lock = SPIN_LOCK_UNLOCKED, + .startup = m68k_irq_startup, + .shutdown = m68k_irq_shutdown, +}; #define NUM_IRQ_NODES 100 static irq_node_t nodes[NUM_IRQ_NODES]; -static void dummy_enable_irq(unsigned int irq); -static void dummy_disable_irq(unsigned int irq); -static int dummy_request_irq(unsigned int irq, - irqreturn_t (*handler) (int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id); -static void dummy_free_irq(unsigned int irq, void *dev_id); - -void (*enable_irq) (unsigned int) = dummy_enable_irq; -void (*disable_irq) (unsigned int) = dummy_disable_irq; - -int (*mach_request_irq) (unsigned int, irqreturn_t (*)(int, void *, struct pt_regs *), - unsigned long, const char *, void *) = dummy_request_irq; -void (*mach_free_irq) (unsigned int, void *) = dummy_free_irq; - -void init_irq_proc(void); - /* * void init_IRQ(void) * @@ -95,18 +87,76 @@ void __init init_IRQ(void) { int i; - for (i = 0; i < SYS_IRQS; i++) { - if (mach_default_handler) - irq_list[i].handler = (*mach_default_handler)[i]; - irq_list[i].flags = 0; - irq_list[i].dev_id = NULL; - irq_list[i].devname = default_names[i]; + /* assembly irq entry code relies on this... */ + if (HARDIRQ_MASK != 0x00ff0000) { + extern void hardirq_mask_is_broken(void); + hardirq_mask_is_broken(); } - for (i = 0; i < NUM_IRQ_NODES; i++) - nodes[i].handler = NULL; + for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++) + irq_controller[i] = &auto_irq_controller; + + mach_init_IRQ(); +} + +/** + * m68k_setup_auto_interrupt + * @handler: called from auto vector interrupts + * + * setup the handler to be called from auto vector interrupts instead of the + * standard m68k_handle_int(), it will be called with irq numbers in the range + * from IRQ_AUTO_1 - IRQ_AUTO_7. + */ +void __init m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *)) +{ + if (handler) + *auto_irqhandler_fixup = (u32)handler; + flush_icache(); +} + +/** + * m68k_setup_user_interrupt + * @vec: first user vector interrupt to handle + * @cnt: number of active user vector interrupts + * @handler: called from user vector interrupts + * + * setup user vector interrupts, this includes activating the specified range + * of interrupts, only then these interrupts can be requested (note: this is + * different from auto vector interrupts). An optional handler can be installed + * to be called instead of the default m68k_handle_int(), it will be called + * with irq numbers starting from IRQ_USER. + */ +void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt, + void (*handler)(unsigned int, struct pt_regs *)) +{ + int i; + + m68k_first_user_vec = vec; + for (i = 0; i < cnt; i++) + irq_controller[IRQ_USER + i] = &user_irq_controller; + *user_irqvec_fixup = vec - IRQ_USER; + if (handler) + *user_irqhandler_fixup = (u32)handler; + flush_icache(); +} + +/** + * m68k_setup_irq_controller + * @contr: irq controller which controls specified irq + * @irq: first irq to be managed by the controller + * + * Change the controller for the specified range of irq, which will be used to + * manage these irq. auto/user irq already have a default controller, which can + * be changed as well, but the controller probably should use m68k_irq_startup/ + * m68k_irq_shutdown. + */ +void m68k_setup_irq_controller(struct irq_controller *contr, unsigned int irq, + unsigned int cnt) +{ + int i; - mach_init_IRQ (); + for (i = 0; i < cnt; i++) + irq_controller[irq + i] = contr; } irq_node_t *new_irq_node(void) @@ -114,84 +164,183 @@ irq_node_t *new_irq_node(void) irq_node_t *node; short i; - for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--) - if (!node->handler) + for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--) { + if (!node->handler) { + memset(node, 0, sizeof(*node)); return node; + } + } printk ("new_irq_node: out of nodes\n"); return NULL; } -/* - * We will keep these functions until I have convinced Linus to move - * the declaration of them from include/linux/sched.h to - * include/asm/irq.h. - */ +int setup_irq(unsigned int irq, struct irq_node *node) +{ + struct irq_controller *contr; + struct irq_node **prev; + unsigned long flags; + + if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { + printk("%s: Incorrect IRQ %d from %s\n", + __FUNCTION__, irq, node->devname); + return -ENXIO; + } + + spin_lock_irqsave(&contr->lock, flags); + + prev = irq_list + irq; + if (*prev) { + /* Can't share interrupts unless both agree to */ + if (!((*prev)->flags & node->flags & IRQF_SHARED)) { + spin_unlock_irqrestore(&contr->lock, flags); + return -EBUSY; + } + while (*prev) + prev = &(*prev)->next; + } + + if (!irq_list[irq]) { + if (contr->startup) + contr->startup(irq); + else + contr->enable(irq); + } + node->next = NULL; + *prev = node; + + spin_unlock_irqrestore(&contr->lock, flags); + + return 0; +} + int request_irq(unsigned int irq, irqreturn_t (*handler) (int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) { - return mach_request_irq(irq, handler, flags, devname, dev_id); + struct irq_node *node; + int res; + + node = new_irq_node(); + if (!node) + return -ENOMEM; + + node->handler = handler; + node->flags = flags; + node->dev_id = dev_id; + node->devname = devname; + + res = setup_irq(irq, node); + if (res) + node->handler = NULL; + + return res; } EXPORT_SYMBOL(request_irq); void free_irq(unsigned int irq, void *dev_id) { - mach_free_irq(irq, dev_id); + struct irq_controller *contr; + struct irq_node **p, *node; + unsigned long flags; + + if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { + printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq); + return; + } + + spin_lock_irqsave(&contr->lock, flags); + + p = irq_list + irq; + while ((node = *p)) { + if (node->dev_id == dev_id) + break; + p = &node->next; + } + + if (node) { + *p = node->next; + node->handler = NULL; + } else + printk("%s: Removing probably wrong IRQ %d\n", + __FUNCTION__, irq); + + if (!irq_list[irq]) { + if (contr->shutdown) + contr->shutdown(irq); + else + contr->disable(irq); + } + + spin_unlock_irqrestore(&contr->lock, flags); } EXPORT_SYMBOL(free_irq); -int cpu_request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) +void enable_irq(unsigned int irq) { - if (irq < IRQ1 || irq > IRQ7) { - printk("%s: Incorrect IRQ %d from %s\n", - __FUNCTION__, irq, devname); - return -ENXIO; - } + struct irq_controller *contr; + unsigned long flags; -#if 0 - if (!(irq_list[irq].flags & IRQ_FLG_STD)) { - if (irq_list[irq].flags & IRQ_FLG_LOCK) { - printk("%s: IRQ %d from %s is not replaceable\n", - __FUNCTION__, irq, irq_list[irq].devname); - return -EBUSY; - } - if (!(flags & IRQ_FLG_REPLACE)) { - printk("%s: %s can't replace IRQ %d from %s\n", - __FUNCTION__, devname, irq, irq_list[irq].devname); - return -EBUSY; - } + if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { + printk("%s: Incorrect IRQ %d\n", + __FUNCTION__, irq); + return; } -#endif - irq_list[irq].handler = handler; - irq_list[irq].flags = flags; - irq_list[irq].dev_id = dev_id; - irq_list[irq].devname = devname; - return 0; + spin_lock_irqsave(&contr->lock, flags); + if (irq_depth[irq]) { + if (!--irq_depth[irq]) { + if (contr->enable) + contr->enable(irq); + } + } else + WARN_ON(1); + spin_unlock_irqrestore(&contr->lock, flags); } -void cpu_free_irq(unsigned int irq, void *dev_id) +EXPORT_SYMBOL(enable_irq); + +void disable_irq(unsigned int irq) { - if (irq < IRQ1 || irq > IRQ7) { - printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq); + struct irq_controller *contr; + unsigned long flags; + + if (irq >= NR_IRQS || !(contr = irq_controller[irq])) { + printk("%s: Incorrect IRQ %d\n", + __FUNCTION__, irq); return; } - if (irq_list[irq].dev_id != dev_id) - printk("%s: Removing probably wrong IRQ %d from %s\n", - __FUNCTION__, irq, irq_list[irq].devname); + spin_lock_irqsave(&contr->lock, flags); + if (!irq_depth[irq]++) { + if (contr->disable) + contr->disable(irq); + } + spin_unlock_irqrestore(&contr->lock, flags); +} - irq_list[irq].handler = (*mach_default_handler)[irq]; - irq_list[irq].flags = 0; - irq_list[irq].dev_id = NULL; - irq_list[irq].devname = default_names[irq]; +EXPORT_SYMBOL(disable_irq); + +int m68k_irq_startup(unsigned int irq) +{ + if (irq <= IRQ_AUTO_7) + vectors[VEC_SPUR + irq] = auto_inthandler; + else + vectors[m68k_first_user_vec + irq - IRQ_USER] = user_inthandler; + return 0; } +void m68k_irq_shutdown(unsigned int irq) +{ + if (irq <= IRQ_AUTO_7) + vectors[VEC_SPUR + irq] = bad_inthandler; + else + vectors[m68k_first_user_vec + irq - IRQ_USER] = bad_inthandler; +} + + /* * Do we need these probe functions on the m68k? * @@ -219,58 +368,50 @@ int probe_irq_off (unsigned long irqs) EXPORT_SYMBOL(probe_irq_off); -static void dummy_enable_irq(unsigned int irq) -{ - printk("calling uninitialized enable_irq()\n"); -} - -static void dummy_disable_irq(unsigned int irq) +unsigned int irq_canonicalize(unsigned int irq) { - printk("calling uninitialized disable_irq()\n"); +#ifdef CONFIG_Q40 + if (MACH_IS_Q40 && irq == 11) + irq = 10; +#endif + return irq; } -static int dummy_request_irq(unsigned int irq, - irqreturn_t (*handler) (int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - printk("calling uninitialized request_irq()\n"); - return 0; -} +EXPORT_SYMBOL(irq_canonicalize); -static void dummy_free_irq(unsigned int irq, void *dev_id) +asmlinkage void m68k_handle_int(unsigned int irq, struct pt_regs *regs) { - printk("calling uninitialized disable_irq()\n"); + struct irq_node *node; + + kstat_cpu(0).irqs[irq]++; + node = irq_list[irq]; + do { + node->handler(irq, node->dev_id, regs); + node = node->next; + } while (node); } -asmlinkage void process_int(unsigned long vec, struct pt_regs *fp) +asmlinkage void handle_badint(struct pt_regs *regs) { - if (vec >= VEC_INT1 && vec <= VEC_INT7 && !MACH_IS_BVME6000) { - vec -= VEC_SPUR; - kstat_cpu(0).irqs[vec]++; - irq_list[vec].handler(vec, irq_list[vec].dev_id, fp); - } else { - if (mach_process_int) - mach_process_int(vec, fp); - else - panic("Can't process interrupt vector %ld\n", vec); - return; - } + kstat_cpu(0).irqs[0]++; + printk("unexpected interrupt from %u\n", regs->vector); } int show_interrupts(struct seq_file *p, void *v) { + struct irq_controller *contr; + struct irq_node *node; int i = *(loff_t *) v; /* autovector interrupts */ - if (i < SYS_IRQS) { - if (mach_default_handler) { - seq_printf(p, "auto %2d: %10u ", i, - i ? kstat_cpu(0).irqs[i] : num_spurious); - seq_puts(p, " "); - seq_printf(p, "%s\n", irq_list[i].devname); - } - } else if (i == SYS_IRQS) - mach_get_irq_list(p, v); + if (irq_list[i]) { + contr = irq_controller[i]; + node = irq_list[i]; + seq_printf(p, "%-8s %3u: %10u %s", contr->name, i, kstat_cpu(0).irqs[i], node->devname); + while ((node = node->next)) + seq_printf(p, ", %s", node->devname); + seq_puts(p, "\n"); + } return 0; } diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c index 5b7952ea2bae..aff26a52167c 100644 --- a/arch/m68k/kernel/m68k_ksyms.c +++ b/arch/m68k/kernel/m68k_ksyms.c @@ -7,7 +7,6 @@ #include <linux/elfcore.h> #include <linux/in6.h> #include <linux/interrupt.h> -#include <linux/config.h> #include <asm/setup.h> #include <asm/machdep.h> @@ -57,8 +56,6 @@ EXPORT_SYMBOL(dump_thread); EXPORT_SYMBOL(strnlen); EXPORT_SYMBOL(strrchr); EXPORT_SYMBOL(strstr); -EXPORT_SYMBOL(enable_irq); -EXPORT_SYMBOL(disable_irq); EXPORT_SYMBOL(kernel_thread); #ifdef CONFIG_VME EXPORT_SYMBOL(vme_brdtype); diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index 33648efb772e..45a46646c1b3 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -10,7 +10,6 @@ * This file handles the architecture-dependent parts of process handling.. */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/module.h> #include <linux/sched.h> diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index 540638ca81f9..ef89060ea328 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c @@ -18,7 +18,6 @@ #include <linux/errno.h> #include <linux/ptrace.h> #include <linux/user.h> -#include <linux/config.h> #include <linux/signal.h> #include <asm/uaccess.h> diff --git a/arch/m68k/kernel/semaphore.c b/arch/m68k/kernel/semaphore.c index 1ebb79baaa8c..d12cbbfe6ebd 100644 --- a/arch/m68k/kernel/semaphore.c +++ b/arch/m68k/kernel/semaphore.c @@ -3,7 +3,6 @@ * specific changes in <asm/semaphore-helper.h> */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/init.h> #include <asm/semaphore-helper.h> diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c index 750d5b3c971f..f2d7ee0ee18c 100644 --- a/arch/m68k/kernel/setup.c +++ b/arch/m68k/kernel/setup.c @@ -8,7 +8,6 @@ * This file handles the architecture-dependent parts of system setup */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/sched.h> @@ -68,11 +67,8 @@ char m68k_debug_device[6] = ""; void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)) __initdata = NULL; /* machine dependent irq functions */ void (*mach_init_IRQ) (void) __initdata = NULL; -irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); void (*mach_get_model) (char *model); int (*mach_get_hardware_list) (char *buffer); -int (*mach_get_irq_list) (struct seq_file *, void *); -irqreturn_t (*mach_process_int) (int, struct pt_regs *); /* machine dependent timer functions */ unsigned long (*mach_gettimeoffset) (void); int (*mach_hwclk) (int, struct rtc_time*); diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c index 866917bfa028..f9af893cd289 100644 --- a/arch/m68k/kernel/signal.c +++ b/arch/m68k/kernel/signal.c @@ -763,7 +763,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) /* This is the X/Open sanctioned signal stack switching. */ if (ka->sa.sa_flags & SA_ONSTACK) { - if (!on_sig_stack(usp)) + if (!sas_ss_flags(usp)) usp = current->sas_ss_sp + current->sas_ss_size; } return (void __user *)((usp - frame_size) & -8UL); diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c index cdf58fbb3e73..4569406a2e1f 100644 --- a/arch/m68k/kernel/traps.c +++ b/arch/m68k/kernel/traps.c @@ -18,7 +18,6 @@ * Sets up all exception vectors */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/signal.h> #include <linux/kernel.h> @@ -45,7 +44,6 @@ asmlinkage void system_call(void); asmlinkage void buserr(void); asmlinkage void trap(void); -asmlinkage void inthandler(void); asmlinkage void nmihandler(void); #ifdef CONFIG_M68KFPU_EMU asmlinkage void fpu_emu(void); @@ -53,51 +51,7 @@ asmlinkage void fpu_emu(void); e_vector vectors[256] = { [VEC_BUSERR] = buserr, - [VEC_ADDRERR] = trap, - [VEC_ILLEGAL] = trap, - [VEC_ZERODIV] = trap, - [VEC_CHK] = trap, - [VEC_TRAP] = trap, - [VEC_PRIV] = trap, - [VEC_TRACE] = trap, - [VEC_LINE10] = trap, - [VEC_LINE11] = trap, - [VEC_RESV12] = trap, - [VEC_COPROC] = trap, - [VEC_FORMAT] = trap, - [VEC_UNINT] = trap, - [VEC_RESV16] = trap, - [VEC_RESV17] = trap, - [VEC_RESV18] = trap, - [VEC_RESV19] = trap, - [VEC_RESV20] = trap, - [VEC_RESV21] = trap, - [VEC_RESV22] = trap, - [VEC_RESV23] = trap, - [VEC_SPUR] = inthandler, - [VEC_INT1] = inthandler, - [VEC_INT2] = inthandler, - [VEC_INT3] = inthandler, - [VEC_INT4] = inthandler, - [VEC_INT5] = inthandler, - [VEC_INT6] = inthandler, - [VEC_INT7] = inthandler, [VEC_SYS] = system_call, - [VEC_TRAP1] = trap, - [VEC_TRAP2] = trap, - [VEC_TRAP3] = trap, - [VEC_TRAP4] = trap, - [VEC_TRAP5] = trap, - [VEC_TRAP6] = trap, - [VEC_TRAP7] = trap, - [VEC_TRAP8] = trap, - [VEC_TRAP9] = trap, - [VEC_TRAP10] = trap, - [VEC_TRAP11] = trap, - [VEC_TRAP12] = trap, - [VEC_TRAP13] = trap, - [VEC_TRAP14] = trap, - [VEC_TRAP15] = trap, }; /* nmi handler for the Amiga */ @@ -114,7 +68,7 @@ void __init base_trap_init(void) if(MACH_IS_SUN3X) { extern e_vector *sun3x_prom_vbr; - __asm__ volatile ("movec %%vbr, %0" : "=r" ((void*)sun3x_prom_vbr)); + __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr)); } /* setup the exception vector table */ @@ -132,12 +86,15 @@ void __init trap_init (void) { int i; - for (i = 48; i < 64; i++) + for (i = VEC_SPUR; i <= VEC_INT7; i++) + vectors[i] = bad_inthandler; + + for (i = 0; i < VEC_USER; i++) if (!vectors[i]) vectors[i] = trap; - for (i = 64; i < 256; i++) - vectors[i] = inthandler; + for (i = VEC_USER; i < 256; i++) + vectors[i] = bad_inthandler; #ifdef CONFIG_M68KFPU_EMU if (FPU_IS_EMU) @@ -927,71 +884,94 @@ void show_trace(unsigned long *stack) void show_registers(struct pt_regs *regs) { struct frame *fp = (struct frame *)regs; + mm_segment_t old_fs = get_fs(); + u16 c, *cp; unsigned long addr; int i; + print_modules(); + printk("PC: [<%08lx>]",regs->pc); + print_symbol(" %s", regs->pc); + printk("\nSR: %04x SP: %p a2: %08lx\n", + regs->sr, regs, regs->a2); + printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", + regs->d0, regs->d1, regs->d2, regs->d3); + printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", + regs->d4, regs->d5, regs->a0, regs->a1); + + printk("Process %s (pid: %d, task=%p)\n", + current->comm, current->pid, current); addr = (unsigned long)&fp->un; - printk("Frame format=%X ", fp->ptregs.format); - switch (fp->ptregs.format) { + printk("Frame format=%X ", regs->format); + switch (regs->format) { case 0x2: - printk("instr addr=%08lx\n", fp->un.fmt2.iaddr); - addr += sizeof(fp->un.fmt2); - break; + printk("instr addr=%08lx\n", fp->un.fmt2.iaddr); + addr += sizeof(fp->un.fmt2); + break; case 0x3: - printk("eff addr=%08lx\n", fp->un.fmt3.effaddr); - addr += sizeof(fp->un.fmt3); - break; + printk("eff addr=%08lx\n", fp->un.fmt3.effaddr); + addr += sizeof(fp->un.fmt3); + break; case 0x4: - printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n" - : "eff addr=%08lx pc=%08lx\n"), - fp->un.fmt4.effaddr, fp->un.fmt4.pc); - addr += sizeof(fp->un.fmt4); - break; + printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n" + : "eff addr=%08lx pc=%08lx\n"), + fp->un.fmt4.effaddr, fp->un.fmt4.pc); + addr += sizeof(fp->un.fmt4); + break; case 0x7: - printk("eff addr=%08lx ssw=%04x faddr=%08lx\n", - fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr); - printk("wb 1 stat/addr/data: %04x %08lx %08lx\n", - fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0); - printk("wb 2 stat/addr/data: %04x %08lx %08lx\n", - fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d); - printk("wb 3 stat/addr/data: %04x %08lx %08lx\n", - fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d); - printk("push data: %08lx %08lx %08lx %08lx\n", - fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2, - fp->un.fmt7.pd3); - addr += sizeof(fp->un.fmt7); - break; + printk("eff addr=%08lx ssw=%04x faddr=%08lx\n", + fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr); + printk("wb 1 stat/addr/data: %04x %08lx %08lx\n", + fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0); + printk("wb 2 stat/addr/data: %04x %08lx %08lx\n", + fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d); + printk("wb 3 stat/addr/data: %04x %08lx %08lx\n", + fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d); + printk("push data: %08lx %08lx %08lx %08lx\n", + fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2, + fp->un.fmt7.pd3); + addr += sizeof(fp->un.fmt7); + break; case 0x9: - printk("instr addr=%08lx\n", fp->un.fmt9.iaddr); - addr += sizeof(fp->un.fmt9); - break; + printk("instr addr=%08lx\n", fp->un.fmt9.iaddr); + addr += sizeof(fp->un.fmt9); + break; case 0xa: - printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n", - fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb, - fp->un.fmta.daddr, fp->un.fmta.dobuf); - addr += sizeof(fp->un.fmta); - break; + printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n", + fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb, + fp->un.fmta.daddr, fp->un.fmta.dobuf); + addr += sizeof(fp->un.fmta); + break; case 0xb: - printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n", - fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb, - fp->un.fmtb.daddr, fp->un.fmtb.dobuf); - printk("baddr=%08lx dibuf=%08lx ver=%x\n", - fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver); - addr += sizeof(fp->un.fmtb); - break; + printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n", + fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb, + fp->un.fmtb.daddr, fp->un.fmtb.dobuf); + printk("baddr=%08lx dibuf=%08lx ver=%x\n", + fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver); + addr += sizeof(fp->un.fmtb); + break; default: - printk("\n"); + printk("\n"); } show_stack(NULL, (unsigned long *)addr); - printk("Code: "); - for (i = 0; i < 10; i++) - printk("%04x ", 0xffff & ((short *) fp->ptregs.pc)[i]); + printk("Code:"); + set_fs(KERNEL_DS); + cp = (u16 *)regs->pc; + for (i = -8; i < 16; i++) { + if (get_user(c, cp + i) && i >= 0) { + printk(" Bad PC value."); + break; + } + printk(i ? " %04x" : " <%04x>", c); + } + set_fs(old_fs); printk ("\n"); } void show_stack(struct task_struct *task, unsigned long *stack) { + unsigned long *p; unsigned long *endstack; int i; @@ -1004,12 +984,13 @@ void show_stack(struct task_struct *task, unsigned long *stack) endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE); printk("Stack from %08lx:", (unsigned long)stack); + p = stack; for (i = 0; i < kstack_depth_to_print; i++) { - if (stack + 1 > endstack) + if (p + 1 > endstack) break; if (i % 8 == 0) printk("\n "); - printk(" %08lx", *stack++); + printk(" %08lx", *p++); } printk("\n"); show_trace(stack); @@ -1188,19 +1169,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr) console_verbose(); printk("%s: %08x\n",str,nr); - print_modules(); - printk("PC: [<%08lx>]",fp->pc); - print_symbol(" %s\n", fp->pc); - printk("\nSR: %04x SP: %p a2: %08lx\n", - fp->sr, fp, fp->a2); - printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", - fp->d0, fp->d1, fp->d2, fp->d3); - printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", - fp->d4, fp->d5, fp->a0, fp->a1); - - printk("Process %s (pid: %d, stackpage=%08lx)\n", - current->comm, current->pid, PAGE_SIZE+(unsigned long)current); - show_stack(NULL, (unsigned long *)fp); + show_registers(fp); do_exit(SIGSEGV); } diff --git a/arch/m68k/kernel/vmlinux.lds.S b/arch/m68k/kernel/vmlinux.lds.S index 497b924f3c86..99ba315bd0a8 100644 --- a/arch/m68k/kernel/vmlinux.lds.S +++ b/arch/m68k/kernel/vmlinux.lds.S @@ -1,4 +1,3 @@ -#include <linux/config.h> PHDRS { text PT_LOAD FILEHDR PHDRS FLAGS (7); diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile index ebe51a513817..6bbf19f96007 100644 --- a/arch/m68k/lib/Makefile +++ b/arch/m68k/lib/Makefile @@ -4,5 +4,5 @@ EXTRA_AFLAGS := -traditional -lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ - checksum.o string.o semaphore.o +lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + checksum.o string.o semaphore.o uaccess.o diff --git a/arch/m68k/lib/uaccess.c b/arch/m68k/lib/uaccess.c new file mode 100644 index 000000000000..1bc188c0d983 --- /dev/null +++ b/arch/m68k/lib/uaccess.c @@ -0,0 +1,222 @@ +/* + * 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. + */ + +#include <linux/module.h> +#include <asm/uaccess.h> + +unsigned long __generic_copy_from_user(void *to, const void __user *from, + unsigned long n) +{ + unsigned long tmp, res; + + asm volatile ("\n" + " tst.l %0\n" + " jeq 2f\n" + "1: moves.l (%1)+,%3\n" + " move.l %3,(%2)+\n" + " subq.l #1,%0\n" + " jne 1b\n" + "2: btst #1,%5\n" + " jeq 4f\n" + "3: moves.w (%1)+,%3\n" + " move.w %3,(%2)+\n" + "4: btst #0,%5\n" + " jeq 6f\n" + "5: moves.b (%1)+,%3\n" + " move.b %3,(%2)+\n" + "6:\n" + " .section .fixup,\"ax\"\n" + " .even\n" + "10: move.l %0,%3\n" + "7: clr.l (%2)+\n" + " subq.l #1,%3\n" + " jne 7b\n" + " lsl.l #2,%0\n" + " btst #1,%5\n" + " jeq 8f\n" + "30: clr.w (%2)+\n" + " addq.l #2,%0\n" + "8: btst #0,%5\n" + " jeq 6b\n" + "50: clr.b (%2)+\n" + " addq.l #1,%0\n" + " jra 6b\n" + " .previous\n" + "\n" + " .section __ex_table,\"a\"\n" + " .align 4\n" + " .long 1b,10b\n" + " .long 3b,30b\n" + " .long 5b,50b\n" + " .previous" + : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) + : "0" (n / 4), "d" (n & 3)); + + return res; +} +EXPORT_SYMBOL(__generic_copy_from_user); + +unsigned long __generic_copy_to_user(void __user *to, const void *from, + unsigned long n) +{ + unsigned long tmp, res; + + asm volatile ("\n" + " tst.l %0\n" + " jeq 4f\n" + "1: move.l (%1)+,%3\n" + "2: moves.l %3,(%2)+\n" + "3: subq.l #1,%0\n" + " jne 1b\n" + "4: btst #1,%5\n" + " jeq 6f\n" + " move.w (%1)+,%3\n" + "5: moves.w %3,(%2)+\n" + "6: btst #0,%5\n" + " jeq 8f\n" + " move.b (%1)+,%3\n" + "7: moves.b %3,(%2)+\n" + "8:\n" + " .section .fixup,\"ax\"\n" + " .even\n" + "20: lsl.l #2,%0\n" + "50: add.l %5,%0\n" + " jra 7b\n" + " .previous\n" + "\n" + " .section __ex_table,\"a\"\n" + " .align 4\n" + " .long 2b,20b\n" + " .long 3b,20b\n" + " .long 5b,50b\n" + " .long 6b,50b\n" + " .long 7b,50b\n" + " .long 8b,50b\n" + " .previous" + : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) + : "0" (n / 4), "d" (n & 3)); + + return res; +} +EXPORT_SYMBOL(__generic_copy_to_user); + +/* + * Copy a null terminated string from userspace. + */ +long strncpy_from_user(char *dst, const char __user *src, long count) +{ + long res; + char c; + + if (count <= 0) + return count; + + asm volatile ("\n" + "1: moves.b (%2)+,%4\n" + " move.b %4,(%1)+\n" + " jeq 2f\n" + " subq.l #1,%3\n" + " jne 1b\n" + "2: sub.l %3,%0\n" + "3:\n" + " .section .fixup,\"ax\"\n" + " .even\n" + "10: move.l %5,%0\n" + " jra 3b\n" + " .previous\n" + "\n" + " .section __ex_table,\"a\"\n" + " .align 4\n" + " .long 1b,10b\n" + " .previous" + : "=d" (res), "+a" (dst), "+a" (src), "+r" (count), "=&d" (c) + : "i" (-EFAULT), "0" (count)); + + return res; +} +EXPORT_SYMBOL(strncpy_from_user); + +/* + * Return the size of a string (including the ending 0) + * + * Return 0 on exception, a value greater than N if too long + */ +long strnlen_user(const char __user *src, long n) +{ + char c; + long res; + + asm volatile ("\n" + "1: subq.l #1,%1\n" + " jmi 3f\n" + "2: moves.b (%0)+,%2\n" + " tst.b %2\n" + " jne 1b\n" + " jra 4f\n" + "\n" + "3: addq.l #1,%0\n" + "4: sub.l %4,%0\n" + "5:\n" + " .section .fixup,\"ax\"\n" + " .even\n" + "20: sub.l %0,%0\n" + " jra 5b\n" + " .previous\n" + "\n" + " .section __ex_table,\"a\"\n" + " .align 4\n" + " .long 2b,20b\n" + " .previous\n" + : "=&a" (res), "+d" (n), "=&d" (c) + : "0" (src), "r" (src)); + + return res; +} +EXPORT_SYMBOL(strnlen_user); + +/* + * Zero Userspace + */ + +unsigned long clear_user(void __user *to, unsigned long n) +{ + unsigned long res; + + asm volatile ("\n" + " tst.l %0\n" + " jeq 3f\n" + "1: moves.l %2,(%1)+\n" + "2: subq.l #1,%0\n" + " jne 1b\n" + "3: btst #1,%4\n" + " jeq 5f\n" + "4: moves.w %2,(%1)+\n" + "5: btst #0,%4\n" + " jeq 7f\n" + "6: moves.b %2,(%1)\n" + "7:\n" + " .section .fixup,\"ax\"\n" + " .even\n" + "10: lsl.l #2,%0\n" + "40: add.l %4,%0\n" + " jra 7b\n" + " .previous\n" + "\n" + " .section __ex_table,\"a\"\n" + " .align 4\n" + " .long 1b,10b\n" + " .long 2b,10b\n" + " .long 4b,40b\n" + " .long 5b,40b\n" + " .long 6b,40b\n" + " .long 7b,40b\n" + " .previous" + : "=d" (res), "+a" (to) + : "r" (0), "0" (n / 4), "d" (n & 3)); + + return res; +} +EXPORT_SYMBOL(clear_user); diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c index b19b7dd9bd21..6eaa881793d1 100644 --- a/arch/m68k/mac/baboon.c +++ b/arch/m68k/mac/baboon.c @@ -81,7 +81,7 @@ irqreturn_t baboon_irq(int irq, void *dev_id, struct pt_regs *regs) for (i = 0, irq_bit = 1 ; i < 3 ; i++, irq_bit <<= 1) { if (events & irq_bit/* & baboon_active*/) { baboon_active &= ~irq_bit; - mac_do_irq_list(IRQ_BABOON_0 + i, regs); + m68k_handle_int(IRQ_BABOON_0 + i, regs); baboon_active |= irq_bit; baboon->mb_ifr &= ~irq_bit; } diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 14f8d3f4e195..85dda1095b1f 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c @@ -10,7 +10,6 @@ * Miscellaneous linux stuff */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/mm.h> @@ -89,38 +88,11 @@ extern void mac_debugging_long(int, long); static void mac_get_model(char *str); -void mac_bang(int irq, void *vector, struct pt_regs *p) -{ - printk(KERN_INFO "Resetting ...\n"); - mac_reset(); -} - static void mac_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *)) { via_init_clock(vector); } -#if 0 -void mac_waitbut (void) -{ - ; -} -#endif - -extern irqreturn_t mac_default_handler(int, void *, struct pt_regs *); - -irqreturn_t (*mac_handlers[8])(int, void *, struct pt_regs *)= -{ - mac_default_handler, - mac_default_handler, - mac_default_handler, - mac_default_handler, - mac_default_handler, - mac_default_handler, - mac_default_handler, - mac_default_handler -}; - /* * Parse a Macintosh-specific record in the bootinfo */ @@ -196,13 +168,7 @@ void __init config_mac(void) mach_sched_init = mac_sched_init; mach_init_IRQ = mac_init_IRQ; - mach_request_irq = mac_request_irq; - mach_free_irq = mac_free_irq; - enable_irq = mac_enable_irq; - disable_irq = mac_disable_irq; mach_get_model = mac_get_model; - mach_default_handler = &mac_handlers; - mach_get_irq_list = show_mac_interrupts; mach_gettimeoffset = mac_gettimeoffset; #warning move to adb/via init #if 0 diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c index cc62ed61cda2..4eeb09dc0e8f 100644 --- a/arch/m68k/mac/debug.c +++ b/arch/m68k/mac/debug.c @@ -14,7 +14,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/sched.h> #include <linux/tty.h> diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c index 9179a3798407..bc657b1057a7 100644 --- a/arch/m68k/mac/iop.c +++ b/arch/m68k/mac/iop.c @@ -104,7 +104,6 @@ * should execute quickly.) */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -317,7 +316,7 @@ void __init iop_register_interrupts(void) { if (iop_ism_present) { if (oss_present) { - cpu_request_irq(OSS_IRQLEV_IOPISM, iop_ism_irq, + request_irq(OSS_IRQLEV_IOPISM, iop_ism_irq, IRQ_FLG_LOCK, "ISM IOP", (void *) IOP_NUM_ISM); oss_irq_enable(IRQ_MAC_ADB); diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c index 1809601ad903..694b14bb0de1 100644 --- a/arch/m68k/mac/macints.c +++ b/arch/m68k/mac/macints.c @@ -137,14 +137,6 @@ #define DEBUG_SPURIOUS #define SHUTUP_SONIC -/* - * The mac_irq_list array is an array of linked lists of irq_node_t nodes. - * Each node contains one handler to be called whenever the interrupt - * occurs, with fast handlers listed before slow handlers. - */ - -irq_node_t *mac_irq_list[NUM_MAC_SOURCES]; - /* SCC interrupt mask */ static int scc_mask; @@ -209,34 +201,37 @@ extern int baboon_irq_pending(int); * SCC interrupt routines */ -static void scc_irq_enable(int); -static void scc_irq_disable(int); +static void scc_irq_enable(unsigned int); +static void scc_irq_disable(unsigned int); /* * console_loglevel determines NMI handler function */ -extern irqreturn_t mac_bang(int, void *, struct pt_regs *); irqreturn_t mac_nmi_handler(int, void *, struct pt_regs *); irqreturn_t mac_debug_handler(int, void *, struct pt_regs *); /* #define DEBUG_MACINTS */ +static void mac_enable_irq(unsigned int irq); +static void mac_disable_irq(unsigned int irq); + +static struct irq_controller mac_irq_controller = { + .name = "mac", + .lock = SPIN_LOCK_UNLOCKED, + .enable = mac_enable_irq, + .disable = mac_disable_irq, +}; + void mac_init_IRQ(void) { - int i; - #ifdef DEBUG_MACINTS printk("mac_init_IRQ(): Setting things up...\n"); #endif - /* Initialize the IRQ handler lists. Initially each list is empty, */ - - for (i = 0; i < NUM_MAC_SOURCES; i++) { - mac_irq_list[i] = NULL; - } - scc_mask = 0; + m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER, + NUM_MAC_SOURCES - IRQ_USER); /* Make sure the SONIC interrupt is cleared or things get ugly */ #ifdef SHUTUP_SONIC printk("Killing onboard sonic... "); @@ -253,15 +248,16 @@ void mac_init_IRQ(void) * at levels 1-7. Most of the work is done elsewhere. */ - if (oss_present) { + if (oss_present) oss_register_interrupts(); - } else { + else via_register_interrupts(); - } - if (psc_present) psc_register_interrupts(); - if (baboon_present) baboon_register_interrupts(); + if (psc_present) + psc_register_interrupts(); + if (baboon_present) + baboon_register_interrupts(); iop_register_interrupts(); - cpu_request_irq(7, mac_nmi_handler, IRQ_FLG_LOCK, "NMI", + request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI", mac_nmi_handler); #ifdef DEBUG_MACINTS printk("mac_init_IRQ(): Done!\n"); @@ -269,104 +265,6 @@ void mac_init_IRQ(void) } /* - * Routines to work with irq_node_t's on linked lists lifted from - * the Amiga code written by Roman Zippel. - */ - -static inline void mac_insert_irq(irq_node_t **list, irq_node_t *node) -{ - unsigned long flags; - irq_node_t *cur; - - if (!node->dev_id) - printk("%s: Warning: dev_id of %s is zero\n", - __FUNCTION__, node->devname); - - local_irq_save(flags); - - cur = *list; - - if (node->flags & IRQ_FLG_FAST) { - node->flags &= ~IRQ_FLG_SLOW; - while (cur && cur->flags & IRQ_FLG_FAST) { - list = &cur->next; - cur = cur->next; - } - } else if (node->flags & IRQ_FLG_SLOW) { - while (cur) { - list = &cur->next; - cur = cur->next; - } - } else { - while (cur && !(cur->flags & IRQ_FLG_SLOW)) { - list = &cur->next; - cur = cur->next; - } - } - - node->next = cur; - *list = node; - - local_irq_restore(flags); -} - -static inline void mac_delete_irq(irq_node_t **list, void *dev_id) -{ - unsigned long flags; - irq_node_t *node; - - local_irq_save(flags); - - for (node = *list; node; list = &node->next, node = *list) { - if (node->dev_id == dev_id) { - *list = node->next; - /* Mark it as free. */ - node->handler = NULL; - local_irq_restore(flags); - return; - } - } - local_irq_restore(flags); - printk ("%s: tried to remove invalid irq\n", __FUNCTION__); -} - -/* - * Call all the handlers for a given interrupt. Fast handlers are called - * first followed by slow handlers. - * - * This code taken from the original Amiga code written by Roman Zippel. - */ - -void mac_do_irq_list(int irq, struct pt_regs *fp) -{ - irq_node_t *node, *slow_nodes; - unsigned long flags; - - kstat_cpu(0).irqs[irq]++; - -#ifdef DEBUG_SPURIOUS - if (!mac_irq_list[irq] && (console_loglevel > 7)) { - printk("mac_do_irq_list: spurious interrupt %d!\n", irq); - return; - } -#endif - - /* serve first fast and normal handlers */ - for (node = mac_irq_list[irq]; - node && (!(node->flags & IRQ_FLG_SLOW)); - node = node->next) - node->handler(irq, node->dev_id, fp); - if (!node) return; - local_save_flags(flags); - local_irq_restore((flags & ~0x0700) | (fp->sr & 0x0700)); - /* if slow handlers exists, serve them now */ - slow_nodes = node; - for (; node; node = node->next) { - node->handler(irq, node->dev_id, fp); - } -} - -/* * mac_enable_irq - enable an interrupt source * mac_disable_irq - disable an interrupt source * mac_clear_irq - clears a pending interrupt @@ -375,276 +273,124 @@ void mac_do_irq_list(int irq, struct pt_regs *fp) * These routines are just dispatchers to the VIA/OSS/PSC routines. */ -void mac_enable_irq (unsigned int irq) +static void mac_enable_irq(unsigned int irq) { - int irq_src = IRQ_SRC(irq); + int irq_src = IRQ_SRC(irq); switch(irq_src) { - case 1: via_irq_enable(irq); - break; - case 2: - case 7: if (oss_present) { - oss_irq_enable(irq); - } else { - via_irq_enable(irq); - } - break; - case 3: - case 4: - case 5: - case 6: if (psc_present) { - psc_irq_enable(irq); - } else if (oss_present) { - oss_irq_enable(irq); - } else if (irq_src == 4) { - scc_irq_enable(irq); - } - break; - case 8: if (baboon_present) { - baboon_irq_enable(irq); - } - break; + case 1: + via_irq_enable(irq); + break; + case 2: + case 7: + if (oss_present) + oss_irq_enable(irq); + else + via_irq_enable(irq); + break; + case 3: + case 4: + case 5: + case 6: + if (psc_present) + psc_irq_enable(irq); + else if (oss_present) + oss_irq_enable(irq); + else if (irq_src == 4) + scc_irq_enable(irq); + break; + case 8: + if (baboon_present) + baboon_irq_enable(irq); + break; } } -void mac_disable_irq (unsigned int irq) +static void mac_disable_irq(unsigned int irq) { - int irq_src = IRQ_SRC(irq); + int irq_src = IRQ_SRC(irq); switch(irq_src) { - case 1: via_irq_disable(irq); - break; - case 2: - case 7: if (oss_present) { - oss_irq_disable(irq); - } else { - via_irq_disable(irq); - } - break; - case 3: - case 4: - case 5: - case 6: if (psc_present) { - psc_irq_disable(irq); - } else if (oss_present) { - oss_irq_disable(irq); - } else if (irq_src == 4) { - scc_irq_disable(irq); - } - break; - case 8: if (baboon_present) { - baboon_irq_disable(irq); - } - break; + case 1: + via_irq_disable(irq); + break; + case 2: + case 7: + if (oss_present) + oss_irq_disable(irq); + else + via_irq_disable(irq); + break; + case 3: + case 4: + case 5: + case 6: + if (psc_present) + psc_irq_disable(irq); + else if (oss_present) + oss_irq_disable(irq); + else if (irq_src == 4) + scc_irq_disable(irq); + break; + case 8: + if (baboon_present) + baboon_irq_disable(irq); + break; } } -void mac_clear_irq( unsigned int irq ) +void mac_clear_irq(unsigned int irq) { switch(IRQ_SRC(irq)) { - case 1: via_irq_clear(irq); - break; - case 2: - case 7: if (oss_present) { - oss_irq_clear(irq); - } else { - via_irq_clear(irq); - } - break; - case 3: - case 4: - case 5: - case 6: if (psc_present) { - psc_irq_clear(irq); - } else if (oss_present) { - oss_irq_clear(irq); - } - break; - case 8: if (baboon_present) { - baboon_irq_clear(irq); - } - break; + case 1: + via_irq_clear(irq); + break; + case 2: + case 7: + if (oss_present) + oss_irq_clear(irq); + else + via_irq_clear(irq); + break; + case 3: + case 4: + case 5: + case 6: + if (psc_present) + psc_irq_clear(irq); + else if (oss_present) + oss_irq_clear(irq); + break; + case 8: + if (baboon_present) + baboon_irq_clear(irq); + break; } } -int mac_irq_pending( unsigned int irq ) +int mac_irq_pending(unsigned int irq) { switch(IRQ_SRC(irq)) { - case 1: return via_irq_pending(irq); - case 2: - case 7: if (oss_present) { - return oss_irq_pending(irq); - } else { - return via_irq_pending(irq); - } - case 3: - case 4: - case 5: - case 6: if (psc_present) { - return psc_irq_pending(irq); - } else if (oss_present) { - return oss_irq_pending(irq); - } - } - return 0; -} - -/* - * Add an interrupt service routine to an interrupt source. - * Returns 0 on success. - * - * FIXME: You can register interrupts on nonexistent source (ie PSC4 on a - * non-PSC machine). We should return -EINVAL in those cases. - */ - -int mac_request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - irq_node_t *node; - -#ifdef DEBUG_MACINTS - printk ("%s: irq %d requested for %s\n", __FUNCTION__, irq, devname); -#endif - - if (irq < VIA1_SOURCE_BASE) { - return cpu_request_irq(irq, handler, flags, devname, dev_id); + case 1: + return via_irq_pending(irq); + case 2: + case 7: + if (oss_present) + return oss_irq_pending(irq); + else + return via_irq_pending(irq); + case 3: + case 4: + case 5: + case 6: + if (psc_present) + return psc_irq_pending(irq); + else if (oss_present) + return oss_irq_pending(irq); } - - if (irq >= NUM_MAC_SOURCES) { - printk ("%s: unknown irq %d requested by %s\n", - __FUNCTION__, irq, devname); - } - - /* Get a node and stick it onto the right list */ - - if (!(node = new_irq_node())) return -ENOMEM; - - node->handler = handler; - node->flags = flags; - node->dev_id = dev_id; - node->devname = devname; - node->next = NULL; - mac_insert_irq(&mac_irq_list[irq], node); - - /* Now enable the IRQ source */ - - mac_enable_irq(irq); - return 0; } -/* - * Removes an interrupt service routine from an interrupt source. - */ - -void mac_free_irq(unsigned int irq, void *dev_id) -{ -#ifdef DEBUG_MACINTS - printk ("%s: irq %d freed by %p\n", __FUNCTION__, irq, dev_id); -#endif - - if (irq < VIA1_SOURCE_BASE) { - cpu_free_irq(irq, dev_id); - return; - } - - if (irq >= NUM_MAC_SOURCES) { - printk ("%s: unknown irq %d freed\n", - __FUNCTION__, irq); - return; - } - - mac_delete_irq(&mac_irq_list[irq], dev_id); - - /* If the list for this interrupt is */ - /* empty then disable the source. */ - - if (!mac_irq_list[irq]) { - mac_disable_irq(irq); - } -} - -/* - * Generate a pretty listing for /proc/interrupts - * - * By the time we're called the autovector interrupt list has already been - * generated, so we just need to do the machspec interrupts. - * - * 990506 (jmt) - rewritten to handle chained machspec interrupt handlers. - * Also removed display of num_spurious it is already - * displayed for us as autovector irq 0. - */ - -int show_mac_interrupts(struct seq_file *p, void *v) -{ - int i; - irq_node_t *node; - char *base; - - /* Don't do Nubus interrupts in this loop; we do them separately */ - /* below so that we can print slot numbers instead of IRQ numbers */ - - for (i = VIA1_SOURCE_BASE ; i < NUM_MAC_SOURCES ; ++i) { - - /* Nonexistant interrupt or nothing registered; skip it. */ - - if ((node = mac_irq_list[i]) == NULL) continue; - if (node->flags & IRQ_FLG_STD) continue; - - base = ""; - switch(IRQ_SRC(i)) { - case 1: base = "via1"; - break; - case 2: if (oss_present) { - base = "oss"; - } else { - base = "via2"; - } - break; - case 3: - case 4: - case 5: - case 6: if (psc_present) { - base = "psc"; - } else if (oss_present) { - base = "oss"; - } else { - if (IRQ_SRC(i) == 4) base = "scc"; - } - break; - case 7: base = "nbus"; - break; - case 8: base = "bbn"; - break; - } - seq_printf(p, "%4s %2d: %10u ", base, i, kstat_cpu(0).irqs[i]); - - do { - if (node->flags & IRQ_FLG_FAST) { - seq_puts(p, "F "); - } else if (node->flags & IRQ_FLG_SLOW) { - seq_puts(p, "S "); - } else { - seq_puts(p, " "); - } - seq_printf(p, "%s\n", node->devname); - if ((node = node->next)) { - seq_puts(p, " "); - } - } while(node); - - } - return 0; -} - -void mac_default_handler(int irq, void *dev_id, struct pt_regs *regs) -{ -#ifdef DEBUG_SPURIOUS - printk("Unexpected IRQ %d on device %p\n", irq, dev_id); -#endif -} - static int num_debug[8]; irqreturn_t mac_debug_handler(int irq, void *dev_id, struct pt_regs *regs) @@ -684,7 +430,7 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp) while (nmi_hold == 1) udelay(1000); - if ( console_loglevel >= 8 ) { + if (console_loglevel >= 8) { #if 0 show_state(); printk("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp); @@ -713,14 +459,16 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp) * done in hardware (only the PSC can do that.) */ -static void scc_irq_enable(int irq) { - int irq_idx = IRQ_IDX(irq); +static void scc_irq_enable(unsigned int irq) +{ + int irq_idx = IRQ_IDX(irq); scc_mask |= (1 << irq_idx); } -static void scc_irq_disable(int irq) { - int irq_idx = IRQ_IDX(irq); +static void scc_irq_disable(unsigned int irq) +{ + int irq_idx = IRQ_IDX(irq); scc_mask &= ~(1 << irq_idx); } @@ -755,6 +503,8 @@ void mac_scc_dispatch(int irq, void *dev_id, struct pt_regs *regs) /* and since they're autovector interrupts they */ /* pretty much kill the system. */ - if (reg & 0x38) mac_do_irq_list(IRQ_SCCA, regs); - if (reg & 0x07) mac_do_irq_list(IRQ_SCCB, regs); + if (reg & 0x38) + m68k_handle_int(IRQ_SCCA, regs); + if (reg & 0x07) + m68k_handle_int(IRQ_SCCB, regs); } diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c index bbb0c3b95e9c..56d1f5676ade 100644 --- a/arch/m68k/mac/misc.c +++ b/arch/m68k/mac/misc.c @@ -2,7 +2,6 @@ * Miscellaneous Mac68K-specific stuff */ -#include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/miscdevice.h> diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c index 333547692724..63e04365191f 100644 --- a/arch/m68k/mac/oss.c +++ b/arch/m68k/mac/oss.c @@ -67,15 +67,15 @@ void __init oss_init(void) void __init oss_register_interrupts(void) { - cpu_request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK, + request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK, "scsi", (void *) oss); - cpu_request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK, + request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK, "scc", mac_scc_dispatch); - cpu_request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK, + request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK, "nubus", (void *) oss); - cpu_request_irq(OSS_IRQLEV_SOUND, oss_irq, IRQ_FLG_LOCK, + request_irq(OSS_IRQLEV_SOUND, oss_irq, IRQ_FLG_LOCK, "sound", (void *) oss); - cpu_request_irq(OSS_IRQLEV_VIA1, via1_irq, IRQ_FLG_LOCK, + request_irq(OSS_IRQLEV_VIA1, via1_irq, IRQ_FLG_LOCK, "via1", (void *) via1); } @@ -113,7 +113,7 @@ irqreturn_t oss_irq(int irq, void *dev_id, struct pt_regs *regs) oss->irq_pending &= ~OSS_IP_SOUND; } else if (events & OSS_IP_SCSI) { oss->irq_level[OSS_SCSI] = OSS_IRQLEV_DISABLED; - mac_do_irq_list(IRQ_MAC_SCSI, regs); + m68k_handle_int(IRQ_MAC_SCSI, regs); oss->irq_pending &= ~OSS_IP_SCSI; oss->irq_level[OSS_SCSI] = OSS_IRQLEV_SCSI; } else { @@ -146,7 +146,7 @@ irqreturn_t oss_nubus_irq(int irq, void *dev_id, struct pt_regs *regs) for (i = 0, irq_bit = 1 ; i < 6 ; i++, irq_bit <<= 1) { if (events & irq_bit) { oss->irq_level[i] = OSS_IRQLEV_DISABLED; - mac_do_irq_list(NUBUS_SOURCE_BASE + i, regs); + m68k_handle_int(NUBUS_SOURCE_BASE + i, regs); oss->irq_pending &= ~irq_bit; oss->irq_level[i] = OSS_IRQLEV_NUBUS; } diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c index e72384e43a1e..e26218091755 100644 --- a/arch/m68k/mac/psc.c +++ b/arch/m68k/mac/psc.c @@ -117,10 +117,10 @@ void __init psc_init(void) void __init psc_register_interrupts(void) { - cpu_request_irq(3, psc_irq, IRQ_FLG_LOCK, "psc3", (void *) 0x30); - cpu_request_irq(4, psc_irq, IRQ_FLG_LOCK, "psc4", (void *) 0x40); - cpu_request_irq(5, psc_irq, IRQ_FLG_LOCK, "psc5", (void *) 0x50); - cpu_request_irq(6, psc_irq, IRQ_FLG_LOCK, "psc6", (void *) 0x60); + request_irq(IRQ_AUTO_3, psc_irq, 0, "psc3", (void *) 0x30); + request_irq(IRQ_AUTO_4, psc_irq, 0, "psc4", (void *) 0x40); + request_irq(IRQ_AUTO_5, psc_irq, 0, "psc5", (void *) 0x50); + request_irq(IRQ_AUTO_6, psc_irq, 0, "psc6", (void *) 0x60); } /* @@ -149,7 +149,7 @@ irqreturn_t psc_irq(int irq, void *dev_id, struct pt_regs *regs) for (i = 0, irq_bit = 1 ; i < 4 ; i++, irq_bit <<= 1) { if (events & irq_bit) { psc_write_byte(pIER, irq_bit); - mac_do_irq_list(base_irq + i, regs); + m68k_handle_int(base_irq + i, regs); psc_write_byte(pIFR, irq_bit); psc_write_byte(pIER, irq_bit | 0x80); } diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c index cd528bf7b43f..c4aa345d544e 100644 --- a/arch/m68k/mac/via.c +++ b/arch/m68k/mac/via.c @@ -25,7 +25,6 @@ #include <linux/init.h> #include <linux/ide.h> -#include <asm/traps.h> #include <asm/bootinfo.h> #include <asm/macintosh.h> #include <asm/macints.h> @@ -71,7 +70,6 @@ void via_irq_enable(int irq); void via_irq_disable(int irq); void via_irq_clear(int irq); -extern irqreturn_t mac_bang(int, void *, struct pt_regs *); extern irqreturn_t mac_scc_dispatch(int, void *, struct pt_regs *); extern int oss_present; @@ -212,11 +210,6 @@ void __init via_init(void) break; } #else - /* The alernate IRQ mapping seems to just not work. Anyone with a */ - /* supported machine is welcome to take a stab at fixing it. It */ - /* _should_ work on the following Quadras: 610,650,700,800,900,950 */ - /* - 1999-06-12 (jmt) */ - via_alt_mapping = 0; #endif @@ -260,27 +253,21 @@ void __init via_init_clock(irqreturn_t (*func)(int, void *, struct pt_regs *)) void __init via_register_interrupts(void) { if (via_alt_mapping) { - cpu_request_irq(IRQ_AUTO_1, via1_irq, + request_irq(IRQ_AUTO_1, via1_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, "software", (void *) via1); - cpu_request_irq(IRQ_AUTO_6, via1_irq, + request_irq(IRQ_AUTO_6, via1_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1", (void *) via1); } else { - cpu_request_irq(IRQ_AUTO_1, via1_irq, + request_irq(IRQ_AUTO_1, via1_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1", (void *) via1); -#if 0 /* interferes with serial on some machines */ - if (!psc_present) { - cpu_request_irq(IRQ_AUTO_6, mac_bang, IRQ_FLG_LOCK, - "Off Switch", mac_bang); - } -#endif } - cpu_request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, + request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, "via2", (void *) via2); if (!psc_present) { - cpu_request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK, + request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK, "scc", mac_scc_dispatch); } request_irq(IRQ_MAC_NUBUS, via_nubus_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST, @@ -437,7 +424,7 @@ irqreturn_t via1_irq(int irq, void *dev_id, struct pt_regs *regs) for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) if (events & irq_bit) { via1[vIER] = irq_bit; - mac_do_irq_list(VIA1_SOURCE_BASE + i, regs); + m68k_handle_int(VIA1_SOURCE_BASE + i, regs); via1[vIFR] = irq_bit; via1[vIER] = irq_bit | 0x80; } @@ -452,7 +439,7 @@ irqreturn_t via1_irq(int irq, void *dev_id, struct pt_regs *regs) /* No, it won't be set. that's why we're doing this. */ via_irq_disable(IRQ_MAC_NUBUS); via_irq_clear(IRQ_MAC_NUBUS); - mac_do_irq_list(IRQ_MAC_NUBUS, regs); + m68k_handle_int(IRQ_MAC_NUBUS, regs); via_irq_enable(IRQ_MAC_NUBUS); } #endif @@ -471,8 +458,8 @@ irqreturn_t via2_irq(int irq, void *dev_id, struct pt_regs *regs) for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) if (events & irq_bit) { via2[gIER] = irq_bit; - mac_do_irq_list(VIA2_SOURCE_BASE + i, regs); via2[gIFR] = irq_bit | rbv_clear; + m68k_handle_int(VIA2_SOURCE_BASE + i, regs); via2[gIER] = irq_bit | 0x80; } return IRQ_HANDLED; @@ -494,7 +481,7 @@ irqreturn_t via_nubus_irq(int irq, void *dev_id, struct pt_regs *regs) for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) { if (events & irq_bit) { via_irq_disable(NUBUS_SOURCE_BASE + i); - mac_do_irq_list(NUBUS_SOURCE_BASE + i, regs); + m68k_handle_int(NUBUS_SOURCE_BASE + i, regs); via_irq_enable(NUBUS_SOURCE_BASE + i); } } @@ -529,6 +516,7 @@ void via_irq_enable(int irq) { } via2[gIER] = irq_bit | 0x80; } else if (irq_src == 7) { + nubus_active |= irq_bit; if (rbv_present) { /* enable the slot interrupt. SIER works like IER. */ via2[rSIER] = IER_SET_BIT(irq_idx); @@ -550,7 +538,6 @@ void via_irq_enable(int irq) { } } } - nubus_active |= irq_bit; } } diff --git a/arch/m68k/math-emu/fp_entry.S b/arch/m68k/math-emu/fp_entry.S index 5ec2d9101ea3..954b4f304a7d 100644 --- a/arch/m68k/math-emu/fp_entry.S +++ b/arch/m68k/math-emu/fp_entry.S @@ -35,7 +35,6 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <linux/config.h> #include <linux/linkage.h> #include <asm/entry.h> diff --git a/arch/m68k/math-emu/fp_util.S b/arch/m68k/math-emu/fp_util.S index a9f7f0129067..b093b85fcdd2 100644 --- a/arch/m68k/math-emu/fp_util.S +++ b/arch/m68k/math-emu/fp_util.S @@ -35,7 +35,6 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <linux/config.h> #include "fp_emu.h" /* diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c index a190e39c907a..ab90213e5c54 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c @@ -7,7 +7,6 @@ * to motorola.c and sun3mmu.c */ -#include <linux/config.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/mm.h> diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c index 85ad19a0ac79..f46f049d29ff 100644 --- a/arch/m68k/mm/kmap.c +++ b/arch/m68k/mm/kmap.c @@ -7,7 +7,6 @@ * used by other architectures /Roman Zippel */ -#include <linux/config.h> #include <linux/mm.h> #include <linux/kernel.h> #include <linux/string.h> @@ -259,13 +258,15 @@ void __iounmap(void *addr, unsigned long size) if (CPU_IS_020_OR_030) { int pmd_off = (virtaddr/PTRTREESIZE) & 15; + int pmd_type = pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK; - if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) { + if (pmd_type == _PAGE_PRESENT) { pmd_dir->pmd[pmd_off] = 0; virtaddr += PTRTREESIZE; size -= PTRTREESIZE; continue; - } + } else if (pmd_type == 0) + continue; } if (pmd_bad(*pmd_dir)) { diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c index d6d582a5abb0..a0c095e17222 100644 --- a/arch/m68k/mm/memory.c +++ b/arch/m68k/mm/memory.c @@ -4,7 +4,6 @@ * Copyright (C) 1995 Hamish Macdonald */ -#include <linux/config.h> #include <linux/mm.h> #include <linux/kernel.h> #include <linux/string.h> @@ -94,8 +93,7 @@ pmd_t *get_pointer_table (void) PD_MARKBITS(dp) = mask & ~tmp; if (!PD_MARKBITS(dp)) { /* move to end of list */ - list_del(dp); - list_add_tail(dp, &ptable_list); + list_move_tail(dp, &ptable_list); } return (pmd_t *) (page_address(PD_PAGE(dp)) + off); } @@ -123,8 +121,7 @@ int free_pointer_table (pmd_t *ptable) * move this descriptor to the front of the list, since * it has one or more free tables. */ - list_del(dp); - list_add(dp, &ptable_list); + list_move(dp, &ptable_list); } return 0; } diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index afb57eeafdcb..49015e32d8fc 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -8,7 +8,6 @@ * Moved 8/20/1999 Sam Creasey */ -#include <linux/config.h> #include <linux/module.h> #include <linux/signal.h> #include <linux/sched.h> @@ -203,7 +202,7 @@ void __init paging_init(void) { int chunk; unsigned long mem_avail = 0; - unsigned long zones_size[3] = { 0, }; + unsigned long zones_size[MAX_NR_ZONES] = { 0, }; #ifdef DEBUG { @@ -257,12 +256,12 @@ void __init paging_init(void) #ifdef DEBUG printk ("before free_area_init\n"); #endif - zones_size[0] = (mach_max_dma_address < (unsigned long)high_memory ? - (mach_max_dma_address+1) : (unsigned long)high_memory); - zones_size[1] = (unsigned long)high_memory - zones_size[0]; + zones_size[ZONE_DMA] = (mach_max_dma_address < (unsigned long)high_memory ? + (mach_max_dma_address+1) : (unsigned long)high_memory); + zones_size[ZONE_NORMAL] = (unsigned long)high_memory - zones_size[0]; - zones_size[0] = (zones_size[0] - PAGE_OFFSET) >> PAGE_SHIFT; - zones_size[1] >>= PAGE_SHIFT; + zones_size[ZONE_DMA] = (zones_size[ZONE_DMA] - PAGE_OFFSET) >> PAGE_SHIFT; + zones_size[ZONE_NORMAL] >>= PAGE_SHIFT; free_area_init(zones_size); } diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c index a47be196a47c..ac6640ade0b1 100644 --- a/arch/m68k/mm/sun3mmu.c +++ b/arch/m68k/mm/sun3mmu.c @@ -46,7 +46,7 @@ void __init paging_init(void) unsigned long address; unsigned long next_pgtable; unsigned long bootmem_end; - unsigned long zones_size[3] = {0, 0, 0}; + unsigned long zones_size[MAX_NR_ZONES] = { 0, }; unsigned long size; @@ -92,8 +92,7 @@ void __init paging_init(void) current->mm = NULL; /* memory sizing is a hack stolen from motorola.c.. hope it works for us */ - zones_size[0] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT; - zones_size[1] = 0; + zones_size[ZONE_DMA] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT; free_area_init(zones_size); diff --git a/arch/m68k/mvme147/147ints.c b/arch/m68k/mvme147/147ints.c deleted file mode 100644 index 69a744ee35a3..000000000000 --- a/arch/m68k/mvme147/147ints.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * arch/m68k/mvme147/147ints.c - * - * Copyright (C) 1997 Richard Hirst [richard@sleepie.demon.co.uk] - * - * based on amiints.c -- Amiga Linux interrupt handling code - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file README.legal in the main directory of this archive - * for more details. - * - */ - -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/seq_file.h> - -#include <asm/ptrace.h> -#include <asm/system.h> -#include <asm/irq.h> -#include <asm/traps.h> - -static irqreturn_t mvme147_defhand (int irq, void *dev_id, struct pt_regs *fp); - -/* - * This should ideally be 4 elements only, for speed. - */ - -static struct { - irqreturn_t (*handler)(int, void *, struct pt_regs *); - unsigned long flags; - void *dev_id; - const char *devname; - unsigned count; -} irq_tab[256]; - -/* - * void mvme147_init_IRQ (void) - * - * Parameters: None - * - * Returns: Nothing - * - * This function is called during kernel startup to initialize - * the mvme147 IRQ handling routines. - */ - -void mvme147_init_IRQ (void) -{ - int i; - - for (i = 0; i < 256; i++) { - irq_tab[i].handler = mvme147_defhand; - irq_tab[i].flags = IRQ_FLG_STD; - irq_tab[i].dev_id = NULL; - irq_tab[i].devname = NULL; - irq_tab[i].count = 0; - } -} - -int mvme147_request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - if (irq > 255) { - printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname); - return -ENXIO; - } - if (!(irq_tab[irq].flags & IRQ_FLG_STD)) { - if (irq_tab[irq].flags & IRQ_FLG_LOCK) { - printk("%s: IRQ %d from %s is not replaceable\n", - __FUNCTION__, irq, irq_tab[irq].devname); - return -EBUSY; - } - if (flags & IRQ_FLG_REPLACE) { - printk("%s: %s can't replace IRQ %d from %s\n", - __FUNCTION__, devname, irq, irq_tab[irq].devname); - return -EBUSY; - } - } - irq_tab[irq].handler = handler; - irq_tab[irq].flags = flags; - irq_tab[irq].dev_id = dev_id; - irq_tab[irq].devname = devname; - return 0; -} - -void mvme147_free_irq(unsigned int irq, void *dev_id) -{ - if (irq > 255) { - printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq); - return; - } - if (irq_tab[irq].dev_id != dev_id) - printk("%s: Removing probably wrong IRQ %d from %s\n", - __FUNCTION__, irq, irq_tab[irq].devname); - - irq_tab[irq].handler = mvme147_defhand; - irq_tab[irq].flags = IRQ_FLG_STD; - irq_tab[irq].dev_id = NULL; - irq_tab[irq].devname = NULL; -} - -irqreturn_t mvme147_process_int (unsigned long vec, struct pt_regs *fp) -{ - if (vec > 255) { - printk ("mvme147_process_int: Illegal vector %ld\n", vec); - return IRQ_NONE; - } else { - irq_tab[vec].count++; - irq_tab[vec].handler(vec, irq_tab[vec].dev_id, fp); - return IRQ_HANDLED; - } -} - -int show_mvme147_interrupts (struct seq_file *p, void *v) -{ - int i; - - for (i = 0; i < 256; i++) { - if (irq_tab[i].count) - seq_printf(p, "Vec 0x%02x: %8d %s\n", - i, irq_tab[i].count, - irq_tab[i].devname ? irq_tab[i].devname : "free"); - } - return 0; -} - - -static irqreturn_t mvme147_defhand (int irq, void *dev_id, struct pt_regs *fp) -{ - printk ("Unknown interrupt 0x%02x\n", irq); - return IRQ_NONE; -} - -void mvme147_enable_irq (unsigned int irq) -{ -} - - -void mvme147_disable_irq (unsigned int irq) -{ -} - diff --git a/arch/m68k/mvme147/Makefile b/arch/m68k/mvme147/Makefile index f0153ed3efa5..a36d38dbfbbc 100644 --- a/arch/m68k/mvme147/Makefile +++ b/arch/m68k/mvme147/Makefile @@ -2,4 +2,4 @@ # Makefile for Linux arch/m68k/mvme147 source directory # -obj-y := config.o 147ints.o +obj-y := config.o diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c index 0fcf9720c2fe..0cd0e5bddcee 100644 --- a/arch/m68k/mvme147/config.c +++ b/arch/m68k/mvme147/config.c @@ -36,15 +36,8 @@ #include <asm/mvme147hw.h> -extern irqreturn_t mvme147_process_int (int level, struct pt_regs *regs); -extern void mvme147_init_IRQ (void); -extern void mvme147_free_irq (unsigned int, void *); -extern int show_mvme147_interrupts (struct seq_file *, void *); -extern void mvme147_enable_irq (unsigned int); -extern void mvme147_disable_irq (unsigned int); static void mvme147_get_model(char *model); static int mvme147_get_hardware_list(char *buffer); -extern int mvme147_request_irq (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id); extern void mvme147_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); extern unsigned long mvme147_gettimeoffset (void); extern int mvme147_hwclk (int, struct rtc_time *); @@ -91,6 +84,15 @@ static int mvme147_get_hardware_list(char *buffer) return 0; } +/* + * This function is called during kernel startup to initialize + * the mvme147 IRQ handling routines. + */ + +void mvme147_init_IRQ(void) +{ + m68k_setup_user_interrupt(VEC_USER, 192, NULL); +} void __init config_mvme147(void) { @@ -101,12 +103,6 @@ void __init config_mvme147(void) mach_hwclk = mvme147_hwclk; mach_set_clock_mmss = mvme147_set_clock_mmss; mach_reset = mvme147_reset; - mach_free_irq = mvme147_free_irq; - mach_process_int = mvme147_process_int; - mach_get_irq_list = show_mvme147_interrupts; - mach_request_irq = mvme147_request_irq; - enable_irq = mvme147_enable_irq; - disable_irq = mvme147_disable_irq; mach_get_model = mvme147_get_model; mach_get_hardware_list = mvme147_get_hardware_list; diff --git a/arch/m68k/mvme16x/16xints.c b/arch/m68k/mvme16x/16xints.c deleted file mode 100644 index 793ef735b59c..000000000000 --- a/arch/m68k/mvme16x/16xints.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * arch/m68k/mvme16x/16xints.c - * - * Copyright (C) 1995 Richard Hirst [richard@sleepie.demon.co.uk] - * - * based on amiints.c -- Amiga Linux interrupt handling code - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file README.legal in the main directory of this archive - * for more details. - * - */ - -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/seq_file.h> - -#include <asm/system.h> -#include <asm/ptrace.h> -#include <asm/irq.h> - -static irqreturn_t mvme16x_defhand (int irq, void *dev_id, struct pt_regs *fp); - -/* - * This should ideally be 4 elements only, for speed. - */ - -static struct { - irqreturn_t (*handler)(int, void *, struct pt_regs *); - unsigned long flags; - void *dev_id; - const char *devname; - unsigned count; -} irq_tab[192]; - -/* - * void mvme16x_init_IRQ (void) - * - * Parameters: None - * - * Returns: Nothing - * - * This function is called during kernel startup to initialize - * the mvme16x IRQ handling routines. Should probably ensure - * that the base vectors for the VMEChip2 and PCCChip2 are valid. - */ - -void mvme16x_init_IRQ (void) -{ - int i; - - for (i = 0; i < 192; i++) { - irq_tab[i].handler = mvme16x_defhand; - irq_tab[i].flags = IRQ_FLG_STD; - irq_tab[i].dev_id = NULL; - irq_tab[i].devname = NULL; - irq_tab[i].count = 0; - } -} - -int mvme16x_request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - if (irq < 64 || irq > 255) { - printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname); - return -ENXIO; - } - - if (!(irq_tab[irq-64].flags & IRQ_FLG_STD)) { - if (irq_tab[irq-64].flags & IRQ_FLG_LOCK) { - printk("%s: IRQ %d from %s is not replaceable\n", - __FUNCTION__, irq, irq_tab[irq-64].devname); - return -EBUSY; - } - if (flags & IRQ_FLG_REPLACE) { - printk("%s: %s can't replace IRQ %d from %s\n", - __FUNCTION__, devname, irq, irq_tab[irq-64].devname); - return -EBUSY; - } - } - irq_tab[irq-64].handler = handler; - irq_tab[irq-64].flags = flags; - irq_tab[irq-64].dev_id = dev_id; - irq_tab[irq-64].devname = devname; - return 0; -} - -void mvme16x_free_irq(unsigned int irq, void *dev_id) -{ - if (irq < 64 || irq > 255) { - printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq); - return; - } - - if (irq_tab[irq-64].dev_id != dev_id) - printk("%s: Removing probably wrong IRQ %d from %s\n", - __FUNCTION__, irq, irq_tab[irq-64].devname); - - irq_tab[irq-64].handler = mvme16x_defhand; - irq_tab[irq-64].flags = IRQ_FLG_STD; - irq_tab[irq-64].dev_id = NULL; - irq_tab[irq-64].devname = NULL; -} - -irqreturn_t mvme16x_process_int (unsigned long vec, struct pt_regs *fp) -{ - if (vec < 64 || vec > 255) { - printk ("mvme16x_process_int: Illegal vector %ld", vec); - return IRQ_NONE; - } else { - irq_tab[vec-64].count++; - irq_tab[vec-64].handler(vec, irq_tab[vec-64].dev_id, fp); - return IRQ_HANDLED; - } -} - -int show_mvme16x_interrupts (struct seq_file *p, void *v) -{ - int i; - - for (i = 0; i < 192; i++) { - if (irq_tab[i].count) - seq_printf(p, "Vec 0x%02x: %8d %s\n", - i+64, irq_tab[i].count, - irq_tab[i].devname ? irq_tab[i].devname : "free"); - } - return 0; -} - - -static irqreturn_t mvme16x_defhand (int irq, void *dev_id, struct pt_regs *fp) -{ - printk ("Unknown interrupt 0x%02x\n", irq); - return IRQ_NONE; -} - - -void mvme16x_enable_irq (unsigned int irq) -{ -} - - -void mvme16x_disable_irq (unsigned int irq) -{ -} - - diff --git a/arch/m68k/mvme16x/Makefile b/arch/m68k/mvme16x/Makefile index 5129f56b64a3..950e82f21640 100644 --- a/arch/m68k/mvme16x/Makefile +++ b/arch/m68k/mvme16x/Makefile @@ -2,4 +2,4 @@ # Makefile for Linux arch/m68k/mvme16x source directory # -obj-y := config.o 16xints.o rtc.o mvme16x_ksyms.o +obj-y := config.o rtc.o mvme16x_ksyms.o diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c index 26ce81c1337d..ce2727ed1bc0 100644 --- a/arch/m68k/mvme16x/config.c +++ b/arch/m68k/mvme16x/config.c @@ -40,15 +40,8 @@ extern t_bdid mvme_bdid; static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE; -extern irqreturn_t mvme16x_process_int (int level, struct pt_regs *regs); -extern void mvme16x_init_IRQ (void); -extern void mvme16x_free_irq (unsigned int, void *); -extern int show_mvme16x_interrupts (struct seq_file *, void *); -extern void mvme16x_enable_irq (unsigned int); -extern void mvme16x_disable_irq (unsigned int); static void mvme16x_get_model(char *model); static int mvme16x_get_hardware_list(char *buffer); -extern int mvme16x_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id); extern void mvme16x_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); extern unsigned long mvme16x_gettimeoffset (void); extern int mvme16x_hwclk (int, struct rtc_time *); @@ -120,6 +113,16 @@ static int mvme16x_get_hardware_list(char *buffer) return (len); } +/* + * This function is called during kernel startup to initialize + * the mvme16x IRQ handling routines. Should probably ensure + * that the base vectors for the VMEChip2 and PCCChip2 are valid. + */ + +static void mvme16x_init_IRQ (void) +{ + m68k_setup_user_interrupt(VEC_USER, 192, NULL); +} #define pcc2chip ((volatile u_char *)0xfff42000) #define PccSCCMICR 0x1d @@ -138,12 +141,6 @@ void __init config_mvme16x(void) mach_hwclk = mvme16x_hwclk; mach_set_clock_mmss = mvme16x_set_clock_mmss; mach_reset = mvme16x_reset; - mach_free_irq = mvme16x_free_irq; - mach_process_int = mvme16x_process_int; - mach_get_irq_list = show_mvme16x_interrupts; - mach_request_irq = mvme16x_request_irq; - enable_irq = mvme16x_enable_irq; - disable_irq = mvme16x_disable_irq; mach_get_model = mvme16x_get_model; mach_get_hardware_list = mvme16x_get_hardware_list; diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c index 5e0f9b04d45e..9a1827876408 100644 --- a/arch/m68k/q40/config.c +++ b/arch/m68k/q40/config.c @@ -12,7 +12,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -37,15 +36,9 @@ #include <asm/q40_master.h> extern irqreturn_t q40_process_int (int level, struct pt_regs *regs); -extern irqreturn_t (*q40_default_handler[]) (int, void *, struct pt_regs *); /* added just for debugging */ extern void q40_init_IRQ (void); -extern void q40_free_irq (unsigned int, void *); -extern int show_q40_interrupts (struct seq_file *, void *); -extern void q40_enable_irq (unsigned int); -extern void q40_disable_irq (unsigned int); static void q40_get_model(char *model); static int q40_get_hardware_list(char *buffer); -extern int q40_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id); extern void q40_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); extern unsigned long q40_gettimeoffset (void); @@ -175,13 +168,6 @@ void __init config_q40(void) mach_set_clock_mmss = q40_set_clock_mmss; mach_reset = q40_reset; - mach_free_irq = q40_free_irq; - mach_process_int = q40_process_int; - mach_get_irq_list = show_q40_interrupts; - mach_request_irq = q40_request_irq; - enable_irq = q40_enable_irq; - disable_irq = q40_disable_irq; - mach_default_handler = &q40_default_handler; mach_get_model = q40_get_model; mach_get_hardware_list = q40_get_hardware_list; diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c index f8ecc2664fe6..472f41c4158b 100644 --- a/arch/m68k/q40/q40ints.c +++ b/arch/m68k/q40/q40ints.c @@ -14,13 +14,8 @@ #include <linux/types.h> #include <linux/kernel.h> #include <linux/errno.h> -#include <linux/string.h> -#include <linux/sched.h> -#include <linux/seq_file.h> #include <linux/interrupt.h> -#include <linux/hardirq.h> -#include <asm/rtc.h> #include <asm/ptrace.h> #include <asm/system.h> #include <asm/irq.h> @@ -39,29 +34,37 @@ * */ -extern int ints_inited; +static void q40_irq_handler(unsigned int, struct pt_regs *fp); +static void q40_enable_irq(unsigned int); +static void q40_disable_irq(unsigned int); +unsigned short q40_ablecount[35]; +unsigned short q40_state[35]; -irqreturn_t q40_irq2_handler (int, void *, struct pt_regs *fp); - - -static irqreturn_t q40_defhand (int irq, void *dev_id, struct pt_regs *fp); -static irqreturn_t default_handler(int lev, void *dev_id, struct pt_regs *regs); - - -#define DEVNAME_SIZE 24 +static int q40_irq_startup(unsigned int irq) +{ + /* test for ISA ints not implemented by HW */ + switch (irq) { + case 1: case 2: case 8: case 9: + case 11: case 12: case 13: + printk("%s: ISA IRQ %d not implemented by HW\n", __FUNCTION__, irq); + return -ENXIO; + } + return 0; +} -static struct q40_irq_node { - irqreturn_t (*handler)(int, void *, struct pt_regs *); - unsigned long flags; - void *dev_id; - /* struct q40_irq_node *next;*/ - char devname[DEVNAME_SIZE]; - unsigned count; - unsigned short state; -} irq_tab[Q40_IRQ_MAX+1]; +static void q40_irq_shutdown(unsigned int irq) +{ +} -short unsigned q40_ablecount[Q40_IRQ_MAX+1]; +static struct irq_controller q40_irq_controller = { + .name = "q40", + .lock = SPIN_LOCK_UNLOCKED, + .startup = q40_irq_startup, + .shutdown = q40_irq_shutdown, + .enable = q40_enable_irq, + .disable = q40_disable_irq, +}; /* * void q40_init_IRQ (void) @@ -74,139 +77,29 @@ short unsigned q40_ablecount[Q40_IRQ_MAX+1]; * the q40 IRQ handling routines. */ -static int disabled=0; +static int disabled; -void q40_init_IRQ (void) +void q40_init_IRQ(void) { - int i; - - disabled=0; - for (i = 0; i <= Q40_IRQ_MAX; i++) { - irq_tab[i].handler = q40_defhand; - irq_tab[i].flags = 0; - irq_tab[i].dev_id = NULL; - /* irq_tab[i].next = NULL;*/ - irq_tab[i].devname[0] = 0; - irq_tab[i].count = 0; - irq_tab[i].state =0; - q40_ablecount[i]=0; /* all enabled */ - } + m68k_setup_irq_controller(&q40_irq_controller, 1, Q40_IRQ_MAX); /* setup handler for ISA ints */ - cpu_request_irq(IRQ2, q40_irq2_handler, 0, "q40 ISA and master chip", - NULL); + m68k_setup_auto_interrupt(q40_irq_handler); + + m68k_irq_startup(IRQ_AUTO_2); + m68k_irq_startup(IRQ_AUTO_4); /* now enable some ints.. */ - master_outb(1,EXT_ENABLE_REG); /* ISA IRQ 5-15 */ + master_outb(1, EXT_ENABLE_REG); /* ISA IRQ 5-15 */ /* make sure keyboard IRQ is disabled */ - master_outb(0,KEY_IRQ_ENABLE_REG); + master_outb(0, KEY_IRQ_ENABLE_REG); } -int q40_request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - /*printk("q40_request_irq %d, %s\n",irq,devname);*/ - - if (irq > Q40_IRQ_MAX || (irq>15 && irq<32)) { - printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname); - return -ENXIO; - } - - /* test for ISA ints not implemented by HW */ - switch (irq) - { - case 1: case 2: case 8: case 9: - case 12: case 13: - printk("%s: ISA IRQ %d from %s not implemented by HW\n", __FUNCTION__, irq, devname); - return -ENXIO; - case 11: - printk("warning IRQ 10 and 11 not distinguishable\n"); - irq=10; - default: - ; - } - - if (irq<Q40_IRQ_SAMPLE) - { - if (irq_tab[irq].dev_id != NULL) - { - printk("%s: IRQ %d from %s is not replaceable\n", - __FUNCTION__, irq, irq_tab[irq].devname); - return -EBUSY; - } - /*printk("IRQ %d set to handler %p\n",irq,handler);*/ - if (dev_id==NULL) - { - printk("WARNING: dev_id == NULL in request_irq\n"); - dev_id=(void*)1; - } - irq_tab[irq].handler = handler; - irq_tab[irq].flags = flags; - irq_tab[irq].dev_id = dev_id; - strlcpy(irq_tab[irq].devname,devname,sizeof(irq_tab[irq].devname)); - irq_tab[irq].state = 0; - return 0; - } - else { - /* Q40_IRQ_SAMPLE :somewhat special actions required here ..*/ - cpu_request_irq(4, handler, flags, devname, dev_id); - cpu_request_irq(6, handler, flags, devname, dev_id); - return 0; - } -} - -void q40_free_irq(unsigned int irq, void *dev_id) -{ - if (irq > Q40_IRQ_MAX || (irq>15 && irq<32)) { - printk("%s: Incorrect IRQ %d, dev_id %x \n", __FUNCTION__, irq, (unsigned)dev_id); - return; - } - - /* test for ISA ints not implemented by HW */ - switch (irq) - { - case 1: case 2: case 8: case 9: - case 12: case 13: - printk("%s: ISA IRQ %d from %x invalid\n", __FUNCTION__, irq, (unsigned)dev_id); - return; - case 11: irq=10; - default: - ; - } - - if (irq<Q40_IRQ_SAMPLE) - { - if (irq_tab[irq].dev_id != dev_id) - printk("%s: Removing probably wrong IRQ %d from %s\n", - __FUNCTION__, irq, irq_tab[irq].devname); - - irq_tab[irq].handler = q40_defhand; - irq_tab[irq].flags = 0; - irq_tab[irq].dev_id = NULL; - /* irq_tab[irq].devname = NULL; */ - /* do not reset state !! */ - } - else - { /* == Q40_IRQ_SAMPLE */ - cpu_free_irq(4, dev_id); - cpu_free_irq(6, dev_id); - } -} - - -irqreturn_t q40_process_int (int level, struct pt_regs *fp) -{ - printk("unexpected interrupt vec=%x, pc=%lx, d0=%lx, d0_orig=%lx, d1=%lx, d2=%lx\n", - level, fp->pc, fp->d0, fp->orig_d0, fp->d1, fp->d2); - printk("\tIIRQ_REG = %x, EIRQ_REG = %x\n",master_inb(IIRQ_REG),master_inb(EIRQ_REG)); - return IRQ_HANDLED; -} /* * this stuff doesn't really belong here.. -*/ + */ int ql_ticks; /* 200Hz ticks since last jiffie */ static int sound_ticks; @@ -215,54 +108,53 @@ static int sound_ticks; void q40_mksound(unsigned int hz, unsigned int ticks) { - /* for now ignore hz, except that hz==0 switches off sound */ - /* simply alternate the ampl (128-SVOL)-(128+SVOL)-..-.. at 200Hz */ - if (hz==0) - { - if (sound_ticks) - sound_ticks=1; - - *DAC_LEFT=128; - *DAC_RIGHT=128; - - return; - } - /* sound itself is done in q40_timer_int */ - if (sound_ticks == 0) sound_ticks=1000; /* pretty long beep */ - sound_ticks=ticks<<1; + /* for now ignore hz, except that hz==0 switches off sound */ + /* simply alternate the ampl (128-SVOL)-(128+SVOL)-..-.. at 200Hz */ + if (hz == 0) { + if (sound_ticks) + sound_ticks = 1; + + *DAC_LEFT = 128; + *DAC_RIGHT = 128; + + return; + } + /* sound itself is done in q40_timer_int */ + if (sound_ticks == 0) + sound_ticks = 1000; /* pretty long beep */ + sound_ticks = ticks << 1; } static irqreturn_t (*q40_timer_routine)(int, void *, struct pt_regs *); static irqreturn_t q40_timer_int (int irq, void * dev, struct pt_regs * regs) { - ql_ticks = ql_ticks ? 0 : 1; - if (sound_ticks) - { - unsigned char sval=(sound_ticks & 1) ? 128-SVOL : 128+SVOL; - sound_ticks--; - *DAC_LEFT=sval; - *DAC_RIGHT=sval; - } - - if (!ql_ticks) - q40_timer_routine(irq, dev, regs); - return IRQ_HANDLED; + ql_ticks = ql_ticks ? 0 : 1; + if (sound_ticks) { + unsigned char sval=(sound_ticks & 1) ? 128-SVOL : 128+SVOL; + sound_ticks--; + *DAC_LEFT=sval; + *DAC_RIGHT=sval; + } + + if (!ql_ticks) + q40_timer_routine(irq, dev, regs); + return IRQ_HANDLED; } void q40_sched_init (irqreturn_t (*timer_routine)(int, void *, struct pt_regs *)) { - int timer_irq; + int timer_irq; - q40_timer_routine = timer_routine; - timer_irq=Q40_IRQ_FRAME; + q40_timer_routine = timer_routine; + timer_irq = Q40_IRQ_FRAME; - if (request_irq(timer_irq, q40_timer_int, 0, + if (request_irq(timer_irq, q40_timer_int, 0, "timer", q40_timer_int)) - panic ("Couldn't register timer int"); + panic("Couldn't register timer int"); - master_outb(-1,FRAME_CLEAR_REG); - master_outb( 1,FRAME_RATE_REG); + master_outb(-1, FRAME_CLEAR_REG); + master_outb( 1, FRAME_RATE_REG); } @@ -308,169 +200,132 @@ static int mext_disabled=0; /* ext irq disabled by master chip? */ static int aliased_irq=0; /* how many times inside handler ?*/ -/* got level 2 interrupt, dispatch to ISA or keyboard/timer IRQs */ -irqreturn_t q40_irq2_handler (int vec, void *devname, struct pt_regs *fp) +/* got interrupt, dispatch to ISA or keyboard/timer IRQs */ +static void q40_irq_handler(unsigned int irq, struct pt_regs *fp) { - unsigned mir, mer; - int irq,i; + unsigned mir, mer; + int i; //repeat: - mir=master_inb(IIRQ_REG); - if (mir&Q40_IRQ_FRAME_MASK) { - irq_tab[Q40_IRQ_FRAME].count++; - irq_tab[Q40_IRQ_FRAME].handler(Q40_IRQ_FRAME,irq_tab[Q40_IRQ_FRAME].dev_id,fp); - master_outb(-1,FRAME_CLEAR_REG); - } - if ((mir&Q40_IRQ_SER_MASK) || (mir&Q40_IRQ_EXT_MASK)) { - mer=master_inb(EIRQ_REG); - for (i=0; eirqs[i].mask; i++) { - if (mer&(eirqs[i].mask)) { - irq=eirqs[i].irq; + mir = master_inb(IIRQ_REG); +#ifdef CONFIG_BLK_DEV_FD + if ((mir & Q40_IRQ_EXT_MASK) && + (master_inb(EIRQ_REG) & Q40_IRQ6_MASK)) { + floppy_hardint(); + return; + } +#endif + switch (irq) { + case 4: + case 6: + m68k_handle_int(Q40_IRQ_SAMPLE, fp); + return; + } + if (mir & Q40_IRQ_FRAME_MASK) { + m68k_handle_int(Q40_IRQ_FRAME, fp); + master_outb(-1, FRAME_CLEAR_REG); + } + if ((mir & Q40_IRQ_SER_MASK) || (mir & Q40_IRQ_EXT_MASK)) { + mer = master_inb(EIRQ_REG); + for (i = 0; eirqs[i].mask; i++) { + if (mer & eirqs[i].mask) { + irq = eirqs[i].irq; /* * There is a little mess wrt which IRQ really caused this irq request. The * main problem is that IIRQ_REG and EIRQ_REG reflect the state when they * are read - which is long after the request came in. In theory IRQs should * not just go away but they occassionally do */ - if (irq>4 && irq<=15 && mext_disabled) { - /*aliased_irq++;*/ - goto iirq; - } - if (irq_tab[irq].handler == q40_defhand ) { - printk("handler for IRQ %d not defined\n",irq); - continue; /* ignore uninited INTs :-( */ - } - if ( irq_tab[irq].state & IRQ_INPROGRESS ) { - /* some handlers do local_irq_enable() for irq latency reasons, */ - /* however reentering an active irq handler is not permitted */ + if (irq > 4 && irq <= 15 && mext_disabled) { + /*aliased_irq++;*/ + goto iirq; + } + if (q40_state[irq] & IRQ_INPROGRESS) { + /* some handlers do local_irq_enable() for irq latency reasons, */ + /* however reentering an active irq handler is not permitted */ #ifdef IP_USE_DISABLE - /* in theory this is the better way to do it because it still */ - /* lets through eg the serial irqs, unfortunately it crashes */ - disable_irq(irq); - disabled=1; + /* in theory this is the better way to do it because it still */ + /* lets through eg the serial irqs, unfortunately it crashes */ + disable_irq(irq); + disabled = 1; #else - /*printk("IRQ_INPROGRESS detected for irq %d, disabling - %s disabled\n",irq,disabled ? "already" : "not yet"); */ - fp->sr = (((fp->sr) & (~0x700))+0x200); - disabled=1; + /*printk("IRQ_INPROGRESS detected for irq %d, disabling - %s disabled\n", + irq, disabled ? "already" : "not yet"); */ + fp->sr = (((fp->sr) & (~0x700))+0x200); + disabled = 1; #endif - goto iirq; - } - irq_tab[irq].count++; - irq_tab[irq].state |= IRQ_INPROGRESS; - irq_tab[irq].handler(irq,irq_tab[irq].dev_id,fp); - irq_tab[irq].state &= ~IRQ_INPROGRESS; - - /* naively enable everything, if that fails than */ - /* this function will be reentered immediately thus */ - /* getting another chance to disable the IRQ */ - - if ( disabled ) { + goto iirq; + } + q40_state[irq] |= IRQ_INPROGRESS; + m68k_handle_int(irq, fp); + q40_state[irq] &= ~IRQ_INPROGRESS; + + /* naively enable everything, if that fails than */ + /* this function will be reentered immediately thus */ + /* getting another chance to disable the IRQ */ + + if (disabled) { #ifdef IP_USE_DISABLE - if (irq>4){ - disabled=0; - enable_irq(irq);} + if (irq > 4) { + disabled = 0; + enable_irq(irq); + } #else - disabled=0; - /*printk("reenabling irq %d\n",irq); */ + disabled = 0; + /*printk("reenabling irq %d\n", irq); */ #endif - } + } // used to do 'goto repeat;' here, this delayed bh processing too long - return IRQ_HANDLED; - } - } - if (mer && ccleirq>0 && !aliased_irq) - printk("ISA interrupt from unknown source? EIRQ_REG = %x\n",mer),ccleirq--; - } - iirq: - mir=master_inb(IIRQ_REG); - /* should test whether keyboard irq is really enabled, doing it in defhand */ - if (mir&Q40_IRQ_KEYB_MASK) { - irq_tab[Q40_IRQ_KEYBOARD].count++; - irq_tab[Q40_IRQ_KEYBOARD].handler(Q40_IRQ_KEYBOARD,irq_tab[Q40_IRQ_KEYBOARD].dev_id,fp); - } - return IRQ_HANDLED; -} - -int show_q40_interrupts (struct seq_file *p, void *v) -{ - int i; - - for (i = 0; i <= Q40_IRQ_MAX; i++) { - if (irq_tab[i].count) - seq_printf(p, "%sIRQ %02d: %8d %s%s\n", - (i<=15) ? "ISA-" : " " , - i, irq_tab[i].count, - irq_tab[i].devname[0] ? irq_tab[i].devname : "?", - irq_tab[i].handler == q40_defhand ? - " (now unassigned)" : ""); + return; + } + } + if (mer && ccleirq > 0 && !aliased_irq) { + printk("ISA interrupt from unknown source? EIRQ_REG = %x\n",mer); + ccleirq--; + } } - return 0; -} - + iirq: + mir = master_inb(IIRQ_REG); + /* should test whether keyboard irq is really enabled, doing it in defhand */ + if (mir & Q40_IRQ_KEYB_MASK) + m68k_handle_int(Q40_IRQ_KEYBOARD, fp); -static irqreturn_t q40_defhand (int irq, void *dev_id, struct pt_regs *fp) -{ - if (irq!=Q40_IRQ_KEYBOARD) - printk ("Unknown q40 interrupt %d\n", irq); - else master_outb(-1,KEYBOARD_UNLOCK_REG); - return IRQ_NONE; + return; } -static irqreturn_t default_handler(int lev, void *dev_id, struct pt_regs *regs) -{ - printk ("Uninitialised interrupt level %d\n", lev); - return IRQ_NONE; -} - -irqreturn_t (*q40_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { - [0] = default_handler, - [1] = default_handler, - [2] = default_handler, - [3] = default_handler, - [4] = default_handler, - [5] = default_handler, - [6] = default_handler, - [7] = default_handler -}; - -void q40_enable_irq (unsigned int irq) +void q40_enable_irq(unsigned int irq) { - if ( irq>=5 && irq<=15 ) - { - mext_disabled--; - if (mext_disabled>0) - printk("q40_enable_irq : nested disable/enable\n"); - if (mext_disabled==0) - master_outb(1,EXT_ENABLE_REG); - } + if (irq >= 5 && irq <= 15) { + mext_disabled--; + if (mext_disabled > 0) + printk("q40_enable_irq : nested disable/enable\n"); + if (mext_disabled == 0) + master_outb(1, EXT_ENABLE_REG); + } } -void q40_disable_irq (unsigned int irq) +void q40_disable_irq(unsigned int irq) { - /* disable ISA iqs : only do something if the driver has been - * verified to be Q40 "compatible" - right now IDE, NE2K - * Any driver should not attempt to sleep across disable_irq !! - */ - - if ( irq>=5 && irq<=15 ) { - master_outb(0,EXT_ENABLE_REG); - mext_disabled++; - if (mext_disabled>1) printk("disable_irq nesting count %d\n",mext_disabled); - } + /* disable ISA iqs : only do something if the driver has been + * verified to be Q40 "compatible" - right now IDE, NE2K + * Any driver should not attempt to sleep across disable_irq !! + */ + + if (irq >= 5 && irq <= 15) { + master_outb(0, EXT_ENABLE_REG); + mext_disabled++; + if (mext_disabled > 1) + printk("disable_irq nesting count %d\n",mext_disabled); + } } -unsigned long q40_probe_irq_on (void) +unsigned long q40_probe_irq_on(void) { - printk("irq probing not working - reconfigure the driver to avoid this\n"); - return -1; + printk("irq probing not working - reconfigure the driver to avoid this\n"); + return -1; } -int q40_probe_irq_off (unsigned long irqs) +int q40_probe_irq_off(unsigned long irqs) { - return -1; + return -1; } -/* - * Local variables: - * compile-command: "m68k-linux-gcc -D__KERNEL__ -I/home/rz/lx/linux-2.2.6/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -ffixed-a2 -m68040 -c -o q40ints.o q40ints.c" - * End: - */ diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c index f1ca0dfbaa67..d09d03b3d956 100644 --- a/arch/m68k/sun3/config.c +++ b/arch/m68k/sun3/config.c @@ -8,7 +8,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -36,7 +35,6 @@ extern char _text, _end; char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; extern unsigned long sun3_gettimeoffset(void); -extern int show_sun3_interrupts (struct seq_file *, void *); extern void sun3_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); extern void sun3_get_model (char* model); extern void idprom_init (void); @@ -147,13 +145,6 @@ void __init config_sun3(void) mach_sched_init = sun3_sched_init; mach_init_IRQ = sun3_init_IRQ; - mach_default_handler = &sun3_default_handler; - mach_request_irq = sun3_request_irq; - mach_free_irq = sun3_free_irq; - enable_irq = sun3_enable_irq; - disable_irq = sun3_disable_irq; - mach_process_int = sun3_process_int; - mach_get_irq_list = show_sun3_interrupts; mach_reset = sun3_reboot; mach_gettimeoffset = sun3_gettimeoffset; mach_get_model = sun3_get_model; diff --git a/arch/m68k/sun3/prom/init.c b/arch/m68k/sun3/prom/init.c index 2e6ae56aec12..202adfcc316e 100644 --- a/arch/m68k/sun3/prom/init.c +++ b/arch/m68k/sun3/prom/init.c @@ -5,7 +5,6 @@ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c index e6ee1006344e..e7bfde377b5e 100644 --- a/arch/m68k/sun3/prom/printf.c +++ b/arch/m68k/sun3/prom/printf.c @@ -8,7 +8,6 @@ * about or use it! It's simple and smelly anyway.... */ -#include <linux/config.h> #include <linux/kernel.h> #include <asm/openprom.h> diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c index f04a1d25f1a2..6c265222cbcd 100644 --- a/arch/m68k/sun3/sun3dvma.c +++ b/arch/m68k/sun3/sun3dvma.c @@ -6,7 +6,6 @@ * Contains common routines for sun3/sun3x DVMA management. */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/list.h> @@ -119,8 +118,7 @@ static inline int refill(void) if(hole->end == prev->start) { hole->size += prev->size; hole->end = prev->end; - list_del(&(prev->list)); - list_add(&(prev->list), &hole_cache); + list_move(&(prev->list), &hole_cache); ret++; } @@ -182,8 +180,7 @@ static inline unsigned long get_baddr(int len, unsigned long align) #endif return hole->end; } else if(hole->size == newlen) { - list_del(&(hole->list)); - list_add(&(hole->list), &hole_cache); + list_move(&(hole->list), &hole_cache); dvma_entry_use(hole->start) = newlen; #ifdef DVMA_DEBUG dvma_allocs++; diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c index e62a033cd493..f18b9d3ef16d 100644 --- a/arch/m68k/sun3/sun3ints.c +++ b/arch/m68k/sun3/sun3ints.c @@ -6,7 +6,6 @@ * for more details. */ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -19,7 +18,6 @@ #include <linux/seq_file.h> extern void sun3_leds (unsigned char); -static irqreturn_t sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp); void sun3_disable_interrupts(void) { @@ -40,48 +38,30 @@ int led_pattern[8] = { volatile unsigned char* sun3_intreg; -void sun3_insert_irq(irq_node_t **list, irq_node_t *node) -{ -} - -void sun3_delete_irq(irq_node_t **list, void *dev_id) -{ -} - void sun3_enable_irq(unsigned int irq) { - *sun3_intreg |= (1<<irq); + *sun3_intreg |= (1 << irq); } void sun3_disable_irq(unsigned int irq) { - *sun3_intreg &= ~(1<<irq); -} - -inline void sun3_do_irq(int irq, struct pt_regs *fp) -{ - kstat_cpu(0).irqs[SYS_IRQS + irq]++; - *sun3_intreg &= ~(1<<irq); - *sun3_intreg |= (1<<irq); + *sun3_intreg &= ~(1 << irq); } static irqreturn_t sun3_int7(int irq, void *dev_id, struct pt_regs *fp) { - sun3_do_irq(irq,fp); - if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 2000)) - sun3_leds(led_pattern[(kstat_cpu(0).irqs[SYS_IRQS+irq]%16000) - /2000]); + *sun3_intreg |= (1 << irq); + if (!(kstat_cpu(0).irqs[irq] % 2000)) + sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 16000) / 2000]); return IRQ_HANDLED; } static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp) { - kstat_cpu(0).irqs[SYS_IRQS + irq]++; #ifdef CONFIG_SUN3 intersil_clear(); #endif - *sun3_intreg &= ~(1<<irq); - *sun3_intreg |= (1<<irq); + *sun3_intreg |= (1 << irq); #ifdef CONFIG_SUN3 intersil_clear(); #endif @@ -89,65 +69,8 @@ static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp) #ifndef CONFIG_SMP update_process_times(user_mode(fp)); #endif - if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 20)) - sun3_leds(led_pattern[(kstat_cpu(0).irqs[SYS_IRQS+irq]%160) - /20]); - return IRQ_HANDLED; -} - -/* handle requested ints, excepting 5 and 7, which always do the same - thing */ -irqreturn_t (*sun3_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { - [0] = sun3_inthandle, - [1] = sun3_inthandle, - [2] = sun3_inthandle, - [3] = sun3_inthandle, - [4] = sun3_inthandle, - [5] = sun3_int5, - [6] = sun3_inthandle, - [7] = sun3_int7 -}; - -static const char *dev_names[SYS_IRQS] = { - [5] = "timer", - [7] = "int7 handler" -}; -static void *dev_ids[SYS_IRQS]; -static irqreturn_t (*sun3_inthandler[SYS_IRQS])(int, void *, struct pt_regs *) = { - [5] = sun3_int5, - [7] = sun3_int7 -}; -static irqreturn_t (*sun3_vechandler[SUN3_INT_VECS])(int, void *, struct pt_regs *); -static void *vec_ids[SUN3_INT_VECS]; -static const char *vec_names[SUN3_INT_VECS]; -static int vec_ints[SUN3_INT_VECS]; - - -int show_sun3_interrupts(struct seq_file *p, void *v) -{ - int i; - - for(i = 0; i < (SUN3_INT_VECS-1); i++) { - if(sun3_vechandler[i] != NULL) { - seq_printf(p, "vec %3d: %10u %s\n", i+64, - vec_ints[i], - (vec_names[i]) ? vec_names[i] : - "sun3_vechandler"); - } - } - - return 0; -} - -static irqreturn_t sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp) -{ - if(sun3_inthandler[irq] == NULL) - panic ("bad interrupt %d received (id %p)\n",irq, dev_id); - - kstat_cpu(0).irqs[SYS_IRQS + irq]++; - *sun3_intreg &= ~(1<<irq); - - sun3_inthandler[irq](irq, dev_ids[irq], fp); + if (!(kstat_cpu(0).irqs[irq] % 20)) + sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]); return IRQ_HANDLED; } @@ -157,109 +80,31 @@ static irqreturn_t sun3_vec255(int irq, void *dev_id, struct pt_regs *fp) return IRQ_HANDLED; } -void sun3_init_IRQ(void) +static void sun3_inthandle(unsigned int irq, struct pt_regs *fp) { - int i; - - *sun3_intreg = 1; - - for(i = 0; i < SYS_IRQS; i++) - { - if(dev_names[i]) - cpu_request_irq(i, sun3_default_handler[i], 0, - dev_names[i], NULL); - } - - for(i = 0; i < 192; i++) - sun3_vechandler[i] = NULL; - - sun3_vechandler[191] = sun3_vec255; -} - -int sun3_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), - unsigned long flags, const char *devname, void *dev_id) -{ - - if(irq < SYS_IRQS) { - if(sun3_inthandler[irq] != NULL) { - printk("sun3_request_irq: request for irq %d -- already taken!\n", irq); - return 1; - } - - sun3_inthandler[irq] = handler; - dev_ids[irq] = dev_id; - dev_names[irq] = devname; - - /* setting devname would be nice */ - cpu_request_irq(irq, sun3_default_handler[irq], 0, devname, - NULL); - - return 0; - } else { - if((irq >= 64) && (irq <= 255)) { - int vec; - - vec = irq - 64; - if(sun3_vechandler[vec] != NULL) { - printk("sun3_request_irq: request for vec %d -- already taken!\n", irq); - return 1; - } - - sun3_vechandler[vec] = handler; - vec_ids[vec] = dev_id; - vec_names[vec] = devname; - vec_ints[vec] = 0; - - return 0; - } - } - - printk("sun3_request_irq: invalid irq %d\n", irq); - return 1; + *sun3_intreg &= ~(1 << irq); + m68k_handle_int(irq, fp); } -void sun3_free_irq(unsigned int irq, void *dev_id) -{ - - if(irq < SYS_IRQS) { - if(sun3_inthandler[irq] == NULL) - panic("sun3_free_int: attempt to free unused irq %d\n", irq); - if(dev_ids[irq] != dev_id) - panic("sun3_free_int: incorrect dev_id for irq %d\n", irq); - - sun3_inthandler[irq] = NULL; - return; - } else if((irq >= 64) && (irq <= 255)) { - int vec; - - vec = irq - 64; - if(sun3_vechandler[vec] == NULL) - panic("sun3_free_int: attempt to free unused vector %d\n", irq); - if(vec_ids[irq] != dev_id) - panic("sun3_free_int: incorrect dev_id for vec %d\n", irq); - - sun3_vechandler[vec] = NULL; - return; - } else { - panic("sun3_free_irq: invalid irq %d\n", irq); - } -} +static struct irq_controller sun3_irq_controller = { + .name = "sun3", + .lock = SPIN_LOCK_UNLOCKED, + .startup = m68k_irq_startup, + .shutdown = m68k_irq_shutdown, + .enable = sun3_enable_irq, + .disable = sun3_disable_irq, +}; -irqreturn_t sun3_process_int(int irq, struct pt_regs *regs) +void sun3_init_IRQ(void) { + *sun3_intreg = 1; - if((irq >= 64) && (irq <= 255)) { - int vec; - - vec = irq - 64; - if(sun3_vechandler[vec] == NULL) - panic ("bad interrupt vector %d received\n",irq); + m68k_setup_auto_interrupt(sun3_inthandle); + m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7); + m68k_setup_user_interrupt(VEC_USER, 192, NULL); - vec_ints[vec]++; - return sun3_vechandler[vec](irq, vec_ids[vec], regs); - } else { - panic("sun3_process_int: unable to handle interrupt vector %d\n", - irq); - } + request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL); + request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL); + request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL); } diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c index 0920f5d33606..987891783a47 100644 --- a/arch/m68k/sun3x/config.c +++ b/arch/m68k/sun3x/config.c @@ -6,7 +6,6 @@ * based on code from Oliver Jowett <oliver@jowett.manawatu.gen.nz> */ -#include <linux/config.h> #include <linux/types.h> #include <linux/mm.h> #include <linux/console.h> @@ -52,17 +51,10 @@ void __init config_sun3x(void) sun3x_prom_init(); - mach_get_irq_list = show_sun3_interrupts; mach_max_dma_address = 0xffffffff; /* we can DMA anywhere, whee */ - mach_default_handler = &sun3_default_handler; mach_sched_init = sun3x_sched_init; mach_init_IRQ = sun3_init_IRQ; - enable_irq = sun3_enable_irq; - disable_irq = sun3_disable_irq; - mach_request_irq = sun3_request_irq; - mach_free_irq = sun3_free_irq; - mach_process_int = sun3_process_int; mach_gettimeoffset = sun3x_gettimeoffset; mach_reset = sun3x_reboot; diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig index 3cde6822ead1..e767f2ddae72 100644 --- a/arch/m68knommu/Kconfig +++ b/arch/m68knommu/Kconfig @@ -5,7 +5,7 @@ mainmenu "uClinux/68k (w/o MMU) Kernel Configuration" -config M68KNOMMU +config M68K bool default y @@ -119,6 +119,11 @@ config M5307 help Motorola ColdFire 5307 processor support. +config M532x + bool "MCF532x" + help + Freescale (Motorola) ColdFire 532x processor support. + config M5407 bool "MCF5407" help @@ -133,125 +138,43 @@ config M527x config COLDFIRE bool - depends on (M5206 || M5206e || M520x || M523x || M5249 || M527x || M5272 || M528x || M5307 || M5407) + depends on (M5206 || M5206e || M520x || M523x || M5249 || M527x || M5272 || M528x || M5307 || M532x || M5407) default y -choice - prompt "CPU CLOCK Frequency" - default AUTO - -config CLOCK_AUTO - bool "AUTO" - ---help--- - Define the CPU clock frequency in use. On many boards you don't - really need to know, so you can select the AUTO option. On some - boards you need to know the real clock frequency to determine other - system timing (for example baud rate dividors, etc). Some processors - have an internal PLL and you can select a frequency to run at. - You need to know a little about the internals of your processor to - set this. If in doubt choose the AUTO option. - -config CLOCK_11MHz - bool "11MHz" - help - Select a 11MHz CPU clock frequency. - -config CLOCK_16MHz - bool "16MHz" - help - Select a 16MHz CPU clock frequency. - -config CLOCK_20MHz - bool "20MHz" - help - Select a 20MHz CPU clock frequency. - -config CLOCK_24MHz - bool "24MHz" - help - Select a 24MHz CPU clock frequency. - -config CLOCK_25MHz - bool "25MHz" - help - Select a 25MHz CPU clock frequency. - -config CLOCK_33MHz - bool "33MHz" - help - Select a 33MHz CPU clock frequency. - -config CLOCK_40MHz - bool "40MHz" - help - Select a 40MHz CPU clock frequency. - -config CLOCK_45MHz - bool "45MHz" - help - Select a 45MHz CPU clock frequency. - -config CLOCK_48MHz - bool "48MHz" - help - Select a 48MHz CPU clock frequency. - -config CLOCK_50MHz - bool "50MHz" - help - Select a 50MHz CPU clock frequency. - -config CLOCK_54MHz - bool "54MHz" - help - Select a 54MHz CPU clock frequency. - -config CLOCK_60MHz - bool "60MHz" - help - Select a 60MHz CPU clock frequency. - -config CLOCK_62_5MHz - bool "62.5MHz" - help - Select a 62.5MHz CPU clock frequency. - -config CLOCK_64MHz - bool "64MHz" - help - Select a 64MHz CPU clock frequency. - -config CLOCK_66MHz - bool "66MHz" - help - Select a 66MHz CPU clock frequency. - -config CLOCK_70MHz - bool "70MHz" - help - Select a 70MHz CPU clock frequency. - -config CLOCK_100MHz - bool "100MHz" - help - Select a 100MHz CPU clock frequency. - -config CLOCK_140MHz - bool "140MHz" - help - Select a 140MHz CPU clock frequency. - -config CLOCK_150MHz - bool "150MHz" - help - Select a 150MHz CPU clock frequency. - -config CLOCK_166MHz - bool "166MHz" +config CLOCK_SET + bool "Enable setting the CPU clock frequency" + default n help - Select a 166MHz CPU clock frequency. - -endchoice + On some CPU's you do not need to know what the core CPU clock + frequency is. On these you can disable clock setting. On some + traditional 68K parts, and on all ColdFire parts you need to set + the appropriate CPU clock frequency. On these devices many of the + onboard peripherals derive their timing from the master CPU clock + frequency. + +config CLOCK_FREQ + int "Set the core clock frequency" + default "66666666" + depends on CLOCK_SET + help + Define the CPU clock frequency in use. This is the core clock + frequency, it may or may not be the same as the external clock + crystal fitted to your board. Some processors have an internal + PLL and can have their frequency programmed at run time, others + use internal dividers. In gernal the kernel won't setup a PLL + if it is fitted (there are some expections). This value will be + specific to the exact CPU that you are using. + +config CLOCK_DIV + int "Set the core/bus clock divide ratio" + default "1" + depends on CLOCK_SET + help + On many SoC style CPUs the master CPU clock is also used to drive + on-chip peripherals. The clock that is distributed to these + peripherals is sometimes a fixed ratio of the master clock + frequency. If so then set this to the divider ration of the + master clock to the peripheral clock. If not sure then select 1. config OLDMASK bool "Old mask 5307 (1H55J) silicon" @@ -377,6 +300,12 @@ config COBRA5272 help Support for the senTec COBRA5272 board. +config AVNET5282 + bool "Avnet 5282 board support" + depends on M528x + help + Support for the Avnet 5282 board. + config M5282EVB bool "Motorola M5282EVB board support" depends on M528x @@ -419,6 +348,18 @@ config SECUREEDGEMP3 help Support for the SnapGear SecureEdge/MP3 platform. +config M5329EVB + bool "Freescale (Motorola) M5329EVB board support" + depends on M532x + help + Support for the Freescale (Motorola) M5329EVB board. + +config COBRA5329 + bool "senTec COBRA5329 board support" + depends on M532x + help + Support for the senTec COBRA5329 board. + config M5407C3 bool "Motorola M5407C3 board support" depends on M5407 @@ -487,7 +428,7 @@ config ARNEWSH config FREESCALE bool default y - depends on (M5206eC3 || M5208EVB || M5235EVB || M5249C3 || M5271EVB || M5272C3 || M5275EVB || M5282EVB || M5307C3 || M5407C3) + depends on (M5206eC3 || M5208EVB || M5235EVB || M5249C3 || M5271EVB || M5272C3 || M5275EVB || M5282EVB || M5307C3 || M5329EVB || M5407C3) config HW_FEITH bool @@ -508,6 +449,11 @@ config SNEHA bool default y depends on CPU16B + +config AVNET + bool + default y + depends on (AVNET5282) config LARGE_ALLOCS bool "Allow allocating large blocks (> 1MB) of memory" @@ -526,38 +472,46 @@ config 4KSTACKS running more threads on a system and also reduces the pressure on the VM subsystem for higher order allocations. -choice - prompt "RAM size" - default AUTO - -config RAMAUTO - bool "AUTO" - ---help--- - Configure the RAM size on your platform. Many platforms can auto - detect this, on those choose the AUTO option. Otherwise set the - RAM size you intend using. +comment "RAM configuration" -config RAM4MB - bool "4MiB" +config RAMBASE + hex "Address of the base of RAM" + default "0" help - Set RAM size to be 4MiB. + Define the address that RAM starts at. On many platforms this is + 0, the base of the address space. And this is the default. Some + platforms choose to setup their RAM at other addresses within the + processor address space. -config RAM8MB - bool "8MiB" +config RAMSIZE + hex "Size of RAM (in bytes)" + default "0x400000" help - Set RAM size to be 8MiB. + Define the size of the system RAM. If you select 0 then the + kernel will try to probe the RAM size at runtime. This is not + supported on all CPU types. -config RAM16MB - bool "16MiB" +config VECTORBASE + hex "Address of the base of system vectors" + default "0" help - Set RAM size to be 16MiB. + Define the address of the the system vectors. Commonly this is + put at the start of RAM, but it doesn't have to be. On ColdFire + platforms this address is programmed into the VBR register, thus + actually setting the address to use. -config RAM32MB - bool "32MiB" +config KERNELBASE + hex "Address of the base of kernel code" + default "0x400" help - Set RAM size to be 32MiB. - -endchoice + Typically on m68k systems the kernel will not start at the base + of RAM, but usually some small offset from it. Define the start + address of the kernel here. The most common setup will have the + processor vectors at the base of RAM and then the start of the + kernel. On some platforms some RAM is reserved for boot loaders + and the kernel starts after that. The 0x400 default was based on + a system with the RAM based at address 0, and leaving enough room + for the theoretical maximum number of 256 vectors. choice prompt "RAM bus width" @@ -565,7 +519,7 @@ choice config RAMAUTOBIT bool "AUTO" - ---help--- + help Select the physical RAM data bus size. Not needed on most platforms, so you can generally choose AUTO. @@ -586,6 +540,59 @@ config RAM32BIT endchoice +comment "ROM configuration" + +config ROM + bool "Specify ROM linker regions" + default n + help + Define a ROM region for the linker script. This creates a kernel + that can be stored in flash, with possibly the text, and data + regions being copied out to RAM at startup. + +config ROMBASE + hex "Address of the base of ROM device" + default "0" + depends on ROM + help + Define the address that the ROM region starts at. Some platforms + use this to set their chip select region accordingly for the boot + device. + +config ROMVEC + hex "Address of the base of the ROM vectors" + default "0" + depends on ROM + help + This is almost always the same as the base of the ROM. Since on all + 68000 type varients the vectors are at the base of the boot device + on system startup. + +config ROMVECSIZE + hex "Size of ROM vector region (in bytes)" + default "0x400" + depends on ROM + help + Define the size of the vector region in ROM. For most 68000 + varients this would be 0x400 bytes in size. Set to 0 if you do + not want a vector region at the start of the ROM. + +config ROMSTART + hex "Address of the base of system image in ROM" + default "0x400" + depends on ROM + help + Define the start address of the system image in ROM. Commonly this + is strait after the ROM vectors. + +config ROMSIZE + hex "Size of the ROM device" + default "0x100000" + depends on ROM + help + Size of the ROM device. On some platforms this is used to setup + the chip select that controls the boot ROM device. + choice prompt "Kernel executes from" ---help--- @@ -599,7 +606,9 @@ config RAMKERNEL config ROMKERNEL bool "ROM" help - The kernel will be resident in FLASH/ROM when running. + The kernel will be resident in FLASH/ROM when running. This is + often referred to as Execute-in-Place (XIP), since the kernel + code executes from the position it is stored in the FLASH/ROM. endchoice diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile index 6f880cbff1c8..8951793fd8d4 100644 --- a/arch/m68knommu/Makefile +++ b/arch/m68knommu/Makefile @@ -21,6 +21,7 @@ platform-$(CONFIG_M527x) := 527x platform-$(CONFIG_M5272) := 5272 platform-$(CONFIG_M528x) := 528x platform-$(CONFIG_M5307) := 5307 +platform-$(CONFIG_M532x) := 532x platform-$(CONFIG_M5407) := 5407 PLATFORM := $(platform-y) @@ -44,6 +45,7 @@ board-$(CONFIG_senTec) := senTec board-$(CONFIG_SNEHA) := SNEHA board-$(CONFIG_M5208EVB) := M5208EVB board-$(CONFIG_MOD5272) := MOD5272 +board-$(CONFIG_AVNET) := AVNET BOARD := $(board-y) model-$(CONFIG_RAMKERNEL) := ram @@ -65,6 +67,7 @@ cpuclass-$(CONFIG_M527x) := 5307 cpuclass-$(CONFIG_M5272) := 5307 cpuclass-$(CONFIG_M528x) := 5307 cpuclass-$(CONFIG_M5307) := 5307 +cpuclass-$(CONFIG_M532x) := 5307 cpuclass-$(CONFIG_M5407) := 5307 cpuclass-$(CONFIG_M68328) := 68328 cpuclass-$(CONFIG_M68EZ328) := 68328 @@ -81,16 +84,17 @@ export PLATFORM BOARD MODEL CPUCLASS # # Some CFLAG additions based on specific CPU type. # -cflags-$(CONFIG_M5206) := -m5200 -Wa,-S -Wa,-m5200 -cflags-$(CONFIG_M5206e) := -m5200 -Wa,-S -Wa,-m5200 -cflags-$(CONFIG_M520x) := -m5307 -Wa,-S -Wa,-m5307 -cflags-$(CONFIG_M523x) := -m5307 -Wa,-S -Wa,-m5307 -cflags-$(CONFIG_M5249) := -m5200 -Wa,-S -Wa,-m5200 -cflags-$(CONFIG_M527x) := -m5307 -Wa,-S -Wa,-m5307 -cflags-$(CONFIG_M5272) := -m5307 -Wa,-S -Wa,-m5307 -cflags-$(CONFIG_M528x) := -m5307 -Wa,-S -Wa,-m5307 -cflags-$(CONFIG_M5307) := -m5307 -Wa,-S -Wa,-m5307 -cflags-$(CONFIG_M5407) := -m5200 -Wa,-S -Wa,-m5200 +cflags-$(CONFIG_M5206) := -m5200 +cflags-$(CONFIG_M5206e) := -m5200 +cflags-$(CONFIG_M520x) := -m5307 +cflags-$(CONFIG_M523x) := -m5307 +cflags-$(CONFIG_M5249) := -m5200 +cflags-$(CONFIG_M527x) := -m5307 +cflags-$(CONFIG_M5272) := -m5307 +cflags-$(CONFIG_M528x) := -m5307 +cflags-$(CONFIG_M5307) := -m5307 +cflags-$(CONFIG_M532x) := -m5307 +cflags-$(CONFIG_M5407) := -m5200 cflags-$(CONFIG_M68328) := -m68000 cflags-$(CONFIG_M68EZ328) := -m68000 cflags-$(CONFIG_M68VZ328) := -m68000 diff --git a/arch/m68knommu/defconfig b/arch/m68knommu/defconfig index 2d59ba1a79ba..3891de09ac23 100644 --- a/arch/m68knommu/defconfig +++ b/arch/m68knommu/defconfig @@ -1,21 +1,22 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.13-uc0 -# Wed Aug 31 15:03:26 2005 +# Linux kernel version: 2.6.17 +# Tue Jun 27 12:57:06 2006 # -CONFIG_M68KNOMMU=y +CONFIG_M68K=y # CONFIG_MMU is not set # CONFIG_FPU is not set -CONFIG_UID16=y CONFIG_RWSEM_GENERIC_SPINLOCK=y # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_HWEIGHT=y CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_TIME_LOW_RES=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y -CONFIG_CLEAN_COMPILE=y CONFIG_BROKEN_ON_SMP=y CONFIG_INIT_ENV_ARG_LIMIT=32 @@ -23,26 +24,30 @@ CONFIG_INIT_ENV_ARG_LIMIT=32 # General setup # CONFIG_LOCALVERSION="" +CONFIG_LOCALVERSION_AUTO=y +# CONFIG_SYSVIPC is not set # CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set # CONFIG_SYSCTL is not set # CONFIG_AUDIT is not set -# CONFIG_HOTPLUG is not set -# CONFIG_KOBJECT_UEVENT is not set # CONFIG_IKCONFIG is not set +# CONFIG_RELAY is not set +CONFIG_INITRAMFS_SOURCE="" +CONFIG_UID16=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_EMBEDDED=y # CONFIG_KALLSYMS is not set +# CONFIG_HOTPLUG is not set CONFIG_PRINTK=y CONFIG_BUG=y +CONFIG_ELF_CORE=y CONFIG_BASE_FULL=y # CONFIG_FUTEX is not set # CONFIG_EPOLL is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_CC_ALIGN_FUNCTIONS=0 -CONFIG_CC_ALIGN_LABELS=0 -CONFIG_CC_ALIGN_LOOPS=0 -CONFIG_CC_ALIGN_JUMPS=0 +CONFIG_SLAB=y +CONFIG_TINY_SHMEM=y CONFIG_BASE_SMALL=0 +# CONFIG_SLOB is not set # # Loadable module support @@ -50,6 +55,24 @@ CONFIG_BASE_SMALL=0 # CONFIG_MODULES is not set # +# Block layer +# +# CONFIG_BLK_DEV_IO_TRACE is not set + +# +# IO Schedulers +# +CONFIG_IOSCHED_NOOP=y +# CONFIG_IOSCHED_AS is not set +# CONFIG_IOSCHED_DEADLINE is not set +# CONFIG_IOSCHED_CFQ is not set +# CONFIG_DEFAULT_AS is not set +# CONFIG_DEFAULT_DEADLINE is not set +# CONFIG_DEFAULT_CFQ is not set +CONFIG_DEFAULT_NOOP=y +CONFIG_DEFAULT_IOSCHED="noop" + +# # Processor type and features # # CONFIG_M68328 is not set @@ -58,6 +81,7 @@ CONFIG_BASE_SMALL=0 # CONFIG_M68360 is not set # CONFIG_M5206 is not set # CONFIG_M5206e is not set +# CONFIG_M520x is not set # CONFIG_M523x is not set # CONFIG_M5249 is not set # CONFIG_M5271 is not set @@ -65,29 +89,12 @@ CONFIG_M5272=y # CONFIG_M5275 is not set # CONFIG_M528x is not set # CONFIG_M5307 is not set +# CONFIG_M532x is not set # CONFIG_M5407 is not set CONFIG_COLDFIRE=y -# CONFIG_CLOCK_AUTO is not set -# CONFIG_CLOCK_11MHz is not set -# CONFIG_CLOCK_16MHz is not set -# CONFIG_CLOCK_20MHz is not set -# CONFIG_CLOCK_24MHz is not set -# CONFIG_CLOCK_25MHz is not set -# CONFIG_CLOCK_33MHz is not set -# CONFIG_CLOCK_40MHz is not set -# CONFIG_CLOCK_45MHz is not set -# CONFIG_CLOCK_48MHz is not set -# CONFIG_CLOCK_50MHz is not set -# CONFIG_CLOCK_54MHz is not set -# CONFIG_CLOCK_60MHz is not set -# CONFIG_CLOCK_62_5MHz is not set -# CONFIG_CLOCK_64MHz is not set -CONFIG_CLOCK_66MHz=y -# CONFIG_CLOCK_70MHz is not set -# CONFIG_CLOCK_100MHz is not set -# CONFIG_CLOCK_140MHz is not set -# CONFIG_CLOCK_150MHz is not set -# CONFIG_CLOCK_166MHz is not set +CONFIG_CLOCK_SET=y +CONFIG_CLOCK_FREQ=66666666 +CONFIG_CLOCK_DIV=1 # # Platform @@ -102,11 +109,14 @@ CONFIG_M5272C3=y CONFIG_FREESCALE=y # CONFIG_LARGE_ALLOCS is not set CONFIG_4KSTACKS=y -CONFIG_RAMAUTO=y -# CONFIG_RAM4MB is not set -# CONFIG_RAM8MB is not set -# CONFIG_RAM16MB is not set -# CONFIG_RAM32MB is not set + +# +# RAM configuration +# +CONFIG_RAMBASE=0x0 +CONFIG_RAMSIZE=0x800000 +CONFIG_VECTORBASE=0x0 +CONFIG_KERNELBASE=0x20000 CONFIG_RAMAUTOBIT=y # CONFIG_RAM8BIT is not set # CONFIG_RAM16BIT is not set @@ -119,6 +129,8 @@ CONFIG_FLATMEM_MANUAL=y # CONFIG_SPARSEMEM_MANUAL is not set CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y +# CONFIG_SPARSEMEM_STATIC is not set +CONFIG_SPLIT_PTLOCK_CPUS=4 # # Bus options (PCI, PCMCIA, EISA, MCA, ISA) @@ -140,6 +152,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y CONFIG_BINFMT_FLAT=y # CONFIG_BINFMT_ZFLAT is not set # CONFIG_BINFMT_SHARED_FLAT is not set +# CONFIG_BINFMT_AOUT is not set # CONFIG_BINFMT_MISC is not set # @@ -155,6 +168,7 @@ CONFIG_NET=y # # Networking options # +# CONFIG_NETDEBUG is not set CONFIG_PACKET=y # CONFIG_PACKET_MMAP is not set CONFIG_UNIX=y @@ -171,18 +185,30 @@ CONFIG_IP_FIB_HASH=y # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set +# CONFIG_INET_XFRM_TUNNEL is not set # CONFIG_INET_TUNNEL is not set -# CONFIG_IP_TCPDIAG is not set -# CONFIG_IP_TCPDIAG_IPV6 is not set +# CONFIG_INET_DIAG is not set # CONFIG_TCP_CONG_ADVANCED is not set CONFIG_TCP_CONG_BIC=y # CONFIG_IPV6 is not set +# CONFIG_INET6_XFRM_TUNNEL is not set +# CONFIG_INET6_TUNNEL is not set # CONFIG_NETFILTER is not set # +# DCCP Configuration (EXPERIMENTAL) +# +# CONFIG_IP_DCCP is not set + +# # SCTP Configuration (EXPERIMENTAL) # # CONFIG_IP_SCTP is not set + +# +# TIPC Configuration (EXPERIMENTAL) +# +# CONFIG_TIPC is not set # CONFIG_ATM is not set # CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set @@ -195,8 +221,11 @@ CONFIG_TCP_CONG_BIC=y # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set + +# +# QoS and/or fair queueing +# # CONFIG_NET_SCHED is not set -# CONFIG_NET_CLS_ROUTE is not set # # Network testing @@ -205,6 +234,7 @@ CONFIG_TCP_CONG_BIC=y # CONFIG_HAMRADIO is not set # CONFIG_IRDA is not set # CONFIG_BT is not set +# CONFIG_IEEE80211 is not set # # Device Drivers @@ -218,6 +248,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y # CONFIG_FW_LOADER is not set # +# Connector - unified userspace <-> kernelspace linker +# +# CONFIG_CONNECTOR is not set + +# # Memory Technology Devices (MTD) # CONFIG_MTD=y @@ -235,6 +270,7 @@ CONFIG_MTD_BLOCK=y # CONFIG_FTL is not set # CONFIG_NFTL is not set # CONFIG_INFTL is not set +# CONFIG_RFD_FTL is not set # # RAM/ROM/Flash chip drivers @@ -254,13 +290,13 @@ CONFIG_MTD_CFI_I2=y CONFIG_MTD_RAM=y # CONFIG_MTD_ROM is not set # CONFIG_MTD_ABSENT is not set +# CONFIG_MTD_OBSOLETE_CHIPS is not set # # Mapping drivers for chip access # # CONFIG_MTD_COMPLEX_MAPPINGS is not set CONFIG_MTD_UCLINUX=y -# CONFIG_MTD_SNAPGEARuC is not set # CONFIG_MTD_PLATRAM is not set # @@ -269,7 +305,6 @@ CONFIG_MTD_UCLINUX=y # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_PHRAM is not set # CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLKMTD is not set # CONFIG_MTD_BLOCK2MTD is not set # @@ -285,6 +320,11 @@ CONFIG_MTD_UCLINUX=y # CONFIG_MTD_NAND is not set # +# OneNAND Flash Device Drivers +# +# CONFIG_MTD_ONENAND is not set + +# # Parallel port support # # CONFIG_PARPORT is not set @@ -296,7 +336,6 @@ CONFIG_MTD_UCLINUX=y # # Block devices # -# CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_DEV_COW_COMMON is not set # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set @@ -304,16 +343,7 @@ CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 # CONFIG_BLK_DEV_INITRD is not set -CONFIG_INITRAMFS_SOURCE="" # CONFIG_CDROM_PKTCDVD is not set - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -# CONFIG_IOSCHED_AS is not set -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set # CONFIG_ATA_OVER_ETH is not set # @@ -324,6 +354,7 @@ CONFIG_IOSCHED_NOOP=y # # SCSI device support # +# CONFIG_RAID_ATTRS is not set # CONFIG_SCSI is not set # @@ -354,13 +385,15 @@ CONFIG_NETDEVICES=y # CONFIG_TUN is not set # +# PHY device support +# +# CONFIG_PHYLIB is not set + +# # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y # CONFIG_MII is not set -# CONFIG_NET_VENDOR_SMC is not set -# CONFIG_NE2000 is not set -# CONFIG_NET_PCI is not set CONFIG_FEC=y # CONFIG_FEC2 is not set @@ -392,6 +425,7 @@ CONFIG_PPP=y # CONFIG_PPP_SYNC_TTY is not set # CONFIG_PPP_DEFLATE is not set # CONFIG_PPP_BSDCOMP is not set +# CONFIG_PPP_MPPE is not set # CONFIG_PPPOE is not set # CONFIG_SLIP is not set # CONFIG_SHAPER is not set @@ -425,8 +459,6 @@ CONFIG_PPP=y # # CONFIG_VT is not set # CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_LEDMAN is not set -# CONFIG_RESETSWITCH is not set # # Serial drivers @@ -450,8 +482,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # Watchdog Cards # # CONFIG_WATCHDOG is not set -# CONFIG_MCFWATCHDOG is not set -# CONFIG_RTC is not set # CONFIG_GEN_RTC is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set @@ -464,14 +494,19 @@ CONFIG_LEGACY_PTY_COUNT=256 # # TPM devices # -# CONFIG_MCF_QSPI is not set -# CONFIG_M41T11M6 is not set +# CONFIG_TCG_TPM is not set +# CONFIG_TELCLOCK is not set # # I2C support # # CONFIG_I2C is not set -# CONFIG_I2C_SENSOR is not set + +# +# SPI support +# +# CONFIG_SPI is not set +# CONFIG_SPI_MASTER is not set # # Dallas's 1-wire bus @@ -482,6 +517,7 @@ CONFIG_LEGACY_PTY_COUNT=256 # Hardware Monitoring support # # CONFIG_HWMON is not set +# CONFIG_HWMON_VID is not set # # Misc devices @@ -491,6 +527,7 @@ CONFIG_LEGACY_PTY_COUNT=256 # Multimedia devices # # CONFIG_VIDEO_DEV is not set +CONFIG_VIDEO_V4L2=y # # Digital Video Broadcasting Devices @@ -503,11 +540,6 @@ CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_FB is not set # -# SPI support -# -# CONFIG_SPI is not set - -# # Sound # # CONFIG_SOUND is not set @@ -517,6 +549,11 @@ CONFIG_LEGACY_PTY_COUNT=256 # # CONFIG_USB_ARCH_HAS_HCD is not set # CONFIG_USB_ARCH_HAS_OHCI is not set +# CONFIG_USB_ARCH_HAS_EHCI is not set + +# +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' +# # # USB Gadget Support @@ -529,29 +566,43 @@ CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_MMC is not set # +# LED devices +# +# CONFIG_NEW_LEDS is not set + +# +# LED drivers +# + +# +# LED Triggers +# + +# # InfiniBand support # # -# SN Devices +# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) # # +# Real Time Clock +# +# CONFIG_RTC_CLASS is not set + +# # File systems # CONFIG_EXT2_FS=y # CONFIG_EXT2_FS_XATTR is not set # CONFIG_EXT2_FS_XIP is not set # CONFIG_EXT3_FS is not set -# CONFIG_JBD is not set # CONFIG_REISERFS_FS is not set # CONFIG_JFS_FS is not set # CONFIG_FS_POSIX_ACL is not set - -# -# XFS support -# # CONFIG_XFS_FS is not set +# CONFIG_OCFS2_FS is not set # CONFIG_MINIX_FS is not set CONFIG_ROMFS_FS=y # CONFIG_INOTIFY is not set @@ -559,6 +610,7 @@ CONFIG_ROMFS_FS=y # CONFIG_DNOTIFY is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set # # CD-ROM/DVD Filesystems @@ -581,6 +633,7 @@ CONFIG_SYSFS=y # CONFIG_TMPFS is not set # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y +# CONFIG_CONFIGFS_FS is not set # # Miscellaneous filesystems @@ -611,6 +664,7 @@ CONFIG_RAMFS=y # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set +# CONFIG_9P_FS is not set # # Partition Types @@ -627,8 +681,12 @@ CONFIG_MSDOS_PARTITION=y # Kernel hacking # # CONFIG_PRINTK_TIME is not set +# CONFIG_MAGIC_SYSRQ is not set # CONFIG_DEBUG_KERNEL is not set CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_UNWIND_INFO is not set # CONFIG_FULLDEBUG is not set # CONFIG_HIGHPROFILE is not set # CONFIG_BOOTPARAM is not set @@ -655,5 +713,6 @@ CONFIG_LOG_BUF_SHIFT=14 # Library routines # # CONFIG_CRC_CCITT is not set +# CONFIG_CRC16 is not set # CONFIG_CRC32 is not set # CONFIG_LIBCRC32C is not set diff --git a/arch/m68knommu/kernel/comempci.c b/arch/m68knommu/kernel/comempci.c index 8670938f1107..6ee00effbad2 100644 --- a/arch/m68knommu/kernel/comempci.c +++ b/arch/m68knommu/kernel/comempci.c @@ -9,7 +9,6 @@ /*****************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/pci.h> @@ -357,7 +356,8 @@ void pcibios_fixup_bus(struct pci_bus *b) /*****************************************************************************/ -void pcibios_align_resource(void *data, struct resource *res, unsigned long size, unsigned long align) +void pcibios_align_resource(void *data, struct resource *res, + resource_size_t size, resource_size_t align) { } diff --git a/arch/m68knommu/kernel/entry.S b/arch/m68knommu/kernel/entry.S index 8b1f47239b9a..1e7ea6a3e1a1 100644 --- a/arch/m68knommu/kernel/entry.S +++ b/arch/m68knommu/kernel/entry.S @@ -24,7 +24,6 @@ * linux 2.4 support David McCullough <davidm@snapgear.com> */ -#include <linux/config.h> #include <linux/sys.h> #include <linux/linkage.h> #include <asm/thread_info.h> diff --git a/arch/m68knommu/kernel/m68k_ksyms.c b/arch/m68knommu/kernel/m68k_ksyms.c index 4320d5dcc9cb..1e62150f3588 100644 --- a/arch/m68knommu/kernel/m68k_ksyms.c +++ b/arch/m68knommu/kernel/m68k_ksyms.c @@ -7,7 +7,6 @@ #include <linux/elfcore.h> #include <linux/in6.h> #include <linux/interrupt.h> -#include <linux/config.h> #include <asm/setup.h> #include <asm/machdep.h> diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c index f861755ec88b..c18a83306953 100644 --- a/arch/m68knommu/kernel/process.c +++ b/arch/m68knommu/kernel/process.c @@ -13,7 +13,6 @@ * This file handles the architecture-dependent parts of process handling.. */ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/sched.h> diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c index 382ca5797b97..9130119537b9 100644 --- a/arch/m68knommu/kernel/ptrace.c +++ b/arch/m68knommu/kernel/ptrace.c @@ -18,7 +18,6 @@ #include <linux/errno.h> #include <linux/ptrace.h> #include <linux/user.h> -#include <linux/config.h> #include <linux/signal.h> #include <asm/uaccess.h> diff --git a/arch/m68knommu/kernel/semaphore.c b/arch/m68knommu/kernel/semaphore.c index c083f4772add..bce2bc7d87c6 100644 --- a/arch/m68knommu/kernel/semaphore.c +++ b/arch/m68knommu/kernel/semaphore.c @@ -3,7 +3,6 @@ * specific changes in <asm/semaphore-helper.h> */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/err.h> #include <linux/init.h> diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c index 93120b9bfff1..bde9811cf98c 100644 --- a/arch/m68knommu/kernel/setup.c +++ b/arch/m68knommu/kernel/setup.c @@ -16,7 +16,6 @@ * This file handles the architecture-dependent parts of system setup */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/delay.h> @@ -42,7 +41,6 @@ #include <asm/pgtable.h> #endif -unsigned long rom_length; unsigned long memory_start; unsigned long memory_end; @@ -56,29 +54,29 @@ static void dummy_waitbut(void) { } -void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)) = NULL; -void (*mach_tick)( void ) = NULL; +void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)); +void (*mach_tick)( void ); /* machine dependent keyboard functions */ -int (*mach_keyb_init) (void) = NULL; -int (*mach_kbdrate) (struct kbd_repeat *) = NULL; -void (*mach_kbd_leds) (unsigned int) = NULL; +int (*mach_keyb_init) (void); +int (*mach_kbdrate) (struct kbd_repeat *); +void (*mach_kbd_leds) (unsigned int); /* machine dependent irq functions */ -void (*mach_init_IRQ) (void) = NULL; -irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL; -int (*mach_get_irq_list) (struct seq_file *, void *) = NULL; -void (*mach_process_int) (int irq, struct pt_regs *fp) = NULL; +void (*mach_init_IRQ) (void); +irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *); +int (*mach_get_irq_list) (struct seq_file *, void *); +void (*mach_process_int) (int irq, struct pt_regs *fp); void (*mach_trap_init) (void); /* machine dependent timer functions */ -unsigned long (*mach_gettimeoffset) (void) = NULL; -void (*mach_gettod) (int*, int*, int*, int*, int*, int*) = NULL; -int (*mach_hwclk) (int, struct hwclk_time*) = NULL; -int (*mach_set_clock_mmss) (unsigned long) = NULL; -void (*mach_mksound)( unsigned int count, unsigned int ticks ) = NULL; -void (*mach_reset)( void ) = NULL; +unsigned long (*mach_gettimeoffset) (void); +void (*mach_gettod) (int*, int*, int*, int*, int*, int*); +int (*mach_hwclk) (int, struct hwclk_time*); +int (*mach_set_clock_mmss) (unsigned long); +void (*mach_mksound)( unsigned int count, unsigned int ticks ); +void (*mach_reset)( void ); void (*waitbut)(void) = dummy_waitbut; -void (*mach_debug_init)(void) = NULL; -void (*mach_halt)( void ) = NULL; -void (*mach_power_off)( void ) = NULL; +void (*mach_debug_init)(void); +void (*mach_halt)( void ); +void (*mach_power_off)( void ); #ifdef CONFIG_M68000 @@ -129,6 +127,9 @@ void (*mach_power_off)( void ) = NULL; #if defined(CONFIG_M5307) #define CPU "COLDFIRE(m5307)" #endif +#if defined(CONFIG_M532x) + #define CPU "COLDFIRE(m532x)" +#endif #if defined(CONFIG_M5407) #define CPU "COLDFIRE(m5407)" #endif @@ -267,34 +268,6 @@ void setup_arch(char **cmdline_p) paging_init(); } -int get_cpuinfo(char * buffer) -{ - char *cpu, *mmu, *fpu; - u_long clockfreq; - - cpu = CPU; - mmu = "none"; - fpu = "none"; - -#ifdef CONFIG_COLDFIRE - clockfreq = (loops_per_jiffy*HZ)*3; -#else - clockfreq = (loops_per_jiffy*HZ)*16; -#endif - - return(sprintf(buffer, "CPU:\t\t%s\n" - "MMU:\t\t%s\n" - "FPU:\t\t%s\n" - "Clocking:\t%lu.%1luMHz\n" - "BogoMips:\t%lu.%02lu\n" - "Calibration:\t%lu loops\n", - cpu, mmu, fpu, - clockfreq/1000000,(clockfreq/100000)%10, - (loops_per_jiffy*HZ)/500000,((loops_per_jiffy*HZ)/5000)%100, - (loops_per_jiffy*HZ))); - -} - /* * Get CPU information for use by the procfs. */ diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c index e1b3aa39e270..437f8c6c14a0 100644 --- a/arch/m68knommu/kernel/signal.c +++ b/arch/m68knommu/kernel/signal.c @@ -553,7 +553,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) /* This is the X/Open sanctioned signal stack switching. */ if (ka->sa.sa_flags & SA_ONSTACK) { - if (!on_sig_stack(usp)) + if (!sas_ss_flags(usp)) usp = current->sas_ss_sp + current->sas_ss_size; } return (void *)((usp - frame_size) & -8UL); @@ -608,7 +608,7 @@ adjust_stack: if (regs->stkadj) { struct pt_regs *tregs = (struct pt_regs *)((ulong)regs + regs->stkadj); -#if DEBUG +#if defined(DEBUG) printk(KERN_DEBUG "Performing stackadjust=%04x\n", regs->stkadj); #endif /* This must be copied with decreasing addresses to @@ -678,7 +678,7 @@ adjust_stack: if (regs->stkadj) { struct pt_regs *tregs = (struct pt_regs *)((ulong)regs + regs->stkadj); -#if DEBUG +#if defined(DEBUG) printk(KERN_DEBUG "Performing stackadjust=%04x\n", regs->stkadj); #endif /* This must be copied with decreasing addresses to diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S index 897deaa06b01..617e43ec95ae 100644 --- a/arch/m68knommu/kernel/syscalltable.S +++ b/arch/m68knommu/kernel/syscalltable.S @@ -11,7 +11,6 @@ * Copyright (C) 1991, 1992 Linus Torvalds */ -#include <linux/config.h> #include <linux/sys.h> #include <linux/linkage.h> #include <asm/unistd.h> diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c index b9d8abb45430..1db987272220 100644 --- a/arch/m68knommu/kernel/time.c +++ b/arch/m68knommu/kernel/time.c @@ -10,7 +10,6 @@ * "A Kernel Model for Precision Timekeeping" by Dave Mills */ -#include <linux/config.h> #include <linux/errno.h> #include <linux/module.h> #include <linux/sched.h> diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c index 5bc068462864..17649d2543ef 100644 --- a/arch/m68knommu/kernel/traps.c +++ b/arch/m68knommu/kernel/traps.c @@ -16,7 +16,6 @@ /* * Sets up all exception vectors */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/signal.h> #include <linux/kernel.h> @@ -93,12 +92,12 @@ asmlinkage void buserr_c(struct frame *fp) if (user_mode(&fp->ptregs)) current->thread.esp0 = (unsigned long) fp; -#if DEBUG +#if defined(DEBUG) printk (KERN_DEBUG "*** Bus Error *** Format is %x\n", fp->ptregs.format); #endif die_if_kernel("bad frame format",&fp->ptregs,0); -#if DEBUG +#if defined(DEBUG) printk(KERN_DEBUG "Unknown SIGSEGV - 4\n"); #endif force_sig(SIGSEGV, current); diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S index a331cc90797c..ccd2ceb05cfb 100644 --- a/arch/m68knommu/kernel/vmlinux.lds.S +++ b/arch/m68knommu/kernel/vmlinux.lds.S @@ -1,205 +1,29 @@ /* * vmlinux.lds.S -- master linker script for m68knommu arch * - * (C) Copyright 2002-2004, Greg Ungerer <gerg@snapgear.com> + * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com> * - * This ends up looking compilcated, because of the number of - * address variations for ram and rom/flash layouts. The real - * work of the linker script is all at the end, and reasonably - * strait forward. + * This linker script is equiped to build either ROM loaded or RAM + * run kernels. */ -#include <linux/config.h> #include <asm-generic/vmlinux.lds.h> -/* - * Original Palm pilot (same for Xcopilot). - * There is really only a rom target for this. - */ -#ifdef CONFIG_PILOT3 -#define ROMVEC_START 0x10c00000 -#define ROMVEC_LENGTH 0x10400 -#define ROM_START 0x10c10400 -#define ROM_LENGTH 0xfec00 -#define ROM_END 0x10d00000 -#define RAMVEC_START 0x00000000 -#define RAMVEC_LENGTH 0x400 -#define RAM_START 0x10000400 -#define RAM_LENGTH 0xffc00 -#define RAM_END 0x10100000 -#define _ramend _ram_end_notused -#define DATA_ADDR RAM_START -#endif - -/* - * Same setup on both the uCsimm and uCdimm. - */ -#if defined(CONFIG_UCSIMM) || defined(CONFIG_UCDIMM) -#ifdef CONFIG_RAMKERNEL -#define ROMVEC_START 0x10c10000 -#define ROMVEC_LENGTH 0x400 -#define ROM_START 0x10c10400 -#define ROM_LENGTH 0x1efc00 -#define ROM_END 0x10e00000 -#define RAMVEC_START 0x00000000 -#define RAMVEC_LENGTH 0x400 -#define RAM_START 0x00020400 -#define RAM_LENGTH 0x7dfc00 -#define RAM_END 0x00800000 -#endif -#ifdef CONFIG_ROMKERNEL -#define ROMVEC_START 0x10c10000 -#define ROMVEC_LENGTH 0x400 -#define ROM_START 0x10c10400 -#define ROM_LENGTH 0x1efc00 -#define ROM_END 0x10e00000 -#define RAMVEC_START 0x00000000 -#define RAMVEC_LENGTH 0x400 -#define RAM_START 0x00020000 -#define RAM_LENGTH 0x600000 -#define RAM_END 0x00800000 -#endif -#ifdef CONFIG_HIMEMKERNEL -#define ROMVEC_START 0x00600000 -#define ROMVEC_LENGTH 0x400 -#define ROM_START 0x00600400 -#define ROM_LENGTH 0x1efc00 -#define ROM_END 0x007f0000 -#define RAMVEC_START 0x00000000 -#define RAMVEC_LENGTH 0x400 -#define RAM_START 0x00020000 -#define RAM_LENGTH 0x5e0000 -#define RAM_END 0x00600000 -#endif -#endif - -#ifdef CONFIG_DRAGEN2 -#define RAM_START 0x10000 -#define RAM_LENGTH 0x7f0000 -#endif - -#ifdef CONFIG_UCQUICC -#define ROMVEC_START 0x00000000 -#define ROMVEC_LENGTH 0x404 -#define ROM_START 0x00000404 -#define ROM_LENGTH 0x1ff6fc -#define ROM_END 0x00200000 -#define RAMVEC_START 0x00200000 -#define RAMVEC_LENGTH 0x404 -#define RAM_START 0x00200404 -#define RAM_LENGTH 0x1ff6fc -#define RAM_END 0x00400000 -#endif - -/* - * The standard Arnewsh 5206 board only has 1MiB of ram. Not normally - * enough to be useful. Assume the user has fitted something larger, - * at least 4MiB in size. No point in not letting the kernel completely - * link, it will be obvious if it is too big when they go to load it. - */ -#if defined(CONFIG_ARN5206) -#define RAM_START 0x10000 -#define RAM_LENGTH 0x3f0000 -#endif - -/* - * The Motorola 5206eLITE board only has 1MiB of static RAM. - */ -#if defined(CONFIG_ELITE) -#define RAM_START 0x30020000 -#define RAM_LENGTH 0xe0000 -#endif - -/* - * All the Motorola eval boards have the same basic arrangement. - * The end of RAM will vary depending on how much ram is fitted, - * but this isn't important here, we assume at least 4MiB. - */ -#if defined(CONFIG_M5206eC3) || defined(CONFIG_M5249C3) || \ - defined(CONFIG_M5272C3) || defined(CONFIG_M5307C3) || \ - defined(CONFIG_ARN5307) || defined(CONFIG_M5407C3) || \ - defined(CONFIG_M5271EVB) || defined(CONFIG_M5275EVB) || \ - defined(CONFIG_M5235EVB) -#define RAM_START 0x20000 -#define RAM_LENGTH 0x3e0000 -#endif - -/* - * The Freescale 5208EVB board has 32MB of RAM. - */ -#if defined(CONFIG_M5208EVB) -#define RAM_START 0x40020000 -#define RAM_LENGTH 0x01fe0000 -#endif - -/* - * The senTec COBRA5272 board has nearly the same memory layout as - * the M5272C3. We assume 16MiB ram. - */ -#if defined(CONFIG_COBRA5272) -#define RAM_START 0x20000 -#define RAM_LENGTH 0xfe0000 -#endif - -#if defined(CONFIG_M5282EVB) -#define RAM_START 0x10000 -#define RAM_LENGTH 0x3f0000 -#endif - -/* - * The senTec COBRA5282 board has the same memory layout as the M5282EVB. - */ -#if defined(CONFIG_COBRA5282) -#define RAM_START 0x10000 -#define RAM_LENGTH 0x3f0000 -#endif - - -/* - * The EMAC SoM-5282EM module. - */ -#if defined(CONFIG_SOM5282EM) -#define RAM_START 0x10000 -#define RAM_LENGTH 0xff0000 -#endif - - -/* - * These flash boot boards use all of ram for operation. Again the - * actual memory size is not important here, assume at least 4MiB. - * They currently have no support for running in flash. - */ -#if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) || \ - defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) || \ - defined(CONFIG_HW_FEITH) -#define RAM_START 0x400 -#define RAM_LENGTH 0x3ffc00 -#endif - -/* - * Sneha Boards mimimun memory - * The end of RAM will vary depending on how much ram is fitted, - * but this isn't important here, we assume at least 4MiB. - */ -#if defined(CONFIG_CPU16B) -#define RAM_START 0x20000 -#define RAM_LENGTH 0x3e0000 -#endif - -#if defined(CONFIG_MOD5272) -#define RAM_START 0x02000000 -#define RAM_LENGTH 0x00800000 -#define RAMVEC_START 0x20000000 -#define RAMVEC_LENGTH 0x00000400 -#endif - #if defined(CONFIG_RAMKERNEL) +#define RAM_START CONFIG_KERNELBASE +#define RAM_LENGTH (CONFIG_RAMBASE + CONFIG_RAMSIZE - CONFIG_KERNELBASE) #define TEXT ram #define DATA ram #define INIT ram #define BSS ram #endif #if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL) +#define RAM_START CONFIG_RAMBASE +#define RAM_LENGTH CONFIG_RAMSIZE +#define ROMVEC_START CONFIG_ROMVEC +#define ROMVEC_LENGTH CONFIG_ROMVECSIZE +#define ROM_START CONFIG_ROMSTART +#define ROM_LENGTH CONFIG_ROMSIZE #define TEXT rom #define DATA ram #define INIT ram @@ -215,17 +39,10 @@ OUTPUT_ARCH(m68k) ENTRY(_start) MEMORY { -#ifdef RAMVEC_START - ramvec : ORIGIN = RAMVEC_START, LENGTH = RAMVEC_LENGTH -#endif ram : ORIGIN = RAM_START, LENGTH = RAM_LENGTH -#ifdef RAM_END - eram : ORIGIN = RAM_END, LENGTH = 0 -#endif #ifdef ROM_START romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH - erom : ORIGIN = ROM_END, LENGTH = 0 #endif } @@ -302,19 +119,6 @@ SECTIONS { _etext = . ; } > TEXT -#ifdef ROM_END - . = ROM_END ; - .erom : { - __rom_end = . ; - } > erom -#endif -#ifdef RAMVEC_START - . = RAMVEC_START ; - .ramvec : { - __ramvec = .; - } > ramvec -#endif - .data DATA_ADDR : { . = ALIGN(4); _sdata = . ; @@ -373,12 +177,5 @@ SECTIONS { _ebss = . ; } > BSS -#ifdef RAM_END - . = RAM_END ; - .eram : { - __ramend = . ; - _ramend = . ; - } > eram -#endif } diff --git a/arch/m68knommu/lib/semaphore.S b/arch/m68knommu/lib/semaphore.S index 76765362fea6..87c746034376 100644 --- a/arch/m68knommu/lib/semaphore.S +++ b/arch/m68knommu/lib/semaphore.S @@ -9,7 +9,6 @@ */ #include <linux/linkage.h> -#include <linux/config.h> #include <asm/semaphore.h> /* diff --git a/arch/m68knommu/mm/init.c b/arch/m68knommu/mm/init.c index d79503fe6e42..e4c233eef195 100644 --- a/arch/m68knommu/mm/init.c +++ b/arch/m68knommu/mm/init.c @@ -15,7 +15,6 @@ * DEC/2000 -- linux 2.4 support <davidm@snapgear.com> */ -#include <linux/config.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/kernel.h> @@ -63,8 +62,6 @@ static unsigned long empty_bad_page; unsigned long empty_zero_page; -extern unsigned long rom_length; - void show_mem(void) { unsigned long i; @@ -178,11 +175,9 @@ void mem_init(void) initk = (&__init_begin - &__init_end) >> 10; tmp = nr_free_pages() << PAGE_SHIFT; - printk(KERN_INFO "Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n", + printk(KERN_INFO "Memory available: %luk/%luk RAM, (%dk kernel code, %dk data)\n", tmp >> 10, len >> 10, - (rom_length > 0) ? ((rom_length >> 10) - codek) : 0, - rom_length >> 10, codek, datak ); diff --git a/arch/m68knommu/mm/kmap.c b/arch/m68knommu/mm/kmap.c index 04213e1c1e57..bc32f38843f0 100644 --- a/arch/m68knommu/mm/kmap.c +++ b/arch/m68knommu/mm/kmap.c @@ -5,7 +5,6 @@ * Copyright (C) 2000-2002 David McCullough <davidm@snapgear.com> */ -#include <linux/config.h> #include <linux/mm.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/arch/m68knommu/mm/memory.c b/arch/m68knommu/mm/memory.c index 0eef72915e61..411e45248e5c 100644 --- a/arch/m68knommu/mm/memory.c +++ b/arch/m68knommu/mm/memory.c @@ -11,7 +11,6 @@ * Copyright (C) 1995 Hamish Macdonald */ -#include <linux/config.h> #include <linux/mm.h> #include <linux/kernel.h> #include <linux/string.h> diff --git a/arch/m68knommu/platform/5206/config.c b/arch/m68knommu/platform/5206/config.c index 987c91a9a206..34657f85e702 100644 --- a/arch/m68knommu/platform/5206/config.c +++ b/arch/m68knommu/platform/5206/config.c @@ -9,7 +9,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c index f35b8606c1ee..48e4d6266507 100644 --- a/arch/m68knommu/platform/5206e/config.c +++ b/arch/m68knommu/platform/5206e/config.c @@ -8,7 +8,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/520x/config.c b/arch/m68knommu/platform/520x/config.c index 71dea2e0f452..823f561f35b0 100644 --- a/arch/m68knommu/platform/520x/config.c +++ b/arch/m68knommu/platform/520x/config.c @@ -11,7 +11,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/param.h> #include <asm/machdep.h> diff --git a/arch/m68knommu/platform/523x/config.c b/arch/m68knommu/platform/523x/config.c index 22767ce506e0..85de817e9ec5 100644 --- a/arch/m68knommu/platform/523x/config.c +++ b/arch/m68knommu/platform/523x/config.c @@ -12,7 +12,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c index 289c1821b841..9d19d5bdb8af 100644 --- a/arch/m68knommu/platform/5249/config.c +++ b/arch/m68knommu/platform/5249/config.c @@ -8,7 +8,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c index cf36e7d007b9..d500e27eda57 100644 --- a/arch/m68knommu/platform/5272/config.c +++ b/arch/m68knommu/platform/5272/config.c @@ -9,7 +9,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/527x/config.c b/arch/m68knommu/platform/527x/config.c index 804de33cd6b7..bbae51597457 100644 --- a/arch/m68knommu/platform/527x/config.c +++ b/arch/m68knommu/platform/527x/config.c @@ -12,7 +12,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c index a5d2aa38a27a..18dad9046144 100644 --- a/arch/m68knommu/platform/528x/config.c +++ b/arch/m68knommu/platform/528x/config.c @@ -12,7 +12,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/5307/Makefile b/arch/m68knommu/platform/5307/Makefile index 8d1619dc1ea6..2fd37dcc309b 100644 --- a/arch/m68knommu/platform/5307/Makefile +++ b/arch/m68knommu/platform/5307/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_M5249) += timers.o obj-$(CONFIG_M527x) += pit.o obj-$(CONFIG_M5272) += timers.o obj-$(CONFIG_M5307) += config.o timers.o +obj-$(CONFIG_M532x) += timers.o obj-$(CONFIG_M528x) += pit.o obj-$(CONFIG_M5407) += timers.o diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c index 7ed5782e9236..8074ac56f479 100644 --- a/arch/m68knommu/platform/5307/config.c +++ b/arch/m68knommu/platform/5307/config.c @@ -9,7 +9,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/5307/entry.S b/arch/m68knommu/platform/5307/entry.S index 89b180d4ed6a..f0dba84d9101 100644 --- a/arch/m68knommu/platform/5307/entry.S +++ b/arch/m68knommu/platform/5307/entry.S @@ -4,8 +4,8 @@ * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>, * Kenneth Albanowski <kjahds@kjahds.com>, - * Copyright (C) 2000 Lineo Inc. (www.lineo.com) - * Copyright (C) 2004 Macq Electronique SA. (www.macqel.com) + * Copyright (C) 2000 Lineo Inc. (www.lineo.com) + * Copyright (C) 2004-2006 Macq Electronique SA. (www.macqel.com) * * Based on: * @@ -26,7 +26,6 @@ * Bug, speed and maintainability fixes by Philippe De Muyter <phdm@macqel.be> */ -#include <linux/config.h> #include <linux/sys.h> #include <linux/linkage.h> #include <asm/unistd.h> @@ -56,32 +55,27 @@ sw_usp: .globl inthandler .globl fasthandler +enosys: + mov.l #sys_ni_syscall,%d3 + bra 1f + ENTRY(system_call) SAVE_ALL move #0x2000,%sr /* enable intrs again */ - movel #-LENOSYS,%d2 - movel %d2,PT_D0(%sp) /* default return value in d0 */ - /* original D0 is in orig_d0 */ - movel %d0,%d2 - - /* save top of frame */ - pea %sp@ - jbsr set_esp0 - addql #4,%sp - - cmpl #NR_syscalls,%d2 - jcc ret_from_exception + cmpl #NR_syscalls,%d0 + jcc enosys lea sys_call_table,%a0 - lsll #2,%d2 /* movel %a0@(%d2:l:4),%d3 */ - movel %a0@(%d2),%d3 - jeq ret_from_exception - lsrl #2,%d2 + lsll #2,%d0 /* movel %a0@(%d0:l:4),%d3 */ + movel %a0@(%d0),%d3 + jeq enosys +1: movel %sp,%d2 /* get thread_info pointer */ andl #-THREAD_SIZE,%d2 /* at start of kernel stack */ movel %d2,%a0 - btst #TIF_SYSCALL_TRACE,%a0@(TI_FLAGS) + movel %sp,%a0@(THREAD_ESP0) /* save top of frame */ + btst #(TIF_SYSCALL_TRACE%8),%a0@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8) bnes 1f movel %d3,%a0 @@ -126,8 +120,8 @@ Luser_return: jne Lwork_to_do /* still work to do */ Lreturn: - move #0x2700,%sr /* disable intrs */ - movel sw_usp,%a0 /* get usp */ + move #0x2700,%sr /* disable intrs */ + movel sw_usp,%a0 /* get usp */ movel %sp@(PT_PC),%a0@- /* copy exception program counter */ movel %sp@(PT_FORMATVEC),%a0@-/* copy exception format/vector/sr */ moveml %sp@,%d1-%d5/%a0-%a2 @@ -170,7 +164,7 @@ ENTRY(inthandler) movel %d0,%sp@(PT_ORIG_D0) addql #1,local_irq_count - movew %sp@(PT_FORMATVEC),%d0 /* put exception # in d0 */ + movew %sp@(PT_FORMATVEC),%d0 /* put exception # in d0 */ andl #0x03fc,%d0 /* mask out vector only */ leal per_cpu__kstat+STAT_IRQ,%a0 @@ -184,7 +178,7 @@ ENTRY(inthandler) movel %sp,%sp@- /* push regs arg onto stack */ movel %a0@(8),%sp@- /* push devid arg */ - movel %d0,%sp@- /* push vector # on stack */ + movel %d0,%sp@- /* push vector # on stack */ movel %a0@,%a0 /* get function to call */ jbsr %a0@ /* call vector handler */ @@ -201,7 +195,7 @@ ENTRY(inthandler) ENTRY(fasthandler) SAVE_LOCAL - movew %sp@(PT_FORMATVEC),%d0 + movew %sp@(PT_FORMATVEC),%d0 andl #0x03fc,%d0 /* mask out vector only */ leal per_cpu__kstat+STAT_IRQ,%a0 @@ -210,7 +204,7 @@ ENTRY(fasthandler) movel %sp,%sp@- /* push regs arg onto stack */ clrl %sp@- /* push devid arg */ lsrl #2,%d0 /* calculate real vector # */ - movel %d0,%sp@- /* push vector # on stack */ + movel %d0,%sp@- /* push vector # on stack */ lsll #4,%d0 /* adjust for array offset */ lea irq_list,%a0 @@ -265,4 +259,3 @@ ENTRY(resume) movew %a1@(TASK_THREAD+THREAD_SR),%d0 /* restore thread status reg */ movew %d0, %sr rts - diff --git a/arch/m68knommu/platform/5307/head.S b/arch/m68knommu/platform/5307/head.S index c30c462b99b1..f2edb6498cd9 100644 --- a/arch/m68knommu/platform/5307/head.S +++ b/arch/m68knommu/platform/5307/head.S @@ -3,12 +3,11 @@ /* * head.S -- common startup code for ColdFire CPUs. * - * (C) Copyright 1999-2004, Greg Ungerer (gerg@snapgear.com). + * (C) Copyright 1999-2006, Greg Ungerer <gerg@snapgear.com>. */ /*****************************************************************************/ -#include <linux/config.h> #include <linux/sys.h> #include <linux/linkage.h> #include <asm/asm-offsets.h> @@ -19,47 +18,15 @@ /*****************************************************************************/ /* - * Define fixed memory sizes. Configuration of a fixed memory size - * overrides everything else. If the user defined a size we just - * blindly use it (they know what they are doing right :-) - */ -#if defined(CONFIG_RAM32MB) -#define MEM_SIZE 0x02000000 /* memory size 32Mb */ -#elif defined(CONFIG_RAM16MB) -#define MEM_SIZE 0x01000000 /* memory size 16Mb */ -#elif defined(CONFIG_RAM8MB) -#define MEM_SIZE 0x00800000 /* memory size 8Mb */ -#elif defined(CONFIG_RAM4MB) -#define MEM_SIZE 0x00400000 /* memory size 4Mb */ -#elif defined(CONFIG_RAM1MB) -#define MEM_SIZE 0x00100000 /* memory size 1Mb */ -#endif - -/* - * Memory size exceptions for special cases. Some boards may be set - * for auto memory sizing, but we can't do it that way for some reason. - * For example the 5206eLITE board has static RAM, and auto-detecting - * the SDRAM will do you no good at all. Same goes for the MOD5272. - */ -#ifdef CONFIG_RAMAUTO -#if defined(CONFIG_M5206eLITE) -#define MEM_SIZE 0x00100000 /* 1MiB default memory */ -#endif -#if defined(CONFIG_MOD5272) -#define MEM_SIZE 0x00800000 /* 8MiB default memory */ -#endif -#endif /* CONFIG_RAMAUTO */ - - -/* - * If we don't have a fixed memory size now, then lets build in code + * If we don't have a fixed memory size, then lets build in code * to auto detect the DRAM size. Obviously this is the prefered - * method, and should work for most boards (it won't work for those - * that do not have their RAM starting at address 0). + * method, and should work for most boards. It won't work for those + * that do not have their RAM starting at address 0, and it only + * works on SDRAM (not boards fitted with SRAM). */ -#if defined(MEM_SIZE) +#if CONFIG_RAMSIZE != 0 .macro GET_MEM_SIZE - movel #MEM_SIZE,%d0 /* hard coded memory size */ + movel #CONFIG_RAMSIZE,%d0 /* hard coded memory size */ .endm #elif defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \ @@ -98,37 +65,7 @@ .endm #else -#error "ERROR: I don't know how to determine your boards memory size?" -#endif - - -/* - * Most ColdFire boards have their DRAM starting at address 0. - * Notable exception is the 5206eLITE board, another is the MOD5272. - */ -#if defined(CONFIG_M5206eLITE) -#define MEM_BASE 0x30000000 -#endif -#if defined(CONFIG_MOD5272) -#define MEM_BASE 0x02000000 -#define VBR_BASE 0x20000000 /* vectors in SRAM */ -#endif -#if defined(CONFIG_M5208EVB) -#define MEM_BASE 0x40000000 -#endif - -#ifndef MEM_BASE -#define MEM_BASE 0x00000000 /* memory base at address 0 */ -#endif - -/* - * The default location for the vectors is at the base of RAM. - * Some boards might like to use internal SRAM or something like - * that. If no board specific header defines an alternative then - * use the base of RAM. - */ -#ifndef VBR_BASE -#define VBR_BASE MEM_BASE /* vector address */ +#error "ERROR: I don't know how to probe your boards memory size?" #endif /*****************************************************************************/ @@ -191,11 +128,11 @@ _start: * Create basic memory configuration. Set VBR accordingly, * and size memory. */ - movel #VBR_BASE,%a7 + movel #CONFIG_VECTORBASE,%a7 movec %a7,%VBR /* set vectors addr */ movel %a7,_ramvec - movel #MEM_BASE,%a7 /* mark the base of RAM */ + movel #CONFIG_RAMBASE,%a7 /* mark the base of RAM */ movel %a7,_rambase GET_MEM_SIZE /* macro code determines size */ diff --git a/arch/m68knommu/platform/5307/ints.c b/arch/m68knommu/platform/5307/ints.c index a134fb2f0566..b4b55093ae7e 100644 --- a/arch/m68knommu/platform/5307/ints.c +++ b/arch/m68knommu/platform/5307/ints.c @@ -21,7 +21,6 @@ #include <linux/sched.h> #include <linux/kernel_stat.h> #include <linux/errno.h> -#include <linux/config.h> #include <linux/seq_file.h> #include <asm/system.h> diff --git a/arch/m68knommu/platform/5307/pit.c b/arch/m68knommu/platform/5307/pit.c index 323f2677e49d..9dc5688f71b5 100644 --- a/arch/m68knommu/platform/5307/pit.c +++ b/arch/m68knommu/platform/5307/pit.c @@ -1,23 +1,23 @@ /***************************************************************************/ /* - * pit.c -- Motorola ColdFire PIT timer. Currently this type of - * hardware timer only exists in the Motorola ColdFire + * pit.c -- Freescale ColdFire PIT timer. Currently this type of + * hardware timer only exists in the Freescale ColdFire * 5270/5271, 5282 and other CPUs. * - * Copyright (C) 1999-2004, Greg Ungerer (gerg@snapgear.com) + * Copyright (C) 1999-2006, Greg Ungerer (gerg@snapgear.com) * Copyright (C) 2001-2004, SnapGear Inc. (www.snapgear.com) * */ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> #include <linux/init.h> #include <linux/interrupt.h> +#include <asm/io.h> #include <asm/irq.h> #include <asm/coldfire.h> #include <asm/mcfpit.h> @@ -25,13 +25,20 @@ /***************************************************************************/ +/* + * By default use timer1 as the system clock timer. + */ +#define TA(a) (MCF_IPSBAR + MCFPIT_BASE1 + (a)) + +/***************************************************************************/ + void coldfire_pit_tick(void) { - volatile struct mcfpit *tp; + unsigned short pcsr; /* Reset the ColdFire timer */ - tp = (volatile struct mcfpit *) (MCF_IPSBAR + MCFPIT_BASE1); - tp->pcsr |= MCFPIT_PCSR_PIF; + pcsr = __raw_readw(TA(MCFPIT_PCSR)); + __raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR)); } /***************************************************************************/ @@ -40,9 +47,8 @@ void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)) { volatile unsigned char *icrp; volatile unsigned long *imrp; - volatile struct mcfpit *tp; - request_irq(MCFINT_VECBASE + MCFINT_PIT1, handler, SA_INTERRUPT, + request_irq(MCFINT_VECBASE + MCFINT_PIT1, handler, IRQF_DISABLED, "ColdFire Timer", NULL); icrp = (volatile unsigned char *) (MCF_IPSBAR + MCFICM_INTC0 + @@ -53,27 +59,23 @@ void coldfire_pit_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)) *imrp &= ~MCFPIT_IMR_IBIT; /* Set up PIT timer 1 as poll clock */ - tp = (volatile struct mcfpit *) (MCF_IPSBAR + MCFPIT_BASE1); - tp->pcsr = MCFPIT_PCSR_DISABLE; - - tp->pmr = ((MCF_CLK / 2) / 64) / HZ; - tp->pcsr = MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW | - MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64; + __raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR)); + __raw_writew(((MCF_CLK / 2) / 64) / HZ, TA(MCFPIT_PMR)); + __raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW | + MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR)); } /***************************************************************************/ unsigned long coldfire_pit_offset(void) { - volatile struct mcfpit *tp; volatile unsigned long *ipr; unsigned long pmr, pcntr, offset; - tp = (volatile struct mcfpit *) (MCF_IPSBAR + MCFPIT_BASE1); ipr = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFPIT_IMR); - pmr = *(&tp->pmr); - pcntr = *(&tp->pcntr); + pmr = __raw_readw(TA(MCFPIT_PMR)); + pcntr = __raw_readw(TA(MCFPIT_PCNTR)); /* * If we are still in the first half of the upcount and a diff --git a/arch/m68knommu/platform/5307/timers.c b/arch/m68knommu/platform/5307/timers.c index ef49596aa09c..24781f009337 100644 --- a/arch/m68knommu/platform/5307/timers.c +++ b/arch/m68knommu/platform/5307/timers.c @@ -8,12 +8,12 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> #include <linux/interrupt.h> #include <linux/init.h> +#include <asm/io.h> #include <asm/irq.h> #include <asm/traps.h> #include <asm/machdep.h> @@ -24,6 +24,11 @@ /***************************************************************************/ /* + * By default use timer1 as the system clock timer. + */ +#define TA(a) (MCF_MBAR + MCFTIMER_BASE1 + (a)) + +/* * Default the timer and vector to use for ColdFire. Some ColdFire * CPU's and some boards may want different. Their sub-architecture * startup code (in config.c) can change these if they want. @@ -32,8 +37,6 @@ unsigned int mcf_timervector = 29; unsigned int mcf_profilevector = 31; unsigned int mcf_timerlevel = 5; -static volatile struct mcftimer *mcf_timerp; - /* * These provide the underlying interrupt vector support. * Unfortunately it is a little different on each ColdFire. @@ -46,22 +49,19 @@ extern int mcf_timerirqpending(int timer); void coldfire_tick(void) { /* Reset the ColdFire timer */ - mcf_timerp->ter = MCFTIMER_TER_CAP | MCFTIMER_TER_REF; + __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER)); } /***************************************************************************/ void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)) { - /* Set up an internal TIMER as poll clock */ - mcf_timerp = (volatile struct mcftimer *) (MCF_MBAR + MCFTIMER_BASE1); - mcf_timerp->tmr = MCFTIMER_TMR_DISABLE; - - mcf_timerp->trr = (unsigned short) ((MCF_BUSCLK / 16) / HZ); - mcf_timerp->tmr = MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | - MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE; + __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); + __raw_writew(((MCF_BUSCLK / 16) / HZ), TA(MCFTIMER_TRR)); + __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | + MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR)); - request_irq(mcf_timervector, handler, SA_INTERRUPT, "timer", NULL); + request_irq(mcf_timervector, handler, IRQF_DISABLED, "timer", NULL); mcf_settimericr(1, mcf_timerlevel); #ifdef CONFIG_HIGHPROFILE @@ -75,13 +75,8 @@ unsigned long coldfire_timer_offset(void) { unsigned long trr, tcn, offset; - /* - * The change to pointer and de-reference is to force the compiler - * to read the registers with a single 16bit access. Otherwise it - * does some crazy 8bit read combining. - */ - tcn = *(&mcf_timerp->tcn); - trr = *(&mcf_timerp->trr); + tcn = __raw_readw(TA(MCFTIMER_TCN)); + trr = __raw_readw(TA(MCFTIMER_TRR)); offset = (tcn * (1000000 / HZ)) / trr; /* Check if we just wrapped the counters and maybe missed a tick */ @@ -95,21 +90,23 @@ unsigned long coldfire_timer_offset(void) /***************************************************************************/ /* + * By default use timer2 as the profiler clock timer. + */ +#define PA(a) (MCF_MBAR + MCFTIMER_BASE2 + (a)) + +/* * Choose a reasonably fast profile timer. Make it an odd value to * try and get good coverage of kernal operations. */ #define PROFILEHZ 1013 -static volatile struct mcftimer *mcf_proftp; - /* * Use the other timer to provide high accuracy profiling info. */ - void coldfire_profile_tick(int irq, void *dummy, struct pt_regs *regs) { /* Reset ColdFire timer2 */ - mcf_proftp->ter = MCFTIMER_TER_CAP | MCFTIMER_TER_REF; + __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, PA(MCFTIMER_TER)); if (current->pid) profile_tick(CPU_PROFILING, regs); } @@ -121,15 +118,14 @@ void coldfire_profile_init(void) printk(KERN_INFO "PROFILE: lodging TIMER2 @ %dHz as profile timer\n", PROFILEHZ); /* Set up TIMER 2 as high speed profile clock */ - mcf_proftp = (volatile struct mcftimer *) (MCF_MBAR + MCFTIMER_BASE2); - mcf_proftp->tmr = MCFTIMER_TMR_DISABLE; + __raw_writew(MCFTIMER_TMR_DISABLE, PA(MCFTIMER_TMR)); - mcf_proftp->trr = (unsigned short) ((MCF_CLK / 16) / PROFILEHZ); - mcf_proftp->tmr = MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | - MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE; + __raw_writew(((MCF_CLK / 16) / PROFILEHZ), PA(MCFTIMER_TRR)); + __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | + MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, PA(MCFTIMER_TMR)); request_irq(mcf_profilevector, coldfire_profile_tick, - (SA_INTERRUPT | IRQ_FLG_FAST), "profile timer", NULL); + (IRQF_DISABLED | IRQ_FLG_FAST), "profile timer", NULL); mcf_settimericr(2, 7); } diff --git a/arch/m68knommu/platform/5307/vectors.c b/arch/m68knommu/platform/5307/vectors.c index ac313a160d8d..2a8b0d044ce5 100644 --- a/arch/m68knommu/platform/5307/vectors.c +++ b/arch/m68knommu/platform/5307/vectors.c @@ -8,7 +8,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/532x/Makefile b/arch/m68knommu/platform/532x/Makefile new file mode 100644 index 000000000000..12301803b9eb --- /dev/null +++ b/arch/m68knommu/platform/532x/Makefile @@ -0,0 +1,20 @@ +# +# Makefile for the m68knommu linux kernel. +# + +# +# If you want to play with the HW breakpoints then you will +# need to add define this, which will give you a stack backtrace +# on the console port whenever a DBG interrupt occurs. You have to +# set up you HW breakpoints to trigger a DBG interrupt: +# +# EXTRA_CFLAGS += -DTRAP_DBG_INTERRUPT +# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT +# + +ifdef CONFIG_FULLDEBUG +AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1 +endif + +#obj-y := config.o usb-mcf532x.o spi-mcf532x.o +obj-y := config.o diff --git a/arch/m68knommu/platform/532x/config.c b/arch/m68knommu/platform/532x/config.c new file mode 100644 index 000000000000..ceef9bc181ea --- /dev/null +++ b/arch/m68knommu/platform/532x/config.c @@ -0,0 +1,486 @@ +/***************************************************************************/ + +/* + * linux/arch/m68knommu/platform/532x/config.c + * + * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) + * Copyright (C) 2000, Lineo (www.lineo.com) + * Yaroslav Vinogradov yaroslav.vinogradov@freescale.com + * Copyright Freescale Semiconductor, Inc 2006 + * Copyright (c) 2006, emlix, Sebastian Hess <sh@emlix.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/***************************************************************************/ + +#include <linux/config.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/param.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <asm/irq.h> +#include <asm/dma.h> +#include <asm/traps.h> +#include <asm/machdep.h> +#include <asm/coldfire.h> +#include <asm/mcftimer.h> +#include <asm/mcfsim.h> +#include <asm/mcfdma.h> +#include <asm/mcfwdebug.h> + +/***************************************************************************/ + +void coldfire_tick(void); +void coldfire_timer_init(irqreturn_t (*handler)(int, void *, struct pt_regs *)); +unsigned long coldfire_timer_offset(void); +void coldfire_trap_init(void); +void coldfire_reset(void); + +extern unsigned int mcf_timervector; +extern unsigned int mcf_profilevector; +extern unsigned int mcf_timerlevel; + +/***************************************************************************/ + +/* + * DMA channel base address table. + */ +unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { }; +unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; + +/***************************************************************************/ + +void mcf_settimericr(unsigned int timer, unsigned int level) +{ + volatile unsigned char *icrp; + unsigned int icr; + unsigned char irq; + + if (timer <= 2) { + switch (timer) { + case 2: irq = 33; icr = MCFSIM_ICR_TIMER2; break; + default: irq = 32; icr = MCFSIM_ICR_TIMER1; break; + } + + icrp = (volatile unsigned char *) (MCF_MBAR + icr); + *icrp = level; + mcf_enable_irq0(irq); + } +} + +/***************************************************************************/ + +int mcf_timerirqpending(int timer) +{ + unsigned int imr = 0; + + switch (timer) { + case 1: imr = 0x1; break; + case 2: imr = 0x2; break; + default: break; + } + return (mcf_getiprh() & imr); +} + +/***************************************************************************/ + +void config_BSP(char *commandp, int size) +{ + mcf_setimr(MCFSIM_IMR_MASKALL); + +#if defined(CONFIG_BOOTPARAM) + strncpy(commandp, CONFIG_BOOTPARAM_STRING, size); + commandp[size-1] = 0; +#else + /* Copy command line from FLASH to local buffer... */ + memcpy(commandp, (char *) 0x4000, 4); + if(strncmp(commandp, "kcl ", 4) == 0){ + memcpy(commandp, (char *) 0x4004, size); + commandp[size-1] = 0; + } else { + memset(commandp, 0, size); + } +#endif + + mcf_timervector = 64+32; + mcf_profilevector = 64+33; + mach_sched_init = coldfire_timer_init; + mach_tick = coldfire_tick; + mach_gettimeoffset = coldfire_timer_offset; + mach_trap_init = coldfire_trap_init; + mach_reset = coldfire_reset; + +#ifdef MCF_BDM_DISABLE + /* + * Disable the BDM clocking. This also turns off most of the rest of + * the BDM device. This is good for EMC reasons. This option is not + * incompatible with the memory protection option. + */ + wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK); +#endif +} + +/***************************************************************************/ +/* Board initialization */ + +/********************************************************************/ +/* + * PLL min/max specifications + */ +#define MAX_FVCO 500000 /* KHz */ +#define MAX_FSYS 80000 /* KHz */ +#define MIN_FSYS 58333 /* KHz */ +#define FREF 16000 /* KHz */ + + +#define MAX_MFD 135 /* Multiplier */ +#define MIN_MFD 88 /* Multiplier */ +#define BUSDIV 6 /* Divider */ + +/* + * Low Power Divider specifications + */ +#define MIN_LPD (1 << 0) /* Divider (not encoded) */ +#define MAX_LPD (1 << 15) /* Divider (not encoded) */ +#define DEFAULT_LPD (1 << 1) /* Divider (not encoded) */ + +#define SYS_CLK_KHZ 80000 +#define SYSTEM_PERIOD 12.5 +/* + * SDRAM Timing Parameters + */ +#define SDRAM_BL 8 /* # of beats in a burst */ +#define SDRAM_TWR 2 /* in clocks */ +#define SDRAM_CASL 2.5 /* CASL in clocks */ +#define SDRAM_TRCD 2 /* in clocks */ +#define SDRAM_TRP 2 /* in clocks */ +#define SDRAM_TRFC 7 /* in clocks */ +#define SDRAM_TREFI 7800 /* in ns */ + +#define EXT_SRAM_ADDRESS (0xC0000000) +#define FLASH_ADDRESS (0x00000000) +#define SDRAM_ADDRESS (0x40000000) + +#define NAND_FLASH_ADDRESS (0xD0000000) + +int sys_clk_khz = 0; +int sys_clk_mhz = 0; + +void wtm_init(void); +void scm_init(void); +void gpio_init(void); +void fbcs_init(void); +void sdramc_init(void); +int clock_pll (int fsys, int flags); +int clock_limp (int); +int clock_exit_limp (void); +int get_sys_clock (void); + +asmlinkage void __init sysinit(void) +{ + sys_clk_khz = clock_pll(0, 0); + sys_clk_mhz = sys_clk_khz/1000; + + wtm_init(); + scm_init(); + gpio_init(); + fbcs_init(); + sdramc_init(); +} + +void wtm_init(void) +{ + /* Disable watchdog timer */ + MCF_WTM_WCR = 0; +} + +#define MCF_SCM_BCR_GBW (0x00000100) +#define MCF_SCM_BCR_GBR (0x00000200) + +void scm_init(void) +{ + /* All masters are trusted */ + MCF_SCM_MPR = 0x77777777; + + /* Allow supervisor/user, read/write, and trusted/untrusted + access to all slaves */ + MCF_SCM_PACRA = 0; + MCF_SCM_PACRB = 0; + MCF_SCM_PACRC = 0; + MCF_SCM_PACRD = 0; + MCF_SCM_PACRE = 0; + MCF_SCM_PACRF = 0; + + /* Enable bursts */ + MCF_SCM_BCR = (MCF_SCM_BCR_GBR | MCF_SCM_BCR_GBW); +} + + +void fbcs_init(void) +{ + MCF_GPIO_PAR_CS = 0x0000003E; + + /* Latch chip select */ + MCF_FBCS1_CSAR = 0x10080000; + + MCF_FBCS1_CSCR = 0x002A3780; + MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_2M | MCF_FBCS_CSMR_V); + + /* Initialize latch to drive signals to inactive states */ + *((u16 *)(0x10080000)) = 0xFFFF; + + /* External SRAM */ + MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS; + MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16 + | MCF_FBCS_CSCR_AA + | MCF_FBCS_CSCR_SBM + | MCF_FBCS_CSCR_WS(1)); + MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K + | MCF_FBCS_CSMR_V); + + /* Boot Flash connected to FBCS0 */ + MCF_FBCS0_CSAR = FLASH_ADDRESS; + MCF_FBCS0_CSCR = (MCF_FBCS_CSCR_PS_16 + | MCF_FBCS_CSCR_BEM + | MCF_FBCS_CSCR_AA + | MCF_FBCS_CSCR_SBM + | MCF_FBCS_CSCR_WS(7)); + MCF_FBCS0_CSMR = (MCF_FBCS_CSMR_BAM_32M + | MCF_FBCS_CSMR_V); +} + +void sdramc_init(void) +{ + /* + * Check to see if the SDRAM has already been initialized + * by a run control tool + */ + if (!(MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF)) { + /* SDRAM chip select initialization */ + + /* Initialize SDRAM chip select */ + MCF_SDRAMC_SDCS0 = (0 + | MCF_SDRAMC_SDCS_BA(SDRAM_ADDRESS) + | MCF_SDRAMC_SDCS_CSSZ(MCF_SDRAMC_SDCS_CSSZ_32MBYTE)); + + /* + * Basic configuration and initialization + */ + MCF_SDRAMC_SDCFG1 = (0 + | MCF_SDRAMC_SDCFG1_SRD2RW((int)((SDRAM_CASL + 2) + 0.5 )) + | MCF_SDRAMC_SDCFG1_SWT2RD(SDRAM_TWR + 1) + | MCF_SDRAMC_SDCFG1_RDLAT((int)((SDRAM_CASL*2) + 2)) + | MCF_SDRAMC_SDCFG1_ACT2RW((int)((SDRAM_TRCD ) + 0.5)) + | MCF_SDRAMC_SDCFG1_PRE2ACT((int)((SDRAM_TRP ) + 0.5)) + | MCF_SDRAMC_SDCFG1_REF2ACT((int)(((SDRAM_TRFC) ) + 0.5)) + | MCF_SDRAMC_SDCFG1_WTLAT(3)); + MCF_SDRAMC_SDCFG2 = (0 + | MCF_SDRAMC_SDCFG2_BRD2PRE(SDRAM_BL/2 + 1) + | MCF_SDRAMC_SDCFG2_BWT2RW(SDRAM_BL/2 + SDRAM_TWR) + | MCF_SDRAMC_SDCFG2_BRD2WT((int)((SDRAM_CASL+SDRAM_BL/2-1.0)+0.5)) + | MCF_SDRAMC_SDCFG2_BL(SDRAM_BL-1)); + + + /* + * Precharge and enable write to SDMR + */ + MCF_SDRAMC_SDCR = (0 + | MCF_SDRAMC_SDCR_MODE_EN + | MCF_SDRAMC_SDCR_CKE + | MCF_SDRAMC_SDCR_DDR + | MCF_SDRAMC_SDCR_MUX(1) + | MCF_SDRAMC_SDCR_RCNT((int)(((SDRAM_TREFI/(SYSTEM_PERIOD*64)) - 1) + 0.5)) + | MCF_SDRAMC_SDCR_PS_16 + | MCF_SDRAMC_SDCR_IPALL); + + /* + * Write extended mode register + */ + MCF_SDRAMC_SDMR = (0 + | MCF_SDRAMC_SDMR_BNKAD_LEMR + | MCF_SDRAMC_SDMR_AD(0x0) + | MCF_SDRAMC_SDMR_CMD); + + /* + * Write mode register and reset DLL + */ + MCF_SDRAMC_SDMR = (0 + | MCF_SDRAMC_SDMR_BNKAD_LMR + | MCF_SDRAMC_SDMR_AD(0x163) + | MCF_SDRAMC_SDMR_CMD); + + /* + * Execute a PALL command + */ + MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IPALL; + + /* + * Perform two REF cycles + */ + MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; + MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; + + /* + * Write mode register and clear reset DLL + */ + MCF_SDRAMC_SDMR = (0 + | MCF_SDRAMC_SDMR_BNKAD_LMR + | MCF_SDRAMC_SDMR_AD(0x063) + | MCF_SDRAMC_SDMR_CMD); + + /* + * Enable auto refresh and lock SDMR + */ + MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_MODE_EN; + MCF_SDRAMC_SDCR |= (0 + | MCF_SDRAMC_SDCR_REF + | MCF_SDRAMC_SDCR_DQS_OE(0xC)); + } +} + +void gpio_init(void) +{ + /* Enable UART0 pins */ + MCF_GPIO_PAR_UART = ( 0 + | MCF_GPIO_PAR_UART_PAR_URXD0 + | MCF_GPIO_PAR_UART_PAR_UTXD0); + + /* Initialize TIN3 as a GPIO output to enable the write + half of the latch */ + MCF_GPIO_PAR_TIMER = 0x00; + MCF_GPIO_PDDR_TIMER = 0x08; + MCF_GPIO_PCLRR_TIMER = 0x0; + +} + +int clock_pll(int fsys, int flags) +{ + int fref, temp, fout, mfd; + u32 i; + + fref = FREF; + + if (fsys == 0) { + /* Return current PLL output */ + mfd = MCF_PLL_PFDR; + + return (fref * mfd / (BUSDIV * 4)); + } + + /* Check bounds of requested system clock */ + if (fsys > MAX_FSYS) + fsys = MAX_FSYS; + if (fsys < MIN_FSYS) + fsys = MIN_FSYS; + + /* Multiplying by 100 when calculating the temp value, + and then dividing by 100 to calculate the mfd allows + for exact values without needing to include floating + point libraries. */ + temp = 100 * fsys / fref; + mfd = 4 * BUSDIV * temp / 100; + + /* Determine the output frequency for selected values */ + fout = (fref * mfd / (BUSDIV * 4)); + + /* + * Check to see if the SDRAM has already been initialized. + * If it has then the SDRAM needs to be put into self refresh + * mode before reprogramming the PLL. + */ + if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) + /* Put SDRAM into self refresh mode */ + MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_CKE; + + /* + * Initialize the PLL to generate the new system clock frequency. + * The device must be put into LIMP mode to reprogram the PLL. + */ + + /* Enter LIMP mode */ + clock_limp(DEFAULT_LPD); + + /* Reprogram PLL for desired fsys */ + MCF_PLL_PODR = (0 + | MCF_PLL_PODR_CPUDIV(BUSDIV/3) + | MCF_PLL_PODR_BUSDIV(BUSDIV)); + + MCF_PLL_PFDR = mfd; + + /* Exit LIMP mode */ + clock_exit_limp(); + + /* + * Return the SDRAM to normal operation if it is in use. + */ + if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) + /* Exit self refresh mode */ + MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_CKE; + + /* Errata - workaround for SDRAM opeartion after exiting LIMP mode */ + MCF_SDRAMC_LIMP_FIX = MCF_SDRAMC_REFRESH; + + /* wait for DQS logic to relock */ + for (i = 0; i < 0x200; i++) + ; + + return fout; +} + +int clock_limp(int div) +{ + u32 temp; + + /* Check bounds of divider */ + if (div < MIN_LPD) + div = MIN_LPD; + if (div > MAX_LPD) + div = MAX_LPD; + + /* Save of the current value of the SSIDIV so we don't + overwrite the value*/ + temp = (MCF_CCM_CDR & MCF_CCM_CDR_SSIDIV(0xF)); + + /* Apply the divider to the system clock */ + MCF_CCM_CDR = ( 0 + | MCF_CCM_CDR_LPDIV(div) + | MCF_CCM_CDR_SSIDIV(temp)); + + MCF_CCM_MISCCR |= MCF_CCM_MISCCR_LIMP; + + return (FREF/(3*(1 << div))); +} + +int clock_exit_limp(void) +{ + int fout; + + /* Exit LIMP mode */ + MCF_CCM_MISCCR = (MCF_CCM_MISCCR & ~ MCF_CCM_MISCCR_LIMP); + + /* Wait for PLL to lock */ + while (!(MCF_CCM_MISCCR & MCF_CCM_MISCCR_PLL_LOCK)) + ; + + fout = get_sys_clock(); + + return fout; +} + +int get_sys_clock(void) +{ + int divider; + + /* Test to see if device is in LIMP mode */ + if (MCF_CCM_MISCCR & MCF_CCM_MISCCR_LIMP) { + divider = MCF_CCM_CDR & MCF_CCM_CDR_LPDIV(0xF); + return (FREF/(2 << divider)); + } + else + return ((FREF * MCF_PLL_PFDR) / (BUSDIV * 4)); +} diff --git a/arch/m68knommu/platform/5407/config.c b/arch/m68knommu/platform/5407/config.c index f7c9018b85a7..5aad2645f0f1 100644 --- a/arch/m68knommu/platform/5407/config.c +++ b/arch/m68knommu/platform/5407/config.c @@ -9,7 +9,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/param.h> diff --git a/arch/m68knommu/platform/68328/Makefile b/arch/m68knommu/platform/68328/Makefile index 1b3b719e4479..5e5435552d56 100644 --- a/arch/m68knommu/platform/68328/Makefile +++ b/arch/m68knommu/platform/68328/Makefile @@ -8,6 +8,7 @@ head-$(CONFIG_DRAGEN2) = head-de2.o obj-y += entry.o ints.o timers.o obj-$(CONFIG_M68328) += config.o +obj-$(CONFIG_ROM) += romvec.o extra-y := head.o extra-$(CONFIG_M68328) += bootlogo.rh head.o diff --git a/arch/m68knommu/platform/68328/config.c b/arch/m68knommu/platform/68328/config.c index bcfa5d7fe1e2..26ffeba28642 100644 --- a/arch/m68knommu/platform/68328/config.c +++ b/arch/m68knommu/platform/68328/config.c @@ -17,7 +17,6 @@ #include <asm/dbg.h> #include <stdarg.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> diff --git a/arch/m68knommu/platform/68328/entry.S b/arch/m68knommu/platform/68328/entry.S index 7d8990d784a2..f97862715450 100644 --- a/arch/m68knommu/platform/68328/entry.S +++ b/arch/m68knommu/platform/68328/entry.S @@ -10,7 +10,6 @@ * Linux/m68k support by Hamish Macdonald */ -#include <linux/config.h> #include <linux/sys.h> #include <linux/linkage.h> #include <asm/thread_info.h> diff --git a/arch/m68knommu/platform/68328/head-de2.S b/arch/m68knommu/platform/68328/head-de2.S index 94c5a1609a75..92d96456d363 100644 --- a/arch/m68knommu/platform/68328/head-de2.S +++ b/arch/m68knommu/platform/68328/head-de2.S @@ -1,4 +1,3 @@ -#include <linux/config.h> #if defined(CONFIG_RAM32MB) #define MEM_END 0x02000000 /* Memory size 32Mb */ diff --git a/arch/m68knommu/platform/68328/head-pilot.S b/arch/m68knommu/platform/68328/head-pilot.S index c46775fe04be..9e07faa3e81d 100644 --- a/arch/m68knommu/platform/68328/head-pilot.S +++ b/arch/m68knommu/platform/68328/head-pilot.S @@ -15,13 +15,11 @@ #define IMMED # #define DBG_PUTC(x) moveb IMMED x, 0xfffff907 -#include <linux/config.h> .global _stext .global _start .global _rambase -.global __ramvec .global _ramvec .global _ramstart .global _ramend @@ -121,7 +119,7 @@ L0: DBG_PUTC('B') /* Copy command line from beginning of RAM (+16) to end of bss */ - movel #__ramvec, %d7 + movel #CONFIG_VECTORBASE, %d7 addl #16, %d7 moveal %d7, %a0 moveal #_ebss, %a1 diff --git a/arch/m68knommu/platform/68328/head-ram.S b/arch/m68knommu/platform/68328/head-ram.S index 6bdc9bce43f2..252b80b02038 100644 --- a/arch/m68knommu/platform/68328/head-ram.S +++ b/arch/m68knommu/platform/68328/head-ram.S @@ -1,10 +1,6 @@ -#include <linux/config.h> .global __main - .global __ram_start - .global __ram_end .global __rom_start - .global __rom_end .global _rambase .global _ramstart @@ -12,6 +8,7 @@ .global splash_bits .global _start .global _stext + .global _edata #define DEBUG #define ROM_OFFSET 0x10C00000 @@ -73,7 +70,7 @@ pclp1: #ifdef CONFIG_RELOCATE /* Copy me to RAM */ moveal #__rom_start, %a0 - moveal #__ram_start, %a1 + moveal #_stext, %a1 moveal #_edata, %a2 /* Copy %a0 to %a1 until %a1 == %a2 */ diff --git a/arch/m68knommu/platform/68328/head-rom.S b/arch/m68knommu/platform/68328/head-rom.S index 2b448a297011..6ec77d3ea0b3 100644 --- a/arch/m68knommu/platform/68328/head-rom.S +++ b/arch/m68knommu/platform/68328/head-rom.S @@ -1,4 +1,3 @@ -#include <linux/config.h> .global _start .global _stext @@ -28,6 +27,8 @@ _ramstart: _ramend: .long 0 +#define RAMEND (CONFIG_RAMBASE + CONFIG_RAMSIZE) + #ifdef CONFIG_INIT_LCD splash_bits: #include "bootlogo.rh" @@ -48,7 +49,7 @@ _stext: movew #0x2700,%sr moveb #0x81, 0xfffffA27 /* LCKCON */ movew #0xff00, 0xfffff412 /* LCD pins */ #endif - moveal #__ramend-CONFIG_MEMORY_RESERVE*0x100000 - 0x10, %sp + moveal #RAMEND-CONFIG_MEMORY_RESERVE*0x100000 - 0x10, %sp movew #32767, %d0 /* PLL settle wait loop */ 1: subq #1, %d0 bne 1b @@ -73,13 +74,13 @@ _stext: movew #0x2700,%sr bhi 1b movel #_sdata, %d0 - movel %d0, _rambase - movel #_ebss, %d0 - movel %d0, _ramstart - movel #__ramend-CONFIG_MEMORY_RESERVE*0x100000, %d0 - movel %d0, _ramend - movel #__ramvec, %d0 - movel %d0, _ramvec + movel %d0, _rambase + movel #_ebss, %d0 + movel %d0, _ramstart + movel #RAMEND-CONFIG_MEMORY_RESERVE*0x100000, %d0 + movel %d0, _ramend + movel #CONFIG_VECTORBASE, %d0 + movel %d0, _ramvec /* * load the current task pointer and stack diff --git a/arch/m68knommu/platform/68328/ints.c b/arch/m68knommu/platform/68328/ints.c index 7437217813d2..2dda7339aae5 100644 --- a/arch/m68knommu/platform/68328/ints.c +++ b/arch/m68knommu/platform/68328/ints.c @@ -18,6 +18,7 @@ #include <asm/system.h> #include <asm/irq.h> +#include <asm/irqnode.h> #include <asm/traps.h> #include <asm/io.h> #include <asm/machdep.h> @@ -82,25 +83,6 @@ unsigned int local_irq_count[NR_CPUS]; /* irq node variables for the 32 (potential) on chip sources */ static irq_node_t int_irq_list[NR_IRQS]; -#if !defined(CONFIG_DRAGEN2) -asm (".global _start, __ramend/n/t" - ".section .romvec/n" - "e_vectors:\n\t" - ".long __ramend-4, _start, buserr, trap, trap, trap, trap, trap\n\t" - ".long trap, trap, trap, trap, trap, trap, trap, trap\n\t" - ".long trap, trap, trap, trap, trap, trap, trap, trap\n\t" - ".long trap, trap, trap, trap\n\t" - ".long trap, trap, trap, trap\n\t" - /*.long inthandler, inthandler, inthandler, inthandler - .long inthandler4, inthandler, inthandler, inthandler */ - /* TRAP #0-15 */ - ".long system_call, trap, trap, trap, trap, trap, trap, trap\n\t" - ".long trap, trap, trap, trap, trap, trap, trap, trap\n\t" - ".long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0\n\t" - ".text\n" - "ignore: rte"); -#endif - /* * This function should be called during kernel startup to initialize * the IRQ handling routines. diff --git a/arch/m68knommu/platform/68328/romvec.S b/arch/m68knommu/platform/68328/romvec.S new file mode 100644 index 000000000000..3e7fe1e14913 --- /dev/null +++ b/arch/m68knommu/platform/68328/romvec.S @@ -0,0 +1,37 @@ +/* + * linux/arch/m68knommu/platform/68328/romvec.S + * + * 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 1996 Roman Zippel + * Copyright 1999 D. Jeff Dionne <jeff@rt-control.com> + * Copyright 2006 Greg Ungerer <gerg@snapgear.com> + */ + +#include <linux/config.h> + +.global _start +.global _buserr +.global trap +.global system_call + +.section .romvec + +e_vectors: +.long CONFIG_RAMBASE+CONFIG_RAMSIZE-4, _start, buserr, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +/* TRAP #0-15 */ +.long system_call, trap, trap, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +.long trap, trap, trap, trap +.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + diff --git a/arch/m68knommu/platform/68328/timers.c b/arch/m68knommu/platform/68328/timers.c index 68c2cd6b0030..438ef6ee9720 100644 --- a/arch/m68knommu/platform/68328/timers.c +++ b/arch/m68knommu/platform/68328/timers.c @@ -14,7 +14,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> diff --git a/arch/m68knommu/platform/68360/config.c b/arch/m68knommu/platform/68360/config.c index 3db244625f0f..c5482e3622eb 100644 --- a/arch/m68knommu/platform/68360/config.c +++ b/arch/m68knommu/platform/68360/config.c @@ -11,7 +11,6 @@ */ #include <stdarg.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -141,13 +140,13 @@ int BSP_set_clock_mmss (unsigned long nowtime) void BSP_reset (void) { local_irq_disable(); - asm volatile (" - moveal #_start, %a0; - moveb #0, 0xFFFFF300; - moveal 0(%a0), %sp; - moveal 4(%a0), %a0; - jmp (%a0); - "); + asm volatile ( + "moveal #_start, %a0;\n" + "moveb #0, 0xFFFFF300;\n" + "moveal 0(%a0), %sp;\n" + "moveal 4(%a0), %a0;\n" + "jmp (%a0);\n" + ); } unsigned char *scc1_hwaddr; diff --git a/arch/m68knommu/platform/68360/entry.S b/arch/m68knommu/platform/68360/entry.S index 8ff48adf24ab..f1af8977f294 100644 --- a/arch/m68knommu/platform/68360/entry.S +++ b/arch/m68knommu/platform/68360/entry.S @@ -12,7 +12,6 @@ * M68360 Port by SED Systems, and Lineo. */ -#include <linux/config.h> #include <linux/sys.h> #include <linux/linkage.h> #include <asm/thread_info.h> diff --git a/arch/m68knommu/platform/68360/head-ram.S b/arch/m68knommu/platform/68360/head-ram.S index a5c639a51eef..2ea51479f13a 100644 --- a/arch/m68knommu/platform/68360/head-ram.S +++ b/arch/m68knommu/platform/68360/head-ram.S @@ -12,13 +12,11 @@ * */ #define ASSEMBLY -#include <linux/config.h> .global _stext .global _start .global _rambase -.global __ramvec .global _ramvec .global _ramstart .global _ramend @@ -26,6 +24,8 @@ .global _quicc_base .global _periph_base +#define RAMEND (CONFIG_RAMBASE + CONFIG_RAMSIZE) + #define REGB 0x1000 #define PEPAR (_dprbase + REGB + 0x0016) #define GMR (_dprbase + REGB + 0x0040) @@ -103,7 +103,7 @@ _stext: nop ori.w #MCU_DISABLE_INTRPTS, %sr /* disable interrupts: */ /* We should not need to setup the boot stack the reset should do it. */ - movea.l #__ramend, %sp /*set up stack at the end of DRAM:*/ + movea.l #RAMEND, %sp /*set up stack at the end of DRAM:*/ set_mbar_register: moveq.l #0x07, %d1 /* Setup MBAR */ @@ -163,7 +163,7 @@ configure_memory_controller: move.l %d0, GMR configure_chip_select_0: - move.l #__ramend, %d0 + move.l #RAMEND, %d0 subi.l #__ramstart, %d0 subq.l #0x01, %d0 eori.l #SIM_OR_MASK, %d0 @@ -234,16 +234,10 @@ store_ram_size: /* Set ram size information */ move.l #_sdata, _rambase move.l #_ebss, _ramstart - move.l #__ramend, %d0 + move.l #RAMEND, %d0 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/ - move.l %d0, _ramend /* Different from __ramend.*/ + move.l %d0, _ramend /* Different from RAMEND.*/ -store_flash_size: - /* Set rom size information */ - move.l #__rom_end, %d0 - sub.l #__rom_start, %d0 - move.l %d0, rom_length - pea 0 pea env pea %sp@(4) @@ -286,7 +280,7 @@ _dprbase: */ .section ".data.initvect","awx" - .long __ramend /* Reset: Initial Stack Pointer - 0. */ + .long RAMEND /* Reset: Initial Stack Pointer - 0. */ .long _start /* Reset: Initial Program Counter - 1. */ .long buserr /* Bus Error - 2. */ .long trap /* Address Error - 3. */ diff --git a/arch/m68knommu/platform/68360/head-rom.S b/arch/m68knommu/platform/68360/head-rom.S index 0da357a4cfee..62ecf4144b3b 100644 --- a/arch/m68knommu/platform/68360/head-rom.S +++ b/arch/m68knommu/platform/68360/head-rom.S @@ -11,14 +11,12 @@ * Copyright (C) 1998 D. Jeff Dionne <jeff@uclinux.org>, * */ -#include <linux/config.h> .global _stext .global _sbss .global _start .global _rambase -.global __ramvec .global _ramvec .global _ramstart .global _ramend @@ -26,6 +24,8 @@ .global _quicc_base .global _periph_base +#define RAMEND (CONFIG_RAMBASE + CONFIG_RAMSIZE) + #define REGB 0x1000 #define PEPAR (_dprbase + REGB + 0x0016) #define GMR (_dprbase + REGB + 0x0040) @@ -115,7 +115,7 @@ _stext: nop ori.w #MCU_DISABLE_INTRPTS, %sr /* disable interrupts: */ /* We should not need to setup the boot stack the reset should do it. */ - movea.l #__ramend, %sp /* set up stack at the end of DRAM:*/ + movea.l #RAMEND, %sp /* set up stack at the end of DRAM:*/ set_mbar_register: @@ -245,16 +245,10 @@ store_ram_size: /* Set ram size information */ move.l #_sdata, _rambase move.l #_ebss, _ramstart - move.l #__ramend, %d0 + move.l #RAMEND, %d0 sub.l #0x1000, %d0 /* Reserve 4K for stack space.*/ - move.l %d0, _ramend /* Different from __ramend.*/ + move.l %d0, _ramend /* Different from RAMEND.*/ -store_flash_size: - /* Set rom size information */ - move.l #__rom_end, %d0 - sub.l #__rom_start, %d0 - move.l %d0, rom_length - pea 0 pea env pea %sp@(4) @@ -298,7 +292,7 @@ _dprbase: */ .section ".data.initvect","awx" - .long __ramend /* Reset: Initial Stack Pointer - 0. */ + .long RAMEND /* Reset: Initial Stack Pointer - 0. */ .long _start /* Reset: Initial Program Counter - 1. */ .long buserr /* Bus Error - 2. */ .long trap /* Address Error - 3. */ diff --git a/arch/m68knommu/platform/68360/ints.c b/arch/m68knommu/platform/68360/ints.c index ba184db1651b..4df3c146eb74 100644 --- a/arch/m68knommu/platform/68360/ints.c +++ b/arch/m68knommu/platform/68360/ints.c @@ -10,7 +10,6 @@ * Copyright (c) 1999 D. Jeff Dionne <jeff@uclinux.org> */ -#include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> @@ -20,6 +19,7 @@ #include <asm/system.h> #include <asm/irq.h> +#include <asm/irqnode.h> #include <asm/traps.h> #include <asm/io.h> #include <asm/machdep.h> diff --git a/arch/m68knommu/platform/68EZ328/config.c b/arch/m68knommu/platform/68EZ328/config.c index d8d56e5de310..659b80aca118 100644 --- a/arch/m68knommu/platform/68EZ328/config.c +++ b/arch/m68knommu/platform/68EZ328/config.c @@ -14,7 +14,6 @@ /***************************************************************************/ #include <stdarg.h> -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -42,13 +41,13 @@ void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int void m68ez328_reset(void) { local_irq_disable(); - asm volatile (" - moveal #0x10c00000, %a0; - moveb #0, 0xFFFFF300; - moveal 0(%a0), %sp; - moveal 4(%a0), %a0; - jmp (%a0); - "); + asm volatile ( + "moveal #0x10c00000, %a0;\n" + "moveb #0, 0xFFFFF300;\n" + "moveal 0(%a0), %sp;\n" + "moveal 4(%a0), %a0;\n" + "jmp (%a0);\n" + ); } /***************************************************************************/ diff --git a/arch/m68knommu/platform/68VZ328/config.c b/arch/m68knommu/platform/68VZ328/config.c index d926524cdf82..fcd100b7594d 100644 --- a/arch/m68knommu/platform/68VZ328/config.c +++ b/arch/m68knommu/platform/68VZ328/config.c @@ -14,7 +14,6 @@ /***************************************************************************/ -#include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/mm.h> @@ -141,13 +140,13 @@ static void init_hardware(char *command, int size) static void m68vz328_reset(void) { local_irq_disable(); - asm volatile (" - moveal #0x10c00000, %a0; - moveb #0, 0xFFFFF300; - moveal 0(%a0), %sp; - moveal 4(%a0), %a0; - jmp (%a0); - "); + asm volatile ( + "moveal #0x10c00000, %a0;\n\t" + "moveb #0, 0xFFFFF300;\n\t" + "moveal 0(%a0), %sp;\n\t" + "moveal 4(%a0), %a0;\n\t" + "jmp (%a0);\n" + ); } unsigned char *cs8900a_hwaddr; |