mirror of
https://github.com/torvalds/linux.git
synced 2024-11-01 09:41:44 +00:00
bc89663aa5
The commit a2be01b
(ARM: only include mach/irqs.h for !SPARSE_IRQ)
makes mach/irqs.h only be included for !SPARSE_IRQ build. There are
a nubmer of platforms have FIQ_START defined in mach/irqs.h for FIQ
support.
arch/arm/mach-rpc/include/mach/irqs.h:#define FIQ_START 64
arch/arm/mach-s3c24xx/include/mach/irqs.h:#define FIQ_START IRQ_EINT0
arch/arm/plat-mxc/include/mach/irqs.h:#define FIQ_START 0
If SPARSE_IRQ is enabled for any of these platforms, the following
compile error will be seen.
arch/arm/kernel/fiq.c: In function ‘enable_fiq’:
arch/arm/kernel/fiq.c:127:19: error: ‘FIQ_START’ undeclared (first use in this function)
arch/arm/kernel/fiq.c:127:19: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/kernel/fiq.c: In function ‘disable_fiq’:
arch/arm/kernel/fiq.c:132:20: error: ‘FIQ_START’ undeclared (first use in this function)
The patch changes fiq code to have init_FIQ take FIQ_START from
platforms as a parameter and assign it to variable fiq_start which
is to replace FIQ_START uses in enable_fiq/disable_fiq.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Rob Herring <rob.herring@calxeda.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
150 lines
3.2 KiB
C
150 lines
3.2 KiB
C
/*
|
|
* linux/arch/arm/kernel/fiq.c
|
|
*
|
|
* Copyright (C) 1998 Russell King
|
|
* Copyright (C) 1998, 1999 Phil Blundell
|
|
*
|
|
* FIQ support written by Philip Blundell <philb@gnu.org>, 1998.
|
|
*
|
|
* FIQ support re-written by Russell King to be more generic
|
|
*
|
|
* We now properly support a method by which the FIQ handlers can
|
|
* be stacked onto the vector. We still do not support sharing
|
|
* the FIQ vector itself.
|
|
*
|
|
* Operation is as follows:
|
|
* 1. Owner A claims FIQ:
|
|
* - default_fiq relinquishes control.
|
|
* 2. Owner A:
|
|
* - inserts code.
|
|
* - sets any registers,
|
|
* - enables FIQ.
|
|
* 3. Owner B claims FIQ:
|
|
* - if owner A has a relinquish function.
|
|
* - disable FIQs.
|
|
* - saves any registers.
|
|
* - returns zero.
|
|
* 4. Owner B:
|
|
* - inserts code.
|
|
* - sets any registers,
|
|
* - enables FIQ.
|
|
* 5. Owner B releases FIQ:
|
|
* - Owner A is asked to reacquire FIQ:
|
|
* - inserts code.
|
|
* - restores saved registers.
|
|
* - enables FIQ.
|
|
* 6. Goto 3
|
|
*/
|
|
#include <linux/module.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/cp15.h>
|
|
#include <asm/fiq.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/traps.h>
|
|
|
|
static unsigned long no_fiq_insn;
|
|
|
|
/* Default reacquire function
|
|
* - we always relinquish FIQ control
|
|
* - we always reacquire FIQ control
|
|
*/
|
|
static int fiq_def_op(void *ref, int relinquish)
|
|
{
|
|
if (!relinquish)
|
|
set_fiq_handler(&no_fiq_insn, sizeof(no_fiq_insn));
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct fiq_handler default_owner = {
|
|
.name = "default",
|
|
.fiq_op = fiq_def_op,
|
|
};
|
|
|
|
static struct fiq_handler *current_fiq = &default_owner;
|
|
|
|
int show_fiq_list(struct seq_file *p, int prec)
|
|
{
|
|
if (current_fiq != &default_owner)
|
|
seq_printf(p, "%*s: %s\n", prec, "FIQ",
|
|
current_fiq->name);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void set_fiq_handler(void *start, unsigned int length)
|
|
{
|
|
#if defined(CONFIG_CPU_USE_DOMAINS)
|
|
memcpy((void *)0xffff001c, start, length);
|
|
#else
|
|
memcpy(vectors_page + 0x1c, start, length);
|
|
#endif
|
|
flush_icache_range(0xffff001c, 0xffff001c + length);
|
|
if (!vectors_high())
|
|
flush_icache_range(0x1c, 0x1c + length);
|
|
}
|
|
|
|
int claim_fiq(struct fiq_handler *f)
|
|
{
|
|
int ret = 0;
|
|
|
|
if (current_fiq) {
|
|
ret = -EBUSY;
|
|
|
|
if (current_fiq->fiq_op != NULL)
|
|
ret = current_fiq->fiq_op(current_fiq->dev_id, 1);
|
|
}
|
|
|
|
if (!ret) {
|
|
f->next = current_fiq;
|
|
current_fiq = f;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
void release_fiq(struct fiq_handler *f)
|
|
{
|
|
if (current_fiq != f) {
|
|
printk(KERN_ERR "%s FIQ trying to release %s FIQ\n",
|
|
f->name, current_fiq->name);
|
|
dump_stack();
|
|
return;
|
|
}
|
|
|
|
do
|
|
current_fiq = current_fiq->next;
|
|
while (current_fiq->fiq_op(current_fiq->dev_id, 0));
|
|
}
|
|
|
|
static int fiq_start;
|
|
|
|
void enable_fiq(int fiq)
|
|
{
|
|
enable_irq(fiq + fiq_start);
|
|
}
|
|
|
|
void disable_fiq(int fiq)
|
|
{
|
|
disable_irq(fiq + fiq_start);
|
|
}
|
|
|
|
EXPORT_SYMBOL(set_fiq_handler);
|
|
EXPORT_SYMBOL(__set_fiq_regs); /* defined in fiqasm.S */
|
|
EXPORT_SYMBOL(__get_fiq_regs); /* defined in fiqasm.S */
|
|
EXPORT_SYMBOL(claim_fiq);
|
|
EXPORT_SYMBOL(release_fiq);
|
|
EXPORT_SYMBOL(enable_fiq);
|
|
EXPORT_SYMBOL(disable_fiq);
|
|
|
|
void __init init_FIQ(int start)
|
|
{
|
|
no_fiq_insn = *(unsigned long *)0xffff001c;
|
|
fiq_start = start;
|
|
}
|