core_irongate.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ALPHA_IRONGATE__H__
  3. #define __ALPHA_IRONGATE__H__
  4. #include <linux/types.h>
  5. #include <asm/compiler.h>
  6. /*
  7. * IRONGATE is the internal name for the AMD-751 K7 core logic chipset
  8. * which provides memory controller and PCI access for NAUTILUS-based
  9. * EV6 (21264) systems.
  10. *
  11. * This file is based on:
  12. *
  13. * IronGate management library, (c) 1999 Alpha Processor, Inc.
  14. * Copyright (C) 1999 Alpha Processor, Inc.,
  15. * (David Daniel, Stig Telfer, Soohoon Lee)
  16. */
  17. /*
  18. * The 21264 supports, and internally recognizes, a 44-bit physical
  19. * address space that is divided equally between memory address space
  20. * and I/O address space. Memory address space resides in the lower
  21. * half of the physical address space (PA[43]=0) and I/O address space
  22. * resides in the upper half of the physical address space (PA[43]=1).
  23. */
  24. /*
  25. * Irongate CSR map. Some of the CSRs are 8 or 16 bits, but all access
  26. * through the routines given is 32-bit.
  27. *
  28. * The first 0x40 bytes are standard as per the PCI spec.
  29. */
  30. typedef volatile __u32 igcsr32;
  31. typedef struct {
  32. igcsr32 dev_vendor; /* 0x00 - device ID, vendor ID */
  33. igcsr32 stat_cmd; /* 0x04 - status, command */
  34. igcsr32 class; /* 0x08 - class code, rev ID */
  35. igcsr32 latency; /* 0x0C - header type, PCI latency */
  36. igcsr32 bar0; /* 0x10 - BAR0 - AGP */
  37. igcsr32 bar1; /* 0x14 - BAR1 - GART */
  38. igcsr32 bar2; /* 0x18 - Power Management reg block */
  39. igcsr32 rsrvd0[6]; /* 0x1C-0x33 reserved */
  40. igcsr32 capptr; /* 0x34 - Capabilities pointer */
  41. igcsr32 rsrvd1[2]; /* 0x38-0x3F reserved */
  42. igcsr32 bacsr10; /* 0x40 - base address chip selects */
  43. igcsr32 bacsr32; /* 0x44 - base address chip selects */
  44. igcsr32 bacsr54_eccms761; /* 0x48 - 751: base addr. chip selects
  45. 761: ECC, mode/status */
  46. igcsr32 rsrvd2[1]; /* 0x4C-0x4F reserved */
  47. igcsr32 drammap; /* 0x50 - address mapping control */
  48. igcsr32 dramtm; /* 0x54 - timing, driver strength */
  49. igcsr32 dramms; /* 0x58 - DRAM mode/status */
  50. igcsr32 rsrvd3[1]; /* 0x5C-0x5F reserved */
  51. igcsr32 biu0; /* 0x60 - bus interface unit */
  52. igcsr32 biusip; /* 0x64 - Serial initialisation pkt */
  53. igcsr32 rsrvd4[2]; /* 0x68-0x6F reserved */
  54. igcsr32 mro; /* 0x70 - memory request optimiser */
  55. igcsr32 rsrvd5[3]; /* 0x74-0x7F reserved */
  56. igcsr32 whami; /* 0x80 - who am I */
  57. igcsr32 pciarb; /* 0x84 - PCI arbitration control */
  58. igcsr32 pcicfg; /* 0x88 - PCI config status */
  59. igcsr32 rsrvd6[4]; /* 0x8C-0x9B reserved */
  60. igcsr32 pci_mem; /* 0x9C - PCI top of memory,
  61. 761 only */
  62. /* AGP (bus 1) control registers */
  63. igcsr32 agpcap; /* 0xA0 - AGP Capability Identifier */
  64. igcsr32 agpstat; /* 0xA4 - AGP status register */
  65. igcsr32 agpcmd; /* 0xA8 - AGP control register */
  66. igcsr32 agpva; /* 0xAC - AGP Virtual Address Space */
  67. igcsr32 agpmode; /* 0xB0 - AGP/GART mode control */
  68. } Irongate0;
  69. typedef struct {
  70. igcsr32 dev_vendor; /* 0x00 - Device and Vendor IDs */
  71. igcsr32 stat_cmd; /* 0x04 - Status and Command regs */
  72. igcsr32 class; /* 0x08 - subclass, baseclass etc */
  73. igcsr32 htype; /* 0x0C - header type (at 0x0E) */
  74. igcsr32 rsrvd0[2]; /* 0x10-0x17 reserved */
  75. igcsr32 busnos; /* 0x18 - Primary, secondary bus nos */
  76. igcsr32 io_baselim_regs; /* 0x1C - IO base, IO lim, AGP status */
  77. igcsr32 mem_baselim; /* 0x20 - memory base, memory lim */
  78. igcsr32 pfmem_baselim; /* 0x24 - prefetchable base, lim */
  79. igcsr32 rsrvd1[2]; /* 0x28-0x2F reserved */
  80. igcsr32 io_baselim; /* 0x30 - IO base, IO limit */
  81. igcsr32 rsrvd2[2]; /* 0x34-0x3B - reserved */
  82. igcsr32 interrupt; /* 0x3C - interrupt, PCI bridge ctrl */
  83. } Irongate1;
  84. extern igcsr32 *IronECC;
  85. /*
  86. * Memory spaces:
  87. */
  88. /* Irongate is consistent with a subset of the Tsunami memory map */
  89. #ifdef USE_48_BIT_KSEG
  90. #define IRONGATE_BIAS 0x80000000000UL
  91. #else
  92. #define IRONGATE_BIAS 0x10000000000UL
  93. #endif
  94. #define IRONGATE_MEM (IDENT_ADDR | IRONGATE_BIAS | 0x000000000UL)
  95. #define IRONGATE_IACK_SC (IDENT_ADDR | IRONGATE_BIAS | 0x1F8000000UL)
  96. #define IRONGATE_IO (IDENT_ADDR | IRONGATE_BIAS | 0x1FC000000UL)
  97. #define IRONGATE_CONF (IDENT_ADDR | IRONGATE_BIAS | 0x1FE000000UL)
  98. /*
  99. * PCI Configuration space accesses are formed like so:
  100. *
  101. * 0x1FE << 24 | : 2 2 2 2 1 1 1 1 : 1 1 1 1 1 1 0 0 : 0 0 0 0 0 0 0 0 :
  102. * : 3 2 1 0 9 8 7 6 : 5 4 3 2 1 0 9 8 : 7 6 5 4 3 2 1 0 :
  103. * ---bus numer--- -device-- -fun- ---register----
  104. */
  105. #define IGCSR(dev,fun,reg) ( IRONGATE_CONF | \
  106. ((dev)<<11) | \
  107. ((fun)<<8) | \
  108. (reg) )
  109. #define IRONGATE0 ((Irongate0 *) IGCSR(0, 0, 0))
  110. #define IRONGATE1 ((Irongate1 *) IGCSR(1, 0, 0))
  111. /*
  112. * Data structure for handling IRONGATE machine checks:
  113. * This is the standard OSF logout frame
  114. */
  115. #define SCB_Q_SYSERR 0x620 /* OSF definitions */
  116. #define SCB_Q_PROCERR 0x630
  117. #define SCB_Q_SYSMCHK 0x660
  118. #define SCB_Q_PROCMCHK 0x670
  119. struct el_IRONGATE_sysdata_mcheck {
  120. __u32 FrameSize; /* Bytes, including this field */
  121. __u32 FrameFlags; /* <31> = Retry, <30> = Second Error */
  122. __u32 CpuOffset; /* Offset to CPU-specific into */
  123. __u32 SystemOffset; /* Offset to system-specific info */
  124. __u32 MCHK_Code;
  125. __u32 MCHK_Frame_Rev;
  126. __u64 I_STAT;
  127. __u64 DC_STAT;
  128. __u64 C_ADDR;
  129. __u64 DC1_SYNDROME;
  130. __u64 DC0_SYNDROME;
  131. __u64 C_STAT;
  132. __u64 C_STS;
  133. __u64 RESERVED0;
  134. __u64 EXC_ADDR;
  135. __u64 IER_CM;
  136. __u64 ISUM;
  137. __u64 MM_STAT;
  138. __u64 PAL_BASE;
  139. __u64 I_CTL;
  140. __u64 PCTX;
  141. };
  142. #ifdef __KERNEL__
  143. #ifndef __EXTERN_INLINE
  144. #define __EXTERN_INLINE extern inline
  145. #define __IO_EXTERN_INLINE
  146. #endif
  147. /*
  148. * I/O functions:
  149. *
  150. * IRONGATE (AMD-751) PCI/memory support chip for the EV6 (21264) and
  151. * K7 can only use linear accesses to get at PCI memory and I/O spaces.
  152. */
  153. /*
  154. * Memory functions. All accesses are done through linear space.
  155. */
  156. __EXTERN_INLINE void __iomem *irongate_ioportmap(unsigned long addr)
  157. {
  158. return (void __iomem *)(addr + IRONGATE_IO);
  159. }
  160. extern void __iomem *irongate_ioremap(unsigned long addr, unsigned long size);
  161. extern void irongate_iounmap(volatile void __iomem *addr);
  162. __EXTERN_INLINE int irongate_is_ioaddr(unsigned long addr)
  163. {
  164. return addr >= IRONGATE_MEM;
  165. }
  166. __EXTERN_INLINE int irongate_is_mmio(const volatile void __iomem *xaddr)
  167. {
  168. unsigned long addr = (unsigned long)xaddr;
  169. return addr < IRONGATE_IO || addr >= IRONGATE_CONF;
  170. }
  171. #undef __IO_PREFIX
  172. #define __IO_PREFIX irongate
  173. #define irongate_trivial_rw_bw 1
  174. #define irongate_trivial_rw_lq 1
  175. #define irongate_trivial_io_bw 1
  176. #define irongate_trivial_io_lq 1
  177. #define irongate_trivial_iounmap 0
  178. #include <asm/io_trivial.h>
  179. #ifdef __IO_EXTERN_INLINE
  180. #undef __EXTERN_INLINE
  181. #undef __IO_EXTERN_INLINE
  182. #endif
  183. #endif /* __KERNEL__ */
  184. #endif /* __ALPHA_IRONGATE__H__ */