ieee1394_core.c 34 KB

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