Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* VISWS traps */ |
| 2 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | #include <linux/sched.h> |
| 4 | #include <linux/kernel.h> |
| 5 | #include <linux/init.h> |
| 6 | #include <linux/pci.h> |
| 7 | #include <linux/pci_ids.h> |
| 8 | |
| 9 | #include <asm/io.h> |
| 10 | #include <asm/arch_hooks.h> |
| 11 | #include <asm/apic.h> |
| 12 | #include "cobalt.h" |
| 13 | #include "lithium.h" |
| 14 | |
| 15 | |
| 16 | #define A01234 (LI_INTA_0 | LI_INTA_1 | LI_INTA_2 | LI_INTA_3 | LI_INTA_4) |
| 17 | #define BCD (LI_INTB | LI_INTC | LI_INTD) |
| 18 | #define ALLDEVS (A01234 | BCD) |
| 19 | |
| 20 | static __init void lithium_init(void) |
| 21 | { |
| 22 | set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS); |
| 23 | set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS); |
| 24 | |
| 25 | if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) || |
Jiri Slaby | c43eaa0 | 2007-06-18 10:58:14 +0200 | [diff] [blame] | 26 | (li_pcia_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A'); |
Ingo Molnar | 22d5c67 | 2008-07-10 16:29:28 +0200 | [diff] [blame^] | 28 | /* panic("This machine is not SGI Visual Workstation 320/540"); */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) || |
Jiri Slaby | c43eaa0 | 2007-06-18 10:58:14 +0200 | [diff] [blame] | 32 | (li_pcib_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B'); |
Ingo Molnar | 22d5c67 | 2008-07-10 16:29:28 +0200 | [diff] [blame^] | 34 | /* panic("This machine is not SGI Visual Workstation 320/540"); */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | li_pcia_write16(LI_PCI_INTEN, ALLDEVS); |
| 38 | li_pcib_write16(LI_PCI_INTEN, ALLDEVS); |
| 39 | } |
| 40 | |
| 41 | static __init void cobalt_init(void) |
| 42 | { |
| 43 | /* |
| 44 | * On normal SMP PC this is used only with SMP, but we have to |
| 45 | * use it and set it up here to start the Cobalt clock |
| 46 | */ |
| 47 | set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE); |
| 48 | setup_local_APIC(); |
Randy Dunlap | 3178071 | 2008-03-04 14:55:47 -0800 | [diff] [blame] | 49 | printk(KERN_INFO "Local APIC Version %#x, ID %#x\n", |
| 50 | (unsigned int)apic_read(APIC_LVR), |
| 51 | (unsigned int)apic_read(APIC_ID)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Ingo Molnar | 22d5c67 | 2008-07-10 16:29:28 +0200 | [diff] [blame^] | 65 | void __init trap_init_hook_dontuse(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | { |
| 67 | lithium_init(); |
| 68 | cobalt_init(); |
| 69 | } |