You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

isapnp.h 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /**************************************************************************
  2. *
  3. * isapnp.h -- Etherboot isapnp support for the 3Com 3c515
  4. * Written 2002-2003 by Timothy Legge <tlegge@rogers.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. * Portions of this code:
  21. * Copyright (C) 2001 P.J.H.Fox (fox@roestock.demon.co.uk)
  22. *
  23. *
  24. *
  25. * REVISION HISTORY:
  26. * ================
  27. * Version 0.1 April 26, 2002 TJL
  28. * Version 0.2 01/08/2003 TJL Renamed from 3c515_isapnp.h
  29. *
  30. *
  31. * Generalised into an ISAPnP bus that can be used by more than just
  32. * the 3c515 by Michael Brown <mbrown@fensystems.co.uk>
  33. *
  34. ***************************************************************************/
  35. #ifndef ISAPNP_H
  36. #define ISAPNP_H
  37. #include "isa_ids.h"
  38. #include "dev.h"
  39. /*
  40. * ISAPnP constants
  41. *
  42. */
  43. /* Port addresses */
  44. #define ISAPNP_ADDRESS 0x279
  45. #define ISAPNP_WRITE_DATA 0xa79
  46. #define ISAPNP_READ_PORT_MIN 0x213 /* ISAPnP spec says 0x203, but
  47. * Linux ISAPnP starts at
  48. * 0x213 with no explanatory
  49. * comment. 0x203 probably
  50. * clashes with something. */
  51. #define ISAPNP_READ_PORT_MAX 0x3ff
  52. #define ISAPNP_READ_PORT_STEP 0x08 /* Can be any multiple of 4 */
  53. /* Registers */
  54. #define ISAPNP_READPORT 0x00
  55. #define ISAPNP_SERIALISOLATION 0x01
  56. #define ISAPNP_CONFIGCONTROL 0x02
  57. #define ISAPNP_WAKE 0x03
  58. #define ISAPNP_RESOURCEDATA 0x04
  59. #define ISAPNP_STATUS 0x05
  60. #define ISAPNP_CARDSELECTNUMBER 0x06
  61. #define ISAPNP_LOGICALDEVICENUMBER 0x07
  62. #define ISAPNP_ACTIVATE 0x30
  63. #define ISAPNP_IORANGECHECK 0x31
  64. /* Bits in the CONFIGCONTROL register */
  65. #define ISAPNP_CONFIG_RESET ( 1 << 0 )
  66. #define ISAPNP_CONFIG_WAIT_FOR_KEY ( 1 << 1 )
  67. #define ISAPNP_CONFIG_RESET_CSN ( 1 << 2 )
  68. #define ISAPNP_CONFIG_RESET_DRV ( ISAPNP_CONFIG_RESET | \
  69. ISAPNP_CONFIG_WAIT_FOR_KEY | \
  70. ISAPNP_CONFIG_RESET_CSN )
  71. /* The LFSR used for the initiation key and for checksumming */
  72. #define ISAPNP_LFSR_SEED 0x6a
  73. /* Short Tags */
  74. #define PnPVerNo_TAG 0x01
  75. #define LogDevId_TAG 0x02
  76. #define CompatDevId_TAG 0x03
  77. #define IRQ_TAG 0x04
  78. #define DMA_TAG 0x05
  79. #define StartDep_TAG 0x06
  80. #define EndDep_TAG 0x07
  81. #define IOport_TAG 0x08
  82. #define FixedIO_TAG 0x09
  83. #define RsvdShortA_TAG 0x0A
  84. #define RsvdShortB_TAG 0x0B
  85. #define RsvdShortC_TAG 0x0C
  86. #define RsvdShortD_TAG 0x0D
  87. #define VendorShort_TAG 0x0E
  88. #define End_TAG 0x0F
  89. /* Long Tags */
  90. #define MemRange_TAG 0x81
  91. #define ANSIstr_TAG 0x82
  92. #define UNICODEstr_TAG 0x83
  93. #define VendorLong_TAG 0x84
  94. #define Mem32Range_TAG 0x85
  95. #define FixedMem32Range_TAG 0x86
  96. #define RsvdLong0_TAG 0xF0
  97. #define RsvdLong1_TAG 0xF1
  98. #define RsvdLong2_TAG 0xF2
  99. #define RsvdLong3_TAG 0xF3
  100. #define RsvdLong4_TAG 0xF4
  101. #define RsvdLong5_TAG 0xF5
  102. #define RsvdLong6_TAG 0xF6
  103. #define RsvdLong7_TAG 0xF7
  104. #define RsvdLong8_TAG 0xF8
  105. #define RsvdLong9_TAG 0xF9
  106. #define RsvdLongA_TAG 0xFA
  107. #define RsvdLongB_TAG 0xFB
  108. #define RsvdLongC_TAG 0xFC
  109. #define RsvdLongD_TAG 0xFD
  110. #define RsvdLongE_TAG 0xFE
  111. #define RsvdLongF_TAG 0xFF
  112. #define NewBoard_PSEUDOTAG 0x100
  113. /*
  114. * An ISAPnP serial identifier
  115. *
  116. */
  117. union isapnp_identifier {
  118. char bytes[9];
  119. struct {
  120. uint16_t vendor_id;
  121. uint16_t product_id;
  122. uint32_t serial;
  123. uint8_t checksum;
  124. } __attribute__ (( packed ));
  125. } __attribute__ (( packed ));
  126. /*
  127. * A physical ISAPnP device
  128. *
  129. */
  130. struct isapnp_device {
  131. char *magic; /* must be first */
  132. const char *name;
  133. unsigned char csn;
  134. uint16_t vendor_id;
  135. uint16_t prod_id;
  136. int already_tried;
  137. };
  138. /*
  139. * An individual ISAPnP device identified by ID
  140. *
  141. */
  142. struct isapnp_id {
  143. const char *name;
  144. uint16_t vendor_id, prod_id;
  145. };
  146. /*
  147. * An ISAPnP driver, with a device ID (struct isapnp_id) table.
  148. *
  149. */
  150. struct isapnp_driver {
  151. const char *name;
  152. struct isapnp_id *ids;
  153. unsigned int id_count;
  154. };
  155. /*
  156. * Define an ISAPnP driver
  157. *
  158. */
  159. #define ISAPNP_DRIVER( driver_name, isapnp_ids ) { \
  160. .name = driver_name, \
  161. .ids = isapnp_ids, \
  162. .id_count = sizeof ( isapnp_ids ) / sizeof ( isapnp_ids[0] ), \
  163. }
  164. /*
  165. * Functions in isapnp.c
  166. *
  167. */
  168. extern int find_isapnp_device ( struct isapnp_device *isapnp,
  169. struct isapnp_driver *driver );
  170. extern int find_isapnp_boot_device ( struct dev *dev,
  171. struct isapnp_driver *driver );
  172. #endif /* ISAPNP_H */