static u32 config_rom[256];
int i, j, length;
- /* Initialize contents of config rom buffer. On the OHCI
- * controller, block reads to the config rom accesses the host
- * memory, but quadlet read access the hardware bus info block
- * registers. That's just crack, but it means we should make
- * sure the contents of bus info block in host memory mathces
- * the version stored in the OHCI registers. */
+ /* Initialize contents of config rom buffer. On the OHCI
+ * controller, block reads to the config rom accesses the host
+ * memory, but quadlet read access the hardware bus info block
+ * registers. That's just crack, but it means we should make
+ * sure the contents of bus info block in host memory mathces
+ * the version stored in the OHCI registers. */
memset(config_rom, 0, sizeof config_rom);
config_rom[0] = bib_crc_length(4) | bib_info_length(4) | bib_crc(0);
static int index;
card->index = index++;
- card->driver = driver;
+ card->driver = driver;
card->device = device;
- card->current_tlabel = 0;
- card->tlabel_mask = 0;
+ card->current_tlabel = 0;
+ card->tlabel_mask = 0;
card->color = 0;
- INIT_LIST_HEAD(&card->transaction_list);
+ INIT_LIST_HEAD(&card->transaction_list);
spin_lock_init(&card->lock);
setup_timer(&card->flush_timer,
flush_timer_callback, (unsigned long)card);
retval = device_add(&card->card_device);
if (retval < 0) {
- fw_error("Failed to register card device.");
+ fw_error("Failed to register card device.");
return retval;
}
static void
dummy_send_request(struct fw_card *card, struct fw_packet *packet)
{
- packet->callback(packet, card, -ENODEV);
+ packet->callback(packet, card, -ENODEV);
}
static void
dummy_send_response(struct fw_card *card, struct fw_packet *packet)
{
- packet->callback(packet, card, -ENODEV);
+ packet->callback(packet, card, -ENODEV);
}
static int
}
static struct fw_card_driver dummy_driver = {
- .name = "dummy",
+ .name = "dummy",
.enable = dummy_enable,
.update_phy_reg = dummy_update_phy_reg,
.set_config_rom = dummy_set_config_rom,
- .send_request = dummy_send_request,
- .send_response = dummy_send_response,
+ .send_request = dummy_send_request,
+ .send_response = dummy_send_response,
.enable_phys_dma = dummy_enable_phys_dma
};
int
fw_core_initiate_bus_reset(struct fw_card *card, int short_reset)
{
- u32 address;
-
- if (short_reset)
- address = 5;
- else
- address = 1;
-
- return card->driver->update_phy_reg(card, address, 0, 0x40);
+ return card->driver->update_phy_reg(card, short_reset ? 5 : 1, 0, 0x40);
}
EXPORT_SYMBOL(fw_core_initiate_bus_reset);
#define TCODE_READ_QUADLET_RESPONSE 6
#define TCODE_READ_BLOCK_RESPONSE 7
#define TCODE_CYCLE_START 8
-#define TCODE_LOCK_REQUEST 9
-#define TCODE_STREAM_DATA 10
-#define TCODE_LOCK_RESPONSE 11
+#define TCODE_LOCK_REQUEST 9
+#define TCODE_STREAM_DATA 10
+#define TCODE_LOCK_RESPONSE 11
#define RCODE_COMPLETE 0x0
-#define RCODE_CONFLICT_ERROR 0x4
-#define RCODE_DATA_ERROR 0x5
-#define RCODE_TYPE_ERROR 0x6
-#define RCODE_ADDRESS_ERROR 0x7
+#define RCODE_CONFLICT_ERROR 0x4
+#define RCODE_DATA_ERROR 0x5
+#define RCODE_TYPE_ERROR 0x6
+#define RCODE_ADDRESS_ERROR 0x7
#define SCODE_100 0x0
#define SCODE_200 0x1
};
struct fw_cdev_iso_packet {
- __u16 payload_length; /* Length of indirect payload. */
+ __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];
+ __u32 header[0];
};
struct fw_cdev_queue_iso {
ci->p = p + 1;
ci->end = ci->p + (p[0] >> 16);
}
-
EXPORT_SYMBOL(fw_csr_iterator_init);
int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value)
return ci->p++ < ci->end;
}
-
EXPORT_SYMBOL(fw_csr_iterator_next);
static int is_fw_unit(struct device *dev);
.match = fw_unit_match,
.uevent = fw_unit_uevent
};
-
EXPORT_SYMBOL(fw_bus_type);
extern struct fw_device *fw_device_get(struct fw_device *device)
device->node_id,
device->generation);
}
-
EXPORT_SYMBOL(fw_device_enable_phys_dma);
static ssize_t
static inline struct fw_device *
fw_device(struct device *dev)
{
- return container_of(dev, struct fw_device, device);
+ return container_of(dev, struct fw_device, device);
}
struct fw_device *fw_device_get(struct fw_device *device);
static inline struct fw_unit *
fw_unit(struct device *dev)
{
- return container_of(dev, struct fw_unit, device);
+ return container_of(dev, struct fw_unit, device);
}
#define CSR_OFFSET 0x40
static inline struct fw_driver *
fw_driver(struct device_driver *drv)
{
- return container_of(drv, struct fw_driver, driver);
+ return container_of(drv, struct fw_driver, driver);
}
extern const struct file_operations fw_device_ops;
return ctx;
}
-
EXPORT_SYMBOL(fw_iso_context_create);
void fw_iso_context_destroy(struct fw_iso_context *ctx)
card->driver->free_iso_context(ctx);
}
-
EXPORT_SYMBOL(fw_iso_context_destroy);
int
return ctx->card->driver->send_iso(ctx, cycle);
}
-
EXPORT_SYMBOL(fw_iso_context_send);
int
return card->driver->queue_iso(ctx, packet, payload);
}
-
EXPORT_SYMBOL(fw_iso_context_queue);
* element so that head == tail means buffer full. */
memset(ctx->head_descriptor, 0, sizeof *ctx->head_descriptor);
- ctx->head_descriptor->control =
- cpu_to_le16(descriptor_output_last);
- ctx->head_descriptor->transfer_status = cpu_to_le16(0x8011);
+ ctx->head_descriptor->control = cpu_to_le16(descriptor_output_last);
+ ctx->head_descriptor->transfer_status = cpu_to_le16(0x8011);
ctx->head_descriptor++;
return &ctx->base;
#define OHCI1394_PhyControl_Read(addr) (((addr) << 8) | 0x00008000)
#define OHCI1394_PhyControl_ReadDone 0x80000000
#define OHCI1394_PhyControl_ReadData(r) (((r) & 0x00ff0000) >> 16)
-#define OHCI1394_PhyControl_Write(addr, data) (((addr) << 8) | (data) | 0x00004000)
+#define OHCI1394_PhyControl_Write(addr, data) (((addr) << 8) | (data) | 0x00004000)
#define OHCI1394_PhyControl_WriteDone 0x00004000
#define OHCI1394_IsochronousCycleTimer 0x0F0
#define OHCI1394_AsReqFilterHiSet 0x100
#define OHCI1394_IsoRcvContextMatch(n) (0x410 + 32 * (n))
/* Interrupts Mask/Events */
-#define OHCI1394_reqTxComplete 0x00000001
-#define OHCI1394_respTxComplete 0x00000002
-#define OHCI1394_ARRQ 0x00000004
-#define OHCI1394_ARRS 0x00000008
-#define OHCI1394_RQPkt 0x00000010
-#define OHCI1394_RSPkt 0x00000020
-#define OHCI1394_isochTx 0x00000040
-#define OHCI1394_isochRx 0x00000080
-#define OHCI1394_postedWriteErr 0x00000100
-#define OHCI1394_lockRespErr 0x00000200
-#define OHCI1394_selfIDComplete 0x00010000
-#define OHCI1394_busReset 0x00020000
-#define OHCI1394_phy 0x00080000
-#define OHCI1394_cycleSynch 0x00100000
-#define OHCI1394_cycle64Seconds 0x00200000
-#define OHCI1394_cycleLost 0x00400000
-#define OHCI1394_cycleInconsistent 0x00800000
-#define OHCI1394_unrecoverableError 0x01000000
-#define OHCI1394_cycleTooLong 0x02000000
-#define OHCI1394_phyRegRcvd 0x04000000
-#define OHCI1394_masterIntEnable 0x80000000
+#define OHCI1394_reqTxComplete 0x00000001
+#define OHCI1394_respTxComplete 0x00000002
+#define OHCI1394_ARRQ 0x00000004
+#define OHCI1394_ARRS 0x00000008
+#define OHCI1394_RQPkt 0x00000010
+#define OHCI1394_RSPkt 0x00000020
+#define OHCI1394_isochTx 0x00000040
+#define OHCI1394_isochRx 0x00000080
+#define OHCI1394_postedWriteErr 0x00000100
+#define OHCI1394_lockRespErr 0x00000200
+#define OHCI1394_selfIDComplete 0x00010000
+#define OHCI1394_busReset 0x00020000
+#define OHCI1394_phy 0x00080000
+#define OHCI1394_cycleSynch 0x00100000
+#define OHCI1394_cycle64Seconds 0x00200000
+#define OHCI1394_cycleLost 0x00400000
+#define OHCI1394_cycleInconsistent 0x00800000
+#define OHCI1394_unrecoverableError 0x01000000
+#define OHCI1394_cycleTooLong 0x02000000
+#define OHCI1394_phyRegRcvd 0x04000000
+#define OHCI1394_masterIntEnable 0x80000000
#define OHCI1394_evt_no_status 0x0
#define OHCI1394_evt_long_packet 0x2
spin_unlock_irqrestore(&card->lock, flags);
}
-
EXPORT_SYMBOL(fw_core_handle_bus_reset);
struct fw_node {
u16 node_id;
- u8 color;
+ u8 color;
u8 port_count;
unsigned link_on : 1;
unsigned initiated_reset : 1;
atomic_t ref_count;
- /* For serializing node topology into a list. */
+ /* For serializing node topology into a list. */
struct list_head link;
/* Upper layer specific data. */
void *data;
- struct fw_port ports[0];
+ struct fw_port ports[0];
};
static inline struct fw_node *
fw_node(struct list_head *l)
{
- return list_entry (l, struct fw_node, link);
+ return list_entry (l, struct fw_node, link);
}
static inline struct fw_node *
{ 0xfffff0000000ULL, 0xfffff0000800ull };
const struct fw_address_region fw_unit_space_region =
{ 0xfffff0000900ull, 0x1000000000000ull };
-
EXPORT_SYMBOL(fw_low_memory_region);
EXPORT_SYMBOL(fw_high_memory_region);
EXPORT_SYMBOL(fw_private_region);
* parameters passed to the callback give the details of the
* particular request
*/
-
int
fw_core_add_address_handler(struct fw_address_handler *handler,
const struct fw_address_region *region)
return ret;
}
-
EXPORT_SYMBOL(fw_core_add_address_handler);
/**
* length are set to the start and the length respectively for the
* deallocated region, payload is set to NULL.
*/
-
void fw_core_remove_address_handler(struct fw_address_handler *handler)
{
unsigned long flags;
list_del(&handler->link);
spin_unlock_irqrestore(&address_handler_lock, flags);
}
-
EXPORT_SYMBOL(fw_core_remove_address_handler);
struct fw_request {
card->driver->send_response(card, &request->response);
}
-
EXPORT_SYMBOL(fw_send_response);
void
request->data, request->length,
handler->callback_data);
}
-
EXPORT_SYMBOL(fw_core_handle_request);
void
t->callback(card, rcode, data, data_length, t->callback_data);
}
-
EXPORT_SYMBOL(fw_core_handle_response);
MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
#define TCODE_READ_QUADLET_RESPONSE 6
#define TCODE_READ_BLOCK_RESPONSE 7
#define TCODE_CYCLE_START 8
-#define TCODE_LOCK_REQUEST 9
-#define TCODE_STREAM_DATA 10
-#define TCODE_LOCK_RESPONSE 11
+#define TCODE_LOCK_REQUEST 9
+#define TCODE_STREAM_DATA 10
+#define TCODE_LOCK_RESPONSE 11
#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0)
#define TCODE_IS_REQUEST(tcode) (((tcode) & 2) == 0)
#define SCODE_400 0x2
#define SCODE_BETA 0x3
-#define EXTCODE_MASK_SWAP 0x1
-#define EXTCODE_COMPARE_SWAP 0x2
-#define EXTCODE_FETCH_ADD 0x3
-#define EXTCODE_LITTLE_ADD 0x4
-#define EXTCODE_BOUNDED_ADD 0x5
-#define EXTCODE_WRAP_ADD 0x6
-
-#define ACK_COMPLETE 0x1
-#define ACK_PENDING 0x2
-#define ACK_BUSY_X 0x4
-#define ACK_BUSY_A 0x5
-#define ACK_BUSY_B 0x6
-#define ACK_DATA_ERROR 0xd
-#define ACK_TYPE_ERROR 0xe
-
-#define RCODE_COMPLETE 0x0
-#define RCODE_CONFLICT_ERROR 0x4
-#define RCODE_DATA_ERROR 0x5
-#define RCODE_TYPE_ERROR 0x6
-#define RCODE_ADDRESS_ERROR 0x7
+#define EXTCODE_MASK_SWAP 0x1
+#define EXTCODE_COMPARE_SWAP 0x2
+#define EXTCODE_FETCH_ADD 0x3
+#define EXTCODE_LITTLE_ADD 0x4
+#define EXTCODE_BOUNDED_ADD 0x5
+#define EXTCODE_WRAP_ADD 0x6
+
+#define ACK_COMPLETE 0x1
+#define ACK_PENDING 0x2
+#define ACK_BUSY_X 0x4
+#define ACK_BUSY_A 0x5
+#define ACK_BUSY_B 0x6
+#define ACK_DATA_ERROR 0xd
+#define ACK_TYPE_ERROR 0xe
+
+#define RCODE_COMPLETE 0x0
+#define RCODE_CONFLICT_ERROR 0x4
+#define RCODE_DATA_ERROR 0x5
+#define RCODE_TYPE_ERROR 0x6
+#define RCODE_ADDRESS_ERROR 0x7
/* Juju specific rcodes */
#define RCODE_SEND_ERROR 0x10
#define LOCAL_BUS 0xffc0
-#define SELFID_PORT_CHILD 0x3
-#define SELFID_PORT_PARENT 0x2
-#define SELFID_PORT_NCONN 0x1
-#define SELFID_PORT_NONE 0x0
+#define SELFID_PORT_CHILD 0x3
+#define SELFID_PORT_PARENT 0x2
+#define SELFID_PORT_NCONN 0x1
+#define SELFID_PORT_NONE 0x0
#define PHY_PACKET_CONFIG 0x0
#define PHY_PACKET_LINK_ON 0x1
void *callback_data);
struct fw_packet {
- int speed;
- int generation;
- u32 header[4];
- size_t header_length;
- void *payload;
- size_t payload_length;
- u32 timestamp;
-
- dma_addr_t payload_bus;
-
- /* 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.
- * The callback can be called from tasklet context and thus
- * must never block.
- */
- fw_packet_callback_t callback;
+ int speed;
+ int generation;
+ u32 header[4];
+ size_t header_length;
+ void *payload;
+ size_t payload_length;
+ u32 timestamp;
+
+ dma_addr_t payload_bus;
+
+ /* 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.
+ * The callback can be called from tasklet context and thus
+ * must never block.
+ */
+ fw_packet_callback_t callback;
int status;
- struct list_head link;
+ struct list_head link;
};
struct fw_transaction {
- int node_id; /* The generation is implied; it is always the current. */
- int tlabel;
- int timestamp;
- struct list_head link;
+ int node_id; /* The generation is implied; it is always the current. */
+ int tlabel;
+ int timestamp;
+ struct list_head link;
- struct fw_packet packet;
+ struct fw_packet packet;
/* The data passed to the callback is valid only during the
* callback. */
- fw_transaction_callback_t callback;
- void *callback_data;
+ fw_transaction_callback_t callback;
+ void *callback_data;
};
static inline struct fw_packet *
fw_packet(struct list_head *l)
{
- return list_entry (l, struct fw_packet, link);
+ return list_entry (l, struct fw_packet, link);
}
struct fw_address_handler {
- u64 offset;
- size_t length;
- fw_address_callback_t address_callback;
- void *callback_data;
- struct list_head link;
+ u64 offset;
+ size_t length;
+ fw_address_callback_t address_callback;
+ void *callback_data;
+ struct list_head link;
};
const struct fw_card_driver *driver;
struct device *device;
- int node_id;
- int generation;
- /* This is the generation used for timestamping incoming requests. */
- int request_generation;
- int current_tlabel, tlabel_mask;
- struct list_head transaction_list;
+ int node_id;
+ int generation;
+ /* This is the generation used for timestamping incoming requests. */
+ int request_generation;
+ int current_tlabel, tlabel_mask;
+ struct list_head transaction_list;
struct timer_list flush_timer;
- unsigned long long guid;
+ unsigned long long guid;
int max_receive;
int link_speed;
int config_rom_generation;
- /* We need to store up to 4 self ID for a maximum of 63 devices. */
- int self_id_count;
- u32 self_ids[252];
+ /* We need to store up to 4 self ID for a maximum of 63 devices. */
+ int self_id_count;
+ u32 self_ids[252];
spinlock_t lock; /* Take this lock when handling the lists in
* this struct. */
* scatter-gather streaming (e.g. assembling video frame automatically). */
struct fw_iso_packet {
- u16 payload_length; /* Length of indirect payload. */
+ 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];
+ u32 header[0];
};
#define FW_ISO_CONTEXT_TRANSMIT 0
int channel, int speed, int cycle);
struct fw_card_driver {
- const char *name;
+ const char *name;
- /* Enable the given card with the given initial config rom.
- * This function is expected to activate the card, and either
- * enable the PHY or set the link_on bit and initiate a bus
- * reset. */
- int (*enable) (struct fw_card *card, u32 *config_rom, size_t length);
+ /* Enable the given card with the given initial config rom.
+ * This function is expected to activate the card, and either
+ * enable the PHY or set the link_on bit and initiate a bus
+ * reset. */
+ int (*enable) (struct fw_card *card, u32 *config_rom, size_t length);
- int (*update_phy_reg) (struct fw_card *card, int address,
- int clear_bits, int set_bits);
+ int (*update_phy_reg) (struct fw_card *card, int address,
+ int clear_bits, int set_bits);
- /* Update the config rom for an enabled card. This function
- * should change the config rom that is presented on the bus
- * an initiate a bus reset. */
- int (*set_config_rom) (struct fw_card *card,
+ /* Update the config rom for an enabled card. This function
+ * should change the config rom that is presented on the bus
+ * an initiate a bus reset. */
+ int (*set_config_rom) (struct fw_card *card,
u32 *config_rom, size_t length);
- void (*send_request) (struct fw_card *card, struct fw_packet *packet);
- void (*send_response) (struct fw_card *card, struct fw_packet *packet);
+ void (*send_request) (struct fw_card *card, struct fw_packet *packet);
+ void (*send_response) (struct fw_card *card, struct fw_packet *packet);
/* Allow the specified node ID to do direct DMA out and in of
* host memory. The card will disable this for all node when
u32 length, u32 *payload);
void
fw_core_handle_response(struct fw_card *card,
- int speed, int ack, int timestamp,
- u32 length, u32 *payload);
+ int speed, int ack, int timestamp,
+ u32 length, u32 *payload);
#endif /* __fw_transaction_h */