Date: Fri, 24 Mar 2006 18:13:53 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 93938 for review Message-ID: <200603241813.k2OIDri0006520@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93938 Change 93938 by kmacy@kmacy_storage:sun4vtmp on 2006/03/24 18:13:23 hook simdisk into vnex Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/simdisk.c#4 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/simdisk.c#4 (text+ko) ==== @@ -1,7 +1,7 @@ /*- - * Copyright (C) 2002 Benno Rice <benno@FreeBSD.org> - * Copyright (C) 2006 Kip Macy <kmacy@FreeBSD.org> + * Copyright (c) 2006 Kip Macy + * Copyright (c) 2001 Benno Rice * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -13,28 +13,22 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * - * - */ - - -/* This is pretty much a rip-off of ofw_disk - it only works on the simulator - * so odds are it will be put out to pasture in a week or two + * $ Exp $ */ - - #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ofw/ofw_disk.c,v 1.18 2005/10/31 03:09:38 grehan Exp $"); +__FBSDID("$$"); #include <sys/param.h> #include <sys/systm.h> @@ -52,6 +46,11 @@ #include <geom/geom.h> +#include <dev/ofw/ofw_bus.h> +#include <dev/ofw/ofw_bus_subr.h> +#include <dev/ofw/openfirm.h> + + #include <machine/hypervisor_api.h> #define HVD_BLOCKSIZE 512 @@ -139,9 +138,6 @@ curthread->td_base_pri = PRIBIO; for (;;) { -#if 0 - printf("in hvd_kthread\n"); -#endif mtx_lock(&sc->hvd_queue_mtx); bp = bioq_takefirst(&sc->hvd_bio_queue); if (!bp) { @@ -218,3 +214,40 @@ return (ENXIO); return (0); } + +static int +hvd_probe(device_t dev) +{ + + if (strcmp(ofw_bus_get_name(dev), "disk")) + return (ENXIO); + + device_set_desc(dev, "sun4v virtual disk"); + + return (0); +} + + +static int +hvd_attach(device_t dev) +{ + return (0); +} + +static device_method_t hvd_methods[] = { + DEVMETHOD(device_probe, hvd_probe), + DEVMETHOD(device_attach, hvd_attach), + {0, 0} +}; + + +static driver_t hvd_driver = { + "hvd", + hvd_methods, + 0, +}; + + +static devclass_t hvd_devclass; + +DRIVER_MODULE(hvd, vnex, hvd_driver, hvd_devclass, 0, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603241813.k2OIDri0006520>