Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
ohci.c File Reference
#include <linux/bitops.h>
#include <linux/bug.h>
#include <linux/compiler.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/pci_ids.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <asm/byteorder.h>
#include <asm/page.h>
#include "core.h"
#include "ohci.h"

Go to the source code of this file.

Data Structures

struct  descriptor
 
struct  ar_context
 
struct  descriptor_buffer
 
struct  context
 
struct  iso_context
 
struct  fw_ohci
 
struct  driver_data
 

Macros

#define DESCRIPTOR_OUTPUT_MORE   0
 
#define DESCRIPTOR_OUTPUT_LAST   (1 << 12)
 
#define DESCRIPTOR_INPUT_MORE   (2 << 12)
 
#define DESCRIPTOR_INPUT_LAST   (3 << 12)
 
#define DESCRIPTOR_STATUS   (1 << 11)
 
#define DESCRIPTOR_KEY_IMMEDIATE   (2 << 8)
 
#define DESCRIPTOR_PING   (1 << 7)
 
#define DESCRIPTOR_YY   (1 << 6)
 
#define DESCRIPTOR_NO_IRQ   (0 << 4)
 
#define DESCRIPTOR_IRQ_ERROR   (1 << 4)
 
#define DESCRIPTOR_IRQ_ALWAYS   (3 << 4)
 
#define DESCRIPTOR_BRANCH_ALWAYS   (3 << 2)
 
#define DESCRIPTOR_WAIT   (3 << 0)
 
#define CONTROL_SET(regs)   (regs)
 
#define CONTROL_CLEAR(regs)   ((regs) + 4)
 
#define COMMAND_PTR(regs)   ((regs) + 12)
 
#define CONTEXT_MATCH(regs)   ((regs) + 16)
 
#define AR_BUFFER_SIZE   (32*1024)
 
#define AR_BUFFERS_MIN   DIV_ROUND_UP(AR_BUFFER_SIZE, PAGE_SIZE)
 
#define AR_BUFFERS   (AR_BUFFERS_MIN >= 2 ? AR_BUFFERS_MIN : 2)
 
#define MAX_ASYNC_PAYLOAD   4096
 
#define MAX_AR_PACKET_SIZE   (16 + MAX_ASYNC_PAYLOAD + 4)
 
#define AR_WRAPAROUND_PAGES   DIV_ROUND_UP(MAX_AR_PACKET_SIZE, PAGE_SIZE)
 
#define IT_HEADER_SY(v)   ((v) << 0)
 
#define IT_HEADER_TCODE(v)   ((v) << 4)
 
#define IT_HEADER_CHANNEL(v)   ((v) << 8)
 
#define IT_HEADER_TAG(v)   ((v) << 14)
 
#define IT_HEADER_SPEED(v)   ((v) << 16)
 
#define IT_HEADER_DATA_LENGTH(v)   ((v) << 16)
 
#define CONFIG_ROM_SIZE   1024
 
#define IT_CONTEXT_CYCLE_MATCH_ENABLE   0x80000000
 
#define IR_CONTEXT_BUFFER_FILL   0x80000000
 
#define IR_CONTEXT_ISOCH_HEADER   0x40000000
 
#define IR_CONTEXT_CYCLE_MATCH_ENABLE   0x20000000
 
#define IR_CONTEXT_MULTI_CHANNEL_MODE   0x10000000
 
#define IR_CONTEXT_DUAL_BUFFER_MODE   0x08000000
 
#define CONTEXT_RUN   0x8000
 
#define CONTEXT_WAKE   0x1000
 
#define CONTEXT_DEAD   0x0800
 
#define CONTEXT_ACTIVE   0x0400
 
#define OHCI1394_MAX_AT_REQ_RETRIES   0xf
 
#define OHCI1394_MAX_AT_RESP_RETRIES   0x2
 
#define OHCI1394_MAX_PHYS_RESP_RETRIES   0x8
 
#define OHCI1394_REGISTER_SIZE   0x800
 
#define OHCI1394_PCI_HCI_Control   0x40
 
#define SELF_ID_BUF_SIZE   0x800
 
#define OHCI_TCODE_PHY_PACKET   0x0e
 
#define OHCI_VERSION_1_1   0x010010
 
#define PCI_DEVICE_ID_AGERE_FW643   0x5901
 
#define PCI_DEVICE_ID_CREATIVE_SB1394   0x4001
 
#define PCI_DEVICE_ID_JMICRON_JMB38X_FW   0x2380
 
#define PCI_DEVICE_ID_TI_TSB12LV22   0x8009
 
#define PCI_DEVICE_ID_TI_TSB12LV26   0x8020
 
#define PCI_DEVICE_ID_TI_TSB82AA2   0x8025
 
#define PCI_VENDOR_ID_PINNACLE_SYSTEMS   0x11bd
 
#define QUIRK_CYCLE_TIMER   1
 
#define QUIRK_RESET_PACKET   2
 
#define QUIRK_BE_HEADERS   4
 
#define QUIRK_NO_1394A   8
 
#define QUIRK_NO_MSI   16
 
#define QUIRK_TI_SLLZ059   32
 
#define OHCI_PARAM_DEBUG_AT_AR   1
 
#define OHCI_PARAM_DEBUG_SELFIDS   2
 
#define OHCI_PARAM_DEBUG_IRQS   4
 
#define OHCI_PARAM_DEBUG_BUSRESETS   8 /* only effective before chip init */
 
#define cond_le32_to_cpu(v)   le32_to_cpu(v)
 
#define HEADER_GET_DESTINATION(q)   (((q) >> 16) & 0xffff)
 
#define HEADER_GET_TCODE(q)   (((q) >> 4) & 0x0f)
 
#define HEADER_GET_OFFSET_HIGH(q)   (((q) >> 0) & 0xffff)
 
#define HEADER_GET_DATA_LENGTH(q)   (((q) >> 16) & 0xffff)
 
#define HEADER_GET_EXTENDED_TCODE(q)   (((q) >> 0) & 0xffff)
 

Typedefs

typedef int(* descriptor_callback_t )(struct context *ctx, struct descriptor *d, struct descriptor *last)
 

Functions

struct descriptor __attribute__ ((aligned(16)))
 
 module_param_named (quirks, param_quirks, int, 0644)
 
 MODULE_PARM_DESC (quirks,"Chip quirks (default = 0"", nonatomic cycle timer = "__stringify(QUIRK_CYCLE_TIMER)", reset packet generation = "__stringify(QUIRK_RESET_PACKET)", AR/selfID endianess = "__stringify(QUIRK_BE_HEADERS)", no 1394a enhancements = "__stringify(QUIRK_NO_1394A)", disable MSI = "__stringify(QUIRK_NO_MSI)", TI SLLZ059 erratum = "__stringify(QUIRK_TI_SLLZ059)")")
 
 module_param_named (debug, param_debug, int, 0644)
 
 MODULE_PARM_DESC (debug,"Verbose logging (default = 0"", AT/AR events = "__stringify(OHCI_PARAM_DEBUG_AT_AR)", self-IDs = "__stringify(OHCI_PARAM_DEBUG_SELFIDS)", IRQs = "__stringify(OHCI_PARAM_DEBUG_IRQS)", busReset events = "__stringify(OHCI_PARAM_DEBUG_BUSRESETS)", or a combination, or all = -1)")
 
 MODULE_DEVICE_TABLE (pci, pci_table)
 
 module_pci_driver (fw_ohci_pci_driver)
 
 MODULE_AUTHOR ("Kristian Hoegsberg <[email protected]>")
 
 MODULE_DESCRIPTION ("Driver for PCI OHCI IEEE1394 controllers")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("ohci1394")
 

Variables

__le16 req_count
 
__le16 control
 
__le32 data_address
 
__le32 branch_address
 
__le16 res_count
 
__le16 transfer_status
 
struct ar_context __attribute__
 
: pointer to a string for the name of this class.

class_create - create a struct class structure : pointer to the module that is to "own" this struct class

: the lock_class_key for this class; used by mutex lock debugging

This is used to create a struct class pointer that can then be used in calls to device_create().

Returns &struct class pointer on success, or ERR_PTR() on error.

Note, the pointer created here is to be destroyed when finished by making a call to class_destroy().

Macro Definition Documentation

#define AR_BUFFER_SIZE   (32*1024)

Definition at line 85 of file ohci.c.

#define AR_BUFFERS   (AR_BUFFERS_MIN >= 2 ? AR_BUFFERS_MIN : 2)

Definition at line 88 of file ohci.c.

#define AR_BUFFERS_MIN   DIV_ROUND_UP(AR_BUFFER_SIZE, PAGE_SIZE)

Definition at line 86 of file ohci.c.

#define AR_WRAPAROUND_PAGES   DIV_ROUND_UP(MAX_AR_PACKET_SIZE, PAGE_SIZE)

Definition at line 92 of file ohci.c.

#define COMMAND_PTR (   regs)    ((regs) + 12)

Definition at line 82 of file ohci.c.

#define cond_le32_to_cpu (   v)    le32_to_cpu(v)

Definition at line 798 of file ohci.c.

#define CONFIG_ROM_SIZE   1024

Definition at line 182 of file ohci.c.

#define CONTEXT_ACTIVE   0x0400

Definition at line 253 of file ohci.c.

#define CONTEXT_DEAD   0x0800

Definition at line 252 of file ohci.c.

#define CONTEXT_MATCH (   regs)    ((regs) + 16)

Definition at line 83 of file ohci.c.

#define CONTEXT_RUN   0x8000

Definition at line 250 of file ohci.c.

#define CONTEXT_WAKE   0x1000

Definition at line 251 of file ohci.c.

#define CONTROL_CLEAR (   regs)    ((regs) + 4)

Definition at line 81 of file ohci.c.

#define CONTROL_SET (   regs)    (regs)

Definition at line 80 of file ohci.c.

#define DESCRIPTOR_BRANCH_ALWAYS   (3 << 2)

Definition at line 68 of file ohci.c.

#define DESCRIPTOR_INPUT_LAST   (3 << 12)

Definition at line 60 of file ohci.c.

#define DESCRIPTOR_INPUT_MORE   (2 << 12)

Definition at line 59 of file ohci.c.

#define DESCRIPTOR_IRQ_ALWAYS   (3 << 4)

Definition at line 67 of file ohci.c.

#define DESCRIPTOR_IRQ_ERROR   (1 << 4)

Definition at line 66 of file ohci.c.

#define DESCRIPTOR_KEY_IMMEDIATE   (2 << 8)

Definition at line 62 of file ohci.c.

#define DESCRIPTOR_NO_IRQ   (0 << 4)

Definition at line 65 of file ohci.c.

#define DESCRIPTOR_OUTPUT_LAST   (1 << 12)

Definition at line 58 of file ohci.c.

#define DESCRIPTOR_OUTPUT_MORE   0

Definition at line 57 of file ohci.c.

#define DESCRIPTOR_PING   (1 << 7)

Definition at line 63 of file ohci.c.

#define DESCRIPTOR_STATUS   (1 << 11)

Definition at line 61 of file ohci.c.

#define DESCRIPTOR_WAIT   (3 << 0)

Definition at line 69 of file ohci.c.

#define DESCRIPTOR_YY   (1 << 6)

Definition at line 64 of file ohci.c.

#define HEADER_GET_DATA_LENGTH (   q)    (((q) >> 16) & 0xffff)

Definition at line 1489 of file ohci.c.

#define HEADER_GET_DESTINATION (   q)    (((q) >> 16) & 0xffff)

Definition at line 1486 of file ohci.c.

#define HEADER_GET_EXTENDED_TCODE (   q)    (((q) >> 0) & 0xffff)

Definition at line 1490 of file ohci.c.

#define HEADER_GET_OFFSET_HIGH (   q)    (((q) >> 0) & 0xffff)

Definition at line 1488 of file ohci.c.

#define HEADER_GET_TCODE (   q)    (((q) >> 4) & 0x0f)

Definition at line 1487 of file ohci.c.

#define IR_CONTEXT_BUFFER_FILL   0x80000000

Definition at line 244 of file ohci.c.

#define IR_CONTEXT_CYCLE_MATCH_ENABLE   0x20000000

Definition at line 246 of file ohci.c.

#define IR_CONTEXT_DUAL_BUFFER_MODE   0x08000000

Definition at line 248 of file ohci.c.

#define IR_CONTEXT_ISOCH_HEADER   0x40000000

Definition at line 245 of file ohci.c.

#define IR_CONTEXT_MULTI_CHANNEL_MODE   0x10000000

Definition at line 247 of file ohci.c.

#define IT_CONTEXT_CYCLE_MATCH_ENABLE   0x80000000

Definition at line 243 of file ohci.c.

#define IT_HEADER_CHANNEL (   v)    ((v) << 8)

Definition at line 164 of file ohci.c.

#define IT_HEADER_DATA_LENGTH (   v)    ((v) << 16)

Definition at line 167 of file ohci.c.

#define IT_HEADER_SPEED (   v)    ((v) << 16)

Definition at line 166 of file ohci.c.

#define IT_HEADER_SY (   v)    ((v) << 0)

Definition at line 162 of file ohci.c.

#define IT_HEADER_TAG (   v)    ((v) << 14)

Definition at line 165 of file ohci.c.

#define IT_HEADER_TCODE (   v)    ((v) << 4)

Definition at line 163 of file ohci.c.

#define MAX_AR_PACKET_SIZE   (16 + MAX_ASYNC_PAYLOAD + 4)

Definition at line 91 of file ohci.c.

#define MAX_ASYNC_PAYLOAD   4096

Definition at line 90 of file ohci.c.

#define OHCI1394_MAX_AT_REQ_RETRIES   0xf

Definition at line 255 of file ohci.c.

#define OHCI1394_MAX_AT_RESP_RETRIES   0x2

Definition at line 256 of file ohci.c.

#define OHCI1394_MAX_PHYS_RESP_RETRIES   0x8

Definition at line 257 of file ohci.c.

#define OHCI1394_PCI_HCI_Control   0x40

Definition at line 260 of file ohci.c.

#define OHCI1394_REGISTER_SIZE   0x800

Definition at line 259 of file ohci.c.

#define OHCI_PARAM_DEBUG_AT_AR   1

Definition at line 338 of file ohci.c.

#define OHCI_PARAM_DEBUG_BUSRESETS   8 /* only effective before chip init */

Definition at line 341 of file ohci.c.

#define OHCI_PARAM_DEBUG_IRQS   4

Definition at line 340 of file ohci.c.

#define OHCI_PARAM_DEBUG_SELFIDS   2

Definition at line 339 of file ohci.c.

#define OHCI_TCODE_PHY_PACKET   0x0e

Definition at line 262 of file ohci.c.

#define OHCI_VERSION_1_1   0x010010

Definition at line 263 of file ohci.c.

#define PCI_DEVICE_ID_AGERE_FW643   0x5901

Definition at line 267 of file ohci.c.

#define PCI_DEVICE_ID_CREATIVE_SB1394   0x4001

Definition at line 268 of file ohci.c.

#define PCI_DEVICE_ID_JMICRON_JMB38X_FW   0x2380

Definition at line 269 of file ohci.c.

#define PCI_DEVICE_ID_TI_TSB12LV22   0x8009

Definition at line 270 of file ohci.c.

#define PCI_DEVICE_ID_TI_TSB12LV26   0x8020

Definition at line 271 of file ohci.c.

#define PCI_DEVICE_ID_TI_TSB82AA2   0x8025

Definition at line 272 of file ohci.c.

#define PCI_VENDOR_ID_PINNACLE_SYSTEMS   0x11bd

Definition at line 273 of file ohci.c.

#define QUIRK_BE_HEADERS   4

Definition at line 277 of file ohci.c.

#define QUIRK_CYCLE_TIMER   1

Definition at line 275 of file ohci.c.

#define QUIRK_NO_1394A   8

Definition at line 278 of file ohci.c.

#define QUIRK_NO_MSI   16

Definition at line 279 of file ohci.c.

#define QUIRK_RESET_PACKET   2

Definition at line 276 of file ohci.c.

#define QUIRK_TI_SLLZ059   32

Definition at line 280 of file ohci.c.

#define SELF_ID_BUF_SIZE   0x800

Definition at line 261 of file ohci.c.

Typedef Documentation

typedef int(* descriptor_callback_t)(struct context *ctx, struct descriptor *d, struct descriptor *last)

Definition at line 108 of file ohci.c.

Function Documentation

MODULE_ALIAS ( "ohci1394"  )
MODULE_AUTHOR ( "Kristian Hoegsberg <[email protected]>"  )
MODULE_DESCRIPTION ( "Driver for PCI OHCI IEEE1394 controllers"  )
MODULE_DEVICE_TABLE ( pci  ,
pci_table   
)
MODULE_LICENSE ( "GPL"  )
module_param_named ( quirks  ,
param_quirks  ,
int  ,
0644   
)
module_param_named ( debug  ,
param_debug  ,
int  ,
0644   
)
MODULE_PARM_DESC ( quirks  ,
"Chip quirks (default = 0"", nonatomic cycle timer = "__stringify(QUIRK_CYCLE_TIMER)", reset packet generation = "__stringify(QUIRK_RESET_PACKET)", AR/selfID endianess = "__stringify(QUIRK_BE_HEADERS)", no 1394a enhancements = "__stringify(QUIRK_NO_1394A)", disable MSI = "__stringify(QUIRK_NO_MSI)", TI SLLZ059 erratum = "__stringify(QUIRK_TI_SLLZ059)")"   
)
MODULE_PARM_DESC ( debug  ,
"Verbose logging (default = 0"", AT/AR events = "__stringify(OHCI_PARAM_DEBUG_AT_AR)", self-IDs = "__stringify(OHCI_PARAM_DEBUG_SELFIDS)", IRQs = "__stringify(OHCI_PARAM_DEBUG_IRQS)", busReset events = "__stringify(OHCI_PARAM_DEBUG_BUSRESETS)", or a combination, or all = -1)"   
)
module_pci_driver ( fw_ohci_pci_driver  )

Variable Documentation

__le32 branch_address

Definition at line 82 of file ohci.c.

__le16 control

Definition at line 80 of file ohci.c.

unsigned int data_address

Definition at line 81 of file ohci.c.

for_each_padev - Iterate over all devices in the tree

: Data to pass to the called function.

This performs a depth-first traversal of the tree, calling the function passed for each node. It calls the function for parents before children.

attribute_container_add_device - see if any container is interested in dev

: device to add attributes to

This function allocates storage for the class device(s) to be attached to dev (one for each matching attribute_container). If no fn is provided, the code will simply register the class device via device_add. If a function is provided, it is expected to add the class device at the appropriate time. One of the things that might be necessary is to allocate and initialise the classdev and then add it a later time. To do this, call this routine for allocation and initialisation and then use attribute_container_device_trigger() to call device_add() on it. Note: after this, the class device contains a reference to dev which is not relinquished until the release of the classdev.

attribute_container_remove_device - make device eligible for removal.

: The generic device

This routine triggers device removal. If fn is NULL, then it is simply done via device_unregister (note that if something still has a reference to the classdev, then the memory occupied will not be freed until the classdev is released). If you want a two phase release: remove from visibility and then delete the device, then you should use this routine with a fn that calls device_del() and then use attribute_container_device_trigger() to do the final put on the classdev.

bus_for_each_dev - device iterator. : bus type. : device to start iterating from. : data for the callback.

Iterate over 's list of devices, and call

Iterate over

device_for_each_child - device child iterator. : parent struct device. : data for the callback.

Iterate over 's child devices, and call

driver_for_each_device - Iterator for devices bound to a driver. : Driver we're iterating. : Device to begin with : Data to pass to the callback.

Iterate over the 's list of devices calling

dpm_for_each_dev - device iterator. : data for the callback.

Iterate over devices in dpm_list, and call

passing it .

starget_for_each_device - helper to walk all devices of a target : target whose devices we want to iterate over. : Opaque passed to each function call.

This traverses over each device of . The devices have a reference that must be released by scsi_host_put when breaking out of the loop.

This traverses over each device of . It does not take a reference on the scsi_device, so the whole loop must be protected by shost->host_lock.

Note: The only reason why drivers would want to use this is because they need to access the device list in irq context. Otherwise you really want to use starget_for_each_device instead.

Definition at line 284 of file ohci.c.

unsigned short flags

Definition at line 284 of file ohci.c.

__le16 req_count

Definition at line 79 of file ohci.c.

__le16 res_count

Definition at line 83 of file ohci.c.

unsigned short revision

Definition at line 284 of file ohci.c.

__le16 transfer_status

Definition at line 84 of file ohci.c.

unsigned short vendor

Definition at line 284 of file ohci.c.