/**
* $Id: k10sensor.c 752 2012-06-25 05:25:09Z elkner $
*
* * 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
* 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.
* 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]
*
* All Rights reserved.
* CDDL HEADER END
*/
/*
* Copyright (c) 2011,2012 by Jens Elkner,
* Otto-von-Guericke Universitaet Magdeburg. All rights reserved.
*/
#include <sys/x86_archext.h>
#include "k10s_kstats.h"
#ifdef DEBUG
#else
#endif
#ifndef MC_AMD_DEV_OFFSET
#endif
k10sensor_open, /* open */
k10sensor_close, /* close */
nodev, /* strategy */
nodev, /* print */
nodev, /* dump */
k10sensor_read, /* read */
nodev, /* write */
k10sensor_ioctl, /* ioctl */
nodev, /* devmap */
nodev, /* mmap */
nodev, /* segmap */
nochpoll, /* chpoll */
ddi_prop_op, /* prop_op */
NULL, /* streamtab */
CB_REV, /* revision */
nodev, /* aread */
nodev /* awrite */
};
DEVO_REV, /* revision */
0, /* reference count */
k10sensor_getinfo, /* getinfo */
nulldev, /* obsolete identify */
nulldev, /* probe */
k10sensor_attach, /* attach */
k10sensor_detach, /* detach */
nodev, /* reset - unsupported */
&k10sensor_cb_ops, /* cb_ops */
nulldev /* power */
#ifdef __SunOS_5_11
,ddi_quiesce_not_needed /* quiesce */
#endif
};
"AMD CPU temperature sensor",
&k10sensor_dev_ops /* dev_ops */
};
&md,
};
static void *statep;
/* Get the number of all physical CPUs in the system.
* @return a value >= 1.
*/
static int
getNumPhysCpus() {
count++;
}
}
return (count);
}
int
_init(void)
{
if (pcpus != 0) {
pcpus);
}
return (pcpus);
}
int
{
}
int
_fini(void)
{
int err;
if (err == 0) {
}
return (err);
}
/* Set k10p->v->chipId to the CPU NodeID, to which this instance belongs to.
* @param k10p the per instance data record. Required members: dip, chipId
* @return DDI_FAILURE if unable to determine, DDI_SUCCESS otherwise.
*/
static int
long unitaddr;
/* unit-address = PCI_device_number,Function
which in this case is (0x18 + ChipId),3 */
{
return (DDI_FAILURE);
}
unitaddr = 0;
}
}
static void
}
}
}
/* Populate k10p->v with CPU/temperature specific "static" data.
* @return DDI_FAILURE on error, DDI_SUCCESS otherwise.
*/
static int
cpu_vars_t *v = k10p->v;
/* once CPU list is initialized, it doesn't change its structure */
do {
break;
}
return (DDI_FAILURE);
}
fillErratum(v);
return (DDI_SUCCESS);
}
/* free all instance related data and ressources */
static int
return (DDI_SUCCESS);
}
}
return (DDI_SUCCESS);
}
static int
{
if (x86_vendor != X86_VENDOR_AMD ) {
return (DDI_FAILURE);
}
switch (cmd) {
default:
return (DDI_FAILURE);
case DDI_RESUME:
return (DDI_SUCCESS);
case DDI_ATTACH:
break;
}
return (DDI_FAILURE);
}
goto failed;
}
goto failed;
}
goto failed;
}
{
goto failed;
}
"inaccurate (see erratum %d for family %s)", inst,
}
return (DDI_SUCCESS);
return (DDI_FAILURE);
}
static int
{
switch (cmd) {
default:
return DDI_FAILURE;
case DDI_SUSPEND:
return DDI_SUCCESS;
case DDI_DETACH:
break;
}
return DDI_SUCCESS;
}
static int
{
switch (cmd) {
case DDI_INFO_DEVT2DEVINFO:
res = DDI_SUCCESS;
} else {
}
break;
case DDI_INFO_DEVT2INSTANCE:
res = DDI_SUCCESS;
break;
default:
break;
}
return res;
}
/* ddi_get_lbolt(void); */
static int
{
}
static int
{
}
static int
{
char *str;
return (0);
}
return EINVAL;
}
}
if (len == 0) {
return 0;
}
}
static int
int *rvalp)
{
cpu_vars_t *v;
return (ENXIO);
}
return (EACCES);
}
v = k10p->v;
switch (cmd) {
default:
return (ENOTTY);
case K10IOC_INFO:
/* cpu_vars_t has same size for 32 and 64bit -> no conv needed */
return (EFAULT);
}
break;
case K10IOC_TCTRL:
{
int32_t t[] = { 0, 0 };
if (v->xfamilyModel < 0x04) {
} else {
/* 0Fh and DualCore */
}
}
return (EFAULT);
}
}
break;
case K10IOC_RHTC:
break;
case K10IOC_RSTC:
break;
case K10IOC_CONF:
break;
}
/* re-read limits */
return (DDI_SUCCESS);
}