1 /* $NetBSD: extern.h,v 1.4 2002/06/26 16:04:11 mjacob Exp $ */
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
32 * Small changes made by Reinoud Zandijk <reinoud@netbsd.org>
40 #define SCSI_CMD_LEN 12
41 typedef unsigned char scsicmd
[SCSI_CMD_LEN
];
44 #include "uscsilib_machdep.h"
45 extern int uscsilib_verbose
;
49 * Unified structure copied and modified from NetBSD's <sys/scsiio.h> for ease
53 int type
; /* bus type */
54 #define USCSI_TYPE_SCSI 0
55 #define USCSI_TYPE_ATAPI 1
58 int scbus
; /* -1 if wildcard */
59 int target
; /* -1 if wildcard */
60 int lun
; /* -1 if wildcard */
63 int atbus
; /* -1 if wildcard */
64 int drive
; /* -1 if wildcard */
71 int asc
; /* Additional sense code */
72 int ascq
; /* Additional sense code quality */
73 int skey_valid
; /* sense key valid */
74 int sense_key
; /* sense key; interpret on (asc, ascq) pair */
81 void *devhandle
; /* for if a fhandle is not enough */
86 extern char *uscsi_decode_sense(void *sinfo
, int flag
);
87 extern void uscsi_print_sense(const char *name
, u_char
*req_cmd
,
88 int req_cmdlen
, u_char
*req_sense
, int req_senselen_used
,
93 extern int uscsi_open(struct uscsi_dev
*);
94 extern int uscsi_close(struct uscsi_dev
*);
95 extern int uscsi_command(int flags
, struct uscsi_dev
*disc
,
96 void *cmd
, size_t cmdlen
, void *data
, size_t datalen
,
97 uint32_t timeout
, struct uscsi_sense
*uscsi_sense
);
98 extern int uscsi_check_for_scsi(struct uscsi_dev
*);
99 extern int uscsi_identify(struct uscsi_dev
*, struct uscsi_addr
*saddr
);
101 extern int uscsi_mode_sense(struct uscsi_dev
*, u_int8_t
, u_int8_t
,
103 extern int uscsi_mode_select(struct uscsi_dev
*, u_int8_t
, void *, size_t);
104 extern int uscsi_request_sense(struct uscsi_dev
*, void *, size_t);
107 #endif /* _SCSILIB_H_ */