blob: 26d4ad9ede2e8f074319a320a504f727f6fb1658 [file] [log] [blame]
James Bottomley2908d772006-08-29 09:22:51 -05001/*
2 * Aic94xx SAS/SATA driver header file.
3 *
4 * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
5 * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
6 *
7 * This file is licensed under GPLv2.
8 *
9 * This file is part of the aic94xx driver.
10 *
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
14 * License.
15 *
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.
20 *
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
24 *
25 * $Id: //depot/aic94xx/aic94xx.h#31 $
26 */
27
28#ifndef _AIC94XX_H_
29#define _AIC94XX_H_
30
31#include <linux/slab.h>
32#include <linux/ctype.h>
33#include <scsi/libsas.h>
34
35#define ASD_DRIVER_NAME "aic94xx"
36#define ASD_DRIVER_DESCRIPTION "Adaptec aic94xx SAS/SATA driver"
37
38#define asd_printk(fmt, ...) printk(KERN_NOTICE ASD_DRIVER_NAME ": " fmt, ## __VA_ARGS__)
39
40#ifdef ASD_ENTER_EXIT
41#define ENTER printk(KERN_NOTICE "%s: ENTER %s\n", ASD_DRIVER_NAME, \
Harvey Harrisoncadbd4a2008-07-03 23:47:27 -070042 __func__)
James Bottomley2908d772006-08-29 09:22:51 -050043#define EXIT printk(KERN_NOTICE "%s: --EXIT %s\n", ASD_DRIVER_NAME, \
Harvey Harrisoncadbd4a2008-07-03 23:47:27 -070044 __func__)
James Bottomley2908d772006-08-29 09:22:51 -050045#else
46#define ENTER
47#define EXIT
48#endif
49
50#ifdef ASD_DEBUG
51#define ASD_DPRINTK asd_printk
52#else
53#define ASD_DPRINTK(fmt, ...)
54#endif
55
56/* 2*ITNL timeout + 1 second */
57#define AIC94XX_SCB_TIMEOUT (5*HZ)
58
Christoph Lametere18b8902006-12-06 20:33:20 -080059extern struct kmem_cache *asd_dma_token_cache;
60extern struct kmem_cache *asd_ascb_cache;
James Bottomley2908d772006-08-29 09:22:51 -050061
62static inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr)
63{
64 int i;
65 for (i = 0; i < SAS_ADDR_SIZE; i++, p += 2)
66 snprintf(p, 3, "%02X", sas_addr[i]);
67 *p = '\0';
68}
69
James Bottomley2908d772006-08-29 09:22:51 -050070struct asd_ha_struct;
71struct asd_ascb;
72
73int asd_read_ocm(struct asd_ha_struct *asd_ha);
74int asd_read_flash(struct asd_ha_struct *asd_ha);
75
76int asd_dev_found(struct domain_device *dev);
77void asd_dev_gone(struct domain_device *dev);
78
79void asd_invalidate_edb(struct asd_ascb *ascb, int edb_id);
80
Christoph Hellwig79855d12014-11-05 10:36:28 +010081int asd_execute_task(struct sas_task *task, gfp_t gfp_flags);
James Bottomley2908d772006-08-29 09:22:51 -050082
Dan Williamsb91bb292011-11-17 17:59:52 -080083void asd_set_dmamode(struct domain_device *dev);
84
James Bottomley2908d772006-08-29 09:22:51 -050085/* ---------- TMFs ---------- */
86int asd_abort_task(struct sas_task *);
87int asd_abort_task_set(struct domain_device *, u8 *lun);
88int asd_clear_aca(struct domain_device *, u8 *lun);
89int asd_clear_task_set(struct domain_device *, u8 *lun);
90int asd_lu_reset(struct domain_device *, u8 *lun);
James Bottomley63edf492008-02-23 23:37:26 -060091int asd_I_T_nexus_reset(struct domain_device *dev);
James Bottomley2908d772006-08-29 09:22:51 -050092int asd_query_task(struct sas_task *);
93
94/* ---------- Adapter and Port management ---------- */
95int asd_clear_nexus_port(struct asd_sas_port *port);
96int asd_clear_nexus_ha(struct sas_ha_struct *sas_ha);
97
98/* ---------- Phy Management ---------- */
James Bottomleya01e70e2006-09-06 19:28:07 -050099int asd_control_phy(struct asd_sas_phy *phy, enum phy_func func, void *arg);
James Bottomley2908d772006-08-29 09:22:51 -0500100
101#endif