5 * Standard includes that we always want
16 * IMPORTANT!!!!!!!!!!!!!!
18 * Everything below this point is cruft left over from older versions
19 * of Etherboot. Do not add *anything* below this point. Things are
20 * gradually being moved to individual header files.
29 #define BOOT_FIRST BOOT_NIC
32 #define BOOT_SECOND BOOT_NOTHING
35 #define BOOT_THIRD BOOT_NOTHING
38 #define DEFAULT_BOOT_ORDER ( \
39 (BOOT_FIRST << (0*BOOT_BITS)) | \
40 (BOOT_SECOND << (1*BOOT_BITS)) | \
41 (BOOT_THIRD << (2*BOOT_BITS)) | \
42 (BOOT_NOTHING << (3*BOOT_BITS)) | \
46 #define DEFAULT_BOOT_INDEX BOOT_INDEX
48 #define DEFAULT_BOOT_INDEX 0
51 #if !defined(TAGGED_IMAGE) && !defined(AOUT_IMAGE) && !defined(ELF_IMAGE) && !defined(ELF64_IMAGE) && !defined(COFF_IMAGE) && !defined(RAW_IMAGE)
52 #define TAGGED_IMAGE /* choose at least one */
56 #define K_EOF '\04' /* Ctrl-D */
57 #define K_INTR '\03' /* Ctrl-C */
59 /* Edit this to change the path to hostspecific kernel image
60 kernel.<client_ip_address> in RARP boot */
61 #ifndef DEFAULT_KERNELPATH
62 #define DEFAULT_KERNELPATH "/tftpboot/kernel.%@"
66 #undef DEFAULT_BOOTFILE
67 #ifndef PXENFSROOTPATH
68 #define PXENFSROOTPATH ""
70 #define DEFAULT_BOOTFILE PXENFSROOTPATH "/boot/pxeboot"
73 #ifndef MAX_TFTP_RETRIES
74 #define MAX_TFTP_RETRIES 20
77 #ifndef MAX_BOOTP_RETRIES
78 #define MAX_BOOTP_RETRIES 20
81 #define MAX_BOOTP_EXTLEN (ETH_MAX_MTU-sizeof(struct bootpip_t))
83 #ifndef MAX_ARP_RETRIES
84 #define MAX_ARP_RETRIES 20
87 #ifndef MAX_RPC_RETRIES
88 #define MAX_RPC_RETRIES 20
91 /* Link configuration time in tenths of a second */
92 #ifndef VALID_LINK_TIMEOUT
93 #define VALID_LINK_TIMEOUT 100 /* 10.0 seconds */
96 /* Inter-packet retry in ticks */
98 #define TIMEOUT (10*TICKS_PER_SEC)
101 #ifndef BOOTP_TIMEOUT
102 #define BOOTP_TIMEOUT (2*TICKS_PER_SEC)
105 /* Max interval between IGMP packets */
106 #define IGMP_INTERVAL (10*TICKS_PER_SEC)
107 #define IGMPv1_ROUTER_PRESENT_TIMEOUT (400*TICKS_PER_SEC)
109 /* These settings have sense only if compiled with -DCONGESTED */
110 /* total retransmission timeout in ticks */
111 #define TFTP_TIMEOUT (30*TICKS_PER_SEC)
112 /* packet retransmission timeout in ticks */
114 #define TFTP_REXMT (3*TICKS_PER_SEC)
116 #define TFTP_REXMT TIMEOUT
120 #define NULL ((void *)0)
123 #include <gpxe/if_ether.h>
126 ARP_CLIENT, ARP_SERVER, ARP_GATEWAY,
134 #define RARP_REQUEST 3
140 /* Helper macros used to identify when DHCP options are valid/invalid in/outside of encapsulation */
141 #define NON_ENCAP_OPT in_encapsulated_options == 0 &&
142 #ifdef ALLOW_ONLY_ENCAPSULATED
143 #define ENCAP_OPT in_encapsulated_options == 1 &&
148 #include <gpxe/if_arp.h>
159 struct in_addr ipaddr;
163 #define KERNEL_BUF (bootp_data.bootp_reply.bp_file)
165 #define FLOPPY_BOOT_LOCATION 0x7c00
168 unsigned short rom_segment;
169 unsigned short rom_length;
172 extern inline int rom_address_ok(struct rom_info *rom, int assigned_rom_segment)
174 return (assigned_rom_segment < 0xC000
175 || assigned_rom_segment == rom->rom_segment);
178 /* Define a type for passing info to a loaded program */
180 uint8_t major, minor; /* Version */
181 uint16_t flags; /* Bit flags */
184 /***************************************************************************
186 ***************************************************************************/
190 extern char as_main_program;
192 extern void rx_qdrain P((void));
193 extern int ip_transmit P((int len, const void *buf));
194 extern void build_ip_hdr P((unsigned long destip, int ttl, int protocol,
195 int option_len, int len, const void *buf));
196 extern void build_udp_hdr P((unsigned long destip,
197 unsigned int srcsock, unsigned int destsock, int ttl,
198 int len, const void *buf));
199 extern int udp_transmit P((unsigned long destip, unsigned int srcsock,
200 unsigned int destsock, int len, const void *buf));
201 extern int tcp_transmit(unsigned long destip, unsigned int srcsock,
202 unsigned int destsock, long send_seq, long recv_seq,
203 int window, int flags, int len, const void *buf);
204 int tcp_reset(struct iphdr *ip);
205 typedef int (*reply_t)(int ival, void *ptr, unsigned short ptype, struct iphdr *ip, struct udphdr *udp, struct tcphdr *tcp);
206 extern int await_reply P((reply_t reply, int ival, void *ptr, long timeout));
207 extern int decode_rfc1533 P((unsigned char *, unsigned int, unsigned int, int));
208 #define RAND_MAX 2147483647L
209 extern uint16_t ipchksum P((const void *ip, unsigned long len));
210 extern uint16_t add_ipchksums P((unsigned long offset, uint16_t sum, uint16_t new));
211 extern int32_t random P((void));
212 extern long rfc2131_sleep_interval P((long base, int exp));
213 extern void cleanup P((void));
216 /* Be careful with sector_t it is an unsigned long long on x86 */
217 typedef uint64_t sector_t;
218 typedef sector_t (*os_download_t)(unsigned char *data, unsigned int len, int eof);
219 extern os_download_t probe_image(unsigned char *data, unsigned int len);
220 extern int load_block P((unsigned char *, unsigned int, unsigned int, int ));
223 extern void twiddle P((void));
224 extern void interruptible_sleep P((int secs));
225 extern int strcasecmp P((const char *a, const char *b));
226 extern char *substr P((const char *a, const char *b));
228 extern unsigned long get_boot_order(unsigned long order, unsigned *index);
229 extern void disk_init P((void));
230 extern unsigned int pcbios_disk_read P((int drv,int c,int h,int s,char *buf));
233 struct os_entry_regs {
234 /* Be careful changing this structure
235 * as it is used by assembly language code.
237 uint32_t edi; /* 0 */
238 uint32_t esi; /* 4 */
239 uint32_t ebp; /* 8 */
240 uint32_t esp; /* 12 */
241 uint32_t ebx; /* 16 */
242 uint32_t edx; /* 20 */
243 uint32_t ecx; /* 24 */
244 uint32_t eax; /* 28 */
246 uint32_t saved_ebp; /* 32 */
247 uint32_t saved_esi; /* 36 */
248 uint32_t saved_edi; /* 40 */
249 uint32_t saved_ebx; /* 44 */
250 uint32_t saved_eip; /* 48 */
251 uint32_t saved_esp; /* 52 */
254 /* Be careful changing this structure
255 * as it is used by assembly language code.
257 uint32_t edi; /* 0 */
258 uint32_t esi; /* 4 */
259 uint32_t ebp; /* 8 */
260 uint32_t esp; /* 12 */
261 uint32_t ebx; /* 16 */
262 uint32_t edx; /* 20 */
263 uint32_t ecx; /* 24 */
264 uint32_t eax; /* 28 */
266 extern struct os_entry_regs os_regs;
267 extern struct regs initial_regs;
268 extern int xstart32(unsigned long entry_point, ...);
269 extern int xstart_lm(unsigned long entry_point, unsigned long params);
270 extern void xend32 P((void));
271 struct Elf_Bhdr *prepare_boot_params(void *header);
272 extern int elf_start(unsigned long machine, unsigned long entry, unsigned long params);
273 extern unsigned long currticks P((void));
274 extern void exit P((int status));
277 /***************************************************************************
279 ***************************************************************************/
281 extern struct rom_info rom;
282 extern char *hostname;
283 extern int hostnamelen;
284 extern unsigned char *addparam;
285 extern int addparamlen;
286 extern jmp_buf restart_etherboot;
288 extern struct arptable_t arptable[MAX_ARP];
290 extern int menutmo,menudefault;
291 extern unsigned char *defparams;
292 extern int defparams_max;
295 extern unsigned char *motd[RFC1533_VENDOR_NUMOFMOTD];
297 extern struct bootpd_t bootp_data;
298 #define BOOTP_DATA_ADDR (&bootp_data)
299 extern unsigned char *end_of_rfc1533;
301 extern int freebsd_howto;
302 #define FREEBSD_KERNEL_ENV_SIZE 256
303 extern char freebsd_kernel_env[FREEBSD_KERNEL_ENV_SIZE];
313 #endif /* ETHERBOOT_H */