/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
#include <sys/ddi_impldefs.h>
#include <sys/pci_tools.h>
#include <sys/pci_impl.h>
#include <sys/hypervisor_api.h>
#include "niumx_var.h"
/*
* NIUMX PCITool interface
*/
/*LINTLIBRARY*/
niumx_open, /* open */
niumx_close, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* read */
nodev, /* write */
niumx_ioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
niumx_prop_op, /* cb_prop_op */
NULL, /* streamtab */
CB_REV, /* rev */
nodev, /* int (*cb_aread)() */
nodev /* int (*cb_awrite)() */
};
extern void *niumx_state;
/* ARGSUSED3 */
static int
{
/*
* Make sure the open is for the right file type.
*/
return (EINVAL);
/*
* Get the soft state structure for the device.
*/
return (ENXIO);
/*
* Handle the open by tracking the device state.
*/
return (EBUSY);
}
} else {
return (EBUSY);
}
}
return (0);
}
/* ARGSUSED */
static int
{
return (EINVAL);
/*
* Get the soft state structure for the device.
*/
return (ENXIO);
niumxds_p->niumx_open_count = 0;
return (0);
}
/* ARGSUSED */
int
int *rvalp)
{
/*
* Get the soft state structure for the device.
*/
return (ENXIO);
}
switch (minor & 0xff) {
/*
* PCI tools.
*/
case PCI_TOOL_INTR_MINOR_NUM:
switch (cmd) {
case PCITOOL_DEVICE_SET_INTR:
/* Require full privileges. */
if (secpolicy_kmdb(credp)) {
break;
}
/*FALLTHRU*/
/* These require no special privileges. */
case PCITOOL_DEVICE_GET_INTR:
case PCITOOL_SYSTEM_INTR_INFO:
break;
default:
}
return (rv);
default:
break;
}
return (rv);
}
{
}
int
{
DDI_NT_INTRCTL, 0) != DDI_SUCCESS) {
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
void
{
}
static void
{
}
/*ARGSUSED*/
static int
{
/* If we need user_version, and to ret same user version as passed in */
DDI_SUCCESS) {
return (EFAULT);
}
else
DDI_SUCCESS) {
}
return (rval);
}
/*
* Get interrupt information for a given ino.
* Returns info only for inos mapped to devices.
*
* Returned info is valid only when iget.num_devs is returned > 0.
* If ino is not enabled or is not mapped to a device,
* iget.num_devs will be returned as = 0.
*/
/*ARGSUSED*/
static int
{
/* Array part isn't used here, but oh well... */
int copyout_rval;
niumxds_p = (niumx_devstate_t *)
/* Read in just the header part, no array section. */
return (EFAULT);
goto done_get_intr;
}
/* Validate argument. */
goto done_get_intr;
}
/* Caller wants device information returned. */
if (iget_p->num_devs_ret > 0) {
/*
* Allocate room.
* Note if num_devs == 0 iget_p remains pointing to
* partial_iget.
*/
/* Read in whole structure to verify there's room. */
DDI_SUCCESS) {
/* Be consistent and just return EFAULT here. */
return (EFAULT);
}
}
if (sysino == 0) {
goto done_get_intr;
}
goto done_get_intr;
}
goto done_get_intr;
}
rval = DDI_SUCCESS;
mode);
if (iget_kmem_alloc_size > 0)
if (copyout_rval != DDI_SUCCESS)
return (rval);
}
/*
* Associate a new CPU with a given ino.
*
* Operate only on inos which are already mapped to devices.
*/
static int
{
niumxds_p = (niumx_devstate_t *)
/* Version 1 of pcitool_intr_set_t doesn't have flags. */
return (EFAULT);
switch (iset.user_version) {
case PCITOOL_V1:
break;
case PCITOOL_V2:
copyinout_size = sizeof (pcitool_intr_set_t);
return (EFAULT);
break;
default:
goto done_set_intr;
}
goto done_set_intr;
}
/* Validate input argument. */
goto done_set_intr;
}
rval = DDI_SUCCESS;
goto done_set_intr;
}
switch (ret) {
case DDI_EPENDING:
break;
case DDI_EINVAL:
break;
default:
break;
}
return (rval);
}
/* Main function for handling interrupt CPU binding requests and queries. */
static int
{
switch (cmd) {
/* Get system interrupt information. */
case PCITOOL_SYSTEM_INTR_INFO:
break;
/* Get interrupt information for a given ino. */
case PCITOOL_DEVICE_GET_INTR:
break;
/* Associate a new CPU with a given ino. */
case PCITOOL_DEVICE_SET_INTR:
break;
default:
}
return (rval);
}