summaryrefslogtreecommitdiffstats
path: root/arch/ppc/kernel/ppc8xx_pic.c
blob: 87bc6d0f8f727b836ab5122db9a994d0c1c4a229 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

#include <linux/stddef.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <asm/irq.h>
#include <asm/8xx_immap.h>
#include <asm/mbx.h>
#include "ppc8xx_pic.h"


static void mbx_mask_irq(unsigned int irq_nr)
{
	if ( irq_nr == ISA_BRIDGE_INT ) return;
	if ( irq_nr >= ppc8xx_pic.irq_offset )
		irq_nr -= ppc8xx_pic.irq_offset;
	ppc_cached_irq_mask[0] &= ~(1 << (31-irq_nr));
	((immap_t *)IMAP_ADDR)->im_siu_conf.sc_simask =	ppc_cached_irq_mask[0];
}

static void mbx_unmask_irq(unsigned int irq_nr)
{
	if ( irq_nr >= ppc8xx_pic.irq_offset )
		irq_nr -= ppc8xx_pic.irq_offset;
	ppc_cached_irq_mask[0] |= (1 << (31-irq_nr));
	((immap_t *)IMAP_ADDR)->im_siu_conf.sc_simask =	ppc_cached_irq_mask[0];
}

static void mbx_mask_and_ack(unsigned int irq_nr)
{
	/* this shouldn't be masked, we mask the 8259 if we need to -- Cort */
	if ( irq_nr != ISA_BRIDGE_INT )
		mbx_mask_irq(irq_nr);
	if ( irq_nr >= ppc8xx_pic.irq_offset )
		irq_nr -= ppc8xx_pic.irq_offset;
	/* clear the pending bits */
	((immap_t *)IMAP_ADDR)->im_siu_conf.sc_sipend = 1 << (31-irq_nr);
}

struct hw_interrupt_type ppc8xx_pic = {
	" 8xx SIU  ",
	NULL,
	NULL,
	NULL,
	mbx_unmask_irq,
	mbx_mask_irq,
	mbx_mask_and_ack,
	0
};