18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#define TAR_1   10
68c2ecf20Sopenharmony_ci#define TAR_2   20
78c2ecf20Sopenharmony_ci#define TAR_3   30
88c2ecf20Sopenharmony_ci#define TAR_4   40
98c2ecf20Sopenharmony_ci#define TAR_5   50
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define DSCR_1  100
128c2ecf20Sopenharmony_ci#define DSCR_2  200
138c2ecf20Sopenharmony_ci#define DSCR_3  300
148c2ecf20Sopenharmony_ci#define DSCR_4  400
158c2ecf20Sopenharmony_ci#define DSCR_5  500
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define PPR_1   0x4000000000000         /* or 31,31,31*/
188c2ecf20Sopenharmony_ci#define PPR_2   0x8000000000000         /* or 1,1,1 */
198c2ecf20Sopenharmony_ci#define PPR_3   0xc000000000000         /* or 6,6,6 */
208c2ecf20Sopenharmony_ci#define PPR_4   0x10000000000000        /* or 2,2,2 */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cichar *user_read = "[User Read (Running)]";
238c2ecf20Sopenharmony_cichar *user_write = "[User Write (Running)]";
248c2ecf20Sopenharmony_cichar *ptrace_read_running = "[Ptrace Read (Running)]";
258c2ecf20Sopenharmony_cichar *ptrace_write_running = "[Ptrace Write (Running)]";
268c2ecf20Sopenharmony_cichar *ptrace_read_ckpt = "[Ptrace Read (Checkpointed)]";
278c2ecf20Sopenharmony_cichar *ptrace_write_ckpt = "[Ptrace Write (Checkpointed)]";
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciint validate_tar_registers(unsigned long *reg, unsigned long tar,
308c2ecf20Sopenharmony_ci				unsigned long ppr, unsigned long dscr)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	int match = 1;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	if (reg[0] != tar)
358c2ecf20Sopenharmony_ci		match = 0;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	if (reg[1] != ppr)
388c2ecf20Sopenharmony_ci		match = 0;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	if (reg[2] != dscr)
418c2ecf20Sopenharmony_ci		match = 0;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	if (!match)
448c2ecf20Sopenharmony_ci		return TEST_FAIL;
458c2ecf20Sopenharmony_ci	return TEST_PASS;
468c2ecf20Sopenharmony_ci}
47