ieee1394_core.c 34 KB

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