cobalt.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef _ASM_X86_VISWS_COBALT_H
  2. #define _ASM_X86_VISWS_COBALT_H
  3. #include <asm/fixmap.h>
  4. /*
  5. * Cobalt SGI Visual Workstation system ASIC
  6. */
  7. #define CO_CPU_NUM_PHYS 0x1e00
  8. #define CO_CPU_TAB_PHYS (CO_CPU_NUM_PHYS + 2)
  9. #define CO_CPU_MAX 4
  10. #define CO_CPU_PHYS 0xc2000000
  11. #define CO_APIC_PHYS 0xc4000000
  12. /* see set_fixmap() and asm/fixmap.h */
  13. #define CO_CPU_VADDR (fix_to_virt(FIX_CO_CPU))
  14. #define CO_APIC_VADDR (fix_to_virt(FIX_CO_APIC))
  15. /* Cobalt CPU registers -- relative to CO_CPU_VADDR, use co_cpu_*() */
  16. #define CO_CPU_REV 0x08
  17. #define CO_CPU_CTRL 0x10
  18. #define CO_CPU_STAT 0x20
  19. #define CO_CPU_TIMEVAL 0x30
  20. /* CO_CPU_CTRL bits */
  21. #define CO_CTRL_TIMERUN 0x04 /* 0 == disabled */
  22. #define CO_CTRL_TIMEMASK 0x08 /* 0 == unmasked */
  23. /* CO_CPU_STATUS bits */
  24. #define CO_STAT_TIMEINTR 0x02 /* (r) 1 == int pend, (w) 0 == clear */
  25. /* CO_CPU_TIMEVAL value */
  26. #define CO_TIME_HZ 100000000 /* Cobalt core rate */
  27. /* Cobalt APIC registers -- relative to CO_APIC_VADDR, use co_apic_*() */
  28. #define CO_APIC_HI(n) (((n) * 0x10) + 4)
  29. #define CO_APIC_LO(n) ((n) * 0x10)
  30. #define CO_APIC_ID 0x0ffc
  31. /* CO_APIC_ID bits */
  32. #define CO_APIC_ENABLE 0x00000100
  33. /* CO_APIC_LO bits */
  34. #define CO_APIC_MASK 0x00010000 /* 0 = enabled */
  35. #define CO_APIC_LEVEL 0x00008000 /* 0 = edge */
  36. /*
  37. * Where things are physically wired to Cobalt
  38. * #defines with no board _<type>_<rev>_ are common to all (thus far)
  39. */
  40. #define CO_APIC_IDE0 4
  41. #define CO_APIC_IDE1 2 /* Only on 320 */
  42. #define CO_APIC_8259 12 /* serial, floppy, par-l-l */
  43. /* Lithium PCI Bridge A -- "the one with 82557 Ethernet" */
  44. #define CO_APIC_PCIA_BASE0 0 /* and 1 */ /* slot 0, line 0 */
  45. #define CO_APIC_PCIA_BASE123 5 /* and 6 */ /* slot 0, line 1 */
  46. #define CO_APIC_PIIX4_USB 7 /* this one is weird */
  47. /* Lithium PCI Bridge B -- "the one with PIIX4" */
  48. #define CO_APIC_PCIB_BASE0 8 /* and 9-12 *//* slot 0, line 0 */
  49. #define CO_APIC_PCIB_BASE123 13 /* 14.15 */ /* slot 0, line 1 */
  50. #define CO_APIC_VIDOUT0 16
  51. #define CO_APIC_VIDOUT1 17
  52. #define CO_APIC_VIDIN0 18
  53. #define CO_APIC_VIDIN1 19
  54. #define CO_APIC_LI_AUDIO 22
  55. #define CO_APIC_AS 24
  56. #define CO_APIC_RE 25
  57. #define CO_APIC_CPU 28 /* Timer and Cache interrupt */
  58. #define CO_APIC_NMI 29
  59. #define CO_APIC_LAST CO_APIC_NMI
  60. /*
  61. * This is how irqs are assigned on the Visual Workstation.
  62. * Legacy devices get irq's 1-15 (system clock is 0 and is CO_APIC_CPU).
  63. * All other devices (including PCI) go to Cobalt and are irq's 16 on up.
  64. */
  65. #define CO_IRQ_APIC0 16 /* irq of apic entry 0 */
  66. #define IS_CO_APIC(irq) ((irq) >= CO_IRQ_APIC0)
  67. #define CO_IRQ(apic) (CO_IRQ_APIC0 + (apic)) /* apic ent to irq */
  68. #define CO_APIC(irq) ((irq) - CO_IRQ_APIC0) /* irq to apic ent */
  69. #define CO_IRQ_IDE0 14 /* knowledge of... */
  70. #define CO_IRQ_IDE1 15 /* ... ide driver defaults! */
  71. #define CO_IRQ_8259 CO_IRQ(CO_APIC_8259)
  72. #ifdef CONFIG_X86_VISWS_APIC
  73. static inline void co_cpu_write(unsigned long reg, unsigned long v)
  74. {
  75. *((volatile unsigned long *)(CO_CPU_VADDR+reg))=v;
  76. }
  77. static inline unsigned long co_cpu_read(unsigned long reg)
  78. {
  79. return *((volatile unsigned long *)(CO_CPU_VADDR+reg));
  80. }
  81. static inline void co_apic_write(unsigned long reg, unsigned long v)
  82. {
  83. *((volatile unsigned long *)(CO_APIC_VADDR+reg))=v;
  84. }
  85. static inline unsigned long co_apic_read(unsigned long reg)
  86. {
  87. return *((volatile unsigned long *)(CO_APIC_VADDR+reg));
  88. }
  89. #endif
  90. extern char visws_board_type;
  91. #define VISWS_320 0
  92. #define VISWS_540 1
  93. extern char visws_board_rev;
  94. #endif /* _ASM_X86_VISWS_COBALT_H */