/*
 **************************************************************************
 *
 * Boot-ROM-Code to load an operating system across a TCP/IP network.
 *
 * Module:  pxe/entry.h
 * Purpose: Definitions for PXE entry functions and installation check
 * Entries: None
 *
 **************************************************************************
 *
 * Copyright (C) 1998-2003 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: entry.h,v 1.4 2003/01/25 23:29:40 gkminix Exp $
 */

#ifndef _PXE_ENTRY_H
#define _PXE_ENTRY_H


/*
 **************************************************************************
 *
 * This file contains the Preboot API installation check definitions
 * as per Intels PXE specification version 1.0.
 *
 **************************************************************************
 *
 * Preboot API Installation check definitions:
 */
#ifndef INT_PXE
#define INT_PXE		0x1A		/* PXE installation check interrupt */
#endif
#define	PXE_IN_MAGIC	0x5650		/* Magic ID into PXE interrupt */
#define PXE_OUT_MAGIC	0x564E		/* Magic ID coming from PXE interrupt */



/*
 **************************************************************************
 *
 * Definition of PXENV API Entry Point Structure
 */
#ifndef _USE_ASSEMBLER

typedef struct s_pxenv_entry {
	unsigned char signature[6];	/* entry point structure signature */
	unsigned int  version;		/* API version */
	unsigned char length;		/* length of this structure */
	unsigned char checksum;		/* makes checksum of struct zero */
	unsigned int  rm_entry_off;	/* 16-bit real mode offset and */
	unsigned int  rm_entry_seg;	/* segment of API entry point */
	unsigned int  pm_entry_off;	/* 16-bit protected mode offset and */
	unsigned long pm_entry_base;	/* segment base of entry point */
	unsigned int  arpa_stk_sel;	/* ARPA stack segment */
	unsigned int  arpa_stk_size;	/* size of ARPA stack */
	unsigned int  arpa_cs_sel;	/* ARPA code segment */
	unsigned int  arpa_cs_size;	/* size of ARPA code segment */
	unsigned int  arpa_ds_sel;	/* ARPA data segment */
	unsigned int  arpa_ds_size;	/* size of ARPA data segment */
	unsigned int  net_ds_sel;	/* network driver data segment */
	unsigned int  net_ds_size;	/* size of network driver data seg */
	unsigned int  net_cs_sel;	/* network driver code segment */
	unsigned int  net_cs_size;	/* size of network driver code seg */
	unsigned long pxeptr;		/* far ptr to !PXE structure */
} t_pxenv_entry;

#else				/* _USE_ASSEMBLER */

o_pe_sig		equ	$0000	! entry point structure signature
o_pe_version		equ	$0006	! API version
o_pe_length		equ	$0008	! length of this structure
o_pe_checksum		equ	$0009	! makes checksum of struct zero
o_pe_rm_entry		equ	$000A
o_pe_rm_entry_off	equ	$000A	! 16-bit real mode offset and
o_pe_rm_entry_seg	equ	$000C	! segment of API entry point
o_pe_pm_entry		equ	$000E
o_pe_pm_entry_off	equ	$000E	! 16-bit protected mode offset and
o_pe_pm_entry_base	equ	$0010	! segment base of entry point
o_pe_arpa_ss_sel	equ	$0014	! ARPA stack segment
o_pe_arpa_ss_size	equ	$0016	! size of ARPA stack
o_pe_arpa_cs_sel	equ	$0018	! ARPA code segment
o_pe_arpa_cs_size	equ	$001A	! size of ARPA code segment
o_pe_arpa_ds_sel	equ	$001C	! ARPA data segment
o_pe_arpa_ds_size	equ	$001E	! size of ARPA data segment
o_pe_net_ds_sel		equ	$0020	! network driver data segment
o_pe_net_ds_size	equ	$0022	! size of network driver data seg
o_pe_net_cs_sel		equ	$0024	! network driver code segment
o_pe_net_cs_size	equ	$0026	! size of network driver code seg
o_pe_pxe_ptr		equ	$0028	! far pointer to !PXE structure
o_pe_pxe_off		equ	$0028	! offset to !PXE structure
o_pe_pxe_seg		equ	$002A	! segment of !PXE structure

pxentry_size		equ	$002C	! size of entry point structure

#endif				/* _USE_ASSEMBLER */



/*
 **************************************************************************
 *
 * Definition of !PXE API Entry Point Structure
 */

/* Segment descriptor numbers */
#define PXE_DESC_STACK		0	/* stack segment */
#define PXE_DESC_UNDI_DATA	1	/* UNDI data segment */
#define PXE_DESC_UNDI_CODE	2	/* UNDI code segment */
#define PXE_DESC_UNDI_WRITE	3	/* UNDI code write segment */
#define PXE_DESC_BASE_DATA	4	/* base data segment */
#define PXE_DESC_BASE_CODE	5	/* base code segment */
#define PXE_DESC_BASE_WRITE	6	/* base code write segment */

#define PXE_DESC_DEF_UNDI	4	/* default # of desc with only UNDI */
#define PXE_DESC_DEF_BASE	7	/* default # of desc with UNDI & base */
#define PXE_DESC_DEF_NUM	7	/* total # of descriptors in struct */


#ifndef _USE_ASSEMBLER

/* Segment descriptor definition */
typedef struct s_desc {
	unsigned int  limit_low;	/* bits 0-15 of segment limit */
	unsigned int  base_low;		/* bits 0-15 of segment base */
	unsigned char base_mid;		/* bits 16-23 of segment base */
	unsigned char type;		/* segment type */
	unsigned char limit_high;	/* bits 16-19 of segment limit */
	unsigned char base_high;	/* bits 24-32 of segment base */
} t_desc;


/* !PXE API entry point structure */
typedef struct s_pxe_struct {
	unsigned char signature[4];	/* entry point structure signature */
	unsigned char length;		/* length of this structure */
	unsigned char checksum;		/* makes checksum of this struct zero */
	unsigned char revision;		/* structure definition revision */
	unsigned char resvd1;		/* reserved */
	unsigned long undiromid;	/* far ptr to UNDI ROM ID structure */
	unsigned long baseromid;	/* far ptr to base ROM ID structure */
	unsigned long pxentry16;	/* far ptr to 16-bit PXE entry point */
	unsigned long pxentry32;	/* far ptr to 32-bit PXE entry point */
	unsigned long statuscallout;	/* far ptr to status callout routine */
	unsigned char resvd2;		/* reserved */
	unsigned char descnum;		/* number of segment descriptors */
	unsigned int  firstsel;		/* first protected mode selector */
	t_desc desc[PXE_DESC_DEF_NUM];	/* segment descriptors */
} t_pxe_struct;

#else				/* _USE_ASSEMBLER */

o_desc_limit_low	equ	$0000	! bits 0-15 of segment limit
o_desc_base_low		equ	$0002	! bits 0-15 of segment base
o_desc_base_mid		equ	$0004	! bits 16-23 of segment base
o_desc_type		equ	$0005	! segment type
o_desc_limit_high	equ	$0006	! bits 16-19 of segment limit
o_desc_base_high	equ	$0007	! bits 24-31 of segment base

desc_size		equ	$0008	! size of descriptor structure
desc_default_data	equ	$93	! default descriptor type for data
desc_default_code	equ	$9D	! default descriptor type for code
desc_default_stack	equ	$93	! default descriptor type for stack


o_ps_sig		equ	$0000	! entry point structure signature
o_ps_length		equ	$0004	! length of this structure
o_ps_checksum		equ	$0005	! makes checksum of this struct zero
o_ps_revision		equ	$0006	! structure definition revision
o_ps_undiromid		equ	$0008	! far ptr to UNDI ROM ID structure
o_ps_baseromid		equ	$000C	! far ptr to base ROM ID structure
o_ps_pxentry16		equ	$0010	! far ptr to 16-bit PXE entry point
o_ps_pxentry32		equ	$0014	! far ptr to 32-bit PXE entry point
o_ps_statuscallout	equ	$0018	! far ptr to status callout routine
o_ps_descnum		equ	$001D	! number of segment descriptors
o_ps_firstsel		equ	$001E	! first protected mode selector
o_ps_desc		equ	$0020	! first segment descriptor

pxe_struct_size		equ	$0020
pxe_desc_size		equ	(PXE_DESC_DEF_NUM * desc_size)
pxe_def_size		equ	(pxe_struct_size + pxe_desc_size)

#endif				/* _USE_ASSEMBLER */
#endif				/* _PXE_ENTRY_H */



syntax highlighted by Code2HTML, v. 0.9.1