tms380tr.h 39 KB

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