ieee1394_core.c 39 KB

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