選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

isapnp.h 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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 "stdint.h"
  38. #include "nic.h"
  39. #include "isa_ids.h"
  40. /*
  41. * ISAPnP constants
  42. *
  43. */
  44. /* Port addresses */
  45. #define ISAPNP_ADDRESS 0x279
  46. #define ISAPNP_WRITE_DATA 0xa79
  47. #define ISAPNP_READ_PORT_MIN 0x213 /* ISAPnP spec says 0x203, but
  48. * Linux ISAPnP starts at
  49. * 0x213 with no explanatory
  50. * comment. 0x203 probably
  51. * clashes with something. */
  52. #define ISAPNP_READ_PORT_MAX 0x3ff
  53. #define ISAPNP_READ_PORT_STEP 0x10 /* Can be any multiple of 4
  54. * according to the spec, but
  55. * since ISA I/O addresses are
  56. * allocated in blocks of 16,
  57. * it makes no sense to use
  58. * any value less than 16.
  59. */
  60. /* Registers */
  61. #define ISAPNP_READPORT 0x00
  62. #define ISAPNP_SERIALISOLATION 0x01
  63. #define ISAPNP_CONFIGCONTROL 0x02
  64. #define ISAPNP_WAKE 0x03
  65. #define ISAPNP_RESOURCEDATA 0x04
  66. #define ISAPNP_STATUS 0x05
  67. #define ISAPNP_CARDSELECTNUMBER 0x06
  68. #define ISAPNP_LOGICALDEVICENUMBER 0x07
  69. #define ISAPNP_ACTIVATE 0x30
  70. #define ISAPNP_IORANGECHECK 0x31
  71. #define ISAPNP_IOBASE(n) ( 0x60 + ( (n) * 2 ) )
  72. #define ISAPNP_IRQNO(n) ( 0x70 + ( (n) * 2 ) )
  73. #define ISAPNP_IRQTYPE(n) ( 0x71 + ( (n) * 2 ) )
  74. /* Bits in the CONFIGCONTROL register */
  75. #define ISAPNP_CONFIG_RESET ( 1 << 0 )
  76. #define ISAPNP_CONFIG_WAIT_FOR_KEY ( 1 << 1 )
  77. #define ISAPNP_CONFIG_RESET_CSN ( 1 << 2 )
  78. #define ISAPNP_CONFIG_RESET_DRV ( ISAPNP_CONFIG_RESET | \
  79. ISAPNP_CONFIG_WAIT_FOR_KEY | \
  80. ISAPNP_CONFIG_RESET_CSN )
  81. /* The LFSR used for the initiation key and for checksumming */
  82. #define ISAPNP_LFSR_SEED 0x6a
  83. /* Small tags */
  84. #define ISAPNP_IS_SMALL_TAG(tag) ( ! ( (tag) & 0x80 ) )
  85. #define ISAPNP_SMALL_TAG_NAME(tag) ( ( (tag) >> 3 ) & 0xf )
  86. #define ISAPNP_SMALL_TAG_LEN(tag) ( ( (tag) & 0x7 ) )
  87. #define ISAPNP_TAG_PNPVERNO 0x01
  88. #define ISAPNP_TAG_LOGDEVID 0x02
  89. #define ISAPNP_TAG_COMPATDEVID 0x03
  90. #define ISAPNP_TAG_IRQ 0x04
  91. #define ISAPNP_TAG_DMA 0x05
  92. #define ISAPNP_TAG_STARTDEP 0x06
  93. #define ISAPNP_TAG_ENDDEP 0x07
  94. #define ISAPNP_TAG_IOPORT 0x08
  95. #define ISAPNP_TAG_FIXEDIO 0x09
  96. #define ISAPNP_TAG_RSVDSHORTA 0x0A
  97. #define ISAPNP_TAG_RSVDSHORTB 0x0B
  98. #define ISAPNP_TAG_RSVDSHORTC 0x0C
  99. #define ISAPNP_TAG_RSVDSHORTD 0x0D
  100. #define ISAPNP_TAG_VENDORSHORT 0x0E
  101. #define ISAPNP_TAG_END 0x0F
  102. /* Large tags */
  103. #define ISAPNP_IS_LARGE_TAG(tag) ( ( (tag) & 0x80 ) )
  104. #define ISAPNP_LARGE_TAG_NAME(tag) (tag)
  105. #define ISAPNP_TAG_MEMRANGE 0x81
  106. #define ISAPNP_TAG_ANSISTR 0x82
  107. #define ISAPNP_TAG_UNICODESTR 0x83
  108. #define ISAPNP_TAG_VENDORLONG 0x84
  109. #define ISAPNP_TAG_MEM32RANGE 0x85
  110. #define ISAPNP_TAG_FIXEDMEM32RANGE 0x86
  111. #define ISAPNP_TAG_RSVDLONG0 0xF0
  112. #define ISAPNP_TAG_RSVDLONG1 0xF1
  113. #define ISAPNP_TAG_RSVDLONG2 0xF2
  114. #define ISAPNP_TAG_RSVDLONG3 0xF3
  115. #define ISAPNP_TAG_RSVDLONG4 0xF4
  116. #define ISAPNP_TAG_RSVDLONG5 0xF5
  117. #define ISAPNP_TAG_RSVDLONG6 0xF6
  118. #define ISAPNP_TAG_RSVDLONG7 0xF7
  119. #define ISAPNP_TAG_RSVDLONG8 0xF8
  120. #define ISAPNP_TAG_RSVDLONG9 0xF9
  121. #define ISAPNP_TAG_RSVDLONGA 0xFA
  122. #define ISAPNP_TAG_RSVDLONGB 0xFB
  123. #define ISAPNP_TAG_RSVDLONGC 0xFC
  124. #define ISAPNP_TAG_RSVDLONGD 0xFD
  125. #define ISAPNP_TAG_RSVDLONGE 0xFE
  126. #define ISAPNP_TAG_RSVDLONGF 0xFF
  127. #define ISAPNP_TAG_PSEUDO_NEWBOARD 0x100
  128. /*
  129. * An ISAPnP serial identifier
  130. *
  131. */
  132. struct isapnp_identifier {
  133. uint16_t vendor_id;
  134. uint16_t prod_id;
  135. uint32_t serial;
  136. uint8_t checksum;
  137. } __attribute__ (( packed ));
  138. /*
  139. * An ISAPnP logical device ID structure
  140. *
  141. */
  142. struct isapnp_logdevid {
  143. uint16_t vendor_id;
  144. uint16_t prod_id;
  145. uint16_t flags;
  146. } __attribute__ (( packed ));
  147. /*
  148. * A location on an ISAPnP bus
  149. *
  150. */
  151. struct isapnp_loc {
  152. uint8_t csn;
  153. uint8_t logdev;
  154. };
  155. /*
  156. * A physical ISAPnP device
  157. *
  158. */
  159. struct isapnp_device {
  160. const char *name;
  161. uint8_t csn;
  162. uint8_t logdev;
  163. uint16_t vendor_id;
  164. uint16_t prod_id;
  165. uint16_t ioaddr;
  166. uint8_t irqno;
  167. };
  168. /*
  169. * An individual ISAPnP device identified by ID
  170. *
  171. */
  172. struct isapnp_id {
  173. const char *name;
  174. uint16_t vendor_id, prod_id;
  175. };
  176. /*
  177. * An ISAPnP driver, with a device ID (struct isapnp_id) table.
  178. *
  179. */
  180. struct isapnp_driver {
  181. struct isapnp_id *ids;
  182. unsigned int id_count;
  183. };
  184. /*
  185. * Define an ISAPnP driver
  186. *
  187. */
  188. #define ISAPNP_DRIVER( _name, _ids ) \
  189. static struct isapnp_driver _name = { \
  190. .ids = _ids, \
  191. .id_count = sizeof ( _ids ) / sizeof ( _ids[0] ), \
  192. }
  193. /*
  194. * Functions in isapnp.c
  195. *
  196. */
  197. extern void isapnp_device_activation ( struct isapnp_device *isapnp,
  198. int activation );
  199. extern void isapnp_fill_nic ( struct nic *nic, struct isapnp_device *isapnp );
  200. static inline void activate_isapnp_device ( struct isapnp_device *isapnp ) {
  201. isapnp_device_activation ( isapnp, 1 );
  202. }
  203. static inline void deactivate_isapnp_device ( struct isapnp_device *isapnp ) {
  204. isapnp_device_activation ( isapnp, 0 );
  205. }
  206. /*
  207. * ISAPnP bus global definition
  208. *
  209. */
  210. extern struct bus_driver isapnp_driver;
  211. /*
  212. * ISAPnP read port. ROM prefix may be able to set this address.
  213. *
  214. */
  215. extern uint16_t isapnp_read_port;
  216. #endif /* ISAPNP_H */