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 * Preliminary version of the SCSA specification 81 * mentioned a routine called scsi_pktfree, which 82 * turned out to be semantically equivialent to 83 * scsi_resfree. 84 */ 85 #define scsi_pktfree scsi_resfree 86 87 #endif /* _KERNEL */ 88 89 #ifdef __cplusplus 90 } 91 #endif 92 93 #endif /* _SYS_SCSI_SCSI_RESOURCE_H */ 94