Home | History | Annotate | Line # | Download | only in pnpbios
pnpbiosreg.h revision 1.1
      1 /*	$NetBSD: pnpbiosreg.h,v 1.1 2000/02/22 15:49:18 chopps Exp $ */
      2 /*
      3  * Copyright (c) 2000 Christian E. Hopps
      4  * All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. The name of the author may not be used to endorse or promote products
     15  *    derived from this software without specific prior written permission
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 /* functions */
     29 #define	PNP_FC_GET_NUM_NODES	0x00
     30 #define	PNP_FC_GET_DEVICE_NODE	0x01
     31 #define	PNP_FC_SET_DEVICE_NODE	0x02
     32 #define	PNP_FC_GET_EVENT	0x03
     33 #define	PNP_FC_SEND_MESSAGE	0x04
     34 #define	PNP_FC_GET_DOCK_INFO	0x05
     35 #define	PNP_FC_SET_STATIC_RES	0x09	/* no support currently */
     36 #define	PNP_FC_GET_STATIC_RES	0x0A	/* no support currently */
     37 #define	PNP_FC_GET_APM_TABLE	0x0B
     38 #define	PNP_FC_GET_ISA_CONFIG	0x40	/* no support currently */
     39 #define	PNP_FC_GET_ESCD_SYS_CONFIG	0x41	/* no support currently */
     40 #define	PNP_FC_READ_ESCD_SYS_CONFIG	0x42	/* no support currently */
     41 #define	PNP_FC_WRITE_ESCD_SYS_CONFIG	0x43	/* no support currently */
     42 
     43 /* return codes from pnp bios calls */
     44 #define	PNP_RC_SUCCESS			0x00
     45 #define	PNP_RC_ERROR_MASK		0x80
     46 #define	PNP_RC_RESERVED			0x01
     47 #define	PNP_RC_NOT_SET_STATICALLY	0x7f	/* warning */
     48 #define	PNP_RC_UNKNOWN_FUNCTION		0x81
     49 #define	PNP_RC_FUNCTION_NOT_SUPPORTED	0x82
     50 #define	PNP_RC_INVALID_HANDLE		0x83
     51 #define	PNP_RC_BAD_PARAMETER		0x84
     52 #define	PNP_RC_SET_FAILED		0x85
     53 #define	PNP_RC_EVENTS_NOT_PENDING	0x86
     54 #define	PNP_RC_SYSTEM_NOT_DOCKED	0x87
     55 #define	PNP_RC_NO_ISA_PNP_CARDS		0x88
     56 #define	PNP_RC_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES	0x89
     57 #define	PNP_RC_CONFIG_CHANGE_FAILED_NO_BATTERY		0x8a
     58 #define	PNP_RC_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT	0x8b
     59 #define	PNP_RC_BUFFER_TOO_SMALL		0x8c
     60 #define	PNP_RC_USE_ESCD_SUPPORT		0x8d
     61 #define	PNP_RC_MESSAGE_NOT_SUPPORTED	0x8e
     62 #define	PNP_RC_HARDWARE_ERROR		0x8f
     63 
     64 /* event identifiers */
     65 #define	PNP_EID_ABOUT_TO_CHANGE_CONFIG	0x0001
     66 #define	PNP_EID_DOCK_CHANGED		0x0002
     67 #define	PNP_EID_SYSTEM_DEVICE_CHANGED	0x0003
     68 #define	PNP_EID_CONFIG_CHANGE_FAILED	0x0004
     69 #define	PNP_EID_UNKNOWN_SYSTEM_EVENT	0xffff
     70 #define	PNP_EID_OEM_DEFINED_BIT		0x8000
     71 
     72 /* response messages */
     73 #define	PNP_RM_OK		0x00
     74 #define	PNP_RM_ABORT		0x01
     75 
     76 /* control messages */
     77 #define	PNP_CM_UNDOCK_DEFAULT_ACTION	0x0040
     78 #define	PNP_CM_POWER_OFF		0x0041
     79 #define	PNP_CM_PNP_OS_ACTIVE		0x0042
     80 #define	PNP_CM_PNP_OS_INACTIVE		0x0043
     81 #define	PNP_CM_OEM_DEFINED_BIT		0x8000
     82 
     83 
     84 /* main pnpbios structure -- note not naturally aligned */
     85 struct pnpinstcheck {
     86 	u_int32_t	ic_sig;			/* '$PnP' */
     87 	u_int8_t	ic_version;		/* 0x10 currently */
     88 	u_int8_t	ic_length;		/* 0x21 currently */
     89 	u_int16_t	ic_control;
     90 	u_int8_t	ic_cksum;
     91 	u_int32_t	ic_evaddr;
     92 	u_int16_t	ic_rcodeoff;
     93 	u_int16_t	ic_rcodeseg;
     94 	u_int16_t	ic_pcodeoff;
     95 	u_int32_t	ic_pcodeseg;
     96 	u_int32_t	ic_oemid;
     97 	u_int16_t	ic_rdataseg;
     98 	u_int32_t	ic_pdataseg;
     99 } __attribute__((__packed__));
    100 #define	PNP_IC_VERSION_1_0		0x10
    101 #define	PNP_IC_CONTORL_EVENT_MASK	0x0003
    102 #define	PNP_IC_CONTROL_EVENT_NONE	0x0000
    103 #define	PNP_IC_CONTROL_EVENT_POLL	0x0001
    104 #define	PNP_IC_CONTROL_EVENT_ASYNC	0x0002
    105 
    106 /* structure used by [GS]ET_DEVICE_NODE -- note not naturally aligned */
    107 struct pnpdevnode {
    108 	u_int16_t	dn_size;
    109 	u_int8_t	dn_handle;
    110 	u_int32_t	dn_product;
    111 	u_int8_t	dn_type;	/* base type */
    112 	u_int8_t	dn_subtype;	/* sub type depends on base */
    113 	u_int8_t	dn_dpi;		/* dev prog intf depends on subtype */
    114 	u_int16_t	dn_attr;
    115 	/* variable - allocated resource */
    116 	/* variable - possible resource */
    117 	/* variable - compatible identifiers */
    118 } __attribute__((__packed__));
    119 #define	PNP_DN_ATTR_CONFIG_TIME_MASK		0x0180
    120 #define	PNP_DN_ATTR_CONFIG_TIME_NEXT_BOOT	0x0000
    121 #define	PNP_DN_ATTR_CONFIG_TIME_BOTH		0x0080
    122 #define	PNP_DN_ATTR_CONFIG_TIME_RUNTIME		0x0180
    123 #define	PNP_DN_ATTR_REMOVABLE		0x0040
    124 #define	PNP_DN_ATTR_DOCK_DEVICE		0x0010
    125 #define	PNP_DN_ATTR_CAP_PRIMARY_IPL	0x0010
    126 #define	PNP_DN_ATTR_CAP_PRIMARY_INPUT	0x0008
    127 #define	PNP_DN_ATTR_CAP_PRIMARY_OUTPUT	0x0004
    128 #define	PNP_DN_ATTR_CAN_CONFIGURE	0x0002
    129 #define	PNP_DN_ATTR_CAN_DISABLE		0x0001
    130 
    131 
    132 /* returned by GET_DOCK_INFO bios call */
    133 struct pnpdockinfo {
    134 	u_int32_t	di_id;		/* dock station id */
    135 	u_int32_t	di_serial;	/* serial number */
    136 	u_int16_t	di_cap;		/* capabilities */
    137 } __attribute__((__packed__));
    138 #define	PNP_DI_ID_UNKNOWN_DOCKING_ID	0xffffffff
    139 #define	PNP_DI_DOCK_WHEN_MASK		0x0006
    140 #define	PNP_DI_DOCK_WHEN_NO_POWER	0x0000
    141 #define	PNP_DI_DOCK_WHEN_SUSPENDED	0x0002
    142 #define	PNP_DI_DOCK_WHEN_RUNNING	0x0004
    143 #define	PNP_DI_DOCK_WHEN_RESERVED	0x0006
    144 #define	PNP_DI_DOCK_STYLE_MASK		0x0001
    145 #define	PNP_DI_DOCK_STYLE_SUPRISE	0x0000	/* just remove */
    146 #define	PNP_DI_DOCK_STYLE_VCR		0x0001	/* controlled */
    147 
    148 struct pnplargeres {
    149 	u_int8_t	r_type;
    150 	u_int16_t	r_len;
    151 	/* variable */
    152 } __attribute__((__packed__));
    153 
    154 /* resource descriptors */
    155 struct pnpmem16rangeres {
    156 	struct pnplargeres	r_hdr;
    157 	u_int8_t	r_flags;
    158 	u_int16_t	r_minbase;	/* bits 23-8 */
    159 	u_int16_t	r_maxbase;	/* bits 23-8 */
    160 	u_int16_t	r_align;	/* 0 == 0x10000 */
    161 	u_int16_t	r_len;		/* bits 23-8 */
    162 } __attribute__((__packed__));
    163 
    164 struct pnpmem32rangeres {
    165 	struct pnplargeres	r_hdr;
    166 	u_int8_t	r_flags;
    167 	u_int32_t	r_minbase;
    168 	u_int32_t	r_maxbase;
    169 	u_int32_t	r_align;
    170 	u_int32_t	r_len;
    171 } __attribute__((__packed__));
    172 
    173 struct pnpfixedmem32rangeres {
    174 	struct pnplargeres	r_hdr;
    175 	u_int8_t	r_flags;
    176 	u_int32_t	r_base;
    177 	u_int32_t	r_len;
    178 } __attribute__((__packed__));
    179 
    180 struct pnpansiidentres {
    181 	struct pnplargeres	r_hdr;
    182 	u_int8_t	r_id[1];	/* variable */
    183 } __attribute__((__packed__));
    184 
    185 struct pnpdevidres {
    186 	u_int8_t	r_hdr;
    187 	u_int32_t	r_id;
    188 	u_int16_t	r_flags;
    189 } __attribute__((__packed__));
    190 
    191 struct pnpcompatres {
    192 	u_int8_t	r_hdr;
    193 	u_int32_t	r_id;
    194 } __attribute__((__packed__));
    195 
    196 struct pnpirqres {
    197 	u_int8_t	r_hdr;
    198 	u_int16_t	r_mask;
    199 	u_int8_t	r_info;		/* may not be present */
    200 } __attribute__((__packed__));
    201 
    202 struct pnpdmares {
    203 	u_int8_t	r_hdr;
    204 	u_int8_t	r_mask;
    205 	u_int8_t	r_flags;
    206 } __attribute__((__packed__));
    207 
    208 struct pnpportres {
    209 	u_int8_t	r_hdr;
    210 	u_int8_t	r_flags;
    211 	u_int16_t	r_minbase;
    212 	u_int16_t	r_maxbase;
    213 	u_int8_t	r_align;
    214 	u_int8_t	r_len;
    215 } __attribute__((__packed__));
    216 
    217 struct pnpfixedportres {
    218 	u_int8_t	r_hdr;
    219 	u_int16_t	r_base;
    220 	u_int8_t	r_len;
    221 } __attribute__((__packed__));
    222 
    223 struct pnpdepstartres {
    224 	u_int8_t	r_hdr;
    225 	u_int8_t	r_pri;	/* may not be present */
    226 } __attribute__((__packed__));
    227 
    228 struct pnpendres {
    229 	u_int8_t	r_hdr;
    230 	u_int8_t	r_cksum;
    231 } __attribute__((__packed__));
    232