12908d778ab3e244900c310974e1fc1c69066e450James Bottomley/*
22908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Aic94xx SAS/SATA driver header file.
32908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
42908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Copyright (C) 2005 Adaptec, Inc.  All rights reserved.
52908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
62908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
72908d778ab3e244900c310974e1fc1c69066e450James Bottomley * This file is licensed under GPLv2.
82908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
92908d778ab3e244900c310974e1fc1c69066e450James Bottomley * This file is part of the aic94xx driver.
102908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
112908d778ab3e244900c310974e1fc1c69066e450James Bottomley * The aic94xx driver is free software; you can redistribute it and/or
122908d778ab3e244900c310974e1fc1c69066e450James Bottomley * modify it under the terms of the GNU General Public License as
132908d778ab3e244900c310974e1fc1c69066e450James Bottomley * published by the Free Software Foundation; version 2 of the
142908d778ab3e244900c310974e1fc1c69066e450James Bottomley * License.
152908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
162908d778ab3e244900c310974e1fc1c69066e450James Bottomley * The aic94xx driver is distributed in the hope that it will be useful,
172908d778ab3e244900c310974e1fc1c69066e450James Bottomley * but WITHOUT ANY WARRANTY; without even the implied warranty of
182908d778ab3e244900c310974e1fc1c69066e450James Bottomley * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
192908d778ab3e244900c310974e1fc1c69066e450James Bottomley * General Public License for more details.
202908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
212908d778ab3e244900c310974e1fc1c69066e450James Bottomley * You should have received a copy of the GNU General Public License
222908d778ab3e244900c310974e1fc1c69066e450James Bottomley * along with the aic94xx driver; if not, write to the Free Software
232908d778ab3e244900c310974e1fc1c69066e450James Bottomley * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
242908d778ab3e244900c310974e1fc1c69066e450James Bottomley *
252908d778ab3e244900c310974e1fc1c69066e450James Bottomley * $Id: //depot/aic94xx/aic94xx.h#31 $
262908d778ab3e244900c310974e1fc1c69066e450James Bottomley */
272908d778ab3e244900c310974e1fc1c69066e450James Bottomley
282908d778ab3e244900c310974e1fc1c69066e450James Bottomley#ifndef _AIC94XX_H_
292908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define _AIC94XX_H_
302908d778ab3e244900c310974e1fc1c69066e450James Bottomley
312908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include <linux/slab.h>
322908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include <linux/ctype.h>
332908d778ab3e244900c310974e1fc1c69066e450James Bottomley#include <scsi/libsas.h>
342908d778ab3e244900c310974e1fc1c69066e450James Bottomley
352908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define ASD_DRIVER_NAME		"aic94xx"
362908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define ASD_DRIVER_DESCRIPTION	"Adaptec aic94xx SAS/SATA driver"
372908d778ab3e244900c310974e1fc1c69066e450James Bottomley
382908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define asd_printk(fmt, ...)	printk(KERN_NOTICE ASD_DRIVER_NAME ": " fmt, ## __VA_ARGS__)
392908d778ab3e244900c310974e1fc1c69066e450James Bottomley
402908d778ab3e244900c310974e1fc1c69066e450James Bottomley#ifdef ASD_ENTER_EXIT
412908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define ENTER  printk(KERN_NOTICE "%s: ENTER %s\n", ASD_DRIVER_NAME, \
42cadbd4a5e36dde7e6c49b587b2c419103c0b7218Harvey Harrison		__func__)
432908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define EXIT   printk(KERN_NOTICE "%s: --EXIT %s\n", ASD_DRIVER_NAME, \
44cadbd4a5e36dde7e6c49b587b2c419103c0b7218Harvey Harrison		__func__)
452908d778ab3e244900c310974e1fc1c69066e450James Bottomley#else
462908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define ENTER
472908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define EXIT
482908d778ab3e244900c310974e1fc1c69066e450James Bottomley#endif
492908d778ab3e244900c310974e1fc1c69066e450James Bottomley
502908d778ab3e244900c310974e1fc1c69066e450James Bottomley#ifdef ASD_DEBUG
512908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define ASD_DPRINTK asd_printk
522908d778ab3e244900c310974e1fc1c69066e450James Bottomley#else
532908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define ASD_DPRINTK(fmt, ...)
542908d778ab3e244900c310974e1fc1c69066e450James Bottomley#endif
552908d778ab3e244900c310974e1fc1c69066e450James Bottomley
562908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* 2*ITNL timeout + 1 second */
572908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define AIC94XX_SCB_TIMEOUT  (5*HZ)
582908d778ab3e244900c310974e1fc1c69066e450James Bottomley
59e18b890bb0881bbab6f4f1a6cd20d9c60d66b003Christoph Lameterextern struct kmem_cache *asd_dma_token_cache;
60e18b890bb0881bbab6f4f1a6cd20d9c60d66b003Christoph Lameterextern struct kmem_cache *asd_ascb_cache;
612908d778ab3e244900c310974e1fc1c69066e450James Bottomley
622908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr)
632908d778ab3e244900c310974e1fc1c69066e450James Bottomley{
642908d778ab3e244900c310974e1fc1c69066e450James Bottomley	int i;
652908d778ab3e244900c310974e1fc1c69066e450James Bottomley	for (i = 0; i < SAS_ADDR_SIZE; i++, p += 2)
662908d778ab3e244900c310974e1fc1c69066e450James Bottomley		snprintf(p, 3, "%02X", sas_addr[i]);
672908d778ab3e244900c310974e1fc1c69066e450James Bottomley	*p = '\0';
682908d778ab3e244900c310974e1fc1c69066e450James Bottomley}
692908d778ab3e244900c310974e1fc1c69066e450James Bottomley
702908d778ab3e244900c310974e1fc1c69066e450James Bottomleystruct asd_ha_struct;
712908d778ab3e244900c310974e1fc1c69066e450James Bottomleystruct asd_ascb;
722908d778ab3e244900c310974e1fc1c69066e450James Bottomley
732908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_read_ocm(struct asd_ha_struct *asd_ha);
742908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_read_flash(struct asd_ha_struct *asd_ha);
752908d778ab3e244900c310974e1fc1c69066e450James Bottomley
762908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_dev_found(struct domain_device *dev);
772908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dev_gone(struct domain_device *dev);
782908d778ab3e244900c310974e1fc1c69066e450James Bottomley
792908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_invalidate_edb(struct asd_ascb *ascb, int edb_id);
802908d778ab3e244900c310974e1fc1c69066e450James Bottomley
813cc27547d6ee2d50ecdd11e9127bc3cd1947e8ddAl Viroint  asd_execute_task(struct sas_task *, int num, gfp_t gfp_flags);
822908d778ab3e244900c310974e1fc1c69066e450James Bottomley
83b91bb296188118eea9fdc6093cfcf76bbe8589baDan Williamsvoid asd_set_dmamode(struct domain_device *dev);
84b91bb296188118eea9fdc6093cfcf76bbe8589baDan Williams
852908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* ---------- TMFs ---------- */
862908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_abort_task(struct sas_task *);
872908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_abort_task_set(struct domain_device *, u8 *lun);
882908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_clear_aca(struct domain_device *, u8 *lun);
892908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_clear_task_set(struct domain_device *, u8 *lun);
902908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_lu_reset(struct domain_device *, u8 *lun);
9163edf49e67cac710826108697c4e8636c89abd17James Bottomleyint  asd_I_T_nexus_reset(struct domain_device *dev);
922908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_query_task(struct sas_task *);
932908d778ab3e244900c310974e1fc1c69066e450James Bottomley
942908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* ---------- Adapter and Port management ---------- */
952908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_clear_nexus_port(struct asd_sas_port *port);
962908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint  asd_clear_nexus_ha(struct sas_ha_struct *sas_ha);
972908d778ab3e244900c310974e1fc1c69066e450James Bottomley
982908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* ---------- Phy Management ---------- */
99a01e70e570a72b8a8c9a58062e4f5bdcd3986222James Bottomleyint  asd_control_phy(struct asd_sas_phy *phy, enum phy_func func, void *arg);
1002908d778ab3e244900c310974e1fc1c69066e450James Bottomley
1012908d778ab3e244900c310974e1fc1c69066e450James Bottomley#endif
102