xref: /freebsd/sys/amd64/include/pc/bios.h (revision 85227700250277c5ad3dc0fc08ce8e1464eb275d)
1 /*-
2  * Copyright (c) 1997 Michael Smith
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  *      $Id$
27  */
28 
29 /*
30  * Signature structure for the BIOS32 Service Directory header
31  */
32 struct bios32_SDheader
33 {
34     u_int8_t	sig[4];
35     u_int32_t	entry;
36     u_int8_t	revision;
37     u_int8_t	len;
38     u_int8_t	cksum;
39     u_int8_t	pad[5];
40 };
41 
42 /*
43  * BIOS32 Service Directory entry.  Caller supplies name, bios32_SDlookup
44  * fills in the rest of the details.
45  */
46 struct bios32_SDentry
47 {
48     union
49     {
50 	u_int8_t	name[4];	/* service identifier */
51 	u_int32_t	id;		/* as a 32-bit value */
52     } ident;
53     u_int32_t	base;			/* base of service */
54     u_int32_t	len;			/* service length */
55     u_int32_t	entry;			/* entrypoint offset from base */
56 };
57 
58 extern int		bios32_SDlookup(struct bios32_SDentry *ent);
59 extern u_int32_t	bios_sigsearch(u_int32_t start, u_char *sig, int siglen,
60 					 int paralen, int sigofs);
61 
62 /*
63  * Call a 32-bit BIOS function
64  */
65 struct bios32_args {
66     u_long eax;
67     u_long ebx;
68     u_long ecx;
69     u_long edx;
70 };
71 extern void		bios32(caddr_t func_addr, struct bios32_args *args);
72 
73 #define BIOS_PADDRTOVADDR(x)	(((x) - ISA_HOLE_START) + atdevbase)
74 #define BIOS_VADDRTOPADDR(x)	(((x) - atdevbase) + ISA_HOLE_START)
75 
76 
77 /*
78  * System Management BIOS / Desktop Management Interface tables
79  */
80 
81 struct DMI_table
82 {
83     u_int8_t	sig[5];			/* "_DMI_" */
84     u_int8_t	cksum;			/* checksum */
85     u_int16_t	st_size;		/* total length of SMBIOS table (bytes)*/
86     u_int32_t	st_base;		/* base address of the SMBIOS table (physical) */
87     u_int16_t	st_entries;		/* total number of structures present in the table */
88     u_int8_t	bcd_revision;		/* interface revision number */
89     u_int8_t	pad[2];
90 };
91 
92 struct SMBIOS_table
93 {
94     u_int8_t	sig[4];			/* "_SM_" */
95     u_int8_t	cksum;			/* checksum */
96     u_int8_t	len;			/* structure length */
97     u_int8_t	major, minor;		/* major/minor revision numbers */
98     u_int16_t	st_maxsize;		/* largest structure size (bytes) */
99     u_int8_t	revision;		/* entrypoint revision */
100     u_int8_t	pad[5];
101     struct DMI_table dmi;		/* follows immediately */
102 };
103 
104 
105 /*
106  * Exported lookup results
107  */
108 extern struct bios32_SDentry	PCIbios;
109 extern struct SMBIOS_table	*SMBIOS_table;
110 extern struct DMI_table		*DMI_table;
111 
112 
113 
114