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