1 #ifndef __ALPHA_POLARIS__H__
2 #define __ALPHA_POLARIS__H__
4 #include <linux/config.h>
5 #include <linux/types.h>
6 #include <asm/compiler.h>
9 * POLARIS is the internal name for a core logic chipset which provides
10 * memory controller and PCI access for the 21164PC chip based systems.
12 * This file is based on:
14 * Polaris System Controller
15 * Device Functional Specification
21 /* Polaris memory regions */
22 #define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000)
23 #define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000)
24 #define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000)
25 #define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000)
26 #define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000)
27 #define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000)
28 #define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000)
30 #define POLARIS_IACK_SC POLARIS_IACK_BASE
32 /* The Polaris command/status registers live in PCI Config space for
33 * bus 0/device 0. As such, they may be bytes, words, or doublewords.
35 #define POLARIS_W_VENID (POLARIS_DENSE_CONFIG_BASE)
36 #define POLARIS_W_DEVID (POLARIS_DENSE_CONFIG_BASE+2)
37 #define POLARIS_W_CMD (POLARIS_DENSE_CONFIG_BASE+4)
38 #define POLARIS_W_STATUS (POLARIS_DENSE_CONFIG_BASE+6)
40 /* No HAE address. Polaris has no concept of an HAE, since it
41 * supports transfers of all sizes in dense space.
44 #define POLARIS_DMA_WIN_BASE_DEFAULT 0x80000000 /* fixed, 2G @ 2G */
45 #define POLARIS_DMA_WIN_SIZE_DEFAULT 0x80000000 /* fixed, 2G @ 2G */
47 #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
48 #define POLARIS_DMA_WIN_BASE alpha_mv.dma_win_base
49 #define POLARIS_DMA_WIN_SIZE alpha_mv.dma_win_size
51 #define POLARIS_DMA_WIN_BASE POLARIS_DMA_WIN_BASE_DEFAULT
52 #define POLARIS_DMA_WIN_SIZE POLARIS_DMA_WIN_SIZE_DEFAULT
56 * Data structure for handling POLARIS machine checks:
58 struct el_POLARIS_sysdata_mcheck
{
67 #ifndef __EXTERN_INLINE
68 #define __EXTERN_INLINE extern inline
69 #define __IO_EXTERN_INLINE
72 __EXTERN_INLINE
unsigned long polaris_virt_to_bus(void * address
)
74 return virt_to_phys(address
) + POLARIS_DMA_WIN_BASE
;
77 __EXTERN_INLINE
void * polaris_bus_to_virt(unsigned long address
)
79 return phys_to_virt(address
- POLARIS_DMA_WIN_BASE
);
85 * POLARIS, the PCI/memory support chipset for the PCA56 (21164PC)
86 * processors, can use either a sparse address mapping scheme, or the
87 * so-called byte-word PCI address space, to get at PCI memory and I/O.
89 * However, we will support only the BWX form.
92 #define vucp volatile unsigned char *
93 #define vusp volatile unsigned short *
94 #define vuip volatile unsigned int *
95 #define vulp volatile unsigned long *
97 __EXTERN_INLINE
unsigned int polaris_inb(unsigned long addr
)
99 return __kernel_ldbu(*(vucp
)(addr
+ POLARIS_DENSE_IO_BASE
));
102 __EXTERN_INLINE
void polaris_outb(unsigned char b
, unsigned long addr
)
104 __kernel_stb(b
, *(vucp
)(addr
+ POLARIS_DENSE_IO_BASE
));
108 __EXTERN_INLINE
unsigned int polaris_inw(unsigned long addr
)
110 return __kernel_ldwu(*(vusp
)(addr
+ POLARIS_DENSE_IO_BASE
));
113 __EXTERN_INLINE
void polaris_outw(unsigned short b
, unsigned long addr
)
115 __kernel_stw(b
, *(vusp
)(addr
+ POLARIS_DENSE_IO_BASE
));
119 __EXTERN_INLINE
unsigned int polaris_inl(unsigned long addr
)
121 return *(vuip
)(addr
+ POLARIS_DENSE_IO_BASE
);
124 __EXTERN_INLINE
void polaris_outl(unsigned int b
, unsigned long addr
)
126 *(vuip
)(addr
+ POLARIS_DENSE_IO_BASE
) = b
;
131 * Memory functions. Polaris allows all accesses (byte/word
132 * as well as long/quad) to be done through dense space.
134 * We will only support DENSE access via BWX insns.
137 __EXTERN_INLINE
unsigned long polaris_readb(unsigned long addr
)
139 return __kernel_ldbu(*(vucp
)(addr
+ POLARIS_DENSE_MEM_BASE
));
142 __EXTERN_INLINE
unsigned long polaris_readw(unsigned long addr
)
144 return __kernel_ldwu(*(vusp
)(addr
+ POLARIS_DENSE_MEM_BASE
));
147 __EXTERN_INLINE
unsigned long polaris_readl(unsigned long addr
)
149 return *(vuip
)(addr
+ POLARIS_DENSE_MEM_BASE
);
152 __EXTERN_INLINE
unsigned long polaris_readq(unsigned long addr
)
154 return *(vulp
)(addr
+ POLARIS_DENSE_MEM_BASE
);
157 __EXTERN_INLINE
void polaris_writeb(unsigned char b
, unsigned long addr
)
159 __kernel_stb(b
, *(vucp
)(addr
+ POLARIS_DENSE_MEM_BASE
));
163 __EXTERN_INLINE
void polaris_writew(unsigned short b
, unsigned long addr
)
165 __kernel_stw(b
, *(vusp
)(addr
+ POLARIS_DENSE_MEM_BASE
));
169 __EXTERN_INLINE
void polaris_writel(unsigned int b
, unsigned long addr
)
171 *(vuip
)(addr
+ POLARIS_DENSE_MEM_BASE
) = b
;
175 __EXTERN_INLINE
void polaris_writeq(unsigned long b
, unsigned long addr
)
177 *(vulp
)(addr
+ POLARIS_DENSE_MEM_BASE
) = b
;
181 /* Find the DENSE memory area for a given bus address. */
183 __EXTERN_INLINE
unsigned long polaris_dense_mem(unsigned long addr
)
185 return POLARIS_DENSE_MEM_BASE
;
195 #define virt_to_bus polaris_virt_to_bus
196 #define bus_to_virt polaris_bus_to_virt
198 #define __inb polaris_inb
199 #define __inw polaris_inw
200 #define __inl polaris_inl
201 #define __outb polaris_outb
202 #define __outw polaris_outw
203 #define __outl polaris_outl
204 #define __readb polaris_readb
205 #define __readw polaris_readw
206 #define __writeb polaris_writeb
207 #define __writew polaris_writew
208 #define __readl polaris_readl
209 #define __readq polaris_readq
210 #define __writel polaris_writel
211 #define __writeq polaris_writeq
212 #define dense_mem polaris_dense_mem
214 #define inb(port) __inb((port))
215 #define inw(port) __inw((port))
216 #define inl(port) __inl((port))
218 #define outb(v, port) __outb((v),(port))
219 #define outw(v, port) __outw((v),(port))
220 #define outl(v, port) __outl((v),(port))
222 #define readb(a) __readb((unsigned long)(a))
223 #define readw(a) __readw((unsigned long)(a))
224 #define readl(a) __readl((unsigned long)(a))
225 #define readq(a) __readq((unsigned long)(a))
227 #define writeb(v,a) __writeb((v),(unsigned long)(a))
228 #define writew(v,a) __writew((v),(unsigned long)(a))
229 #define writel(v,a) __writel((v),(unsigned long)(a))
230 #define writeq(v,a) __writeq((v),(unsigned long)(a))
232 #endif /* __WANT_IO_DEF */
234 #ifdef __IO_EXTERN_INLINE
235 #undef __EXTERN_INLINE
236 #undef __IO_EXTERN_INLINE
239 #endif /* __KERNEL__ */
241 #endif /* __ALPHA_POLARIS__H__ */