From 5371842b723dd04df57171f2c74660966901380c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 7 Mar 2007 12:12:42 -0500 Subject: [PATCH] firewire: Implement ioctl to initiate bus reset. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristian Høgsberg Signed-off-by: Stefan Richter --- drivers/firewire/fw-device-cdev.c | 15 +++++++++++++++ drivers/firewire/fw-device-cdev.h | 16 ++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index 9f3c96c7af29..79e095ea552d 100644 --- a/drivers/firewire/fw-device-cdev.c +++ b/drivers/firewire/fw-device-cdev.c @@ -433,6 +433,19 @@ static int ioctl_send_response(struct client *client, void __user *arg) return 0; } +static int ioctl_initiate_bus_reset(struct client *client, void __user *arg) +{ + struct fw_cdev_initiate_bus_reset request; + int short_reset; + + if (copy_from_user(&request, arg, sizeof request)) + return -EFAULT; + + short_reset = (request.type == FW_CDEV_SHORT_RESET); + + return fw_core_initiate_bus_reset(client->device->card, short_reset); +} + static void iso_callback(struct fw_iso_context *context, u32 cycle, size_t header_length, void *header, void *data) @@ -606,6 +619,8 @@ dispatch_ioctl(struct client *client, unsigned int cmd, void __user *arg) return ioctl_allocate(client, arg); case FW_CDEV_IOC_SEND_RESPONSE: return ioctl_send_response(client, arg); + case FW_CDEV_IOC_INITIATE_BUS_RESET: + return ioctl_initiate_bus_reset(client, arg); case FW_CDEV_IOC_CREATE_ISO_CONTEXT: return ioctl_create_iso_context(client, arg); case FW_CDEV_IOC_QUEUE_ISO: diff --git a/drivers/firewire/fw-device-cdev.h b/drivers/firewire/fw-device-cdev.h index 4f94471b8078..8a8b390d5996 100644 --- a/drivers/firewire/fw-device-cdev.h +++ b/drivers/firewire/fw-device-cdev.h @@ -108,10 +108,11 @@ struct fw_cdev_event_iso_interrupt { #define FW_CDEV_IOC_SEND_REQUEST _IO('#', 0x01) #define FW_CDEV_IOC_ALLOCATE _IO('#', 0x02) #define FW_CDEV_IOC_SEND_RESPONSE _IO('#', 0x03) -#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IO('#', 0x04) -#define FW_CDEV_IOC_QUEUE_ISO _IO('#', 0x05) -#define FW_CDEV_IOC_START_ISO _IO('#', 0x06) -#define FW_CDEV_IOC_STOP_ISO _IO('#', 0x07) +#define FW_CDEV_IOC_INITIATE_BUS_RESET _IO('#', 0x04) +#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IO('#', 0x05) +#define FW_CDEV_IOC_QUEUE_ISO _IO('#', 0x06) +#define FW_CDEV_IOC_START_ISO _IO('#', 0x07) +#define FW_CDEV_IOC_STOP_ISO _IO('#', 0x08) struct fw_cdev_get_config_rom { __u32 length; @@ -139,6 +140,13 @@ struct fw_cdev_allocate { __u32 length; }; +#define FW_CDEV_LONG_RESET 0 +#define FW_CDEV_SHORT_RESET 1 + +struct fw_cdev_initiate_bus_reset { + __u32 type; +}; + #define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 #define FW_CDEV_ISO_CONTEXT_RECEIVE 1 -- 2.20.1