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