block: get rid of elv_insert() interface
[linux-2.6.git] / include / linux / firewire.h
index 53b9217..c64f368 100644 (file)
 #define CSR_CYCLE_TIME                 0x200
 #define CSR_BUS_TIME                   0x204
 #define CSR_BUSY_TIMEOUT               0x210
+#define CSR_PRIORITY_BUDGET            0x218
 #define CSR_BUS_MANAGER_ID             0x21c
 #define CSR_BANDWIDTH_AVAILABLE                0x220
 #define CSR_CHANNELS_AVAILABLE         0x224
 #define CSR_CHANNELS_AVAILABLE_HI      0x224
 #define CSR_CHANNELS_AVAILABLE_LO      0x228
+#define CSR_MAINT_UTILITY              0x230
 #define CSR_BROADCAST_CHANNEL          0x234
 #define CSR_CONFIG_ROM                 0x400
 #define CSR_CONFIG_ROM_END             0x800
+#define CSR_OMPR                       0x900
+#define CSR_OPCR(i)                    (0x904 + (i) * 4)
+#define CSR_IMPR                       0x980
+#define CSR_IPCR(i)                    (0x984 + (i) * 4)
 #define CSR_FCP_COMMAND                        0xB00
 #define CSR_FCP_RESPONSE               0xD00
 #define CSR_FCP_END                    0xF00
 #define CSR_DESCRIPTOR         0x01
 #define CSR_VENDOR             0x03
 #define CSR_HARDWARE_VERSION   0x04
-#define CSR_NODE_CAPABILITIES  0x0c
 #define CSR_UNIT               0x11
 #define CSR_SPECIFIER_ID       0x12
 #define CSR_VERSION            0x13
 #define CSR_DEPENDENT_INFO     0x14
 #define CSR_MODEL              0x17
-#define CSR_INSTANCE           0x18
 #define CSR_DIRECTORY_ID       0x20
 
 struct fw_csr_iterator {
-       u32 *p;
-       u32 *end;
+       const u32 *p;
+       const u32 *end;
 };
 
-void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p);
+void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p);
 int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
+int fw_csr_string(const u32 *directory, int key, char *buf, size_t size);
 
 extern struct bus_type fw_bus_type;
 
@@ -88,8 +93,12 @@ struct fw_card {
        int current_tlabel;
        u64 tlabel_mask;
        struct list_head transaction_list;
-       struct timer_list flush_timer;
-       unsigned long reset_jiffies;
+       u64 reset_jiffies;
+
+       u32 split_timeout_hi;
+       u32 split_timeout_lo;
+       unsigned int split_timeout_cycles;
+       unsigned int split_timeout_jiffies;
 
        unsigned long long guid;
        unsigned max_receive;
@@ -106,18 +115,28 @@ struct fw_card {
        bool beta_repeaters_present;
 
        int index;
-
        struct list_head link;
 
-       /* Work struct for BM duties. */
-       struct delayed_work work;
+       struct list_head phy_receiver_list;
+
+       struct delayed_work br_work; /* bus reset job */
+       bool br_short;
+
+       struct delayed_work bm_work; /* bus manager job */
        int bm_retries;
        int bm_generation;
        __be32 bm_transaction_data[2];
+       int bm_node_id;
+       bool bm_abdicate;
+
+       bool priority_budget_implemented;       /* controller feature */
+       bool broadcast_channel_auto_allocated;  /* controller feature */
 
        bool broadcast_channel_allocated;
        u32 broadcast_channel;
-       u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
+       __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
+
+       __be32 maint_utility_register;
 };
 
 struct fw_attribute_group {
@@ -162,7 +181,7 @@ struct fw_device {
        struct mutex client_list_mutex;
        struct list_head client_list;
 
-       u32 *config_rom;
+       const u32 *config_rom;
        size_t config_rom_length;
        int config_rom_retries;
        unsigned is_local:1;
@@ -204,7 +223,7 @@ int fw_device_enable_phys_dma(struct fw_device *device);
  */
 struct fw_unit {
        struct device device;
-       u32 *directory;
+       const u32 *directory;
        struct fw_attribute_group attribute_group;
 };
 
@@ -248,13 +267,13 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
                                          void *data, size_t length,
                                          void *callback_data);
 /*
- * Important note:  The callback must guarantee that either fw_send_response()
- * or kfree() is called on the @request.
+ * Important note:  Except for the FCP registers, the callback must guarantee
+ * that either fw_send_response() or kfree() is called on the @request.
  */
 typedef void (*fw_address_callback_t)(struct fw_card *card,
                                      struct fw_request *request,
                                      int tcode, int destination, int source,
-                                     int generation, int speed,
+                                     int generation,
                                      unsigned long long offset,
                                      void *data, size_t length,
                                      void *callback_data);
@@ -267,13 +286,14 @@ struct fw_packet {
        void *payload;
        size_t payload_length;
        dma_addr_t payload_bus;
+       bool payload_mapped;
        u32 timestamp;
 
        /*
-        * This callback is called when the packet transmission has
-        * completed; for successful transmission, the status code is
-        * the ack received from the destination, otherwise it's a
-        * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
+        * This callback is called when the packet transmission has completed.
+        * For successful transmission, the status code is the ack received
+        * from the destination.  Otherwise it is one of the juju-specific
+        * rcodes:  RCODE_SEND_ERROR, _CANCELLED, _BUSY, _GENERATION, _NO_ACK.
         * The callback can be called from tasklet context and thus
         * must never block.
         */
@@ -286,8 +306,10 @@ struct fw_packet {
 struct fw_transaction {
        int node_id; /* The generation is implied; it is always the current. */
        int tlabel;
-       int timestamp;
        struct list_head link;
+       struct fw_card *card;
+       bool is_split_transaction;
+       struct timer_list split_timeout_timer;
 
        struct fw_packet packet;
 
@@ -354,17 +376,19 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc);
  * scatter-gather streaming (e.g. assembling video frame automatically).
  */
 struct fw_iso_packet {
-       u16 payload_length;     /* Length of indirect payload. */
-       u32 interrupt:1;        /* Generate interrupt on this packet */
-       u32 skip:1;             /* Set to not send packet at all. */
-       u32 tag:2;
-       u32 sy:4;
-       u32 header_length:8;    /* Length of immediate header. */
-       u32 header[0];
+       u16 payload_length;     /* Length of indirect payload           */
+       u32 interrupt:1;        /* Generate interrupt on this packet    */
+       u32 skip:1;             /* tx: Set to not send packet at all    */
+                               /* rx: Sync bit, wait for matching sy   */
+       u32 tag:2;              /* tx: Tag in packet header             */
+       u32 sy:4;               /* tx: Sy in packet header              */
+       u32 header_length:8;    /* Length of immediate header           */
+       u32 header[0];          /* tx: Top of 1394 isoch. data_block    */
 };
 
-#define FW_ISO_CONTEXT_TRANSMIT        0
-#define FW_ISO_CONTEXT_RECEIVE 1
+#define FW_ISO_CONTEXT_TRANSMIT                        0
+#define FW_ISO_CONTEXT_RECEIVE                 1
+#define FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL    2
 
 #define FW_ISO_CONTEXT_MATCH_TAG0       1
 #define FW_ISO_CONTEXT_MATCH_TAG1       2
@@ -388,24 +412,31 @@ struct fw_iso_buffer {
 int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
                       int page_count, enum dma_data_direction direction);
 void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
+size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed);
 
 struct fw_iso_context;
 typedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
                                  u32 cycle, size_t header_length,
                                  void *header, void *data);
+typedef void (*fw_iso_mc_callback_t)(struct fw_iso_context *context,
+                                    dma_addr_t completed, void *data);
 struct fw_iso_context {
        struct fw_card *card;
        int type;
        int channel;
        int speed;
        size_t header_size;
-       fw_iso_callback_t callback;
+       union {
+               fw_iso_callback_t sc;
+               fw_iso_mc_callback_t mc;
+       } callback;
        void *callback_data;
 };
 
 struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
                int type, int channel, int speed, size_t header_size,
                fw_iso_callback_t callback, void *callback_data);
+int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels);
 int fw_iso_context_queue(struct fw_iso_context *ctx,
                         struct fw_iso_packet *packet,
                         struct fw_iso_buffer *buffer,
@@ -414,5 +445,8 @@ int fw_iso_context_start(struct fw_iso_context *ctx,
                         int cycle, int sync, int tags);
 int fw_iso_context_stop(struct fw_iso_context *ctx);
 void fw_iso_context_destroy(struct fw_iso_context *ctx);
+void fw_iso_resource_manage(struct fw_card *card, int generation,
+                           u64 channels_mask, int *channel, int *bandwidth,
+                           bool allocate, __be32 buffer[2]);
 
 #endif /* _LINUX_FIREWIRE_H */