summaryrefslogtreecommitdiffstats
path: root/arch/alpha/kernel/sys_jensen.c
blob: 98dea0902fc295f7c46a58dbedcd383ec0d2287f (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
 *	linux/arch/alpha/kernel/sys_jensen.c
 *
 *	Copyright (C) 1995 Linus Torvalds
 *	Copyright (C) 1998, 1999 Richard Henderson
 *
 * Code supporting the Jensen.
 */

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/pci.h>
#include <linux/init.h>

#include <asm/ptrace.h>
#include <asm/system.h>

#define __EXTERN_INLINE inline
#include <asm/io.h>
#include <asm/jensen.h>
#undef  __EXTERN_INLINE

#include <asm/dma.h>
#include <asm/irq.h>
#include <asm/mmu_context.h>
#include <asm/pgtable.h>

#include "proto.h"
#include "irq_impl.h"
#include "machvec_impl.h"


/*
 * Jensen is special: the vector is 0x8X0 for EISA interrupt X, and
 * 0x9X0 for the local motherboard interrupts..
 *
 *	0x660 - NMI
 *
 *	0x800 - IRQ0  interval timer (not used, as we use the RTC timer)
 *	0x810 - IRQ1  line printer (duh..)
 *	0x860 - IRQ6  floppy disk
 *	0x8E0 - IRQ14 SCSI controller
 *
 *	0x900 - COM1
 *	0x920 - COM2
 *	0x980 - keyboard
 *	0x990 - mouse
 *
 * PCI-based systems are more sane: they don't have the local
 * interrupts at all, and have only normal PCI interrupts from
 * devices.  Happily it's easy enough to do a sane mapping from the
 * Jensen..  Note that this means that we may have to do a hardware
 * "ack" to a different interrupt than we report to the rest of the
 * world.
 */

static void
jensen_local_ack(unsigned int irq)
{
	/* irq1 is supposed to be the keyboard, silly Jensen.  */
	if (irq == 7)
		i8259a_mask_and_ack_irq(1);
}

static struct hw_interrupt_type jensen_local_irq_type = {
	typename:	"LOCAL",
	startup:	i8259a_startup_irq,
	shutdown:	i8259a_disable_irq,
	enable:		i8259a_enable_irq,
	disable:	i8259a_disable_irq,
	ack:		jensen_local_ack,
	end:		i8259a_enable_irq,
};

static void 
jensen_device_interrupt(unsigned long vector, struct pt_regs * regs)
{
	int irq;

	switch (vector) {
	case 0x660:
		printk("Whee.. NMI received. Probable hardware error\n");
		printk("61=%02x, 461=%02x\n", inb(0x61), inb(0x461));
		return;

	/* local device interrupts: */
	case 0x900: irq = 4; break;		/* com1 -> irq 4 */
	case 0x920: irq = 3; break;		/* com2 -> irq 3 */
	case 0x980: irq = 1; break;		/* kbd -> irq 1 */
	case 0x990: irq = 9; break;		/* mouse -> irq 9 */

	default:
		if (vector > 0x900) {
			printk("Unknown local interrupt %lx\n", vector);
			return;
		}

		irq = (vector - 0x800) >> 4;
		if (irq == 1)
			irq = 7;
		break;
	}

	handle_irq(irq, regs);
}

static void __init
jensen_init_irq(void)
{
	init_i8259a_irqs();
	init_rtc_irq();

	irq_desc[1].handler = &jensen_local_irq_type;
	irq_desc[4].handler = &jensen_local_irq_type;
	irq_desc[3].handler = &jensen_local_irq_type;
	irq_desc[7].handler = &jensen_local_irq_type;
	irq_desc[9].handler = &jensen_local_irq_type;

	common_init_isa_dma();
}

static void __init
jensen_init_arch(void)
{
	__direct_map_base = 0;
	__direct_map_size = 0xffffffff;
}

static void
jensen_machine_check (u64 vector, u64 la, struct pt_regs *regs)
{
	printk(KERN_CRIT "Machine check\n");
}

#define jensen_pci_tbi	((void*)0)


/*
 * The System Vector
 */

struct alpha_machine_vector jensen_mv __initmv = {
	vector_name:		"Jensen",
	DO_EV4_MMU,
	IO_LITE(JENSEN,jensen),
	BUS(jensen),
	machine_check:		jensen_machine_check,
	max_dma_address:	ALPHA_MAX_DMA_ADDRESS,
	rtc_port: 0x170,

	nr_irqs:		16,
	device_interrupt:	jensen_device_interrupt,

	init_arch:		jensen_init_arch,
	init_irq:		jensen_init_irq,
	init_rtc:		common_init_rtc,
	init_pci:		NULL,
	kill_arch:		NULL,
};
ALIAS_MV(jensen)