synergy.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:6k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _ASM_IA64_SN_SN1_SYNERGY_H
  2. #define _ASM_IA64_SN_SN1_SYNERGY_H
  3. #include <asm/io.h>
  4. #include <asm/sn/hcl.h>
  5. #include <asm/sn/addrs.h>
  6. #include <asm/sn/intr_public.h>
  7. /*
  8.  * Definitions for the synergy asic driver
  9.  * 
  10.  * These are for SGI platforms only.
  11.  *
  12.  * This file is subject to the terms and conditions of the GNU General Public
  13.  * License.  See the file "COPYING" in the main directory of this archive
  14.  * for more details.
  15.  *
  16.  * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All rights reserved.
  17.  */
  18. #define SYNERGY_L4_BYTES (64UL*1024*1024)
  19. #define SYNERGY_L4_WAYS 8
  20. #define SYNERGY_L4_BYTES_PER_WAY (SYNERGY_L4_BYTES/SYNERGY_L4_WAYS)
  21. #define SYNERGY_BLOCK_SIZE 512UL
  22. #define SSPEC_BASE (0xe0000000000UL)
  23. #define LB_REG_BASE (SSPEC_BASE + 0x0)
  24. #define VEC_MASK3A_ADDR (0x2a0 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  25. #define VEC_MASK3B_ADDR (0x2a8 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  26. #define VEC_MASK3A (0x2a0)
  27. #define VEC_MASK3B (0x2a8)
  28. #define VEC_MASK2A_ADDR (0x2b0 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  29. #define VEC_MASK2B_ADDR (0x2b8 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  30. #define VEC_MASK2A (0x2b0)
  31. #define VEC_MASK2B (0x2b8)
  32. #define VEC_MASK1A_ADDR (0x2c0 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  33. #define VEC_MASK1B_ADDR (0x2c8 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  34. #define VEC_MASK1A (0x2c0)
  35. #define VEC_MASK1B (0x2c8)
  36. #define VEC_MASK0A_ADDR (0x2d0 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  37. #define VEC_MASK0B_ADDR (0x2d8 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  38. #define VEC_MASK0A (0x2d0)
  39. #define VEC_MASK0B (0x2d8)
  40. #define GBL_PERF_A_ADDR (0x330 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  41. #define GBL_PERF_B_ADDR (0x338 + LB_REG_BASE + __IA64_UNCACHED_OFFSET)
  42. #define WRITE_LOCAL_SYNERGY_REG(addr, value) __synergy_out(addr, value)
  43. #define HUB_L(_a)               *(_a)
  44. #define HUB_S(_a, _d)           *(_a) = (_d)
  45. #define HSPEC_SYNERGY0_0        0x04000000    /* Synergy0 Registers     */
  46. #define HSPEC_SYNERGY1_0        0x05000000    /* Synergy1 Registers     */
  47. #define HS_SYNERGY_STRIDE       (HSPEC_SYNERGY1_0 - HSPEC_SYNERGY0_0)
  48. #define REMOTE_HSPEC(_n, _x)    (HUBREG_CAST (RREG_BASE(_n) + (_x)))
  49. #define RREG_BASE(_n)           (NODE_LREG_BASE(_n))
  50. #define NODE_LREG_BASE(_n)      (NODE_HSPEC_BASE(_n) + 0x30000000)
  51. #define NODE_HSPEC_BASE(_n)     (HSPEC_BASE + NODE_OFFSET(_n))
  52. #ifndef HSPEC_BASE
  53. #define HSPEC_BASE              (SYN_UNCACHED_SPACE | HSPEC_BASE_SYN)
  54. #endif
  55. #define SYN_UNCACHED_SPACE      0xc000000000000000
  56. #define HSPEC_BASE_SYN          0x00000b0000000000
  57. #define NODE_OFFSET(_n)         (UINT64_CAST (_n) << NODE_SIZE_BITS)
  58. #define NODE_SIZE_BITS 33
  59. #define SYN_TAG_DISABLE_WAY (SSPEC_BASE+0xae0)
  60. #define RSYN_REG_OFFSET(fsb, reg) (((fsb) ? HSPEC_SYNERGY1_0 : HSPEC_SYNERGY0_0) | (reg))
  61. #define REMOTE_SYNERGY_LOAD(nasid, fsb, reg)  __remote_synergy_in(nasid, fsb, reg)
  62. #define REMOTE_SYNERGY_STORE(nasid, fsb, reg, val) __remote_synergy_out(nasid, fsb, reg, val)
  63. static inline uint64_t
  64. __remote_synergy_in(int nasid, int fsb, uint64_t reg) {
  65. volatile uint64_t *addr;
  66. addr = (uint64_t *)(RREG_BASE(nasid) + RSYN_REG_OFFSET(fsb, reg));
  67. return (*addr);
  68. }
  69. static inline void
  70. __remote_synergy_out(int nasid, int fsb, uint64_t reg, uint64_t value) {
  71. volatile uint64_t *addr;
  72.         addr = (uint64_t *)(RREG_BASE(nasid) + RSYN_REG_OFFSET(fsb, (reg<<2)));
  73.         *(addr+0) = value >> 48;
  74.         *(addr+1) = value >> 32;
  75.         *(addr+2) = value >> 16;
  76.         *(addr+3) = value;
  77.         __ia64_mf_a();
  78. }
  79. /* XX this doesn't make a lot of sense. Which fsb?  */
  80. static inline void
  81. __synergy_out(unsigned long addr, unsigned long value)
  82. {
  83. volatile unsigned long *adr = (unsigned long *)
  84. (addr | __IA64_UNCACHED_OFFSET);
  85. *adr = value;
  86. __ia64_mf_a();
  87. }
  88. #define READ_LOCAL_SYNERGY_REG(addr) __synergy_in(addr)
  89. /* XX this doesn't make a lot of sense. Which fsb? */
  90. static inline unsigned long
  91. __synergy_in(unsigned long addr)
  92. {
  93. unsigned long ret, *adr = (unsigned long *)
  94. (addr | __IA64_UNCACHED_OFFSET);
  95. ret = *adr;
  96. __ia64_mf_a();
  97. return ret;
  98. }
  99. struct sn1_intr_action {
  100. void (*handler)(int, void *, struct pt_regs *);
  101. void *intr_arg;
  102. unsigned long flags;
  103. struct sn1_intr_action * next;
  104. };
  105. typedef struct synergy_da_s {
  106. hub_intmasks_t s_intmasks;
  107. }synergy_da_t;
  108. struct sn1_cnode_action_list {
  109. spinlock_t action_list_lock;
  110. struct sn1_intr_action *action_list;
  111. };
  112. /*
  113.  * ioctl cmds for node/hub/synergy/[01]/mon for synergy
  114.  * perf monitoring are defined in sndrv.h
  115.  */
  116. /* multiplex the counters every 10 timer interrupts */ 
  117. #define SYNERGY_PERF_FREQ_DEFAULT 10
  118. /* macros for synergy "mon" device ioctl handler */
  119. #define SYNERGY_PERF_INFO(_s, _f) (arbitrary_info_t)(((_s) << 16)|(_f))
  120. #define SYNERGY_PERF_INFO_CNODE(_x) (cnodeid_t)(((uint64_t)_x) >> 16)
  121. #define SYNERGY_PERF_INFO_FSB(_x) (((uint64_t)_x) & 1)
  122. /* synergy perf control registers */
  123. #define PERF_CNTL0_A            0xab0UL /* control A on FSB0 */
  124. #define PERF_CNTL0_B            0xab8UL /* control B on FSB0 */
  125. #define PERF_CNTL1_A            0xac0UL /* control A on FSB1 */
  126. #define PERF_CNTL1_B            0xac8UL /* control B on FSB1 */
  127. /* synergy perf counters */
  128. #define PERF_CNTR0_A            0xad0UL /* counter A on FSB0 */
  129. #define PERF_CNTR0_B            0xad8UL /* counter B on FSB0 */
  130. #define PERF_CNTR1_A            0xaf0UL /* counter A on FSB1 */
  131. #define PERF_CNTR1_B            0xaf8UL /* counter B on FSB1 */
  132. /* Synergy perf data. Each nodepda keeps a list of these */
  133. struct synergy_perf_s {
  134.         uint64_t        intervals;      /* count of active intervals for this event */
  135.         uint64_t        total_intervals;/* snapshot of total intervals */
  136.         uint64_t        modesel;        /* mode and sel bits, both A and B registers */
  137.         struct synergy_perf_s *next; /* next in circular linked list */
  138.         uint64_t        counts[2];      /* [0] is synergy-A counter, [1] synergy-B counter */
  139. };
  140. typedef struct synergy_perf_s synergy_perf_t;
  141. typedef struct synergy_info_s synergy_info_t;
  142. extern void synergy_perf_init(void);
  143. extern void synergy_perf_update(int);
  144. extern struct file_operations synergy_mon_fops;
  145. #endif /* _ASM_IA64_SN_SN1_SYNERGY_H */