MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / asm-ia64 / sn / xtalk / xtalkaddrs.h
blobafedfc0f3e6b9648a84069c776cb142281fa4599
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 1992-1997,2000-2003 Silicon Graphics, Inc. All Rights Reserved.
7 */
8 #ifndef _ASM_IA64_SN_XTALK_XTALKADDRS_H
9 #define _ASM_IA64_SN_XTALK_XTALKADDRS_H
13 * CrossTalk to SN0 Hub addressing support
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.
19 * Format for non-Memory accesses:
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.
35 * Format for non-Memory accesses:
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
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.
60 /* Hub-specific xtalk definitions */
62 #define HX_MEM_BIT 0L /* Hub's idea of xtalk memory access */
63 #define HX_IO_BIT 1L /* Hub's idea of xtalk register access */
64 #define HX_ACCTYPE_SHIFT 47
66 #define HX_NODE_SHIFT 39
68 #define HX_BIGWIN_SHIFT 28
69 #define HX_SWIN_SHIFT 23
71 #define HX_LOCACC 0L /* local access */
72 #define HX_REMACC 1L /* remote access */
73 #define HX_ACCESS_SHIFT 23
76 * Pre-calculate the fixed portion of a crosstalk address that maps
77 * to local register space on a hub.
79 #define HX_REG_BASE ((HX_IO_BIT<<HX_ACCTYPE_SHIFT) + \
80 (0L<<HX_BIGWIN_SHIFT) + \
81 (1L<<HX_SWIN_SHIFT) + IALIAS_SIZE + \
82 (HX_REMACC<<HX_ACCESS_SHIFT))
84 /*
85 * Return a crosstalk address which a widget can use to access a
86 * designated register on a designated node.
88 #define HUBREG_AS_XTALKADDR(nasid, regaddr) \
89 ((iopaddr_t)(HX_REG_BASE + (((long)nasid)<<HX_NODE_SHIFT) + ((long)regaddr)))
91 #if TBD
92 #assert sizeof(iopaddr_t) == 8
93 #endif /* TBD */
96 * Get widget part number, given node id and widget id.
97 * Always do a 32-bit read, because some widgets, e.g., Bridge, require so.
98 * Widget ID is at offset 0 for 64-bit access. Add 4 to get lower 32 bits
99 * in big endian mode.
100 * XXX Double check this with Hub, Xbow, Bridge and other hardware folks.
102 #define XWIDGET_ID_READ(nasid, widget) \
103 (widgetreg_t)(*(volatile uint32_t *)(NODE_SWIN_BASE(nasid, widget) + WIDGET_ID))
106 #endif /* _ASM_IA64_SN_XTALK_XTALKADDRS_H */