Print this page
NEX-8020 illumos nvme changes
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-6131 support EUI64 in blkdev
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-4427 blkdev should provide the device_error kstat for iostat -E
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
NEX-4424 kstat module needs cleanup
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
NEX-4420 format(1M) should be able to use device inquiry properties
Reviewed by: Dan McDonald <danmcd@omniti.com>
NEX-4419 blkdev and blkdev drivers should provide inquiry properties
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Adding AoE support to nza-kernel
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/blkdev.h
+++ new/usr/src/uts/common/sys/blkdev.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 2012 DEY Storage Systems, Inc. All rights reserved.
23 23 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
24 24 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
25 25 */
26 26
27 27 #ifndef _SYS_BLKDEV_H
28 28 #define _SYS_BLKDEV_H
29 29
30 30 #include <sys/types.h>
31 31 #include <sys/ksynch.h>
32 32 #include <sys/ddi.h>
33 33 #include <sys/sunddi.h>
34 34
35 35 #ifdef __cplusplus
36 36 extern "C" {
37 37 #endif
38 38
39 39 /*
40 40 * This describes a fairly simple block device. The idea here is that
41 41 * these things want to take advantage of the common labelling support,
42 42 * but do not need all the capabilities of SCSA. So we make quite a few
43 43 * simplifications:
44 44 *
45 45 * 1) Device block size is a power of 2 greater or equal to 512 bytes.
46 46 * An optional physical block size can be reported if the underlying
47 47 * device uses larger block sizes internally, so that writes can be
48 48 * aligned properly.
49 49 *
50 50 * 2) Non-rotating media. We assume a simple linear layout.
51 51 *
52 52 * 3) Fixed queue depth, for each device. The adapter driver reports
53 53 * the queue depth at registration. We don't have any form of
54 54 * dynamic flow control.
55 55 *
56 56 * 4) Negligible power management support. The framework does not support
57 57 * fine grained power management. If the adapter driver wants to use
58 58 * such, it will need to manage power on its own.
59 59 *
60 60 * 5) Suspend/resume support managed by the adapter driver. We don't
61 61 * support suspend/resume directly. The adapter device driver will
62 62 * need to manage this on its own behalf.
63 63 *
64 64 * 6) No request priorities. Transfers are assumed to execute in
65 65 * roughly FIFO order. The adapter driver may reorder them, but the
66 66 * submitter has no control over that.
67 67 *
68 68 * 7) No request cancellation. Once submitted, the job completes or
69 69 * fails. It cannot be canceled.
70 70 *
71 71 * 8) Limited support for removable media. There is no support for
72 72 * locking bay doors or mechanised media bays. This could be
73 73 * added, but at present the only such interesting devices are
74 74 * covered by the SCSI disk driver.
75 75 */
76 76
77 77 typedef struct bd_handle *bd_handle_t;
78 78 typedef struct bd_xfer bd_xfer_t;
79 79 typedef struct bd_drive bd_drive_t;
80 80 typedef struct bd_media bd_media_t;
81 81 typedef struct bd_ops bd_ops_t;
82 82
83 83
84 84 struct bd_xfer {
85 85 /*
86 86 * NB: If using DMA the br_ndmac will be non-zero. Otherwise
87 87 * the br_kaddr will be non-NULL.
88 88 */
|
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
89 89 diskaddr_t x_blkno;
90 90 size_t x_nblks;
91 91 ddi_dma_handle_t x_dmah;
92 92 ddi_dma_cookie_t x_dmac;
93 93 unsigned x_ndmac;
94 94 caddr_t x_kaddr;
95 95 unsigned x_flags;
96 96 };
97 97
98 98 #define BD_XFER_POLL (1U << 0) /* no interrupts (dump) */
99 +#define BD_XFER_MHD_TKOWN (1U << 1)
100 +#define BD_XFER_MHD_RELEASE (1U << 2)
101 +#define BD_XFER_MHD_STATUS (1U << 3)
102 +#define BD_XFER_MHD_QRESERVE (1U << 4)
103 +#define BD_XFER_MHD_ENFAILFAST (1U << 5)
99 104
100 105 struct bd_drive {
101 106 uint32_t d_qsize;
102 107 uint32_t d_maxxfer;
103 108 boolean_t d_removable;
104 109 boolean_t d_hotpluggable;
105 110 int d_target;
106 111 int d_lun;
107 112 size_t d_vendor_len;
108 113 char *d_vendor;
109 114 size_t d_product_len;
110 115 char *d_product;
111 116 size_t d_model_len;
112 117 char *d_model;
113 118 size_t d_serial_len;
114 119 char *d_serial;
115 120 size_t d_revision_len;
116 121 char *d_revision;
117 122 uint8_t d_eui64[8];
118 123 };
119 124
120 125 struct bd_media {
121 126 /*
122 127 * NB: The block size must be a power of two not less than
123 128 * DEV_BSIZE (512). Other values of the block size will
124 129 * simply not function and the media will be rejected.
125 130 *
126 131 * The block size must also divide evenly into the device's
127 132 * d_maxxfer field. If the maxxfer is a power of two larger
128 133 * than the block size, then this will automatically be
129 134 * satisfied.
130 135 *
131 136 * The physical block size (m_pblksize) must be 0 or a power
132 137 * of two not less than the block size.
133 138 */
134 139 uint64_t m_nblks;
135 140 uint32_t m_blksize;
136 141 boolean_t m_readonly;
137 142 boolean_t m_solidstate;
138 143 uint32_t m_pblksize;
139 144 };
140 145
141 146 #define BD_INFO_FLAG_REMOVABLE (1U << 0)
142 147 #define BD_INFO_FLAG_HOTPLUGGABLE (1U << 1)
|
↓ open down ↓ |
34 lines elided |
↑ open up ↑ |
143 148 #define BD_INFO_FLAG_READ_ONLY (1U << 2)
144 149
145 150 struct bd_ops {
146 151 int o_version;
147 152 void (*o_drive_info)(void *, bd_drive_t *);
148 153 int (*o_media_info)(void *, bd_media_t *);
149 154 int (*o_devid_init)(void *, dev_info_t *, ddi_devid_t *);
150 155 int (*o_sync_cache)(void *, bd_xfer_t *);
151 156 int (*o_read)(void *, bd_xfer_t *);
152 157 int (*o_write)(void *, bd_xfer_t *);
158 + int (*o_reserve)(void *, bd_xfer_t *);
153 159 };
154 160
155 161 #define BD_OPS_VERSION_0 0
156 162
157 163 struct bd_errstats {
158 164 /* these are managed by blkdev itself */
159 165 kstat_named_t bd_softerrs;
160 166 kstat_named_t bd_harderrs;
161 167 kstat_named_t bd_transerrs;
162 168 kstat_named_t bd_model;
163 169 kstat_named_t bd_vid;
164 170 kstat_named_t bd_pid;
165 171 kstat_named_t bd_revision;
166 172 kstat_named_t bd_serial;
167 173 kstat_named_t bd_capacity;
168 174
169 175 /* the following are updated on behalf of the HW driver */
170 176 kstat_named_t bd_rq_media_err;
171 177 kstat_named_t bd_rq_ntrdy_err;
172 178 kstat_named_t bd_rq_nodev_err;
173 179 kstat_named_t bd_rq_recov_err;
174 180 kstat_named_t bd_rq_illrq_err;
175 181 kstat_named_t bd_rq_pfa_err;
176 182 };
177 183
178 184 #define BD_ERR_MEDIA 0
179 185 #define BD_ERR_NTRDY 1
180 186 #define BD_ERR_NODEV 2
181 187 #define BD_ERR_RECOV 3
182 188 #define BD_ERR_ILLRQ 4
183 189 #define BD_ERR_PFA 5
184 190
185 191 /*
186 192 * Note, one handler *per* address. Drivers with multiple targets at
187 193 * different addresses must use separate handles.
188 194 */
189 195 bd_handle_t bd_alloc_handle(void *, bd_ops_t *, ddi_dma_attr_t *, int);
190 196 void bd_free_handle(bd_handle_t);
191 197 int bd_attach_handle(dev_info_t *, bd_handle_t);
192 198 int bd_detach_handle(bd_handle_t);
193 199 void bd_state_change(bd_handle_t);
194 200 void bd_xfer_done(bd_xfer_t *, int);
195 201 void bd_error(bd_xfer_t *, int);
196 202 void bd_mod_init(struct dev_ops *);
197 203 void bd_mod_fini(struct dev_ops *);
198 204
199 205 #ifdef __cplusplus
200 206 }
201 207 #endif
202 208
203 209 #endif /* _SYS_BLKDEV_H */
|
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX