1f50a7f3dSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
23752e453SMichael Ellerman /*
33752e453SMichael Ellerman  * Copyright 2014, Michael Ellerman, IBM Corp.
43752e453SMichael Ellerman  */
53752e453SMichael Ellerman 
63752e453SMichael Ellerman #ifndef __SELFTESTS_POWERPC_PMU_LIB_H
73752e453SMichael Ellerman #define __SELFTESTS_POWERPC_PMU_LIB_H
83752e453SMichael Ellerman 
9c9938a9dSMichael Ellerman #include <stdbool.h>
103752e453SMichael Ellerman #include <stdio.h>
113752e453SMichael Ellerman #include <stdint.h>
123752e453SMichael Ellerman #include <string.h>
133752e453SMichael Ellerman #include <unistd.h>
143752e453SMichael Ellerman 
153752e453SMichael Ellerman union pipe {
163752e453SMichael Ellerman 	struct {
173752e453SMichael Ellerman 		int read_fd;
183752e453SMichael Ellerman 		int write_fd;
193752e453SMichael Ellerman 	};
203752e453SMichael Ellerman 	int fds[2];
213752e453SMichael Ellerman };
223752e453SMichael Ellerman 
233752e453SMichael Ellerman extern int kill_child_and_wait(pid_t child_pid);
243752e453SMichael Ellerman extern int wait_for_child(pid_t child_pid);
253752e453SMichael Ellerman extern int sync_with_child(union pipe read_pipe, union pipe write_pipe);
263752e453SMichael Ellerman extern int wait_for_parent(union pipe read_pipe);
273752e453SMichael Ellerman extern int notify_parent(union pipe write_pipe);
283752e453SMichael Ellerman extern int notify_parent_of_error(union pipe write_pipe);
293752e453SMichael Ellerman extern pid_t eat_cpu(int (test_function)(void));
303752e453SMichael Ellerman extern bool require_paranoia_below(int level);
313752e453SMichael Ellerman 
323752e453SMichael Ellerman struct addr_range {
333752e453SMichael Ellerman 	uint64_t first, last;
343752e453SMichael Ellerman };
353752e453SMichael Ellerman 
363752e453SMichael Ellerman extern struct addr_range libc, vdso;
373752e453SMichael Ellerman 
383752e453SMichael Ellerman int parse_proc_maps(void);
393752e453SMichael Ellerman 
403752e453SMichael Ellerman #endif /* __SELFTESTS_POWERPC_PMU_LIB_H */
41