ieee1394.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Generic IEEE 1394 definitions
  3. */
  4. #ifndef _IEEE1394_IEEE1394_H
  5. #define _IEEE1394_IEEE1394_H
  6. #define TCODE_WRITEQ 0x0
  7. #define TCODE_WRITEB 0x1
  8. #define TCODE_WRITE_RESPONSE 0x2
  9. #define TCODE_READQ 0x4
  10. #define TCODE_READB 0x5
  11. #define TCODE_READQ_RESPONSE 0x6
  12. #define TCODE_READB_RESPONSE 0x7
  13. #define TCODE_CYCLE_START 0x8
  14. #define TCODE_LOCK_REQUEST 0x9
  15. #define TCODE_ISO_DATA 0xa
  16. #define TCODE_STREAM_DATA 0xa
  17. #define TCODE_LOCK_RESPONSE 0xb
  18. #define RCODE_COMPLETE 0x0
  19. #define RCODE_CONFLICT_ERROR 0x4
  20. #define RCODE_DATA_ERROR 0x5
  21. #define RCODE_TYPE_ERROR 0x6
  22. #define RCODE_ADDRESS_ERROR 0x7
  23. #define EXTCODE_MASK_SWAP 0x1
  24. #define EXTCODE_COMPARE_SWAP 0x2
  25. #define EXTCODE_FETCH_ADD 0x3
  26. #define EXTCODE_LITTLE_ADD 0x4
  27. #define EXTCODE_BOUNDED_ADD 0x5
  28. #define EXTCODE_WRAP_ADD 0x6
  29. #define ACK_COMPLETE 0x1
  30. #define ACK_PENDING 0x2
  31. #define ACK_BUSY_X 0x4
  32. #define ACK_BUSY_A 0x5
  33. #define ACK_BUSY_B 0x6
  34. #define ACK_TARDY 0xb
  35. #define ACK_CONFLICT_ERROR 0xc
  36. #define ACK_DATA_ERROR 0xd
  37. #define ACK_TYPE_ERROR 0xe
  38. #define ACK_ADDRESS_ERROR 0xf
  39. /* Non-standard "ACK codes" for internal use */
  40. #define ACKX_NONE (-1)
  41. #define ACKX_SEND_ERROR (-2)
  42. #define ACKX_ABORTED (-3)
  43. #define ACKX_TIMEOUT (-4)
  44. #define IEEE1394_SPEED_100 0x00
  45. #define IEEE1394_SPEED_200 0x01
  46. #define IEEE1394_SPEED_400 0x02
  47. #define IEEE1394_SPEED_800 0x03
  48. #define IEEE1394_SPEED_1600 0x04
  49. #define IEEE1394_SPEED_3200 0x05
  50. #define IEEE1394_SPEED_MAX IEEE1394_SPEED_3200
  51. /* Maps speed values above to a string representation */
  52. extern const char *hpsb_speedto_str[];
  53. /* 1394a cable PHY packets */
  54. #define SELFID_PWRCL_NO_POWER 0x0
  55. #define SELFID_PWRCL_PROVIDE_15W 0x1
  56. #define SELFID_PWRCL_PROVIDE_30W 0x2
  57. #define SELFID_PWRCL_PROVIDE_45W 0x3
  58. #define SELFID_PWRCL_USE_1W 0x4
  59. #define SELFID_PWRCL_USE_3W 0x5
  60. #define SELFID_PWRCL_USE_6W 0x6
  61. #define SELFID_PWRCL_USE_10W 0x7
  62. #define SELFID_PORT_CHILD 0x3
  63. #define SELFID_PORT_PARENT 0x2
  64. #define SELFID_PORT_NCONN 0x1
  65. #define SELFID_PORT_NONE 0x0
  66. #define SELFID_SPEED_UNKNOWN 0x3 /* 1394b PHY */
  67. #define PHYPACKET_LINKON 0x40000000
  68. #define PHYPACKET_PHYCONFIG_R 0x00800000
  69. #define PHYPACKET_PHYCONFIG_T 0x00400000
  70. #define EXTPHYPACKET_TYPE_PING 0x00000000
  71. #define EXTPHYPACKET_TYPE_REMOTEACCESS_BASE 0x00040000
  72. #define EXTPHYPACKET_TYPE_REMOTEACCESS_PAGED 0x00140000
  73. #define EXTPHYPACKET_TYPE_REMOTEREPLY_BASE 0x000C0000
  74. #define EXTPHYPACKET_TYPE_REMOTEREPLY_PAGED 0x001C0000
  75. #define EXTPHYPACKET_TYPE_REMOTECOMMAND 0x00200000
  76. #define EXTPHYPACKET_TYPE_REMOTECONFIRMATION 0x00280000
  77. #define EXTPHYPACKET_TYPE_RESUME 0x003C0000
  78. #define EXTPHYPACKET_TYPEMASK 0xC0FC0000
  79. #define PHYPACKET_PORT_SHIFT 24
  80. #define PHYPACKET_GAPCOUNT_SHIFT 16
  81. /* 1394a PHY register map bitmasks */
  82. #define PHY_00_PHYSICAL_ID 0xFC
  83. #define PHY_00_R 0x02 /* Root */
  84. #define PHY_00_PS 0x01 /* Power Status*/
  85. #define PHY_01_RHB 0x80 /* Root Hold-Off */
  86. #define PHY_01_IBR 0x80 /* Initiate Bus Reset */
  87. #define PHY_01_GAP_COUNT 0x3F
  88. #define PHY_02_EXTENDED 0xE0 /* 0x7 for 1394a-compliant PHY */
  89. #define PHY_02_TOTAL_PORTS 0x1F
  90. #define PHY_03_MAX_SPEED 0xE0
  91. #define PHY_03_DELAY 0x0F
  92. #define PHY_04_LCTRL 0x80 /* Link Active Report Control */
  93. #define PHY_04_CONTENDER 0x40
  94. #define PHY_04_JITTER 0x38
  95. #define PHY_04_PWR_CLASS 0x07 /* Power Class */
  96. #define PHY_05_WATCHDOG 0x80
  97. #define PHY_05_ISBR 0x40 /* Initiate Short Bus Reset */
  98. #define PHY_05_LOOP 0x20 /* Loop Detect */
  99. #define PHY_05_PWR_FAIL 0x10 /* Cable Power Failure Detect */
  100. #define PHY_05_TIMEOUT 0x08 /* Arbitration State Machine Timeout */
  101. #define PHY_05_PORT_EVENT 0x04 /* Port Event Detect */
  102. #define PHY_05_ENAB_ACCEL 0x02 /* Enable Arbitration Acceleration */
  103. #define PHY_05_ENAB_MULTI 0x01 /* Ena. Multispeed Packet Concatenation */
  104. #include <asm/byteorder.h>
  105. /* '1' '3' '9' '4' in ASCII */
  106. #define IEEE1394_BUSID_MAGIC cpu_to_be32(0x31333934)
  107. #ifdef __BIG_ENDIAN_BITFIELD
  108. struct selfid {
  109. u32 packet_identifier:2; /* always binary 10 */
  110. u32 phy_id:6;
  111. /* byte */
  112. u32 extended:1; /* if true is struct ext_selfid */
  113. u32 link_active:1;
  114. u32 gap_count:6;
  115. /* byte */
  116. u32 speed:2;
  117. u32 phy_delay:2;
  118. u32 contender:1;
  119. u32 power_class:3;
  120. /* byte */
  121. u32 port0:2;
  122. u32 port1:2;
  123. u32 port2:2;
  124. u32 initiated_reset:1;
  125. u32 more_packets:1;
  126. } __attribute__((packed));
  127. struct ext_selfid {
  128. u32 packet_identifier:2; /* always binary 10 */
  129. u32 phy_id:6;
  130. /* byte */
  131. u32 extended:1; /* if false is struct selfid */
  132. u32 seq_nr:3;
  133. u32 reserved:2;
  134. u32 porta:2;
  135. /* byte */
  136. u32 portb:2;
  137. u32 portc:2;
  138. u32 portd:2;
  139. u32 porte:2;
  140. /* byte */
  141. u32 portf:2;
  142. u32 portg:2;
  143. u32 porth:2;
  144. u32 reserved2:1;
  145. u32 more_packets:1;
  146. } __attribute__((packed));
  147. #elif defined __LITTLE_ENDIAN_BITFIELD /* __BIG_ENDIAN_BITFIELD */
  148. /*
  149. * Note: these mean to be bit fields of a big endian SelfID as seen on a little
  150. * endian machine. Without swapping.
  151. */
  152. struct selfid {
  153. u32 phy_id:6;
  154. u32 packet_identifier:2; /* always binary 10 */
  155. /* byte */
  156. u32 gap_count:6;
  157. u32 link_active:1;
  158. u32 extended:1; /* if true is struct ext_selfid */
  159. /* byte */
  160. u32 power_class:3;
  161. u32 contender:1;
  162. u32 phy_delay:2;
  163. u32 speed:2;
  164. /* byte */
  165. u32 more_packets:1;
  166. u32 initiated_reset:1;
  167. u32 port2:2;
  168. u32 port1:2;
  169. u32 port0:2;
  170. } __attribute__((packed));
  171. struct ext_selfid {
  172. u32 phy_id:6;
  173. u32 packet_identifier:2; /* always binary 10 */
  174. /* byte */
  175. u32 porta:2;
  176. u32 reserved:2;
  177. u32 seq_nr:3;
  178. u32 extended:1; /* if false is struct selfid */
  179. /* byte */
  180. u32 porte:2;
  181. u32 portd:2;
  182. u32 portc:2;
  183. u32 portb:2;
  184. /* byte */
  185. u32 more_packets:1;
  186. u32 reserved2:1;
  187. u32 porth:2;
  188. u32 portg:2;
  189. u32 portf:2;
  190. } __attribute__((packed));
  191. #else
  192. #error What? PDP endian?
  193. #endif /* __BIG_ENDIAN_BITFIELD */
  194. #endif /* _IEEE1394_IEEE1394_H */