5 * Standard includes that we always want
15 * IMPORTANT!!!!!!!!!!!!!!
17 * Everything below this point is cruft left over from older versions
18 * of Etherboot. Do not add *anything* below this point. Things are
19 * gradually being moved to individual header files.
28 #define BOOT_FIRST BOOT_NIC
31 #define BOOT_SECOND BOOT_NOTHING
34 #define BOOT_THIRD BOOT_NOTHING
37 #define DEFAULT_BOOT_ORDER ( \
38 (BOOT_FIRST << (0*BOOT_BITS)) | \
39 (BOOT_SECOND << (1*BOOT_BITS)) | \
40 (BOOT_THIRD << (2*BOOT_BITS)) | \
41 (BOOT_NOTHING << (3*BOOT_BITS)) | \
45 #define DEFAULT_BOOT_INDEX BOOT_INDEX
47 #define DEFAULT_BOOT_INDEX 0
50 #if !defined(TAGGED_IMAGE) && !defined(AOUT_IMAGE) && !defined(ELF_IMAGE) && !defined(ELF64_IMAGE) && !defined(COFF_IMAGE) && !defined(RAW_IMAGE)
51 #define TAGGED_IMAGE /* choose at least one */
55 #define K_EOF '\04' /* Ctrl-D */
56 #define K_INTR '\03' /* Ctrl-C */
58 /* Edit this to change the path to hostspecific kernel image
59 kernel.<client_ip_address> in RARP boot */
60 #ifndef DEFAULT_KERNELPATH
61 #define DEFAULT_KERNELPATH "/tftpboot/kernel.%@"
65 #undef DEFAULT_BOOTFILE
66 #ifndef PXENFSROOTPATH
67 #define PXENFSROOTPATH ""
69 #define DEFAULT_BOOTFILE PXENFSROOTPATH "/boot/pxeboot"
72 #ifndef MAX_TFTP_RETRIES
73 #define MAX_TFTP_RETRIES 20
76 #ifndef MAX_BOOTP_RETRIES
77 #define MAX_BOOTP_RETRIES 20
80 #define MAX_BOOTP_EXTLEN (ETH_MAX_MTU-sizeof(struct bootpip_t))
82 #ifndef MAX_ARP_RETRIES
83 #define MAX_ARP_RETRIES 20
86 #ifndef MAX_RPC_RETRIES
87 #define MAX_RPC_RETRIES 20
90 /* Link configuration time in tenths of a second */
91 #ifndef VALID_LINK_TIMEOUT
92 #define VALID_LINK_TIMEOUT 100 /* 10.0 seconds */
95 /* Inter-packet retry in ticks */
97 #define TIMEOUT (10*TICKS_PER_SEC)
100 #ifndef BOOTP_TIMEOUT
101 #define BOOTP_TIMEOUT (2*TICKS_PER_SEC)
104 /* Max interval between IGMP packets */
105 #define IGMP_INTERVAL (10*TICKS_PER_SEC)
106 #define IGMPv1_ROUTER_PRESENT_TIMEOUT (400*TICKS_PER_SEC)
108 /* These settings have sense only if compiled with -DCONGESTED */
109 /* total retransmission timeout in ticks */
110 #define TFTP_TIMEOUT (30*TICKS_PER_SEC)
111 /* packet retransmission timeout in ticks */
113 #define TFTP_REXMT (3*TICKS_PER_SEC)
115 #define TFTP_REXMT TIMEOUT
119 #define NULL ((void *)0)
122 #include "if_ether.h"
125 ARP_CLIENT, ARP_SERVER, ARP_GATEWAY,
133 #define RARP_REQUEST 3
139 /* Helper macros used to identify when DHCP options are valid/invalid in/outside of encapsulation */
140 #define NON_ENCAP_OPT in_encapsulated_options == 0 &&
141 #ifdef ALLOW_ONLY_ENCAPSULATED
142 #define ENCAP_OPT in_encapsulated_options == 1 &&
158 struct in_addr ipaddr;
162 #define KERNEL_BUF (bootp_data.bootp_reply.bp_file)
164 #define FLOPPY_BOOT_LOCATION 0x7c00
167 unsigned short rom_segment;
168 unsigned short rom_length;
171 extern inline int rom_address_ok(struct rom_info *rom, int assigned_rom_segment)
173 return (assigned_rom_segment < 0xC000
174 || assigned_rom_segment == rom->rom_segment);
177 /* Define a type for passing info to a loaded program */
179 uint8_t major, minor; /* Version */
180 uint16_t flags; /* Bit flags */
183 /***************************************************************************
185 ***************************************************************************/
189 extern char as_main_program;
191 extern void rx_qdrain P((void));
192 extern int ip_transmit P((int len, const void *buf));
193 extern void build_ip_hdr P((unsigned long destip, int ttl, int protocol,
194 int option_len, int len, const void *buf));
195 extern void build_udp_hdr P((unsigned long destip,
196 unsigned int srcsock, unsigned int destsock, int ttl,
197 int len, const void *buf));
198 extern int udp_transmit P((unsigned long destip, unsigned int srcsock,
199 unsigned int destsock, int len, const void *buf));
200 extern int tcp_transmit(unsigned long destip, unsigned int srcsock,
201 unsigned int destsock, long send_seq, long recv_seq,
202 int window, int flags, int len, const void *buf);
203 int tcp_reset(struct iphdr *ip);
204 typedef int (*reply_t)(int ival, void *ptr, unsigned short ptype, struct iphdr *ip, struct udphdr *udp, struct tcphdr *tcp);
205 extern int await_reply P((reply_t reply, int ival, void *ptr, long timeout));
206 extern int decode_rfc1533 P((unsigned char *, unsigned int, unsigned int, int));
207 #define RAND_MAX 2147483647L
208 extern uint16_t ipchksum P((const void *ip, unsigned long len));
209 extern uint16_t add_ipchksums P((unsigned long offset, uint16_t sum, uint16_t new));
210 extern int32_t random P((void));
211 extern long rfc2131_sleep_interval P((long base, int exp));
212 extern void cleanup P((void));
215 /* Be careful with sector_t it is an unsigned long long on x86 */
216 typedef uint64_t sector_t;
217 typedef sector_t (*os_download_t)(unsigned char *data, unsigned int len, int eof);
218 extern os_download_t probe_image(unsigned char *data, unsigned int len);
219 extern int load_block P((unsigned char *, unsigned int, unsigned int, int ));
222 extern void twiddle P((void));
223 extern void sleep P((int secs));
224 extern void interruptible_sleep P((int secs));
225 extern void poll_interruptions P((void));
226 extern int strcasecmp P((const char *a, const char *b));
227 extern char *substr P((const char *a, const char *b));
229 extern unsigned long get_boot_order(unsigned long order, unsigned *index);
230 extern void disk_init P((void));
231 extern unsigned int pcbios_disk_read P((int drv,int c,int h,int s,char *buf));
234 struct os_entry_regs {
235 /* Be careful changing this structure
236 * as it is used by assembly language code.
238 uint32_t edi; /* 0 */
239 uint32_t esi; /* 4 */
240 uint32_t ebp; /* 8 */
241 uint32_t esp; /* 12 */
242 uint32_t ebx; /* 16 */
243 uint32_t edx; /* 20 */
244 uint32_t ecx; /* 24 */
245 uint32_t eax; /* 28 */
247 uint32_t saved_ebp; /* 32 */
248 uint32_t saved_esi; /* 36 */
249 uint32_t saved_edi; /* 40 */
250 uint32_t saved_ebx; /* 44 */
251 uint32_t saved_eip; /* 48 */
252 uint32_t saved_esp; /* 52 */
255 /* Be careful changing this structure
256 * as it is used by assembly language code.
258 uint32_t edi; /* 0 */
259 uint32_t esi; /* 4 */
260 uint32_t ebp; /* 8 */
261 uint32_t esp; /* 12 */
262 uint32_t ebx; /* 16 */
263 uint32_t edx; /* 20 */
264 uint32_t ecx; /* 24 */
265 uint32_t eax; /* 28 */
267 extern struct os_entry_regs os_regs;
268 extern struct regs initial_regs;
269 extern int xstart32(unsigned long entry_point, ...);
270 extern int xstart_lm(unsigned long entry_point, unsigned long params);
271 extern void xend32 P((void));
272 struct Elf_Bhdr *prepare_boot_params(void *header);
273 extern int elf_start(unsigned long machine, unsigned long entry, unsigned long params);
274 extern unsigned long currticks P((void));
275 extern void exit P((int status));
278 /***************************************************************************
280 ***************************************************************************/
282 extern struct rom_info rom;
283 extern char *hostname;
284 extern int hostnamelen;
285 extern unsigned char *addparam;
286 extern int addparamlen;
287 extern jmp_buf restart_etherboot;
289 extern struct arptable_t arptable[MAX_ARP];
291 extern int menutmo,menudefault;
292 extern unsigned char *defparams;
293 extern int defparams_max;
296 extern unsigned char *motd[RFC1533_VENDOR_NUMOFMOTD];
298 extern struct bootpd_t bootp_data;
299 #define BOOTP_DATA_ADDR (&bootp_data)
300 extern unsigned char *end_of_rfc1533;
302 extern int freebsd_howto;
303 #define FREEBSD_KERNEL_ENV_SIZE 256
304 extern char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE];
314 #endif /* ETHERBOOT_H */