ld.c revision 1.54.6.3 1 1.54.6.3 mjf /* $NetBSD: ld.c,v 1.54.6.3 2008/04/06 09:58:49 mjf Exp $ */
2 1.1 ad
3 1.1 ad /*-
4 1.1 ad * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
5 1.1 ad * All rights reserved.
6 1.1 ad *
7 1.1 ad * This code is derived from software contributed to The NetBSD Foundation
8 1.1 ad * by Andrew Doran and Charles M. Hannum.
9 1.1 ad *
10 1.1 ad * Redistribution and use in source and binary forms, with or without
11 1.1 ad * modification, are permitted provided that the following conditions
12 1.1 ad * are met:
13 1.1 ad * 1. Redistributions of source code must retain the above copyright
14 1.1 ad * notice, this list of conditions and the following disclaimer.
15 1.1 ad * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 ad * notice, this list of conditions and the following disclaimer in the
17 1.1 ad * documentation and/or other materials provided with the distribution.
18 1.1 ad * 3. All advertising materials mentioning features or use of this software
19 1.1 ad * must display the following acknowledgement:
20 1.1 ad * This product includes software developed by the NetBSD
21 1.1 ad * Foundation, Inc. and its contributors.
22 1.1 ad * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 ad * contributors may be used to endorse or promote products derived
24 1.1 ad * from this software without specific prior written permission.
25 1.1 ad *
26 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 ad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 ad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 ad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 ad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 ad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 ad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 ad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 ad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 ad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 ad * POSSIBILITY OF SUCH DAMAGE.
37 1.1 ad */
38 1.1 ad
39 1.1 ad /*
40 1.1 ad * Disk driver for use by RAID controllers.
41 1.1 ad */
42 1.12 lukem
43 1.12 lukem #include <sys/cdefs.h>
44 1.54.6.3 mjf __KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.54.6.3 2008/04/06 09:58:49 mjf Exp $");
45 1.1 ad
46 1.1 ad #include "rnd.h"
47 1.1 ad
48 1.1 ad #include <sys/param.h>
49 1.1 ad #include <sys/systm.h>
50 1.1 ad #include <sys/kernel.h>
51 1.1 ad #include <sys/device.h>
52 1.1 ad #include <sys/queue.h>
53 1.1 ad #include <sys/proc.h>
54 1.1 ad #include <sys/buf.h>
55 1.33 yamt #include <sys/bufq.h>
56 1.1 ad #include <sys/endian.h>
57 1.1 ad #include <sys/disklabel.h>
58 1.1 ad #include <sys/disk.h>
59 1.1 ad #include <sys/dkio.h>
60 1.1 ad #include <sys/stat.h>
61 1.1 ad #include <sys/conf.h>
62 1.1 ad #include <sys/fcntl.h>
63 1.2 ad #include <sys/vnode.h>
64 1.1 ad #include <sys/syslog.h>
65 1.44 ad #include <sys/mutex.h>
66 1.1 ad #if NRND > 0
67 1.1 ad #include <sys/rnd.h>
68 1.1 ad #endif
69 1.1 ad
70 1.1 ad #include <dev/ldvar.h>
71 1.1 ad
72 1.43 riz #include <prop/proplib.h>
73 1.43 riz
74 1.1 ad static void ldgetdefaultlabel(struct ld_softc *, struct disklabel *);
75 1.1 ad static void ldgetdisklabel(struct ld_softc *);
76 1.1 ad static void ldminphys(struct buf *bp);
77 1.54.6.1 mjf static bool ld_shutdown(device_t, int);
78 1.44 ad static void ldstart(struct ld_softc *, struct buf *);
79 1.43 riz static void ld_set_properties(struct ld_softc *);
80 1.45 riz static void ld_config_interrupts (struct device *);
81 1.1 ad
82 1.1 ad extern struct cfdriver ld_cd;
83 1.1 ad
84 1.29 thorpej static dev_type_open(ldopen);
85 1.29 thorpej static dev_type_close(ldclose);
86 1.29 thorpej static dev_type_read(ldread);
87 1.29 thorpej static dev_type_write(ldwrite);
88 1.29 thorpej static dev_type_ioctl(ldioctl);
89 1.29 thorpej static dev_type_strategy(ldstrategy);
90 1.29 thorpej static dev_type_dump(lddump);
91 1.29 thorpej static dev_type_size(ldsize);
92 1.16 gehenna
93 1.16 gehenna const struct bdevsw ld_bdevsw = {
94 1.16 gehenna ldopen, ldclose, ldstrategy, ldioctl, lddump, ldsize, D_DISK
95 1.16 gehenna };
96 1.16 gehenna
97 1.16 gehenna const struct cdevsw ld_cdevsw = {
98 1.16 gehenna ldopen, ldclose, ldread, ldwrite, ldioctl,
99 1.17 jdolecek nostop, notty, nopoll, nommap, nokqfilter, D_DISK
100 1.16 gehenna };
101 1.16 gehenna
102 1.30 thorpej static struct dkdriver lddkdriver = { ldstrategy, ldminphys };
103 1.1 ad
104 1.1 ad void
105 1.1 ad ldattach(struct ld_softc *sc)
106 1.1 ad {
107 1.37 christos char tbuf[9];
108 1.54.6.2 mjf int i, unit, cmaj, bmaj;
109 1.1 ad
110 1.53 ad mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_VM);
111 1.44 ad
112 1.7 ad if ((sc->sc_flags & LDF_ENABLED) == 0) {
113 1.34 briggs aprint_normal("%s: disabled\n", sc->sc_dv.dv_xname);
114 1.7 ad return;
115 1.7 ad }
116 1.7 ad
117 1.1 ad /* Initialise and attach the disk structure. */
118 1.50 ad disk_init(&sc->sc_dk, sc->sc_dv.dv_xname, &lddkdriver);
119 1.1 ad disk_attach(&sc->sc_dk);
120 1.1 ad
121 1.1 ad if (sc->sc_maxxfer > MAXPHYS)
122 1.1 ad sc->sc_maxxfer = MAXPHYS;
123 1.9 ad
124 1.19 thorpej /* Build synthetic geometry if necessary. */
125 1.19 thorpej if (sc->sc_nheads == 0 || sc->sc_nsectors == 0 ||
126 1.19 thorpej sc->sc_ncylinders == 0) {
127 1.28 dbj uint64_t ncyl;
128 1.28 dbj
129 1.19 thorpej if (sc->sc_secperunit <= 528 * 2048) /* 528MB */
130 1.19 thorpej sc->sc_nheads = 16;
131 1.19 thorpej else if (sc->sc_secperunit <= 1024 * 2048) /* 1GB */
132 1.19 thorpej sc->sc_nheads = 32;
133 1.19 thorpej else if (sc->sc_secperunit <= 21504 * 2048) /* 21GB */
134 1.19 thorpej sc->sc_nheads = 64;
135 1.19 thorpej else if (sc->sc_secperunit <= 43008 * 2048) /* 42GB */
136 1.19 thorpej sc->sc_nheads = 128;
137 1.19 thorpej else
138 1.19 thorpej sc->sc_nheads = 255;
139 1.19 thorpej
140 1.19 thorpej sc->sc_nsectors = 63;
141 1.28 dbj sc->sc_ncylinders = INT_MAX;
142 1.35 perry ncyl = sc->sc_secperunit /
143 1.19 thorpej (sc->sc_nheads * sc->sc_nsectors);
144 1.28 dbj if (ncyl < INT_MAX)
145 1.28 dbj sc->sc_ncylinders = (int)ncyl;
146 1.19 thorpej }
147 1.1 ad
148 1.37 christos format_bytes(tbuf, sizeof(tbuf), sc->sc_secperunit *
149 1.1 ad sc->sc_secsize);
150 1.34 briggs aprint_normal("%s: %s, %d cyl, %d head, %d sec, %d bytes/sect x %"PRIu64" sectors\n",
151 1.37 christos sc->sc_dv.dv_xname, tbuf, sc->sc_ncylinders, sc->sc_nheads,
152 1.1 ad sc->sc_nsectors, sc->sc_secsize, sc->sc_secperunit);
153 1.1 ad
154 1.43 riz ld_set_properties(sc);
155 1.43 riz
156 1.1 ad #if NRND > 0
157 1.1 ad /* Attach the device into the rnd source list. */
158 1.1 ad rnd_attach_source(&sc->sc_rnd_source, sc->sc_dv.dv_xname,
159 1.1 ad RND_TYPE_DISK, 0);
160 1.1 ad #endif
161 1.1 ad
162 1.54.6.1 mjf /* Register with PMF */
163 1.54.6.1 mjf if (!pmf_device_register1(&sc->sc_dv, NULL, NULL, ld_shutdown))
164 1.54.6.1 mjf aprint_error_dev(&sc->sc_dv,
165 1.54.6.1 mjf "couldn't establish power handler\n");
166 1.54.6.1 mjf
167 1.38 yamt bufq_alloc(&sc->sc_bufq, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK);
168 1.30 thorpej
169 1.30 thorpej /* Discover wedges on this disk. */
170 1.45 riz config_interrupts(&sc->sc_dv, ld_config_interrupts);
171 1.54.6.2 mjf
172 1.54.6.2 mjf cmaj = cdevsw_lookup_major(&ld_cdevsw);
173 1.54.6.2 mjf bmaj = bdevsw_lookup_major(&ld_bdevsw);
174 1.54.6.2 mjf unit = device_unit(&sc->sc_dv);
175 1.54.6.2 mjf
176 1.54.6.2 mjf for (i = 0; i < MAXPARTITIONS; i++) {
177 1.54.6.2 mjf device_register_name(MAKEDISKDEV(cmaj, unit, i), &sc->sc_dv,
178 1.54.6.2 mjf true, DEV_DISK, "rld%d%c", unit, 'a' + i);
179 1.54.6.2 mjf device_register_name(MAKEDISKDEV(bmaj, unit, i), &sc->sc_dv,
180 1.54.6.2 mjf false, DEV_DISK, "ld%d%c", unit, 'a' + i);
181 1.54.6.2 mjf }
182 1.54.6.2 mjf
183 1.1 ad }
184 1.1 ad
185 1.3 ad int
186 1.37 christos ldadjqparam(struct ld_softc *sc, int xmax)
187 1.3 ad {
188 1.24 thorpej int s;
189 1.7 ad
190 1.7 ad s = splbio();
191 1.37 christos sc->sc_maxqueuecnt = xmax;
192 1.7 ad splx(s);
193 1.7 ad
194 1.24 thorpej return (0);
195 1.7 ad }
196 1.7 ad
197 1.7 ad int
198 1.7 ad ldbegindetach(struct ld_softc *sc, int flags)
199 1.7 ad {
200 1.24 thorpej int s, rv = 0;
201 1.7 ad
202 1.7 ad if ((sc->sc_flags & LDF_ENABLED) == 0)
203 1.7 ad return (0);
204 1.3 ad
205 1.3 ad if ((flags & DETACH_FORCE) == 0 && sc->sc_dk.dk_openmask != 0)
206 1.3 ad return (EBUSY);
207 1.3 ad
208 1.3 ad s = splbio();
209 1.24 thorpej sc->sc_maxqueuecnt = 0;
210 1.7 ad sc->sc_flags |= LDF_DETACH;
211 1.24 thorpej while (sc->sc_queuecnt > 0) {
212 1.24 thorpej sc->sc_flags |= LDF_DRAIN;
213 1.24 thorpej rv = tsleep(&sc->sc_queuecnt, PRIBIO, "lddrn", 0);
214 1.24 thorpej if (rv)
215 1.24 thorpej break;
216 1.24 thorpej }
217 1.3 ad splx(s);
218 1.7 ad
219 1.7 ad return (rv);
220 1.3 ad }
221 1.3 ad
222 1.2 ad void
223 1.7 ad ldenddetach(struct ld_softc *sc)
224 1.2 ad {
225 1.13 drochner int s, bmaj, cmaj, i, mn;
226 1.2 ad
227 1.7 ad if ((sc->sc_flags & LDF_ENABLED) == 0)
228 1.7 ad return;
229 1.7 ad
230 1.2 ad /* Wait for commands queued with the hardware to complete. */
231 1.2 ad if (sc->sc_queuecnt != 0)
232 1.7 ad if (tsleep(&sc->sc_queuecnt, PRIBIO, "lddtch", 30 * hz))
233 1.7 ad printf("%s: not drained\n", sc->sc_dv.dv_xname);
234 1.2 ad
235 1.54.6.3 mjf device_deregister_all(&sc->sc_dv);
236 1.54.6.2 mjf
237 1.2 ad /* Locate the major numbers. */
238 1.16 gehenna bmaj = bdevsw_lookup_major(&ld_bdevsw);
239 1.16 gehenna cmaj = cdevsw_lookup_major(&ld_cdevsw);
240 1.2 ad
241 1.2 ad /* Kill off any queued buffers. */
242 1.2 ad s = splbio();
243 1.38 yamt bufq_drain(sc->sc_bufq);
244 1.36 yamt splx(s);
245 1.36 yamt
246 1.38 yamt bufq_free(sc->sc_bufq);
247 1.2 ad
248 1.2 ad /* Nuke the vnodes for any open instances. */
249 1.13 drochner for (i = 0; i < MAXPARTITIONS; i++) {
250 1.40 thorpej mn = DISKMINOR(device_unit(&sc->sc_dv), i);
251 1.13 drochner vdevgone(bmaj, mn, mn, VBLK);
252 1.13 drochner vdevgone(cmaj, mn, mn, VCHR);
253 1.13 drochner }
254 1.13 drochner
255 1.30 thorpej /* Delete all of our wedges. */
256 1.30 thorpej dkwedge_delall(&sc->sc_dk);
257 1.30 thorpej
258 1.2 ad /* Detach from the disk list. */
259 1.2 ad disk_detach(&sc->sc_dk);
260 1.50 ad disk_destroy(&sc->sc_dk);
261 1.2 ad
262 1.2 ad #if NRND > 0
263 1.2 ad /* Unhook the entropy source. */
264 1.2 ad rnd_detach_source(&sc->sc_rnd_source);
265 1.2 ad #endif
266 1.2 ad
267 1.54.6.1 mjf /* Deregister with PMF */
268 1.54.6.1 mjf pmf_device_deregister(&sc->sc_dv);
269 1.54.6.1 mjf
270 1.24 thorpej /*
271 1.24 thorpej * XXX We can't really flush the cache here, beceause the
272 1.24 thorpej * XXX device may already be non-existent from the controller's
273 1.24 thorpej * XXX perspective.
274 1.24 thorpej */
275 1.24 thorpej #if 0
276 1.2 ad /* Flush the device's cache. */
277 1.2 ad if (sc->sc_flush != NULL)
278 1.2 ad if ((*sc->sc_flush)(sc) != 0)
279 1.2 ad printf("%s: unable to flush cache\n",
280 1.2 ad sc->sc_dv.dv_xname);
281 1.24 thorpej #endif
282 1.2 ad }
283 1.2 ad
284 1.8 lukem /* ARGSUSED */
285 1.54.6.1 mjf static bool
286 1.54.6.1 mjf ld_shutdown(device_t dev, int flags)
287 1.1 ad {
288 1.54.6.1 mjf struct ld_softc *sc = device_private(dev);
289 1.1 ad
290 1.54.6.1 mjf if (sc->sc_flush != NULL && (*sc->sc_flush)(sc) != 0) {
291 1.54.6.1 mjf printf("%s: unable to flush cache\n", device_xname(dev));
292 1.54.6.1 mjf return false;
293 1.1 ad }
294 1.54.6.1 mjf
295 1.54.6.1 mjf return true;
296 1.1 ad }
297 1.1 ad
298 1.8 lukem /* ARGSUSED */
299 1.29 thorpej static int
300 1.42 christos ldopen(dev_t dev, int flags, int fmt, struct lwp *l)
301 1.1 ad {
302 1.1 ad struct ld_softc *sc;
303 1.30 thorpej int error, unit, part;
304 1.1 ad
305 1.1 ad unit = DISKUNIT(dev);
306 1.30 thorpej if ((sc = device_lookup(&ld_cd, unit)) == NULL)
307 1.1 ad return (ENXIO);
308 1.1 ad if ((sc->sc_flags & LDF_ENABLED) == 0)
309 1.1 ad return (ENODEV);
310 1.1 ad part = DISKPART(dev);
311 1.30 thorpej
312 1.48 ad mutex_enter(&sc->sc_dk.dk_openlock);
313 1.1 ad
314 1.22 thorpej if (sc->sc_dk.dk_openmask == 0) {
315 1.22 thorpej /* Load the partition info if not already loaded. */
316 1.22 thorpej if ((sc->sc_flags & LDF_VLABEL) == 0)
317 1.22 thorpej ldgetdisklabel(sc);
318 1.22 thorpej }
319 1.1 ad
320 1.1 ad /* Check that the partition exists. */
321 1.1 ad if (part != RAW_PART && (part >= sc->sc_dk.dk_label->d_npartitions ||
322 1.1 ad sc->sc_dk.dk_label->d_partitions[part].p_fstype == FS_UNUSED)) {
323 1.30 thorpej error = ENXIO;
324 1.30 thorpej goto bad1;
325 1.1 ad }
326 1.1 ad
327 1.1 ad /* Ensure only one open at a time. */
328 1.1 ad switch (fmt) {
329 1.1 ad case S_IFCHR:
330 1.1 ad sc->sc_dk.dk_copenmask |= (1 << part);
331 1.1 ad break;
332 1.1 ad case S_IFBLK:
333 1.1 ad sc->sc_dk.dk_bopenmask |= (1 << part);
334 1.1 ad break;
335 1.1 ad }
336 1.1 ad sc->sc_dk.dk_openmask =
337 1.1 ad sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask;
338 1.1 ad
339 1.48 ad error = 0;
340 1.30 thorpej bad1:
341 1.48 ad mutex_exit(&sc->sc_dk.dk_openlock);
342 1.30 thorpej return (error);
343 1.1 ad }
344 1.1 ad
345 1.8 lukem /* ARGSUSED */
346 1.29 thorpej static int
347 1.42 christos ldclose(dev_t dev, int flags, int fmt, struct lwp *l)
348 1.1 ad {
349 1.1 ad struct ld_softc *sc;
350 1.48 ad int part, unit;
351 1.1 ad
352 1.1 ad unit = DISKUNIT(dev);
353 1.1 ad part = DISKPART(dev);
354 1.1 ad sc = device_lookup(&ld_cd, unit);
355 1.30 thorpej
356 1.48 ad mutex_enter(&sc->sc_dk.dk_openlock);
357 1.1 ad
358 1.1 ad switch (fmt) {
359 1.1 ad case S_IFCHR:
360 1.1 ad sc->sc_dk.dk_copenmask &= ~(1 << part);
361 1.1 ad break;
362 1.1 ad case S_IFBLK:
363 1.1 ad sc->sc_dk.dk_bopenmask &= ~(1 << part);
364 1.1 ad break;
365 1.1 ad }
366 1.1 ad sc->sc_dk.dk_openmask =
367 1.1 ad sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask;
368 1.1 ad
369 1.22 thorpej if (sc->sc_dk.dk_openmask == 0) {
370 1.22 thorpej if (sc->sc_flush != NULL && (*sc->sc_flush)(sc) != 0)
371 1.1 ad printf("%s: unable to flush cache\n",
372 1.1 ad sc->sc_dv.dv_xname);
373 1.22 thorpej if ((sc->sc_flags & LDF_KLABEL) == 0)
374 1.22 thorpej sc->sc_flags &= ~LDF_VLABEL;
375 1.22 thorpej }
376 1.1 ad
377 1.48 ad mutex_exit(&sc->sc_dk.dk_openlock);
378 1.1 ad return (0);
379 1.1 ad }
380 1.1 ad
381 1.8 lukem /* ARGSUSED */
382 1.29 thorpej static int
383 1.42 christos ldread(dev_t dev, struct uio *uio, int ioflag)
384 1.1 ad {
385 1.1 ad
386 1.1 ad return (physio(ldstrategy, NULL, dev, B_READ, ldminphys, uio));
387 1.1 ad }
388 1.1 ad
389 1.8 lukem /* ARGSUSED */
390 1.29 thorpej static int
391 1.42 christos ldwrite(dev_t dev, struct uio *uio, int ioflag)
392 1.1 ad {
393 1.1 ad
394 1.1 ad return (physio(ldstrategy, NULL, dev, B_WRITE, ldminphys, uio));
395 1.1 ad }
396 1.1 ad
397 1.8 lukem /* ARGSUSED */
398 1.29 thorpej static int
399 1.46 christos ldioctl(dev_t dev, u_long cmd, void *addr, int32_t flag, struct lwp *l)
400 1.1 ad {
401 1.1 ad struct ld_softc *sc;
402 1.52 xtraeme int part, unit, error;
403 1.4 fvdl #ifdef __HAVE_OLD_DISKLABEL
404 1.6 itojun struct disklabel newlabel;
405 1.4 fvdl #endif
406 1.6 itojun struct disklabel *lp;
407 1.1 ad
408 1.1 ad unit = DISKUNIT(dev);
409 1.1 ad part = DISKPART(dev);
410 1.1 ad sc = device_lookup(&ld_cd, unit);
411 1.1 ad
412 1.43 riz error = disk_ioctl(&sc->sc_dk, cmd, addr, flag, l);
413 1.43 riz if (error != EPASSTHROUGH)
414 1.43 riz return (error);
415 1.43 riz
416 1.47 tron error = 0;
417 1.1 ad switch (cmd) {
418 1.1 ad case DIOCGDINFO:
419 1.1 ad memcpy(addr, sc->sc_dk.dk_label, sizeof(struct disklabel));
420 1.1 ad return (0);
421 1.1 ad
422 1.4 fvdl #ifdef __HAVE_OLD_DISKLABEL
423 1.4 fvdl case ODIOCGDINFO:
424 1.4 fvdl newlabel = *(sc->sc_dk.dk_label);
425 1.4 fvdl if (newlabel.d_npartitions > OLDMAXPARTITIONS)
426 1.5 fvdl return ENOTTY;
427 1.4 fvdl memcpy(addr, &newlabel, sizeof(struct olddisklabel));
428 1.4 fvdl return (0);
429 1.4 fvdl #endif
430 1.4 fvdl
431 1.1 ad case DIOCGPART:
432 1.1 ad ((struct partinfo *)addr)->disklab = sc->sc_dk.dk_label;
433 1.1 ad ((struct partinfo *)addr)->part =
434 1.1 ad &sc->sc_dk.dk_label->d_partitions[part];
435 1.1 ad break;
436 1.1 ad
437 1.1 ad case DIOCWDINFO:
438 1.1 ad case DIOCSDINFO:
439 1.4 fvdl #ifdef __HAVE_OLD_DISKLABEL
440 1.4 fvdl case ODIOCWDINFO:
441 1.4 fvdl case ODIOCSDINFO:
442 1.4 fvdl
443 1.4 fvdl if (cmd == ODIOCSDINFO || cmd == ODIOCWDINFO) {
444 1.4 fvdl memset(&newlabel, 0, sizeof newlabel);
445 1.4 fvdl memcpy(&newlabel, addr, sizeof (struct olddisklabel));
446 1.4 fvdl lp = &newlabel;
447 1.4 fvdl } else
448 1.4 fvdl #endif
449 1.4 fvdl lp = (struct disklabel *)addr;
450 1.4 fvdl
451 1.1 ad if ((flag & FWRITE) == 0)
452 1.1 ad return (EBADF);
453 1.1 ad
454 1.48 ad mutex_enter(&sc->sc_dk.dk_openlock);
455 1.1 ad sc->sc_flags |= LDF_LABELLING;
456 1.1 ad
457 1.1 ad error = setdisklabel(sc->sc_dk.dk_label,
458 1.4 fvdl lp, /*sc->sc_dk.dk_openmask : */0,
459 1.1 ad sc->sc_dk.dk_cpulabel);
460 1.4 fvdl if (error == 0 && (cmd == DIOCWDINFO
461 1.4 fvdl #ifdef __HAVE_OLD_DISKLABEL
462 1.4 fvdl || cmd == ODIOCWDINFO
463 1.4 fvdl #endif
464 1.4 fvdl ))
465 1.1 ad error = writedisklabel(
466 1.35 perry MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART),
467 1.35 perry ldstrategy, sc->sc_dk.dk_label,
468 1.1 ad sc->sc_dk.dk_cpulabel);
469 1.1 ad
470 1.1 ad sc->sc_flags &= ~LDF_LABELLING;
471 1.48 ad mutex_exit(&sc->sc_dk.dk_openlock);
472 1.1 ad break;
473 1.1 ad
474 1.22 thorpej case DIOCKLABEL:
475 1.22 thorpej if ((flag & FWRITE) == 0)
476 1.22 thorpej return (EBADF);
477 1.22 thorpej if (*(int *)addr)
478 1.22 thorpej sc->sc_flags |= LDF_KLABEL;
479 1.22 thorpej else
480 1.22 thorpej sc->sc_flags &= ~LDF_KLABEL;
481 1.22 thorpej break;
482 1.22 thorpej
483 1.1 ad case DIOCWLABEL:
484 1.1 ad if ((flag & FWRITE) == 0)
485 1.1 ad return (EBADF);
486 1.1 ad if (*(int *)addr)
487 1.1 ad sc->sc_flags |= LDF_WLABEL;
488 1.1 ad else
489 1.1 ad sc->sc_flags &= ~LDF_WLABEL;
490 1.1 ad break;
491 1.1 ad
492 1.1 ad case DIOCGDEFLABEL:
493 1.1 ad ldgetdefaultlabel(sc, (struct disklabel *)addr);
494 1.1 ad break;
495 1.4 fvdl
496 1.4 fvdl #ifdef __HAVE_OLD_DISKLABEL
497 1.4 fvdl case ODIOCGDEFLABEL:
498 1.4 fvdl ldgetdefaultlabel(sc, &newlabel);
499 1.4 fvdl if (newlabel.d_npartitions > OLDMAXPARTITIONS)
500 1.5 fvdl return ENOTTY;
501 1.4 fvdl memcpy(addr, &newlabel, sizeof (struct olddisklabel));
502 1.4 fvdl break;
503 1.4 fvdl #endif
504 1.1 ad
505 1.32 thorpej case DIOCCACHESYNC:
506 1.32 thorpej /*
507 1.32 thorpej * XXX Do we really need to care about having a writable
508 1.32 thorpej * file descriptor here?
509 1.32 thorpej */
510 1.32 thorpej if ((flag & FWRITE) == 0)
511 1.32 thorpej error = EBADF;
512 1.32 thorpej else if (sc->sc_flush)
513 1.32 thorpej error = (*sc->sc_flush)(sc);
514 1.32 thorpej else
515 1.32 thorpej error = 0; /* XXX Error out instead? */
516 1.32 thorpej break;
517 1.32 thorpej
518 1.30 thorpej case DIOCAWEDGE:
519 1.30 thorpej {
520 1.30 thorpej struct dkwedge_info *dkw = (void *) addr;
521 1.30 thorpej
522 1.30 thorpej if ((flag & FWRITE) == 0)
523 1.30 thorpej return (EBADF);
524 1.30 thorpej
525 1.30 thorpej /* If the ioctl happens here, the parent is us. */
526 1.30 thorpej strcpy(dkw->dkw_parent, sc->sc_dv.dv_xname);
527 1.30 thorpej return (dkwedge_add(dkw));
528 1.30 thorpej }
529 1.35 perry
530 1.30 thorpej case DIOCDWEDGE:
531 1.30 thorpej {
532 1.30 thorpej struct dkwedge_info *dkw = (void *) addr;
533 1.30 thorpej
534 1.30 thorpej if ((flag & FWRITE) == 0)
535 1.30 thorpej return (EBADF);
536 1.30 thorpej
537 1.30 thorpej /* If the ioctl happens here, the parent is us. */
538 1.30 thorpej strcpy(dkw->dkw_parent, sc->sc_dv.dv_xname);
539 1.30 thorpej return (dkwedge_del(dkw));
540 1.30 thorpej }
541 1.35 perry
542 1.30 thorpej case DIOCLWEDGES:
543 1.30 thorpej {
544 1.30 thorpej struct dkwedge_list *dkwl = (void *) addr;
545 1.30 thorpej
546 1.39 christos return (dkwedge_list(&sc->sc_dk, dkwl, l));
547 1.30 thorpej }
548 1.51 xtraeme case DIOCGSTRATEGY:
549 1.51 xtraeme {
550 1.51 xtraeme struct disk_strategy *dks = (void *)addr;
551 1.51 xtraeme
552 1.52 xtraeme mutex_enter(&sc->sc_mutex);
553 1.51 xtraeme strlcpy(dks->dks_name, bufq_getstrategyname(sc->sc_bufq),
554 1.51 xtraeme sizeof(dks->dks_name));
555 1.52 xtraeme mutex_exit(&sc->sc_mutex);
556 1.51 xtraeme dks->dks_paramlen = 0;
557 1.51 xtraeme
558 1.51 xtraeme return 0;
559 1.51 xtraeme }
560 1.51 xtraeme case DIOCSSTRATEGY:
561 1.51 xtraeme {
562 1.51 xtraeme struct disk_strategy *dks = (void *)addr;
563 1.51 xtraeme struct bufq_state *new, *old;
564 1.30 thorpej
565 1.51 xtraeme if ((flag & FWRITE) == 0)
566 1.51 xtraeme return EPERM;
567 1.51 xtraeme
568 1.51 xtraeme if (dks->dks_param != NULL)
569 1.51 xtraeme return EINVAL;
570 1.51 xtraeme
571 1.51 xtraeme dks->dks_name[sizeof(dks->dks_name) - 1] = 0; /* ensure term */
572 1.51 xtraeme error = bufq_alloc(&new, dks->dks_name,
573 1.51 xtraeme BUFQ_EXACT|BUFQ_SORT_RAWBLOCK);
574 1.51 xtraeme if (error)
575 1.51 xtraeme return error;
576 1.51 xtraeme
577 1.52 xtraeme mutex_enter(&sc->sc_mutex);
578 1.51 xtraeme old = sc->sc_bufq;
579 1.51 xtraeme bufq_move(new, old);
580 1.51 xtraeme sc->sc_bufq = new;
581 1.52 xtraeme mutex_exit(&sc->sc_mutex);
582 1.51 xtraeme bufq_free(old);
583 1.51 xtraeme
584 1.51 xtraeme return 0;
585 1.51 xtraeme }
586 1.1 ad default:
587 1.1 ad error = ENOTTY;
588 1.1 ad break;
589 1.1 ad }
590 1.1 ad
591 1.1 ad return (error);
592 1.1 ad }
593 1.1 ad
594 1.29 thorpej static void
595 1.1 ad ldstrategy(struct buf *bp)
596 1.1 ad {
597 1.1 ad struct ld_softc *sc;
598 1.23 thorpej struct disklabel *lp;
599 1.23 thorpej daddr_t blkno;
600 1.23 thorpej int s, part;
601 1.1 ad
602 1.1 ad sc = device_lookup(&ld_cd, DISKUNIT(bp->b_dev));
603 1.23 thorpej part = DISKPART(bp->b_dev);
604 1.1 ad
605 1.7 ad if ((sc->sc_flags & LDF_DETACH) != 0) {
606 1.2 ad bp->b_error = EIO;
607 1.49 ad goto done;
608 1.2 ad }
609 1.2 ad
610 1.1 ad lp = sc->sc_dk.dk_label;
611 1.1 ad
612 1.1 ad /*
613 1.1 ad * The transfer must be a whole number of blocks and the offset must
614 1.1 ad * not be negative.
615 1.1 ad */
616 1.1 ad if ((bp->b_bcount % lp->d_secsize) != 0 || bp->b_blkno < 0) {
617 1.23 thorpej bp->b_error = EINVAL;
618 1.49 ad goto done;
619 1.1 ad }
620 1.1 ad
621 1.23 thorpej /* If it's a null transfer, return immediately. */
622 1.23 thorpej if (bp->b_bcount == 0)
623 1.23 thorpej goto done;
624 1.1 ad
625 1.1 ad /*
626 1.1 ad * Do bounds checking and adjust the transfer. If error, process.
627 1.1 ad * If past the end of partition, just return.
628 1.1 ad */
629 1.1 ad if (part != RAW_PART &&
630 1.20 thorpej bounds_check_with_label(&sc->sc_dk, bp,
631 1.1 ad (sc->sc_flags & (LDF_WLABEL | LDF_LABELLING)) != 0) <= 0) {
632 1.23 thorpej goto done;
633 1.1 ad }
634 1.1 ad
635 1.1 ad /*
636 1.23 thorpej * Convert the block number to absolute and put it in terms
637 1.23 thorpej * of the device's logical block size.
638 1.1 ad */
639 1.23 thorpej if (lp->d_secsize == DEV_BSIZE)
640 1.23 thorpej blkno = bp->b_blkno;
641 1.23 thorpej else if (lp->d_secsize > DEV_BSIZE)
642 1.23 thorpej blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE);
643 1.1 ad else
644 1.23 thorpej blkno = bp->b_blkno * (DEV_BSIZE / lp->d_secsize);
645 1.1 ad
646 1.11 thorpej if (part != RAW_PART)
647 1.23 thorpej blkno += lp->d_partitions[part].p_offset;
648 1.23 thorpej
649 1.23 thorpej bp->b_rawblkno = blkno;
650 1.1 ad
651 1.1 ad s = splbio();
652 1.44 ad ldstart(sc, bp);
653 1.1 ad splx(s);
654 1.23 thorpej return;
655 1.23 thorpej
656 1.23 thorpej done:
657 1.23 thorpej bp->b_resid = bp->b_bcount;
658 1.23 thorpej biodone(bp);
659 1.23 thorpej }
660 1.23 thorpej
661 1.23 thorpej static void
662 1.44 ad ldstart(struct ld_softc *sc, struct buf *bp)
663 1.23 thorpej {
664 1.23 thorpej int error;
665 1.1 ad
666 1.44 ad mutex_enter(&sc->sc_mutex);
667 1.44 ad
668 1.44 ad if (bp != NULL)
669 1.44 ad BUFQ_PUT(sc->sc_bufq, bp);
670 1.44 ad
671 1.23 thorpej while (sc->sc_queuecnt < sc->sc_maxqueuecnt) {
672 1.23 thorpej /* See if there is work to do. */
673 1.38 yamt if ((bp = BUFQ_PEEK(sc->sc_bufq)) == NULL)
674 1.23 thorpej break;
675 1.23 thorpej
676 1.23 thorpej disk_busy(&sc->sc_dk);
677 1.23 thorpej sc->sc_queuecnt++;
678 1.23 thorpej
679 1.23 thorpej if (__predict_true((error = (*sc->sc_start)(sc, bp)) == 0)) {
680 1.23 thorpej /*
681 1.23 thorpej * The back-end is running the job; remove it from
682 1.23 thorpej * the queue.
683 1.23 thorpej */
684 1.38 yamt (void) BUFQ_GET(sc->sc_bufq);
685 1.23 thorpej } else {
686 1.23 thorpej disk_unbusy(&sc->sc_dk, 0, (bp->b_flags & B_READ));
687 1.23 thorpej sc->sc_queuecnt--;
688 1.23 thorpej if (error == EAGAIN) {
689 1.23 thorpej /*
690 1.23 thorpej * Temporary resource shortage in the
691 1.23 thorpej * back-end; just defer the job until
692 1.23 thorpej * later.
693 1.23 thorpej *
694 1.23 thorpej * XXX We might consider a watchdog timer
695 1.23 thorpej * XXX to make sure we are kicked into action.
696 1.23 thorpej */
697 1.23 thorpej break;
698 1.23 thorpej } else {
699 1.38 yamt (void) BUFQ_GET(sc->sc_bufq);
700 1.23 thorpej bp->b_error = error;
701 1.23 thorpej bp->b_resid = bp->b_bcount;
702 1.44 ad mutex_exit(&sc->sc_mutex);
703 1.23 thorpej biodone(bp);
704 1.44 ad mutex_enter(&sc->sc_mutex);
705 1.23 thorpej }
706 1.23 thorpej }
707 1.1 ad }
708 1.44 ad
709 1.44 ad mutex_exit(&sc->sc_mutex);
710 1.1 ad }
711 1.1 ad
712 1.1 ad void
713 1.1 ad lddone(struct ld_softc *sc, struct buf *bp)
714 1.1 ad {
715 1.1 ad
716 1.49 ad if (bp->b_error != 0) {
717 1.1 ad diskerr(bp, "ld", "error", LOG_PRINTF, 0, sc->sc_dk.dk_label);
718 1.1 ad printf("\n");
719 1.1 ad }
720 1.1 ad
721 1.18 mrg disk_unbusy(&sc->sc_dk, bp->b_bcount - bp->b_resid,
722 1.18 mrg (bp->b_flags & B_READ));
723 1.1 ad #if NRND > 0
724 1.1 ad rnd_add_uint32(&sc->sc_rnd_source, bp->b_rawblkno);
725 1.1 ad #endif
726 1.1 ad biodone(bp);
727 1.1 ad
728 1.44 ad mutex_enter(&sc->sc_mutex);
729 1.7 ad if (--sc->sc_queuecnt <= sc->sc_maxqueuecnt) {
730 1.24 thorpej if ((sc->sc_flags & LDF_DRAIN) != 0) {
731 1.24 thorpej sc->sc_flags &= ~LDF_DRAIN;
732 1.7 ad wakeup(&sc->sc_queuecnt);
733 1.24 thorpej }
734 1.44 ad mutex_exit(&sc->sc_mutex);
735 1.44 ad ldstart(sc, NULL);
736 1.44 ad } else
737 1.44 ad mutex_exit(&sc->sc_mutex);
738 1.1 ad }
739 1.1 ad
740 1.29 thorpej static int
741 1.1 ad ldsize(dev_t dev)
742 1.1 ad {
743 1.1 ad struct ld_softc *sc;
744 1.1 ad int part, unit, omask, size;
745 1.1 ad
746 1.1 ad unit = DISKUNIT(dev);
747 1.1 ad if ((sc = device_lookup(&ld_cd, unit)) == NULL)
748 1.1 ad return (ENODEV);
749 1.1 ad if ((sc->sc_flags & LDF_ENABLED) == 0)
750 1.1 ad return (ENODEV);
751 1.1 ad part = DISKPART(dev);
752 1.1 ad
753 1.1 ad omask = sc->sc_dk.dk_openmask & (1 << part);
754 1.1 ad
755 1.1 ad if (omask == 0 && ldopen(dev, 0, S_IFBLK, NULL) != 0)
756 1.1 ad return (-1);
757 1.1 ad else if (sc->sc_dk.dk_label->d_partitions[part].p_fstype != FS_SWAP)
758 1.1 ad size = -1;
759 1.1 ad else
760 1.1 ad size = sc->sc_dk.dk_label->d_partitions[part].p_size *
761 1.1 ad (sc->sc_dk.dk_label->d_secsize / DEV_BSIZE);
762 1.1 ad if (omask == 0 && ldclose(dev, 0, S_IFBLK, NULL) != 0)
763 1.1 ad return (-1);
764 1.1 ad
765 1.1 ad return (size);
766 1.1 ad }
767 1.1 ad
768 1.1 ad /*
769 1.1 ad * Load the label information from the specified device.
770 1.1 ad */
771 1.1 ad static void
772 1.1 ad ldgetdisklabel(struct ld_softc *sc)
773 1.1 ad {
774 1.1 ad const char *errstring;
775 1.1 ad
776 1.1 ad ldgetdefaultlabel(sc, sc->sc_dk.dk_label);
777 1.1 ad
778 1.1 ad /* Call the generic disklabel extraction routine. */
779 1.40 thorpej errstring = readdisklabel(MAKEDISKDEV(0, device_unit(&sc->sc_dv),
780 1.40 thorpej RAW_PART), ldstrategy, sc->sc_dk.dk_label, sc->sc_dk.dk_cpulabel);
781 1.1 ad if (errstring != NULL)
782 1.1 ad printf("%s: %s\n", sc->sc_dv.dv_xname, errstring);
783 1.22 thorpej
784 1.22 thorpej /* In-core label now valid. */
785 1.22 thorpej sc->sc_flags |= LDF_VLABEL;
786 1.1 ad }
787 1.1 ad
788 1.1 ad /*
789 1.1 ad * Construct a ficticious label.
790 1.1 ad */
791 1.1 ad static void
792 1.1 ad ldgetdefaultlabel(struct ld_softc *sc, struct disklabel *lp)
793 1.1 ad {
794 1.1 ad
795 1.1 ad memset(lp, 0, sizeof(struct disklabel));
796 1.1 ad
797 1.1 ad lp->d_secsize = sc->sc_secsize;
798 1.1 ad lp->d_ntracks = sc->sc_nheads;
799 1.1 ad lp->d_nsectors = sc->sc_nsectors;
800 1.1 ad lp->d_ncylinders = sc->sc_ncylinders;
801 1.1 ad lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
802 1.1 ad lp->d_type = DTYPE_LD;
803 1.21 itojun strlcpy(lp->d_typename, "unknown", sizeof(lp->d_typename));
804 1.21 itojun strlcpy(lp->d_packname, "fictitious", sizeof(lp->d_packname));
805 1.1 ad lp->d_secperunit = sc->sc_secperunit;
806 1.1 ad lp->d_rpm = 7200;
807 1.1 ad lp->d_interleave = 1;
808 1.1 ad lp->d_flags = 0;
809 1.1 ad
810 1.1 ad lp->d_partitions[RAW_PART].p_offset = 0;
811 1.1 ad lp->d_partitions[RAW_PART].p_size =
812 1.1 ad lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
813 1.1 ad lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
814 1.1 ad lp->d_npartitions = RAW_PART + 1;
815 1.1 ad
816 1.1 ad lp->d_magic = DISKMAGIC;
817 1.1 ad lp->d_magic2 = DISKMAGIC;
818 1.1 ad lp->d_checksum = dkcksum(lp);
819 1.1 ad }
820 1.1 ad
821 1.1 ad /*
822 1.1 ad * Take a dump.
823 1.1 ad */
824 1.29 thorpej static int
825 1.46 christos lddump(dev_t dev, daddr_t blkno, void *vav, size_t size)
826 1.1 ad {
827 1.46 christos char *va = vav;
828 1.1 ad struct ld_softc *sc;
829 1.1 ad struct disklabel *lp;
830 1.1 ad int unit, part, nsects, sectoff, towrt, nblk, maxblkcnt, rv;
831 1.1 ad static int dumping;
832 1.1 ad
833 1.1 ad unit = DISKUNIT(dev);
834 1.1 ad if ((sc = device_lookup(&ld_cd, unit)) == NULL)
835 1.1 ad return (ENXIO);
836 1.1 ad if ((sc->sc_flags & LDF_ENABLED) == 0)
837 1.1 ad return (ENODEV);
838 1.3 ad if (sc->sc_dump == NULL)
839 1.3 ad return (ENXIO);
840 1.3 ad
841 1.3 ad /* Check if recursive dump; if so, punt. */
842 1.3 ad if (dumping)
843 1.3 ad return (EFAULT);
844 1.3 ad dumping = 1;
845 1.1 ad
846 1.1 ad /* Convert to disk sectors. Request must be a multiple of size. */
847 1.3 ad part = DISKPART(dev);
848 1.1 ad lp = sc->sc_dk.dk_label;
849 1.1 ad if ((size % lp->d_secsize) != 0)
850 1.1 ad return (EFAULT);
851 1.1 ad towrt = size / lp->d_secsize;
852 1.1 ad blkno = dbtob(blkno) / lp->d_secsize; /* blkno in DEV_BSIZE units */
853 1.1 ad
854 1.1 ad nsects = lp->d_partitions[part].p_size;
855 1.1 ad sectoff = lp->d_partitions[part].p_offset;
856 1.1 ad
857 1.1 ad /* Check transfer bounds against partition size. */
858 1.1 ad if ((blkno < 0) || ((blkno + towrt) > nsects))
859 1.1 ad return (EINVAL);
860 1.1 ad
861 1.1 ad /* Offset block number to start of partition. */
862 1.1 ad blkno += sectoff;
863 1.1 ad
864 1.1 ad /* Start dumping and return when done. */
865 1.3 ad maxblkcnt = sc->sc_maxxfer / sc->sc_secsize - 1;
866 1.1 ad while (towrt > 0) {
867 1.3 ad nblk = min(maxblkcnt, towrt);
868 1.1 ad
869 1.1 ad if ((rv = (*sc->sc_dump)(sc, va, blkno, nblk)) != 0)
870 1.1 ad return (rv);
871 1.1 ad
872 1.1 ad towrt -= nblk;
873 1.1 ad blkno += nblk;
874 1.1 ad va += nblk * sc->sc_secsize;
875 1.1 ad }
876 1.1 ad
877 1.1 ad dumping = 0;
878 1.1 ad return (0);
879 1.1 ad }
880 1.1 ad
881 1.1 ad /*
882 1.1 ad * Adjust the size of a transfer.
883 1.1 ad */
884 1.1 ad static void
885 1.1 ad ldminphys(struct buf *bp)
886 1.1 ad {
887 1.1 ad struct ld_softc *sc;
888 1.1 ad
889 1.1 ad sc = device_lookup(&ld_cd, DISKUNIT(bp->b_dev));
890 1.1 ad
891 1.1 ad if (bp->b_bcount > sc->sc_maxxfer)
892 1.1 ad bp->b_bcount = sc->sc_maxxfer;
893 1.1 ad minphys(bp);
894 1.1 ad }
895 1.43 riz
896 1.43 riz static void
897 1.43 riz ld_set_properties(struct ld_softc *ld)
898 1.43 riz {
899 1.43 riz prop_dictionary_t disk_info, odisk_info, geom;
900 1.43 riz
901 1.43 riz disk_info = prop_dictionary_create();
902 1.43 riz
903 1.43 riz geom = prop_dictionary_create();
904 1.43 riz
905 1.43 riz prop_dictionary_set_uint64(geom, "sectors-per-unit",
906 1.43 riz ld->sc_secperunit);
907 1.43 riz
908 1.43 riz prop_dictionary_set_uint32(geom, "sector-size",
909 1.43 riz ld->sc_secsize);
910 1.43 riz
911 1.43 riz prop_dictionary_set_uint16(geom, "sectors-per-track",
912 1.43 riz ld->sc_nsectors);
913 1.43 riz
914 1.43 riz prop_dictionary_set_uint16(geom, "tracks-per-cylinder",
915 1.43 riz ld->sc_nheads);
916 1.43 riz
917 1.43 riz prop_dictionary_set_uint64(geom, "cylinders-per-unit",
918 1.43 riz ld->sc_ncylinders);
919 1.43 riz
920 1.43 riz prop_dictionary_set(disk_info, "geometry", geom);
921 1.43 riz prop_object_release(geom);
922 1.43 riz
923 1.43 riz prop_dictionary_set(device_properties(&ld->sc_dv),
924 1.43 riz "disk-info", disk_info);
925 1.43 riz
926 1.43 riz /*
927 1.43 riz * Don't release disk_info here; we keep a reference to it.
928 1.43 riz * disk_detach() will release it when we go away.
929 1.43 riz */
930 1.43 riz
931 1.43 riz odisk_info = ld->sc_dk.dk_info;
932 1.43 riz ld->sc_dk.dk_info = disk_info;
933 1.43 riz if (odisk_info)
934 1.43 riz prop_object_release(odisk_info);
935 1.43 riz }
936 1.45 riz
937 1.45 riz static void
938 1.45 riz ld_config_interrupts (struct device *d)
939 1.45 riz {
940 1.45 riz struct ld_softc *sc = (struct ld_softc *)d;
941 1.45 riz dkwedge_discover(&sc->sc_dk);
942 1.45 riz }
943