From caf96194c05cd97ce96546fbcb1f35ec06aaaac7 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 13 Oct 2010 20:35:56 -0400 Subject: parisc: add prlimit64 syscall Signed-off-by: Kyle McMartin --- arch/parisc/kernel/syscall_table.S | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 3d52c978738..74867dfdabe 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S @@ -419,6 +419,7 @@ ENTRY_SAME(perf_event_open) ENTRY_COMP(recvmmsg) ENTRY_SAME(accept4) /* 320 */ + ENTRY_SAME(prlimit64) /* Nothing yet */ -- cgit v1.2.3-70-g09d2 From ba20085c20f1c9e8af546dea6ad0efa421bdef32 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 13 Oct 2010 21:00:55 -0400 Subject: parisc: lay groundwork for killing __do_IRQ Use proper accessors and handlers for generic irq cleanups. We just call back into __do_IRQ through desc->handler now, and remove the explicit calls. Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/irq.h | 3 +++ arch/parisc/kernel/irq.c | 26 ++++++++++++++++---------- drivers/parisc/dino.c | 8 +++----- drivers/parisc/eisa.c | 8 ++++---- drivers/parisc/gsc.c | 15 ++++++--------- drivers/parisc/iosapic.c | 15 ++++----------- drivers/parisc/superio.c | 6 ++---- 7 files changed, 38 insertions(+), 43 deletions(-) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h index dfa26b67f91..47041d448d3 100644 --- a/arch/parisc/include/asm/irq.h +++ b/arch/parisc/include/asm/irq.h @@ -32,6 +32,9 @@ static __inline__ int irq_canonicalize(int irq) } struct irq_chip; +struct irq_desc; + +extern void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc); /* * Some useful "we don't have to do anything here" handlers. Should diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index efbcee5d222..272c29a44f2 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -151,7 +151,7 @@ static struct irq_chip cpu_interrupt_type = { .enable = cpu_enable_irq, .disable = cpu_disable_irq, .ack = cpu_ack_irq, - .end = cpu_end_irq, + .eoi = cpu_end_irq, #ifdef CONFIG_SMP .set_affinity = cpu_set_affinity_irq, #endif @@ -247,10 +247,11 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data) if (irq_desc[irq].chip != &cpu_interrupt_type) return -EBUSY; + /* for iosapic interrupts */ if (type) { - irq_desc[irq].chip = type; - irq_desc[irq].chip_data = data; - cpu_interrupt_type.enable(irq); + set_irq_chip_and_handler(irq, type, parisc_do_IRQ); + set_irq_chip_data(irq, data); + cpu_enable_irq(irq); } return 0; } @@ -368,7 +369,7 @@ void do_cpu_irq_mask(struct pt_regs *regs) goto set_out; } #endif - __do_IRQ(irq); + generic_handle_irq(irq); out: irq_exit(); @@ -398,14 +399,14 @@ static void claim_cpu_irqs(void) { int i; for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) { - irq_desc[i].chip = &cpu_interrupt_type; + set_irq_chip_and_handler(i, &cpu_interrupt_type, parisc_do_IRQ); } - irq_desc[TIMER_IRQ].action = &timer_action; - irq_desc[TIMER_IRQ].status = IRQ_PER_CPU; + set_irq_handler(TIMER_IRQ, handle_percpu_irq); + setup_irq(TIMER_IRQ, &timer_action); #ifdef CONFIG_SMP - irq_desc[IPI_IRQ].action = &ipi_action; - irq_desc[IPI_IRQ].status = IRQ_PER_CPU; + set_irq_handler(IPI_IRQ, handle_percpu_irq); + setup_irq(IPI_IRQ, &ipi_action); #endif } @@ -423,3 +424,8 @@ void __init init_IRQ(void) set_eiem(cpu_eiem); /* EIEM : enable all external intr */ } + +void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc) +{ + __do_IRQ(irq); +} diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index c542c7bb745..3013c57f121 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c @@ -298,8 +298,7 @@ static struct pci_port_ops dino_port_ops = { static void dino_disable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct dino_device *dino_dev = desc->chip_data; + struct dino_device *dino_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq); @@ -311,8 +310,7 @@ static void dino_disable_irq(unsigned int irq) static void dino_enable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct dino_device *dino_dev = desc->chip_data; + struct dino_device *dino_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS); u32 tmp; @@ -391,7 +389,7 @@ ilr_again: int irq = dino_dev->global_irq[local_irq]; DBG(KERN_DEBUG "%s(%d, %p) mask 0x%x\n", __func__, irq, intr_dev, mask); - __do_IRQ(irq); + generic_handle_irq(irq); mask &= ~(1 << local_irq); } while (mask); diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c index 46f503fb7fc..58541770221 100644 --- a/drivers/parisc/eisa.c +++ b/drivers/parisc/eisa.c @@ -233,7 +233,7 @@ static irqreturn_t eisa_irq(int wax_irq, void *intr_dev) } spin_unlock_irqrestore(&eisa_irq_lock, flags); - __do_IRQ(irq); + generic_handle_irq(irq); spin_lock_irqsave(&eisa_irq_lock, flags); /* unmask */ @@ -346,10 +346,10 @@ static int __init eisa_probe(struct parisc_device *dev) } /* Reserve IRQ2 */ - irq_to_desc(2)->action = &irq2_action; - + setup_irq(2, &irq2_action); for (i = 0; i < 16; i++) { - irq_to_desc(i)->chip = &eisa_interrupt_type; + set_irq_chip_and_handler(i, &eisa_interrupt_type, + parisc_do_IRQ); } EISA_bus = 1; diff --git a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c index 20a1bce1a03..68bccdafa89 100644 --- a/drivers/parisc/gsc.c +++ b/drivers/parisc/gsc.c @@ -86,7 +86,7 @@ irqreturn_t gsc_asic_intr(int gsc_asic_irq, void *dev) do { int local_irq = __ffs(irr); unsigned int irq = gsc_asic->global_irq[local_irq]; - __do_IRQ(irq); + generic_handle_irq(irq); irr &= ~(1 << local_irq); } while (irr); @@ -107,8 +107,7 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit) static void gsc_asic_disable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct gsc_asic *irq_dev = desc->chip_data; + struct gsc_asic *irq_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); u32 imr; @@ -123,8 +122,7 @@ static void gsc_asic_disable_irq(unsigned int irq) static void gsc_asic_enable_irq(unsigned int irq) { - struct irq_desc *desc = irq_to_desc(irq); - struct gsc_asic *irq_dev = desc->chip_data; + struct gsc_asic *irq_dev = get_irq_chip_data(irq); int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32); u32 imr; @@ -160,14 +158,13 @@ static struct irq_chip gsc_asic_interrupt_type = { int gsc_assign_irq(struct irq_chip *type, void *data) { static int irq = GSC_IRQ_BASE; - struct irq_desc *desc; if (irq > GSC_IRQ_MAX) return NO_IRQ; - desc = irq_to_desc(irq); - desc->chip = type; - desc->chip_data = data; + set_irq_chip_and_handler(irq, type, parisc_do_IRQ); + set_irq_chip_data(irq, data); + return irq++; } diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index c76836727ca..10348c9a22c 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -615,17 +615,10 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1) } -static struct vector_info *iosapic_get_vector(unsigned int irq) -{ - struct irq_desc *desc = irq_to_desc(irq); - - return desc->chip_data; -} - static void iosapic_disable_irq(unsigned int irq) { unsigned long flags; - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1; spin_lock_irqsave(&iosapic_lock, flags); @@ -637,7 +630,7 @@ static void iosapic_disable_irq(unsigned int irq) static void iosapic_enable_irq(unsigned int irq) { - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1; /* data is initialized by fixup_irq */ @@ -688,7 +681,7 @@ printk("\n"); */ static void iosapic_end_irq(unsigned int irq) { - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); DBG(KERN_DEBUG "end_irq(%d): eoi(%p, 0x%x)\n", irq, vi->eoi_addr, vi->eoi_data); iosapic_eoi(vi->eoi_addr, vi->eoi_data); @@ -705,7 +698,7 @@ static unsigned int iosapic_startup_irq(unsigned int irq) static int iosapic_set_affinity_irq(unsigned int irq, const struct cpumask *dest) { - struct vector_info *vi = iosapic_get_vector(irq); + struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1, dummy_d0; unsigned long flags; int dest_cpu; diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index f7806d81f1e..aceec6ed511 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -139,7 +139,7 @@ superio_interrupt(int parent_irq, void *devp) } /* Call the appropriate device's interrupt */ - __do_IRQ(local_irq); + generic_handle_irq(local_irq); /* set EOI - forces a new interrupt if a lower priority device * still needs service. @@ -363,9 +363,7 @@ int superio_fixup_irq(struct pci_dev *pcidev) #endif for (i = 0; i < 16; i++) { - struct irq_desc *desc = irq_to_desc(i); - - desc->chip = &superio_interrupt_type; + set_irq_chip_and_handler(i, &superio_interrupt_type, parisc_do_IRQ); } /* -- cgit v1.2.3-70-g09d2 From 4d4f681dc43a06167763ec698f5de4f2b3119ad6 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 00:12:23 -0400 Subject: parisc: convert cpu interrupts to proper flow handlers Only major change is renaming functions to match the conventions expected by the generic irq code. Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/irq.h | 2 +- arch/parisc/kernel/irq.c | 25 +++++++++---------------- drivers/parisc/iosapic.c | 2 +- 3 files changed, 11 insertions(+), 18 deletions(-) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h index 47041d448d3..3a9b2498fd1 100644 --- a/arch/parisc/include/asm/irq.h +++ b/arch/parisc/include/asm/irq.h @@ -43,7 +43,7 @@ extern void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc); void no_ack_irq(unsigned int irq); void no_end_irq(unsigned int irq); void cpu_ack_irq(unsigned int irq); -void cpu_end_irq(unsigned int irq); +void cpu_eoi_irq(unsigned int irq); extern int txn_alloc_irq(unsigned int nbits); extern int txn_claim_irq(int); diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index 272c29a44f2..13bfa9702fd 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -52,7 +52,7 @@ static volatile unsigned long cpu_eiem = 0; */ static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL; -static void cpu_disable_irq(unsigned int irq) +static void cpu_mask_irq(unsigned int irq) { unsigned long eirr_bit = EIEM_MASK(irq); @@ -63,7 +63,7 @@ static void cpu_disable_irq(unsigned int irq) * then gets disabled */ } -static void cpu_enable_irq(unsigned int irq) +static void cpu_unmask_irq(unsigned int irq) { unsigned long eirr_bit = EIEM_MASK(irq); @@ -75,12 +75,6 @@ static void cpu_enable_irq(unsigned int irq) smp_send_all_nop(); } -static unsigned int cpu_startup_irq(unsigned int irq) -{ - cpu_enable_irq(irq); - return 0; -} - void no_ack_irq(unsigned int irq) { } void no_end_irq(unsigned int irq) { } @@ -99,7 +93,7 @@ void cpu_ack_irq(unsigned int irq) mtctl(mask, 23); } -void cpu_end_irq(unsigned int irq) +void cpu_eoi_irq(unsigned int irq) { unsigned long mask = EIEM_MASK(irq); int cpu = smp_processor_id(); @@ -146,12 +140,10 @@ static int cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest) static struct irq_chip cpu_interrupt_type = { .name = "CPU", - .startup = cpu_startup_irq, - .shutdown = cpu_disable_irq, - .enable = cpu_enable_irq, - .disable = cpu_disable_irq, + .mask = cpu_mask_irq, + .unmask = cpu_unmask_irq, .ack = cpu_ack_irq, - .eoi = cpu_end_irq, + .eoi = cpu_eoi_irq, #ifdef CONFIG_SMP .set_affinity = cpu_set_affinity_irq, #endif @@ -251,7 +243,7 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data) if (type) { set_irq_chip_and_handler(irq, type, parisc_do_IRQ); set_irq_chip_data(irq, data); - cpu_enable_irq(irq); + cpu_unmask_irq(irq); } return 0; } @@ -399,7 +391,8 @@ static void claim_cpu_irqs(void) { int i; for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) { - set_irq_chip_and_handler(i, &cpu_interrupt_type, parisc_do_IRQ); + set_irq_chip_and_handler(i, &cpu_interrupt_type, + handle_level_irq); } set_irq_handler(TIMER_IRQ, handle_percpu_irq); diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 10348c9a22c..13020881d08 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -685,7 +685,7 @@ static void iosapic_end_irq(unsigned int irq) DBG(KERN_DEBUG "end_irq(%d): eoi(%p, 0x%x)\n", irq, vi->eoi_addr, vi->eoi_data); iosapic_eoi(vi->eoi_addr, vi->eoi_data); - cpu_end_irq(irq); + cpu_eoi_irq(irq); } static unsigned int iosapic_startup_irq(unsigned int irq) -- cgit v1.2.3-70-g09d2 From f3d4605977f9f30993c670a85f75d8f3853144c5 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 00:38:27 -0400 Subject: parisc: convert iosapic interrupts to proper flow handlers Shift the ->end call (cpu eoi) from __do_IRQ into our unmask handler. Also nuke some redundant code. Signed-off-by: Kyle McMartin --- arch/parisc/kernel/irq.c | 2 +- drivers/parisc/iosapic.c | 37 ++++++------------------------------- 2 files changed, 7 insertions(+), 32 deletions(-) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index 13bfa9702fd..e873edaf274 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -241,7 +241,7 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data) /* for iosapic interrupts */ if (type) { - set_irq_chip_and_handler(irq, type, parisc_do_IRQ); + set_irq_chip_and_handler(irq, type, handle_level_irq); set_irq_chip_data(irq, data); cpu_unmask_irq(irq); } diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index 13020881d08..edab2941e1d 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -615,7 +615,7 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1) } -static void iosapic_disable_irq(unsigned int irq) +static void iosapic_mask_irq(unsigned int irq) { unsigned long flags; struct vector_info *vi = get_irq_chip_data(irq); @@ -628,7 +628,7 @@ static void iosapic_disable_irq(unsigned int irq) spin_unlock_irqrestore(&iosapic_lock, flags); } -static void iosapic_enable_irq(unsigned int irq) +static void iosapic_unmask_irq(unsigned int irq) { struct vector_info *vi = get_irq_chip_data(irq); u32 d0, d1; @@ -669,31 +669,9 @@ printk("\n"); DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", irq, vi->eoi_addr, vi->eoi_data); iosapic_eoi(vi->eoi_addr, vi->eoi_data); -} - -/* - * PARISC only supports PCI devices below I/O SAPIC. - * PCI only supports level triggered in order to share IRQ lines. - * ergo I/O SAPIC must always issue EOI on parisc. - * - * i386/ia64 support ISA devices and have to deal with - * edge-triggered interrupts too. - */ -static void iosapic_end_irq(unsigned int irq) -{ - struct vector_info *vi = get_irq_chip_data(irq); - DBG(KERN_DEBUG "end_irq(%d): eoi(%p, 0x%x)\n", irq, - vi->eoi_addr, vi->eoi_data); - iosapic_eoi(vi->eoi_addr, vi->eoi_data); cpu_eoi_irq(irq); } -static unsigned int iosapic_startup_irq(unsigned int irq) -{ - iosapic_enable_irq(irq); - return 0; -} - #ifdef CONFIG_SMP static int iosapic_set_affinity_irq(unsigned int irq, const struct cpumask *dest) @@ -723,13 +701,10 @@ static int iosapic_set_affinity_irq(unsigned int irq, #endif static struct irq_chip iosapic_interrupt_type = { - .name = "IO-SAPIC-level", - .startup = iosapic_startup_irq, - .shutdown = iosapic_disable_irq, - .enable = iosapic_enable_irq, - .disable = iosapic_disable_irq, - .ack = cpu_ack_irq, - .end = iosapic_end_irq, + .name = "IO-SAPIC-level", + .unmask = iosapic_unmask_irq, + .mask = iosapic_mask_irq, + .ack = cpu_ack_irq, #ifdef CONFIG_SMP .set_affinity = iosapic_set_affinity_irq, #endif -- cgit v1.2.3-70-g09d2 From 7da1272547ebe96982a42292dfc833457708f4da Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 14 Oct 2010 01:02:23 -0400 Subject: parisc: kill __do_IRQ Signed-off-by: Kyle McMartin --- arch/parisc/Kconfig | 4 ++++ arch/parisc/include/asm/irq.h | 3 --- arch/parisc/kernel/irq.c | 4 ---- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 907417d187e..2cb6401fc8a 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig @@ -18,6 +18,7 @@ config PARISC select BUG select HAVE_PERF_EVENTS select GENERIC_ATOMIC64 if !64BIT + select GENERIC_HARDIRQS_NO__DO_IRQ help The PA-RISC microprocessor is designed by Hewlett-Packard and used in many of their workstations & servers (HP9000 700 and 800 series, @@ -84,6 +85,9 @@ config IRQ_PER_CPU bool default y +config GENERIC_HARDIRQS_NO__DO_IRQ + def_bool y + # unless you want to implement ACPI on PA-RISC ... ;-) config PM bool diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h index 3a9b2498fd1..c67dccf2e31 100644 --- a/arch/parisc/include/asm/irq.h +++ b/arch/parisc/include/asm/irq.h @@ -32,9 +32,6 @@ static __inline__ int irq_canonicalize(int irq) } struct irq_chip; -struct irq_desc; - -extern void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc); /* * Some useful "we don't have to do anything here" handlers. Should diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c index e873edaf274..5024f643b3b 100644 --- a/arch/parisc/kernel/irq.c +++ b/arch/parisc/kernel/irq.c @@ -418,7 +418,3 @@ void __init init_IRQ(void) } -void parisc_do_IRQ(unsigned int irq, struct irq_desc *desc) -{ - __do_IRQ(irq); -} -- cgit v1.2.3-70-g09d2 From b1b1d4a6f244eb9513f006a188f7ed30d5014de5 Mon Sep 17 00:00:00 2001 From: Phil Carmody Date: Fri, 10 Sep 2010 13:47:59 +0300 Subject: parisc: unwind - optimise linked-list searches for modules Having many dozens of modules, the searches down the linked list of sections would dominate the lookup time, dwarfing any savings from the binary search within the section. A simple move-to-front optimisation exploits the commonality of the code paths taken, and in simple real-world tests on other architectures reduced the number of steps in the search to barely more than 1. Signed-off-by: Phil Carmody Signed-off-by: Kyle McMartin --- arch/parisc/kernel/unwind.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c index d58eac1a828..76ed62ed785 100644 --- a/arch/parisc/kernel/unwind.c +++ b/arch/parisc/kernel/unwind.c @@ -80,8 +80,11 @@ find_unwind_entry(unsigned long addr) if (addr >= table->start && addr <= table->end) e = find_unwind_entry_in_table(table, addr); - if (e) + if (e) { + /* Move-to-front to exploit common traces */ + list_move(&table->list, &unwind_tables); break; + } } return e; -- cgit v1.2.3-70-g09d2 From 2da83b90bbbac586fca2735f7da21966a31ec33f Mon Sep 17 00:00:00 2001 From: Christian Dietrich Date: Mon, 6 Sep 2010 16:36:06 +0200 Subject: arch/parisc: Removing undead ifdef CONFIG_PA20 The CONFIG_PA20 ifdef isn't necessary at this point, because it is checked in an outer ifdef level already and has no effect here. Signed-off-by: Christian Dietrich Signed-off-by: Kyle McMartin --- arch/parisc/kernel/unaligned.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c index 92d977bb5ea..234e3682cf0 100644 --- a/arch/parisc/kernel/unaligned.c +++ b/arch/parisc/kernel/unaligned.c @@ -619,15 +619,12 @@ void handle_unaligned(struct pt_regs *regs) flop=1; ret = emulate_std(regs, R2(regs->iir),1); break; - -#ifdef CONFIG_PA20 case OPCODE_LDD_L: ret = emulate_ldd(regs, R2(regs->iir),0); break; case OPCODE_STD_L: ret = emulate_std(regs, R2(regs->iir),0); break; -#endif } #endif switch (regs->iir & OPCODE3_MASK) -- cgit v1.2.3-70-g09d2 From 650a35f868f809aade56ef960d8a465f57ac74e2 Mon Sep 17 00:00:00 2001 From: Guy Martin Date: Mon, 14 Jun 2010 19:24:41 +0200 Subject: parisc: add tty driver to PDC console This patch adds a tty driver to the PDC console. It allows the use of ports not supported by linux as a console (e.g. serial port on C8000.) The tty driver will not register the ttyB device if PDC console driver has been unregistered. This happens when the early printk console is disabled as it has not been selected as the primary console. Signed-off-by: Guy Martin Signed-off-by: Kyle McMartin --- arch/parisc/kernel/pdc_cons.c | 141 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 134 insertions(+), 7 deletions(-) (limited to 'arch/parisc/kernel') diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c index 1ff366cb968..66d1f17fdb9 100644 --- a/arch/parisc/kernel/pdc_cons.c +++ b/arch/parisc/kernel/pdc_cons.c @@ -12,6 +12,7 @@ * Copyright (C) 2001 Helge Deller * Copyright (C) 2001 Thomas Bogendoerfer * Copyright (C) 2002 Randolph Chung + * Copyright (C) 2010 Guy Martin * * * This program is free software; you can redistribute it and/or modify @@ -31,12 +32,11 @@ /* * The PDC console is a simple console, which can be used for debugging - * boot related problems on HP PA-RISC machines. + * boot related problems on HP PA-RISC machines. It is also useful when no + * other console works. * * This code uses the ROM (=PDC) based functions to read and write characters * from and to PDC's boot path. - * Since all character read from that path must be polled, this code never - * can or will be a fully functional linux console. */ /* Define EARLY_BOOTUP_DEBUG to debug kernel related boot problems. @@ -53,6 +53,7 @@ #include /* for iodc_call() proto and friends */ static DEFINE_SPINLOCK(pdc_console_lock); +static struct console pdc_cons; static void pdc_console_write(struct console *co, const char *s, unsigned count) { @@ -85,12 +86,138 @@ static int pdc_console_setup(struct console *co, char *options) #if defined(CONFIG_PDC_CONSOLE) #include +#include + +#define PDC_CONS_POLL_DELAY (30 * HZ / 1000) + +static struct timer_list pdc_console_timer; + +extern struct console * console_drivers; + +static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp) +{ + + mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY); + + return 0; +} + +static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp) +{ + if (!tty->count) + del_timer(&pdc_console_timer); +} + +static int pdc_console_tty_write(struct tty_struct *tty, const unsigned char *buf, int count) +{ + pdc_console_write(NULL, buf, count); + return count; +} + +static int pdc_console_tty_write_room(struct tty_struct *tty) +{ + return 32768; /* no limit, no buffer used */ +} + +static int pdc_console_tty_chars_in_buffer(struct tty_struct *tty) +{ + return 0; /* no buffer */ +} + +static struct tty_driver *pdc_console_tty_driver; + +static const struct tty_operations pdc_console_tty_ops = { + .open = pdc_console_tty_open, + .close = pdc_console_tty_close, + .write = pdc_console_tty_write, + .write_room = pdc_console_tty_write_room, + .chars_in_buffer = pdc_console_tty_chars_in_buffer, +}; + +static void pdc_console_poll(unsigned long unused) +{ + + int data, count = 0; + + struct tty_struct *tty = pdc_console_tty_driver->ttys[0]; + + if (!tty) + return; + + while (1) { + data = pdc_console_poll_key(NULL); + if (data == -1) + break; + tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL); + count ++; + } + + if (count) + tty_flip_buffer_push(tty); + + if (tty->count && (pdc_cons.flags & CON_ENABLED)) + mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY); +} + +static int __init pdc_console_tty_driver_init(void) +{ + + int err; + struct tty_driver *drv; + + /* Check if the console driver is still registered. + * It is unregistered if the pdc console was not selected as the + * primary console. */ + + struct console *tmp = console_drivers; + + for (tmp = console_drivers; tmp; tmp = tmp->next) + if (tmp == &pdc_cons) + break; + + if (!tmp) { + printk(KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name); + return -ENODEV; + } + + printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n"); + pdc_cons.flags &= ~CON_BOOT; + + drv = alloc_tty_driver(1); + + if (!drv) + return -ENOMEM; + + drv->driver_name = "pdc_cons"; + drv->name = "ttyB"; + drv->major = MUX_MAJOR; + drv->minor_start = 0; + drv->type = TTY_DRIVER_TYPE_SYSTEM; + drv->init_termios = tty_std_termios; + drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; + tty_set_operations(drv, &pdc_console_tty_ops); + + err = tty_register_driver(drv); + if (err) { + printk(KERN_ERR "Unable to register the PDC console TTY driver\n"); + return err; + } + + pdc_console_tty_driver = drv; + + /* No need to initialize the pdc_console_timer if tty isn't allocated */ + init_timer(&pdc_console_timer); + pdc_console_timer.function = pdc_console_poll; + + return 0; +} + +module_init(pdc_console_tty_driver_init); static struct tty_driver * pdc_console_device (struct console *c, int *index) { - extern struct tty_driver console_driver; - *index = c->index ? c->index-1 : fg_console; - return &console_driver; + *index = c->index; + return pdc_console_tty_driver; } #else #define pdc_console_device NULL @@ -101,7 +228,7 @@ static struct console pdc_cons = { .write = pdc_console_write, .device = pdc_console_device, .setup = pdc_console_setup, - .flags = CON_BOOT | CON_PRINTBUFFER | CON_ENABLED, + .flags = CON_BOOT | CON_PRINTBUFFER, .index = -1, }; -- cgit v1.2.3-70-g09d2