1/*
2 * BK Id: %F% %I% %G% %U% %#%
3 */
4/*
5 *  arch/ppc/kernel/open_pic.h -- OpenPIC Interrupt Handling
6 *
7 *  Copyright (C) 1997 Geert Uytterhoeven
8 *
9 *  This file is subject to the terms and conditions of the GNU General Public
10 *  License.  See the file COPYING in the main directory of this archive
11 *  for more details.
12 *
13 */
14
15#ifndef _PPC_KERNEL_OPEN_PIC_H
16#define _PPC_KERNEL_OPEN_PIC_H
17
18#include <linux/config.h>
19#include <linux/irq.h>
20
21#define OPENPIC_SIZE	0x40000
22
23/*
24 *  Non-offset'ed vector numbers
25 */
26
27#define OPENPIC_VEC_TIMER	64	/* and up */
28#define OPENPIC_VEC_IPI		72	/* and up */
29#define OPENPIC_VEC_SPURIOUS	127
30
31/* OpenPIC IRQ controller structure */
32extern struct hw_interrupt_type open_pic;
33
34/* OpenPIC IPI controller structure */
35#ifdef CONFIG_SMP
36extern struct hw_interrupt_type open_pic_ipi;
37#endif /* CONFIG_SMP */
38
39extern u_int OpenPIC_NumInitSenses;
40extern u_char *OpenPIC_InitSenses;
41extern void* OpenPIC_Addr;
42
43/* Exported functions */
44extern void openpic_set_sources(int first_irq, int num_irqs, void *isr);
45extern void openpic_init(int, int, unsigned char *, int);
46extern u_int openpic_irq(void);
47extern void openpic_eoi(void);
48extern void openpic_request_IPIs(void);
49extern void do_openpic_setup_cpu(void);
50extern int openpic_get_irq(struct pt_regs *regs);
51extern void openpic_reset_processor_phys(u_int cpumask);
52extern void openpic_setup_ISU(int isu_num, unsigned long addr);
53extern void openpic_cause_IPI(u_int ipi, u_int cpumask);
54extern void smp_openpic_message_pass(int target, int msg, unsigned long data,
55				     int wait);
56
57extern inline int openpic_to_irq(int irq)
58{
59	/* IRQ 0 usually means 'disabled'.. don't mess with it
60	 * exceptions to this (sandpoint maybe?)
61	 * shouldn't use openpic_to_irq
62	 */
63	if (irq != 0){
64		return irq += NUM_8259_INTERRUPTS;
65	} else {
66		return 0;
67	}
68}
69/*extern int open_pic_irq_offset;*/
70#endif /* _PPC_KERNEL_OPEN_PIC_H */
71