aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/mach-visws/traps.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/mach-visws/traps.c')
-rw-r--r--arch/i386/mach-visws/traps.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/arch/i386/mach-visws/traps.c b/arch/i386/mach-visws/traps.c
new file mode 100644
index 000000000000..964353992031
--- /dev/null
+++ b/arch/i386/mach-visws/traps.c
@@ -0,0 +1,69 @@
1/* VISWS traps */
2
3#include <linux/config.h>
4#include <linux/sched.h>
5#include <linux/kernel.h>
6#include <linux/init.h>
7#include <linux/pci.h>
8#include <linux/pci_ids.h>
9
10#include <asm/io.h>
11#include <asm/arch_hooks.h>
12#include <asm/apic.h>
13#include "cobalt.h"
14#include "lithium.h"
15
16
17#define A01234 (LI_INTA_0 | LI_INTA_1 | LI_INTA_2 | LI_INTA_3 | LI_INTA_4)
18#define BCD (LI_INTB | LI_INTC | LI_INTD)
19#define ALLDEVS (A01234 | BCD)
20
21static __init void lithium_init(void)
22{
23 set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS);
24 set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
25
26 if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
27 (li_pcia_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) {
28 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A');
29 panic("This machine is not SGI Visual Workstation 320/540");
30 }
31
32 if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
33 (li_pcib_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) {
34 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B');
35 panic("This machine is not SGI Visual Workstation 320/540");
36 }
37
38 li_pcia_write16(LI_PCI_INTEN, ALLDEVS);
39 li_pcib_write16(LI_PCI_INTEN, ALLDEVS);
40}
41
42static __init void cobalt_init(void)
43{
44 /*
45 * On normal SMP PC this is used only with SMP, but we have to
46 * use it and set it up here to start the Cobalt clock
47 */
48 set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
49 setup_local_APIC();
50 printk(KERN_INFO "Local APIC Version %#lx, ID %#lx\n",
51 apic_read(APIC_LVR), apic_read(APIC_ID));
52
53 set_fixmap(FIX_CO_CPU, CO_CPU_PHYS);
54 set_fixmap(FIX_CO_APIC, CO_APIC_PHYS);
55 printk(KERN_INFO "Cobalt Revision %#lx, APIC ID %#lx\n",
56 co_cpu_read(CO_CPU_REV), co_apic_read(CO_APIC_ID));
57
58 /* Enable Cobalt APIC being careful to NOT change the ID! */
59 co_apic_write(CO_APIC_ID, co_apic_read(CO_APIC_ID) | CO_APIC_ENABLE);
60
61 printk(KERN_INFO "Cobalt APIC enabled: ID reg %#lx\n",
62 co_apic_read(CO_APIC_ID));
63}
64
65void __init trap_init_hook(void)
66{
67 lithium_init();
68 cobalt_init();
69}