machvec_impl.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * linux/arch/alpha/kernel/machvec_impl.h
  3. *
  4. * Copyright (C) 1997, 1998 Richard Henderson
  5. *
  6. * This file has goodies to help simplify instantiation of machine vectors.
  7. */
  8. #include <asm/pgalloc.h>
  9. /* Whee. These systems don't have an HAE:
  10. IRONGATE, MARVEL, POLARIS, TSUNAMI, TITAN, WILDFIRE
  11. Fix things up for the GENERIC kernel by defining the HAE address
  12. to be that of the cache. Now we can read and write it as we like. ;-) */
  13. #define IRONGATE_HAE_ADDRESS (&alpha_mv.hae_cache)
  14. #define MARVEL_HAE_ADDRESS (&alpha_mv.hae_cache)
  15. #define POLARIS_HAE_ADDRESS (&alpha_mv.hae_cache)
  16. #define TSUNAMI_HAE_ADDRESS (&alpha_mv.hae_cache)
  17. #define TITAN_HAE_ADDRESS (&alpha_mv.hae_cache)
  18. #define WILDFIRE_HAE_ADDRESS (&alpha_mv.hae_cache)
  19. #ifdef CIA_ONE_HAE_WINDOW
  20. #define CIA_HAE_ADDRESS (&alpha_mv.hae_cache)
  21. #endif
  22. #ifdef MCPCIA_ONE_HAE_WINDOW
  23. #define MCPCIA_HAE_ADDRESS (&alpha_mv.hae_cache)
  24. #endif
  25. #ifdef T2_ONE_HAE_WINDOW
  26. #define T2_HAE_ADDRESS (&alpha_mv.hae_cache)
  27. #endif
  28. /* Only a few systems don't define IACK_SC, handling all interrupts through
  29. the SRM console. But splitting out that one case from IO() below
  30. seems like such a pain. Define this to get things to compile. */
  31. #define JENSEN_IACK_SC 1
  32. #define T2_IACK_SC 1
  33. #define WILDFIRE_IACK_SC 1 /* FIXME */
  34. /*
  35. * Some helpful macros for filling in the blanks.
  36. */
  37. #define CAT1(x,y) x##y
  38. #define CAT(x,y) CAT1(x,y)
  39. #define DO_DEFAULT_RTC .rtc_port = 0x70
  40. #define DO_EV4_MMU \
  41. .max_asn = EV4_MAX_ASN, \
  42. .mv_switch_mm = ev4_switch_mm, \
  43. .mv_activate_mm = ev4_activate_mm, \
  44. .mv_flush_tlb_current = ev4_flush_tlb_current, \
  45. .mv_flush_tlb_current_page = ev4_flush_tlb_current_page
  46. #define DO_EV5_MMU \
  47. .max_asn = EV5_MAX_ASN, \
  48. .mv_switch_mm = ev5_switch_mm, \
  49. .mv_activate_mm = ev5_activate_mm, \
  50. .mv_flush_tlb_current = ev5_flush_tlb_current, \
  51. .mv_flush_tlb_current_page = ev5_flush_tlb_current_page
  52. #define DO_EV6_MMU \
  53. .max_asn = EV6_MAX_ASN, \
  54. .mv_switch_mm = ev5_switch_mm, \
  55. .mv_activate_mm = ev5_activate_mm, \
  56. .mv_flush_tlb_current = ev5_flush_tlb_current, \
  57. .mv_flush_tlb_current_page = ev5_flush_tlb_current_page
  58. #define DO_EV7_MMU \
  59. .max_asn = EV6_MAX_ASN, \
  60. .mv_switch_mm = ev5_switch_mm, \
  61. .mv_activate_mm = ev5_activate_mm, \
  62. .mv_flush_tlb_current = ev5_flush_tlb_current, \
  63. .mv_flush_tlb_current_page = ev5_flush_tlb_current_page
  64. #define IO_LITE(UP,low) \
  65. .hae_register = (unsigned long *) CAT(UP,_HAE_ADDRESS), \
  66. .iack_sc = CAT(UP,_IACK_SC), \
  67. .mv_ioread8 = CAT(low,_ioread8), \
  68. .mv_ioread16 = CAT(low,_ioread16), \
  69. .mv_ioread32 = CAT(low,_ioread32), \
  70. .mv_iowrite8 = CAT(low,_iowrite8), \
  71. .mv_iowrite16 = CAT(low,_iowrite16), \
  72. .mv_iowrite32 = CAT(low,_iowrite32), \
  73. .mv_readb = CAT(low,_readb), \
  74. .mv_readw = CAT(low,_readw), \
  75. .mv_readl = CAT(low,_readl), \
  76. .mv_readq = CAT(low,_readq), \
  77. .mv_writeb = CAT(low,_writeb), \
  78. .mv_writew = CAT(low,_writew), \
  79. .mv_writel = CAT(low,_writel), \
  80. .mv_writeq = CAT(low,_writeq), \
  81. .mv_ioportmap = CAT(low,_ioportmap), \
  82. .mv_ioremap = CAT(low,_ioremap), \
  83. .mv_iounmap = CAT(low,_iounmap), \
  84. .mv_is_ioaddr = CAT(low,_is_ioaddr), \
  85. .mv_is_mmio = CAT(low,_is_mmio) \
  86. #define IO(UP,low) \
  87. IO_LITE(UP,low), \
  88. .pci_ops = &CAT(low,_pci_ops), \
  89. .mv_pci_tbi = CAT(low,_pci_tbi)
  90. #define DO_APECS_IO IO(APECS,apecs)
  91. #define DO_CIA_IO IO(CIA,cia)
  92. #define DO_IRONGATE_IO IO(IRONGATE,irongate)
  93. #define DO_LCA_IO IO(LCA,lca)
  94. #define DO_MARVEL_IO IO(MARVEL,marvel)
  95. #define DO_MCPCIA_IO IO(MCPCIA,mcpcia)
  96. #define DO_POLARIS_IO IO(POLARIS,polaris)
  97. #define DO_T2_IO IO(T2,t2)
  98. #define DO_TSUNAMI_IO IO(TSUNAMI,tsunami)
  99. #define DO_TITAN_IO IO(TITAN,titan)
  100. #define DO_WILDFIRE_IO IO(WILDFIRE,wildfire)
  101. #define DO_PYXIS_IO IO_LITE(CIA,cia_bwx), \
  102. .pci_ops = &cia_pci_ops, \
  103. .mv_pci_tbi = cia_pci_tbi
  104. /*
  105. * In a GENERIC kernel, we have lots of these vectors floating about,
  106. * all but one of which we want to go away. In a non-GENERIC kernel,
  107. * we want only one, ever.
  108. *
  109. * Accomplish this in the GENERIC kernel by putting all of the vectors
  110. * in the .init.data section where they'll go away. We'll copy the
  111. * one we want to the real alpha_mv vector in setup_arch.
  112. *
  113. * Accomplish this in a non-GENERIC kernel by ifdef'ing out all but
  114. * one of the vectors, which will not reside in .init.data. We then
  115. * alias this one vector to alpha_mv, so no copy is needed.
  116. *
  117. * Upshot: set __initdata to nothing for non-GENERIC kernels.
  118. */
  119. #ifdef CONFIG_ALPHA_GENERIC
  120. #define __initmv __initdata
  121. #define ALIAS_MV(x)
  122. #else
  123. #define __initmv __refdata
  124. /* GCC actually has a syntax for defining aliases, but is under some
  125. delusion that you shouldn't be able to declare it extern somewhere
  126. else beforehand. Fine. We'll do it ourselves. */
  127. #if 0
  128. #define ALIAS_MV(system) \
  129. struct alpha_machine_vector alpha_mv __attribute__((alias(#system "_mv"))); \
  130. EXPORT_SYMBOL(alpha_mv);
  131. #else
  132. #define ALIAS_MV(system) \
  133. asm(".global alpha_mv\nalpha_mv = " #system "_mv"); \
  134. EXPORT_SYMBOL(alpha_mv);
  135. #endif
  136. #endif /* GENERIC */