1*2874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2254dae59SAnshuman Khandual /*
3254dae59SAnshuman Khandual  * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.
4254dae59SAnshuman Khandual  */
5254dae59SAnshuman Khandual #define TAR_1   10
6254dae59SAnshuman Khandual #define TAR_2   20
7254dae59SAnshuman Khandual #define TAR_3   30
8254dae59SAnshuman Khandual #define TAR_4   40
9254dae59SAnshuman Khandual #define TAR_5   50
10254dae59SAnshuman Khandual 
11254dae59SAnshuman Khandual #define DSCR_1  100
12254dae59SAnshuman Khandual #define DSCR_2  200
13254dae59SAnshuman Khandual #define DSCR_3  300
14254dae59SAnshuman Khandual #define DSCR_4  400
15254dae59SAnshuman Khandual #define DSCR_5  500
16254dae59SAnshuman Khandual 
17254dae59SAnshuman Khandual #define PPR_1   0x4000000000000         /* or 31,31,31*/
18254dae59SAnshuman Khandual #define PPR_2   0x8000000000000         /* or 1,1,1 */
19254dae59SAnshuman Khandual #define PPR_3   0xc000000000000         /* or 6,6,6 */
20254dae59SAnshuman Khandual #define PPR_4   0x10000000000000        /* or 2,2,2 */
21254dae59SAnshuman Khandual 
22254dae59SAnshuman Khandual char *user_read = "[User Read (Running)]";
23254dae59SAnshuman Khandual char *user_write = "[User Write (Running)]";
24254dae59SAnshuman Khandual char *ptrace_read_running = "[Ptrace Read (Running)]";
25254dae59SAnshuman Khandual char *ptrace_write_running = "[Ptrace Write (Running)]";
26254dae59SAnshuman Khandual char *ptrace_read_ckpt = "[Ptrace Read (Checkpointed)]";
27254dae59SAnshuman Khandual char *ptrace_write_ckpt = "[Ptrace Write (Checkpointed)]";
28254dae59SAnshuman Khandual 
validate_tar_registers(unsigned long * reg,unsigned long tar,unsigned long ppr,unsigned long dscr)29254dae59SAnshuman Khandual int validate_tar_registers(unsigned long *reg, unsigned long tar,
30254dae59SAnshuman Khandual 				unsigned long ppr, unsigned long dscr)
31254dae59SAnshuman Khandual {
32254dae59SAnshuman Khandual 	int match = 1;
33254dae59SAnshuman Khandual 
34254dae59SAnshuman Khandual 	if (reg[0] != tar)
35254dae59SAnshuman Khandual 		match = 0;
36254dae59SAnshuman Khandual 
37254dae59SAnshuman Khandual 	if (reg[1] != ppr)
38254dae59SAnshuman Khandual 		match = 0;
39254dae59SAnshuman Khandual 
40254dae59SAnshuman Khandual 	if (reg[2] != dscr)
41254dae59SAnshuman Khandual 		match = 0;
42254dae59SAnshuman Khandual 
43254dae59SAnshuman Khandual 	if (!match)
44254dae59SAnshuman Khandual 		return TEST_FAIL;
45254dae59SAnshuman Khandual 	return TEST_PASS;
46254dae59SAnshuman Khandual }
47