pv_cmdk.c revision eb0cc229f19c437a6b538d3ac0d0443268290b7e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/xpv_support.h>
#include <public/grant_table.h>
/*
* General Notes
*
* We don't support disks with bad block mappins. We have this
* limitation because the underlying xdf driver doesn't support
* bad block remapping. If there is a need to support this feature
* it should be added directly to the xdf driver and we should just
* pass requests strait on through and let it handle the remapping.
* Also, it's probably worth pointing out that most modern disks do bad
* block remapping internally in the hardware so there's actually less
* of a chance of us ever discovering bad blocks. Also, in most cases
* this driver (and the xdf driver) will only be used with virtualized
* devices, so one might wonder why a virtual device would ever actually
* experience bad blocks. To wrap this up, you might be wondering how
* these bad block mappings get created and how they are managed. Well,
* there are two tools for managing bad block mappings, format(1M) and
* addbadsec(1M). Format(1M) can be used to do a surface scan of a disk
* to attempt to find bad block and create mappings for them. Format(1M)
* and addbadsec(1M) can also be used to edit existing mappings that may
* be saved on the disk.
*
* The underlying PV driver that this driver passes on requests to is the
* xdf driver. Since in most cases the xdf driver doesn't deal with
* physical disks it has it's own algorithm for assigning a physical
* geometry to a virtual disk (ie, cylinder count, head count, etc.)
* The default values chosen by the xdf driver may not match those
* assigned to a disk by a hardware disk emulator in an HVM environment.
* This is a problem since these physical geometry attributes affect
* things like the partition table, backup label location, etc. So
* to emulate disk devices correctly we need to know the physical geometry
* that was assigned to a disk at the time of it's initalization.
* Normally in an HVM environment this information will passed to
* the BIOS and operating system from the hardware emulator that is
* emulating the disk devices. In the case of a solaris dom0+xvm
* this would be qemu. So to work around this issue, this driver will
* query the emulated hardware to get the assigned physical geometry
* and then pass this geometry onto the xdf driver so that it can use it.
* But really, this information is essentially metadata about the disk
* that should be kept with the disk image itself. (Assuming or course
* that a disk image is the actual backingstore for this emulated device.)
* This metadata should also be made available to PV drivers via a common
* mechamisn, probably the xenstore. The fact that this metadata isn't
* available outside of HVM domains means that it's difficult to move
* disks between HVM and PV domains, since a fully PV domain will have no
* way of knowing what the correct geometry of the target device is.
* (Short of reading the disk, looking for things like partition tables
* and labels, and taking a best guess at what the geometry was when
* the disk was initialized. Unsuprisingly, qemu actually does this.)
*
* This driver has to map cmdk device instances into their corresponding
* xdf device instances. We have to do this to ensure that when a user
* accesses a emulated cmdk device we map those accesses to the proper
* paravirtualized device. Basically what we need to know is how multiple
* 'disk' entries in a domU configuration file get mapped to emulated
* cmdk devices and to xdf devices. The 'disk' entry to xdf instance
* mappings we know because those are done within the Solaris xvdi code
* and the xpvd nexus driver. But the config to emulated devices mappings
* are handled entirely within the xen management tool chain and the
* hardware emulator. Since all the tools that establish these mappings
* live in dom0, dom0 should really supply us with this information,
* probably via the xenstore. Unfortunatly it doesn't so, since there's
* no good way to determine this mapping dynamically, this driver uses
* a hard coded set of static mappings. These mappings are hardware
* emulator specific because each different hardware emulator could have
* a different device tree with different cmdk device paths. This
* means that if we want to continue to use this static mapping approach
* to allow Solaris to run on different hardware emulators we'll have
* to analyze each of those emulators to determine what paths they
* use and hard code those paths into this driver. yech. This metadata
* really needs to be supplied to us by dom0.
*
* This driver access underlying xdf nodes. Unfortunatly, devices
* must create minor nodes during attach, and for disk devices to create
* minor nodes, they have to look at the label on the disk, so this means
* that disk drivers must be able to access a disk contents during
* attach. That means that this disk driver must be able to access
* underlying xdf nodes during attach. Unfortunatly, due to device tree
* locking restrictions, we cannot have an attach operation occuring on
* this device and then attempt to access another device which may
* cause another attach to occur in a different device tree branch
* since this could result in deadlock. Hence, this driver can only
* access xdf device nodes that we know are attached, and it can't use
* any ddi interfaces to access those nodes if those interfaces could
* trigger an attach of the xdf device. So this driver works around
* these restrictions by talking directly to xdf devices via
* xdf_hvm_hold(). This interface takes a pathname to an xdf device,
* and if that device is already attached then it returns the a held dip
* pointer for that device node. This prevents us from getting into
* deadlock situations, but now we need a mechanism to ensure that all
* the xdf device nodes this driver might access are attached before
* this driver tries to access them. This is accomplished via the
* hvmboot_rootconf() callback which is invoked just before root is
* mounted. hvmboot_rootconf() will attach xpvd and tell it to configure
* all xdf device visible to the system. All these xdf device nodes
* will also be marked with the "ddi-no-autodetach" property so that
* once they are configured, the will not be automatically unconfigured.
* The only way that they could be unconfigured is if the administrator
* explicitly attempts to unload required modules via rem_drv(1M)
* or modunload(1M).
*/
/*
* 16 paritions + fdisk (see xdf.h)
*/
#define PV_CMDK_NODES 4
typedef struct hvm_to_pv {
char *h2p_hvm_path;
char *h2p_pv_path;
} hvm_to_pv_t;
/*
*/
static hvm_to_pv_t pv_cmdk_h2p_xen_qemu[] = {
/*
* The paths mapping here are very specific to xen and qemu. When a
* domU is booted under xen in HVM mode, qemu is normally used to
* emulate up to four ide disks. These disks always have the four
* path listed below. To configure an emulated ide device, the
* xen domain configuration file normally has an entry that looks
* like this:
* disk = [ 'file:/foo.img,hda,w' ]
*
* The part we're interested in is the 'hda', which we'll call the
* xen disk device name here. The xen management tools (which parse
* the xen domain configuration file and launch qemu) makes the
* following assumptions about this value:
* hda == emulated ide disk 0 (ide bus 0, master)
* hdb == emulated ide disk 1 (ide bus 0, slave)
* hdc == emulated ide disk 2 (ide bus 1, master)
* hdd == emulated ide disk 3 (ide bus 1, slave)
*
* (Uncoincidentally, these xen disk device names actually map to
* the /dev filesystem names of ide disk devices in Linux. So in
* our mapping we've just hardcoded the cmdk paths that we know
* qemu will use.
*
* To understand the second half of the mapping (ie, the xdf device
* that each emulated cmdk device should be mapped two) we need to
* know the solaris device node address that will be assigned to
* each xdf device. (The device node address is the hex number that
* comes after the "xdf@" in the device path.)
*
* Normally when a domU is run in non-HVM mode, the xen disk device
* names in the xen domain configuration file are specified with
* integers instead of Linux device names. (for example, '0' would
* be used instead of 'hda'.) So in the non-HVM case we simply
* convert the xen disk device name (which is an interger) into a
* hex number and use it as the Solaris xdf device node address.
* But when we're running in HVM mode then we have a string for the
* xen disk device name, so we can't simply use that as a solaris
* device node address. Instead we fall back to using the xenstore
* device id for the xen disk device as the xdf device node address.
* The xdf device node address assignment happens in xvdi_init_dev().
*
* So the question becomes, how do we know what the xenstore device
* id for emulated disk will be? Well, it turns out that since the
* xen management tools expect the disk device names to be Linux
* device names, those same management tools assign each disk a
* device id that matches the dev_t of the corresponding device
* under Linux. (Big shocker.) This xen device name-to-id mapping
* is currently all hard coded here:
*
* So looking at the code above we can see the following xen disk
* device name to xenstore device id mappings:
* 'hda' --> 0x300 == 0t768 == ((3 * 256) + (0 * 64))
* 'hdb' --> 0x340 == 0t832 == ((3 * 256) + (1 * 64))
* 'hdc' --> 0x1600 == 0t5632 == ((22 * 256) + (0 * 64))
* 'hdd' --> 0x1640 == 0t5696 == ((22 * 256) + (1 * 64))
*/
{ NULL, 0 }
};
typedef struct pv_cmdk {
} pv_cmdk_t;
/*
* Globals
*/
static void *pv_cmdk_state;
static major_t pv_cmdk_major;
static hvm_to_pv_t *pv_cmdk_h2p;
/*
* Function prototypes for xdf callback functions
*/
extern int xdf_lb_getinfo(dev_info_t *, int, void *, void *);
void *);
static boolean_t
{
int otyp;
return (B_TRUE);
}
return (B_FALSE);
}
/*
* Cmlb ops vectors, allows the cmlb module to directly access the entire
* pv_cmdk disk device without going through any partitioning layers.
*/
/*ARGSUSED*/
static int
{
return (ENXIO);
tg_cookie));
}
/*ARGSUSED*/
static int
{
int err;
return (ENXIO);
if (cmd == TG_GETVIRTGEOM) {
/*
* The native xdf driver doesn't support this ioctl.
* Intead of passing it on, emulate it here so that the
* results look the same as what we get for a real cmdk
* device.
*
* Get the real size of the device
*/
return (err);
/*
* If the controller returned us something that doesn't
* really fit into an Int 13/function 8 geometry
* result, just fail the ioctl. See PSARC 1998/313.
*/
return (EINVAL);
return (0);
}
}
static cmlb_tg_ops_t pv_cmdk_lb_ops = {
};
/*
* devid management functions
*/
/*
* pv_cmdk_get_modser() is basically a local copy of
* cmdk_get_modser() modified to work without the dadk layer.
* (which the non-pv version of the cmdk driver uses.)
*/
static int
{
struct scsi_device *scsi_device;
char *s;
char ch;
int i;
int tb;
return (0);
/*
*/
s = buf;
ch = *s++;
tb = i + 1;
}
return (0);
return (tb);
}
/*
* pv_cmdk_devid_modser() is basically a copy of cmdk_devid_modser()
* that has been modified to use local pv cmdk driver functions.
*
* Build a devid from the model and serial number
* Return DDI_SUCCESS or DDI_FAILURE.
*/
static int
{
int rc = DDI_FAILURE;
char *hwid;
int modlen;
int serlen;
/*
* device ID is a concatenation of model number, '=', serial number.
*/
if (modlen == 0)
goto err;
if (serlen == 0)
goto err;
/* Initialize the device ID, trailing NULL not included */
if (rc != DDI_SUCCESS)
goto err;
return (DDI_SUCCESS);
err:
return (DDI_FAILURE);
}
/*
* pv_cmdk_devid_read() is basically a local copy of
* cmdk_devid_read() modified to work without the dadk layer.
* (which the non-pv version of the cmdk driver uses.)
*
* Read a devid from on the first block of the last track of
* the last cylinder. Make sure what we read is a valid devid.
* Return DDI_SUCCESS or DDI_FAILURE.
*/
static int
{
int i;
return (DDI_FAILURE);
goto err;
/* Validate the revision */
goto err;
/* Calculate the checksum */
chksum = 0;
for (i = 0; i < ((NBPSCTR - sizeof (int))/sizeof (int)); i++)
goto err;
/* Validate the device id */
goto err;
/* keep a copy of the device id */
return (DDI_SUCCESS);
err:
return (DDI_FAILURE);
}
/*
* pv_cmdk_devid_fabricate() is basically a local copy of
* cmdk_devid_fabricate() modified to work without the dadk layer.
* (which the non-pv version of the cmdk driver uses.)
*
* Create a devid and write it on the first block of the last track of
* the last cylinder.
* Return DDI_SUCCESS or DDI_FAILURE.
*/
static int
{
int i;
return (DDI_FAILURE);
return (DDI_FAILURE);
/* allocate a buffer */
/* Fill in the revision */
/* Copy in the device id */
i = ddi_devid_sizeof(devid);
if (i > DK_DEVID_SIZE)
goto err;
/* Calculate the chksum */
chksum = 0;
for (i = 0; i < ((NBPSCTR - sizeof (int))/sizeof (int)); i++)
/* Fill in the checksum */
goto err;
return (DDI_SUCCESS);
err:
return (DDI_FAILURE);
}
/*
* pv_cmdk_devid_setup() is basically a local copy ofcmdk_devid_setup()
* that has been modified to use local pv cmdk driver functions.
*
* Create and register the devid.
* There are 4 different ways we can get a device id:
* 1. Already have one - nothing to do
* 2. Build one from the drive's model and serial numbers
* 3. Read one from the disk (first sector of last track)
* 4. Fabricate one and write it on the disk.
* If any of these succeeds, register the deviceid
*/
static void
{
int rc;
/* Try options until one succeeds, or all have failed */
/* 1. All done if already registered */
return;
/* 2. Build a devid from the model and serial number */
if (rc != DDI_SUCCESS) {
/* 3. Read devid from the disk, if present */
/* 4. otherwise make one up and write it on the disk */
if (rc != DDI_SUCCESS)
}
/* If we managed to get a devid any of the above ways, register it */
if (rc == DDI_SUCCESS)
}
/*
* Local Functions
*/
static int
{
/* Propegate back the io results */
return (0);
}
static int
{
/*
* Sanity checks that the dev_t associated with the buf we were
* passed actually corresponds us and that the partition we're
* trying to access is actually open. On debug kernels we'll
* panic and on non-debug kernels we'll return failure.
*/
goto err;
goto err;
}
/* clone this buffer */
/*
* If we're being invoked on behalf of the physio() call in
* pv_cmdk_dioctl_rwcmd() then b_private will be set to
* XB_SLICE_NONE and we need to propegate this flag into the
* cloned buffer so that the xdf driver will see it.
*/
/*
* Pass on the cloned buffer. Note that we don't bother to check
* for failure because the xdf strategy routine will have to
* invoke biodone() if it wants to return an error, which means
* that the pv_cmdk_iodone() callback will get invoked and it
* will propegate the error back up the stack and free the cloned
* buffer.
*/
err:
return (0);
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
/*ARGSUSED*/
static int
{
}
static int
{
}
/*
* pv_rwcmd_copyin() is a duplicate of rwcmd_copyin().
*/
static int
{
switch (ddi_model_convert_from(flag)) {
case DDI_MODEL_ILP32: {
struct dadkio_rwcmd32 cmd32;
sizeof (struct dadkio_rwcmd32), flag)) {
return (EFAULT);
}
/*
* Note: we do not convert the 'status' field,
* as it should not contain valid data at this
* point.
*/
break;
}
case DDI_MODEL_NONE: {
sizeof (struct dadkio_rwcmd), flag)) {
return (EFAULT);
}
}
}
return (0);
}
/*
* pv_rwcmd_copyout() is a duplicate of rwcmd_copyout().
*/
static int
{
switch (ddi_model_convert_from(flag)) {
case DDI_MODEL_ILP32: {
struct dadkio_rwcmd32 cmd32;
sizeof (struct dadkio_rwcmd32), flag))
return (EFAULT);
break;
}
case DDI_MODEL_NONE: {
sizeof (struct dadkio_rwcmd), flag))
return (EFAULT);
}
}
return (0);
}
static void
{
}
static int
{
struct dadkio_rwcmd *rwcmdp;
if (status != 0)
goto out;
case DADKIO_RWCMD_READ:
case DADKIO_RWCMD_WRITE:
break;
default:
goto out;
}
/*
* Tell the xdf driver that this I/O request is using an absolute
* offset.
*/
if (status == 0)
out:
return (status);
}
static int
int *rvalp)
{
int err;
switch (cmd) {
default:
case DKIOCGETWCE:
case DKIOCSETWCE:
return (EIO);
case DKIOCADDBAD: {
/*
* to cause the driver to re-read the bad block list and
* alternate map after it has been updated. Our driver
* will refuse to attach to any disk which has a bad blocks
* list defined, so there really isn't much to do here.
*/
return (0);
}
case DKIOCGETDEF: {
/*
* I can't actually find any code that utilizes this ioctl,
* hence we're leaving it explicitly unimplemented.
*/
ASSERT("ioctl cmd unsupported by pv_cmdk: DKIOCGETDEF");
return (EIO);
}
case DIOCTL_RWCMD: {
/*
* This just seems to just be an alternate interface for
* reading and writing the disk. Great, another way to
* do the same thing...
*/
}
case DKIOCINFO: {
/* Pass on the ioctl request, save the response */
return (err);
/* Update controller info */
/* Update unit info. */
return (EFAULT);
return (0);
}
} /* switch (cmd) */
/*NOTREACHED*/
}
/*ARGSUSED*/
static int
{
int err = 0;
return (EINVAL);
/* allocate an ldi handle */
/*
* We translate all device opens (chr, blk, and lyr) into
* block device opens. Why? Because for all the opens that
* come through this driver, we only keep around one LDI handle.
* So that handle can only be of one open type. The reason
* that we choose the block interface for this is that to use
* the block interfaces for a device the system needs to allocatex
* buf_ts, which are associated with system memory which can act
* as a cache for device data. So normally when a block device
* is closed the system will ensure that all these pages get
* flushed out of memory. But if we were to open the device
* as a character device, then when we went to close the underlying
* device (even if we had invoked the block interfaces) any data
* remaining in memory wouldn't necessairly be flushed out
* before the device was closed.
*/
if (err != 0) {
return (err);
}
/* Disk devices really shouldn't clone */
} else {
if (err != 0) {
return (err);
}
/* Disk devices really shouldn't clone */
}
return (0);
}
/*ARGSUSED*/
static int
{
int err = 0;
/*
* Sanity check that that the dev_t specified corresponds to this
* driver and that the device is actually open. On debug kernels we'll
* panic and on non-debug kernels we'll return failure.
*/
return (ENXIO);
return (ENXIO);
}
} else {
}
}
return (err);
}
static int
{
struct scsi_device *scsi_device;
int err;
return (err);
/* This driver won't work if this isn't true */
return (0);
}
/*
* pv_cmdk_bb_check() checks for the existance of bad blocks mappings in
* block mappins found, and B_TRUE is there are bad block mappins found.
*/
static boolean_t
{
struct alts_parttbl *ap;
int alts;
/* find slice with V_ALTSCTR tag */
/* no partition table exists */
return (B_FALSE);
}
break;
}
return (B_FALSE); /* no V_ALTSCTR slice defined */
/* read in ALTS label block */
goto err;
goto err;
/* we found bad block mappins */
return (B_TRUE);
err:
return (B_FALSE);
}
/*
* Autoconfiguration Routines
*/
static int
{
char *path;
int i;
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
/*
* This cmdk device layers on top of an xdf device. So the first
* thing we need to do is determine which xdf device instance this
* cmdk instance should be layered on top of.
*/
break;
}
/*
* UhOh. We don't know what xdf instance this cmdk device
* should be mapped to.
*/
return (DDI_FAILURE);
}
/* Check if this device exists */
return (DDI_FAILURE);
/* allocate and initialize our state structure */
/*
* GROSS HACK ALERT! GROSS HACK ALERT!
*
* Before we can initialize the cmlb layer, we have to tell the
* underlying xdf device what it's physical geometry should be.
* See the block comments at the top of this file for more info.
*/
return (DDI_FAILURE);
}
/* create kstat for iostat(1M) */
return (DDI_FAILURE);
}
/*
* Force the xdf front end driver to connect to the backend. From
* the solaris device tree perspective, the xdf driver devinfo node
* is already in the ATTACHED state. (Otherwise xdf_hvm_hold()
* would not have returned a dip.) But this doesn't mean that the
* xdf device has actually established a connection to it's back
* end driver. For us to be able to access the xdf device it needs
* to be connected. There are two ways to force the xdf driver to
* connect to the backend device.
*/
"pv driver failed to connect: %s",
pv_cmdk_h2p[i].h2p_pv_path);
return (DDI_FAILURE);
}
/*
* Initalize cmlb. Note that for partition information cmlb
* will access the underly xdf disk device directly via
* pv_cmdk_lb_rdwr() and pv_cmdk_lb_getinfo(). There are no
* layered driver handles associated with this access because
* it is a direct disk access that doesn't go through
* any of the device nodes exported by the xdf device (since
* all exported device nodes only reflect the portion of
* is associated with.) So while not observable via the LDI,
* this direct disk access is ok since we're actually holding
* the target device.
*/
DTYPE_DIRECT, /* device_type */
0, /* not removable */
0, /* not hot pluggable */
CMLB_CREATE_ALTSLICE_VTOC_16_DTYPE_DIRECT, /* mimic cmdk */
dkp->dk_cmlbhandle, 0) != 0) {
return (DDI_FAILURE);
}
if (pv_cmdk_bb_check(dkp)) {
"pv cmdk disks with bad blocks are unsupported: %s",
pv_cmdk_h2p[i].h2p_hvm_path);
return (DDI_FAILURE);
}
/* setup devid string */
/* Calling validate will create minor nodes according to disk label */
/*
* Add a zero-length attribute to tell the world we support
* kernel ioctls (for layered drivers).
*/
DDI_KERNEL_IOCTL, NULL, 0);
/* Have the system report any newly created device nodes */
return (DDI_SUCCESS);
}
static int
{
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
return (DDI_SUCCESS);
}
/*ARGSUSED*/
static int
void **result)
{
switch (infocmd) {
case DDI_INFO_DEVT2DEVINFO:
return (DDI_FAILURE);
break;
case DDI_INFO_DEVT2INSTANCE:
break;
default:
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
static int
{
int err;
/*
* Sanity check that if a dev_t or dip were specified that they
* correspond to this device driver. On debug kernels we'll
* panic and on non-debug kernels we'll return failure.
*/
return (DDI_PROP_NOT_FOUND);
/*
* This property lookup might be associated with a device node
* that is not yet attached, if so pass it onto ddi_prop_op().
*/
/*
* Make sure we only lookup static properties.
*
* If there are static properties of the underlying xdf driver
* that we want to mirror, then we'll have to explicity look them
* up and define them during attach. There are a few reasons
* for this. Most importantly, most static properties are typed
* and all dynamic properties are untyped, ie, for dynamic
* properties the caller must know the type of the property and
* how to interpret the value of the property. the prop_op drivedr
* properties, so if we were to attempt to lookup and pass back
* static properties of the underlying device here then we would
* be losing the type information for those properties. Another
* reason we don't want to pass on static property requests is that
* static properties are enumerable in the device tree, where as
* dynamic ones are not.
*/
/*
* We can't use the ldi here to access the underlying device because
* the ldi actually opens the device, and that open might fail if the
* device has already been opened with the FEXCL flag. If we used
* the ldi here, it would also be possible for some other caller
* to try open the device with the FEXCL flag and get a failure
* back because we have it open to do a property query.
*
* Instad we'll grab a hold on the target dip and query the
* property directly.
*/
return (DDI_PROP_NOT_FOUND);
}
/* figure out the dev_t we're going to pass on down */
if (dev == DDI_DEV_T_ANY) {
} else {
}
/*
* Cdev_prop_op() is not a public interface, and normally the caller
* is required to make sure that the target driver actually implements
* this interface before trying to invoke it. In this case we know
* that we're always accessing the xdf driver and it does have this
* interface defined, so we can skip the check.
*/
return (err);
}
/*
* Device driver ops vector
*/
static struct cb_ops pv_cmdk_cb_ops = {
pv_cmdkopen, /* open */
pv_cmdkclose, /* close */
pv_cmdkstrategy, /* strategy */
nodev, /* print */
pv_cmdkdump, /* dump */
pv_cmdkread, /* read */
pv_cmdkwrite, /* write */
pv_cmdkioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
pv_cmdk_prop_op, /* cb_prop_op */
0, /* streamtab */
CB_REV, /* cb_rev */
pv_cmdkaread, /* async read */
pv_cmdkawrite /* async write */
};
struct dev_ops pv_cmdk_ops = {
DEVO_REV, /* devo_rev, */
0, /* refcnt */
pv_cmdk_getinfo, /* info */
nulldev, /* identify */
nulldev, /* probe */
pv_cmdkattach, /* attach */
pv_cmdkdetach, /* detach */
nodev, /* reset */
&pv_cmdk_cb_ops, /* driver operations */
(struct bus_ops *)0 /* bus operations */
};
/*
* Module linkage information for the kernel.
*/
&mod_driverops, /* Type of module. This one is a driver */
"PV Common Direct Access Disk",
&pv_cmdk_ops, /* driver ops */
};
static struct modlinkage modlinkage = {
};
int
_init(void)
{
int rval;
return (EINVAL);
/*
* In general ide usually supports 4 disk devices, this same
* limitation also applies to software emulating ide devices.
* so by default we pre-allocate 4 cmdk soft state structures.
*/
sizeof (struct pv_cmdk), PV_CMDK_NODES)) != 0)
return (rval);
/*
* Currently we only support qemu as the backing hardware emulator
* for cmdk devices.
*/
/* Install our module */
return (rval);
}
return (0);
}
int
{
}
int
_fini(void)
{
int rval;
return (rval);
return (0);
}