xref: /rk3399_rockchip-uboot/cmd/ddr_tool/stressapptest/stressapptest.h (revision 4b97f93074f3c3fd638fb1d4e20ff6639c142208)
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_test_size_mb;
24 	/* total_test_size = page_size * page_num */
25 	ulong page_size_byte;
26 	u32 page_num;
27 	/* page_size = block_size * block_num */
28 	u32 block_size_byte;
29 	u32 block_num;
30 
31 	u32 weight_count;
32 
33 	u8 cpu_num;
34 } sat;
35 
36 struct pat {
37 	const char *name;
38 	const unsigned int *data_array;
39 	/* mask = size - 1, So data_array[index & mask] is always valid. */
40 	const unsigned int mask;
41 	const unsigned int weight[4];	/* Weighted frequency of this pattern. */
42 };
43 
44 struct adler_sum {
45 	u64 a1;
46 	u64 b1;
47 	u64 a2;
48 	u64 b2;
49 };
50 
51 struct pattern {
52 	struct pat *pat;
53 	bool inv;
54 	u32 repeat;
55 	u32 weight;
56 	struct adler_sum adler_sum;
57 };
58 
59 struct page {
60 	void *base_addr;
61 	struct pattern *pattern;
62 	bool valid;	/* 1: valid, 0: empty */
63 } *page_list;
64 
65 extern void secondary_init(void);
66 extern void lock_byte_mutex(u32 *flag);
67 extern u32 unlock_byte_mutex(u32 *flag);
68 extern u32 get_cpu_id(void);
69 
70 #endif /* __CMD_DDR_TOOL_STRESSAPPTEST_STRESSAPPTEST_H */
71