firewire.h revision 5c40cbfefa828208c671e2f58789e4dd04f79563
177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#ifndef _LINUX_FIREWIRE_H
277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define _LINUX_FIREWIRE_H
377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/completion.h>
577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/device.h>
6c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#include <linux/dma-mapping.h>
777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/kernel.h>
877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/kref.h>
977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/list.h>
1077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/mutex.h>
1177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/spinlock.h>
1277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/sysfs.h>
1377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/timer.h>
1477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/types.h>
1577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <linux/workqueue.h>
1677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
1777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <asm/atomic.h>
1877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#include <asm/byteorder.h>
1977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
2077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
2177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
2277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
2377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_REGISTER_BASE		0xfffff0000000ULL
2477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
2577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter/* register offsets are relative to CSR_REGISTER_BASE */
2677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_STATE_CLEAR			0x0
2777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_STATE_SET			0x4
2877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_NODE_IDS			0x8
2977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_RESET_START			0xc
3077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_SPLIT_TIMEOUT_HI		0x18
3177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_SPLIT_TIMEOUT_LO		0x1c
3277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_CYCLE_TIME			0x200
3377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_BUS_TIME			0x204
3477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_BUSY_TIMEOUT		0x210
3577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_BUS_MANAGER_ID		0x21c
3677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_BANDWIDTH_AVAILABLE		0x220
3777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_CHANNELS_AVAILABLE		0x224
3877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_CHANNELS_AVAILABLE_HI	0x224
3977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_CHANNELS_AVAILABLE_LO	0x228
4077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_BROADCAST_CHANNEL		0x234
4177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_CONFIG_ROM			0x400
4277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_CONFIG_ROM_END		0x800
4377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_FCP_COMMAND			0xB00
4477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_FCP_RESPONSE		0xD00
4577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_FCP_END			0xF00
4677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_TOPOLOGY_MAP		0x1000
4777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_TOPOLOGY_MAP_END		0x1400
4877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_SPEED_MAP			0x2000
4977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_SPEED_MAP_END		0x3000
5077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
5177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_OFFSET		0x40
5277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_LEAF		0x80
5377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_DIRECTORY		0xc0
5477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
5577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_DESCRIPTOR		0x01
5677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_VENDOR		0x03
5777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_HARDWARE_VERSION	0x04
5877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_UNIT		0x11
5977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_SPECIFIER_ID	0x12
6077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_VERSION		0x13
6177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_DEPENDENT_INFO	0x14
6277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_MODEL		0x17
6377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#define CSR_DIRECTORY_ID	0x20
6477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
6577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_csr_iterator {
6613b302d0a217580c0129b0641b0ca8b592e437b0Stefan Richter	const u32 *p;
6713b302d0a217580c0129b0641b0ca8b592e437b0Stefan Richter	const u32 *end;
6877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
6977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
7013b302d0a217580c0129b0641b0ca8b592e437b0Stefan Richtervoid fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p);
7177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterint fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
7213b302d0a217580c0129b0641b0ca8b592e437b0Stefan Richterint fw_csr_string(const u32 *directory, int key, char *buf, size_t size);
731f8fef7b3388b5a976e80839679b5bae581a1091Clemens Ladisch
7477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterextern struct bus_type fw_bus_type;
7577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
7677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_card_driver;
7777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_node;
7877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
7977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_card {
8077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	const struct fw_card_driver *driver;
8177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct device *device;
8277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct kref kref;
8377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct completion done;
8477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
8577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int node_id;
8677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int generation;
871e626fdcef61460dc75fe7377f38bb019722b848Stefan Richter	int current_tlabel;
881e626fdcef61460dc75fe7377f38bb019722b848Stefan Richter	u64 tlabel_mask;
8977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct list_head transaction_list;
9077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	unsigned long reset_jiffies;
9177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
9277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	unsigned long long guid;
9377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	unsigned max_receive;
9477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int link_speed;
9577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int config_rom_generation;
9677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
9777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	spinlock_t lock; /* Take this lock when handling the lists in
9877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter			  * this struct. */
9977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_node *local_node;
10077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_node *root_node;
10177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_node *irm_node;
10277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	u8 color; /* must be u8 to match the definition in struct fw_node */
10377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int gap_count;
10477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	bool beta_repeaters_present;
10577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
10677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int index;
10777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
10877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct list_head link;
10977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
11077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	/* Work struct for BM duties. */
11177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct delayed_work work;
11277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int bm_retries;
11377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int bm_generation;
1146fdc03709433ccc2005f0f593ae9d9dd04f7b485Stefan Richter	__be32 bm_transaction_data[2];
11577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
11677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	bool broadcast_channel_allocated;
11777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	u32 broadcast_channel;
118cb7c96da3651111efbe088fa12f9bed61836ea93Stefan Richter	__be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
11977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
12077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
12177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_attribute_group {
12277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct attribute_group *groups[2];
12377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct attribute_group group;
12477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct attribute *attrs[12];
12577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
12677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
12777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterenum fw_device_state {
12877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	FW_DEVICE_INITIALIZING,
12977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	FW_DEVICE_RUNNING,
13077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	FW_DEVICE_GONE,
13177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	FW_DEVICE_SHUTDOWN,
13277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
13377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
13477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter/*
13577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * Note, fw_device.generation always has to be read before fw_device.node_id.
13677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * Use SMP memory barriers to ensure this.  Otherwise requests will be sent
13777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * to an outdated node_id if the generation was updated in the meantime due
13877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * to a bus reset.
13977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter *
14077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * Likewise, fw-core will take care to update .node_id before .generation so
14177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * that whenever fw_device.generation is current WRT the actual bus generation,
14277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * fw_device.node_id is guaranteed to be current too.
14377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter *
14477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * The same applies to fw_device.card->node_id vs. fw_device.generation.
14577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter *
14677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * fw_device.config_rom and fw_device.config_rom_length may be accessed during
14777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * the lifetime of any fw_unit belonging to the fw_device, before device_del()
14877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * was called on the last fw_unit.  Alternatively, they may be accessed while
14977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * holding fw_device_rwsem.
15077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter */
15177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_device {
15277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	atomic_t state;
15377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_node *node;
15477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int node_id;
15577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int generation;
15677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	unsigned max_speed;
15777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_card *card;
15877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct device device;
15977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
16077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct mutex client_list_mutex;
16177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct list_head client_list;
16277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
16313b302d0a217580c0129b0641b0ca8b592e437b0Stefan Richter	const u32 *config_rom;
16477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	size_t config_rom_length;
16577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int config_rom_retries;
16677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	unsigned is_local:1;
167837ec787d85fda8d73193a399ebcea0288e4765bStefan Richter	unsigned max_rec:4;
16877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	unsigned cmc:1;
169837ec787d85fda8d73193a399ebcea0288e4765bStefan Richter	unsigned irmc:1;
17077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	unsigned bc_implemented:2;
17177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
17277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct delayed_work work;
17377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_attribute_group attribute_group;
17477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
17577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
17677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstatic inline struct fw_device *fw_device(struct device *dev)
17777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter{
17877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	return container_of(dev, struct fw_device, device);
17977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter}
18077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
18177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstatic inline int fw_device_is_shutdown(struct fw_device *device)
18277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter{
18377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN;
18477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter}
18577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
18677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstatic inline struct fw_device *fw_device_get(struct fw_device *device)
18777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter{
18877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	get_device(&device->device);
18977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
19077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	return device;
19177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter}
19277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
19377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstatic inline void fw_device_put(struct fw_device *device)
19477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter{
19577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	put_device(&device->device);
19677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter}
19777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
19877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterint fw_device_enable_phys_dma(struct fw_device *device);
19977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
20077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter/*
20177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter * fw_unit.directory must not be accessed after device_del(&fw_unit.device).
20277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter */
20377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_unit {
20477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct device device;
20513b302d0a217580c0129b0641b0ca8b592e437b0Stefan Richter	const u32 *directory;
20677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_attribute_group attribute_group;
20777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
20877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
20977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstatic inline struct fw_unit *fw_unit(struct device *dev)
21077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter{
21177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	return container_of(dev, struct fw_unit, device);
21277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter}
21377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
21477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstatic inline struct fw_unit *fw_unit_get(struct fw_unit *unit)
21577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter{
21677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	get_device(&unit->device);
21777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
21877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	return unit;
21977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter}
22077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
22177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstatic inline void fw_unit_put(struct fw_unit *unit)
22277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter{
22377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	put_device(&unit->device);
22477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter}
22577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
226e5110d011e03030926872457f05e49e3d5031737Stefan Richterstatic inline struct fw_device *fw_parent_device(struct fw_unit *unit)
227e5110d011e03030926872457f05e49e3d5031737Stefan Richter{
228e5110d011e03030926872457f05e49e3d5031737Stefan Richter	return fw_device(unit->device.parent);
229e5110d011e03030926872457f05e49e3d5031737Stefan Richter}
230e5110d011e03030926872457f05e49e3d5031737Stefan Richter
23177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct ieee1394_device_id;
23277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
23377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_driver {
23477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct device_driver driver;
23577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	/* Called when the parent device sits through a bus reset. */
23677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	void (*update)(struct fw_unit *unit);
23777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	const struct ieee1394_device_id *id_table;
23877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
23977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
24077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_packet;
24177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_request;
24277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
24377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richtertypedef void (*fw_packet_callback_t)(struct fw_packet *packet,
24477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				     struct fw_card *card, int status);
24577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richtertypedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
24677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter					  void *data, size_t length,
24777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter					  void *callback_data);
24877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter/*
249db5d247ae811f49185a71e703b65acad845e4b18Clemens Ladisch * Important note:  Except for the FCP registers, the callback must guarantee
250db5d247ae811f49185a71e703b65acad845e4b18Clemens Ladisch * that either fw_send_response() or kfree() is called on the @request.
25177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter */
25277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richtertypedef void (*fw_address_callback_t)(struct fw_card *card,
25377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				      struct fw_request *request,
25477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				      int tcode, int destination, int source,
25577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				      int generation, int speed,
25677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				      unsigned long long offset,
25777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				      void *data, size_t length,
25877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				      void *callback_data);
25977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
26077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_packet {
26177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int speed;
26277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int generation;
26377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	u32 header[4];
26477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	size_t header_length;
26577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	void *payload;
26677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	size_t payload_length;
26777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	dma_addr_t payload_bus;
26819593ffdb6daa6ba691d247a2400cece12687c52Stefan Richter	bool payload_mapped;
26977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	u32 timestamp;
27077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
27177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	/*
27277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * This callback is called when the packet transmission has
27377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * completed; for successful transmission, the status code is
27477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * the ack received from the destination, otherwise it's a
27577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
27677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * The callback can be called from tasklet context and thus
27777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * must never block.
27877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 */
27977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	fw_packet_callback_t callback;
28077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int ack;
28177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct list_head link;
28277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	void *driver_data;
28377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
28477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
28577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_transaction {
28677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int node_id; /* The generation is implied; it is always the current. */
28777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int tlabel;
28877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	int timestamp;
28977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct list_head link;
2905c40cbfefa828208c671e2f58789e4dd04f79563Clemens Ladisch	struct fw_card *card;
2915c40cbfefa828208c671e2f58789e4dd04f79563Clemens Ladisch	struct timer_list split_timeout_timer;
29277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
29377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct fw_packet packet;
29477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
29577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	/*
29677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * The data passed to the callback is valid only during the
29777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 * callback.
29877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	 */
29977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	fw_transaction_callback_t callback;
30077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	void *callback_data;
30177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
30277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
30377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_address_handler {
30477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	u64 offset;
30577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	size_t length;
30677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	fw_address_callback_t address_callback;
30777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	void *callback_data;
30877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	struct list_head link;
30977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
31077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
31177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterstruct fw_address_region {
31277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	u64 start;
31377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter	u64 end;
31477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter};
31577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
31677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterextern const struct fw_address_region fw_high_memory_region;
31777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
31877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterint fw_core_add_address_handler(struct fw_address_handler *handler,
31977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter				const struct fw_address_region *region);
32077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richtervoid fw_core_remove_address_handler(struct fw_address_handler *handler);
32177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richtervoid fw_send_response(struct fw_card *card,
32277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter		      struct fw_request *request, int rcode);
32377c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richtervoid fw_send_request(struct fw_card *card, struct fw_transaction *t,
32477c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter		     int tcode, int destination_id, int generation, int speed,
32577c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter		     unsigned long long offset, void *payload, size_t length,
32677c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter		     fw_transaction_callback_t callback, void *callback_data);
32777c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterint fw_cancel_transaction(struct fw_card *card,
32877c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter			  struct fw_transaction *transaction);
32977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richterint fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
33077c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter		       int generation, int speed, unsigned long long offset,
33177c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter		       void *payload, size_t length);
33277c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter
333c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonstatic inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
334c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason{
335c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	return tag << 14 | channel << 8 | sy;
336c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason}
337c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
338c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonstruct fw_descriptor {
339c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	struct list_head link;
340c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	size_t length;
341c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 immediate;
342c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 key;
343c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	const u32 *data;
344c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason};
345c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
346c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonint fw_core_add_descriptor(struct fw_descriptor *desc);
347c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonvoid fw_core_remove_descriptor(struct fw_descriptor *desc);
348c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
349c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason/*
350c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * The iso packet format allows for an immediate header/payload part
351c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * stored in 'header' immediately after the packet info plus an
352c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * indirect payload part that is pointer to by the 'payload' field.
353c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * Applications can use one or the other or both to implement simple
354c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * low-bandwidth streaming (e.g. audio) or more advanced
355c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * scatter-gather streaming (e.g. assembling video frame automatically).
356c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason */
357c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonstruct fw_iso_packet {
358c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u16 payload_length;	/* Length of indirect payload. */
359c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 interrupt:1;	/* Generate interrupt on this packet */
360c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 skip:1;		/* Set to not send packet at all. */
361c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 tag:2;
362c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 sy:4;
363c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 header_length:8;	/* Length of immediate header. */
364c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	u32 header[0];
365c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason};
366c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
367c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#define FW_ISO_CONTEXT_TRANSMIT	0
368c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#define FW_ISO_CONTEXT_RECEIVE	1
369c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
370c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#define FW_ISO_CONTEXT_MATCH_TAG0	 1
371c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#define FW_ISO_CONTEXT_MATCH_TAG1	 2
372c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#define FW_ISO_CONTEXT_MATCH_TAG2	 4
373c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#define FW_ISO_CONTEXT_MATCH_TAG3	 8
374c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason#define FW_ISO_CONTEXT_MATCH_ALL_TAGS	15
375c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
376c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason/*
377c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * An iso buffer is just a set of pages mapped for DMA in the
378c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * specified direction.  Since the pages are to be used for DMA, they
379c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * are not mapped into the kernel virtual address space.  We store the
380c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * DMA address in the page private. The helper function
381c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason * fw_iso_buffer_map() will map the pages into a given vma.
382c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason */
383c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonstruct fw_iso_buffer {
384c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	enum dma_data_direction direction;
385c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	struct page **pages;
386c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	int page_count;
387c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason};
388c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
389c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonint fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
390c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason		       int page_count, enum dma_data_direction direction);
391c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonvoid fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
392c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
393c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonstruct fw_iso_context;
394c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasontypedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
395c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason				  u32 cycle, size_t header_length,
396c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason				  void *header, void *data);
397c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonstruct fw_iso_context {
398c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	struct fw_card *card;
399c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	int type;
400c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	int channel;
401c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	int speed;
402c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	size_t header_size;
403c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	fw_iso_callback_t callback;
404c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason	void *callback_data;
405c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason};
406c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
407c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonstruct fw_iso_context *fw_iso_context_create(struct fw_card *card,
408c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason		int type, int channel, int speed, size_t header_size,
409c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason		fw_iso_callback_t callback, void *callback_data);
410c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonint fw_iso_context_queue(struct fw_iso_context *ctx,
411c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason			 struct fw_iso_packet *packet,
412c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason			 struct fw_iso_buffer *buffer,
413c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason			 unsigned long payload);
414c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonint fw_iso_context_start(struct fw_iso_context *ctx,
415c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason			 int cycle, int sync, int tags);
416c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonint fw_iso_context_stop(struct fw_iso_context *ctx);
417c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlasonvoid fw_iso_context_destroy(struct fw_iso_context *ctx);
418c76acec6d55107b652a37c90b36c00bc8b04dabbJay Fenlason
41977c9a5daa9c4d9b37812c9c69c7bcbb3f9399c3cStefan Richter#endif /* _LINUX_FIREWIRE_H */
420