ieee1394_core.c 34 KB

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