pnpbios.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * pnpbios.h - contains local definitions
  3. */
  4. /*
  5. * Include file for the interface to a PnP BIOS
  6. *
  7. * Original BIOS code (C) 1998 Christian Schmidt (chr.schmidt@tu-bs.de)
  8. * PnP handler parts (c) 1998 Tom Lees <tom@lpsg.demon.co.uk>
  9. * Minor reorganizations by David Hinds <dahinds@users.sourceforge.net>
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2, or (at your option) any
  14. * later version.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  24. */
  25. /*
  26. * Return codes
  27. */
  28. #define PNP_SUCCESS 0x00
  29. #define PNP_NOT_SET_STATICALLY 0x7f
  30. #define PNP_UNKNOWN_FUNCTION 0x81
  31. #define PNP_FUNCTION_NOT_SUPPORTED 0x82
  32. #define PNP_INVALID_HANDLE 0x83
  33. #define PNP_BAD_PARAMETER 0x84
  34. #define PNP_SET_FAILED 0x85
  35. #define PNP_EVENTS_NOT_PENDING 0x86
  36. #define PNP_SYSTEM_NOT_DOCKED 0x87
  37. #define PNP_NO_ISA_PNP_CARDS 0x88
  38. #define PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES 0x89
  39. #define PNP_CONFIG_CHANGE_FAILED_NO_BATTERY 0x8a
  40. #define PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT 0x8b
  41. #define PNP_BUFFER_TOO_SMALL 0x8c
  42. #define PNP_USE_ESCD_SUPPORT 0x8d
  43. #define PNP_MESSAGE_NOT_SUPPORTED 0x8e
  44. #define PNP_HARDWARE_ERROR 0x8f
  45. #define ESCD_SUCCESS 0x00
  46. #define ESCD_IO_ERROR_READING 0x55
  47. #define ESCD_INVALID 0x56
  48. #define ESCD_BUFFER_TOO_SMALL 0x59
  49. #define ESCD_NVRAM_TOO_SMALL 0x5a
  50. #define ESCD_FUNCTION_NOT_SUPPORTED 0x81
  51. /*
  52. * Events that can be received by "get event"
  53. */
  54. #define PNPEV_ABOUT_TO_CHANGE_CONFIG 0x0001
  55. #define PNPEV_DOCK_CHANGED 0x0002
  56. #define PNPEV_SYSTEM_DEVICE_CHANGED 0x0003
  57. #define PNPEV_CONFIG_CHANGED_FAILED 0x0004
  58. #define PNPEV_UNKNOWN_SYSTEM_EVENT 0xffff
  59. /* 0x8000 through 0xfffe are OEM defined */
  60. /*
  61. * Messages that should be sent through "send message"
  62. */
  63. #define PNPMSG_OK 0x00
  64. #define PNPMSG_ABORT 0x01
  65. #define PNPMSG_UNDOCK_DEFAULT_ACTION 0x40
  66. #define PNPMSG_POWER_OFF 0x41
  67. #define PNPMSG_PNP_OS_ACTIVE 0x42
  68. #define PNPMSG_PNP_OS_INACTIVE 0x43
  69. /*
  70. * Plug and Play BIOS flags
  71. */
  72. #define PNPBIOS_NO_DISABLE 0x0001
  73. #define PNPBIOS_NO_CONFIG 0x0002
  74. #define PNPBIOS_OUTPUT 0x0004
  75. #define PNPBIOS_INPUT 0x0008
  76. #define PNPBIOS_BOOTABLE 0x0010
  77. #define PNPBIOS_DOCK 0x0020
  78. #define PNPBIOS_REMOVABLE 0x0040
  79. #define pnpbios_is_static(x) (((x)->flags & 0x0100) == 0x0000)
  80. #define pnpbios_is_dynamic(x) ((x)->flags & 0x0080)
  81. /*
  82. * Function Parameters
  83. */
  84. #define PNPMODE_STATIC 1
  85. #define PNPMODE_DYNAMIC 0
  86. /* 0x8000 through 0xffff are OEM defined */
  87. #pragma pack(1)
  88. struct pnp_dev_node_info {
  89. __u16 no_nodes;
  90. __u16 max_node_size;
  91. };
  92. struct pnp_docking_station_info {
  93. __u32 location_id;
  94. __u32 serial;
  95. __u16 capabilities;
  96. };
  97. struct pnp_isa_config_struc {
  98. __u8 revision;
  99. __u8 no_csns;
  100. __u16 isa_rd_data_port;
  101. __u16 reserved;
  102. };
  103. struct escd_info_struc {
  104. __u16 min_escd_write_size;
  105. __u16 escd_size;
  106. __u32 nv_storage_base;
  107. };
  108. struct pnp_bios_node {
  109. __u16 size;
  110. __u8 handle;
  111. __u32 eisa_id;
  112. __u8 type_code[3];
  113. __u16 flags;
  114. __u8 data[0];
  115. };
  116. #pragma pack()
  117. /* non-exported */
  118. extern struct pnp_dev_node_info node_info;
  119. extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
  120. extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
  121. struct pnp_bios_node *data);
  122. extern int pnp_bios_set_dev_node(u8 nodenum, char config,
  123. struct pnp_bios_node *data);
  124. extern int pnp_bios_get_stat_res(char *info);
  125. extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
  126. extern int pnp_bios_escd_info(struct escd_info_struc *data);
  127. extern int pnp_bios_read_escd(char *data, u32 nvram_base);
  128. extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
  129. #pragma pack(1)
  130. union pnp_bios_install_struct {
  131. struct {
  132. u32 signature; /* "$PnP" */
  133. u8 version; /* in BCD */
  134. u8 length; /* length in bytes, currently 21h */
  135. u16 control; /* system capabilities */
  136. u8 checksum; /* all bytes must add up to 0 */
  137. u32 eventflag; /* phys. address of the event flag */
  138. u16 rmoffset; /* real mode entry point */
  139. u16 rmcseg;
  140. u16 pm16offset; /* 16 bit protected mode entry */
  141. u32 pm16cseg;
  142. u32 deviceID; /* EISA encoded system ID or 0 */
  143. u16 rmdseg; /* real mode data segment */
  144. u32 pm16dseg; /* 16 bit pm data segment base */
  145. } fields;
  146. char chars[0x21]; /* To calculate the checksum */
  147. };
  148. #pragma pack()
  149. extern int pnp_bios_present(void);
  150. extern int pnpbios_dont_use_current_config;
  151. extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node);
  152. extern int pnpbios_read_resources_from_node(struct pnp_dev *dev, struct pnp_bios_node *node);
  153. extern int pnpbios_write_resources_to_node(struct pnp_dev *dev, struct pnp_bios_node *node);
  154. extern void pnpid32_to_pnpid(u32 id, char *str);
  155. extern void pnpbios_print_status(const char * module, u16 status);
  156. extern void pnpbios_calls_init(union pnp_bios_install_struct * header);
  157. #ifdef CONFIG_PNPBIOS_PROC_FS
  158. extern int pnpbios_interface_attach_device(struct pnp_bios_node * node);
  159. extern int pnpbios_proc_init (void);
  160. extern void pnpbios_proc_exit (void);
  161. #else
  162. static inline int pnpbios_interface_attach_device(struct pnp_bios_node * node) { return 0; }
  163. static inline int pnpbios_proc_init (void) { return 0; }
  164. static inline void pnpbios_proc_exit (void) { ; }
  165. #endif /* CONFIG_PNPBIOS_PROC_FS */