libsas.h

来自「linux 内核源代码」· C头文件 代码 · 共 680 行 · 第 1/2 页

H
680
字号
/* * SAS host prototypes and structures header file * * Copyright (C) 2005 Adaptec, Inc.  All rights reserved. * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com> * * This file is licensed under GPLv2. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */#ifndef _LIBSAS_H_#define _LIBSAS_H_#include <linux/timer.h>#include <linux/pci.h>#include <scsi/sas.h>#include <linux/libata.h>#include <linux/list.h>#include <asm/semaphore.h>#include <scsi/scsi_device.h>#include <scsi/scsi_cmnd.h>#include <scsi/scsi_transport_sas.h>#include <linux/scatterlist.h>struct block_device;enum sas_class {	SAS,	EXPANDER};enum sas_phy_role {	PHY_ROLE_NONE = 0,	PHY_ROLE_TARGET = 0x40,	PHY_ROLE_INITIATOR = 0x80,};enum sas_phy_type {        PHY_TYPE_PHYSICAL,        PHY_TYPE_VIRTUAL};/* The events are mnemonically described in sas_dump.c * so when updating/adding events here, please also * update the other file too. */enum ha_event {	HAE_RESET             = 0U,	HA_NUM_EVENTS         = 1,};enum port_event {	PORTE_BYTES_DMAED     = 0U,	PORTE_BROADCAST_RCVD  = 1,	PORTE_LINK_RESET_ERR  = 2,	PORTE_TIMER_EVENT     = 3,	PORTE_HARD_RESET      = 4,	PORT_NUM_EVENTS       = 5,};enum phy_event {	PHYE_LOSS_OF_SIGNAL   = 0U,	PHYE_OOB_DONE         = 1,	PHYE_OOB_ERROR        = 2,	PHYE_SPINUP_HOLD      = 3, /* hot plug SATA, no COMWAKE sent */	PHY_NUM_EVENTS        = 4,};enum discover_event {	DISCE_DISCOVER_DOMAIN   = 0U,	DISCE_REVALIDATE_DOMAIN = 1,	DISCE_PORT_GONE         = 2,	DISC_NUM_EVENTS 	= 3,};/* ---------- Expander Devices ---------- */#define ETASK 0xFA#define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj)#define to_dev_attr(_attr)  container_of(_attr, struct domain_dev_attribute,\                                         attr)enum routing_attribute {	DIRECT_ROUTING,	SUBTRACTIVE_ROUTING,	TABLE_ROUTING,};enum ex_phy_state {	PHY_EMPTY,	PHY_VACANT,	PHY_NOT_PRESENT,	PHY_DEVICE_DISCOVERED};struct ex_phy {	int    phy_id;	enum ex_phy_state phy_state;	enum sas_dev_type attached_dev_type;	enum sas_linkrate linkrate;	u8   attached_sata_host:1;	u8   attached_sata_dev:1;	u8   attached_sata_ps:1;	enum sas_proto attached_tproto;	enum sas_proto attached_iproto;	u8   attached_sas_addr[SAS_ADDR_SIZE];	u8   attached_phy_id;	u8   phy_change_count;	enum routing_attribute routing_attr;	u8   virtual:1;	int  last_da_index;	struct sas_phy *phy;	struct sas_port *port;};struct expander_device {	struct list_head children;	u16    ex_change_count;	u16    max_route_indexes;	u8     num_phys;	u8     configuring:1;	u8     conf_route_table:1;	u8     enclosure_logical_id[8];	struct ex_phy *ex_phy;	struct sas_port *parent_port;};/* ---------- SATA device ---------- */enum ata_command_set {        ATA_COMMAND_SET   = 0,        ATAPI_COMMAND_SET = 1,};struct sata_device {        enum   ata_command_set command_set;        struct smp_resp        rps_resp; /* report_phy_sata_resp */        __le16 *identify_device;        __le16 *identify_packet_device;        u8     port_no;        /* port number, if this is a PM (Port) */        struct list_head children; /* PM Ports if this is a PM */	struct ata_port *ap;	struct ata_host ata_host;	struct ata_taskfile tf;	u32 sstatus;	u32 serror;	u32 scontrol;};/* ---------- Domain device ---------- */struct domain_device {        enum sas_dev_type dev_type;        enum sas_linkrate linkrate;        enum sas_linkrate min_linkrate;        enum sas_linkrate max_linkrate;        int  pathways;        struct domain_device *parent;        struct list_head siblings; /* devices on the same level */        struct asd_sas_port *port;        /* shortcut to root of the tree */        struct list_head dev_list_node;        enum sas_proto    iproto;        enum sas_proto    tproto;        struct sas_rphy *rphy;        u8  sas_addr[SAS_ADDR_SIZE];        u8  hashed_sas_addr[HASHED_SAS_ADDR_SIZE];        u8  frame_rcvd[32];        union {                struct expander_device ex_dev;                struct sata_device     sata_dev; /* STP & directly attached */        };        void *lldd_dev;};struct sas_discovery_event {	struct work_struct work;	struct asd_sas_port *port;};struct sas_discovery {	spinlock_t disc_event_lock;	struct sas_discovery_event disc_work[DISC_NUM_EVENTS];	unsigned long    pending;	u8     fanout_sas_addr[8];	u8     eeds_a[8];	u8     eeds_b[8];	int    max_level;};/* The port struct is Class:RW, driver:RO */struct asd_sas_port {/* private: */	struct completion port_gone_completion;	struct sas_discovery disc;	struct domain_device *port_dev;	spinlock_t dev_list_lock;	struct list_head dev_list;	enum   sas_linkrate linkrate;	struct sas_phy *phy;	struct work_struct work;/* public: */	int id;	enum sas_class   class;	u8               sas_addr[SAS_ADDR_SIZE];	u8               attached_sas_addr[SAS_ADDR_SIZE];	enum sas_proto   iproto;	enum sas_proto   tproto;	enum sas_oob_mode oob_mode;	spinlock_t       phy_list_lock;	struct list_head phy_list;	int              num_phys;	u32              phy_mask;	struct sas_ha_struct *ha;	struct sas_port	*port;	void *lldd_port;	  /* not touched by the sas class code */};struct asd_sas_event {	struct work_struct work;	struct asd_sas_phy *phy;};/* The phy pretty much is controlled by the LLDD. * The class only reads those fields. */struct asd_sas_phy {/* private: */	/* protected by ha->event_lock */	struct asd_sas_event   port_events[PORT_NUM_EVENTS];	struct asd_sas_event   phy_events[PHY_NUM_EVENTS];	unsigned long port_events_pending;	unsigned long phy_events_pending;	int error;	struct sas_phy *phy;/* public: */	/* The following are class:RO, driver:R/W */	int            enabled;	  /* must be set */	int            id;	  /* must be set */	enum sas_class class;	enum sas_proto iproto;	enum sas_proto tproto;	enum sas_phy_type  type;	enum sas_phy_role  role;	enum sas_oob_mode  oob_mode;	enum sas_linkrate linkrate;	u8   *sas_addr;		  /* must be set */	u8   attached_sas_addr[SAS_ADDR_SIZE]; /* class:RO, driver: R/W */	spinlock_t     frame_rcvd_lock;	u8             *frame_rcvd; /* must be set */	int            frame_rcvd_size;	spinlock_t     sas_prim_lock;	u32            sas_prim;	struct list_head port_phy_el; /* driver:RO */	struct asd_sas_port      *port; /* Class:RW, driver: RO */	struct sas_ha_struct *ha; /* may be set; the class sets it anyway */	void *lldd_phy;		  /* not touched by the sas_class_code */};struct scsi_core {	struct Scsi_Host *shost;	spinlock_t        task_queue_lock;	struct list_head  task_queue;	int               task_queue_size;	struct task_struct *queue_thread;};struct sas_ha_event {	struct work_struct work;	struct sas_ha_struct *ha;};enum sas_ha_state {	SAS_HA_REGISTERED,	SAS_HA_UNREGISTERED};struct sas_ha_struct {/* private: */	spinlock_t       event_lock;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?