ieee1394_core.c 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323
  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, 0);
  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 speedcap[nodecount];
  249. u8 cldcnt[nodecount];
  250. u8 *map = host->speed_map;
  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. }
  310. void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid)
  311. {
  312. if (host->in_bus_reset) {
  313. HPSB_VERBOSE("Including SelfID 0x%x", sid);
  314. host->topology_map[host->selfid_count++] = sid;
  315. } else {
  316. HPSB_NOTICE("Spurious SelfID packet (0x%08x) received from bus %d",
  317. sid, NODEID_TO_BUS(host->node_id));
  318. }
  319. }
  320. void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot)
  321. {
  322. if (!host->in_bus_reset)
  323. HPSB_NOTICE("SelfID completion called outside of bus reset!");
  324. host->node_id = LOCAL_BUS | phyid;
  325. host->is_root = isroot;
  326. if (!check_selfids(host)) {
  327. if (host->reset_retries++ < 20) {
  328. /* selfid stage did not complete without error */
  329. HPSB_NOTICE("Error in SelfID stage, resetting");
  330. host->in_bus_reset = 0;
  331. /* this should work from ohci1394 now... */
  332. hpsb_reset_bus(host, LONG_RESET);
  333. return;
  334. } else {
  335. HPSB_NOTICE("Stopping out-of-control reset loop");
  336. HPSB_NOTICE("Warning - topology map and speed map will not be valid");
  337. host->reset_retries = 0;
  338. }
  339. } else {
  340. host->reset_retries = 0;
  341. build_speed_map(host, host->node_count);
  342. }
  343. HPSB_VERBOSE("selfid_complete called with successful SelfID stage "
  344. "... irm_id: 0x%X node_id: 0x%X",host->irm_id,host->node_id);
  345. /* irm_id is kept up to date by check_selfids() */
  346. if (host->irm_id == host->node_id) {
  347. host->is_irm = 1;
  348. } else {
  349. host->is_busmgr = 0;
  350. host->is_irm = 0;
  351. }
  352. if (isroot) {
  353. host->driver->devctl(host, ACT_CYCLE_MASTER, 1);
  354. host->is_cycmst = 1;
  355. }
  356. atomic_inc(&host->generation);
  357. host->in_bus_reset = 0;
  358. highlevel_host_reset(host);
  359. }
  360. void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet,
  361. int ackcode)
  362. {
  363. unsigned long flags;
  364. spin_lock_irqsave(&host->pending_packet_queue.lock, flags);
  365. packet->ack_code = ackcode;
  366. if (packet->no_waiter || packet->state == hpsb_complete) {
  367. /* if packet->no_waiter, must not have a tlabel allocated */
  368. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  369. hpsb_free_packet(packet);
  370. return;
  371. }
  372. atomic_dec(&packet->refcnt); /* drop HC's reference */
  373. /* here the packet must be on the host->pending_packet_queue */
  374. if (ackcode != ACK_PENDING || !packet->expect_response) {
  375. packet->state = hpsb_complete;
  376. __skb_unlink(packet->skb, &host->pending_packet_queue);
  377. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  378. queue_packet_complete(packet);
  379. return;
  380. }
  381. packet->state = hpsb_pending;
  382. packet->sendtime = jiffies;
  383. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  384. mod_timer(&host->timeout, jiffies + host->timeout_interval);
  385. }
  386. /**
  387. * hpsb_send_phy_config - transmit a PHY configuration packet on the bus
  388. * @host: host that PHY config packet gets sent through
  389. * @rootid: root whose force_root bit should get set (-1 = don't set force_root)
  390. * @gapcnt: gap count value to set (-1 = don't set gap count)
  391. *
  392. * This function sends a PHY config packet on the bus through the specified host.
  393. *
  394. * Return value: 0 for success or error number otherwise.
  395. */
  396. int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt)
  397. {
  398. struct hpsb_packet *packet;
  399. quadlet_t d = 0;
  400. int retval = 0;
  401. if (rootid >= ALL_NODES || rootid < -1 || gapcnt > 0x3f || gapcnt < -1 ||
  402. (rootid == -1 && gapcnt == -1)) {
  403. HPSB_DEBUG("Invalid Parameter: rootid = %d gapcnt = %d",
  404. rootid, gapcnt);
  405. return -EINVAL;
  406. }
  407. if (rootid != -1)
  408. d |= PHYPACKET_PHYCONFIG_R | rootid << PHYPACKET_PORT_SHIFT;
  409. if (gapcnt != -1)
  410. d |= PHYPACKET_PHYCONFIG_T | gapcnt << PHYPACKET_GAPCOUNT_SHIFT;
  411. packet = hpsb_make_phypacket(host, d);
  412. if (!packet)
  413. return -ENOMEM;
  414. packet->generation = get_hpsb_generation(host);
  415. retval = hpsb_send_packet_and_wait(packet);
  416. hpsb_free_packet(packet);
  417. return retval;
  418. }
  419. /**
  420. * hpsb_send_packet - transmit a packet on the bus
  421. * @packet: packet to send
  422. *
  423. * The packet is sent through the host specified in the packet->host field.
  424. * Before sending, the packet's transmit speed is automatically determined
  425. * using the local speed map when it is an async, non-broadcast packet.
  426. *
  427. * Possibilities for failure are that host is either not initialized, in bus
  428. * reset, the packet's generation number doesn't match the current generation
  429. * number or the host reports a transmit error.
  430. *
  431. * Return value: 0 on success, negative errno on failure.
  432. */
  433. int hpsb_send_packet(struct hpsb_packet *packet)
  434. {
  435. struct hpsb_host *host = packet->host;
  436. if (host->is_shutdown)
  437. return -EINVAL;
  438. if (host->in_bus_reset ||
  439. (packet->generation != get_hpsb_generation(host)))
  440. return -EAGAIN;
  441. packet->state = hpsb_queued;
  442. /* This just seems silly to me */
  443. WARN_ON(packet->no_waiter && packet->expect_response);
  444. if (!packet->no_waiter || packet->expect_response) {
  445. atomic_inc(&packet->refcnt);
  446. /* Set the initial "sendtime" to 10 seconds from now, to
  447. prevent premature expiry. If a packet takes more than
  448. 10 seconds to hit the wire, we have bigger problems :) */
  449. packet->sendtime = jiffies + 10 * HZ;
  450. skb_queue_tail(&host->pending_packet_queue, packet->skb);
  451. }
  452. if (packet->node_id == host->node_id) {
  453. /* it is a local request, so handle it locally */
  454. quadlet_t *data;
  455. size_t size = packet->data_size + packet->header_size;
  456. data = kmalloc(size, GFP_ATOMIC);
  457. if (!data) {
  458. HPSB_ERR("unable to allocate memory for concatenating header and data");
  459. return -ENOMEM;
  460. }
  461. memcpy(data, packet->header, packet->header_size);
  462. if (packet->data_size)
  463. memcpy(((u8*)data) + packet->header_size, packet->data, packet->data_size);
  464. dump_packet("send packet local", packet->header, packet->header_size, -1);
  465. hpsb_packet_sent(host, packet, packet->expect_response ? ACK_PENDING : ACK_COMPLETE);
  466. hpsb_packet_received(host, data, size, 0);
  467. kfree(data);
  468. return 0;
  469. }
  470. if (packet->type == hpsb_async && packet->node_id != ALL_NODES) {
  471. packet->speed_code =
  472. host->speed_map[NODEID_TO_NODE(host->node_id) * 64
  473. + NODEID_TO_NODE(packet->node_id)];
  474. }
  475. dump_packet("send packet", packet->header, packet->header_size, packet->speed_code);
  476. return host->driver->transmit_packet(host, packet);
  477. }
  478. /* We could just use complete() directly as the packet complete
  479. * callback, but this is more typesafe, in the sense that we get a
  480. * compiler error if the prototype for complete() changes. */
  481. static void complete_packet(void *data)
  482. {
  483. complete((struct completion *) data);
  484. }
  485. int hpsb_send_packet_and_wait(struct hpsb_packet *packet)
  486. {
  487. struct completion done;
  488. int retval;
  489. init_completion(&done);
  490. hpsb_set_packet_complete_task(packet, complete_packet, &done);
  491. retval = hpsb_send_packet(packet);
  492. if (retval == 0)
  493. wait_for_completion(&done);
  494. return retval;
  495. }
  496. static void send_packet_nocare(struct hpsb_packet *packet)
  497. {
  498. if (hpsb_send_packet(packet) < 0) {
  499. hpsb_free_packet(packet);
  500. }
  501. }
  502. static void handle_packet_response(struct hpsb_host *host, int tcode,
  503. quadlet_t *data, size_t size)
  504. {
  505. struct hpsb_packet *packet = NULL;
  506. struct sk_buff *skb;
  507. int tcode_match = 0;
  508. int tlabel;
  509. unsigned long flags;
  510. tlabel = (data[0] >> 10) & 0x3f;
  511. spin_lock_irqsave(&host->pending_packet_queue.lock, flags);
  512. skb_queue_walk(&host->pending_packet_queue, skb) {
  513. packet = (struct hpsb_packet *)skb->data;
  514. if ((packet->tlabel == tlabel)
  515. && (packet->node_id == (data[1] >> 16))){
  516. break;
  517. }
  518. packet = NULL;
  519. }
  520. if (packet == NULL) {
  521. HPSB_DEBUG("unsolicited response packet received - no tlabel match");
  522. dump_packet("contents", data, 16, -1);
  523. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  524. return;
  525. }
  526. switch (packet->tcode) {
  527. case TCODE_WRITEQ:
  528. case TCODE_WRITEB:
  529. if (tcode != TCODE_WRITE_RESPONSE)
  530. break;
  531. tcode_match = 1;
  532. memcpy(packet->header, data, 12);
  533. break;
  534. case TCODE_READQ:
  535. if (tcode != TCODE_READQ_RESPONSE)
  536. break;
  537. tcode_match = 1;
  538. memcpy(packet->header, data, 16);
  539. break;
  540. case TCODE_READB:
  541. if (tcode != TCODE_READB_RESPONSE)
  542. break;
  543. tcode_match = 1;
  544. BUG_ON(packet->skb->len - sizeof(*packet) < size - 16);
  545. memcpy(packet->header, data, 16);
  546. memcpy(packet->data, data + 4, size - 16);
  547. break;
  548. case TCODE_LOCK_REQUEST:
  549. if (tcode != TCODE_LOCK_RESPONSE)
  550. break;
  551. tcode_match = 1;
  552. size = min((size - 16), (size_t)8);
  553. BUG_ON(packet->skb->len - sizeof(*packet) < size);
  554. memcpy(packet->header, data, 16);
  555. memcpy(packet->data, data + 4, size);
  556. break;
  557. }
  558. if (!tcode_match) {
  559. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  560. HPSB_INFO("unsolicited response packet received - tcode mismatch");
  561. dump_packet("contents", data, 16, -1);
  562. return;
  563. }
  564. __skb_unlink(skb, &host->pending_packet_queue);
  565. if (packet->state == hpsb_queued) {
  566. packet->sendtime = jiffies;
  567. packet->ack_code = ACK_PENDING;
  568. }
  569. packet->state = hpsb_complete;
  570. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  571. queue_packet_complete(packet);
  572. }
  573. static struct hpsb_packet *create_reply_packet(struct hpsb_host *host,
  574. quadlet_t *data, size_t dsize)
  575. {
  576. struct hpsb_packet *p;
  577. p = hpsb_alloc_packet(dsize);
  578. if (unlikely(p == NULL)) {
  579. /* FIXME - send data_error response */
  580. return NULL;
  581. }
  582. p->type = hpsb_async;
  583. p->state = hpsb_unused;
  584. p->host = host;
  585. p->node_id = data[1] >> 16;
  586. p->tlabel = (data[0] >> 10) & 0x3f;
  587. p->no_waiter = 1;
  588. p->generation = get_hpsb_generation(host);
  589. if (dsize % 4)
  590. p->data[dsize / 4] = 0;
  591. return p;
  592. }
  593. #define PREP_ASYNC_HEAD_RCODE(tc) \
  594. packet->tcode = tc; \
  595. packet->header[0] = (packet->node_id << 16) | (packet->tlabel << 10) \
  596. | (1 << 8) | (tc << 4); \
  597. packet->header[1] = (packet->host->node_id << 16) | (rcode << 12); \
  598. packet->header[2] = 0
  599. static void fill_async_readquad_resp(struct hpsb_packet *packet, int rcode,
  600. quadlet_t data)
  601. {
  602. PREP_ASYNC_HEAD_RCODE(TCODE_READQ_RESPONSE);
  603. packet->header[3] = data;
  604. packet->header_size = 16;
  605. packet->data_size = 0;
  606. }
  607. static void fill_async_readblock_resp(struct hpsb_packet *packet, int rcode,
  608. int length)
  609. {
  610. if (rcode != RCODE_COMPLETE)
  611. length = 0;
  612. PREP_ASYNC_HEAD_RCODE(TCODE_READB_RESPONSE);
  613. packet->header[3] = length << 16;
  614. packet->header_size = 16;
  615. packet->data_size = length + (length % 4 ? 4 - (length % 4) : 0);
  616. }
  617. static void fill_async_write_resp(struct hpsb_packet *packet, int rcode)
  618. {
  619. PREP_ASYNC_HEAD_RCODE(TCODE_WRITE_RESPONSE);
  620. packet->header[2] = 0;
  621. packet->header_size = 12;
  622. packet->data_size = 0;
  623. }
  624. static void fill_async_lock_resp(struct hpsb_packet *packet, int rcode, int extcode,
  625. int length)
  626. {
  627. if (rcode != RCODE_COMPLETE)
  628. length = 0;
  629. PREP_ASYNC_HEAD_RCODE(TCODE_LOCK_RESPONSE);
  630. packet->header[3] = (length << 16) | extcode;
  631. packet->header_size = 16;
  632. packet->data_size = length;
  633. }
  634. #define PREP_REPLY_PACKET(length) \
  635. packet = create_reply_packet(host, data, length); \
  636. if (packet == NULL) break
  637. static void handle_incoming_packet(struct hpsb_host *host, int tcode,
  638. quadlet_t *data, size_t size, int write_acked)
  639. {
  640. struct hpsb_packet *packet;
  641. int length, rcode, extcode;
  642. quadlet_t buffer;
  643. nodeid_t source = data[1] >> 16;
  644. nodeid_t dest = data[0] >> 16;
  645. u16 flags = (u16) data[0];
  646. u64 addr;
  647. /* big FIXME - no error checking is done for an out of bounds length */
  648. switch (tcode) {
  649. case TCODE_WRITEQ:
  650. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  651. rcode = highlevel_write(host, source, dest, data+3,
  652. addr, 4, flags);
  653. if (!write_acked
  654. && (NODEID_TO_NODE(data[0] >> 16) != NODE_MASK)
  655. && (rcode >= 0)) {
  656. /* not a broadcast write, reply */
  657. PREP_REPLY_PACKET(0);
  658. fill_async_write_resp(packet, rcode);
  659. send_packet_nocare(packet);
  660. }
  661. break;
  662. case TCODE_WRITEB:
  663. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  664. rcode = highlevel_write(host, source, dest, data+4,
  665. addr, data[3]>>16, flags);
  666. if (!write_acked
  667. && (NODEID_TO_NODE(data[0] >> 16) != NODE_MASK)
  668. && (rcode >= 0)) {
  669. /* not a broadcast write, reply */
  670. PREP_REPLY_PACKET(0);
  671. fill_async_write_resp(packet, rcode);
  672. send_packet_nocare(packet);
  673. }
  674. break;
  675. case TCODE_READQ:
  676. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  677. rcode = highlevel_read(host, source, &buffer, addr, 4, flags);
  678. if (rcode >= 0) {
  679. PREP_REPLY_PACKET(0);
  680. fill_async_readquad_resp(packet, rcode, buffer);
  681. send_packet_nocare(packet);
  682. }
  683. break;
  684. case TCODE_READB:
  685. length = data[3] >> 16;
  686. PREP_REPLY_PACKET(length);
  687. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  688. rcode = highlevel_read(host, source, packet->data, addr,
  689. length, flags);
  690. if (rcode >= 0) {
  691. fill_async_readblock_resp(packet, rcode, length);
  692. send_packet_nocare(packet);
  693. } else {
  694. hpsb_free_packet(packet);
  695. }
  696. break;
  697. case TCODE_LOCK_REQUEST:
  698. length = data[3] >> 16;
  699. extcode = data[3] & 0xffff;
  700. addr = (((u64)(data[1] & 0xffff)) << 32) | data[2];
  701. PREP_REPLY_PACKET(8);
  702. if ((extcode == 0) || (extcode >= 7)) {
  703. /* let switch default handle error */
  704. length = 0;
  705. }
  706. switch (length) {
  707. case 4:
  708. rcode = highlevel_lock(host, source, packet->data, addr,
  709. data[4], 0, extcode,flags);
  710. fill_async_lock_resp(packet, rcode, extcode, 4);
  711. break;
  712. case 8:
  713. if ((extcode != EXTCODE_FETCH_ADD)
  714. && (extcode != EXTCODE_LITTLE_ADD)) {
  715. rcode = highlevel_lock(host, source,
  716. packet->data, addr,
  717. data[5], data[4],
  718. extcode, flags);
  719. fill_async_lock_resp(packet, rcode, extcode, 4);
  720. } else {
  721. rcode = highlevel_lock64(host, source,
  722. (octlet_t *)packet->data, addr,
  723. *(octlet_t *)(data + 4), 0ULL,
  724. extcode, flags);
  725. fill_async_lock_resp(packet, rcode, extcode, 8);
  726. }
  727. break;
  728. case 16:
  729. rcode = highlevel_lock64(host, source,
  730. (octlet_t *)packet->data, addr,
  731. *(octlet_t *)(data + 6),
  732. *(octlet_t *)(data + 4),
  733. extcode, flags);
  734. fill_async_lock_resp(packet, rcode, extcode, 8);
  735. break;
  736. default:
  737. rcode = RCODE_TYPE_ERROR;
  738. fill_async_lock_resp(packet, rcode,
  739. extcode, 0);
  740. }
  741. if (rcode >= 0) {
  742. send_packet_nocare(packet);
  743. } else {
  744. hpsb_free_packet(packet);
  745. }
  746. break;
  747. }
  748. }
  749. #undef PREP_REPLY_PACKET
  750. void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size,
  751. int write_acked)
  752. {
  753. int tcode;
  754. if (host->in_bus_reset) {
  755. HPSB_INFO("received packet during reset; ignoring");
  756. return;
  757. }
  758. dump_packet("received packet", data, size, -1);
  759. tcode = (data[0] >> 4) & 0xf;
  760. switch (tcode) {
  761. case TCODE_WRITE_RESPONSE:
  762. case TCODE_READQ_RESPONSE:
  763. case TCODE_READB_RESPONSE:
  764. case TCODE_LOCK_RESPONSE:
  765. handle_packet_response(host, tcode, data, size);
  766. break;
  767. case TCODE_WRITEQ:
  768. case TCODE_WRITEB:
  769. case TCODE_READQ:
  770. case TCODE_READB:
  771. case TCODE_LOCK_REQUEST:
  772. handle_incoming_packet(host, tcode, data, size, write_acked);
  773. break;
  774. case TCODE_ISO_DATA:
  775. highlevel_iso_receive(host, data, size);
  776. break;
  777. case TCODE_CYCLE_START:
  778. /* simply ignore this packet if it is passed on */
  779. break;
  780. default:
  781. HPSB_NOTICE("received packet with bogus transaction code %d",
  782. tcode);
  783. break;
  784. }
  785. }
  786. static void abort_requests(struct hpsb_host *host)
  787. {
  788. struct hpsb_packet *packet;
  789. struct sk_buff *skb;
  790. host->driver->devctl(host, CANCEL_REQUESTS, 0);
  791. while ((skb = skb_dequeue(&host->pending_packet_queue)) != NULL) {
  792. packet = (struct hpsb_packet *)skb->data;
  793. packet->state = hpsb_complete;
  794. packet->ack_code = ACKX_ABORTED;
  795. queue_packet_complete(packet);
  796. }
  797. }
  798. void abort_timedouts(unsigned long __opaque)
  799. {
  800. struct hpsb_host *host = (struct hpsb_host *)__opaque;
  801. unsigned long flags;
  802. struct hpsb_packet *packet;
  803. struct sk_buff *skb;
  804. unsigned long expire;
  805. spin_lock_irqsave(&host->csr.lock, flags);
  806. expire = host->csr.expire;
  807. spin_unlock_irqrestore(&host->csr.lock, flags);
  808. /* Hold the lock around this, since we aren't dequeuing all
  809. * packets, just ones we need. */
  810. spin_lock_irqsave(&host->pending_packet_queue.lock, flags);
  811. while (!skb_queue_empty(&host->pending_packet_queue)) {
  812. skb = skb_peek(&host->pending_packet_queue);
  813. packet = (struct hpsb_packet *)skb->data;
  814. if (time_before(packet->sendtime + expire, jiffies)) {
  815. __skb_unlink(skb, &host->pending_packet_queue);
  816. packet->state = hpsb_complete;
  817. packet->ack_code = ACKX_TIMEOUT;
  818. queue_packet_complete(packet);
  819. } else {
  820. /* Since packets are added to the tail, the oldest
  821. * ones are first, always. When we get to one that
  822. * isn't timed out, the rest aren't either. */
  823. break;
  824. }
  825. }
  826. if (!skb_queue_empty(&host->pending_packet_queue))
  827. mod_timer(&host->timeout, jiffies + host->timeout_interval);
  828. spin_unlock_irqrestore(&host->pending_packet_queue.lock, flags);
  829. }
  830. /* Kernel thread and vars, which handles packets that are completed. Only
  831. * packets that have a "complete" function are sent here. This way, the
  832. * completion is run out of kernel context, and doesn't block the rest of
  833. * the stack. */
  834. static int khpsbpkt_pid = -1, khpsbpkt_kill;
  835. static DECLARE_COMPLETION(khpsbpkt_complete);
  836. static struct sk_buff_head hpsbpkt_queue;
  837. static DECLARE_MUTEX_LOCKED(khpsbpkt_sig);
  838. static void queue_packet_complete(struct hpsb_packet *packet)
  839. {
  840. if (packet->no_waiter) {
  841. hpsb_free_packet(packet);
  842. return;
  843. }
  844. if (packet->complete_routine != NULL) {
  845. skb_queue_tail(&hpsbpkt_queue, packet->skb);
  846. /* Signal the kernel thread to handle this */
  847. up(&khpsbpkt_sig);
  848. }
  849. return;
  850. }
  851. static int hpsbpkt_thread(void *__hi)
  852. {
  853. struct sk_buff *skb;
  854. struct hpsb_packet *packet;
  855. void (*complete_routine)(void*);
  856. void *complete_data;
  857. daemonize("khpsbpkt");
  858. current->flags |= PF_NOFREEZE;
  859. while (1) {
  860. if (down_interruptible(&khpsbpkt_sig)) {
  861. printk("khpsbpkt: received unexpected signal?!\n" );
  862. break;
  863. }
  864. if (khpsbpkt_kill)
  865. break;
  866. while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) {
  867. packet = (struct hpsb_packet *)skb->data;
  868. complete_routine = packet->complete_routine;
  869. complete_data = packet->complete_data;
  870. packet->complete_routine = packet->complete_data = NULL;
  871. complete_routine(complete_data);
  872. }
  873. }
  874. complete_and_exit(&khpsbpkt_complete, 0);
  875. }
  876. static int __init ieee1394_init(void)
  877. {
  878. int i, ret;
  879. skb_queue_head_init(&hpsbpkt_queue);
  880. /* non-fatal error */
  881. if (hpsb_init_config_roms()) {
  882. HPSB_ERR("Failed to initialize some config rom entries.\n");
  883. HPSB_ERR("Some features may not be available\n");
  884. }
  885. khpsbpkt_pid = kernel_thread(hpsbpkt_thread, NULL, CLONE_KERNEL);
  886. if (khpsbpkt_pid < 0) {
  887. HPSB_ERR("Failed to start hpsbpkt thread!\n");
  888. ret = -ENOMEM;
  889. goto exit_cleanup_config_roms;
  890. }
  891. if (register_chrdev_region(IEEE1394_CORE_DEV, 256, "ieee1394")) {
  892. HPSB_ERR("unable to register character device major %d!\n", IEEE1394_MAJOR);
  893. ret = -ENODEV;
  894. goto exit_release_kernel_thread;
  895. }
  896. /* actually this is a non-fatal error */
  897. ret = devfs_mk_dir("ieee1394");
  898. if (ret < 0) {
  899. HPSB_ERR("unable to make devfs dir for device major %d!\n", IEEE1394_MAJOR);
  900. goto release_chrdev;
  901. }
  902. ret = bus_register(&ieee1394_bus_type);
  903. if (ret < 0) {
  904. HPSB_INFO("bus register failed");
  905. goto release_devfs;
  906. }
  907. for (i = 0; fw_bus_attrs[i]; i++) {
  908. ret = bus_create_file(&ieee1394_bus_type, fw_bus_attrs[i]);
  909. if (ret < 0) {
  910. while (i >= 0) {
  911. bus_remove_file(&ieee1394_bus_type,
  912. fw_bus_attrs[i--]);
  913. }
  914. bus_unregister(&ieee1394_bus_type);
  915. goto release_devfs;
  916. }
  917. }
  918. ret = class_register(&hpsb_host_class);
  919. if (ret < 0)
  920. goto release_all_bus;
  921. hpsb_protocol_class = class_create(THIS_MODULE, "ieee1394_protocol");
  922. if (IS_ERR(hpsb_protocol_class)) {
  923. ret = PTR_ERR(hpsb_protocol_class);
  924. goto release_class_host;
  925. }
  926. ret = init_csr();
  927. if (ret) {
  928. HPSB_INFO("init csr failed");
  929. ret = -ENOMEM;
  930. goto release_class_protocol;
  931. }
  932. if (disable_nodemgr) {
  933. HPSB_INFO("nodemgr and IRM functionality disabled");
  934. /* We shouldn't contend for IRM with nodemgr disabled, since
  935. nodemgr implements functionality required of ieee1394a-2000
  936. IRMs */
  937. hpsb_disable_irm = 1;
  938. return 0;
  939. }
  940. if (hpsb_disable_irm) {
  941. HPSB_INFO("IRM functionality disabled");
  942. }
  943. ret = init_ieee1394_nodemgr();
  944. if (ret < 0) {
  945. HPSB_INFO("init nodemgr failed");
  946. goto cleanup_csr;
  947. }
  948. return 0;
  949. cleanup_csr:
  950. cleanup_csr();
  951. release_class_protocol:
  952. class_destroy(hpsb_protocol_class);
  953. release_class_host:
  954. class_unregister(&hpsb_host_class);
  955. release_all_bus:
  956. for (i = 0; fw_bus_attrs[i]; i++)
  957. bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
  958. bus_unregister(&ieee1394_bus_type);
  959. release_devfs:
  960. devfs_remove("ieee1394");
  961. release_chrdev:
  962. unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
  963. exit_release_kernel_thread:
  964. if (khpsbpkt_pid >= 0) {
  965. kill_proc(khpsbpkt_pid, SIGTERM, 1);
  966. wait_for_completion(&khpsbpkt_complete);
  967. }
  968. exit_cleanup_config_roms:
  969. hpsb_cleanup_config_roms();
  970. return ret;
  971. }
  972. static void __exit ieee1394_cleanup(void)
  973. {
  974. int i;
  975. if (!disable_nodemgr)
  976. cleanup_ieee1394_nodemgr();
  977. cleanup_csr();
  978. class_destroy(hpsb_protocol_class);
  979. class_unregister(&hpsb_host_class);
  980. for (i = 0; fw_bus_attrs[i]; i++)
  981. bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
  982. bus_unregister(&ieee1394_bus_type);
  983. if (khpsbpkt_pid >= 0) {
  984. khpsbpkt_kill = 1;
  985. mb();
  986. up(&khpsbpkt_sig);
  987. wait_for_completion(&khpsbpkt_complete);
  988. }
  989. hpsb_cleanup_config_roms();
  990. unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
  991. devfs_remove("ieee1394");
  992. }
  993. module_init(ieee1394_init);
  994. module_exit(ieee1394_cleanup);
  995. /* Exported symbols */
  996. /** hosts.c **/
  997. EXPORT_SYMBOL(hpsb_alloc_host);
  998. EXPORT_SYMBOL(hpsb_add_host);
  999. EXPORT_SYMBOL(hpsb_remove_host);
  1000. EXPORT_SYMBOL(hpsb_update_config_rom_image);
  1001. /** ieee1394_core.c **/
  1002. EXPORT_SYMBOL(hpsb_speedto_str);
  1003. EXPORT_SYMBOL(hpsb_protocol_class);
  1004. EXPORT_SYMBOL(hpsb_set_packet_complete_task);
  1005. EXPORT_SYMBOL(hpsb_alloc_packet);
  1006. EXPORT_SYMBOL(hpsb_free_packet);
  1007. EXPORT_SYMBOL(hpsb_send_packet);
  1008. EXPORT_SYMBOL(hpsb_reset_bus);
  1009. EXPORT_SYMBOL(hpsb_bus_reset);
  1010. EXPORT_SYMBOL(hpsb_selfid_received);
  1011. EXPORT_SYMBOL(hpsb_selfid_complete);
  1012. EXPORT_SYMBOL(hpsb_packet_sent);
  1013. EXPORT_SYMBOL(hpsb_packet_received);
  1014. EXPORT_SYMBOL_GPL(hpsb_disable_irm);
  1015. #ifdef CONFIG_IEEE1394_EXPORT_FULL_API
  1016. EXPORT_SYMBOL(hpsb_send_phy_config);
  1017. EXPORT_SYMBOL(hpsb_send_packet_and_wait);
  1018. #endif
  1019. /** ieee1394_transactions.c **/
  1020. EXPORT_SYMBOL(hpsb_get_tlabel);
  1021. EXPORT_SYMBOL(hpsb_free_tlabel);
  1022. EXPORT_SYMBOL(hpsb_make_readpacket);
  1023. EXPORT_SYMBOL(hpsb_make_writepacket);
  1024. EXPORT_SYMBOL(hpsb_make_streampacket);
  1025. EXPORT_SYMBOL(hpsb_make_lockpacket);
  1026. EXPORT_SYMBOL(hpsb_make_lock64packet);
  1027. EXPORT_SYMBOL(hpsb_make_phypacket);
  1028. EXPORT_SYMBOL(hpsb_make_isopacket);
  1029. EXPORT_SYMBOL(hpsb_read);
  1030. EXPORT_SYMBOL(hpsb_write);
  1031. EXPORT_SYMBOL(hpsb_packet_success);
  1032. /** highlevel.c **/
  1033. EXPORT_SYMBOL(hpsb_register_highlevel);
  1034. EXPORT_SYMBOL(hpsb_unregister_highlevel);
  1035. EXPORT_SYMBOL(hpsb_register_addrspace);
  1036. EXPORT_SYMBOL(hpsb_unregister_addrspace);
  1037. EXPORT_SYMBOL(hpsb_allocate_and_register_addrspace);
  1038. EXPORT_SYMBOL(hpsb_listen_channel);
  1039. EXPORT_SYMBOL(hpsb_unlisten_channel);
  1040. EXPORT_SYMBOL(hpsb_get_hostinfo);
  1041. EXPORT_SYMBOL(hpsb_create_hostinfo);
  1042. EXPORT_SYMBOL(hpsb_destroy_hostinfo);
  1043. EXPORT_SYMBOL(hpsb_set_hostinfo_key);
  1044. EXPORT_SYMBOL(hpsb_get_hostinfo_bykey);
  1045. EXPORT_SYMBOL(hpsb_set_hostinfo);
  1046. EXPORT_SYMBOL(highlevel_host_reset);
  1047. #ifdef CONFIG_IEEE1394_EXPORT_FULL_API
  1048. EXPORT_SYMBOL(highlevel_add_host);
  1049. EXPORT_SYMBOL(highlevel_remove_host);
  1050. #endif
  1051. /** nodemgr.c **/
  1052. EXPORT_SYMBOL(hpsb_node_fill_packet);
  1053. EXPORT_SYMBOL(hpsb_node_write);
  1054. EXPORT_SYMBOL(hpsb_register_protocol);
  1055. EXPORT_SYMBOL(hpsb_unregister_protocol);
  1056. EXPORT_SYMBOL(ieee1394_bus_type);
  1057. #ifdef CONFIG_IEEE1394_EXPORT_FULL_API
  1058. EXPORT_SYMBOL(nodemgr_for_each_host);
  1059. #endif
  1060. /** csr.c **/
  1061. EXPORT_SYMBOL(hpsb_update_config_rom);
  1062. /** dma.c **/
  1063. EXPORT_SYMBOL(dma_prog_region_init);
  1064. EXPORT_SYMBOL(dma_prog_region_alloc);
  1065. EXPORT_SYMBOL(dma_prog_region_free);
  1066. EXPORT_SYMBOL(dma_region_init);
  1067. EXPORT_SYMBOL(dma_region_alloc);
  1068. EXPORT_SYMBOL(dma_region_free);
  1069. EXPORT_SYMBOL(dma_region_sync_for_cpu);
  1070. EXPORT_SYMBOL(dma_region_sync_for_device);
  1071. EXPORT_SYMBOL(dma_region_mmap);
  1072. EXPORT_SYMBOL(dma_region_offset_to_bus);
  1073. /** iso.c **/
  1074. EXPORT_SYMBOL(hpsb_iso_xmit_init);
  1075. EXPORT_SYMBOL(hpsb_iso_recv_init);
  1076. EXPORT_SYMBOL(hpsb_iso_xmit_start);
  1077. EXPORT_SYMBOL(hpsb_iso_recv_start);
  1078. EXPORT_SYMBOL(hpsb_iso_recv_listen_channel);
  1079. EXPORT_SYMBOL(hpsb_iso_recv_unlisten_channel);
  1080. EXPORT_SYMBOL(hpsb_iso_recv_set_channel_mask);
  1081. EXPORT_SYMBOL(hpsb_iso_stop);
  1082. EXPORT_SYMBOL(hpsb_iso_shutdown);
  1083. EXPORT_SYMBOL(hpsb_iso_xmit_queue_packet);
  1084. EXPORT_SYMBOL(hpsb_iso_xmit_sync);
  1085. EXPORT_SYMBOL(hpsb_iso_recv_release_packets);
  1086. EXPORT_SYMBOL(hpsb_iso_n_ready);
  1087. EXPORT_SYMBOL(hpsb_iso_packet_sent);
  1088. EXPORT_SYMBOL(hpsb_iso_packet_received);
  1089. EXPORT_SYMBOL(hpsb_iso_wake);
  1090. EXPORT_SYMBOL(hpsb_iso_recv_flush);
  1091. /** csr1212.c **/
  1092. EXPORT_SYMBOL(csr1212_new_directory);
  1093. EXPORT_SYMBOL(csr1212_attach_keyval_to_directory);
  1094. EXPORT_SYMBOL(csr1212_detach_keyval_from_directory);
  1095. EXPORT_SYMBOL(csr1212_release_keyval);
  1096. EXPORT_SYMBOL(csr1212_read);
  1097. EXPORT_SYMBOL(csr1212_parse_keyval);
  1098. EXPORT_SYMBOL(_csr1212_read_keyval);
  1099. EXPORT_SYMBOL(_csr1212_destroy_keyval);
  1100. #ifdef CONFIG_IEEE1394_EXPORT_FULL_API
  1101. EXPORT_SYMBOL(csr1212_create_csr);
  1102. EXPORT_SYMBOL(csr1212_init_local_csr);
  1103. EXPORT_SYMBOL(csr1212_new_immediate);
  1104. EXPORT_SYMBOL(csr1212_associate_keyval);
  1105. EXPORT_SYMBOL(csr1212_new_string_descriptor_leaf);
  1106. EXPORT_SYMBOL(csr1212_destroy_csr);
  1107. EXPORT_SYMBOL(csr1212_generate_csr_image);
  1108. EXPORT_SYMBOL(csr1212_parse_csr);
  1109. #endif