aic94xx.h revision 63edf49e67cac710826108697c4e8636c89abd17
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, \ 422908d778ab3e244900c310974e1fc1c69066e450James Bottomley __FUNCTION__) 432908d778ab3e244900c310974e1fc1c69066e450James Bottomley#define EXIT printk(KERN_NOTICE "%s: --EXIT %s\n", ASD_DRIVER_NAME, \ 442908d778ab3e244900c310974e1fc1c69066e450James Bottomley __FUNCTION__) 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 Bottomleyextern char sas_addr_str[2*SAS_ADDR_SIZE + 1]; 622908d778ab3e244900c310974e1fc1c69066e450James Bottomley 632908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic inline void asd_stringify_sas_addr(char *p, const u8 *sas_addr) 642908d778ab3e244900c310974e1fc1c69066e450James Bottomley{ 652908d778ab3e244900c310974e1fc1c69066e450James Bottomley int i; 662908d778ab3e244900c310974e1fc1c69066e450James Bottomley for (i = 0; i < SAS_ADDR_SIZE; i++, p += 2) 672908d778ab3e244900c310974e1fc1c69066e450James Bottomley snprintf(p, 3, "%02X", sas_addr[i]); 682908d778ab3e244900c310974e1fc1c69066e450James Bottomley *p = '\0'; 692908d778ab3e244900c310974e1fc1c69066e450James Bottomley} 702908d778ab3e244900c310974e1fc1c69066e450James Bottomley 712908d778ab3e244900c310974e1fc1c69066e450James Bottomleystatic inline void asd_destringify_sas_addr(u8 *sas_addr, const char *p) 722908d778ab3e244900c310974e1fc1c69066e450James Bottomley{ 732908d778ab3e244900c310974e1fc1c69066e450James Bottomley int i; 742908d778ab3e244900c310974e1fc1c69066e450James Bottomley for (i = 0; i < SAS_ADDR_SIZE; i++) { 752908d778ab3e244900c310974e1fc1c69066e450James Bottomley u8 h, l; 762908d778ab3e244900c310974e1fc1c69066e450James Bottomley if (!*p) 772908d778ab3e244900c310974e1fc1c69066e450James Bottomley break; 782908d778ab3e244900c310974e1fc1c69066e450James Bottomley h = isdigit(*p) ? *p-'0' : *p-'A'+10; 792908d778ab3e244900c310974e1fc1c69066e450James Bottomley p++; 802908d778ab3e244900c310974e1fc1c69066e450James Bottomley l = isdigit(*p) ? *p-'0' : *p-'A'+10; 812908d778ab3e244900c310974e1fc1c69066e450James Bottomley p++; 822908d778ab3e244900c310974e1fc1c69066e450James Bottomley sas_addr[i] = (h<<4) | l; 832908d778ab3e244900c310974e1fc1c69066e450James Bottomley } 842908d778ab3e244900c310974e1fc1c69066e450James Bottomley} 852908d778ab3e244900c310974e1fc1c69066e450James Bottomley 862908d778ab3e244900c310974e1fc1c69066e450James Bottomleystruct asd_ha_struct; 872908d778ab3e244900c310974e1fc1c69066e450James Bottomleystruct asd_ascb; 882908d778ab3e244900c310974e1fc1c69066e450James Bottomley 892908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_read_ocm(struct asd_ha_struct *asd_ha); 902908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_read_flash(struct asd_ha_struct *asd_ha); 912908d778ab3e244900c310974e1fc1c69066e450James Bottomley 922908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_dev_found(struct domain_device *dev); 932908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_dev_gone(struct domain_device *dev); 942908d778ab3e244900c310974e1fc1c69066e450James Bottomley 952908d778ab3e244900c310974e1fc1c69066e450James Bottomleyvoid asd_invalidate_edb(struct asd_ascb *ascb, int edb_id); 962908d778ab3e244900c310974e1fc1c69066e450James Bottomley 973cc27547d6ee2d50ecdd11e9127bc3cd1947e8ddAl Viroint asd_execute_task(struct sas_task *, int num, gfp_t gfp_flags); 982908d778ab3e244900c310974e1fc1c69066e450James Bottomley 992908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* ---------- TMFs ---------- */ 1002908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_abort_task(struct sas_task *); 1012908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_abort_task_set(struct domain_device *, u8 *lun); 1022908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_clear_aca(struct domain_device *, u8 *lun); 1032908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_clear_task_set(struct domain_device *, u8 *lun); 1042908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_lu_reset(struct domain_device *, u8 *lun); 10563edf49e67cac710826108697c4e8636c89abd17James Bottomleyint asd_I_T_nexus_reset(struct domain_device *dev); 1062908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_query_task(struct sas_task *); 1072908d778ab3e244900c310974e1fc1c69066e450James Bottomley 1082908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* ---------- Adapter and Port management ---------- */ 1092908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_clear_nexus_port(struct asd_sas_port *port); 1102908d778ab3e244900c310974e1fc1c69066e450James Bottomleyint asd_clear_nexus_ha(struct sas_ha_struct *sas_ha); 1112908d778ab3e244900c310974e1fc1c69066e450James Bottomley 1122908d778ab3e244900c310974e1fc1c69066e450James Bottomley/* ---------- Phy Management ---------- */ 113a01e70e570a72b8a8c9a58062e4f5bdcd3986222James Bottomleyint asd_control_phy(struct asd_sas_phy *phy, enum phy_func func, void *arg); 1142908d778ab3e244900c310974e1fc1c69066e450James Bottomley 1152908d778ab3e244900c310974e1fc1c69066e450James Bottomley#endif 116