1109412Smdodd/*-
2109412Smdodd * Copyright (c) 2003 Matthew N. Dodd <winter@freebsd.org>
3109412Smdodd * All rights reserved.
4109412Smdodd *
5109412Smdodd * Redistribution and use in source and binary forms, with or without
6109412Smdodd * modification, are permitted provided that the following conditions
7109412Smdodd * are met:
8109412Smdodd * 1. Redistributions of source code must retain the above copyright
9109412Smdodd *    notice, this list of conditions and the following disclaimer.
10109412Smdodd * 2. Redistributions in binary form must reproduce the above copyright
11109412Smdodd *    notice, this list of conditions and the following disclaimer in the
12109412Smdodd *    documentation and/or other materials provided with the distribution.
13109412Smdodd *
14109412Smdodd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15109412Smdodd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16109412Smdodd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17109412Smdodd * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18109412Smdodd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19109412Smdodd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20109412Smdodd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21109412Smdodd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22109412Smdodd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23109412Smdodd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24109412Smdodd * SUCH DAMAGE.
25109412Smdodd *
26109412Smdodd * $FreeBSD$
27109412Smdodd */
28109412Smdodd
29109412Smdodd#ifndef _MACHINE_SMAPI_H_
30109412Smdodd#define	_MACHINE_SMAPI_H_
31109412Smdodd
32109412Smdodd#ifndef _KERNEL
33109412Smdodd#include <sys/types.h>
34109412Smdodd#endif
35109412Smdodd#include <sys/ioccom.h>
36109412Smdodd
37109412Smdoddstruct smapi_bios_header {
38109412Smdodd	u_int8_t	signature[4];	/* '$SMB' */
39109412Smdodd	u_int8_t	version_major;
40109412Smdodd	u_int8_t	version_minor;
41109412Smdodd	u_int8_t	length;
42109412Smdodd	u_int8_t	checksum;
43109412Smdodd	u_int16_t	information;
44109412Smdodd#define	SMAPI_REAL_VM86		0x0001
45109412Smdodd#define	SMAPI_PROT_16BIT	0x0002
46109412Smdodd#define	SMAPI_PROT_32BIT	0x0004
47109412Smdodd	u_int16_t	reserved1;
48109412Smdodd
49109412Smdodd	u_int16_t	real16_offset;
50109412Smdodd	u_int16_t	real16_segment;
51109412Smdodd
52109412Smdodd	u_int16_t	reserved2;
53109412Smdodd
54109412Smdodd	u_int16_t	prot16_offset;
55109412Smdodd	u_int32_t	prot16_segment;
56109412Smdodd
57109412Smdodd	u_int32_t	prot32_offset;
58109412Smdodd	u_int32_t	prot32_segment;
59109412Smdodd
60112558Smdodd} __packed;
61109412Smdodd
62109412Smdoddstruct smapi_bios_parameter {
63109412Smdodd	union {
64109412Smdodd		struct {
65109412Smdodd			u_int8_t func;
66109412Smdodd			u_int8_t sub_func;
67109412Smdodd		} in;
68109412Smdodd		struct {
69109412Smdodd			u_int8_t rc;
70109412Smdodd			u_int8_t sub_rc;
71109412Smdodd		} out;
72109412Smdodd	} type;
73109412Smdodd
74109412Smdodd	u_int16_t	param1;
75109412Smdodd	u_int16_t	param2;
76109412Smdodd	u_int16_t	param3;
77109412Smdodd
78109412Smdodd	u_int32_t	param4;
79109412Smdodd	u_int32_t	param5;
80109412Smdodd
81112558Smdodd} __packed;
82109412Smdodd
83109412Smdodd#define	cmd_func	type.in.func
84109412Smdodd#define	cmd_sub_func	type.in.sub_func
85109412Smdodd#define	rsp_rc		type.out.rc
86109412Smdodd#define	rsp_sub_rc	type.out.sub_rc
87109412Smdodd
88109412Smdodd#define	SMAPIOGHEADER		_IOR('$', 0, struct smapi_bios_header)
89109412Smdodd#define SMAPIOCGFUNCTION	_IOWR('$', 1, struct smapi_bios_parameter)
90109412Smdodd
91109412Smdodd#endif	/* _MACHINE_SMAPI_H_ */
92