/*
 * pnph.h -- shared ioctl definitions for the pnp.c verification harness
 * (kernel pnp_harness.c + userland pnphctl.c).
 *
 * Targets: DF-2314, DF-2315 (sys/bus/isa/pnp.c).
 */
#ifndef _PNPH_HARNESS_H
#define _PNPH_HARNESS_H

#include <sys/ioccom.h>
#include <sys/types.h>

#define PNPH_SC_LAYOUT		9	/* print struct isa_config layout */
#define PNPH_SC_2314_WALK	1	/* DF-2314: groomed stack + len-0 ANSI */
#define PNPH_SC_2314_CTRL	2	/* DF-2314: control groom (non-space) */
#define PNPH_SC_2314_SANE	3	/* DF-2314: sanity, normal ANSI string */
#define PNPH_SC_2315_D49	4	/* DF-2315: direct quirk, ic_nport=49 */
#define PNPH_SC_2315_D50	5	/* DF-2315: direct quirk, ic_nport=50 */
#define PNPH_SC_2315_P17	6	/* DF-2315: real pnp_parse_resources, 17 IO tags */
#define PNPH_SC_2315_P18	7	/* DF-2315: real pnp_parse_resources, 18 IO tags */
#define PNPH_SC_2315_PN		8	/* DF-2315: real parse, arg = ntags */

struct pnph_req {
	uint32_t	scenario;
	uint32_t	arg;		/* ntags for PNPH_SC_2315_PN */

	/* out */
	uint32_t	o_rc;
	uint32_t	o_tries;	/* DF-2314: groom phases tried */
	uint32_t	o_desc_len;	/* strlen(captured desc) */
	char		o_desc[224];	/* captured device desc bytes */
	uint64_t	o_nul_off;	/* groom-pad offset of OOB NUL write */
	uint64_t	o_nul_addr;	/* KVA of the OOB NUL write */
	uint64_t	o_pad_lo, o_pad_hi;	/* groom pad KVA range */
	uint32_t	o_nul_found;	/* count of {0x12 -> 0x00} pad diffs */

	/* DF-2315: isa_config before / after (direct + parse) */
	uint32_t	o_nport0, o_nportF;
	uint32_t	o_irqmask0[2], o_drqmask0[2], o_cnt0[4];
	uint32_t	o_irqmaskF[2], o_drqmaskF[2], o_cntF[4];
	uint32_t	o_alloc_size;	/* configs alloc size (parse path) */
	uint32_t	o_max_index;	/* max ic_port[] index written */
	uint32_t	o_max_off;	/* byte offset of that write in configs */

	char		o_child[32];	/* nameunit of created isa child */
};

#define PNPHIOC_RUN	_IOWR('P', 1, struct pnph_req)

#endif /* !_PNPH_HARNESS_H */
