ieee1394_core.c 34 KB

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