Commit eb0306ea authored by Kristian Høgsberg's avatar Kristian Høgsberg Committed by Stefan Richter

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: default avatarKristian Høgsberg <krh@redhat.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent c70dc788
...@@ -546,12 +546,6 @@ static int ioctl_create_iso_context(struct client *client, void __user *arg) ...@@ -546,12 +546,6 @@ static int ioctl_create_iso_context(struct client *client, void __user *arg)
switch (request.type) { switch (request.type) {
case FW_ISO_CONTEXT_RECEIVE: case FW_ISO_CONTEXT_RECEIVE:
if (request.sync > 15)
return -EINVAL;
if (request.tags == 0 || request.tags > 15)
return -EINVAL;
if (request.header_size < 4 || (request.header_size & 3)) if (request.header_size < 4 || (request.header_size & 3))
return -EINVAL; return -EINVAL;
...@@ -567,13 +561,10 @@ static int ioctl_create_iso_context(struct client *client, void __user *arg) ...@@ -567,13 +561,10 @@ static int ioctl_create_iso_context(struct client *client, void __user *arg)
return -EINVAL; return -EINVAL;
} }
client->iso_context = fw_iso_context_create(client->device->card, client->iso_context = fw_iso_context_create(client->device->card,
request.type, request.type,
request.channel, request.channel,
request.speed, request.speed,
request.sync,
request.tags,
request.header_size, request.header_size,
iso_callback, client); iso_callback, client);
if (IS_ERR(client->iso_context)) if (IS_ERR(client->iso_context))
...@@ -678,7 +669,16 @@ static int ioctl_start_iso(struct client *client, void __user *arg) ...@@ -678,7 +669,16 @@ static int ioctl_start_iso(struct client *client, void __user *arg)
if (copy_from_user(&request, arg, sizeof request)) if (copy_from_user(&request, arg, sizeof request))
return -EFAULT; return -EFAULT;
return fw_iso_context_start(client->iso_context, request.cycle); if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) {
if (request.tags == 0 || request.tags > 15)
return -EINVAL;
if (request.sync > 15)
return -EINVAL;
}
return fw_iso_context_start(client->iso_context,
request.cycle, request.sync, request.tags);
} }
static int ioctl_stop_iso(struct client *client, void __user *arg) static int ioctl_stop_iso(struct client *client, void __user *arg)
......
...@@ -194,8 +194,6 @@ struct fw_cdev_create_iso_context { ...@@ -194,8 +194,6 @@ struct fw_cdev_create_iso_context {
__u32 header_size; __u32 header_size;
__u32 channel; __u32 channel;
__u32 speed; __u32 speed;
__u32 sync;
__u32 tags;
}; };
struct fw_cdev_iso_packet { struct fw_cdev_iso_packet {
...@@ -216,6 +214,8 @@ struct fw_cdev_queue_iso { ...@@ -216,6 +214,8 @@ struct fw_cdev_queue_iso {
struct fw_cdev_start_iso { struct fw_cdev_start_iso {
__s32 cycle; __s32 cycle;
__u32 sync;
__u32 tags;
}; };
#endif /* __fw_cdev_h */ #endif /* __fw_cdev_h */
...@@ -107,14 +107,12 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, ...@@ -107,14 +107,12 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer,
struct fw_iso_context * struct fw_iso_context *
fw_iso_context_create(struct fw_card *card, int type, fw_iso_context_create(struct fw_card *card, int type,
int channel, int speed, int channel, int speed, size_t header_size,
int sync, int tags, size_t header_size,
fw_iso_callback_t callback, void *callback_data) fw_iso_callback_t callback, void *callback_data)
{ {
struct fw_iso_context *ctx; struct fw_iso_context *ctx;
ctx = card->driver->allocate_iso_context(card, type, ctx = card->driver->allocate_iso_context(card, type, header_size);
sync, tags, header_size);
if (IS_ERR(ctx)) if (IS_ERR(ctx))
return ctx; return ctx;
...@@ -122,8 +120,6 @@ fw_iso_context_create(struct fw_card *card, int type, ...@@ -122,8 +120,6 @@ fw_iso_context_create(struct fw_card *card, int type,
ctx->type = type; ctx->type = type;
ctx->channel = channel; ctx->channel = channel;
ctx->speed = speed; ctx->speed = speed;
ctx->sync = sync;
ctx->tags = tags;
ctx->header_size = header_size; ctx->header_size = header_size;
ctx->callback = callback; ctx->callback = callback;
ctx->callback_data = callback_data; ctx->callback_data = callback_data;
...@@ -141,9 +137,9 @@ void fw_iso_context_destroy(struct fw_iso_context *ctx) ...@@ -141,9 +137,9 @@ void fw_iso_context_destroy(struct fw_iso_context *ctx)
EXPORT_SYMBOL(fw_iso_context_destroy); EXPORT_SYMBOL(fw_iso_context_destroy);
int int
fw_iso_context_start(struct fw_iso_context *ctx, int cycle) fw_iso_context_start(struct fw_iso_context *ctx, int cycle, int sync, int tags)
{ {
return ctx->card->driver->start_iso(ctx, cycle); return ctx->card->driver->start_iso(ctx, cycle, sync, tags);
} }
EXPORT_SYMBOL(fw_iso_context_start); EXPORT_SYMBOL(fw_iso_context_start);
......
...@@ -1294,8 +1294,7 @@ static int handle_it_packet(struct context *context, ...@@ -1294,8 +1294,7 @@ static int handle_it_packet(struct context *context,
} }
static struct fw_iso_context * static struct fw_iso_context *
ohci_allocate_iso_context(struct fw_card *card, int type, ohci_allocate_iso_context(struct fw_card *card, int type, size_t header_size)
int sync, int tags, size_t header_size)
{ {
struct fw_ohci *ohci = fw_ohci(card); struct fw_ohci *ohci = fw_ohci(card);
struct iso_context *ctx, *list; struct iso_context *ctx, *list;
...@@ -1357,7 +1356,8 @@ ohci_allocate_iso_context(struct fw_card *card, int type, ...@@ -1357,7 +1356,8 @@ ohci_allocate_iso_context(struct fw_card *card, int type,
return ERR_PTR(retval); return ERR_PTR(retval);
} }
static int ohci_start_iso(struct fw_iso_context *base, s32 cycle) static int ohci_start_iso(struct fw_iso_context *base,
s32 cycle, u32 sync, u32 tags)
{ {
struct iso_context *ctx = container_of(base, struct iso_context, base); struct iso_context *ctx = container_of(base, struct iso_context, base);
struct fw_ohci *ohci = ctx->context.ohci; struct fw_ohci *ohci = ctx->context.ohci;
...@@ -1379,8 +1379,7 @@ static int ohci_start_iso(struct fw_iso_context *base, s32 cycle) ...@@ -1379,8 +1379,7 @@ static int ohci_start_iso(struct fw_iso_context *base, s32 cycle)
reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 1 << index); reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 1 << index);
reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, 1 << index); reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, 1 << index);
reg_write(ohci, context_match(ctx->context.regs), reg_write(ohci, context_match(ctx->context.regs),
(ctx->base.tags << 28) | (tags << 28) | (sync << 8) | ctx->base.channel);
(ctx->base.sync << 8) | ctx->base.channel);
context_run(&ctx->context, context_run(&ctx->context,
IR_CONTEXT_DUAL_BUFFER_MODE | IR_CONTEXT_DUAL_BUFFER_MODE |
IR_CONTEXT_ISOCH_HEADER); IR_CONTEXT_ISOCH_HEADER);
......
...@@ -363,8 +363,6 @@ struct fw_iso_context { ...@@ -363,8 +363,6 @@ struct fw_iso_context {
int type; int type;
int channel; int channel;
int speed; int speed;
int sync;
int tags;
size_t header_size; size_t header_size;
fw_iso_callback_t callback; fw_iso_callback_t callback;
void *callback_data; void *callback_data;
...@@ -382,8 +380,7 @@ fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); ...@@ -382,8 +380,7 @@ fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
struct fw_iso_context * struct fw_iso_context *
fw_iso_context_create(struct fw_card *card, int type, fw_iso_context_create(struct fw_card *card, int type,
int channel, int speed, int channel, int speed, size_t header_size,
int sync, int tags, size_t header_size,
fw_iso_callback_t callback, void *callback_data); fw_iso_callback_t callback, void *callback_data);
void void
...@@ -396,7 +393,8 @@ fw_iso_context_queue(struct fw_iso_context *ctx, ...@@ -396,7 +393,8 @@ fw_iso_context_queue(struct fw_iso_context *ctx,
unsigned long payload); unsigned long payload);
int int
fw_iso_context_start(struct fw_iso_context *ctx, int cycle); fw_iso_context_start(struct fw_iso_context *ctx,
int cycle, int sync, int tags);
int int
fw_iso_context_stop(struct fw_iso_context *ctx); fw_iso_context_stop(struct fw_iso_context *ctx);
...@@ -436,11 +434,12 @@ struct fw_card_driver { ...@@ -436,11 +434,12 @@ struct fw_card_driver {
u64 (*get_bus_time) (struct fw_card *card); u64 (*get_bus_time) (struct fw_card *card);
struct fw_iso_context * struct fw_iso_context *
(*allocate_iso_context)(struct fw_card *card, int sync, int tags, (*allocate_iso_context)(struct fw_card *card,
int type, size_t header_size); int type, size_t header_size);
void (*free_iso_context)(struct fw_iso_context *ctx); void (*free_iso_context)(struct fw_iso_context *ctx);
int (*start_iso)(struct fw_iso_context *ctx, s32 cycle); int (*start_iso)(struct fw_iso_context *ctx,
s32 cycle, u32 sync, u32 tags);
int (*queue_iso)(struct fw_iso_context *ctx, int (*queue_iso)(struct fw_iso_context *ctx,
struct fw_iso_packet *packet, struct fw_iso_packet *packet,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment