ieee1394_core.c 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381
  1. /*
  2. * IEEE 1394 for Linux
  3. *
  4. * Core support: hpsb_packet management, packet handling and forwarding to
  5. * highlevel or lowlevel code
  6. *
  7. * Copyright (C) 1999, 2000 Andreas E. Bombe
  8. * 2002 Manfred Weihs <weihs@ict.tuwien.ac.at>
  9. *
  10. * This code is licensed under the GPL. See the file COPYING in the root
  11. * directory of the kernel sources for details.
  12. *
  13. *
  14. * Contributions:
  15. *
  16. * Manfred Weihs <weihs@ict.tuwien.ac.at>
  17. * loopback functionality in hpsb_send_packet
  18. * allow highlevel drivers to disable automatic response generation
  19. * and to generate responses themselves (deferred)
  20. *
  21. */
  22. #include <linux/kernel.h>
  23. #include <linux/list.h>
  24. #include <linux/string.h>
  25. #include <linux/init.h>
  26. #include <linux/slab.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/module.h>
  29. #include <linux/moduleparam.h>
  30. #include <linux/bitops.h>
  31. #include <linux/kdev_t.h>
  32. #include <linux/skbuff.h>
  33. #include <linux/suspend.h>
  34. #include <linux/kthread.h>
  35. #include <linux/preempt.h>
  36. #include <linux/time.h>
  37. #include <asm/system.h>
  38. #include <asm/byteorder.h>
  39. #include "ieee1394_types.h"
  40. #include "ieee1394.h"
  41. #include "hosts.h"
  42. #include "ieee1394_core.h"
  43. #include "highlevel.h"
  44. #include "ieee1394_transactions.h"
  45. #include "csr.h"
  46. #include "nodemgr.h"
  47. #include "dma.h"
  48. #include "iso.h"
  49. #include "config_roms.h"
  50. /*
  51. * Disable the nodemgr detection and config rom reading functionality.
  52. */
  53. static int disable_nodemgr;
  54. module_param(disable_nodemgr, int, 0444);
  55. MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality.");
  56. /* Disable Isochronous Resource Manager functionality */
  57. int hpsb_disable_irm = 0;
  58. module_param_named(disable_irm, hpsb_disable_irm, bool, 0444);
  59. MODULE_PARM_DESC(disable_irm,
  60. "Disable Isochronous Resource Manager functionality.");
  61. /* We are GPL, so treat us special */
  62. MODULE_LICENSE("GPL");
  63. /* Some globals used */
  64. const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" };
  65. struct class *hpsb_protocol_class;
  66. #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
  67. static void dump_packet(const char *text, quadlet_t *data, int size, int speed)
  68. {
  69. int i;
  70. size /= 4;
  71. size = (size > 4 ? 4 : size);
  72. printk(KERN_DEBUG "ieee1394: %s", text);
  73. if (speed > -1 && speed < 6)
  74. printk(" at %s", hpsb_speedto_str[speed]);
  75. printk(":");
  76. for (i = 0; i < size; i++)
  77. printk(" %08x", data[i]);
  78. printk("\n");
  79. }
  80. #else
  81. #define dump_packet(a,b,c,d) do {} while (0)
  82. #endif
  83. static void abort_requests(struct hpsb_host *host);
  84. static void queue_packet_complete(struct hpsb_packet *packet);
  85. /**
  86. * hpsb_set_packet_complete_task - set task that runs when a packet completes
  87. * @packet: the packet whose completion we want the task added to
  88. * @routine: function to call
  89. * @data: data (if any) to pass to the above function
  90. *
  91. * Set the task that runs when a packet completes. You cannot call this more
  92. * than once on a single packet before it is sent.
  93. */
  94. void hpsb_set_packet_complete_task(struct hpsb_packet *packet,
  95. void (*routine)(void *), void *data)
  96. {
  97. WARN_ON(packet->complete_routine != NULL);
  98. packet->complete_routine = routine;
  99. packet->complete_data = data;
  100. return;
  101. }
  102. /**
  103. * hpsb_alloc_packet - allocate new packet structure
  104. * @data_size: size of the data block to be allocated
  105. *
  106. * This function allocates, initializes and returns a new &struct hpsb_packet.
  107. * It can be used in interrupt context. A header block is always included, its
  108. * size is big enough to contain all possible 1394 headers. The data block is
  109. * only allocated when @data_size is not zero.
  110. *
  111. * For packets for which responses will be received the @data_size has to be big
  112. * enough to contain the response's data block since no further allocation
  113. * occurs at response matching time.
  114. *
  115. * The packet's generation value will be set to the current generation number
  116. * for ease of use. Remember to overwrite it with your own recorded generation
  117. * number if you can not be sure that your code will not race with a bus reset.
  118. *
  119. * Return value: A pointer to a &struct hpsb_packet or NULL on allocation
  120. * failure.
  121. */
  122. struct hpsb_packet *hpsb_alloc_packet(size_t data_size)
  123. {
  124. struct hpsb_packet *packet = NULL;
  125. struct sk_buff *skb;
  126. data_size = ((data_size + 3) & ~3);
  127. skb = alloc_skb(data_size + sizeof(*packet), GFP_ATOMIC);
  128. if (skb == NULL)
  129. return NULL;
  130. memset(skb->data, 0, data_size + sizeof(*packet));
  131. packet = (struct hpsb_packet *)skb->data;
  132. packet->skb = skb;
  133. packet->header = packet->embedded_header;
  134. packet->state = hpsb_unused;
  135. packet->generation = -1;
  136. INIT_LIST_HEAD(&packet->driver_list);
  137. atomic_set(&packet->refcnt, 1);
  138. if (data_size) {
  139. packet->data = (quadlet_t *)(skb->data + sizeof(*packet));
  140. packet->data_size = data_size;
  141. }
  142. return packet;
  143. }
  144. /**
  145. * hpsb_free_packet - free packet and data associated with it
  146. * @packet: packet to free (is NULL safe)
  147. *
  148. * This function will free packet->data and finally the packet itself.
  149. */
  150. void hpsb_free_packet(struct hpsb_packet *packet)
  151. {
  152. if (packet && atomic_dec_and_test(&packet->refcnt)) {
  153. BUG_ON(!list_empty(&packet->driver_list));
  154. kfree_skb(packet->skb);
  155. }
  156. }
  157. /**
  158. * hpsb_reset_bus - initiate bus reset on the given host
  159. * @host: host controller whose bus to reset
  160. * @type: one of enum reset_types
  161. *
  162. * Returns 1 if bus reset already in progress, 0 otherwise.
  163. */
  164. int hpsb_reset_bus(struct hpsb_host *host, int type)
  165. {
  166. if (!host->in_bus_reset) {
  167. host->driver->devctl(host, RESET_BUS, type);
  168. return 0;
  169. } else {
  170. return 1;
  171. }
  172. }
  173. /**
  174. * hpsb_read_cycle_timer - read cycle timer register and system time
  175. * @host: host whose isochronous cycle timer register is read
  176. * @cycle_timer: address of bitfield to return the register contents
  177. * @local_time: address to return the system time
  178. *
  179. * The format of * @cycle_timer, is described in OHCI 1.1 clause 5.13. This
  180. * format is also read from non-OHCI controllers. * @local_time contains the
  181. * system time in microseconds since the Epoch, read at the moment when the
  182. * cycle timer was read.
  183. *
  184. * Return value: 0 for success or error number otherwise.
  185. */
  186. int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer,
  187. u64 *local_time)
  188. {
  189. int ctr;
  190. struct timeval tv;
  191. unsigned long flags;
  192. if (!host || !cycle_timer || !local_time)
  193. return -EINVAL;
  194. preempt_disable();
  195. local_irq_save(flags);
  196. ctr = host->driver->devctl(host, GET_CYCLE_COUNTER, 0);
  197. if (ctr)
  198. do_gettimeofday(&tv);
  199. local_irq_restore(flags);
  200. preempt_enable();
  201. if (!ctr)
  202. return -EIO;
  203. *cycle_timer = ctr;
  204. *local_time = tv.tv_sec * 1000000ULL + tv.tv_usec;
  205. return 0;
  206. }
  207. /**
  208. * hpsb_bus_reset - notify a bus reset to the core
  209. *
  210. * For host driver module usage. Safe to use in interrupt context, although
  211. * quite complex; so you may want to run it in the bottom rather than top half.
  212. *
  213. * Returns 1 if bus reset already in progress, 0 otherwise.
  214. */
  215. int hpsb_bus_reset(struct hpsb_host *host)
  216. {
  217. if (host->in_bus_reset) {
  218. HPSB_NOTICE("%s called while bus reset already in progress",
  219. __FUNCTION__);
  220. return 1;
  221. }
  222. abort_requests(host);
  223. host->in_bus_reset = 1;
  224. host->irm_id = -1;
  225. host->is_irm = 0;
  226. host->busmgr_id = -1;
  227. host->is_busmgr = 0;
  228. host->is_cycmst = 0;
  229. host->node_count = 0;
  230. host->selfid_count = 0;
  231. return 0;
  232. }
  233. /*
  234. * Verify num_of_selfids SelfIDs and return number of nodes. Return zero in
  235. * case verification failed.
  236. */
  237. static int check_selfids(struct hpsb_host *host)
  238. {
  239. int nodeid = -1;
  240. int rest_of_selfids = host->selfid_count;
  241. struct selfid *sid = (struct selfid *)host->topology_map;
  242. struct ext_selfid *esid;
  243. int esid_seq = 23;
  244. host->nodes_active = 0;
  245. while (rest_of_selfids--) {
  246. if (!sid->extended) {
  247. nodeid++;
  248. esid_seq = 0;
  249. if (sid->phy_id != nodeid) {
  250. HPSB_INFO("SelfIDs failed monotony check with "
  251. "%d", sid->phy_id);
  252. return 0;
  253. }
  254. if (sid->link_active) {
  255. host->nodes_active++;
  256. if (sid->contender)
  257. host->irm_id = LOCAL_BUS | sid->phy_id;
  258. }
  259. } else {
  260. esid = (struct ext_selfid *)sid;
  261. if ((esid->phy_id != nodeid)
  262. || (esid->seq_nr != esid_seq)) {
  263. HPSB_INFO("SelfIDs failed monotony check with "
  264. "%d/%d", esid->phy_id, esid->seq_nr);
  265. return 0;
  266. }
  267. esid_seq++;
  268. }
  269. sid++;
  270. }
  271. esid = (struct ext_selfid *)(sid - 1);
  272. while (esid->extended) {
  273. if ((esid->porta == SELFID_PORT_PARENT) ||
  274. (esid->portb == SELFID_PORT_PARENT) ||
  275. (esid->portc == SELFID_PORT_PARENT) ||
  276. (esid->portd == SELFID_PORT_PARENT) ||
  277. (esid->porte == SELFID_PORT_PARENT) ||
  278. (esid->portf == SELFID_PORT_PARENT) ||
  279. (esid->portg == SELFID_PORT_PARENT) ||
  280. (esid->porth == SELFID_PORT_PARENT)) {
  281. HPSB_INFO("SelfIDs failed root check on "
  282. "extended SelfID");
  283. return 0;
  284. }
  285. esid--;
  286. }
  287. sid = (struct selfid *)esid;
  288. if ((sid->port0 == SELFID_PORT_PARENT) ||
  289. (sid->port1 == SELFID_PORT_PARENT) ||
  290. (sid->port2 == SELFID_PORT_PARENT)) {
  291. HPSB_INFO("SelfIDs failed root check");
  292. return 0;
  293. }
  294. host->node_count = nodeid + 1;
  295. return 1;
  296. }
  297. static void build_speed_map(struct hpsb_host *host, int nodecount)
  298. {
  299. u8 cldcnt[nodecount];
  300. u8 *map = host->speed_map;
  301. u8 *speedcap = host->speed;
  302. struct selfid *sid;
  303. struct ext_selfid *esid;
  304. int i, j, n;
  305. for (i = 0; i < (nodecount * 64); i += 64) {
  306. for (j = 0; j < nodecount; j++) {
  307. map[i+j] = IEEE1394_SPEED_MAX;
  308. }
  309. }
  310. for (i = 0; i < nodecount; i++) {
  311. cldcnt[i] = 0;
  312. }
  313. /* find direct children count and speed */
  314. for (sid = (struct selfid *)&host->topology_map[host->selfid_count-1],
  315. n = nodecount - 1;
  316. (void *)sid >= (void *)host->topology_map; sid--) {
  317. if (sid->extended) {
  318. esid = (struct ext_selfid *)sid;
  319. if (esid->porta == SELFID_PORT_CHILD) cldcnt[n]++;
  320. if (esid->portb == SELFID_PORT_CHILD) cldcnt[n]++;
  321. if (esid->portc == SELFID_PORT_CHILD) cldcnt[n]++;
  322. if (esid->portd == SELFID_PORT_CHILD) cldcnt[n]++;
  323. if (esid->porte == SELFID_PORT_CHILD) cldcnt[n]++;
  324. if (esid->portf == SELFID_PORT_CHILD) cldcnt[n]++;
  325. if (esid->portg == SELFID_PORT_CHILD) cldcnt[n]++;
  326. if (esid->porth == SELFID_PORT_CHILD) cldcnt[n]++;
  327. } else {
  328. if (sid->port0 == SELFID_PORT_CHILD) cldcnt[n]++;
  329. if (sid->port1 == SELFID_PORT_CHILD) cldcnt[n]++;
  330. if (sid->port2 == SELFID_PORT_CHILD) cldcnt[n]++;
  331. speedcap[n] = sid->speed;
  332. n--;
  333. }
  334. }
  335. /* set self mapping */
  336. for (i = 0; i < nodecount; i++) {
  337. map[64*i + i] = speedcap[i];
  338. }
  339. /* fix up direct children count to total children count;
  340. * also fix up speedcaps for sibling and parent communication */
  341. for (i = 1; i < nodecount; i++) {
  342. for (j = cldcnt[i], n = i - 1; j > 0; j--) {
  343. cldcnt[i] += cldcnt[n];
  344. speedcap[n] = min(speedcap[n], speedcap[i]);
  345. n -= cldcnt[n] + 1;
  346. }
  347. }
  348. for (n = 0; n < nodecount; n++) {
  349. for (i = n - cldcnt[n]; i <= n; i++) {
  350. for (j = 0; j < (n - cldcnt[n]); j++) {
  351. map[j*64 + i] = map[i*64 + j] =
  352. min(map[i*64 + j], speedcap[n]);
  353. }
  354. for (j = n + 1; j < nodecount; j++) {
  355. map[j*64 + i] = map[i*64 + j] =
  356. min(map[i*64 + j], speedcap[n]);
  357. }
  358. }
  359. }
  360. #if SELFID_SPEED_UNKNOWN != IEEE1394_SPEED_MAX
  361. /* assume maximum speed for 1394b PHYs, nodemgr will correct it */
  362. for (n = 0; n < nodecount; n++)
  363. if (speedcap[n] == SELFID_SPEED_UNKNOWN)
  364. speedcap[n] = IEEE1394_SPEED_MAX;
  365. #endif
  366. }
  367. /**
  368. * hpsb_selfid_received - hand over received selfid packet to the core
  369. *
  370. * For host driver module usage. Safe to use in interrupt context.
  371. *
  372. * The host driver should have done a successful complement check (second
  373. * quadlet is complement of first) beforehand.
  374. */
  375. void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid)
  376. {
  377. if (host->in_bus_reset) {
  378. HPSB_VERBOSE("Including SelfID 0x%x", sid);
  379. host->topology_map[host->selfid_count++] = sid;
  380. } else {
  381. HPSB_NOTICE("Spurious SelfID packet (0x%08x) received from bus %d",
  382. sid, NODEID_TO_BUS(host->node_id));
  383. }
  384. }
  385. /**
  386. * hpsb_selfid_complete - notify completion of SelfID stage to the core
  387. *
  388. * For host driver module usage. Safe to use in interrupt context, although
  389. * quite complex; so you may want to run it in the bottom rather than top half.
  390. *
  391. * Notify completion of SelfID stage to the core and report new physical ID
  392. * and whether host is root now.
  393. */
  394. void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot)
  395. {
  396. if (!host->in_bus_reset)
  397. HPSB_NOTICE("SelfID completion called outside of bus reset!");
  398. host->node_id = LOCAL_BUS | phyid;
  399. host->is_root = isroot;
  400. if (!check_selfids(host)) {
  401. if (host->reset_retries++ < 20) {
  402. /* selfid stage did not complete without error */
  403. HPSB_NOTICE("Error in SelfID stage, resetting");
  404. host->in_bus_reset = 0;
  405. /* this should work from ohci1394 now... */
  406. hpsb_reset_bus(host, LONG_RESET);
  407. return;
  408. } else {
  409. HPSB_NOTICE("Stopping out-of-control reset loop");
  410. HPSB_NOTICE("Warning - topology map and speed map will not be valid");
  411. host->reset_retries = 0;
  412. }
  413. } else {
  414. host->reset_retries = 0;
  415. build_speed_map(host, host->node_count);
  416. }
  417. HPSB_VERBOSE("selfid_complete called with successful SelfID stage "
  418. "... irm_id: 0x%X node_id: 0x%X",host->irm_id,host->node_id);
  419. /* irm_id is kept up to date by check_selfids() */
  420. if (host->irm_id == host->node_id) {
  421. host->is_irm = 1;
  422. } else {
  423. host->is_busmgr = 0;
  424. host->is_irm = 0;
  425. }
  426. if (isroot) {
  427. host->driver->devctl(host, ACT_CYCLE_MASTER, 1);
  428. host->is_cycmst = 1;
  429. }
  430. atomic_inc(&host->generation);
  431. host->in_bus_reset = 0;
  432. highlevel_host_reset(host);
  433. }
  434. /**
  435. * hpsb_packet_sent - notify core of sending a packet
  436. *
  437. * For host driver module usage. Safe to call from within a transmit packet
  438. * routine.
  439. *
  440. * Notify core of sending a packet. Ackcode is the ack code returned for async
  441. * transmits or ACKX_SEND_ERROR if the transmission failed completely; ACKX_NONE
  442. * for other cases (internal errors that don't justify a panic).
  443. */
  444. void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet,
  445. int ackcode)
  446. {
  447. unsigned long flags;
  448. spin_lock_irqsave(&host->pending_packet_queue.lock, flags);
  449. packet->ack_code = ackcode;
  450. if (packet->no_waiter || packet->state == hpsb_complete) {
  451. /* if packet->no_waiter, must not have a tlabel allocated */
  452. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  453. hpsb_free_packet(packet);
  454. return;
  455. }
  456. atomic_dec(&packet->refcnt); /* drop HC's reference */
  457. /* here the packet must be on the host->pending_packet_queue */
  458. if (ackcode != ACK_PENDING || !packet->expect_response) {
  459. packet->state = hpsb_complete;
  460. __skb_unlink(packet->skb, &host->pending_packet_queue);
  461. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  462. queue_packet_complete(packet);
  463. return;
  464. }
  465. packet->state = hpsb_pending;
  466. packet->sendtime = jiffies;
  467. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  468. mod_timer(&host->timeout, jiffies + host->timeout_interval);
  469. }
  470. /**
  471. * hpsb_send_phy_config - transmit a PHY configuration packet on the bus
  472. * @host: host that PHY config packet gets sent through
  473. * @rootid: root whose force_root bit should get set (-1 = don't set force_root)
  474. * @gapcnt: gap count value to set (-1 = don't set gap count)
  475. *
  476. * This function sends a PHY config packet on the bus through the specified
  477. * host.
  478. *
  479. * Return value: 0 for success or negative error number otherwise.
  480. */
  481. int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
  482. {
  483. struct hpsb_packet *packet;
  484. quadlet_t d = 0;
  485. int retval = 0;
  486. if (rootid >= ALL_NODES || rootid < -1 || gapcnt > 0x3f || gapcnt < -1 ||
  487. (rootid == -1 && gapcnt == -1)) {
  488. HPSB_DEBUG("Invalid Parameter: rootid = %d gapcnt = %d",
  489. rootid, gapcnt);
  490. return -EINVAL;
  491. }
  492. if (rootid != -1)
  493. d |= PHYPACKET_PHYCONFIG_R | rootid << PHYPACKET_PORT_SHIFT;
  494. if (gapcnt != -1)
  495. d |= PHYPACKET_PHYCONFIG_T | gapcnt << PHYPACKET_GAPCOUNT_SHIFT;
  496. packet = hpsb_make_phypacket(host, d);
  497. if (!packet)
  498. return -ENOMEM;
  499. packet->generation = get_hpsb_generation(host);
  500. retval = hpsb_send_packet_and_wait(packet);
  501. hpsb_free_packet(packet);
  502. return retval;
  503. }
  504. /**
  505. * hpsb_send_packet - transmit a packet on the bus
  506. * @packet: packet to send
  507. *
  508. * The packet is sent through the host specified in the packet->host field.
  509. * Before sending, the packet's transmit speed is automatically determined
  510. * using the local speed map when it is an async, non-broadcast packet.
  511. *
  512. * Possibilities for failure are that host is either not initialized, in bus
  513. * reset, the packet's generation number doesn't match the current generation
  514. * number or the host reports a transmit error.
  515. *
  516. * Return value: 0 on success, negative errno on failure.
  517. */
  518. int hpsb_send_packet(struct hpsb_packet *packet)
  519. {
  520. struct hpsb_host *host = packet->host;
  521. if (host->is_shutdown)
  522. return -EINVAL;
  523. if (host->in_bus_reset ||
  524. (packet->generation != get_hpsb_generation(host)))
  525. return -EAGAIN;
  526. packet->state = hpsb_queued;
  527. /* This just seems silly to me */
  528. WARN_ON(packet->no_waiter && packet->expect_response);
  529. if (!packet->no_waiter || packet->expect_response) {
  530. atomic_inc(&packet->refcnt);
  531. /* Set the initial "sendtime" to 10 seconds from now, to
  532. prevent premature expiry. If a packet takes more than
  533. 10 seconds to hit the wire, we have bigger problems :) */
  534. packet->sendtime = jiffies + 10 * HZ;
  535. skb_queue_tail(&host->pending_packet_queue, packet->skb);
  536. }
  537. if (packet->node_id == host->node_id) {
  538. /* it is a local request, so handle it locally */
  539. quadlet_t *data;
  540. size_t size = packet->data_size + packet->header_size;
  541. data = kmalloc(size, GFP_ATOMIC);
  542. if (!data) {
  543. HPSB_ERR("unable to allocate memory for concatenating header and data");
  544. return -ENOMEM;
  545. }
  546. memcpy(data, packet->header, packet->header_size);
  547. if (packet->data_size)
  548. memcpy(((u8*)data) + packet->header_size, packet->data, packet->data_size);
  549. dump_packet("send packet local", packet->header, packet->header_size, -1);
  550. hpsb_packet_sent(host, packet, packet->expect_response ? ACK_PENDING : ACK_COMPLETE);
  551. hpsb_packet_received(host, data, size, 0);
  552. kfree(data);
  553. return 0;
  554. }
  555. if (packet->type == hpsb_async &&
  556. NODEID_TO_NODE(packet->node_id) != ALL_NODES)
  557. packet->speed_code =
  558. host->speed[NODEID_TO_NODE(packet->node_id)];
  559. dump_packet("send packet", packet->header, packet->header_size, packet->speed_code);
  560. return host->driver->transmit_packet(host, packet);
  561. }
  562. /* We could just use complete() directly as the packet complete
  563. * callback, but this is more typesafe, in the sense that we get a
  564. * compiler error if the prototype for complete() changes. */
  565. static void complete_packet(void *data)
  566. {
  567. complete((struct completion *) data);
  568. }
  569. /**
  570. * hpsb_send_packet_and_wait - enqueue packet, block until transaction completes
  571. * @packet: packet to send
  572. *
  573. * Return value: 0 on success, negative errno on failure.
  574. */
  575. int hpsb_send_packet_and_wait(struct hpsb_packet *packet)
  576. {
  577. struct completion done;
  578. int retval;
  579. init_completion(&done);
  580. hpsb_set_packet_complete_task(packet, complete_packet, &done);
  581. retval = hpsb_send_packet(packet);
  582. if (retval == 0)
  583. wait_for_completion(&done);
  584. return retval;
  585. }
  586. static void send_packet_nocare(struct hpsb_packet *packet)
  587. {
  588. if (hpsb_send_packet(packet) < 0) {
  589. hpsb_free_packet(packet);
  590. }
  591. }
  592. static void handle_packet_response(struct hpsb_host *host, int tcode,
  593. quadlet_t *data, size_t size)
  594. {
  595. struct hpsb_packet *packet = NULL;
  596. struct sk_buff *skb;
  597. int tcode_match = 0;
  598. int tlabel;
  599. unsigned long flags;
  600. tlabel = (data[0] >> 10) & 0x3f;
  601. spin_lock_irqsave(&host->pending_packet_queue.lock, flags);
  602. skb_queue_walk(&host->pending_packet_queue, skb) {
  603. packet = (struct hpsb_packet *)skb->data;
  604. if ((packet->tlabel == tlabel)
  605. && (packet->node_id == (data[1] >> 16))){
  606. break;
  607. }
  608. packet = NULL;
  609. }
  610. if (packet == NULL) {
  611. HPSB_DEBUG("unsolicited response packet received - no tlabel match");
  612. dump_packet("contents", data, 16, -1);
  613. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  614. return;
  615. }
  616. switch (packet->tcode) {
  617. case TCODE_WRITEQ:
  618. case TCODE_WRITEB:
  619. if (tcode != TCODE_WRITE_RESPONSE)
  620. break;
  621. tcode_match = 1;
  622. memcpy(packet->header, data, 12);
  623. break;
  624. case TCODE_READQ:
  625. if (tcode != TCODE_READQ_RESPONSE)
  626. break;
  627. tcode_match = 1;
  628. memcpy(packet->header, data, 16);
  629. break;
  630. case TCODE_READB:
  631. if (tcode != TCODE_READB_RESPONSE)
  632. break;
  633. tcode_match = 1;
  634. BUG_ON(packet->skb->len - sizeof(*packet) < size - 16);
  635. memcpy(packet->header, data, 16);
  636. memcpy(packet->data, data + 4, size - 16);
  637. break;
  638. case TCODE_LOCK_REQUEST:
  639. if (tcode != TCODE_LOCK_RESPONSE)
  640. break;
  641. tcode_match = 1;
  642. size = min((size - 16), (size_t)8);
  643. BUG_ON(packet->skb->len - sizeof(*packet) < size);
  644. memcpy(packet->header, data, 16);
  645. memcpy(packet->data, data + 4, size);
  646. break;
  647. }
  648. if (!tcode_match) {
  649. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  650. HPSB_INFO("unsolicited response packet received - tcode mismatch");
  651. dump_packet("contents", data, 16, -1);
  652. return;
  653. }
  654. __skb_unlink(skb, &host->pending_packet_queue);
  655. if (packet->state == hpsb_queued) {
  656. packet->sendtime = jiffies;
  657. packet->ack_code = ACK_PENDING;
  658. }
  659. packet->state = hpsb_complete;
  660. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  661. queue_packet_complete(packet);
  662. }
  663. static struct hpsb_packet *create_reply_packet(struct hpsb_host *host,
  664. quadlet_t *data, size_t dsize)
  665. {
  666. struct hpsb_packet *p;
  667. p = hpsb_alloc_packet(dsize);
  668. if (unlikely(p == NULL)) {
  669. /* FIXME - send data_error response */
  670. return NULL;
  671. }
  672. p->type = hpsb_async;
  673. p->state = hpsb_unused;
  674. p->host = host;
  675. p->node_id = data[1] >> 16;
  676. p->tlabel = (data[0] >> 10) & 0x3f;
  677. p->no_waiter = 1;
  678. p->generation = get_hpsb_generation(host);
  679. if (dsize % 4)
  680. p->data[dsize / 4] = 0;
  681. return p;
  682. }
  683. #define PREP_ASYNC_HEAD_RCODE(tc) \
  684. packet->tcode = tc; \
  685. packet->header[0] = (packet->node_id << 16) | (packet->tlabel << 10) \
  686. | (1 << 8) | (tc << 4); \
  687. packet->header[1] = (packet->host->node_id << 16) | (rcode << 12); \
  688. packet->header[2] = 0
  689. static void fill_async_readquad_resp(struct hpsb_packet *packet, int rcode,
  690. quadlet_t data)
  691. {
  692. PREP_ASYNC_HEAD_RCODE(TCODE_READQ_RESPONSE);
  693. packet->header[3] = data;
  694. packet->header_size = 16;
  695. packet->data_size = 0;
  696. }
  697. static void fill_async_readblock_resp(struct hpsb_packet *packet, int rcode,
  698. int length)
  699. {
  700. if (rcode != RCODE_COMPLETE)
  701. length = 0;
  702. PREP_ASYNC_HEAD_RCODE(TCODE_READB_RESPONSE);
  703. packet->header[3] = length << 16;
  704. packet->header_size = 16;
  705. packet->data_size = length + (length % 4 ? 4 - (length % 4) : 0);
  706. }
  707. static void fill_async_write_resp(struct hpsb_packet *packet, int rcode)
  708. {
  709. PREP_ASYNC_HEAD_RCODE(TCODE_WRITE_RESPONSE);
  710. packet->header[2] = 0;
  711. packet->header_size = 12;
  712. packet->data_size = 0;
  713. }
  714. static void fill_async_lock_resp(struct hpsb_packet *packet, int rcode, int extcode,
  715. int length)
  716. {
  717. if (rcode != RCODE_COMPLETE)
  718. length = 0;
  719. PREP_ASYNC_HEAD_RCODE(TCODE_LOCK_RESPONSE);
  720. packet->header[3] = (length << 16) | extcode;
  721. packet->header_size = 16;
  722. packet->data_size = length;
  723. }
  724. #define PREP_REPLY_PACKET(length) \
  725. packet = create_reply_packet(host, data, length); \
  726. if (packet == NULL) break
  727. static void handle_incoming_packet(struct hpsb_host *host, int tcode,
  728. quadlet_t *data, size_t size, int write_acked)
  729. {
  730. struct hpsb_packet *packet;
  731. int length, rcode, extcode;
  732. quadlet_t buffer;
  733. nodeid_t source = data[1] >> 16;
  734. nodeid_t dest = data[0] >> 16;
  735. u16 flags = (u16) data[0];
  736. u64 addr;
  737. /* big FIXME - no error checking is done for an out of bounds length */
  738. switch (tcode) {
  739. case TCODE_WRITEQ:
  740. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  741. rcode = highlevel_write(host, source, dest, data+3,
  742. addr, 4, flags);
  743. if (!write_acked
  744. && (NODEID_TO_NODE(data[0] >> 16) != NODE_MASK)
  745. && (rcode >= 0)) {
  746. /* not a broadcast write, reply */
  747. PREP_REPLY_PACKET(0);
  748. fill_async_write_resp(packet, rcode);
  749. send_packet_nocare(packet);
  750. }
  751. break;
  752. case TCODE_WRITEB:
  753. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  754. rcode = highlevel_write(host, source, dest, data+4,
  755. addr, data[3]>>16, flags);
  756. if (!write_acked
  757. && (NODEID_TO_NODE(data[0] >> 16) != NODE_MASK)
  758. && (rcode >= 0)) {
  759. /* not a broadcast write, reply */
  760. PREP_REPLY_PACKET(0);
  761. fill_async_write_resp(packet, rcode);
  762. send_packet_nocare(packet);
  763. }
  764. break;
  765. case TCODE_READQ:
  766. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  767. rcode = highlevel_read(host, source, &buffer, addr, 4, flags);
  768. if (rcode >= 0) {
  769. PREP_REPLY_PACKET(0);
  770. fill_async_readquad_resp(packet, rcode, buffer);
  771. send_packet_nocare(packet);
  772. }
  773. break;
  774. case TCODE_READB:
  775. length = data[3] >> 16;
  776. PREP_REPLY_PACKET(length);
  777. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  778. rcode = highlevel_read(host, source, packet->data, addr,
  779. length, flags);
  780. if (rcode >= 0) {
  781. fill_async_readblock_resp(packet, rcode, length);
  782. send_packet_nocare(packet);
  783. } else {
  784. hpsb_free_packet(packet);
  785. }
  786. break;
  787. case TCODE_LOCK_REQUEST:
  788. length = data[3] >> 16;
  789. extcode = data[3] & 0xffff;
  790. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  791. PREP_REPLY_PACKET(8);
  792. if ((extcode == 0) || (extcode >= 7)) {
  793. /* let switch default handle error */
  794. length = 0;
  795. }
  796. switch (length) {
  797. case 4:
  798. rcode = highlevel_lock(host, source, packet->data, addr,
  799. data[4], 0, extcode,flags);
  800. fill_async_lock_resp(packet, rcode, extcode, 4);
  801. break;
  802. case 8:
  803. if ((extcode != EXTCODE_FETCH_ADD)
  804. && (extcode != EXTCODE_LITTLE_ADD)) {
  805. rcode = highlevel_lock(host, source,
  806. packet->data, addr,
  807. data[5], data[4],
  808. extcode, flags);
  809. fill_async_lock_resp(packet, rcode, extcode, 4);
  810. } else {
  811. rcode = highlevel_lock64(host, source,
  812. (octlet_t *)packet->data, addr,
  813. *(octlet_t *)(data + 4), 0ULL,
  814. extcode, flags);
  815. fill_async_lock_resp(packet, rcode, extcode, 8);
  816. }
  817. break;
  818. case 16:
  819. rcode = highlevel_lock64(host, source,
  820. (octlet_t *)packet->data, addr,
  821. *(octlet_t *)(data + 6),
  822. *(octlet_t *)(data + 4),
  823. extcode, flags);
  824. fill_async_lock_resp(packet, rcode, extcode, 8);
  825. break;
  826. default:
  827. rcode = RCODE_TYPE_ERROR;
  828. fill_async_lock_resp(packet, rcode,
  829. extcode, 0);
  830. }
  831. if (rcode >= 0) {
  832. send_packet_nocare(packet);
  833. } else {
  834. hpsb_free_packet(packet);
  835. }
  836. break;
  837. }
  838. }
  839. #undef PREP_REPLY_PACKET
  840. /**
  841. * hpsb_packet_received - hand over received packet to the core
  842. *
  843. * For host driver module usage.
  844. *
  845. * The contents of data are expected to be the full packet but with the CRCs
  846. * left out (data block follows header immediately), with the header (i.e. the
  847. * first four quadlets) in machine byte order and the data block in big endian.
  848. * *@data can be safely overwritten after this call.
  849. *
  850. * If the packet is a write request, @write_acked is to be set to true if it was
  851. * ack_complete'd already, false otherwise. This argument is ignored for any
  852. * other packet type.
  853. */
  854. void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,
  855. int write_acked)
  856. {
  857. int tcode;
  858. if (host->in_bus_reset) {
  859. HPSB_INFO("received packet during reset; ignoring");
  860. return;
  861. }
  862. dump_packet("received packet", data, size, -1);
  863. tcode = (data[0] >> 4) & 0xf;
  864. switch (tcode) {
  865. case TCODE_WRITE_RESPONSE:
  866. case TCODE_READQ_RESPONSE:
  867. case TCODE_READB_RESPONSE:
  868. case TCODE_LOCK_RESPONSE:
  869. handle_packet_response(host, tcode, data, size);
  870. break;
  871. case TCODE_WRITEQ:
  872. case TCODE_WRITEB:
  873. case TCODE_READQ:
  874. case TCODE_READB:
  875. case TCODE_LOCK_REQUEST:
  876. handle_incoming_packet(host, tcode, data, size, write_acked);
  877. break;
  878. case TCODE_ISO_DATA:
  879. highlevel_iso_receive(host, data, size);
  880. break;
  881. case TCODE_CYCLE_START:
  882. /* simply ignore this packet if it is passed on */
  883. break;
  884. default:
  885. HPSB_NOTICE("received packet with bogus transaction code %d",
  886. tcode);
  887. break;
  888. }
  889. }
  890. static void abort_requests(struct hpsb_host *host)
  891. {
  892. struct hpsb_packet *packet;
  893. struct sk_buff *skb;
  894. host->driver->devctl(host, CANCEL_REQUESTS, 0);
  895. while ((skb = skb_dequeue(&host->pending_packet_queue)) != NULL) {
  896. packet = (struct hpsb_packet *)skb->data;
  897. packet->state = hpsb_complete;
  898. packet->ack_code = ACKX_ABORTED;
  899. queue_packet_complete(packet);
  900. }
  901. }
  902. void abort_timedouts(unsigned long __opaque)
  903. {
  904. struct hpsb_host *host = (struct hpsb_host *)__opaque;
  905. unsigned long flags;
  906. struct hpsb_packet *packet;
  907. struct sk_buff *skb;
  908. unsigned long expire;
  909. spin_lock_irqsave(&host->csr.lock, flags);
  910. expire = host->csr.expire;
  911. spin_unlock_irqrestore(&host->csr.lock, flags);
  912. /* Hold the lock around this, since we aren't dequeuing all
  913. * packets, just ones we need. */
  914. spin_lock_irqsave(&host->pending_packet_queue.lock, flags);
  915. while (!skb_queue_empty(&host->pending_packet_queue)) {
  916. skb = skb_peek(&host->pending_packet_queue);
  917. packet = (struct hpsb_packet *)skb->data;
  918. if (time_before(packet->sendtime + expire, jiffies)) {
  919. __skb_unlink(skb, &host->pending_packet_queue);
  920. packet->state = hpsb_complete;
  921. packet->ack_code = ACKX_TIMEOUT;
  922. queue_packet_complete(packet);
  923. } else {
  924. /* Since packets are added to the tail, the oldest
  925. * ones are first, always. When we get to one that
  926. * isn't timed out, the rest aren't either. */
  927. break;
  928. }
  929. }
  930. if (!skb_queue_empty(&host->pending_packet_queue))
  931. mod_timer(&host->timeout, jiffies + host->timeout_interval);
  932. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  933. }
  934. /* Kernel thread and vars, which handles packets that are completed. Only
  935. * packets that have a "complete" function are sent here. This way, the
  936. * completion is run out of kernel context, and doesn't block the rest of
  937. * the stack. */
  938. static struct task_struct *khpsbpkt_thread;
  939. static struct sk_buff_head hpsbpkt_queue;
  940. static void queue_packet_complete(struct hpsb_packet *packet)
  941. {
  942. if (packet->no_waiter) {
  943. hpsb_free_packet(packet);
  944. return;
  945. }
  946. if (packet->complete_routine != NULL) {
  947. skb_queue_tail(&hpsbpkt_queue, packet->skb);
  948. wake_up_process(khpsbpkt_thread);
  949. }
  950. return;
  951. }
  952. static int hpsbpkt_thread(void *__hi)
  953. {
  954. struct sk_buff *skb;
  955. struct hpsb_packet *packet;
  956. void (*complete_routine)(void*);
  957. void *complete_data;
  958. current->flags |= PF_NOFREEZE;
  959. while (!kthread_should_stop()) {
  960. while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) {
  961. packet = (struct hpsb_packet *)skb->data;
  962. complete_routine = packet->complete_routine;
  963. complete_data = packet->complete_data;
  964. packet->complete_routine = packet->complete_data = NULL;
  965. complete_routine(complete_data);
  966. }
  967. set_current_state(TASK_INTERRUPTIBLE);
  968. if (!skb_peek(&hpsbpkt_queue))
  969. schedule();
  970. __set_current_state(TASK_RUNNING);
  971. }
  972. return 0;
  973. }
  974. static int __init ieee1394_init(void)
  975. {
  976. int i, ret;
  977. skb_queue_head_init(&hpsbpkt_queue);
  978. /* non-fatal error */
  979. if (hpsb_init_config_roms()) {
  980. HPSB_ERR("Failed to initialize some config rom entries.\n");
  981. HPSB_ERR("Some features may not be available\n");
  982. }
  983. khpsbpkt_thread = kthread_run(hpsbpkt_thread, NULL, "khpsbpkt");
  984. if (IS_ERR(khpsbpkt_thread)) {
  985. HPSB_ERR("Failed to start hpsbpkt thread!\n");
  986. ret = PTR_ERR(khpsbpkt_thread);
  987. goto exit_cleanup_config_roms;
  988. }
  989. if (register_chrdev_region(IEEE1394_CORE_DEV, 256, "ieee1394")) {
  990. HPSB_ERR("unable to register character device major %d!\n", IEEE1394_MAJOR);
  991. ret = -ENODEV;
  992. goto exit_release_kernel_thread;
  993. }
  994. ret = bus_register(&ieee1394_bus_type);
  995. if (ret < 0) {
  996. HPSB_INFO("bus register failed");
  997. goto release_chrdev;
  998. }
  999. for (i = 0; fw_bus_attrs[i]; i++) {
  1000. ret = bus_create_file(&ieee1394_bus_type, fw_bus_attrs[i]);
  1001. if (ret < 0) {
  1002. while (i >= 0) {
  1003. bus_remove_file(&ieee1394_bus_type,
  1004. fw_bus_attrs[i--]);
  1005. }
  1006. bus_unregister(&ieee1394_bus_type);
  1007. goto release_chrdev;
  1008. }
  1009. }
  1010. ret = class_register(&hpsb_host_class);
  1011. if (ret < 0)
  1012. goto release_all_bus;
  1013. hpsb_protocol_class = class_create(THIS_MODULE, "ieee1394_protocol");
  1014. if (IS_ERR(hpsb_protocol_class)) {
  1015. ret = PTR_ERR(hpsb_protocol_class);
  1016. goto release_class_host;
  1017. }
  1018. ret = init_csr();
  1019. if (ret) {
  1020. HPSB_INFO("init csr failed");
  1021. ret = -ENOMEM;
  1022. goto release_class_protocol;
  1023. }
  1024. if (disable_nodemgr) {
  1025. HPSB_INFO("nodemgr and IRM functionality disabled");
  1026. /* We shouldn't contend for IRM with nodemgr disabled, since
  1027. nodemgr implements functionality required of ieee1394a-2000
  1028. IRMs */
  1029. hpsb_disable_irm = 1;
  1030. return 0;
  1031. }
  1032. if (hpsb_disable_irm) {
  1033. HPSB_INFO("IRM functionality disabled");
  1034. }
  1035. ret = init_ieee1394_nodemgr();
  1036. if (ret < 0) {
  1037. HPSB_INFO("init nodemgr failed");
  1038. goto cleanup_csr;
  1039. }
  1040. return 0;
  1041. cleanup_csr:
  1042. cleanup_csr();
  1043. release_class_protocol:
  1044. class_destroy(hpsb_protocol_class);
  1045. release_class_host:
  1046. class_unregister(&hpsb_host_class);
  1047. release_all_bus:
  1048. for (i = 0; fw_bus_attrs[i]; i++)
  1049. bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
  1050. bus_unregister(&ieee1394_bus_type);
  1051. release_chrdev:
  1052. unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
  1053. exit_release_kernel_thread:
  1054. kthread_stop(khpsbpkt_thread);
  1055. exit_cleanup_config_roms:
  1056. hpsb_cleanup_config_roms();
  1057. return ret;
  1058. }
  1059. static void __exit ieee1394_cleanup(void)
  1060. {
  1061. int i;
  1062. if (!disable_nodemgr)
  1063. cleanup_ieee1394_nodemgr();
  1064. cleanup_csr();
  1065. class_destroy(hpsb_protocol_class);
  1066. class_unregister(&hpsb_host_class);
  1067. for (i = 0; fw_bus_attrs[i]; i++)
  1068. bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
  1069. bus_unregister(&ieee1394_bus_type);
  1070. kthread_stop(khpsbpkt_thread);
  1071. hpsb_cleanup_config_roms();
  1072. unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
  1073. }
  1074. fs_initcall(ieee1394_init); /* same as ohci1394 */
  1075. module_exit(ieee1394_cleanup);
  1076. /* Exported symbols */
  1077. /** hosts.c **/
  1078. EXPORT_SYMBOL(hpsb_alloc_host);
  1079. EXPORT_SYMBOL(hpsb_add_host);
  1080. EXPORT_SYMBOL(hpsb_resume_host);
  1081. EXPORT_SYMBOL(hpsb_remove_host);
  1082. EXPORT_SYMBOL(hpsb_update_config_rom_image);
  1083. /** ieee1394_core.c **/
  1084. EXPORT_SYMBOL(hpsb_speedto_str);
  1085. EXPORT_SYMBOL(hpsb_protocol_class);
  1086. EXPORT_SYMBOL(hpsb_set_packet_complete_task);
  1087. EXPORT_SYMBOL(hpsb_alloc_packet);
  1088. EXPORT_SYMBOL(hpsb_free_packet);
  1089. EXPORT_SYMBOL(hpsb_send_packet);
  1090. EXPORT_SYMBOL(hpsb_reset_bus);
  1091. EXPORT_SYMBOL(hpsb_read_cycle_timer);
  1092. EXPORT_SYMBOL(hpsb_bus_reset);
  1093. EXPORT_SYMBOL(hpsb_selfid_received);
  1094. EXPORT_SYMBOL(hpsb_selfid_complete);
  1095. EXPORT_SYMBOL(hpsb_packet_sent);
  1096. EXPORT_SYMBOL(hpsb_packet_received);
  1097. EXPORT_SYMBOL_GPL(hpsb_disable_irm);
  1098. /** ieee1394_transactions.c **/
  1099. EXPORT_SYMBOL(hpsb_get_tlabel);
  1100. EXPORT_SYMBOL(hpsb_free_tlabel);
  1101. EXPORT_SYMBOL(hpsb_make_readpacket);
  1102. EXPORT_SYMBOL(hpsb_make_writepacket);
  1103. EXPORT_SYMBOL(hpsb_make_streampacket);
  1104. EXPORT_SYMBOL(hpsb_make_lockpacket);
  1105. EXPORT_SYMBOL(hpsb_make_lock64packet);
  1106. EXPORT_SYMBOL(hpsb_make_phypacket);
  1107. EXPORT_SYMBOL(hpsb_make_isopacket);
  1108. EXPORT_SYMBOL(hpsb_read);
  1109. EXPORT_SYMBOL(hpsb_write);
  1110. EXPORT_SYMBOL(hpsb_packet_success);
  1111. /** highlevel.c **/
  1112. EXPORT_SYMBOL(hpsb_register_highlevel);
  1113. EXPORT_SYMBOL(hpsb_unregister_highlevel);
  1114. EXPORT_SYMBOL(hpsb_register_addrspace);
  1115. EXPORT_SYMBOL(hpsb_unregister_addrspace);
  1116. EXPORT_SYMBOL(hpsb_allocate_and_register_addrspace);
  1117. EXPORT_SYMBOL(hpsb_listen_channel);
  1118. EXPORT_SYMBOL(hpsb_unlisten_channel);
  1119. EXPORT_SYMBOL(hpsb_get_hostinfo);
  1120. EXPORT_SYMBOL(hpsb_create_hostinfo);
  1121. EXPORT_SYMBOL(hpsb_destroy_hostinfo);
  1122. EXPORT_SYMBOL(hpsb_set_hostinfo_key);
  1123. EXPORT_SYMBOL(hpsb_get_hostinfo_bykey);
  1124. EXPORT_SYMBOL(hpsb_set_hostinfo);
  1125. EXPORT_SYMBOL(highlevel_host_reset);
  1126. /** nodemgr.c **/
  1127. EXPORT_SYMBOL(hpsb_node_fill_packet);
  1128. EXPORT_SYMBOL(hpsb_node_write);
  1129. EXPORT_SYMBOL(__hpsb_register_protocol);
  1130. EXPORT_SYMBOL(hpsb_unregister_protocol);
  1131. /** csr.c **/
  1132. EXPORT_SYMBOL(hpsb_update_config_rom);
  1133. /** dma.c **/
  1134. EXPORT_SYMBOL(dma_prog_region_init);
  1135. EXPORT_SYMBOL(dma_prog_region_alloc);
  1136. EXPORT_SYMBOL(dma_prog_region_free);
  1137. EXPORT_SYMBOL(dma_region_init);
  1138. EXPORT_SYMBOL(dma_region_alloc);
  1139. EXPORT_SYMBOL(dma_region_free);
  1140. EXPORT_SYMBOL(dma_region_sync_for_cpu);
  1141. EXPORT_SYMBOL(dma_region_sync_for_device);
  1142. EXPORT_SYMBOL(dma_region_mmap);
  1143. EXPORT_SYMBOL(dma_region_offset_to_bus);
  1144. /** iso.c **/
  1145. EXPORT_SYMBOL(hpsb_iso_xmit_init);
  1146. EXPORT_SYMBOL(hpsb_iso_recv_init);
  1147. EXPORT_SYMBOL(hpsb_iso_xmit_start);
  1148. EXPORT_SYMBOL(hpsb_iso_recv_start);
  1149. EXPORT_SYMBOL(hpsb_iso_recv_listen_channel);
  1150. EXPORT_SYMBOL(hpsb_iso_recv_unlisten_channel);
  1151. EXPORT_SYMBOL(hpsb_iso_recv_set_channel_mask);
  1152. EXPORT_SYMBOL(hpsb_iso_stop);
  1153. EXPORT_SYMBOL(hpsb_iso_shutdown);
  1154. EXPORT_SYMBOL(hpsb_iso_xmit_queue_packet);
  1155. EXPORT_SYMBOL(hpsb_iso_xmit_sync);
  1156. EXPORT_SYMBOL(hpsb_iso_recv_release_packets);
  1157. EXPORT_SYMBOL(hpsb_iso_n_ready);
  1158. EXPORT_SYMBOL(hpsb_iso_packet_sent);
  1159. EXPORT_SYMBOL(hpsb_iso_packet_received);
  1160. EXPORT_SYMBOL(hpsb_iso_wake);
  1161. EXPORT_SYMBOL(hpsb_iso_recv_flush);
  1162. /** csr1212.c **/
  1163. EXPORT_SYMBOL(csr1212_attach_keyval_to_directory);
  1164. EXPORT_SYMBOL(csr1212_detach_keyval_from_directory);
  1165. EXPORT_SYMBOL(csr1212_get_keyval);
  1166. EXPORT_SYMBOL(csr1212_new_directory);
  1167. EXPORT_SYMBOL(csr1212_parse_keyval);
  1168. EXPORT_SYMBOL(csr1212_read);
  1169. EXPORT_SYMBOL(csr1212_release_keyval);