⬢ DragonFlyBSD Kernel Audit
DF-2343 / umcsh.h
← back to finding ↓ download raw
/*-
 * umcsh.h -- shared ABI for the umcs.c verification harness
 * (DF-2343 / DF-2344).  Kernel side: umcs_harness.c; userland side:
 * umcshctl.c.
 */
#ifndef _UMCSH_H_
#define	_UMCSH_H_

#include <sys/ioccom.h>

#define	UMCSH_IOC		_IOWR('U', 1, struct umcsh_req)

/* scenarios */
#define	UMCSH_SC_LAYOUT		1	/* structure + divisor array layout */
#define	UMCSH_SC_CALC		2	/* arg = rate; arg2&1 = allow rate==0 */
#define	UMCSH_SC_PREPARAM	3	/* arg = c_ospeed to feed pre_param */
#define	UMCSH_SC_ATTACH		4	/* arg = gpio/poison; arg2 = flags */
#define	UMCSH_SC_DETACH		5
#define	UMCSH_SC_SEED_ITIN	6	/* arg = speed; arg2 selects it_in/out */
#define	UMCSH_SC_STATUS		7

/* ATTACH flags (arg2) */
#define	UMCSH_AT_GPIOFAIL	0x1	/* GPIO control transfer fails */
#define	UMCSH_AT_GROOM		0x2	/* pre-poison stack with byte arg */
#define	UMCSH_AT_MODEFAIL	0x4	/* MODE control transfer fails */

/* SEED targets (arg2) */
#define	UMCSH_SEED_IN		0
#define	UMCSH_SEED_OUT		1
#define	UMCSH_SEED_BOTH		2

struct umcsh_req {
	uint32_t	scenario;
	uint32_t	arg;
	uint32_t	arg2;

	/* outputs */
	uint32_t	r_rc;		/* return code / errno of the call */
	uint32_t	r_numports;	/* sc->sc_numports after attach */
	uint32_t	r_divisor;	/* calc_baudrate out */
	uint32_t	r_clk;		/* calc_baudrate out */
	uint32_t	r_attached;	/* harness attach state after */
	uint32_t	r_rd_cnt;	/* simulated control reads */
	uint32_t	r_wr_cnt;	/* simulated control writes */
	uint32_t	r_oob_dword;	/* divisors[9] (instrumentation) */
	char		r_msg[128];
};

#endif /* _UMCSH_H_ */