xref: /OK3568_Linux_fs/u-boot/cmd/ddr_tool/stressapptest/stressapptest.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* Copyright 2006 Google Inc. All Rights Reserved. */
2 /* Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  *	http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  */
14 
15 /* This is stressapptest for Rockchip platform in U-Boot, the design idea and
16  * the patterns are from code.google.com/p/stressapptest.
17  */
18 
19 #ifndef __CMD_DDR_TOOL_STRESSAPPTEST_STRESSAPPTEST_H
20 #define __CMD_DDR_TOOL_STRESSAPPTEST_STRESSAPPTEST_H
21 
22 struct stressapptest_params {
23 	ulong total_start_addr;
24 	ulong total_test_size_mb;
25 	/* total_test_size = page_size * page_num */
26 	ulong page_size_byte;
27 	u32 page_num;
28 	/* page_size = block_size * block_num */
29 	u32 block_size_byte;
30 	u32 block_num;
31 
32 	u32 weight_count;
33 
34 	u8 cpu_num;
35 } sat;
36 
37 struct pat {
38 	const char *name;
39 	const unsigned int *data_array;
40 	/* mask = size - 1, So data_array[index & mask] is always valid. */
41 	const unsigned int mask;
42 	const unsigned int weight[4];	/* Weighted frequency of this pattern. */
43 };
44 
45 struct adler_sum {
46 	u64 a1;
47 	u64 b1;
48 	u64 a2;
49 	u64 b2;
50 };
51 
52 struct pattern {
53 	struct pat *pat;
54 	bool inv;
55 	u32 repeat;
56 	u32 weight;
57 	struct adler_sum adler_sum;
58 };
59 
60 struct page {
61 	void *base_addr;
62 	struct pattern *pattern;
63 	bool valid;	/* 1: valid, 0: empty */
64 } *page_list;
65 
66 extern void secondary_init(void);
67 extern void lock_byte_mutex(u32 *flag);
68 extern u32 unlock_byte_mutex(u32 *flag);
69 
70 #endif /* __CMD_DDR_TOOL_STRESSAPPTEST_STRESSAPPTEST_H */
71