2 * Aic94xx SAS/SATA driver header file.
4 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
5 * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
7 * This file is licensed under GPLv2.
9 * This file is part of the aic94xx driver.
11 * The aic94xx driver is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; version 2 of the
16 * The aic94xx driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with the aic94xx driver; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 * $Id: //depot/aic94xx/aic94xx.h#31 $
31 #include <linux/slab.h>
32 #include <linux/ctype.h>
33 #include <scsi/libsas.h>
35 #define ASD_DRIVER_NAME "aic94xx"
36 #define ASD_DRIVER_DESCRIPTION "Adaptec aic94xx SAS/SATA driver"
38 #define asd_printk(fmt, ...) printk(KERN_NOTICE ASD_DRIVER_NAME ": " fmt, ## __VA_ARGS__)
41 #define ENTER printk(KERN_NOTICE "%s: ENTER %s\n", ASD_DRIVER_NAME, \
43 #define EXIT printk(KERN_NOTICE "%s: --EXIT %s\n", ASD_DRIVER_NAME, \
51 #define ASD_DPRINTK asd_printk
53 #define ASD_DPRINTK(fmt, ...)
56 /* 2*ITNL timeout + 1 second */
57 #define AIC94XX_SCB_TIMEOUT (5*HZ)
59 extern struct kmem_cache *asd_dma_token_cache;
60 extern struct kmem_cache *asd_ascb_cache;
61 extern char sas_addr_str[2*SAS_ADDR_SIZE + 1];
63 static inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr)
66 for (i = 0; i < SAS_ADDR_SIZE; i++, p += 2)
67 snprintf(p, 3, "%02X", sas_addr[i]);
71 static inline void asd_destringify_sas_addr(u8 *sas_addr, const char *p)
74 for (i = 0; i < SAS_ADDR_SIZE; i++) {
78 h = isdigit(*p) ? *p-'0' : *p-'A'+10;
80 l = isdigit(*p) ? *p-'0' : *p-'A'+10;
82 sas_addr[i] = (h<<4) | l;
89 int asd_read_ocm(struct asd_ha_struct *asd_ha);
90 int asd_read_flash(struct asd_ha_struct *asd_ha);
92 int asd_dev_found(struct domain_device *dev);
93 void asd_dev_gone(struct domain_device *dev);
95 void asd_invalidate_edb(struct asd_ascb *ascb, int edb_id);
97 int asd_execute_task(struct sas_task *, int num, gfp_t gfp_flags);
99 /* ---------- TMFs ---------- */
100 int asd_abort_task(struct sas_task *);
101 int asd_abort_task_set(struct domain_device *, u8 *lun);
102 int asd_clear_aca(struct domain_device *, u8 *lun);
103 int asd_clear_task_set(struct domain_device *, u8 *lun);
104 int asd_lu_reset(struct domain_device *, u8 *lun);
105 int asd_query_task(struct sas_task *);
107 /* ---------- Adapter and Port management ---------- */
108 int asd_clear_nexus_port(struct asd_sas_port *port);
109 int asd_clear_nexus_ha(struct sas_ha_struct *sas_ha);
111 /* ---------- Phy Management ---------- */
112 int asd_control_phy(struct asd_sas_phy *phy, enum phy_func func, void *arg);