1/* $Id: vector.h,v 1.1.1.1 2008/10/15 03:27:17 james26_jang Exp $
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-2002 Silicon Graphics, Inc. All rights reserved.
8 */
9#ifndef _ASM_IA64_SN_VECTOR_H
10#define _ASM_IA64_SN_VECTOR_H
11
12#include <linux/config.h>
13
14#define NET_VEC_NULL            ((net_vec_t)  0)
15#define NET_VEC_BAD             ((net_vec_t) -1)
16
17#ifdef RTL
18
19#define VEC_POLLS_W		16	/* Polls before write times out */
20#define VEC_POLLS_R		16	/* Polls before read times out */
21#define VEC_POLLS_X		16	/* Polls before exch times out */
22
23#define VEC_RETRIES_W		1	/* Retries before write fails */
24#define VEC_RETRIES_R		1	/* Retries before read fails */
25#define VEC_RETRIES_X		1	/* Retries before exch fails */
26
27#else /* RTL */
28
29#define VEC_POLLS_W		128	/* Polls before write times out */
30#define VEC_POLLS_R		128	/* Polls before read times out */
31#define VEC_POLLS_X		128	/* Polls before exch times out */
32
33#define VEC_RETRIES_W		8	/* Retries before write fails */
34#define VEC_RETRIES_R           8	/* Retries before read fails */
35#define VEC_RETRIES_X		4	/* Retries before exch fails */
36
37#endif /* RTL */
38
39#if defined(CONFIG_IA64_SGI_SN1) || defined(CONFIG_IA64_GENERIC)
40#define VECTOR_PARMS		LB_VECTOR_PARMS
41#define VECTOR_ROUTE		LB_VECTOR_ROUTE
42#define VECTOR_DATA		LB_VECTOR_DATA
43#define VECTOR_STATUS		LB_VECTOR_STATUS
44#define VECTOR_RETURN		LB_VECTOR_RETURN
45#define VECTOR_READ_DATA	LB_VECTOR_READ_DATA
46#define VECTOR_STATUS_CLEAR	LB_VECTOR_STATUS_CLEAR
47#define VP_PIOID_SHFT		LVP_PIOID_SHFT
48#define VP_PIOID_MASK		LVP_PIOID_MASK
49#define VP_WRITEID_SHFT		LVP_WRITEID_SHFT
50#define VP_WRITEID_MASK		LVP_WRITEID_MASK
51#define VP_ADDRESS_MASK		LVP_ADDRESS_MASK
52#define VP_TYPE_SHFT		LVP_TYPE_SHFT
53#define VP_TYPE_MASK		LVP_TYPE_MASK
54#define VS_VALID		LVS_VALID
55#define VS_OVERRUN		LVS_OVERRUN
56#define VS_TARGET_SHFT		LVS_TARGET_SHFT
57#define VS_TARGET_MASK		LVS_TARGET_MASK
58#define VS_PIOID_SHFT		LVS_PIOID_SHFT
59#define VS_PIOID_MASK		LVS_PIOID_MASK
60#define VS_WRITEID_SHFT		LVS_WRITEID_SHFT
61#define VS_WRITEID_MASK		LVS_WRITEID_MASK
62#define VS_ADDRESS_MASK		LVS_ADDRESS_MASK
63#define VS_TYPE_SHFT		LVS_TYPE_SHFT
64#define VS_TYPE_MASK		LVS_TYPE_MASK
65#define VS_ERROR_MASK		LVS_ERROR_MASK
66#endif
67
68#define NET_ERROR_NONE		0	/* No error		*/
69#define NET_ERROR_HARDWARE	(-1)	/* Hardware error	*/
70#define NET_ERROR_OVERRUN	(-2)	/* Extra response(s)	*/
71#define NET_ERROR_REPLY		(-3)	/* Reply parms mismatch */
72#define NET_ERROR_ADDRESS	(-4)	/* Addr error response	*/
73#define NET_ERROR_COMMAND	(-5)	/* Cmd error response	*/
74#define NET_ERROR_PROT		(-6)	/* Prot error response	*/
75#define NET_ERROR_TIMEOUT	(-7)	/* Too many retries	*/
76#define NET_ERROR_VECTOR	(-8)	/* Invalid vector/path	*/
77#define NET_ERROR_ROUTERLOCK	(-9)	/* Timeout locking rtr	*/
78#define NET_ERROR_INVAL		(-10)	/* Invalid vector request */
79
80#ifndef __ASSEMBLY__
81#include <linux/types.h>
82#include <asm/sn/types.h>
83
84typedef uint64_t              net_reg_t;
85typedef uint64_t              net_vec_t;
86
87int             vector_write(net_vec_t dest,
88                              int write_id, int address,
89                              uint64_t value);
90
91int             vector_read(net_vec_t dest,
92                             int write_id, int address,
93                             uint64_t *value);
94
95int             vector_write_node(net_vec_t dest, nasid_t nasid,
96                              int write_id, int address,
97                              uint64_t value);
98
99int             vector_read_node(net_vec_t dest, nasid_t nasid,
100                             int write_id, int address,
101                             uint64_t *value);
102
103int             vector_length(net_vec_t vec);
104net_vec_t       vector_get(net_vec_t vec, int n);
105net_vec_t       vector_prefix(net_vec_t vec, int n);
106net_vec_t       vector_modify(net_vec_t entry, int n, int route);
107net_vec_t       vector_reverse(net_vec_t vec);
108net_vec_t       vector_concat(net_vec_t vec1, net_vec_t vec2);
109
110char		*net_errmsg(int);
111
112#ifndef _STANDALONE
113int hub_vector_write(cnodeid_t cnode, net_vec_t vector, int writeid,
114	int addr, net_reg_t value);
115int hub_vector_read(cnodeid_t cnode, net_vec_t vector, int writeid,
116	int addr, net_reg_t *value);
117#endif
118
119#endif /* __ASSEMBLY__ */
120
121#endif /* _ASM_IA64_SN_VECTOR_H */
122