xref: /dflybsd-src/sys/platform/pc64/include/pc/bios.h (revision 22cef96dd9d10712636404d29176c08f8f6cb215)
1c8fe38aeSMatthew Dillon /*-
2c8fe38aeSMatthew Dillon  * Copyright (c) 1997 Michael Smith
3c8fe38aeSMatthew Dillon  * Copyright (c) 1998 Jonathan Lemon
4c8fe38aeSMatthew Dillon  * Copyright (c) 2008 The DragonFly Project.
5c8fe38aeSMatthew Dillon  * All rights reserved.
6c8fe38aeSMatthew Dillon  *
7c8fe38aeSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
8c8fe38aeSMatthew Dillon  * modification, are permitted provided that the following conditions
9c8fe38aeSMatthew Dillon  * are met:
10c8fe38aeSMatthew Dillon  * 1. Redistributions of source code must retain the above copyright
11c8fe38aeSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
12c8fe38aeSMatthew Dillon  * 2. Redistributions in binary form must reproduce the above copyright
13c8fe38aeSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in the
14c8fe38aeSMatthew Dillon  *    documentation and/or other materials provided with the distribution.
15c8fe38aeSMatthew Dillon  *
16c8fe38aeSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17c8fe38aeSMatthew Dillon  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18c8fe38aeSMatthew Dillon  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19c8fe38aeSMatthew Dillon  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20c8fe38aeSMatthew Dillon  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21c8fe38aeSMatthew Dillon  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22c8fe38aeSMatthew Dillon  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23c8fe38aeSMatthew Dillon  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24c8fe38aeSMatthew Dillon  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25c8fe38aeSMatthew Dillon  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26c8fe38aeSMatthew Dillon  * SUCH DAMAGE.
27c8fe38aeSMatthew Dillon  *
28c8fe38aeSMatthew Dillon  * $FreeBSD$
29c8fe38aeSMatthew Dillon  */
30c8fe38aeSMatthew Dillon 
31c8fe38aeSMatthew Dillon #ifndef _MACHINE_PC_BIOS_H_
32c8fe38aeSMatthew Dillon #define _MACHINE_PC_BIOS_H_
33c8fe38aeSMatthew Dillon 
34*22cef96dSSascha Wildner uint32_t	bios_sigsearch(uint32_t, unsigned char *, int, int, int);
35c8fe38aeSMatthew Dillon 
36c8fe38aeSMatthew Dillon #define BIOS_PADDRTOVADDR(x)	((x) + KERNBASE)
37c8fe38aeSMatthew Dillon #define BIOS_VADDRTOPADDR(x)	((x) - KERNBASE)
38c8fe38aeSMatthew Dillon 
39c8fe38aeSMatthew Dillon /*
40c8fe38aeSMatthew Dillon  * Int 15:E820 'SMAP' structure
41c8fe38aeSMatthew Dillon  */
42c8fe38aeSMatthew Dillon 
43c8fe38aeSMatthew Dillon #define SMAP_SIG	0x534D4150			/* 'SMAP' */
44c8fe38aeSMatthew Dillon 
45c8fe38aeSMatthew Dillon #define	SMAP_TYPE_MEMORY	1
46c8fe38aeSMatthew Dillon 
47c8fe38aeSMatthew Dillon struct bios_smap {
48*22cef96dSSascha Wildner     uint64_t	base;
49*22cef96dSSascha Wildner     uint64_t	length;
50*22cef96dSSascha Wildner     uint32_t	type;
51c8fe38aeSMatthew Dillon } __packed;
52c8fe38aeSMatthew Dillon 
5353a374c1SSascha Wildner /*
5453a374c1SSascha Wildner  * System Management BIOS
5553a374c1SSascha Wildner  */
5653a374c1SSascha Wildner #define	SMBIOS_START	0xf0000
5753a374c1SSascha Wildner #define	SMBIOS_STEP	0x10
5853a374c1SSascha Wildner #define	SMBIOS_OFF	0
5953a374c1SSascha Wildner #define	SMBIOS_LEN	4
6053a374c1SSascha Wildner #define	SMBIOS_SIG	"_SM_"
6153a374c1SSascha Wildner 
6253a374c1SSascha Wildner struct smbios_eps {
6353a374c1SSascha Wildner 	uint8_t		anchor_string[4];		/* '_SM_' */
6453a374c1SSascha Wildner 	uint8_t		checksum;
6553a374c1SSascha Wildner 	uint8_t		length;
6653a374c1SSascha Wildner 	uint8_t		major_version;
6753a374c1SSascha Wildner 	uint8_t		minor_version;
6853a374c1SSascha Wildner 	uint16_t	maximum_structure_size;
6953a374c1SSascha Wildner 	uint8_t		entry_point_revision;
7053a374c1SSascha Wildner 	uint8_t		formatted_area[5];
7153a374c1SSascha Wildner 	uint8_t		intermediate_anchor_string[5];	/* '_DMI_' */
7253a374c1SSascha Wildner 	uint8_t		intermediate_checksum;
7353a374c1SSascha Wildner 	uint16_t	structure_table_length;
7453a374c1SSascha Wildner 	uint32_t	structure_table_address;
7553a374c1SSascha Wildner 	uint16_t	number_structures;
7653a374c1SSascha Wildner 	uint8_t		BCD_revision;
7753a374c1SSascha Wildner };
7853a374c1SSascha Wildner 
7953a374c1SSascha Wildner struct smbios_structure_header {
8053a374c1SSascha Wildner 	uint8_t		type;
8153a374c1SSascha Wildner 	uint8_t		length;
8253a374c1SSascha Wildner 	uint16_t	handle;
8353a374c1SSascha Wildner };
84c8fe38aeSMatthew Dillon 
85c8fe38aeSMatthew Dillon #endif /* _MACHINE_PC_BIOS_H_ */
86