/* ************************************************************************** * * Boot-ROM-Code to load an operating system across a TCP/IP network. * * Module: load.h * Purpose: Definitions for the boot image loader * Entries: none * ************************************************************************** * * Copyright (C) 1995-2003 Gero Kuhlmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: load.h,v 1.4 2003/01/25 23:29:41 gkminix Exp $ */ #ifndef _KERNEL_BOOT_LOAD_H #define _KERNEL_BOOT_LOAD_H #ifndef _USE_ASSEMBLER /* ************************************************************************** * * We need some includes before we can include this file */ #include #include #include /* ************************************************************************** * * Image file header. This header has to have the same size as a TFTP * block. */ struct imghdr { unsigned long ih_magic1; /* Header magic ID 1 */ unsigned long ih_flags; /* Header flags */ unsigned long ih_locn; /* Pointer to this header */ unsigned long ih_execute; /* Execute address */ unsigned char ih_dummy[494]; /* Fill up to SEGSIZE */ unsigned short ih_magic2; /* Header magic ID 2 */ }; #define IH_MAGIC1 0x1b031336L /* First magic number */ #define IH_MAGIC2 0xaa55 /* Second magic number */ #define IH_KEEP_ALL(a) ((a) & 0x00000100L) /* Keep UNDI and kernel */ #define IH_KEEP_UNDI(a) ((a) & 0x00000200L) /* Only keep UNDI */ #define IH_HDRLEN(a) ((unsigned int)((a) & 0x0fL) << 2) #define IH_VENDLEN(a) ((unsigned int)((a) & 0xf0L) >> 2) #define IH_HEADERSIZE 16 /* Size of header */ /* ************************************************************************** * * Load record header */ struct loadrec { unsigned long lr_flags; /* Flags and record length */ unsigned long lr_addr; /* Linear address to put record */ unsigned long lr_ilen; /* Image length */ unsigned long lr_mlen; /* Memory length */ }; #define LR_IS_B0(a) ((a) & 0x01000000L) #define LR_IS_B1(a) ((a) & 0x02000000L) #define LR_IS_EOF(a) ((a) & 0x04000000L) /* Marks last record */ #define LR_HDRLEN(a) ((unsigned int)((a) & 0x0fL) << 2) #define LR_VENDLEN(a) ((unsigned int)((a) & 0xf0L) >> 2) /* ************************************************************************** * * Definition of boot block address and required boot block buffer size */ #define BOOTBLOCK MK_FP(0, 0x7c00) #define BOOTBSIZE 1024L /* ************************************************************************** * * Structure used to pass parameters to the loading routine */ extern struct loadparams { t_tftp_read_file tftp; /* TFTP parameters */ unsigned long header; /* far ptr to load header */ unsigned long exec; /* far execution address */ unsigned int drive; /* disk ID when calling image */ int mode; /* loading mode */ } ldparams; /* Loading modes */ #define LDMODE_KEEP_NONE 0 /* remove kernel and UNDI driver */ #define LDMODE_KEEP_UNDI 1 /* only remove kernel and keep UNDI */ #define LDMODE_KEEP_ALL 2 /* dont remove anything */ #define LDMODE_KEEP_PXE 3 /* PXE calling sequence */ /* ************************************************************************** * * Functions in boot image loader module: */ /* Get the boot image from the server and execute it */ extern int load __P((int quiet)); #endif /* _USE_ASSEMBLER */ #endif /* _KERNEL_BOOT_LOAD_H */