linux/drivers/firewire/core-cdev.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Char device for device raw access
 *
 * Copyright (C) 2005-2007  Kristian Hoegsberg <[email protected]>
 */

#include <linux/bug.h>
#include <linux/compat.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/firewire.h>
#include <linux/firewire-cdev.h>
#include <linux/idr.h>
#include <linux/irqflags.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/kref.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/poll.h>
#include <linux/sched.h> /* required for linux/wait.h */
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/wait.h>
#include <linux/workqueue.h>


#include "core.h"
#include <trace/events/firewire.h>

/*
 * ABI version history is documented in linux/firewire-cdev.h.
 */
#define FW_CDEV_KERNEL_VERSION
#define FW_CDEV_VERSION_EVENT_REQUEST2
#define FW_CDEV_VERSION_ALLOCATE_REGION_END
#define FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW
#define FW_CDEV_VERSION_EVENT_ASYNC_TSTAMP

struct client {};

static inline void client_get(struct client *client)
{}

static void client_release(struct kref *kref)
{}

static void client_put(struct client *client)
{}

struct client_resource;
client_resource_release_fn_t;
struct client_resource {};

struct address_handler_resource {};

struct outbound_transaction_resource {};

struct inbound_transaction_resource {};

struct descriptor_resource {};

struct iso_resource {};

static void release_iso_resource(struct client *, struct client_resource *);

static void schedule_iso_resource(struct iso_resource *r, unsigned long delay)
{}

static void schedule_if_iso_resource(struct client_resource *resource)
{}

/*
 * dequeue_event() just kfree()'s the event, so the event has to be
 * the first field in a struct XYZ_event.
 */
struct event {};

struct bus_reset_event {};

struct outbound_transaction_event {};

struct inbound_transaction_event {};

struct iso_interrupt_event {};

struct iso_interrupt_mc_event {};

struct iso_resource_event {};

struct outbound_phy_packet_event {};

struct inbound_phy_packet_event {};

#ifdef CONFIG_COMPAT
static void __user *u64_to_uptr(u64 value)
{}

static u64 uptr_to_u64(void __user *ptr)
{}
#else
static inline void __user *u64_to_uptr(u64 value)
{
	return (void __user *)(unsigned long)value;
}

static inline u64 uptr_to_u64(void __user *ptr)
{
	return (u64)(unsigned long)ptr;
}
#endif /* CONFIG_COMPAT */

static int fw_device_op_open(struct inode *inode, struct file *file)
{}

static void queue_event(struct client *client, struct event *event,
			void *data0, size_t size0, void *data1, size_t size1)
{}

static int dequeue_event(struct client *client,
			 char __user *buffer, size_t count)
{}

static ssize_t fw_device_op_read(struct file *file, char __user *buffer,
				 size_t count, loff_t *offset)
{}

static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event,
				 struct client *client)
{}

static void for_each_client(struct fw_device *device,
			    void (*callback)(struct client *client))
{}

static int schedule_reallocations(int id, void *p, void *data)
{}

static void queue_bus_reset_event(struct client *client)
{}

void fw_device_cdev_update(struct fw_device *device)
{}

static void wake_up_client(struct client *client)
{}

void fw_device_cdev_remove(struct fw_device *device)
{}

ioctl_arg;

static int ioctl_get_info(struct client *client, union ioctl_arg *arg)
{}

static int add_client_resource(struct client *client,
			       struct client_resource *resource, gfp_t gfp_mask)
{}

static int release_client_resource(struct client *client, u32 handle,
				   client_resource_release_fn_t release,
				   struct client_resource **return_resource)
{}

static void release_transaction(struct client *client,
				struct client_resource *resource)
{}

static void complete_transaction(struct fw_card *card, int rcode, u32 request_tstamp,
				 u32 response_tstamp, void *payload, size_t length, void *data)
{}

static int init_request(struct client *client,
			struct fw_cdev_send_request *request,
			int destination_id, int speed)
{}

static int ioctl_send_request(struct client *client, union ioctl_arg *arg)
{}

static void release_request(struct client *client,
			    struct client_resource *resource)
{}

static void handle_request(struct fw_card *card, struct fw_request *request,
			   int tcode, int destination, int source,
			   int generation, unsigned long long offset,
			   void *payload, size_t length, void *callback_data)
{}

static void release_address_handler(struct client *client,
				    struct client_resource *resource)
{}

static int ioctl_allocate(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_deallocate(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_send_response(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_initiate_bus_reset(struct client *client, union ioctl_arg *arg)
{}

static void release_descriptor(struct client *client,
			       struct client_resource *resource)
{}

static int ioctl_add_descriptor(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_remove_descriptor(struct client *client, union ioctl_arg *arg)
{}

static void iso_callback(struct fw_iso_context *context, u32 cycle,
			 size_t header_length, void *header, void *data)
{}

static void iso_mc_callback(struct fw_iso_context *context,
			    dma_addr_t completed, void *data)
{}

static enum dma_data_direction iso_dma_direction(struct fw_iso_context *context)
{}

static struct fw_iso_context *fw_iso_mc_context_create(struct fw_card *card,
						fw_iso_mc_callback_t callback,
						void *callback_data)
{}

static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_set_iso_channels(struct client *client, union ioctl_arg *arg)
{}

/* Macros for decoding the iso packet control header. */
#define GET_PAYLOAD_LENGTH(v)
#define GET_INTERRUPT(v)
#define GET_SKIP(v)
#define GET_TAG(v)
#define GET_SY(v)
#define GET_HEADER_LENGTH(v)

static int ioctl_queue_iso(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_start_iso(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_stop_iso(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_flush_iso(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_get_cycle_timer2(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_get_cycle_timer(struct client *client, union ioctl_arg *arg)
{}

static void iso_resource_work(struct work_struct *work)
{}

static void release_iso_resource(struct client *client,
				 struct client_resource *resource)
{}

static int init_iso_resource(struct client *client,
		struct fw_cdev_allocate_iso_resource *request, int todo)
{}

static int ioctl_allocate_iso_resource(struct client *client,
				       union ioctl_arg *arg)
{}

static int ioctl_deallocate_iso_resource(struct client *client,
					 union ioctl_arg *arg)
{}

static int ioctl_allocate_iso_resource_once(struct client *client,
					    union ioctl_arg *arg)
{}

static int ioctl_deallocate_iso_resource_once(struct client *client,
					      union ioctl_arg *arg)
{}

/*
 * Returns a speed code:  Maximum speed to or from this device,
 * limited by the device's link speed, the local node's link speed,
 * and all PHY port speeds between the two links.
 */
static int ioctl_get_speed(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_send_broadcast_request(struct client *client,
					union ioctl_arg *arg)
{}

static int ioctl_send_stream_packet(struct client *client, union ioctl_arg *arg)
{}

static void outbound_phy_packet_callback(struct fw_packet *packet,
					 struct fw_card *card, int status)
{}

static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
{}

static int ioctl_receive_phy_packets(struct client *client, union ioctl_arg *arg)
{}

void fw_cdev_handle_phy_packet(struct fw_card *card, struct fw_packet *p)
{}

static int (* const ioctl_handlers[])(struct client *, union ioctl_arg *) =;

static int dispatch_ioctl(struct client *client,
			  unsigned int cmd, void __user *arg)
{}

static long fw_device_op_ioctl(struct file *file,
			       unsigned int cmd, unsigned long arg)
{}

static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma)
{}

static int is_outbound_transaction_resource(int id, void *p, void *data)
{}

static int has_outbound_transactions(struct client *client)
{}

static int shutdown_resource(int id, void *p, void *data)
{}

static int fw_device_op_release(struct inode *inode, struct file *file)
{}

static __poll_t fw_device_op_poll(struct file *file, poll_table * pt)
{}

const struct file_operations fw_device_ops =;