/*
* 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 (c) 2012, Joyent, Inc. All rights reserved.
*/
#include <sys/processor.h>
#include <sys/cpuid_drv.h>
#include <sys/systeminfo.h>
#if defined(__x86)
#include <sys/x86_archext.h>
#endif
/*ARGSUSED*/
static int
{
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
case DDI_INFO_DEVT2INSTANCE:
break;
default:
return (DDI_FAILURE);
}
case CPUID_SELF_CPUID_MINOR:
break;
default:
return (DDI_FAILURE);
}
if (cmd == DDI_INFO_DEVT2INSTANCE)
*result = 0;
else
*result = cpuid_devi;
return (DDI_SUCCESS);
}
static int
{
if (cmd != DDI_ATTACH)
return (DDI_FAILURE);
cpuid_devi = devi;
CPUID_SELF_CPUID_MINOR, DDI_PSEUDO, 0));
}
static int
{
if (cmd != DDI_DETACH)
return (DDI_FAILURE);
cpuid_devi = NULL;
return (DDI_SUCCESS);
}
/*ARGSUSED1*/
static int
{
}
#if defined(_HAVE_CPUID_INSN)
/*ARGSUSED*/
static int
{
int error = 0;
return (ENXIO);
return (EINVAL);
break;
}
break;
}
return (error);
}
#else
#endif /* _HAVE_CPUID_INSN */
/*ARGSUSED*/
static int
{
void *ustr;
switch (cmd) {
case CPUID_GET_HWCAP: {
STRUCT_INIT(h, mode);
if (ddi_copyin((void *)arg,
return (EFAULT);
return (EFAULT);
#if defined(_SYSCALL32_IMPL)
#endif
} else {
STRUCT_FSET(h, cgh_hwcap[0], 0);
}
if (ddi_copyout(STRUCT_BUF(h),
return (EFAULT);
return (0);
}
default:
return (ENOTTY);
}
}
nulldev, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
nodev, /* write */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* poll */
NULL,
};
0,
nulldev, /* identify */
nulldev, /* probe */
nodev, /* reset */
(struct bus_ops *)0,
NULL,
ddi_quiesce_not_needed, /* quiesce */
};
"cpuid driver",
};
};
int
_init(void)
{
return (mod_install(&modl));
}
int
_fini(void)
{
return (mod_remove(&modl));
}
int
{
}