1#ifndef __ALPHA_POLARIS__H__ 2#define __ALPHA_POLARIS__H__ 3 4#include <linux/types.h> 5#include <asm/compiler.h> 6 7/* 8 * POLARIS is the internal name for a core logic chipset which provides 9 * memory controller and PCI access for the 21164PC chip based systems. 10 * 11 * This file is based on: 12 * 13 * Polaris System Controller 14 * Device Functional Specification 15 * 22-Jan-98 16 * Rev. 4.2 17 * 18 */ 19 20/* Polaris memory regions */ 21#define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000) 22#define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000) 23#define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000) 24#define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000) 25#define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000) 26#define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000) 27#define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000) 28 29#define POLARIS_IACK_SC POLARIS_IACK_BASE 30 31/* The Polaris command/status registers live in PCI Config space for 32 * bus 0/device 0. As such, they may be bytes, words, or doublewords. 33 */ 34#define POLARIS_W_VENID (POLARIS_DENSE_CONFIG_BASE) 35#define POLARIS_W_DEVID (POLARIS_DENSE_CONFIG_BASE+2) 36#define POLARIS_W_CMD (POLARIS_DENSE_CONFIG_BASE+4) 37#define POLARIS_W_STATUS (POLARIS_DENSE_CONFIG_BASE+6) 38 39/* 40 * Data structure for handling POLARIS machine checks: 41 */ 42struct el_POLARIS_sysdata_mcheck { 43 u_long psc_status; 44 u_long psc_pcictl0; 45 u_long psc_pcictl1; 46 u_long psc_pcictl2; 47}; 48 49#ifdef __KERNEL__ 50 51#ifndef __EXTERN_INLINE 52#define __EXTERN_INLINE extern inline 53#define __IO_EXTERN_INLINE 54#endif 55 56/* 57 * I/O functions: 58 * 59 * POLARIS, the PCI/memory support chipset for the PCA56 (21164PC) 60 * processors, can use either a sparse address mapping scheme, or the 61 * so-called byte-word PCI address space, to get at PCI memory and I/O. 62 * 63 * However, we will support only the BWX form. 64 */ 65 66#define vucp volatile unsigned char * 67#define vusp volatile unsigned short * 68#define vuip volatile unsigned int * 69#define vulp volatile unsigned long * 70 71__EXTERN_INLINE u8 polaris_inb(unsigned long addr) 72{ 73 /* ??? I wish I could get rid of this. But there's no ioremap 74 equivalent for I/O space. PCI I/O can be forced into the 75 POLARIS I/O region, but that doesn't take care of legacy 76 ISA crap. */ 77 78 return __kernel_ldbu(*(vucp)(addr + POLARIS_DENSE_IO_BASE)); 79} 80 81__EXTERN_INLINE void polaris_outb(u8 b, unsigned long addr) 82{ 83 __kernel_stb(b, *(vucp)(addr + POLARIS_DENSE_IO_BASE)); 84 mb(); 85} 86 87__EXTERN_INLINE u16 polaris_inw(unsigned long addr) 88{ 89 return __kernel_ldwu(*(vusp)(addr + POLARIS_DENSE_IO_BASE)); 90} 91 92__EXTERN_INLINE void polaris_outw(u16 b, unsigned long addr) 93{ 94 __kernel_stw(b, *(vusp)(addr + POLARIS_DENSE_IO_BASE)); 95 mb(); 96} 97 98__EXTERN_INLINE u32 polaris_inl(unsigned long addr) 99{ 100 return *(vuip)(addr + POLARIS_DENSE_IO_BASE); 101} 102 103__EXTERN_INLINE void polaris_outl(u32 b, unsigned long addr) 104{ 105 *(vuip)(addr + POLARIS_DENSE_IO_BASE) = b; 106 mb(); 107} 108 109/* 110 * Memory functions. Polaris allows all accesses (byte/word 111 * as well as long/quad) to be done through dense space. 112 * 113 * We will only support DENSE access via BWX insns. 114 */ 115 116__EXTERN_INLINE u8 polaris_readb(unsigned long addr) 117{ 118 return __kernel_ldbu(*(vucp)addr); 119} 120 121__EXTERN_INLINE u16 polaris_readw(unsigned long addr) 122{ 123 return __kernel_ldwu(*(vusp)addr); 124} 125 126__EXTERN_INLINE u32 polaris_readl(unsigned long addr) 127{ 128 return (*(vuip)addr) & 0xffffffff; 129} 130 131__EXTERN_INLINE u64 polaris_readq(unsigned long addr) 132{ 133 return *(vulp)addr; 134} 135 136__EXTERN_INLINE void polaris_writeb(u8 b, unsigned long addr) 137{ 138 __kernel_stb(b, *(vucp)addr); 139} 140 141__EXTERN_INLINE void polaris_writew(u16 b, unsigned long addr) 142{ 143 __kernel_stw(b, *(vusp)addr); 144} 145 146__EXTERN_INLINE void polaris_writel(u32 b, unsigned long addr) 147{ 148 *(vuip)addr = b; 149} 150 151__EXTERN_INLINE void polaris_writeq(u64 b, unsigned long addr) 152{ 153 *(vulp)addr = b; 154} 155 156__EXTERN_INLINE unsigned long polaris_ioremap(unsigned long addr, 157 unsigned long size 158 __attribute__((unused))) 159{ 160 return addr + POLARIS_DENSE_MEM_BASE; 161} 162 163__EXTERN_INLINE void polaris_iounmap(unsigned long addr) 164{ 165 return; 166} 167 168__EXTERN_INLINE int polaris_is_ioaddr(unsigned long addr) 169{ 170 return addr >= POLARIS_SPARSE_MEM_BASE; 171} 172 173#undef vucp 174#undef vusp 175#undef vuip 176#undef vulp 177 178#ifdef __WANT_IO_DEF 179 180#define __inb(p) polaris_inb((unsigned long)(p)) 181#define __inw(p) polaris_inw((unsigned long)(p)) 182#define __inl(p) polaris_inl((unsigned long)(p)) 183#define __outb(x,p) polaris_outb((x),(unsigned long)(p)) 184#define __outw(x,p) polaris_outw((x),(unsigned long)(p)) 185#define __outl(x,p) polaris_outl((x),(unsigned long)(p)) 186#define __readb(a) polaris_readb((unsigned long)(a)) 187#define __readw(a) polaris_readw((unsigned long)(a)) 188#define __readl(a) polaris_readl((unsigned long)(a)) 189#define __readq(a) polaris_readq((unsigned long)(a)) 190#define __writeb(x,a) polaris_writeb((x),(unsigned long)(a)) 191#define __writew(x,a) polaris_writew((x),(unsigned long)(a)) 192#define __writel(x,a) polaris_writel((x),(unsigned long)(a)) 193#define __writeq(x,a) polaris_writeq((x),(unsigned long)(a)) 194#define __ioremap(a,s) polaris_ioremap((unsigned long)(a),(s)) 195#define __iounmap(a) polaris_iounmap((unsigned long)(a)) 196#define __is_ioaddr(a) polaris_is_ioaddr((unsigned long)(a)) 197 198#define inb(p) __inb(p) 199#define inw(p) __inw(p) 200#define inl(p) __inl(p) 201#define outb(x,p) __outb((x),(p)) 202#define outw(x,p) __outw((x),(p)) 203#define outl(x,p) __outl((x),(p)) 204#define __raw_readb(a) __readb(a) 205#define __raw_readw(a) __readw(a) 206#define __raw_readl(a) __readl(a) 207#define __raw_readq(a) __readq(a) 208#define __raw_writeb(v,a) __writeb((v),(a)) 209#define __raw_writew(v,a) __writew((v),(a)) 210#define __raw_writel(v,a) __writel((v),(a)) 211#define __raw_writeq(v,a) __writeq((v),(a)) 212 213#endif /* __WANT_IO_DEF */ 214 215#ifdef __IO_EXTERN_INLINE 216#undef __EXTERN_INLINE 217#undef __IO_EXTERN_INLINE 218#endif 219 220#endif /* __KERNEL__ */ 221 222#endif /* __ALPHA_POLARIS__H__ */ 223