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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /* $Id$
  2.  *
  3.  * This file is subject to the terms and conditions of the GNU General Public
  4.  * License.  See the file "COPYING" in the main directory of this archive
  5.  * for more details.
  6.  *
  7.  * Copyright (C) 1992 - 1997, 2000-2001 Silicon Graphics, Inc.
  8.  * Copyright (C) 2000 by Colin Ngam
  9.  */
  10. #ifndef _ASM_SN_XTALK_XTALKADDRS_H
  11. #define _ASM_SN_XTALK_XTALKADDRS_H
  12. /*
  13.  * CrossTalk to SN0 Hub addressing support
  14.  *
  15.  * This file defines the mapping conventions used by the Hub's
  16.  * I/O interface when it receives a read or write request from 
  17.  * a CrossTalk widget.  
  18.  *
  19.  * Format for non-Memory accesses:
  20.  *
  21.  *  +--------------+------------------------------------------------+
  22.  *  | 0  | XXXXX   |        SN0Addr                                |
  23.  *  +----+---------+------------------------------------------------+
  24.  *    47  46     40 39                                             0
  25.  * bit 47 indicates Memory (0)
  26.  * bits 46..40 are unused
  27.  * bits 39..0 hold the memory address
  28.  * (bits 39..31 hold the nodeID in N mode
  29.  *  bits 39..32 hold the nodeID in M mode
  30.  * By design, this looks exactly like a 0-extended SN0 Address, so
  31.  * we don't need to do any conversions.
  32.  *
  33.  *
  34.  *
  35.  * Format for non-Memory accesses:
  36.  *
  37.  *  +--------------+------+---------+------+--+---------------------+
  38.  *  | 1  | DstNode | XXXX | BigW=0  | SW=1 | 1|   Addr              |
  39.  *  +----+---------+------+---------+------+--+---------------------+
  40.  *    47  46     38 37  31 30     28 27  24 23 22                  0
  41.  *
  42.  * bit 47 indicates IO (1)
  43.  *      bits 46..38 hold the destination node ID
  44.  *      bits 37..31 are unused
  45.  *      bits 30..28 hold the big window being addressed
  46.  *      bits 27..24 hold the small window being addressed
  47.  *                  0 always refers to the xbow
  48.  *                  1 always refers to the hub itself
  49.  *      bit 23 indicates local (0) or remote (1)
  50.  *             no accessing checks are done if this bit is 0
  51.  *      bits 22..0 hold the register address
  52.  *                 bits 22..21 determine which section of the hub
  53.  *                              00 -> PI
  54.  *                              01 -> MD
  55.  *                              10 -> IO
  56.  *                              11 -> NI
  57.  * This looks very much like a REMOTE_HUB access, except the nodeID
  58.  * is in a different place, and the highest xtalk bit is set.
  59.  */
  60. /* Hub-specific xtalk definitions */
  61. #define HX_MEM_BIT 0L /* Hub's idea of xtalk memory access */
  62. #define HX_IO_BIT 1L /* Hub's idea of xtalk register access */
  63. #define HX_ACCTYPE_SHIFT 47
  64. #define HX_NODE_SHIFT 39
  65. #define HX_BIGWIN_SHIFT 28
  66. #define HX_SWIN_SHIFT 23
  67. #define HX_LOCACC 0L /* local access */
  68. #define HX_REMACC 1L /* remote access */
  69. #define HX_ACCESS_SHIFT 23
  70. /*
  71.  * Pre-calculate the fixed portion of a crosstalk address that maps
  72.  * to local register space on a hub.
  73.  */
  74. #define HX_REG_BASE ((HX_IO_BIT<<HX_ACCTYPE_SHIFT) + 
  75. (0L<<HX_BIGWIN_SHIFT) + 
  76. (1L<<HX_SWIN_SHIFT) + IALIAS_SIZE + 
  77. (HX_REMACC<<HX_ACCESS_SHIFT))
  78. /* 
  79.  * Return a crosstalk address which a widget can use to access a
  80.  * designated register on a designated node.
  81.  */
  82. #define HUBREG_AS_XTALKADDR(nasid, regaddr) 
  83. ((iopaddr_t)(HX_REG_BASE + (((long)nasid)<<HX_NODE_SHIFT) + ((long)regaddr)))
  84. #if TBD
  85. #assert sizeof(iopaddr_t) == 8
  86. #endif /* TBD */
  87. /*
  88.  * Get widget part number, given node id and widget id. 
  89.  * Always do a 32-bit read, because some widgets, e.g., Bridge, require so.
  90.  * Widget ID is at offset 0 for 64-bit access.  Add 4 to get lower 32 bits
  91.  * in big endian mode. 
  92.  * XXX Double check this with Hub, Xbow, Bridge and other hardware folks.
  93.  */
  94. #define XWIDGET_ID_READ(nasid, widget) 
  95.         (widgetreg_t)(*(volatile uint32_t *)(NODE_SWIN_BASE(nasid, widget) + WIDGET_ID))
  96. #endif /* _ASM_SN_XTALK_XTALKADDRS_H */