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