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

firewire: Future proof the iso ioctls by adding a handle for the iso context.

Currently create context always returns 0 and the other iso
ioctls will expect user space to pass that in for subsequent ioctls.
Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 4f259223
...@@ -80,6 +80,7 @@ struct client { ...@@ -80,6 +80,7 @@ struct client {
u64 bus_reset_closure; u64 bus_reset_closure;
struct fw_iso_context *iso_context; struct fw_iso_context *iso_context;
u64 iso_closure;
struct fw_iso_buffer buffer; struct fw_iso_buffer buffer;
unsigned long vm_start; unsigned long vm_start;
...@@ -626,7 +627,7 @@ iso_callback(struct fw_iso_context *context, u32 cycle, ...@@ -626,7 +627,7 @@ iso_callback(struct fw_iso_context *context, u32 cycle,
return; return;
interrupt->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT; interrupt->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT;
interrupt->interrupt.closure = 0; interrupt->interrupt.closure = client->iso_closure;
interrupt->interrupt.cycle = cycle; interrupt->interrupt.cycle = cycle;
interrupt->interrupt.header_length = header_length; interrupt->interrupt.header_length = header_length;
memcpy(interrupt->interrupt.header, header, header_length); memcpy(interrupt->interrupt.header, header, header_length);
...@@ -659,6 +660,7 @@ static int ioctl_create_iso_context(struct client *client, void *buffer) ...@@ -659,6 +660,7 @@ static int ioctl_create_iso_context(struct client *client, void *buffer)
return -EINVAL; return -EINVAL;
} }
client->iso_closure = request->closure;
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,
...@@ -668,6 +670,9 @@ static int ioctl_create_iso_context(struct client *client, void *buffer) ...@@ -668,6 +670,9 @@ static int ioctl_create_iso_context(struct client *client, void *buffer)
if (IS_ERR(client->iso_context)) if (IS_ERR(client->iso_context))
return PTR_ERR(client->iso_context); return PTR_ERR(client->iso_context);
/* We only support one context at this time. */
request->handle = 0;
return 0; return 0;
} }
...@@ -683,7 +688,7 @@ static int ioctl_queue_iso(struct client *client, void *buffer) ...@@ -683,7 +688,7 @@ static int ioctl_queue_iso(struct client *client, void *buffer)
u8 header[256]; u8 header[256];
} u; } u;
if (ctx == NULL) if (ctx == NULL || request->handle != 0)
return -EINVAL; return -EINVAL;
/* If the user passes a non-NULL data pointer, has mmap()'ed /* If the user passes a non-NULL data pointer, has mmap()'ed
...@@ -759,6 +764,8 @@ static int ioctl_start_iso(struct client *client, void *buffer) ...@@ -759,6 +764,8 @@ static int ioctl_start_iso(struct client *client, void *buffer)
{ {
struct fw_cdev_start_iso *request = buffer; struct fw_cdev_start_iso *request = buffer;
if (request->handle != 0)
return -EINVAL;
if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) { if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) {
if (request->tags == 0 || request->tags > 15) if (request->tags == 0 || request->tags > 15)
return -EINVAL; return -EINVAL;
...@@ -773,6 +780,11 @@ static int ioctl_start_iso(struct client *client, void *buffer) ...@@ -773,6 +780,11 @@ static int ioctl_start_iso(struct client *client, void *buffer)
static int ioctl_stop_iso(struct client *client, void *buffer) static int ioctl_stop_iso(struct client *client, void *buffer)
{ {
struct fw_cdev_stop_iso *request = buffer;
if (request->handle != 0)
return -EINVAL;
return fw_iso_context_stop(client->iso_context); return fw_iso_context_stop(client->iso_context);
} }
......
...@@ -133,10 +133,10 @@ union fw_cdev_event { ...@@ -133,10 +133,10 @@ union fw_cdev_event {
#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOW('#', 0x08, struct fw_cdev_create_iso_context) #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso)
#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
#define FW_CDEV_IOC_STOP_ISO _IO('#', 0x0b) #define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
/* FW_CDEV_VERSION History /* FW_CDEV_VERSION History
* *
...@@ -233,6 +233,8 @@ struct fw_cdev_create_iso_context { ...@@ -233,6 +233,8 @@ struct fw_cdev_create_iso_context {
__u32 header_size; __u32 header_size;
__u32 channel; __u32 channel;
__u32 speed; __u32 speed;
__u64 closure;
__u32 handle;
}; };
struct fw_cdev_iso_packet { struct fw_cdev_iso_packet {
...@@ -249,12 +251,18 @@ struct fw_cdev_queue_iso { ...@@ -249,12 +251,18 @@ struct fw_cdev_queue_iso {
__u64 packets; __u64 packets;
__u64 data; __u64 data;
__u32 size; __u32 size;
__u32 handle;
}; };
struct fw_cdev_start_iso { struct fw_cdev_start_iso {
__s32 cycle; __s32 cycle;
__u32 sync; __u32 sync;
__u32 tags; __u32 tags;
__u32 handle;
};
struct fw_cdev_stop_iso {
__u32 handle;
}; };
#endif /* __fw_cdev_h */ #endif /* __fw_cdev_h */
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