Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
libata-transport.c File Reference
#include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <scsi/scsi_transport.h>
#include <linux/libata.h>
#include <linux/hdreg.h>
#include <linux/uaccess.h>
#include <linux/pm_runtime.h>
#include "libata.h"
#include "libata-transport.h"

Go to the source code of this file.

Data Structures

struct  ata_internal
 
struct  ata_show_ering_arg
 

Macros

#define ATA_PORT_ATTRS   2
 
#define ATA_LINK_ATTRS   3
 
#define ATA_DEV_ATTRS   9
 
#define to_ata_internal(tmpl)   container_of(tmpl, struct ata_internal, t)
 
#define tdev_to_device(d)   container_of((d), struct ata_device, tdev)
 
#define transport_class_to_dev(dev)   tdev_to_device((dev)->parent)
 
#define tdev_to_link(d)   container_of((d), struct ata_link, tdev)
 
#define transport_class_to_link(dev)   tdev_to_link((dev)->parent)
 
#define tdev_to_port(d)   container_of((d), struct ata_port, tdev)
 
#define transport_class_to_port(dev)   tdev_to_port((dev)->parent)
 
#define ATA_DEVICE_ATTR(_prefix, _name, _mode, _show, _store)
 
#define ata_bitfield_name_match(title, table)
 
#define ata_bitfield_name_search(title, table)
 
#define ata_port_show_simple(field, name, format_string, cast)
 
#define ata_port_simple_attr(field, name, format_string, type)
 
#define ata_link_show_linkspeed(field)
 
#define ata_link_linkspeed_attr(field)
 
#define ata_dev_show_class(title, field)
 
#define ata_dev_attr(title, field)
 
#define ata_dev_show_simple(field, format_string, cast)
 
#define ata_dev_simple_attr(field, format_string, type)
 
#define SETUP_TEMPLATE(attrb, field, perm, test)
 
#define SETUP_LINK_ATTRIBUTE(field)   SETUP_TEMPLATE(link_attrs, field, S_IRUGO, 1)
 
#define SETUP_PORT_ATTRIBUTE(field)   SETUP_TEMPLATE(port_attrs, field, S_IRUGO, 1)
 
#define SETUP_DEV_ATTRIBUTE(field)   SETUP_TEMPLATE(dev_attrs, field, S_IRUGO, 1)
 

Functions

 ata_bitfield_name_search (class, ata_class_names)
 
 ata_bitfield_name_match (err, ata_err_names)
 
 ata_bitfield_name_match (xfer, ata_xfer_names)
 
void ata_tport_delete (struct ata_port *ap)
 
int ata_tport_add (struct device *parent, struct ata_port *ap)
 
 ata_link_linkspeed_attr (hw_sata_spd_limit)
 
 ata_link_linkspeed_attr (sata_spd_limit)
 
 ata_link_linkspeed_attr (sata_spd)
 
void ata_tlink_delete (struct ata_link *link)
 
int ata_tlink_add (struct ata_link *link)
 
 ata_dev_attr (class, class)
 
 ata_dev_attr (xfer, pio_mode)
 
 ata_dev_attr (xfer, dma_mode)
 
 ata_dev_attr (xfer, xfer_mode)
 
 ata_dev_simple_attr (spdn_cnt,"%d\n", int)
 
struct scsi_transport_templateata_attach_transport (void)
 
void ata_release_transport (struct scsi_transport_template *t)
 
__init int libata_transport_init (void)
 
void __exit libata_transport_exit (void)
 

Variables

struct scsi_transport_templateata_scsi_transport_template
 
 ata_err_names []
 
 ata_xfer_names []
 

Macro Definition Documentation

#define ata_bitfield_name_match (   title,
  table 
)
Value:
static ssize_t \
get_ata_##title##_names(u32 table_key, char *buf) \
{ \
char *prefix = ""; \
ssize_t len = 0; \
int i; \
for (i = 0; i < ARRAY_SIZE(table); i++) { \
if (table[i].value & table_key) { \
len += sprintf(buf + len, "%s%s", \
prefix, table[i].name); \
prefix = ", "; \
} \
} \
len += sprintf(buf + len, "\n"); \
return len; \
}

Definition at line 96 of file libata-transport.c.

#define ata_bitfield_name_search (   title,
  table 
)
Value:
static ssize_t \
get_ata_##title##_names(u32 table_key, char *buf) \
{ \
ssize_t len = 0; \
int i; \
for (i = 0; i < ARRAY_SIZE(table); i++) { \
if (table[i].value == table_key) { \
len += sprintf(buf + len, "%s", \
table[i].name); \
break; \
} \
} \
len += sprintf(buf + len, "\n"); \
return len; \
}

Definition at line 115 of file libata-transport.c.

#define ata_dev_attr (   title,
  field 
)
Value:
static DEVICE_ATTR(field, S_IRUGO, show_ata_dev_##field, NULL)

Definition at line 460 of file libata-transport.c.

#define ATA_DEV_ATTRS   9

Definition at line 42 of file libata-transport.c.

#define ata_dev_show_class (   title,
  field 
)
Value:
static ssize_t \
show_ata_dev_##field(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
\
return get_ata_##title##_names(ata_dev->field, buf); \
}

Definition at line 450 of file libata-transport.c.

#define ata_dev_show_simple (   field,
  format_string,
  cast 
)
Value:
static ssize_t \
show_ata_dev_##field(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
\
return snprintf(buf, 20, format_string, cast ata_dev->field); \
}

Definition at line 470 of file libata-transport.c.

#define ata_dev_simple_attr (   field,
  format_string,
  type 
)
Value:
ata_dev_show_simple(field, format_string, (type)) \
show_ata_dev_##field, NULL)

Definition at line 480 of file libata-transport.c.

#define ATA_DEVICE_ATTR (   _prefix,
  _name,
  _mode,
  _show,
  _store 
)
Value:
struct device_attribute device_attr_##_prefix##_##_name = \
__ATTR(_name,_mode,_show,_store)

Definition at line 92 of file libata-transport.c.

#define ATA_LINK_ATTRS   3

Definition at line 41 of file libata-transport.c.

#define ata_link_linkspeed_attr (   field)
Value:

Definition at line 334 of file libata-transport.c.

#define ata_link_show_linkspeed (   field)
Value:
static ssize_t \
show_ata_link_##field(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
\
return sprintf(buf,"%s\n", sata_spd_string(fls(link->field))); \
}

Definition at line 324 of file libata-transport.c.

#define ATA_PORT_ATTRS   2

Definition at line 40 of file libata-transport.c.

#define ata_port_show_simple (   field,
  name,
  format_string,
  cast 
)
Value:
static ssize_t \
show_ata_port_##name(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
\
return snprintf(buf, 20, format_string, cast ap->field); \
}
#define ata_port_simple_attr (   field,
  name,
  format_string,
  type 
)
Value:
ata_port_show_simple(field, name, format_string, (type)) \
static DEVICE_ATTR(name, S_IRUGO, show_ata_port_##name, NULL)
#define SETUP_DEV_ATTRIBUTE (   field)    SETUP_TEMPLATE(dev_attrs, field, S_IRUGO, 1)

Definition at line 675 of file libata-transport.c.

#define SETUP_LINK_ATTRIBUTE (   field)    SETUP_TEMPLATE(link_attrs, field, S_IRUGO, 1)

Definition at line 669 of file libata-transport.c.

#define SETUP_PORT_ATTRIBUTE (   field)    SETUP_TEMPLATE(port_attrs, field, S_IRUGO, 1)

Definition at line 672 of file libata-transport.c.

#define SETUP_TEMPLATE (   attrb,
  field,
  perm,
  test 
)
Value:
i->private_##attrb[count] = dev_attr_##field; \
i->private_##attrb[count].attr.mode = perm; \
i->attrb[count] = &i->private_##attrb[count]; \
if (test) \
count++

Definition at line 662 of file libata-transport.c.

#define tdev_to_device (   d)    container_of((d), struct ata_device, tdev)

Definition at line 68 of file libata-transport.c.

#define tdev_to_link (   d)    container_of((d), struct ata_link, tdev)

Definition at line 73 of file libata-transport.c.

#define tdev_to_port (   d)    container_of((d), struct ata_port, tdev)

Definition at line 78 of file libata-transport.c.

#define to_ata_internal (   tmpl)    container_of(tmpl, struct ata_internal, t)

Definition at line 65 of file libata-transport.c.

#define transport_class_to_dev (   dev)    tdev_to_device((dev)->parent)

Definition at line 70 of file libata-transport.c.

#define transport_class_to_link (   dev)    tdev_to_link((dev)->parent)

Definition at line 75 of file libata-transport.c.

#define transport_class_to_port (   dev)    tdev_to_port((dev)->parent)

Definition at line 80 of file libata-transport.c.

Function Documentation

struct scsi_transport_template* ata_attach_transport ( void  )
read

ata_attach_transport – instantiate ATA transport template

Definition at line 681 of file libata-transport.c.

ata_bitfield_name_match ( err  ,
ata_err_names   
)

Definition at line 167 of file libata-transport.c.

ata_bitfield_name_match ( xfer  ,
ata_xfer_names   
)

Definition at line 198 of file libata-transport.c.

ata_bitfield_name_search ( class  ,
ata_class_names   
)

Definition at line 148 of file libata-transport.c.

ata_dev_attr ( class  ,
class   
)
ata_dev_attr ( xfer  ,
pio_mode   
)
ata_dev_attr ( xfer  ,
dma_mode   
)
ata_dev_attr ( xfer  ,
xfer_mode   
)
ata_dev_simple_attr ( spdn_cnt  ,
"%d\n"  ,
int   
)
ata_link_linkspeed_attr ( hw_sata_spd_limit  )
ata_link_linkspeed_attr ( sata_spd_limit  )
ata_link_linkspeed_attr ( sata_spd  )
void ata_release_transport ( struct scsi_transport_template t)

ata_release_transport – release ATA transport template instance : transport template instance

Definition at line 741 of file libata-transport.c.

int ata_tlink_add ( struct ata_link link)

ata_tlink_add – initialize a transport ATA link structure allocated ata_link structure.

Initialize an ATA LINK structure for sysfs. It will be added in the device tree below the ATA PORT it belongs to.

Returns %0 on success

Definition at line 402 of file libata-transport.c.

void ata_tlink_delete ( struct ata_link link)

ata_tlink_delete – remove ATA LINK : ATA LINK to remove

Removes the specified ATA LINK. remove associated ATA device(s) as well.

Definition at line 378 of file libata-transport.c.

int ata_tport_add ( struct device parent,
struct ata_port ap 
)

ata_tport_add - initialize a transport ATA port structure

: parent device : existing ata_port structure

Initialize a ATA port structure for sysfs. It will be added to the device tree below the device specified by which could be a PCI device.

Returns %0 on success

Definition at line 276 of file libata-transport.c.

void ata_tport_delete ( struct ata_port ap)

ata_tport_delete – remove ATA PORT : ATA PORT to remove

Removes the specified ATA PORT. Remove the associated link as well.

Definition at line 254 of file libata-transport.c.

void __exit libata_transport_exit ( void  )

Definition at line 776 of file libata-transport.c.

__init int libata_transport_init ( void  )

Definition at line 752 of file libata-transport.c.

Variable Documentation

ata_err_names[]
Initial value:
= {
{ AC_ERR_DEV, "DeviceError" },
{ AC_ERR_HSM, "HostStateMachineError" },
{ AC_ERR_TIMEOUT, "Timeout" },
{ AC_ERR_MEDIA, "MediaError" },
{ AC_ERR_ATA_BUS, "BusError" },
{ AC_ERR_HOST_BUS, "HostBusError" },
{ AC_ERR_SYSTEM, "SystemError" },
{ AC_ERR_INVALID, "InvalidArg" },
{ AC_ERR_OTHER, "Unknown" },
{ AC_ERR_NODEV_HINT, "NoDeviceHint" },
{ AC_ERR_NCQ, "NCQError" }
}

Definition at line 154 of file libata-transport.c.

struct scsi_transport_template* ata_scsi_transport_template

Definition at line 45 of file libata-transport.c.

ata_xfer_names[]
Initial value:
= {
{ XFER_UDMA_7, "XFER_UDMA_7" },
{ XFER_UDMA_6, "XFER_UDMA_6" },
{ XFER_UDMA_5, "XFER_UDMA_5" },
{ XFER_UDMA_4, "XFER_UDMA_4" },
{ XFER_UDMA_3, "XFER_UDMA_3" },
{ XFER_UDMA_2, "XFER_UDMA_2" },
{ XFER_UDMA_1, "XFER_UDMA_1" },
{ XFER_UDMA_0, "XFER_UDMA_0" },
{ XFER_MW_DMA_4, "XFER_MW_DMA_4" },
{ XFER_MW_DMA_3, "XFER_MW_DMA_3" },
{ XFER_MW_DMA_2, "XFER_MW_DMA_2" },
{ XFER_MW_DMA_1, "XFER_MW_DMA_1" },
{ XFER_MW_DMA_0, "XFER_MW_DMA_0" },
{ XFER_SW_DMA_2, "XFER_SW_DMA_2" },
{ XFER_SW_DMA_1, "XFER_SW_DMA_1" },
{ XFER_SW_DMA_0, "XFER_SW_DMA_0" },
{ XFER_PIO_6, "XFER_PIO_6" },
{ XFER_PIO_5, "XFER_PIO_5" },
{ XFER_PIO_4, "XFER_PIO_4" },
{ XFER_PIO_3, "XFER_PIO_3" },
{ XFER_PIO_2, "XFER_PIO_2" },
{ XFER_PIO_1, "XFER_PIO_1" },
{ XFER_PIO_0, "XFER_PIO_0" },
{ XFER_PIO_SLOW, "XFER_PIO_SLOW" }
}

Definition at line 172 of file libata-transport.c.

char* name

Definition at line 135 of file libata-transport.c.

value

snd_pcm_hw_param_value - return field : the hw_params instance

Definition at line 134 of file libata-transport.c.