xref: /freebsd-src/sys/i386/include/smapi.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
17534ac7aSMatthew N. Dodd /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
383ef78beSPedro F. Giffuni  *
47534ac7aSMatthew N. Dodd  * Copyright (c) 2003 Matthew N. Dodd <winter@freebsd.org>
57534ac7aSMatthew N. Dodd  * All rights reserved.
67534ac7aSMatthew N. Dodd  *
77534ac7aSMatthew N. Dodd  * Redistribution and use in source and binary forms, with or without
87534ac7aSMatthew N. Dodd  * modification, are permitted provided that the following conditions
97534ac7aSMatthew N. Dodd  * are met:
107534ac7aSMatthew N. Dodd  * 1. Redistributions of source code must retain the above copyright
117534ac7aSMatthew N. Dodd  *    notice, this list of conditions and the following disclaimer.
127534ac7aSMatthew N. Dodd  * 2. Redistributions in binary form must reproduce the above copyright
137534ac7aSMatthew N. Dodd  *    notice, this list of conditions and the following disclaimer in the
147534ac7aSMatthew N. Dodd  *    documentation and/or other materials provided with the distribution.
157534ac7aSMatthew N. Dodd  *
167534ac7aSMatthew N. Dodd  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
177534ac7aSMatthew N. Dodd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
187534ac7aSMatthew N. Dodd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
197534ac7aSMatthew N. Dodd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
207534ac7aSMatthew N. Dodd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
217534ac7aSMatthew N. Dodd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
227534ac7aSMatthew N. Dodd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
237534ac7aSMatthew N. Dodd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
247534ac7aSMatthew N. Dodd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
257534ac7aSMatthew N. Dodd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
267534ac7aSMatthew N. Dodd  * SUCH DAMAGE.
277534ac7aSMatthew N. Dodd  */
287534ac7aSMatthew N. Dodd 
297534ac7aSMatthew N. Dodd #ifndef _MACHINE_SMAPI_H_
307534ac7aSMatthew N. Dodd #define	_MACHINE_SMAPI_H_
317534ac7aSMatthew N. Dodd 
327534ac7aSMatthew N. Dodd #ifndef _KERNEL
337534ac7aSMatthew N. Dodd #include <sys/types.h>
347534ac7aSMatthew N. Dodd #endif
357534ac7aSMatthew N. Dodd #include <sys/ioccom.h>
367534ac7aSMatthew N. Dodd 
377534ac7aSMatthew N. Dodd struct smapi_bios_header {
387534ac7aSMatthew N. Dodd 	u_int8_t	signature[4];	/* '$SMB' */
397534ac7aSMatthew N. Dodd 	u_int8_t	version_major;
407534ac7aSMatthew N. Dodd 	u_int8_t	version_minor;
417534ac7aSMatthew N. Dodd 	u_int8_t	length;
427534ac7aSMatthew N. Dodd 	u_int8_t	checksum;
437534ac7aSMatthew N. Dodd 	u_int16_t	information;
447534ac7aSMatthew N. Dodd #define	SMAPI_REAL_VM86		0x0001
457534ac7aSMatthew N. Dodd #define	SMAPI_PROT_16BIT	0x0002
467534ac7aSMatthew N. Dodd #define	SMAPI_PROT_32BIT	0x0004
477534ac7aSMatthew N. Dodd 	u_int16_t	reserved1;
487534ac7aSMatthew N. Dodd 
497534ac7aSMatthew N. Dodd 	u_int16_t	real16_offset;
507534ac7aSMatthew N. Dodd 	u_int16_t	real16_segment;
517534ac7aSMatthew N. Dodd 
527534ac7aSMatthew N. Dodd 	u_int16_t	reserved2;
537534ac7aSMatthew N. Dodd 
547534ac7aSMatthew N. Dodd 	u_int16_t	prot16_offset;
557534ac7aSMatthew N. Dodd 	u_int32_t	prot16_segment;
567534ac7aSMatthew N. Dodd 
577534ac7aSMatthew N. Dodd 	u_int32_t	prot32_offset;
587534ac7aSMatthew N. Dodd 	u_int32_t	prot32_segment;
597534ac7aSMatthew N. Dodd 
601352a542SMatthew N. Dodd } __packed;
617534ac7aSMatthew N. Dodd 
627534ac7aSMatthew N. Dodd struct smapi_bios_parameter {
637534ac7aSMatthew N. Dodd 	union {
647534ac7aSMatthew N. Dodd 		struct {
657534ac7aSMatthew N. Dodd 			u_int8_t func;
667534ac7aSMatthew N. Dodd 			u_int8_t sub_func;
677534ac7aSMatthew N. Dodd 		} in;
687534ac7aSMatthew N. Dodd 		struct {
697534ac7aSMatthew N. Dodd 			u_int8_t rc;
707534ac7aSMatthew N. Dodd 			u_int8_t sub_rc;
717534ac7aSMatthew N. Dodd 		} out;
727534ac7aSMatthew N. Dodd 	} type;
737534ac7aSMatthew N. Dodd 
747534ac7aSMatthew N. Dodd 	u_int16_t	param1;
757534ac7aSMatthew N. Dodd 	u_int16_t	param2;
767534ac7aSMatthew N. Dodd 	u_int16_t	param3;
777534ac7aSMatthew N. Dodd 
787534ac7aSMatthew N. Dodd 	u_int32_t	param4;
797534ac7aSMatthew N. Dodd 	u_int32_t	param5;
807534ac7aSMatthew N. Dodd 
811352a542SMatthew N. Dodd } __packed;
827534ac7aSMatthew N. Dodd 
837534ac7aSMatthew N. Dodd #define	cmd_func	type.in.func
847534ac7aSMatthew N. Dodd #define	cmd_sub_func	type.in.sub_func
857534ac7aSMatthew N. Dodd #define	rsp_rc		type.out.rc
867534ac7aSMatthew N. Dodd #define	rsp_sub_rc	type.out.sub_rc
877534ac7aSMatthew N. Dodd 
887534ac7aSMatthew N. Dodd #define	SMAPIOGHEADER		_IOR('$', 0, struct smapi_bios_header)
897534ac7aSMatthew N. Dodd #define SMAPIOCGFUNCTION	_IOWR('$', 1, struct smapi_bios_parameter)
907534ac7aSMatthew N. Dodd 
917534ac7aSMatthew N. Dodd #endif	/* _MACHINE_SMAPI_H_ */
92