Import 2.1.116pre2
[davej-history.git] / arch / alpha / kernel / machvec.h
blob6ac7cc6a0a245514276a7d9309afa78836167fe2
1 /*
2 * linux/arch/alpha/kernel/machvec.h
4 * Copyright (C) 1997, 1998 Richard Henderson
6 * This file has goodies to help simplify instantiation of machine vectors.
7 */
9 #include <linux/config.h>
11 /* Whee. TSUNAMI doesn't have an HAE. Fix things up for the GENERIC
12 kernel by defining the HAE address to be that of the cache. Now
13 we can read and write it as we like. ;-) */
14 #define TSUNAMI_HAE_ADDRESS (&alpha_mv.hae_cache)
16 /* Only a few systems don't define IACK_SC, handling all interrupts through
17 the SRM console. But splitting out that one case from IO() below
18 seems like such a pain. Define this to get things to compile. */
19 #define JENSEN_IACK_SC 1
20 #define T2_IACK_SC 1
24 * Some helpful macros for filling in the blanks.
27 #define CAT1(x,y) x##y
28 #define CAT(x,y) CAT1(x,y)
30 #define DO_DEFAULT_RTC \
31 rtc_port: 0x70, rtc_addr: 0x80
33 #define DO_EV4_MMU \
34 max_asn: EV4_MAX_ASN, \
35 mmu_context_mask: ~0UL, \
36 mv_get_mmu_context: ev4_get_mmu_context, \
37 mv_flush_tlb_current: ev4_flush_tlb_current, \
38 mv_flush_tlb_other: ev4_flush_tlb_other, \
39 mv_flush_tlb_current_page: ev4_flush_tlb_current_page
41 #define DO_EV5_MMU \
42 max_asn: EV5_MAX_ASN, \
43 mmu_context_mask: ~0UL, \
44 mv_get_mmu_context: ev5_get_mmu_context, \
45 mv_flush_tlb_current: ev5_flush_tlb_current, \
46 mv_flush_tlb_other: ev5_flush_tlb_other, \
47 mv_flush_tlb_current_page: ev5_flush_tlb_current_page
49 #define DO_EV6_MMU \
50 max_asn: EV5_MAX_ASN, \
51 mmu_context_mask: 0xfffffffffful, \
52 mv_get_mmu_context: ev5_get_mmu_context, \
53 mv_flush_tlb_current: ev5_flush_tlb_current, \
54 mv_flush_tlb_other: ev5_flush_tlb_other, \
55 mv_flush_tlb_current_page: ev5_flush_tlb_current_page
57 #define IO_LITE(UP,low1,low2) \
58 hae_register: (unsigned long *) CAT(UP,_HAE_ADDRESS), \
59 iack_sc: CAT(UP,_IACK_SC), \
60 mv_inb: CAT(low1,_inb), \
61 mv_inw: CAT(low1,_inw), \
62 mv_inl: CAT(low1,_inl), \
63 mv_outb: CAT(low1,_outb), \
64 mv_outw: CAT(low1,_outw), \
65 mv_outl: CAT(low1,_outl), \
66 mv_readb: CAT(low1,_readb), \
67 mv_readw: CAT(low1,_readw), \
68 mv_readl: CAT(low1,_readl), \
69 mv_readq: CAT(low1,_readq), \
70 mv_writeb: CAT(low1,_writeb), \
71 mv_writew: CAT(low1,_writew), \
72 mv_writel: CAT(low1,_writel), \
73 mv_writeq: CAT(low1,_writeq), \
74 mv_dense_mem: CAT(low2,_dense_mem)
76 #define IO(UP,low1,low2) \
77 IO_LITE(UP,low1,low2), \
78 pci_read_config_byte: CAT(low2,_pcibios_read_config_byte), \
79 pci_read_config_word: CAT(low2,_pcibios_read_config_word), \
80 pci_read_config_dword: CAT(low2,_pcibios_read_config_dword), \
81 pci_write_config_byte: CAT(low2,_pcibios_write_config_byte), \
82 pci_write_config_word: CAT(low2,_pcibios_write_config_word), \
83 pci_write_config_dword: CAT(low2,_pcibios_write_config_dword), \
84 dma_win_base: CAT(UP,_DMA_WIN_BASE_DEFAULT), \
85 dma_win_size: CAT(UP,_DMA_WIN_SIZE_DEFAULT)
87 /* Any assembler that can generate a GENERIC kernel can generate BWX
88 instructions. So always use them for PYXIS I/O. */
90 #define DO_APECS_IO IO(APECS,apecs,apecs)
91 #define DO_CIA_IO IO(CIA,cia,cia)
92 #define DO_LCA_IO IO(LCA,lca,lca)
93 #define DO_MCPCIA_IO IO(MCPCIA,mcpcia,mcpcia)
94 #define DO_PYXIS_IO IO(PYXIS,pyxis_bw,pyxis)
95 #define DO_T2_IO IO(T2,t2,t2)
96 #define DO_TSUNAMI_IO IO(TSUNAMI,tsunami,tsunami)
98 #define BUS(which) \
99 mv_virt_to_bus: CAT(which,_virt_to_bus), \
100 mv_bus_to_virt: CAT(which,_bus_to_virt)
102 #define DO_APECS_BUS BUS(apecs)
103 #define DO_CIA_BUS BUS(cia)
104 #define DO_LCA_BUS BUS(lca)
105 #define DO_MCPCIA_BUS BUS(mcpcia)
106 #define DO_PYXIS_BUS BUS(pyxis)
107 #define DO_T2_BUS BUS(t2)
108 #define DO_TSUNAMI_BUS BUS(tsunami)
112 * In a GENERIC kernel, we have lots of these vectors floating about,
113 * all but one of which we want to go away. In a non-GENERIC kernel,
114 * we want only one, ever.
116 * Accomplish this in the GENERIC kernel by puting all of the vectors
117 * in the .init.data section where they'll go away. We'll copy the
118 * one we want to the real alpha_mv vector in setup_arch.
120 * Accomplish this in a non-GENERIC kernel by ifdef'ing out all but
121 * one of the vectors, which will not reside in .init.data. We then
122 * alias this one vector to alpha_mv, so no copy is needed.
124 * Upshot: set __initdata to nothing for non-GENERIC kernels.
127 #ifdef CONFIG_ALPHA_GENERIC
128 #define __initmv __initdata
129 #define ALIAS_MV(x)
130 #else
131 #define __initmv
133 /* GCC actually has a syntax for defining aliases, but is under some
134 delusion that you shouldn't be able to declare it extern somewhere
135 else beforehand. Fine. We'll do it ourselves. */
136 #define ALIAS_MV(system) asm(".global alpha_mv\nalpha_mv = " #system "_mv");
137 #endif