1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_SCSI_SCSI_RESOURCE_H 28 #define _SYS_SCSI_SCSI_RESOURCE_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/scsi/scsi_types.h> 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /* 39 * SCSI Resource Function Declarations 40 */ 41 42 /* 43 * Defines for stating preferences in resource allocation 44 */ 45 46 #define NULL_FUNC ((int (*)())0) 47 #define SLEEP_FUNC ((int (*)())1) 48 49 #ifdef _KERNEL 50 /* 51 * Defines for the flags to scsi_init_pkt() 52 */ 53 #define PKT_CONSISTENT 0x0001 /* this is an 'iopb' packet */ 54 #define PKT_DMA_PARTIAL 0x040000 /* partial xfer ok */ 55 56 /* 57 * Old PKT_CONSISTENT value for binary compatibility with x86 2.1 58 */ 59 #define PKT_CONSISTENT_OLD 0x001000 60 61 /* 62 * Kernel function declarations 63 */ 64 struct buf *scsi_alloc_consistent_buf(struct scsi_address *, 65 struct buf *, size_t, uint_t, int (*)(caddr_t), caddr_t); 66 struct scsi_pkt *scsi_init_pkt(struct scsi_address *, 67 struct scsi_pkt *, struct buf *, int, int, int, int, 68 int (*)(caddr_t), caddr_t); 69 void scsi_destroy_pkt(struct scsi_pkt *); 70 void scsi_free_consistent_buf(struct buf *); 71 struct scsi_pkt *scsi_resalloc(struct scsi_address *, int, 72 int, opaque_t, int (*)(void)); 73 struct scsi_pkt *scsi_pktalloc(struct scsi_address *, int, int, int (*)(void)); 74 struct scsi_pkt *scsi_dmaget(struct scsi_pkt *, opaque_t, int (*)(void)); 75 void scsi_dmafree(struct scsi_pkt *); 76 void scsi_sync_pkt(struct scsi_pkt *); 77 void scsi_resfree(struct scsi_pkt *); 78 79 /* 80 * Private wrapper for scsi_pkt's allocated via scsi_init_cache_pkt() 81 */ 82 struct scsi_pkt_cache_wrapper { 83 struct scsi_pkt pcw_pkt; 84 uint_t pcw_kmflags; 85 }; 86 87 #define NEED_EXT_CDB 0x0001 88 #define NEED_EXT_TGT 0x0002 89 #define NEED_EXT_SCB 0x0004 90 91 /* 92 * Private defines i.e. not part of the DDI. 93 */ 94 #define DEFAULT_CDBLEN 16 95 #define DEFAULT_PRIVLEN 0 96 #define DEFAULT_SCBLEN (sizeof (struct scsi_arq_status)) 97 98 /* 99 * Preliminary version of the SCSA specification 100 * mentioned a routine called scsi_pktfree, which 101 * turned out to be semantically equivialent to 102 * scsi_resfree. 103 */ 104 #define scsi_pktfree scsi_resfree 105 106 #endif /* _KERNEL */ 107 108 #ifdef __cplusplus 109 } 110 #endif 111 112 #endif /* _SYS_SCSI_SCSI_RESOURCE_H */ 113