aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-03-14 17:34:54 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-15 13:21:36 -0400
commiteb0306eac0aad0b7da18d8fbfb777f155b2c010d (patch)
treeac0d1922362804b9687deb5bffb8179ac670149a
parentc70dc788fd8d3870b41231b6a53a64afb98cfd13 (diff)
firewire: Move sync and tag parameters to start_iso ioctl.
Setting these at create_context time or start_iso time doesn't matter much, but raw1394 sets them at start_iso time so that will be easier to emulate this way. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r--drivers/firewire/fw-device-cdev.c20
-rw-r--r--drivers/firewire/fw-device-cdev.h4
-rw-r--r--drivers/firewire/fw-iso.c12
-rw-r--r--drivers/firewire/fw-ohci.c9
-rw-r--r--drivers/firewire/fw-transaction.h13
5 files changed, 26 insertions, 32 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c
index be6bfcfb9065..175ea042ba3f 100644
--- a/drivers/firewire/fw-device-cdev.c
+++ b/drivers/firewire/fw-device-cdev.c
@@ -546,12 +546,6 @@ static int ioctl_create_iso_context(struct client *client, void __user *arg)
546 546
547 switch (request.type) { 547 switch (request.type) {
548 case FW_ISO_CONTEXT_RECEIVE: 548 case FW_ISO_CONTEXT_RECEIVE:
549 if (request.sync > 15)
550 return -EINVAL;
551
552 if (request.tags == 0 || request.tags > 15)
553 return -EINVAL;
554
555 if (request.header_size < 4 || (request.header_size & 3)) 549 if (request.header_size < 4 || (request.header_size & 3))
556 return -EINVAL; 550 return -EINVAL;
557 551
@@ -567,13 +561,10 @@ static int ioctl_create_iso_context(struct client *client, void __user *arg)
567 return -EINVAL; 561 return -EINVAL;
568 } 562 }
569 563
570
571 client->iso_context = fw_iso_context_create(client->device->card, 564 client->iso_context = fw_iso_context_create(client->device->card,
572 request.type, 565 request.type,
573 request.channel, 566 request.channel,
574 request.speed, 567 request.speed,
575 request.sync,
576 request.tags,
577 request.header_size, 568 request.header_size,
578 iso_callback, client); 569 iso_callback, client);
579 if (IS_ERR(client->iso_context)) 570 if (IS_ERR(client->iso_context))
@@ -678,7 +669,16 @@ static int ioctl_start_iso(struct client *client, void __user *arg)
678 if (copy_from_user(&request, arg, sizeof request)) 669 if (copy_from_user(&request, arg, sizeof request))
679 return -EFAULT; 670 return -EFAULT;
680 671
681 return fw_iso_context_start(client->iso_context, request.cycle); 672 if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) {
673 if (request.tags == 0 || request.tags > 15)
674 return -EINVAL;
675
676 if (request.sync > 15)
677 return -EINVAL;
678 }
679
680 return fw_iso_context_start(client->iso_context,
681 request.cycle, request.sync, request.tags);
682} 682}
683 683
684static int ioctl_stop_iso(struct client *client, void __user *arg) 684static int ioctl_stop_iso(struct client *client, void __user *arg)
diff --git a/drivers/firewire/fw-device-cdev.h b/drivers/firewire/fw-device-cdev.h
index 440fb742aae9..3437a360d7dc 100644
--- a/drivers/firewire/fw-device-cdev.h
+++ b/drivers/firewire/fw-device-cdev.h
@@ -194,8 +194,6 @@ struct fw_cdev_create_iso_context {
194 __u32 header_size; 194 __u32 header_size;
195 __u32 channel; 195 __u32 channel;
196 __u32 speed; 196 __u32 speed;
197 __u32 sync;
198 __u32 tags;
199}; 197};
200 198
201struct fw_cdev_iso_packet { 199struct fw_cdev_iso_packet {
@@ -216,6 +214,8 @@ struct fw_cdev_queue_iso {
216 214
217struct fw_cdev_start_iso { 215struct fw_cdev_start_iso {
218 __s32 cycle; 216 __s32 cycle;
217 __u32 sync;
218 __u32 tags;
219}; 219};
220 220
221#endif /* __fw_cdev_h */ 221#endif /* __fw_cdev_h */
diff --git a/drivers/firewire/fw-iso.c b/drivers/firewire/fw-iso.c
index 3eaf88005c5d..2ce26db656e0 100644
--- a/drivers/firewire/fw-iso.c
+++ b/drivers/firewire/fw-iso.c
@@ -107,14 +107,12 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer,
107 107
108struct fw_iso_context * 108struct fw_iso_context *
109fw_iso_context_create(struct fw_card *card, int type, 109fw_iso_context_create(struct fw_card *card, int type,
110 int channel, int speed, 110 int channel, int speed, size_t header_size,
111 int sync, int tags, size_t header_size,
112 fw_iso_callback_t callback, void *callback_data) 111 fw_iso_callback_t callback, void *callback_data)
113{ 112{
114 struct fw_iso_context *ctx; 113 struct fw_iso_context *ctx;
115 114
116 ctx = card->driver->allocate_iso_context(card, type, 115 ctx = card->driver->allocate_iso_context(card, type, header_size);
117 sync, tags, header_size);
118 if (IS_ERR(ctx)) 116 if (IS_ERR(ctx))
119 return ctx; 117 return ctx;
120 118
@@ -122,8 +120,6 @@ fw_iso_context_create(struct fw_card *card, int type,
122 ctx->type = type; 120 ctx->type = type;
123 ctx->channel = channel; 121 ctx->channel = channel;
124 ctx->speed = speed; 122 ctx->speed = speed;
125 ctx->sync = sync;
126 ctx->tags = tags;
127 ctx->header_size = header_size; 123 ctx->header_size = header_size;
128 ctx->callback = callback; 124 ctx->callback = callback;
129 ctx->callback_data = callback_data; 125 ctx->callback_data = callback_data;
@@ -141,9 +137,9 @@ void fw_iso_context_destroy(struct fw_iso_context *ctx)
141EXPORT_SYMBOL(fw_iso_context_destroy); 137EXPORT_SYMBOL(fw_iso_context_destroy);
142 138
143int 139int
144fw_iso_context_start(struct fw_iso_context *ctx, int cycle) 140fw_iso_context_start(struct fw_iso_context *ctx, int cycle, int sync, int tags)
145{ 141{
146 return ctx->card->driver->start_iso(ctx, cycle); 142 return ctx->card->driver->start_iso(ctx, cycle, sync, tags);
147} 143}
148EXPORT_SYMBOL(fw_iso_context_start); 144EXPORT_SYMBOL(fw_iso_context_start);
149 145
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 17e13d099294..abb9dc12a613 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -1294,8 +1294,7 @@ static int handle_it_packet(struct context *context,
1294} 1294}
1295 1295
1296static struct fw_iso_context * 1296static struct fw_iso_context *
1297ohci_allocate_iso_context(struct fw_card *card, int type, 1297ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size)
1298 int sync, int tags, size_t header_size)
1299{ 1298{
1300 struct fw_ohci *ohci = fw_ohci(card); 1299 struct fw_ohci *ohci = fw_ohci(card);
1301 struct iso_context *ctx, *list; 1300 struct iso_context *ctx, *list;
@@ -1357,7 +1356,8 @@ ohci_allocate_iso_context(struct fw_card *card, int type,
1357 return ERR_PTR(retval); 1356 return ERR_PTR(retval);
1358} 1357}
1359 1358
1360static int ohci_start_iso(struct fw_iso_context *base, s32 cycle) 1359static int ohci_start_iso(struct fw_iso_context *base,
1360 s32 cycle, u32 sync, u32 tags)
1361{ 1361{
1362 struct iso_context *ctx = container_of(base, struct iso_context, base); 1362 struct iso_context *ctx = container_of(base, struct iso_context, base);
1363 struct fw_ohci *ohci = ctx->context.ohci; 1363 struct fw_ohci *ohci = ctx->context.ohci;
@@ -1379,8 +1379,7 @@ static int ohci_start_iso(struct fw_iso_context *base, s32 cycle)
1379 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 1 << index); 1379 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 1 << index);
1380 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, 1 << index); 1380 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, 1 << index);
1381 reg_write(ohci, context_match(ctx->context.regs), 1381 reg_write(ohci, context_match(ctx->context.regs),
1382 (ctx->base.tags << 28) | 1382 (tags << 28) | (sync << 8) | ctx->base.channel);
1383 (ctx->base.sync << 8) | ctx->base.channel);
1384 context_run(&ctx->context, 1383 context_run(&ctx->context,
1385 IR_CONTEXT_DUAL_BUFFER_MODE | 1384 IR_CONTEXT_DUAL_BUFFER_MODE |
1386 IR_CONTEXT_ISOCH_HEADER); 1385 IR_CONTEXT_ISOCH_HEADER);
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index 855beb27216d..662149723e98 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -363,8 +363,6 @@ struct fw_iso_context {
363 int type; 363 int type;
364 int channel; 364 int channel;
365 int speed; 365 int speed;
366 int sync;
367 int tags;
368 size_t header_size; 366 size_t header_size;
369 fw_iso_callback_t callback; 367 fw_iso_callback_t callback;
370 void *callback_data; 368 void *callback_data;
@@ -382,8 +380,7 @@ fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
382 380
383struct fw_iso_context * 381struct fw_iso_context *
384fw_iso_context_create(struct fw_card *card, int type, 382fw_iso_context_create(struct fw_card *card, int type,
385 int channel, int speed, 383 int channel, int speed, size_t header_size,
386 int sync, int tags, size_t header_size,
387 fw_iso_callback_t callback, void *callback_data); 384 fw_iso_callback_t callback, void *callback_data);
388 385
389void 386void
@@ -396,7 +393,8 @@ fw_iso_context_queue(struct fw_iso_context *ctx,
396 unsigned long payload); 393 unsigned long payload);
397 394
398int 395int
399fw_iso_context_start(struct fw_iso_context *ctx, int cycle); 396fw_iso_context_start(struct fw_iso_context *ctx,
397 int cycle, int sync, int tags);
400 398
401int 399int
402fw_iso_context_stop(struct fw_iso_context *ctx); 400fw_iso_context_stop(struct fw_iso_context *ctx);
@@ -436,11 +434,12 @@ struct fw_card_driver {
436 u64 (*get_bus_time) (struct fw_card *card); 434 u64 (*get_bus_time) (struct fw_card *card);
437 435
438 struct fw_iso_context * 436 struct fw_iso_context *
439 (*allocate_iso_context)(struct fw_card *card, int sync, int tags, 437 (*allocate_iso_context)(struct fw_card *card,
440 int type, size_t header_size); 438 int type, size_t header_size);
441 void (*free_iso_context)(struct fw_iso_context *ctx); 439 void (*free_iso_context)(struct fw_iso_context *ctx);
442 440
443 int (*start_iso)(struct fw_iso_context *ctx, s32 cycle); 441 int (*start_iso)(struct fw_iso_context *ctx,
442 s32 cycle, u32 sync, u32 tags);
444 443
445 int (*queue_iso)(struct fw_iso_context *ctx, 444 int (*queue_iso)(struct fw_iso_context *ctx,
446 struct fw_iso_packet *packet, 445 struct fw_iso_packet *packet,