Print this page
XXXX introduce drv_sectohz
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/dktp/dadk.h
+++ new/usr/src/uts/common/sys/dktp/dadk.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #ifndef _SYS_DKTP_DADK_H
27 27 #define _SYS_DKTP_DADK_H
28 28
29 29 #pragma ident "%Z%%M% %I% %E% SMI"
30 30
31 31 #ifdef __cplusplus
32 32 extern "C" {
33 33 #endif
34 34
35 35 #include <sys/dktp/tgcom.h>
36 36
37 37 struct dadk {
38 38 struct tgdk_ext *dad_extp; /* back pointer to ext data */
39 39 struct scsi_device *dad_sd; /* back pointer to SCSI_DEVICE */
40 40
41 41 struct tgdk_geom dad_logg; /* logical disk geometry */
42 42 struct tgdk_geom dad_phyg; /* physical disk geometry */
43 43
44 44 unsigned dad_rmb : 1; /* removable device */
45 45 unsigned dad_rdonly : 1; /* read only device */
46 46 unsigned dad_cdrom : 1; /* cdrom device */
47 47 unsigned dad_noflush : 1; /* flush cmd unsupported */
48 48 unsigned dad_wce : 1; /* disk write cache enabled */
49 49 unsigned dad_resv : 3;
50 50 unsigned char dad_type; /* device type */
51 51 unsigned char dad_ctype; /* controller type */
52 52
53 53 short dad_secshf;
54 54 short dad_blkshf;
55 55
56 56 opaque_t dad_bbhobjp; /* bbh object ptr */
57 57 opaque_t dad_flcobjp; /* flow control object ptr */
58 58 opaque_t dad_ctlobjp; /* controller object ptr */
59 59 struct tgcom_obj dad_com; /* com object for flowctrl */
60 60 enum dkio_state dad_iostate; /* ejected/inserted */
61 61 kmutex_t dad_mutex; /* protect dad_state */
62 62 kcondvar_t dad_state_cv; /* condition variable for state */
63 63 uchar_t dad_thread_cnt; /* reference count on removable */
64 64 /* - disk state watcher thread */
65 65 kstat_t *dad_errstats; /* error stats */
66 66 kmutex_t dad_cmd_mutex;
67 67 int dad_cmd_count;
68 68 };
↓ open down ↓ |
68 lines elided |
↑ open up ↑ |
69 69
70 70 #define DAD_SECSIZ dad_phyg.g_secsiz
71 71
72 72 /*
73 73 * Local definitions, for clarity of code
74 74 */
75 75
76 76 /*
77 77 * Parameters
78 78 */
79 -#define DADK_BSY_TIMEOUT (drv_usectohz(5 * 1000000))
79 +#define DADK_BSY_TIMEOUT drv_sectohz(5)
80 80 #define DADK_IO_TIME 35
81 81 #define DADK_FLUSH_CACHE_TIME 60
82 82 #define DADK_RETRY_COUNT 5
83 83 #define DADK_SILENT 1
84 84
85 85 #define PKT2DADK(pktp) ((struct dadk *)(pktp)->cp_dev_private)
86 86
87 87 /*
88 88 * packet action codes
89 89 */
90 90 #define COMMAND_DONE 0
91 91 #define COMMAND_DONE_ERROR 1
92 92 #define QUE_COMMAND 2
93 93 #define QUE_SENSE 3
94 94 #define JUST_RETURN 4
95 95
96 96 typedef struct dadk_errstats {
97 97 kstat_named_t dadk_softerrs; /* Collecting Softerrs */
98 98 kstat_named_t dadk_harderrs; /* Collecting harderrs */
99 99 kstat_named_t dadk_transerrs; /* Collecting Transfer errs */
100 100 kstat_named_t dadk_model; /* model # of the disk */
101 101 kstat_named_t dadk_revision; /* The disk revision */
102 102 kstat_named_t dadk_serial; /* The disk serial number */
103 103 kstat_named_t dadk_capacity; /* Capacity of the disk */
104 104 kstat_named_t dadk_rq_media_err; /* Any media err seen */
105 105 kstat_named_t dadk_rq_ntrdy_err; /* Not ready errs */
106 106 kstat_named_t dadk_rq_nodev_err; /* No device errs */
107 107 kstat_named_t dadk_rq_recov_err; /* Recovered errs */
108 108 kstat_named_t dadk_rq_illrq_err; /* Illegal requests */
109 109 } dadk_errstats_t;
110 110
111 111 int dadk_init(opaque_t objp, opaque_t devp, opaque_t flcobjp,
112 112 opaque_t queobjp, opaque_t bbhobjp, void *lkarg);
113 113 int dadk_free(struct tgdk_obj *dkobjp);
114 114 int dadk_probe(opaque_t objp, int kmsflg);
115 115 int dadk_attach(opaque_t objp);
116 116 int dadk_open(opaque_t objp, int flag);
117 117 int dadk_close(opaque_t objp);
118 118 int dadk_ioctl(opaque_t objp, dev_t dev, int cmd, intptr_t arg,
119 119 int flag, cred_t *cred_p, int *rval_p);
120 120 int dadk_flushdone(struct buf *bp);
121 121 int dadk_strategy(opaque_t objp, struct buf *bp);
122 122 int dadk_setgeom(opaque_t objp, struct tgdk_geom *dkgeom_p);
123 123 int dadk_getgeom(opaque_t objp, struct tgdk_geom *dkgeom_p);
124 124 struct tgdk_iob *dadk_iob_alloc(opaque_t objp, daddr_t blkno,
125 125 ssize_t xfer, int kmsflg);
126 126 int dadk_iob_free(opaque_t objp, struct tgdk_iob *iobp);
127 127 caddr_t dadk_iob_htoc(opaque_t objp, struct tgdk_iob *iobp);
128 128 caddr_t dadk_iob_xfer(opaque_t objp, struct tgdk_iob *iobp, int rw);
129 129 int dadk_dump(opaque_t objp, struct buf *bp);
130 130 int dadk_getphygeom(opaque_t objp, struct tgdk_geom *dkgeom_p);
131 131 int dadk_set_bbhobj(opaque_t objp, opaque_t bbhobjp);
132 132 int dadk_check_media(opaque_t objp, int *state);
133 133 static void dadk_watch_thread(struct dadk *dadkp);
134 134 int dadk_inquiry(opaque_t objp, opaque_t *inqpp);
135 135 void dadk_cleanup(struct tgdk_obj *dkobjp);
136 136
137 137 int dadk_getcmds(opaque_t objp);
138 138
139 139 #ifdef __cplusplus
140 140 }
141 141 #endif
142 142
143 143 #endif /* _SYS_DKTP_DADK_H */
↓ open down ↓ |
54 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX