162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef	_SPARC_OPENPROMIO_H
362306a36Sopenharmony_ci#define	_SPARC_OPENPROMIO_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/compiler.h>
662306a36Sopenharmony_ci#include <linux/ioctl.h>
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/*
962306a36Sopenharmony_ci * SunOS and Solaris /dev/openprom definitions. The ioctl values
1062306a36Sopenharmony_ci * were chosen to be exactly equal to the SunOS equivalents.
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cistruct openpromio {
1462306a36Sopenharmony_ci	unsigned int oprom_size;	/* Actual size of the oprom_array. */
1562306a36Sopenharmony_ci	char	oprom_array[];		/* Holds property names and values. */
1662306a36Sopenharmony_ci};
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define	OPROMMAXPARAM	4096		/* Maximum size of oprom_array. */
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define	OPROMGETOPT		0x20004F01
2162306a36Sopenharmony_ci#define	OPROMSETOPT		0x20004F02
2262306a36Sopenharmony_ci#define	OPROMNXTOPT		0x20004F03
2362306a36Sopenharmony_ci#define	OPROMSETOPT2		0x20004F04
2462306a36Sopenharmony_ci#define	OPROMNEXT		0x20004F05
2562306a36Sopenharmony_ci#define	OPROMCHILD		0x20004F06
2662306a36Sopenharmony_ci#define	OPROMGETPROP		0x20004F07
2762306a36Sopenharmony_ci#define	OPROMNXTPROP		0x20004F08
2862306a36Sopenharmony_ci#define	OPROMU2P		0x20004F09
2962306a36Sopenharmony_ci#define	OPROMGETCONS		0x20004F0A
3062306a36Sopenharmony_ci#define	OPROMGETFBNAME		0x20004F0B
3162306a36Sopenharmony_ci#define	OPROMGETBOOTARGS	0x20004F0C
3262306a36Sopenharmony_ci/* Linux extensions */				/* Arguments in oprom_array: */
3362306a36Sopenharmony_ci#define OPROMSETCUR		0x20004FF0	/* int node - Sets current node */
3462306a36Sopenharmony_ci#define OPROMPCI2NODE		0x20004FF1	/* int pci_bus, pci_devfn - Sets current node to PCI device's node */
3562306a36Sopenharmony_ci#define OPROMPATH2NODE		0x20004FF2	/* char path[] - Set current node from fully qualified PROM path */
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/*
3862306a36Sopenharmony_ci * Return values from OPROMGETCONS:
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci#define OPROMCONS_NOT_WSCONS    0
4262306a36Sopenharmony_ci#define OPROMCONS_STDIN_IS_KBD  0x1     /* stdin device is kbd */
4362306a36Sopenharmony_ci#define OPROMCONS_STDOUT_IS_FB  0x2     /* stdout is a framebuffer */
4462306a36Sopenharmony_ci#define OPROMCONS_OPENPROM      0x4     /* supports openboot */
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/*
4862306a36Sopenharmony_ci *  NetBSD/OpenBSD /dev/openprom definitions.
4962306a36Sopenharmony_ci */
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cistruct opiocdesc
5262306a36Sopenharmony_ci{
5362306a36Sopenharmony_ci	int	op_nodeid;		/* PROM Node ID (value-result) */
5462306a36Sopenharmony_ci	int	op_namelen;		/* Length of op_name. */
5562306a36Sopenharmony_ci	char	__user *op_name;	/* Pointer to the property name. */
5662306a36Sopenharmony_ci	int	op_buflen;		/* Length of op_buf (value-result) */
5762306a36Sopenharmony_ci	char	__user *op_buf;		/* Pointer to buffer. */
5862306a36Sopenharmony_ci};
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define	OPIOCGET	_IOWR('O', 1, struct opiocdesc)
6162306a36Sopenharmony_ci#define	OPIOCSET	_IOW('O', 2, struct opiocdesc)
6262306a36Sopenharmony_ci#define	OPIOCNEXTPROP	_IOWR('O', 3, struct opiocdesc)
6362306a36Sopenharmony_ci#define	OPIOCGETOPTNODE	_IOR('O', 4, int)
6462306a36Sopenharmony_ci#define	OPIOCGETNEXT	_IOWR('O', 5, int)
6562306a36Sopenharmony_ci#define	OPIOCGETCHILD	_IOWR('O', 6, int)
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#endif /* _SPARC_OPENPROMIO_H */
6862306a36Sopenharmony_ci
69