/*
 * pnp.i86  -  Definitions for ROM PnP BIOS interface
 *
 * 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: pnp.i86,v 1.8 2007/01/06 18:31:10 gkminix Exp $
 */

#ifndef SYSTEM_PNP_I86
#define SYSTEM_PNP_I86


/*
 * Include the main C header file
 */
#define GAS_INCLUDE
#include <system/pnp.h>



/*
 **************************************************************************
 *
 * PnP BIOS interface
 */

/*
 * PnP entry point structure:
 */
#define PNPE_STRUCT_SEG	0xE000		/* segment for searching PnP struct */
#define PNPE_SIGNATURE	0x506E5024	/* PnP entry struct signature */


			.struct	0
pnpe_sig:		.struct	.+4	/* entry point structure signature */
pnpe_version:		.struct	.+1	/* structure version number */
pnpe_length:		.struct	.+1	/* structure length */
pnpe_control:		.struct	.+2	/* system capabilities information */
pnpe_checksum:		.struct	.+1	/* structure checksum */
pnpe_event:		.struct	.+4	/* event notification flag address */
pnpe_real_entry:
pnpe_real_ofs:		.struct	.+2	/* real mode offset to entry point */
pnpe_real_seg:		.struct	.+2	/* real mode segment of entry point */
pnpe_prot_entry:
pnpe_prot_ofs:		.struct	.+2	/* protected mode offset to entry point */
pnpe_prot_base:		.struct	.+4	/* protected mode code segment base */
pnpe_devid:		.struct	.+4	/* OEM device identifier */
pnpe_real_data:		.struct	.+2	/* real mode data segment */
pnpe_prot_data:		.struct	.+4	/* protected mode data segment base */



/*
 * System capabilities flags:
 */
#define PNP_EVENT_MASK	0b000000000000011	/* bit mask */
#define PNP_EVENT_POLL	0b000000000000001	/* event handled through polling */
#define PNP_EVENT_ASYNC	0b000000000000010	/* event is asynchronous */



/*
 * PnP BIOS functions:
 */
#define PNP_FUNC_GET_NODE_NUM	0x0000		/* get number of system nodes */
#define PNP_FUNC_GET_NODE	0x0001		/* get system device node */
#define PNP_FUNC_SET_NODE	0x0002		/* set system device node */
#define PNP_FUNC_GET_EVENT	0x0003		/* get event */
#define PNP_FUNC_SEND_MSG	0x0004		/* send message */
#define PNP_FUNC_GET_DOCK_INFO	0x0005		/* get docking station info */
#define PNP_FUNC_SET_PRIM_BOOT	0x0007		/* set primary boot device */
#define PNP_FUNC_GET_PRIM_BOOT	0x0008		/* get primary boot device */
#define PNP_FUNC_SET_SARI	0x0009		/* set statically allocated info */
#define PNP_FUNC_GET_SARI	0x000A		/* get statically allocated info */
#define PNP_FUNC_GET_APM_ID	0x000B		/* get APM ID table */
#define PNP_FUNC_GET_CONFIG	0x0040		/* get PnP config structure */
#define PNP_FUNC_GET_ESCD	0x0041		/* get ESCD info */
#define PNP_FUNC_READ_ESCD	0x0042		/* read ESCD data */
#define PNP_FUNC_WRITE_ESCD	0x0043		/* write ESCD data */
#define PNP_FUNC_GET_BBS_VER	0x0060		/* get BBS version number */
#define PNP_FUNC_GET_DEV_COUNT	0x0061		/* get BBS device count */
#define PNP_FUNC_GET_PRIORITY	0x0062		/* get BBS priority and table */
#define PNP_FUNC_SET_PRIORITY	0x0063		/* set BBS priority */
#define PNP_FUNC_GET_IPL_DEV	0x0064		/* get IPL device from last boot */
#define PNP_FUNC_GET_BOOT_FIRST	0x0065		/* get first boot device */
#define PNP_FUNC_SET_BOOT_FIRST	0x0066		/* set first boot device */



/*
 * PnP BIOS return codes:
 */
#define PNP_RET_SUCCESS		0x0000		/* success */
#define PNP_RET_UNKNOWN		0x0081		/* unknown function */
#define PNP_RET_UNSUPPORTED	0x0082		/* function unsupported */
#define PNP_RET_INV_HANDLE	0x0083		/* invalid handle */
#define PNP_RET_BAD_PARAM	0x0084		/* invalid function parameter */
#define PNP_RET_SET_FAILED	0x0085		/* set device node failed */
#define PNP_RET_NO_EVENTS	0x0086		/* no events pending */
#define PNP_RET_NOT_DOCKED	0x0087		/* system is not docked */
#define PNP_RET_NO_PNP_CARDS	0x0088		/* no ISA PnP cards found */
#define PNP_RET_DOCK_CAP	0x0089		/* not able to determine docking */
#define PNP_RET_NO_BATT		0x008A		/* no battery in docking station */
#define PNP_RET_RES_CONFLICT	0x008B		/* resource conflict */
#define PNP_RET_BUFFER_SMALL	0x008C		/* buffer too small */
#define PNP_RET_USE_ESCD	0x008D		/* have to use ESCD functions */
#define PNP_RET_MSG_UNSUPPORTED	0x008E		/* message type not supported */
#define PNP_RET_HW_ERROR	0x008F		/* hardware failure */



/*
 * Plug and Play ISA configuration structure:
 */
#define PNP_CONF_REV		0x0000		/* structure revision */
#define PNP_CONF_CSN_NUM	0x0001		/* total number of CSNs assigned */
#define PNP_CONF_DATA_PORT	0x0002		/* ISA read data port */

#define PNP_CONF_SIZE		0x0006		/* size of structure */


#endif

