make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / include / asm-ia64 / sn / bte.h
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.
5  * 
6  * Copyright (c) 2001-2002 Silicon Graphics, Inc.  All rights reserved.
7  */
8
9 #ifndef _ASM_IA64_SN_BTE_H
10 #define _ASM_IA64_SN_BTE_H
11
12 #ident "$Revision: 1.1.1.1 $"
13
14 #include <linux/spinlock.h>
15 #include <linux/cache.h>
16 #include <asm/sn/io.h>
17
18 #define L1_CACHE_MASK (L1_CACHE_BYTES - 1)      /* Mask to retrieve
19                                                  * the offset into this
20                                                  * cache line.*/
21
22 /* BTE status register only supports 16 bits for length field */
23 #define BTE_LEN_BITS (16)
24 #define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1)
25 #define BTE_MAX_XFER ((1 << BTE_LEN_BITS) * L1_CACHE_BYTES)
26
27
28 /*
29  * Constants used in determining the best and worst case transfer
30  * times. To help explain the two, the following graph of transfer
31  * status vs time may help.
32  *
33  *     active +------------------:-+  :
34  *  status    |                  : |  :
35  *       idle +__________________:_+=======
36  *            0 Time           MaxT  MinT
37  *
38  *  Therefore, MaxT is the maximum thoeretical rate for transfering
39  *  the request block (assuming ideal circumstances)
40  *
41  *  MinT is the minimum theoretical rate for transferring the
42  *  requested block (assuming maximum link distance and contention)
43  *
44  *  The following defines are the inverse of the above.  They are
45  *  used for calculating the MaxT time and MinT time given the 
46  *  number of lines in the transfer.
47  */
48 #define BTE_MAXT_LINES_PER_SECOND 800
49 #define BTE_MINT_LINES_PER_SECOND 600
50
51
52 /* Define hardware */
53 #define BTES_PER_NODE 2
54
55 /* Define hardware modes */
56 #define BTE_NOTIFY (IBCT_NOTIFY)
57 #define BTE_NORMAL BTE_NOTIFY
58 #define BTE_ZERO_FILL (BTE_NOTIFY | IBCT_ZFIL_MODE)
59
60 /* Use a reserved bit to let the caller specify a wait for any BTE */
61 #define BTE_WACQUIRE (0x4000)
62
63 /*
64  * Structure defining a bte.  An instance of this
65  * structure is created in the nodepda for each
66  * bte on that node (as defined by BTES_PER_NODE)
67  * This structure contains everything necessary
68  * to work with a BTE.
69  */
70 typedef struct bteinfo_s {
71         u64 volatile notify ____cacheline_aligned;
72         char *bte_base_addr ____cacheline_aligned;
73         spinlock_t spinlock;
74         u64 idealTransferTimeout;
75         u64 idealTransferTimeoutReached;
76         u64 mostRecentSrc;
77         u64 mostRecentDest;
78         u64 mostRecentLen;
79         u64 mostRecentMode;
80         u64 volatile *mostRecentNotification;
81         void *bteTestBuf;
82 } bteinfo_t;
83
84 /* Possible results from bte_copy and bte_unaligned_copy */
85 typedef enum {
86         BTE_SUCCESS,            /* 0 is success */
87         BTEFAIL_NOTAVAIL,       /* BTE not available */
88         BTEFAIL_ERROR,          /* Generic error */
89         BTEFAIL_DIR             /* Diretory error */
90 } bte_result_t;
91
92 #endif                          /* _ASM_IA64_SN_BTE_H */