ieee1394_core.c 39 KB

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