/* vim: set filetype=c:
 *
 * base.h86  -  Definitions for base code PXE API functions
 *
 * Copyright (C) 2003-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: base.h86,v 1.10 2007/01/06 18:31:03 gkminix Exp $
 */

#ifndef PXE_BASE_H86
#define PXE_BASE_H86


/*
 * This file can only get included into target C or assembler source files.
 */
#define GCC_INCLUDE
#include <compiler.h>



/*
 **************************************************************************
 *
 * This file contains base code PXE API functions as per Intels PXE
 * specification version 2.1.
 *
 **************************************************************************
 *
 * Base code PXE API opcodes:
 */
#define BASE_UNLOAD_STACK	0x0070
#define BASE_GET_BINL_INFO	0x0071
#define BASE_RESTART_TFTP	0x0073
#define BASE_START_BASE		0x0075
#define BASE_STOP_BASE		0x0076

#define BASE_MINNUM		0x0070
#define BASE_MAXNUM		0x0076



/*
 **************************************************************************
 *
 * Definition of structure for BASE_UNLOAD_STACK function:
 */
#ifndef _ASSEMBLY_

typedef struct s_base_unload_stack {
	__u16 status;			/* Out: function status */
	__u8  resvd[10];
} t_base_unload_stack;

#else

			.struct	0
o_bus_status:		.struct	.+2	/* Out: function status */

#define unload_stack_size	12	/* size of function structure */

#endif



/*
 **************************************************************************
 *
 * Definition of structure for GEN_GET_BINL_INFO function:
 */
#ifndef _ASSEMBLY_

typedef struct s_base_get_binl_info {
	__u16  status;			/* Out: function status */
	__u16  packet_type;		/* In: type of buffer requested */
	__u16  buffer_size;		/* In/Out: size of buffer in bytes */
	__fptr buffer;			/* In/Out: far pointer to buffer */
	__u16  buffer_limit;		/* Out: max size of buffer */
} t_base_get_binl_info;

#else

			.struct	0
o_bgbi_status:		.struct	.+2	/* Out: status */
o_bgbi_packet_type:	.struct	.+2	/* In: type of buffer requested */
o_bgbi_buffer_size:	.struct	.+2	/* In/Out: size of buffer in bytes */
o_bgbi_buffer_offset:	.struct	.+2	/* In/Out: offset to buffer */
o_bgbi_buffer_segment:	.struct	.+2	/* In/Out: segment of buffer */
o_bgbi_buffer_limit:	.struct	.+2	/* Out: max size of buffer */

#define get_binl_info_size	12	/* size of function structure */

#endif

/* Packet types */
#define BASE_PACKET_DHCP_DISCOVER	1
#define BASE_PACKET_DHCP_ACK		2
#define BASE_PACKET_BINL_REPLY		3



/*
 **************************************************************************
 *
 * Definition of structure for BASE_RESTART_TFTP function:
 *
 * All definitions for the BASE_RESTART_TFTP function are identical to
 * those for the TFTP_READ_FILE function.
 */
#ifdef _ASSEMBLY_
# include <pxe/tftp.i86>
#else
# include <pxe/tftp.h86>
#endif

#ifndef _ASSEMBLY_

#define s_base_restart_tftp	s_tftp_read_file
#define t_base_restart_tftp	t_tftp_read_file

#endif



/*
 **************************************************************************
 *
 * Definition of structure for BASE_START_BASE function:
 */
#ifndef _ASSEMBLY_

typedef struct s_base_start_base {
	__u16 status;			/* Out: function status */
} t_base_start_base;

#else

			.struct	0
o_bsb_status:		.struct	.+2	/* Out: status */

#define start_base_size		2	/* size of function structure */

#endif



/*
 **************************************************************************
 *
 * Definition of structure for BASE_STOP_BASE function:
 */
#ifndef _ASSEMBLY_

typedef struct s_base_stop_base {
	__u16 status;			/* Out: function status */
} t_base_stop_base;

#else

			.struct	0
o_bxb_status:		.struct	.+2	/* Out: status */

#define stop_base_size		2	/* size of function structure */

#endif

#endif

