blob: 329192adc9dd949d27dee6105c27b2956fd139b1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Include file for the interface to a PnP BIOS
3 *
4 * Original BIOS code (C) 1998 Christian Schmidt (chr.schmidt@tu-bs.de)
5 * PnP handler parts (c) 1998 Tom Lees <tom@lpsg.demon.co.uk>
6 * Minor reorganizations by David Hinds <dahinds@users.sourceforge.net>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef _LINUX_PNPBIOS_H
24#define _LINUX_PNPBIOS_H
25
26#ifdef __KERNEL__
27
28#include <linux/types.h>
29#include <linux/pnp.h>
30
31/*
32 * Return codes
33 */
34#define PNP_SUCCESS 0x00
35#define PNP_NOT_SET_STATICALLY 0x7f
36#define PNP_UNKNOWN_FUNCTION 0x81
37#define PNP_FUNCTION_NOT_SUPPORTED 0x82
38#define PNP_INVALID_HANDLE 0x83
39#define PNP_BAD_PARAMETER 0x84
40#define PNP_SET_FAILED 0x85
41#define PNP_EVENTS_NOT_PENDING 0x86
42#define PNP_SYSTEM_NOT_DOCKED 0x87
43#define PNP_NO_ISA_PNP_CARDS 0x88
44#define PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES 0x89
45#define PNP_CONFIG_CHANGE_FAILED_NO_BATTERY 0x8a
46#define PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT 0x8b
47#define PNP_BUFFER_TOO_SMALL 0x8c
48#define PNP_USE_ESCD_SUPPORT 0x8d
49#define PNP_MESSAGE_NOT_SUPPORTED 0x8e
50#define PNP_HARDWARE_ERROR 0x8f
51
52#define ESCD_SUCCESS 0x00
53#define ESCD_IO_ERROR_READING 0x55
54#define ESCD_INVALID 0x56
55#define ESCD_BUFFER_TOO_SMALL 0x59
56#define ESCD_NVRAM_TOO_SMALL 0x5a
57#define ESCD_FUNCTION_NOT_SUPPORTED 0x81
58
59/*
60 * Events that can be received by "get event"
61 */
62#define PNPEV_ABOUT_TO_CHANGE_CONFIG 0x0001
63#define PNPEV_DOCK_CHANGED 0x0002
64#define PNPEV_SYSTEM_DEVICE_CHANGED 0x0003
65#define PNPEV_CONFIG_CHANGED_FAILED 0x0004
66#define PNPEV_UNKNOWN_SYSTEM_EVENT 0xffff
67/* 0x8000 through 0xfffe are OEM defined */
68
69/*
70 * Messages that should be sent through "send message"
71 */
72#define PNPMSG_OK 0x00
73#define PNPMSG_ABORT 0x01
74#define PNPMSG_UNDOCK_DEFAULT_ACTION 0x40
75#define PNPMSG_POWER_OFF 0x41
76#define PNPMSG_PNP_OS_ACTIVE 0x42
77#define PNPMSG_PNP_OS_INACTIVE 0x43
78
79/*
80 * Plug and Play BIOS flags
81 */
82#define PNPBIOS_NO_DISABLE 0x0001
83#define PNPBIOS_NO_CONFIG 0x0002
84#define PNPBIOS_OUTPUT 0x0004
85#define PNPBIOS_INPUT 0x0008
86#define PNPBIOS_BOOTABLE 0x0010
87#define PNPBIOS_DOCK 0x0020
88#define PNPBIOS_REMOVABLE 0x0040
89#define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000)
90#define pnpbios_is_dynamic(x) ((x)->flags & 0x0080)
91
92/*
93 * Function Parameters
94 */
95#define PNPMODE_STATIC 1
96#define PNPMODE_DYNAMIC 0
97
98/* 0x8000 through 0xffff are OEM defined */
99
100#pragma pack(1)
101struct pnp_dev_node_info {
Bjorn Helgaas9dd78462007-07-26 10:41:20 -0700102 __u16 no_nodes;
103 __u16 max_node_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104};
105struct pnp_docking_station_info {
Bjorn Helgaas9dd78462007-07-26 10:41:20 -0700106 __u32 location_id;
107 __u32 serial;
108 __u16 capabilities;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109};
110struct pnp_isa_config_struc {
Bjorn Helgaas9dd78462007-07-26 10:41:20 -0700111 __u8 revision;
112 __u8 no_csns;
113 __u16 isa_rd_data_port;
114 __u16 reserved;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115};
116struct escd_info_struc {
Bjorn Helgaas9dd78462007-07-26 10:41:20 -0700117 __u16 min_escd_write_size;
118 __u16 escd_size;
119 __u32 nv_storage_base;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120};
121struct pnp_bios_node {
Bjorn Helgaas9dd78462007-07-26 10:41:20 -0700122 __u16 size;
123 __u8 handle;
124 __u32 eisa_id;
125 __u8 type_code[3];
126 __u16 flags;
127 __u8 data[0];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128};
129#pragma pack()
130
131#ifdef CONFIG_PNPBIOS
132
133/* non-exported */
134extern struct pnp_dev_node_info node_info;
135
Bjorn Helgaas9dd78462007-07-26 10:41:20 -0700136extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
Bjorn Helgaas07d4e9a2007-07-26 10:41:21 -0700137extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
Bjorn Helgaas9dd78462007-07-26 10:41:20 -0700138 struct pnp_bios_node *data);
139extern int pnp_bios_set_dev_node(u8 nodenum, char config,
140 struct pnp_bios_node *data);
141extern int pnp_bios_get_stat_res(char *info);
142extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
143extern int pnp_bios_escd_info(struct escd_info_struc *data);
144extern int pnp_bios_read_escd(char *data, u32 nvram_base);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
147#endif /* CONFIG_PNPBIOS */
148
149#endif /* __KERNEL__ */
150
151#endif /* _LINUX_PNPBIOS_H */