]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/firewire/fw-transaction.h
PCI: update pci_create_slot() to take a 'hotplug' param
[linux-2.6-omap-h63xx.git] / drivers / firewire / fw-transaction.h
index 04d3854f65600924e53183b63f4001d048d047eb..027f58ce81ad124a03b630071cd94dc1d4579348 100644 (file)
 #ifndef __fw_transaction_h
 #define __fw_transaction_h
 
+#include <linux/completion.h>
 #include <linux/device.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#include <linux/fs.h>
 #include <linux/dma-mapping.h>
 #include <linux/firewire-constants.h>
-#include <asm/atomic.h>
+#include <linux/kref.h>
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+#include <linux/timer.h>
+#include <linux/workqueue.h>
 
 #define TCODE_IS_READ_REQUEST(tcode)   (((tcode) & ~1) == 4)
 #define TCODE_IS_BLOCK_PACKET(tcode)   (((tcode) &  1) != 0)
@@ -80,6 +81,9 @@
 #define CSR_SPEED_MAP                  0x2000
 #define CSR_SPEED_MAP_END              0x3000
 
+#define BROADCAST_CHANNEL_INITIAL      (1 << 31 | 31)
+#define BROADCAST_CHANNEL_VALID                (1 << 30)
+
 #define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
 #define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
 
@@ -216,7 +220,8 @@ extern struct bus_type fw_bus_type;
 struct fw_card {
        const struct fw_card_driver *driver;
        struct device *device;
-       atomic_t device_count;
+       struct kref kref;
+       struct completion done;
 
        int node_id;
        int generation;
@@ -236,6 +241,7 @@ struct fw_card {
         */
        int self_id_count;
        u32 topology_map[252 + 3];
+       u32 broadcast_channel;
 
        spinlock_t lock; /* Take this lock when handling the lists in
                          * this struct. */
@@ -256,6 +262,20 @@ struct fw_card {
        int bm_generation;
 };
 
+static inline struct fw_card *fw_card_get(struct fw_card *card)
+{
+       kref_get(&card->kref);
+
+       return card;
+}
+
+void fw_card_release(struct kref *kref);
+
+static inline void fw_card_put(struct fw_card *card)
+{
+       kref_put(&card->kref, fw_card_release);
+}
+
 /*
  * The iso packet format allows for an immediate header/payload part
  * stored in 'header' immediately after the packet info plus an
@@ -348,8 +368,6 @@ int
 fw_iso_context_stop(struct fw_iso_context *ctx);
 
 struct fw_card_driver {
-       const char *name;
-
        /*
         * Enable the given card with the given initial config rom.
         * This function is expected to activate the card, and either
@@ -408,11 +426,14 @@ fw_core_initiate_bus_reset(struct fw_card *card, int short_reset);
 
 void
 fw_send_request(struct fw_card *card, struct fw_transaction *t,
-               int tcode, int node_id, int generation, int speed,
-               unsigned long long offset,
-               void *data, size_t length,
+               int tcode, int destination_id, int generation, int speed,
+               unsigned long long offset, void *data, size_t length,
                fw_transaction_callback_t callback, void *callback_data);
 
+int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
+                      int generation, int speed, unsigned long long offset,
+                      void *data, size_t length);
+
 int fw_cancel_transaction(struct fw_card *card,
                          struct fw_transaction *transaction);