Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * pnpbios.h - contains local definitions
0004  */
0005 
0006 /*
0007  * Include file for the interface to a PnP BIOS
0008  *
0009  * Original BIOS code (C) 1998 Christian Schmidt (chr.schmidt@tu-bs.de)
0010  * PnP handler parts (c) 1998 Tom Lees <tom@lpsg.demon.co.uk>
0011  * Minor reorganizations by David Hinds <dahinds@users.sourceforge.net>
0012  */
0013 
0014 /*
0015  * Return codes
0016  */
0017 #define PNP_SUCCESS                     0x00
0018 #define PNP_NOT_SET_STATICALLY          0x7f
0019 #define PNP_UNKNOWN_FUNCTION            0x81
0020 #define PNP_FUNCTION_NOT_SUPPORTED      0x82
0021 #define PNP_INVALID_HANDLE              0x83
0022 #define PNP_BAD_PARAMETER               0x84
0023 #define PNP_SET_FAILED                  0x85
0024 #define PNP_EVENTS_NOT_PENDING          0x86
0025 #define PNP_SYSTEM_NOT_DOCKED           0x87
0026 #define PNP_NO_ISA_PNP_CARDS            0x88
0027 #define PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES 0x89
0028 #define PNP_CONFIG_CHANGE_FAILED_NO_BATTERY 0x8a
0029 #define PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT 0x8b
0030 #define PNP_BUFFER_TOO_SMALL            0x8c
0031 #define PNP_USE_ESCD_SUPPORT            0x8d
0032 #define PNP_MESSAGE_NOT_SUPPORTED       0x8e
0033 #define PNP_HARDWARE_ERROR              0x8f
0034 
0035 #define ESCD_SUCCESS                    0x00
0036 #define ESCD_IO_ERROR_READING           0x55
0037 #define ESCD_INVALID                    0x56
0038 #define ESCD_BUFFER_TOO_SMALL           0x59
0039 #define ESCD_NVRAM_TOO_SMALL            0x5a
0040 #define ESCD_FUNCTION_NOT_SUPPORTED     0x81
0041 
0042 /*
0043  * Events that can be received by "get event"
0044  */
0045 #define PNPEV_ABOUT_TO_CHANGE_CONFIG    0x0001
0046 #define PNPEV_DOCK_CHANGED      0x0002
0047 #define PNPEV_SYSTEM_DEVICE_CHANGED 0x0003
0048 #define PNPEV_CONFIG_CHANGED_FAILED 0x0004
0049 #define PNPEV_UNKNOWN_SYSTEM_EVENT  0xffff
0050 /* 0x8000 through 0xfffe are OEM defined */
0051 
0052 /*
0053  * Messages that should be sent through "send message"
0054  */
0055 #define PNPMSG_OK           0x00
0056 #define PNPMSG_ABORT            0x01
0057 #define PNPMSG_UNDOCK_DEFAULT_ACTION    0x40
0058 #define PNPMSG_POWER_OFF        0x41
0059 #define PNPMSG_PNP_OS_ACTIVE        0x42
0060 #define PNPMSG_PNP_OS_INACTIVE      0x43
0061 
0062 /*
0063  * Plug and Play BIOS flags
0064  */
0065 #define PNPBIOS_NO_DISABLE      0x0001
0066 #define PNPBIOS_NO_CONFIG       0x0002
0067 #define PNPBIOS_OUTPUT          0x0004
0068 #define PNPBIOS_INPUT           0x0008
0069 #define PNPBIOS_BOOTABLE        0x0010
0070 #define PNPBIOS_DOCK            0x0020
0071 #define PNPBIOS_REMOVABLE       0x0040
0072 #define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000)
0073 #define pnpbios_is_dynamic(x) ((x)->flags & 0x0080)
0074 
0075 /*
0076  * Function Parameters
0077  */
0078 #define PNPMODE_STATIC 1
0079 #define PNPMODE_DYNAMIC 0
0080 
0081 /* 0x8000 through 0xffff are OEM defined */
0082 
0083 #pragma pack(1)
0084 struct pnp_dev_node_info {
0085     __u16 no_nodes;
0086     __u16 max_node_size;
0087 };
0088 struct pnp_docking_station_info {
0089     __u32 location_id;
0090     __u32 serial;
0091     __u16 capabilities;
0092 };
0093 struct pnp_isa_config_struc {
0094     __u8 revision;
0095     __u8 no_csns;
0096     __u16 isa_rd_data_port;
0097     __u16 reserved;
0098 };
0099 struct escd_info_struc {
0100     __u16 min_escd_write_size;
0101     __u16 escd_size;
0102     __u32 nv_storage_base;
0103 };
0104 struct pnp_bios_node {
0105     __u16 size;
0106     __u8 handle;
0107     __u32 eisa_id;
0108     __u8 type_code[3];
0109     __u16 flags;
0110     __u8 data[];
0111 };
0112 #pragma pack()
0113 
0114 /* non-exported */
0115 extern struct pnp_dev_node_info node_info;
0116 
0117 extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
0118 extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
0119                  struct pnp_bios_node *data);
0120 extern int pnp_bios_set_dev_node(u8 nodenum, char config,
0121                  struct pnp_bios_node *data);
0122 extern int pnp_bios_get_stat_res(char *info);
0123 extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
0124 extern int pnp_bios_escd_info(struct escd_info_struc *data);
0125 extern int pnp_bios_read_escd(char *data, u32 nvram_base);
0126 extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
0127 
0128 #pragma pack(1)
0129 union pnp_bios_install_struct {
0130     struct {
0131         u32 signature;    /* "$PnP" */
0132         u8 version;   /* in BCD */
0133         u8 length;    /* length in bytes, currently 21h */
0134         u16 control;      /* system capabilities */
0135         u8 checksum;      /* all bytes must add up to 0 */
0136 
0137         u32 eventflag;    /* phys. address of the event flag */
0138         u16 rmoffset;     /* real mode entry point */
0139         u16 rmcseg;
0140         u16 pm16offset;   /* 16 bit protected mode entry */
0141         u32 pm16cseg;
0142         u32 deviceID;     /* EISA encoded system ID or 0 */
0143         u16 rmdseg;   /* real mode data segment */
0144         u32 pm16dseg;     /* 16 bit pm data segment base */
0145     } fields;
0146     char chars[0x21];     /* To calculate the checksum */
0147 };
0148 #pragma pack()
0149 
0150 extern int pnp_bios_present(void);
0151 extern int  pnpbios_dont_use_current_config;
0152 
0153 extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node);
0154 extern int pnpbios_read_resources_from_node(struct pnp_dev *dev, struct pnp_bios_node *node);
0155 extern int pnpbios_write_resources_to_node(struct pnp_dev *dev, struct pnp_bios_node *node);
0156 extern void pnpid32_to_pnpid(u32 id, char *str);
0157 
0158 extern void pnpbios_print_status(const char * module, u16 status);
0159 extern void pnpbios_calls_init(union pnp_bios_install_struct * header);
0160 
0161 #ifdef CONFIG_PNPBIOS_PROC_FS
0162 extern int pnpbios_interface_attach_device(struct pnp_bios_node * node);
0163 extern int pnpbios_proc_init (void);
0164 extern void pnpbios_proc_exit (void);
0165 #else
0166 static inline int pnpbios_interface_attach_device(struct pnp_bios_node * node) { return 0; }
0167 static inline int pnpbios_proc_init (void) { return 0; }
0168 static inline void pnpbios_proc_exit (void) { ; }
0169 #endif /* CONFIG_PNPBIOS_PROC_FS */