• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
4  *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
5  *
6  *   Permission is hereby granted, free of charge, to any person
7  *   obtaining a copy of this software and associated documentation
8  *   files (the "Software"), to deal in the Software without
9  *   restriction, including without limitation the rights to use,
10  *   copy, modify, merge, publish, distribute, sublicense, and/or
11  *   sell copies of the Software, and to permit persons to whom
12  *   the Software is furnished to do so, subject to the following
13  *   conditions:
14  *
15  *   The above copyright notice and this permission notice shall
16  *   be included in all copies or substantial portions of the Software.
17  *
18  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20  *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22  *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  *   OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * ----------------------------------------------------------------------- */
28 
29 /*
30  * syslinux/config.h
31  *
32  * Query syslinux configuration information.
33  */
34 
35 #ifndef _SYSLINUX_CONFIG_H
36 #define _SYSLINUX_CONFIG_H
37 
38 #include <stdint.h>
39 #include <com32.h>
40 
41 enum syslinux_filesystem {
42     SYSLINUX_FS_UNKNOWN  = 0x30,
43     SYSLINUX_FS_SYSLINUX = 0x31,
44     SYSLINUX_FS_PXELINUX = 0x32,
45     SYSLINUX_FS_ISOLINUX = 0x33,
46     SYSLINUX_FS_EXTLINUX = 0x34,
47 };
48 
49 struct syslinux_version {
50     uint16_t version;		/* (major << 8)+minor */
51     uint16_t max_api;
52     enum syslinux_filesystem filesystem;
53     const char *version_string;
54     const char *copyright_string;
55 };
56 
57 struct syslinux_ipinfo {
58     uint32_t ipver;
59     uint32_t myip;
60     uint32_t serverip;
61     uint32_t gateway;
62     uint32_t netmask;
63 };
64 
65 extern __nocommon struct syslinux_version __syslinux_version;
syslinux_version(void)66 static inline const struct syslinux_version *syslinux_version(void)
67 {
68     return &__syslinux_version;
69 }
70 
71 union syslinux_derivative_info {
72     struct {
73 	com32sys_t r;
74 	const void *esbx;
75 	const void *fssi;
76 	const void *gsdi;
77     } rr;			/* real raw */
78     struct {
79 	uint16_t _pad1[4];
80 	uint32_t _pad2[7];
81 	uint8_t filesystem;
82 	uint8_t ah;
83 	uint16_t axh;
84     } c;			/* common */
85     struct {
86 	uint16_t gs;
87 	uint16_t fs;
88 	uint16_t es;
89 	uint16_t ds;
90 	uint16_t di, dih;
91 	uint16_t si, sih;
92 	uint16_t bp, bph;
93 	uint16_t sp, sph;
94 	uint16_t bx, bxh;
95 	uint16_t dx, dxh;
96 	uint16_t cx, cxh;
97 	uint16_t ax, axh;
98 	uint32_t eflags;
99 	const void *esbx;
100 	const void *fssi;
101 	const void *gsdi;
102     } r;			/* raw */
103     struct {
104 	uint16_t _gs, _fs, _es, _ds;
105 	uint32_t _edi, _esi, _ebp, _esp, _ebx;
106 	uint8_t drive_number, dh;
107 	uint16_t _dxh;
108 	uint8_t sector_shift, ch;
109 	uint16_t _cxh;
110 	uint8_t filesystem, ah;
111 	uint16_t _axh;
112 	uint32_t _eflags;
113 	const void *ptab_ptr;
114 	const uint32_t *esdi_ptr;
115 	const uint64_t *partoffset;
116     } disk;			/* syslinux/extlinux */
117     struct {
118 	uint16_t _gs, stack_seg, pxenv_seg, _ds;
119 	uint32_t _edi, stack_offs, _ebp, _esp, pxenv_offs;
120 	uint16_t apiver;
121 	uint16_t _dxh;
122 	uint32_t myip;
123 	uint8_t filesystem, ah;
124 	uint16_t _axh;
125 	uint32_t _eflags;
126 	const void *pxenvptr;
127 	const void *stack;
128 	const struct syslinux_ipinfo *ipinfo;
129     } pxe;			/* pxelinux */
130     struct {
131 	uint16_t _gs, _fs, _es, _ds;
132 	uint32_t _edi, _esi, _ebp, _esp, _ebx;
133 	uint8_t drive_number, dh;
134 	uint16_t _dxh;
135 	uint8_t sector_shift, cd_mode;
136 	uint16_t _cxh;
137 	uint8_t filesystem, ah;
138 	uint16_t _axh;
139 	uint32_t _eflags;
140 	const void *spec_packet;
141 	const uint32_t *esdi_ptr;
142 	const uint64_t *partoffset;
143     } iso;			/* isolinux */
144 };
145 
146 extern __nocommon union syslinux_derivative_info __syslinux_derivative_info;
147 static inline const union syslinux_derivative_info
syslinux_derivative_info(void)148     *syslinux_derivative_info(void)
149 {
150     return &__syslinux_derivative_info;
151 }
152 
153 struct syslinux_serial_console_info {
154     uint16_t iobase;
155     uint16_t divisor;
156     uint16_t flowctl;
157 };
158 
159 extern void __syslinux_set_serial_console_info(void);
160 
161 extern __nocommon struct syslinux_serial_console_info
162     __syslinux_serial_console_info;
163 static inline const struct syslinux_serial_console_info
syslinux_serial_console_info(void)164     *syslinux_serial_console_info(void)
165 {
166     return &__syslinux_serial_console_info;
167 }
168 
169 extern char ConfigName[];
syslinux_config_file(void)170 static inline const char *syslinux_config_file(void)
171 {
172     return ConfigName;
173 }
174 
175 struct syslinux_ipappend_strings {
176     int count;
177     const char *const *ptr;
178 };
179 extern __nocommon struct syslinux_ipappend_strings __syslinux_ipappend_strings;
180 static inline const struct syslinux_ipappend_strings
syslinux_ipappend_strings(void)181     *syslinux_ipappend_strings(void)
182 {
183     return &__syslinux_ipappend_strings;
184 }
185 
syslinux_filesystem(void)186 static inline enum syslinux_filesystem syslinux_filesystem(void)
187 {
188     return syslinux_derivative_info()->c.filesystem;
189 }
190 
191 extern void get_derivative_info(union syslinux_derivative_info *di);
192 
193 #endif /* _SYSLINUX_CONFIG_H */
194