traps.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* VISWS traps */
  2. #include <linux/sched.h>
  3. #include <linux/kernel.h>
  4. #include <linux/init.h>
  5. #include <linux/pci.h>
  6. #include <linux/pci_ids.h>
  7. #include <asm/io.h>
  8. #include <asm/arch_hooks.h>
  9. #include <asm/apic.h>
  10. #include "cobalt.h"
  11. #include "lithium.h"
  12. #define A01234 (LI_INTA_0 | LI_INTA_1 | LI_INTA_2 | LI_INTA_3 | LI_INTA_4)
  13. #define BCD (LI_INTB | LI_INTC | LI_INTD)
  14. #define ALLDEVS (A01234 | BCD)
  15. static __init void lithium_init(void)
  16. {
  17. set_fixmap(FIX_LI_PCIA, LI_PCI_A_PHYS);
  18. set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
  19. if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
  20. (li_pcia_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) {
  21. printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A');
  22. panic("This machine is not SGI Visual Workstation 320/540");
  23. }
  24. if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
  25. (li_pcib_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) {
  26. printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B');
  27. panic("This machine is not SGI Visual Workstation 320/540");
  28. }
  29. li_pcia_write16(LI_PCI_INTEN, ALLDEVS);
  30. li_pcib_write16(LI_PCI_INTEN, ALLDEVS);
  31. }
  32. static __init void cobalt_init(void)
  33. {
  34. /*
  35. * On normal SMP PC this is used only with SMP, but we have to
  36. * use it and set it up here to start the Cobalt clock
  37. */
  38. set_fixmap(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
  39. setup_local_APIC();
  40. printk(KERN_INFO "Local APIC Version %#lx, ID %#lx\n",
  41. apic_read(APIC_LVR), apic_read(APIC_ID));
  42. set_fixmap(FIX_CO_CPU, CO_CPU_PHYS);
  43. set_fixmap(FIX_CO_APIC, CO_APIC_PHYS);
  44. printk(KERN_INFO "Cobalt Revision %#lx, APIC ID %#lx\n",
  45. co_cpu_read(CO_CPU_REV), co_apic_read(CO_APIC_ID));
  46. /* Enable Cobalt APIC being careful to NOT change the ID! */
  47. co_apic_write(CO_APIC_ID, co_apic_read(CO_APIC_ID) | CO_APIC_ENABLE);
  48. printk(KERN_INFO "Cobalt APIC enabled: ID reg %#lx\n",
  49. co_apic_read(CO_APIC_ID));
  50. }
  51. void __init trap_init_hook(void)
  52. {
  53. lithium_init();
  54. cobalt_init();
  55. }