File: /usr/src/linux/arch/ia64/sn/sn1/llsc4.h
1 /*
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) 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2000 by Jack Steiner (steiner@sgi.com)
9 */
10
11 #ifdef STANDALONE
12 #include "lock.h"
13 #endif
14
15
16 #define DEF_NAPTICKS 0
17 #define DEF_PASSES 0
18 #define DEF_AUTO_PASSES 1000000
19 #define DEF_STOP_ON_ERROR 1
20 #define DEF_VERBOSE 0
21 #define DEF_LINECOUNT 2
22 #define DEF_ITER_MSG 0
23 #define DEF_VV 0xffffffff
24 #define DEF_LINEPAD 0x234
25
26
27
28 #define MAXCPUS 16
29 #define CACHELINE 64
30 #define MAX_LINECOUNT 1024
31 #define K 1024
32 #define MB (K*K)
33
34
35 #define uint unsigned int
36 #define ushort unsigned short
37 #define vint volatile int
38 #define vlong volatile long
39
40 #define LOCKADDR(i) &linep->lock[(i)]
41 #define LOCK(i) set_lock(LOCKADDR(i), lockpat)
42 #define UNLOCK(i) clr_lock(LOCKADDR(i), lockpat)
43 #define GETLOCK(i) *LOCKADDR(i)
44 #define ZEROLOCK(i) zero_lock(LOCKADDR(i))
45
46 #define CACHEALIGN(a) ((void*)((long)(a) & ~127L))
47
48 typedef uint lock_t;
49 typedef uint share_t;
50 typedef uint private_t;
51
52 typedef struct {
53 lock_t lock[2];
54 share_t share[2];
55 private_t private[MAXCPUS];
56 share_t share0;
57 share_t share1;
58 } dataline_t ;
59
60
61 #define LINEPAD k_linepad
62 #define LINESTRIDE (((sizeof(dataline_t)+CACHELINE-1)/CACHELINE)*CACHELINE + LINEPAD)
63
64
65 typedef struct {
66 vint threadstate;
67 uint threadpasses;
68 private_t private[MAX_LINECOUNT];
69 } threadprivate_t;
70
71 typedef struct {
72 vlong sk_go; /* 0=idle, 1=init, 2=run */
73 long sk_linecount;
74 long sk_passes;
75 long sk_napticks;
76 long sk_stop_on_error;
77 long sk_verbose;
78 long sk_iter_msg;
79 long sk_vv;
80 long sk_linepad;
81 long sk_options;
82 long sk_testnumber;
83 vlong sk_currentpass;
84 void *sk_blocks;
85 threadprivate_t *sk_threadprivate[MAXCPUS];
86 } control_t;
87
88 /* Run state (k_go) constants */
89 #define ST_IDLE 0
90 #define ST_INIT 1
91 #define ST_RUN 2
92 #define ST_STOP 3
93 #define ST_ERRSTOP 4
94
95
96 /* Threadstate constants */
97 #define TS_STOPPED 0
98 #define TS_RUNNING 1
99 #define TS_KILLED 2
100
101
102
103 int llsc_main (int cpuid, long mbasex);
104
105