/* vim: set filetype=c:
 *
 **************************************************************************
 *
 * Boot-ROM-Code to load an operating system across a TCP/IP network.
 *
 * Module:  load.h86
 * Purpose: Definitions for the boot image loader
 * Entries: none
 *
 **************************************************************************
 *
 * Copyright (C) 1995-2007 Gero Kuhlmann <gero@gkminix.han.de>
 *
 *  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.h86,v 1.5 2007/01/06 18:30:46 gkminix Exp $
 */

#ifndef KERNEL_BOOT_LOAD_H86
#define KERNEL_BOOT_LOAD_H86



/*
 **************************************************************************
 *
 * This file can only get included into target C source files
 */
#if defined(_ASSEMBLY_) || !defined(_TARGET_) || !defined(_BOOTROM_)
# error This file can only get included into target C source files
#endif



/*
 **************************************************************************
 *
 * We need some includes before we can include this file
 */
#include <common.h86>
#include <netboot.h86>
#include <net/in.h86>
#include <pxe/general.h86>
#include <pxe/tftp.h86>



/*
 **************************************************************************
 *
 * 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
 */
struct loadparams {
	t_tftp_read_file  tftp;		/* TFTP parameters		*/
	__fptr            header;	/* far ptr to load header	*/
	__fptr            exec;		/* far execution address	*/
	unsigned short    port;		/* TFTP server port		*/
	short             mode;		/* loading mode			*/
};

/* 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 short load(struct loadparams *params);


#endif

