tms380tr.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  1. /*
  2. * tms380tr.h: TI TMS380 Token Ring driver for Linux
  3. *
  4. * Authors:
  5. * - Christoph Goos <cgoos@syskonnect.de>
  6. * - Adam Fritzler <mid@auk.cx>
  7. */
  8. #ifndef __LINUX_TMS380TR_H
  9. #define __LINUX_TMS380TR_H
  10. #ifdef __KERNEL__
  11. #include <linux/interrupt.h>
  12. /* module prototypes */
  13. int tms380tr_open(struct net_device *dev);
  14. int tms380tr_close(struct net_device *dev);
  15. irqreturn_t tms380tr_interrupt(int irq, void *dev_id, struct pt_regs *regs);
  16. int tmsdev_init(struct net_device *dev, struct device *pdev);
  17. void tmsdev_term(struct net_device *dev);
  18. void tms380tr_wait(unsigned long time);
  19. #define TMS380TR_MAX_ADAPTERS 7
  20. #define SEND_TIMEOUT 10*HZ
  21. #define TR_RCF_LONGEST_FRAME_MASK 0x0070
  22. #define TR_RCF_FRAME4K 0x0030
  23. /*------------------------------------------------------------------*/
  24. /* Bit order for adapter communication with DMA */
  25. /* -------------------------------------------------------------- */
  26. /* Bit 8 | 9| 10| 11|| 12| 13| 14| 15|| 0| 1| 2| 3|| 4| 5| 6| 7| */
  27. /* -------------------------------------------------------------- */
  28. /* The bytes in a word must be byte swapped. Also, if a double */
  29. /* word is used for storage, then the words, as well as the bytes, */
  30. /* must be swapped. */
  31. /* Bit order for adapter communication with DIO */
  32. /* -------------------------------------------------------------- */
  33. /* Bit 0 | 1| 2| 3|| 4| 5| 6| 7|| 8| 9| 10| 11|| 12| 13| 14| 15| */
  34. /* -------------------------------------------------------------- */
  35. /*------------------------------------------------------------------*/
  36. /* Swap words of a long. */
  37. #define SWAPW(x) (((x) << 16) | ((x) >> 16))
  38. /* Get the low byte of a word. */
  39. #define LOBYTE(w) ((unsigned char)(w))
  40. /* Get the high byte of a word. */
  41. #define HIBYTE(w) ((unsigned char)((unsigned short)(w) >> 8))
  42. /* Get the low word of a long. */
  43. #define LOWORD(l) ((unsigned short)(l))
  44. /* Get the high word of a long. */
  45. #define HIWORD(l) ((unsigned short)((unsigned long)(l) >> 16))
  46. /* Token ring adapter I/O addresses for normal mode. */
  47. /*
  48. * The SIF registers. Common to all adapters.
  49. */
  50. /* Basic SIF (SRSX = 0) */
  51. #define SIFDAT 0x00 /* SIF/DMA data. */
  52. #define SIFINC 0x02 /* IO Word data with auto increment. */
  53. #define SIFINH 0x03 /* IO Byte data with auto increment. */
  54. #define SIFADR 0x04 /* SIF/DMA Address. */
  55. #define SIFCMD 0x06 /* SIF Command. */
  56. #define SIFSTS 0x06 /* SIF Status. */
  57. /* "Extended" SIF (SRSX = 1) */
  58. #define SIFACL 0x08 /* SIF Adapter Control Register. */
  59. #define SIFADD 0x0a /* SIF/DMA Address. -- 0x0a */
  60. #define SIFADX 0x0c /* 0x0c */
  61. #define DMALEN 0x0e /* SIF DMA length. -- 0x0e */
  62. /*
  63. * POS Registers. Only for ISA Adapters.
  64. */
  65. #define POSREG 0x10 /* Adapter Program Option Select (POS)
  66. * Register: base IO address + 16 byte.
  67. */
  68. #define POSREG_2 24L /* only for TR4/16+ adapter
  69. * base IO address + 24 byte. -- 0x18
  70. */
  71. /* SIFCMD command codes (high-low) */
  72. #define CMD_INTERRUPT_ADAPTER 0x8000 /* Cause internal adapter interrupt */
  73. #define CMD_ADAPTER_RESET 0x4000 /* Hardware reset of adapter */
  74. #define CMD_SSB_CLEAR 0x2000 /* Acknowledge to adapter to
  75. * system interrupts.
  76. */
  77. #define CMD_EXECUTE 0x1000 /* Execute SCB command */
  78. #define CMD_SCB_REQUEST 0x0800 /* Request adapter to interrupt
  79. * system when SCB is available for
  80. * another command.
  81. */
  82. #define CMD_RX_CONTINUE 0x0400 /* Continue receive after odd pointer
  83. * stop. (odd pointer receive method)
  84. */
  85. #define CMD_RX_VALID 0x0200 /* Now actual RPL is valid. */
  86. #define CMD_TX_VALID 0x0100 /* Now actual TPL is valid. (valid
  87. * bit receive/transmit method)
  88. */
  89. #define CMD_SYSTEM_IRQ 0x0080 /* Adapter-to-attached-system
  90. * interrupt is reset.
  91. */
  92. #define CMD_CLEAR_SYSTEM_IRQ 0x0080 /* Clear SYSTEM_INTERRUPT bit.
  93. * (write: 1=ignore, 0=reset)
  94. */
  95. #define EXEC_SOFT_RESET 0xFF00 /* adapter soft reset. (restart
  96. * adapter after hardware reset)
  97. */
  98. /* ACL commands (high-low) */
  99. #define ACL_SWHLDA 0x0800 /* Software hold acknowledge. */
  100. #define ACL_SWDDIR 0x0400 /* Data transfer direction. */
  101. #define ACL_SWHRQ 0x0200 /* Pseudo DMA operation. */
  102. #define ACL_PSDMAEN 0x0100 /* Enable pseudo system DMA. */
  103. #define ACL_ARESET 0x0080 /* Adapter hardware reset command.
  104. * (held in reset condition as
  105. * long as bit is set)
  106. */
  107. #define ACL_CPHALT 0x0040 /* Communication processor halt.
  108. * (can only be set while ACL_ARESET
  109. * bit is set; prevents adapter
  110. * processor from executing code while
  111. * downloading firmware)
  112. */
  113. #define ACL_BOOT 0x0020
  114. #define ACL_SINTEN 0x0008 /* System interrupt enable/disable
  115. * (1/0): can be written if ACL_ARESET
  116. * is zero.
  117. */
  118. #define ACL_PEN 0x0004
  119. #define ACL_NSELOUT0 0x0002
  120. #define ACL_NSELOUT1 0x0001 /* NSELOUTx have a card-specific
  121. * meaning for setting ring speed.
  122. */
  123. #define PS_DMA_MASK (ACL_SWHRQ | ACL_PSDMAEN)
  124. /* SIFSTS register return codes (high-low) */
  125. #define STS_SYSTEM_IRQ 0x0080 /* Adapter-to-attached-system
  126. * interrupt is valid.
  127. */
  128. #define STS_INITIALIZE 0x0040 /* INITIALIZE status. (ready to
  129. * initialize)
  130. */
  131. #define STS_TEST 0x0020 /* TEST status. (BUD not completed) */
  132. #define STS_ERROR 0x0010 /* ERROR status. (unrecoverable
  133. * HW error occurred)
  134. */
  135. #define STS_MASK 0x00F0 /* Mask interesting status bits. */
  136. #define STS_ERROR_MASK 0x000F /* Get Error Code by masking the
  137. * interrupt code bits.
  138. */
  139. #define ADAPTER_INT_PTRS 0x0A00 /* Address offset of adapter internal
  140. * pointers 01:0a00 (high-low) have to
  141. * be read after init and before open.
  142. */
  143. /* Interrupt Codes (only MAC IRQs) */
  144. #define STS_IRQ_ADAPTER_CHECK 0x0000 /* unrecoverable hardware or
  145. * software error.
  146. */
  147. #define STS_IRQ_RING_STATUS 0x0004 /* SSB is updated with ring status. */
  148. #define STS_IRQ_LLC_STATUS 0x0005 /* Not used in MAC-only microcode */
  149. #define STS_IRQ_SCB_CLEAR 0x0006 /* SCB clear, following an
  150. * SCB_REQUEST IRQ.
  151. */
  152. #define STS_IRQ_TIMER 0x0007 /* Not normally used in MAC ucode */
  153. #define STS_IRQ_COMMAND_STATUS 0x0008 /* SSB is updated with command
  154. * status.
  155. */
  156. #define STS_IRQ_RECEIVE_STATUS 0x000A /* SSB is updated with receive
  157. * status.
  158. */
  159. #define STS_IRQ_TRANSMIT_STATUS 0x000C /* SSB is updated with transmit
  160. * status
  161. */
  162. #define STS_IRQ_RECEIVE_PENDING 0x000E /* Not used in MAC-only microcode */
  163. #define STS_IRQ_MASK 0x000F /* = STS_ERROR_MASK. */
  164. /* TRANSMIT_STATUS completion code: (SSB.Parm[0]) */
  165. #define COMMAND_COMPLETE 0x0080 /* TRANSMIT command completed
  166. * (avoid this!) issue another transmit
  167. * to send additional frames.
  168. */
  169. #define FRAME_COMPLETE 0x0040 /* Frame has been transmitted;
  170. * INTERRUPT_FRAME bit was set in the
  171. * CSTAT request; indication of possibly
  172. * more than one frame transmissions!
  173. * SSB.Parm[0-1]: 32 bit pointer to
  174. * TPL of last frame.
  175. */
  176. #define LIST_ERROR 0x0020 /* Error in one of the TPLs that
  177. * compose the frame; TRANSMIT
  178. * terminated; Parm[1-2]: 32bit pointer
  179. * to TPL which starts the error
  180. * frame; error details in bits 8-13.
  181. * (14?)
  182. */
  183. #define FRAME_SIZE_ERROR 0x8000 /* FRAME_SIZE does not equal the sum of
  184. * the valid DATA_COUNT fields;
  185. * FRAME_SIZE less than header plus
  186. * information field. (15 bytes +
  187. * routing field) Or if FRAME_SIZE
  188. * was specified as zero in one list.
  189. */
  190. #define TX_THRESHOLD 0x4000 /* FRAME_SIZE greater than (BUFFER_SIZE
  191. * - 9) * TX_BUF_MAX.
  192. */
  193. #define ODD_ADDRESS 0x2000 /* Odd forward pointer value is
  194. * read on a list without END_FRAME
  195. * indication.
  196. */
  197. #define FRAME_ERROR 0x1000 /* START_FRAME bit (not) anticipated,
  198. * but (not) set.
  199. */
  200. #define ACCESS_PRIORITY_ERROR 0x0800 /* Access priority requested has not
  201. * been allowed.
  202. */
  203. #define UNENABLED_MAC_FRAME 0x0400 /* MAC frame has source class of zero
  204. * or MAC frame PCF ATTN field is
  205. * greater than one.
  206. */
  207. #define ILLEGAL_FRAME_FORMAT 0x0200 /* Bit 0 or FC field was set to one. */
  208. /*
  209. * Since we need to support some functions even if the adapter is in a
  210. * CLOSED state, we have a (pseudo-) command queue which holds commands
  211. * that are outstandig to be executed.
  212. *
  213. * Each time a command completes, an interrupt occurs and the next
  214. * command is executed. The command queue is actually a simple word with
  215. * a bit for each outstandig command. Therefore the commands will not be
  216. * executed in the order they have been queued.
  217. *
  218. * The following defines the command code bits and the command queue:
  219. */
  220. #define OC_OPEN 0x0001 /* OPEN command */
  221. #define OC_TRANSMIT 0x0002 /* TRANSMIT command */
  222. #define OC_TRANSMIT_HALT 0x0004 /* TRANSMIT_HALT command */
  223. #define OC_RECEIVE 0x0008 /* RECEIVE command */
  224. #define OC_CLOSE 0x0010 /* CLOSE command */
  225. #define OC_SET_GROUP_ADDR 0x0020 /* SET_GROUP_ADDR command */
  226. #define OC_SET_FUNCT_ADDR 0x0040 /* SET_FUNCT_ADDR command */
  227. #define OC_READ_ERROR_LOG 0x0080 /* READ_ERROR_LOG command */
  228. #define OC_READ_ADAPTER 0x0100 /* READ_ADAPTER command */
  229. #define OC_MODIFY_OPEN_PARMS 0x0400 /* MODIFY_OPEN_PARMS command */
  230. #define OC_RESTORE_OPEN_PARMS 0x0800 /* RESTORE_OPEN_PARMS command */
  231. #define OC_SET_FIRST_16_GROUP 0x1000 /* SET_FIRST_16_GROUP command */
  232. #define OC_SET_BRIDGE_PARMS 0x2000 /* SET_BRIDGE_PARMS command */
  233. #define OC_CONFIG_BRIDGE_PARMS 0x4000 /* CONFIG_BRIDGE_PARMS command */
  234. #define OPEN 0x0300 /* C: open command. S: completion. */
  235. #define TRANSMIT 0x0400 /* C: transmit command. S: completion
  236. * status. (reject: COMMAND_REJECT if
  237. * adapter not opened, TRANSMIT already
  238. * issued or address passed in the SCB
  239. * not word aligned)
  240. */
  241. #define TRANSMIT_HALT 0x0500 /* C: interrupt TX TPL chain; if no
  242. * TRANSMIT command issued, the command
  243. * is ignored (completion with TRANSMIT
  244. * status (0x0400)!)
  245. */
  246. #define RECEIVE 0x0600 /* C: receive command. S: completion
  247. * status. (reject: COMMAND_REJECT if
  248. * adapter not opened, RECEIVE already
  249. * issued or address passed in the SCB
  250. * not word aligned)
  251. */
  252. #define CLOSE 0x0700 /* C: close adapter. S: completion.
  253. * (COMMAND_REJECT if adapter not open)
  254. */
  255. #define SET_GROUP_ADDR 0x0800 /* C: alter adapter group address after
  256. * OPEN. S: completion. (COMMAND_REJECT
  257. * if adapter not open)
  258. */
  259. #define SET_FUNCT_ADDR 0x0900 /* C: alter adapter functional address
  260. * after OPEN. S: completion.
  261. * (COMMAND_REJECT if adapter not open)
  262. */
  263. #define READ_ERROR_LOG 0x0A00 /* C: read adapter error counters.
  264. * S: completion. (command ignored
  265. * if adapter not open!)
  266. */
  267. #define READ_ADAPTER 0x0B00 /* C: read data from adapter memory.
  268. * (important: after init and before
  269. * open!) S: completion. (ADAPTER_CHECK
  270. * interrupt if undefined storage area
  271. * read)
  272. */
  273. #define MODIFY_OPEN_PARMS 0x0D00 /* C: modify some adapter operational
  274. * parameters. (bit correspondend to
  275. * WRAP_INTERFACE is ignored)
  276. * S: completion. (reject:
  277. * COMMAND_REJECT)
  278. */
  279. #define RESTORE_OPEN_PARMS 0x0E00 /* C: modify some adapter operational
  280. * parameters. (bit correspondend
  281. * to WRAP_INTERFACE is ignored)
  282. * S: completion. (reject:
  283. * COMMAND_REJECT)
  284. */
  285. #define SET_FIRST_16_GROUP 0x0F00 /* C: alter the first two bytes in
  286. * adapter group address.
  287. * S: completion. (reject:
  288. * COMMAND_REJECT)
  289. */
  290. #define SET_BRIDGE_PARMS 0x1000 /* C: values and conditions for the
  291. * adapter hardware to use when frames
  292. * are copied for forwarding.
  293. * S: completion. (reject:
  294. * COMMAND_REJECT)
  295. */
  296. #define CONFIG_BRIDGE_PARMS 0x1100 /* C: ..
  297. * S: completion. (reject:
  298. * COMMAND_REJECT)
  299. */
  300. #define SPEED_4 4
  301. #define SPEED_16 16 /* Default transmission speed */
  302. /* Initialization Parameter Block (IPB); word alignment necessary! */
  303. #define BURST_SIZE 0x0018 /* Default burst size */
  304. #define BURST_MODE 0x9F00 /* Burst mode enable */
  305. #define DMA_RETRIES 0x0505 /* Magic DMA retry number... */
  306. #define CYCLE_TIME 3 /* Default AT-bus cycle time: 500 ns
  307. * (later adapter version: fix cycle time!)
  308. */
  309. #define LINE_SPEED_BIT 0x80
  310. /* Macro definition for the wait function. */
  311. #define ONE_SECOND_TICKS 1000000
  312. #define HALF_SECOND (ONE_SECOND_TICKS / 2)
  313. #define ONE_SECOND (ONE_SECOND_TICKS)
  314. #define TWO_SECONDS (ONE_SECOND_TICKS * 2)
  315. #define THREE_SECONDS (ONE_SECOND_TICKS * 3)
  316. #define FOUR_SECONDS (ONE_SECOND_TICKS * 4)
  317. #define FIVE_SECONDS (ONE_SECOND_TICKS * 5)
  318. #define BUFFER_SIZE 2048 /* Buffers on Adapter */
  319. #pragma pack(1)
  320. typedef struct {
  321. unsigned short Init_Options; /* Initialize with burst mode;
  322. * LLC disabled. (MAC only)
  323. */
  324. /* Interrupt vectors the adapter places on attached system bus. */
  325. u_int8_t CMD_Status_IV; /* Interrupt vector: command status. */
  326. u_int8_t TX_IV; /* Interrupt vector: transmit. */
  327. u_int8_t RX_IV; /* Interrupt vector: receive. */
  328. u_int8_t Ring_Status_IV; /* Interrupt vector: ring status. */
  329. u_int8_t SCB_Clear_IV; /* Interrupt vector: SCB clear. */
  330. u_int8_t Adapter_CHK_IV; /* Interrupt vector: adapter check. */
  331. u_int16_t RX_Burst_Size; /* Max. number of transfer cycles. */
  332. u_int16_t TX_Burst_Size; /* During DMA burst; even value! */
  333. u_int16_t DMA_Abort_Thrhld; /* Number of DMA retries. */
  334. u_int32_t SCB_Addr; /* SCB address: even, word aligned, high-low */
  335. u_int32_t SSB_Addr; /* SSB address: even, word aligned, high-low */
  336. } IPB, *IPB_Ptr;
  337. #pragma pack()
  338. /*
  339. * OPEN Command Parameter List (OCPL) (can be reused, if the adapter has to
  340. * be reopened)
  341. */
  342. #define BUFFER_SIZE 2048 /* Buffers on Adapter. */
  343. #define TPL_SIZE 8+6*TX_FRAG_NUM /* Depending on fragments per TPL. */
  344. #define RPL_SIZE 14 /* (with TI firmware v2.26 handling
  345. * up to nine fragments possible)
  346. */
  347. #define TX_BUF_MIN 20 /* ??? (Stephan: calculation with */
  348. #define TX_BUF_MAX 40 /* BUFFER_SIZE and MAX_FRAME_SIZE) ???
  349. */
  350. #define DISABLE_EARLY_TOKEN_RELEASE 0x1000
  351. /* OPEN Options (high-low) */
  352. #define WRAP_INTERFACE 0x0080 /* Inserting omitted for test
  353. * purposes; transmit data appears
  354. * as receive data. (useful for
  355. * testing; change: CLOSE necessary)
  356. */
  357. #define DISABLE_HARD_ERROR 0x0040 /* On HARD_ERROR & TRANSMIT_BEACON
  358. * no RING.STATUS interrupt.
  359. */
  360. #define DISABLE_SOFT_ERROR 0x0020 /* On SOFT_ERROR, no RING.STATUS
  361. * interrupt.
  362. */
  363. #define PASS_ADAPTER_MAC_FRAMES 0x0010 /* Passing unsupported MAC frames
  364. * to system.
  365. */
  366. #define PASS_ATTENTION_FRAMES 0x0008 /* All changed attention MAC frames are
  367. * passed to the system.
  368. */
  369. #define PAD_ROUTING_FIELD 0x0004 /* Routing field is padded to 18
  370. * bytes.
  371. */
  372. #define FRAME_HOLD 0x0002 /*Adapter waits for entire frame before
  373. * initiating DMA transfer; otherwise:
  374. * DMA transfer initiation if internal
  375. * buffer filled.
  376. */
  377. #define CONTENDER 0x0001 /* Adapter participates in the monitor
  378. * contention process.
  379. */
  380. #define PASS_BEACON_MAC_FRAMES 0x8000 /* Adapter passes beacon MAC frames
  381. * to the system.
  382. */
  383. #define EARLY_TOKEN_RELEASE 0x1000 /* Only valid in 16 Mbps operation;
  384. * 0 = ETR. (no effect in 4 Mbps
  385. * operation)
  386. */
  387. #define COPY_ALL_MAC_FRAMES 0x0400 /* All MAC frames are copied to
  388. * the system. (after OPEN: duplicate
  389. * address test (DAT) MAC frame is
  390. * first received frame copied to the
  391. * system)
  392. */
  393. #define COPY_ALL_NON_MAC_FRAMES 0x0200 /* All non MAC frames are copied to
  394. * the system.
  395. */
  396. #define PASS_FIRST_BUF_ONLY 0x0100 /* Passes only first internal buffer
  397. * of each received frame; FrameSize
  398. * of RPLs must contain internal
  399. * BUFFER_SIZE bits for promiscous mode.
  400. */
  401. #define ENABLE_FULL_DUPLEX_SELECTION 0x2000
  402. /* Enable the use of full-duplex
  403. * settings with bits in byte 22 in
  404. * ocpl. (new feature in firmware
  405. * version 3.09)
  406. */
  407. /* Full-duplex settings */
  408. #define OPEN_FULL_DUPLEX_OFF 0x0000
  409. #define OPEN_FULL_DUPLEX_ON 0x00c0
  410. #define OPEN_FULL_DUPLEX_AUTO 0x0080
  411. #define PROD_ID_SIZE 18 /* Length of product ID. */
  412. #define TX_FRAG_NUM 3 /* Number of fragments used in one TPL. */
  413. #define TX_MORE_FRAGMENTS 0x8000 /* Bit set in DataCount to indicate more
  414. * fragments following.
  415. */
  416. /* XXX is there some better way to do this? */
  417. #define ISA_MAX_ADDRESS 0x00ffffff
  418. #define PCI_MAX_ADDRESS 0xffffffff
  419. #pragma pack(1)
  420. typedef struct {
  421. u_int16_t OPENOptions;
  422. u_int8_t NodeAddr[6]; /* Adapter node address; use ROM
  423. * address
  424. */
  425. u_int32_t GroupAddr; /* Multicast: high order
  426. * bytes = 0xC000
  427. */
  428. u_int32_t FunctAddr; /* High order bytes = 0xC000 */
  429. u_int16_t RxListSize; /* RPL size: 0 (=26), 14, 20 or
  430. * 26 bytes read by the adapter.
  431. * (Depending on the number of
  432. * fragments/list)
  433. */
  434. u_int16_t TxListSize; /* TPL size */
  435. u_int16_t BufSize; /* Is automatically rounded up to the
  436. * nearest nK boundary.
  437. */
  438. u_int16_t FullDuplex;
  439. u_int16_t Reserved;
  440. u_int8_t TXBufMin; /* Number of adapter buffers reserved
  441. * for transmission a minimum of 2
  442. * buffers must be allocated.
  443. */
  444. u_int8_t TXBufMax; /* Maximum number of adapter buffers
  445. * for transmit; a minimum of 2 buffers
  446. * must be available for receive.
  447. * Default: 6
  448. */
  449. u_int16_t ProdIDAddr[2];/* Pointer to product ID. */
  450. } OPB, *OPB_Ptr;
  451. #pragma pack()
  452. /*
  453. * SCB: adapter commands enabled by the host system started by writing
  454. * CMD_INTERRUPT_ADAPTER | CMD_EXECUTE (|SCB_REQUEST) to the SIFCMD IO
  455. * register. (special case: | CMD_SYSTEM_IRQ for initialization)
  456. */
  457. #pragma pack(1)
  458. typedef struct {
  459. u_int16_t CMD; /* Command code */
  460. u_int16_t Parm[2]; /* Pointer to Command Parameter Block */
  461. } SCB; /* System Command Block (32 bit physical address; big endian)*/
  462. #pragma pack()
  463. /*
  464. * SSB: adapter command return status can be evaluated after COMMAND_STATUS
  465. * adapter to system interrupt after reading SSB, the availability of the SSB
  466. * has to be told the adapter by writing CMD_INTERRUPT_ADAPTER | CMD_SSB_CLEAR
  467. * in the SIFCMD IO register.
  468. */
  469. #pragma pack(1)
  470. typedef struct {
  471. u_int16_t STS; /* Status code */
  472. u_int16_t Parm[3]; /* Parameter or pointer to Status Parameter
  473. * Block.
  474. */
  475. } SSB; /* System Status Block (big endian - physical address) */
  476. #pragma pack()
  477. typedef struct {
  478. unsigned short BurnedInAddrPtr; /* Pointer to adapter burned in
  479. * address. (BIA)
  480. */
  481. unsigned short SoftwareLevelPtr;/* Pointer to software level data. */
  482. unsigned short AdapterAddrPtr; /* Pointer to adapter addresses. */
  483. unsigned short AdapterParmsPtr; /* Pointer to adapter parameters. */
  484. unsigned short MACBufferPtr; /* Pointer to MAC buffer. (internal) */
  485. unsigned short LLCCountersPtr; /* Pointer to LLC counters. */
  486. unsigned short SpeedFlagPtr; /* Pointer to data rate flag.
  487. * (4/16 Mbps)
  488. */
  489. unsigned short AdapterRAMPtr; /* Pointer to adapter RAM found. (KB) */
  490. } INTPTRS; /* Adapter internal pointers */
  491. #pragma pack(1)
  492. typedef struct {
  493. u_int8_t Line_Error; /* Line error: code violation in
  494. * frame or in a token, or FCS error.
  495. */
  496. u_int8_t Internal_Error; /* IBM specific. (Reserved_1) */
  497. u_int8_t Burst_Error;
  498. u_int8_t ARI_FCI_Error; /* ARI/FCI bit zero in AMP or
  499. * SMP MAC frame.
  500. */
  501. u_int8_t AbortDelimeters; /* IBM specific. (Reserved_2) */
  502. u_int8_t Reserved_3;
  503. u_int8_t Lost_Frame_Error; /* Receive of end of transmitted
  504. * frame failed.
  505. */
  506. u_int8_t Rx_Congest_Error; /* Adapter in repeat mode has not
  507. * enough buffer space to copy incoming
  508. * frame.
  509. */
  510. u_int8_t Frame_Copied_Error; /* ARI bit not zero in frame
  511. * addressed to adapter.
  512. */
  513. u_int8_t Frequency_Error; /* IBM specific. (Reserved_4) */
  514. u_int8_t Token_Error; /* (active only in monitor station) */
  515. u_int8_t Reserved_5;
  516. u_int8_t DMA_Bus_Error; /* DMA bus errors not exceeding the
  517. * abort thresholds.
  518. */
  519. u_int8_t DMA_Parity_Error; /* DMA parity errors not exceeding
  520. * the abort thresholds.
  521. */
  522. } ERRORTAB; /* Adapter error counters */
  523. #pragma pack()
  524. /*--------------------- Send and Receive definitions -------------------*/
  525. #pragma pack(1)
  526. typedef struct {
  527. u_int16_t DataCount; /* Value 0, even and odd values are
  528. * permitted; value is unaltered most
  529. * significant bit set: following
  530. * fragments last fragment: most
  531. * significant bit is not evaluated.
  532. * (???)
  533. */
  534. u_int32_t DataAddr; /* Pointer to frame data fragment;
  535. * even or odd.
  536. */
  537. } Fragment;
  538. #pragma pack()
  539. #define MAX_FRAG_NUMBERS 9 /* Maximal number of fragments possible to use
  540. * in one RPL/TPL. (depending on TI firmware
  541. * version)
  542. */
  543. /*
  544. * AC (1), FC (1), Dst (6), Src (6), RIF (18), Data (4472) = 4504
  545. * The packet size can be one of the follows: 548, 1502, 2084, 4504, 8176,
  546. * 11439, 17832. Refer to TMS380 Second Generation Token Ring User's Guide
  547. * Page 2-27.
  548. */
  549. #define HEADER_SIZE (1 + 1 + 6 + 6)
  550. #define SRC_SIZE 18
  551. #define MIN_DATA_SIZE 516
  552. #define DEFAULT_DATA_SIZE 4472
  553. #define MAX_DATA_SIZE 17800
  554. #define DEFAULT_PACKET_SIZE (HEADER_SIZE + SRC_SIZE + DEFAULT_DATA_SIZE)
  555. #define MIN_PACKET_SIZE (HEADER_SIZE + SRC_SIZE + MIN_DATA_SIZE)
  556. #define MAX_PACKET_SIZE (HEADER_SIZE + SRC_SIZE + MAX_DATA_SIZE)
  557. /*
  558. * Macros to deal with the frame status field.
  559. */
  560. #define AC_NOT_RECOGNIZED 0x00
  561. #define GROUP_BIT 0x80
  562. #define GET_TRANSMIT_STATUS_HIGH_BYTE(Ts) ((unsigned char)((Ts) >> 8))
  563. #define GET_FRAME_STATUS_HIGH_AC(Fs) ((unsigned char)(((Fs) & 0xC0) >> 6))
  564. #define GET_FRAME_STATUS_LOW_AC(Fs) ((unsigned char)(((Fs) & 0x0C) >> 2))
  565. #define DIRECTED_FRAME(Context) (!((Context)->MData[2] & GROUP_BIT))
  566. /*--------------------- Send Functions ---------------------------------*/
  567. /* define TX_CSTAT _REQUEST (R) and _COMPLETE (C) values (high-low) */
  568. #define TX_VALID 0x0080 /* R: set via TRANSMIT.VALID interrupt.
  569. * C: always reset to zero!
  570. */
  571. #define TX_FRAME_COMPLETE 0x0040 /* R: must be reset to zero.
  572. * C: set to one.
  573. */
  574. #define TX_START_FRAME 0x0020 /* R: start of a frame: 1
  575. * C: unchanged.
  576. */
  577. #define TX_END_FRAME 0x0010 /* R: end of a frame: 1
  578. * C: unchanged.
  579. */
  580. #define TX_FRAME_IRQ 0x0008 /* R: request interrupt generation
  581. * after transmission.
  582. * C: unchanged.
  583. */
  584. #define TX_ERROR 0x0004 /* R: reserved.
  585. * C: set to one if Error occurred.
  586. */
  587. #define TX_INTERFRAME_WAIT 0x0004
  588. #define TX_PASS_CRC 0x0002 /* R: set if CRC value is already
  589. * calculated. (valid only in
  590. * FRAME_START TPL)
  591. * C: unchanged.
  592. */
  593. #define TX_PASS_SRC_ADDR 0x0001 /* R: adapter uses explicit frame
  594. * source address and does not overwrite
  595. * with the adapter node address.
  596. * (valid only in FRAME_START TPL)
  597. *
  598. * C: unchanged.
  599. */
  600. #define TX_STRIP_FS 0xFF00 /* R: reserved.
  601. * C: if no Transmission Error,
  602. * field contains copy of FS byte after
  603. * stripping of frame.
  604. */
  605. /*
  606. * Structure of Transmit Parameter Lists (TPLs) (only one frame every TPL,
  607. * but possibly multiple TPLs for one frame) the length of the TPLs has to be
  608. * initialized in the OPL. (OPEN parameter list)
  609. */
  610. #define TPL_NUM 3 /* Number of Transmit Parameter Lists.
  611. * !! MUST BE >= 3 !!
  612. */
  613. #pragma pack(1)
  614. typedef struct s_TPL TPL;
  615. struct s_TPL { /* Transmit Parameter List (align on even word boundaries) */
  616. u_int32_t NextTPLAddr; /* Pointer to next TPL in chain; if
  617. * pointer is odd: this is the last
  618. * TPL. Pointing to itself can cause
  619. * problems!
  620. */
  621. volatile u_int16_t Status; /* Initialized by the adapter:
  622. * CSTAT_REQUEST important: update least
  623. * significant bit first! Set by the
  624. * adapter: CSTAT_COMPLETE status.
  625. */
  626. u_int16_t FrameSize; /* Number of bytes to be transmitted
  627. * as a frame including AC/FC,
  628. * Destination, Source, Routing field
  629. * not including CRC, FS, End Delimiter
  630. * (valid only if START_FRAME bit in
  631. * CSTAT nonzero) must not be zero in
  632. * any list; maximum value: (BUFFER_SIZE
  633. * - 8) * TX_BUF_MAX sum of DataCount
  634. * values in FragmentList must equal
  635. * Frame_Size value in START_FRAME TPL!
  636. * frame data fragment list.
  637. */
  638. /* TPL/RPL size in OPEN parameter list depending on maximal
  639. * numbers of fragments used in one parameter list.
  640. */
  641. Fragment FragList[TX_FRAG_NUM]; /* Maximum: nine frame fragments in one
  642. * TPL actual version of firmware: 9
  643. * fragments possible.
  644. */
  645. #pragma pack()
  646. /* Special proprietary data and precalculations */
  647. TPL *NextTPLPtr; /* Pointer to next TPL in chain. */
  648. unsigned char *MData;
  649. struct sk_buff *Skb;
  650. unsigned char TPLIndex;
  651. volatile unsigned char BusyFlag;/* Flag: TPL busy? */
  652. dma_addr_t DMABuff; /* DMA IO bus address from dma_map */
  653. };
  654. /* ---------------------Receive Functions-------------------------------*
  655. * define RECEIVE_CSTAT_REQUEST (R) and RECEIVE_CSTAT_COMPLETE (C) values.
  656. * (high-low)
  657. */
  658. #define RX_VALID 0x0080 /* R: set; tell adapter with
  659. * RECEIVE.VALID interrupt.
  660. * C: reset to zero.
  661. */
  662. #define RX_FRAME_COMPLETE 0x0040 /* R: must be reset to zero,
  663. * C: set to one.
  664. */
  665. #define RX_START_FRAME 0x0020 /* R: must be reset to zero.
  666. * C: set to one on the list.
  667. */
  668. #define RX_END_FRAME 0x0010 /* R: must be reset to zero.
  669. * C: set to one on the list
  670. * that ends the frame.
  671. */
  672. #define RX_FRAME_IRQ 0x0008 /* R: request interrupt generation
  673. * after receive.
  674. * C: unchanged.
  675. */
  676. #define RX_INTERFRAME_WAIT 0x0004 /* R: after receiving a frame:
  677. * interrupt and wait for a
  678. * RECEIVE.CONTINUE.
  679. * C: unchanged.
  680. */
  681. #define RX_PASS_CRC 0x0002 /* R: if set, the adapter includes
  682. * the CRC in data passed. (last four
  683. * bytes; valid only if FRAME_START is
  684. * set)
  685. * C: set, if CRC is included in
  686. * received data.
  687. */
  688. #define RX_PASS_SRC_ADDR 0x0001 /* R: adapter uses explicit frame
  689. * source address and does not
  690. * overwrite with the adapter node
  691. * address. (valid only if FRAME_START
  692. * is set)
  693. * C: unchanged.
  694. */
  695. #define RX_RECEIVE_FS 0xFC00 /* R: reserved; must be reset to zero.
  696. * C: on lists with START_FRAME, field
  697. * contains frame status field from
  698. * received frame; otherwise cleared.
  699. */
  700. #define RX_ADDR_MATCH 0x0300 /* R: reserved; must be reset to zero.
  701. * C: address match code mask.
  702. */
  703. #define RX_STATUS_MASK 0x00FF /* Mask for receive status bits. */
  704. #define RX_INTERN_ADDR_MATCH 0x0100 /* C: internally address match. */
  705. #define RX_EXTERN_ADDR_MATCH 0x0200 /* C: externally matched via
  706. * XMATCH/XFAIL interface.
  707. */
  708. #define RX_INTEXT_ADDR_MATCH 0x0300 /* C: internally and externally
  709. * matched.
  710. */
  711. #define RX_READY (RX_VALID | RX_FRAME_IRQ) /* Ready for receive. */
  712. /* Constants for Command Status Interrupt.
  713. * COMMAND_REJECT status field bit functions (SSB.Parm[0])
  714. */
  715. #define ILLEGAL_COMMAND 0x0080 /* Set if an unknown command
  716. * is issued to the adapter
  717. */
  718. #define ADDRESS_ERROR 0x0040 /* Set if any address field in
  719. * the SCB is odd. (not word aligned)
  720. */
  721. #define ADAPTER_OPEN 0x0020 /* Command issued illegal with
  722. * open adapter.
  723. */
  724. #define ADAPTER_CLOSE 0x0010 /* Command issued illegal with
  725. * closed adapter.
  726. */
  727. #define SAME_COMMAND 0x0008 /* Command issued with same command
  728. * already executing.
  729. */
  730. /* OPEN_COMPLETION values (SSB.Parm[0], MSB) */
  731. #define NODE_ADDR_ERROR 0x0040 /* Wrong address or BIA read
  732. * zero address.
  733. */
  734. #define LIST_SIZE_ERROR 0x0020 /* If List_Size value not in 0,
  735. * 14, 20, 26.
  736. */
  737. #define BUF_SIZE_ERROR 0x0010 /* Not enough available memory for
  738. * two buffers.
  739. */
  740. #define TX_BUF_COUNT_ERROR 0x0004 /* Remaining receive buffers less than
  741. * two.
  742. */
  743. #define OPEN_ERROR 0x0002 /* Error during ring insertion; more
  744. * information in bits 8-15.
  745. */
  746. /* Standard return codes */
  747. #define GOOD_COMPLETION 0x0080 /* =OPEN_SUCCESSFULL */
  748. #define INVALID_OPEN_OPTION 0x0001 /* OPEN options are not supported by
  749. * the adapter.
  750. */
  751. /* OPEN phases; details of OPEN_ERROR (SSB.Parm[0], LSB) */
  752. #define OPEN_PHASES_MASK 0xF000 /* Check only the bits 8-11. */
  753. #define LOBE_MEDIA_TEST 0x1000
  754. #define PHYSICAL_INSERTION 0x2000
  755. #define ADDRESS_VERIFICATION 0x3000
  756. #define PARTICIPATION_IN_RING_POLL 0x4000
  757. #define REQUEST_INITIALISATION 0x5000
  758. #define FULLDUPLEX_CHECK 0x6000
  759. /* OPEN error codes; details of OPEN_ERROR (SSB.Parm[0], LSB) */
  760. #define OPEN_ERROR_CODES_MASK 0x0F00 /* Check only the bits 12-15. */
  761. #define OPEN_FUNCTION_FAILURE 0x0100 /* Unable to transmit to itself or
  762. * frames received before insertion.
  763. */
  764. #define OPEN_SIGNAL_LOSS 0x0200 /* Signal loss condition detected at
  765. * receiver.
  766. */
  767. #define OPEN_TIMEOUT 0x0500 /* Insertion timer expired before
  768. * logical insertion.
  769. */
  770. #define OPEN_RING_FAILURE 0x0600 /* Unable to receive own ring purge
  771. * MAC frames.
  772. */
  773. #define OPEN_RING_BEACONING 0x0700 /* Beacon MAC frame received after
  774. * ring insertion.
  775. */
  776. #define OPEN_DUPLICATE_NODEADDR 0x0800 /* Other station in ring found
  777. * with the same address.
  778. */
  779. #define OPEN_REQUEST_INIT 0x0900 /* RPS present but does not respond. */
  780. #define OPEN_REMOVE_RECEIVED 0x0A00 /* Adapter received a remove adapter
  781. * MAC frame.
  782. */
  783. #define OPEN_FULLDUPLEX_SET 0x0D00 /* Got this with full duplex on when
  784. * trying to connect to a normal ring.
  785. */
  786. /* SET_BRIDGE_PARMS return codes: */
  787. #define BRIDGE_INVALID_MAX_LEN 0x4000 /* MAX_ROUTING_FIELD_LENGTH odd,
  788. * less than 6 or > 30.
  789. */
  790. #define BRIDGE_INVALID_SRC_RING 0x2000 /* SOURCE_RING number zero, too large
  791. * or = TARGET_RING.
  792. */
  793. #define BRIDGE_INVALID_TRG_RING 0x1000 /* TARGET_RING number zero, too large
  794. * or = SOURCE_RING.
  795. */
  796. #define BRIDGE_INVALID_BRDGE_NO 0x0800 /* BRIDGE_NUMBER too large. */
  797. #define BRIDGE_INVALID_OPTIONS 0x0400 /* Invalid bridge options. */
  798. #define BRIDGE_DIAGS_FAILED 0x0200 /* Diagnostics of TMS380SRA failed. */
  799. #define BRIDGE_NO_SRA 0x0100 /* The TMS380SRA does not exist in HW
  800. * configuration.
  801. */
  802. /*
  803. * Bring Up Diagnostics error codes.
  804. */
  805. #define BUD_INITIAL_ERROR 0x0
  806. #define BUD_CHECKSUM_ERROR 0x1
  807. #define BUD_ADAPTER_RAM_ERROR 0x2
  808. #define BUD_INSTRUCTION_ERROR 0x3
  809. #define BUD_CONTEXT_ERROR 0x4
  810. #define BUD_PROTOCOL_ERROR 0x5
  811. #define BUD_INTERFACE_ERROR 0x6
  812. /* BUD constants */
  813. #define BUD_MAX_RETRIES 3
  814. #define BUD_MAX_LOOPCNT 6
  815. #define BUD_TIMEOUT 3000
  816. /* Initialization constants */
  817. #define INIT_MAX_RETRIES 3 /* Maximum three retries. */
  818. #define INIT_MAX_LOOPCNT 22 /* Maximum loop counts. */
  819. /* RING STATUS field values (high/low) */
  820. #define SIGNAL_LOSS 0x0080 /* Loss of signal on the ring
  821. * detected.
  822. */
  823. #define HARD_ERROR 0x0040 /* Transmitting or receiving beacon
  824. * frames.
  825. */
  826. #define SOFT_ERROR 0x0020 /* Report error MAC frame
  827. * transmitted.
  828. */
  829. #define TRANSMIT_BEACON 0x0010 /* Transmitting beacon frames on the
  830. * ring.
  831. */
  832. #define LOBE_WIRE_FAULT 0x0008 /* Open or short circuit in the
  833. * cable to concentrator; adapter
  834. * closed.
  835. */
  836. #define AUTO_REMOVAL_ERROR 0x0004 /* Lobe wrap test failed, deinserted;
  837. * adapter closed.
  838. */
  839. #define REMOVE_RECEIVED 0x0001 /* Received a remove ring station MAC
  840. * MAC frame request; adapter closed.
  841. */
  842. #define COUNTER_OVERFLOW 0x8000 /* Overflow of one of the adapters
  843. * error counters; READ.ERROR.LOG.
  844. */
  845. #define SINGLE_STATION 0x4000 /* Adapter is the only station on the
  846. * ring.
  847. */
  848. #define RING_RECOVERY 0x2000 /* Claim token MAC frames on the ring;
  849. * reset after ring purge frame.
  850. */
  851. #define ADAPTER_CLOSED (LOBE_WIRE_FAULT | AUTO_REMOVAL_ERROR |\
  852. REMOVE_RECEIVED)
  853. /* Adapter_check_block.Status field bit assignments: */
  854. #define DIO_PARITY 0x8000 /* Adapter detects bad parity
  855. * through direct I/O access.
  856. */
  857. #define DMA_READ_ABORT 0x4000 /* Aborting DMA read operation
  858. * from system Parm[0]: 0=timeout,
  859. * 1=parity error, 2=bus error;
  860. * Parm[1]: 32 bit pointer to host
  861. * system address at failure.
  862. */
  863. #define DMA_WRITE_ABORT 0x2000 /* Aborting DMA write operation
  864. * to system. (parameters analogous to
  865. * DMA_READ_ABORT)
  866. */
  867. #define ILLEGAL_OP_CODE 0x1000 /* Illegal operation code in the
  868. * the adapters firmware Parm[0]-2:
  869. * communications processor registers
  870. * R13-R15.
  871. */
  872. #define PARITY_ERRORS 0x0800 /* Adapter detects internal bus
  873. * parity error.
  874. */
  875. #define RAM_DATA_ERROR 0x0080 /* Valid only during RAM testing;
  876. * RAM data error Parm[0-1]: 32 bit
  877. * pointer to RAM location.
  878. */
  879. #define RAM_PARITY_ERROR 0x0040 /* Valid only during RAM testing;
  880. * RAM parity error Parm[0-1]: 32 bit
  881. * pointer to RAM location.
  882. */
  883. #define RING_UNDERRUN 0x0020 /* Internal DMA underrun when
  884. * transmitting onto ring.
  885. */
  886. #define INVALID_IRQ 0x0008 /* Unrecognized interrupt generated
  887. * internal to adapter Parm[0-2]:
  888. * adapter register R13-R15.
  889. */
  890. #define INVALID_ERROR_IRQ 0x0004 /* Unrecognized error interrupt
  891. * generated Parm[0-2]: adapter register
  892. * R13-R15.
  893. */
  894. #define INVALID_XOP 0x0002 /* Unrecognized XOP request in
  895. * communication processor Parm[0-2]:
  896. * adapter register R13-R15.
  897. */
  898. #define CHECKADDR 0x05E0 /* Adapter check status information
  899. * address offset.
  900. */
  901. #define ROM_PAGE_0 0x0000 /* Adapter ROM page 0. */
  902. /*
  903. * RECEIVE.STATUS interrupt result SSB values: (high-low)
  904. * (RECEIVE_COMPLETE field bit definitions in SSB.Parm[0])
  905. */
  906. #define RX_COMPLETE 0x0080 /* SSB.Parm[0]; SSB.Parm[1]: 32
  907. * bit pointer to last RPL.
  908. */
  909. #define RX_SUSPENDED 0x0040 /* SSB.Parm[0]; SSB.Parm[1]: 32
  910. * bit pointer to RPL with odd
  911. * forward pointer.
  912. */
  913. /* Valid receive CSTAT: */
  914. #define RX_FRAME_CONTROL_BITS (RX_VALID | RX_START_FRAME | RX_END_FRAME | \
  915. RX_FRAME_COMPLETE)
  916. #define VALID_SINGLE_BUFFER_FRAME (RX_START_FRAME | RX_END_FRAME | \
  917. RX_FRAME_COMPLETE)
  918. typedef enum SKB_STAT SKB_STAT;
  919. enum SKB_STAT {
  920. SKB_UNAVAILABLE,
  921. SKB_DMA_DIRECT,
  922. SKB_DATA_COPY
  923. };
  924. /* Receive Parameter List (RPL) The length of the RPLs has to be initialized
  925. * in the OPL. (OPEN parameter list)
  926. */
  927. #define RPL_NUM 3
  928. #define RX_FRAG_NUM 1 /* Maximal number of used fragments in one RPL.
  929. * (up to firmware v2.24: 3, now: up to 9)
  930. */
  931. #pragma pack(1)
  932. typedef struct s_RPL RPL;
  933. struct s_RPL { /* Receive Parameter List */
  934. u_int32_t NextRPLAddr; /* Pointer to next RPL in chain
  935. * (normalized = physical 32 bit
  936. * address) if pointer is odd: this
  937. * is last RPL. Pointing to itself can
  938. * cause problems!
  939. */
  940. volatile u_int16_t Status; /* Set by creation of Receive Parameter
  941. * List RECEIVE_CSTAT_COMPLETE set by
  942. * adapter in lists that start or end
  943. * a frame.
  944. */
  945. volatile u_int16_t FrameSize; /* Number of bytes received as a
  946. * frame including AC/FC, Destination,
  947. * Source, Routing field not including
  948. * CRC, FS (Frame Status), End Delimiter
  949. * (valid only if START_FRAME bit in
  950. * CSTAT nonzero) must not be zero in
  951. * any list; maximum value: (BUFFER_SIZE
  952. * - 8) * TX_BUF_MAX sum of DataCount
  953. * values in FragmentList must equal
  954. * Frame_Size value in START_FRAME TPL!
  955. * frame data fragment list
  956. */
  957. /* TPL/RPL size in OPEN parameter list depending on maximal numbers
  958. * of fragments used in one parameter list.
  959. */
  960. Fragment FragList[RX_FRAG_NUM]; /* Maximum: nine frame fragments in
  961. * one TPL. Actual version of firmware:
  962. * 9 fragments possible.
  963. */
  964. #pragma pack()
  965. /* Special proprietary data and precalculations. */
  966. RPL *NextRPLPtr; /* Logical pointer to next RPL in chain. */
  967. unsigned char *MData;
  968. struct sk_buff *Skb;
  969. SKB_STAT SkbStat;
  970. int RPLIndex;
  971. dma_addr_t DMABuff; /* DMA IO bus address from dma_map */
  972. };
  973. /* Information that need to be kept for each board. */
  974. typedef struct net_local {
  975. #pragma pack(1)
  976. IPB ipb; /* Initialization Parameter Block. */
  977. SCB scb; /* System Command Block: system to adapter
  978. * communication.
  979. */
  980. SSB ssb; /* System Status Block: adapter to system
  981. * communication.
  982. */
  983. OPB ocpl; /* Open Options Parameter Block. */
  984. ERRORTAB errorlogtable; /* Adapter statistic error counters.
  985. * (read from adapter memory)
  986. */
  987. unsigned char ProductID[PROD_ID_SIZE + 1]; /* Product ID */
  988. #pragma pack()
  989. TPL Tpl[TPL_NUM];
  990. TPL *TplFree;
  991. TPL *TplBusy;
  992. unsigned char LocalTxBuffers[TPL_NUM][DEFAULT_PACKET_SIZE];
  993. RPL Rpl[RPL_NUM];
  994. RPL *RplHead;
  995. RPL *RplTail;
  996. unsigned char LocalRxBuffers[RPL_NUM][DEFAULT_PACKET_SIZE];
  997. struct device *pdev;
  998. int DataRate;
  999. unsigned char ScbInUse;
  1000. unsigned short CMDqueue;
  1001. unsigned long AdapterOpenFlag:1;
  1002. unsigned long AdapterVirtOpenFlag:1;
  1003. unsigned long OpenCommandIssued:1;
  1004. unsigned long TransmitCommandActive:1;
  1005. unsigned long TransmitHaltScheduled:1;
  1006. unsigned long HaltInProgress:1;
  1007. unsigned long LobeWireFaultLogged:1;
  1008. unsigned long ReOpenInProgress:1;
  1009. unsigned long Sleeping:1;
  1010. unsigned long LastOpenStatus;
  1011. unsigned short CurrentRingStatus;
  1012. unsigned long MaxPacketSize;
  1013. unsigned long StartTime;
  1014. unsigned long LastSendTime;
  1015. struct tr_statistics MacStat; /* MAC statistics structure */
  1016. unsigned long dmalimit; /* the max DMA address (ie, ISA) */
  1017. dma_addr_t dmabuffer; /* the DMA bus address corresponding to
  1018. priv. Might be different from virt_to_bus()
  1019. for architectures with IO MMU (Alpha) */
  1020. struct timer_list timer;
  1021. wait_queue_head_t wait_for_tok_int;
  1022. INTPTRS intptrs; /* Internal adapter pointer. Must be read
  1023. * before OPEN command.
  1024. */
  1025. unsigned short (*setnselout)(struct net_device *);
  1026. unsigned short (*sifreadb)(struct net_device *, unsigned short);
  1027. void (*sifwriteb)(struct net_device *, unsigned short, unsigned short);
  1028. unsigned short (*sifreadw)(struct net_device *, unsigned short);
  1029. void (*sifwritew)(struct net_device *, unsigned short, unsigned short);
  1030. spinlock_t lock; /* SMP protection */
  1031. void *tmspriv;
  1032. } NET_LOCAL;
  1033. #endif /* __KERNEL__ */
  1034. #endif /* __LINUX_TMS380TR_H */