/*
* Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
*
* This Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*//*
* Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
*
*
*/
#ifndef_IOPLATFORMPLUGINDEFS_H
#define_IOPLATFORMPLUGINDEFS_H
#include<IOKit/IOTypes.h>/*
* IOPlatformPluginDefs
*//*
* Property keys for publishing sensor, control and control-loop instance data
* in the I/O registry.
*
* The IOPlatformSensor, IOPlatformControl and IOPlatformCtrlLoop instances store
* their instance data in an OSDictionary (infoDict). The Platform Plugin creates
* properties in its I/O registry node, using the keys defined below, which contain
* arrays of pointers to the infoDict for each IOPlatformCtrlLoop instance (under
* IOHWCtrlLoops) and each *registered* IOPlatformSensor and IOPlatformControl (under
* IOHWSensors and IOHWControls, respectively).
*/
#definekIOPPluginSensorDataKey"IOHWSensors"
#definekIOPPluginControlDataKey"IOHWControls"
#definekIOPPluginCtrlLoopDataKey"IOHWCtrlLoops"/*
* Keys defined by the Thermal SW ERS
*
* (Most of) these keys are define in the Thermal SW ERS. Each sensor and control
* has a set of properties that goes along with it. As such, the following keys
* are used to key member data in the infoDict, and will show up in the I/O
* registry.
*/// Thermal SW parameter version
#definekIOPPluginVersionKey"version"// Sensor/Control type key, followed by possible values
#definekIOPPluginTypeKey"type"// Sensor type strings - values for the "type" attribute
#definekIOPPluginTypeTempSensor"temperature"
#definekIOPPluginTypePowerSensor"power"
#definekIOPPluginTypeVoltageSensor"voltage"
#definekIOPPluginTypeCurrentSensor"current"
#definekIOPPluginTypeADCSensor"adc"// Control type strings - values for the "type" attribute
#definekIOPPluginTypeSlewControl"slew"
#definekIOPPluginTypeFanRPMControl"fan-rpm"
#definekIOPPluginTypeFanPWMControl"fan-pwm"// Location key, contains a string to identify the physical location and/or human-
// readable description of the device
#definekIOPPluginLocationKey"location"// Thermal zone key. Value is an OSData.
#definekIOPPluginZoneKey"zone"// Current value key, holds the sensor's current value or the control's measured
// value as an OSNumber.
#definekIOPPluginCurrentValueKey"current-value"// Sensor polling period key (optional)
#definekIOPPluginPollingPeriodKey"polling-period"
#definekIOPPluginPollingPeriodNSKey"polling-period-ns"// Boolean to flag whether or not a driver has registered as this sensor/control
#definekIOPPluginRegisteredKey"registered"// Sensor ID key
#definekIOPPluginSensorIDKey"sensor-id"// Sensor flags key -- currently unused / no bits defined
#definekIOPPluginSensorFlagsKey"sensor-flags"// Current state key -- used for threshold-driven state sensors (see IOPlatformStateSensor)
#definekIOPPluginCurrentStateKey"current-state"// Low threshold key -- holds the low threshold that corresponds to the current
// state (see IOPlatformStateSensor)
#definekIOPPluginLowThresholdKey"low-threshold"// High threshold -- holds the high threshold that corresponds to the current
// state (see IOPlatformStateSensor)
#definekIOPPluginHighThresholdKey"high-threshold"// Control ID key
#definekIOPPluginControlIDKey"control-id"// Control flags key -- currently unused / no bits defined
#definekIOPPluginControlFlagsKey"control-flags"// Control target value key -- the control is instructed to adjust itself to this value
#definekIOPPluginTargetValueKey"target-value"// Control initial target value key -- this can be included in a ControlArray entry
// in the thermal profile to force a control to be programmed to a certain target
// when it registers
#definekIOPPluginInitialTargetKey"initial-target"// Minimum value -- used in IOPlatformControl as a lower bound for target-value
// and current-value
#definekIOPPluginControlMinValueKey"min-value"// Maximum value -- used in IOPlatformControl as an upper bound for target-value
// and current-value
#definekIOPPluginControlMaxValueKey"max-value"// Safe value -- maximum safe target-value when the chassis is open (used in
// IOPlatformControl, IOPlatformPIDCtrlLoop, etc.)
#definekIOPPluginControlSafeValueKey"safe-value"// for interaction with IOHWSensor class
#definekIOPPluginNoThreshold -1
#definekIOPPluginNoPolling -1
// When a control registers, it sends it's type in the registration
// dictionary with the key "control-type". This is a bit off from
// normal convention of just using "type" as the key for sensors and
// controls, but it is easy to minimize the impact since the only
// place this needs to be handled is in the registration handler.
#definekIOPPluginControlTypeKey"control-type"// Cpu ID key
#definekIOPPluginCpuIDKey"cpu-id"/*
* Control loop keys
*/// Control loop ID key
#definekIOPPluginCtrlLoopIDKey"ctrlloop-id"// Current control loop meta state key
#definekIOPPluginCtrlLoopMetaState"current-meta-state"/*
* Environment dictionary keys
*/// Key for publishing the environment dictionary in the I/O registry, alongside
// IOHWSensors, IOHWControls and IOHWCtrlLoops
#definekIOPPluginEnvInfoKey"IOEnvironment"// Global environmental variable keys
// internally generated overtemp condition - if the fans are at full
// and the system is still not cooling, this condition is set. The
// processor is forced slow. Boolean value.
#definekIOPPluginEnvInternalOvertemp"internal-overtemp"// externally generated overtemp condition. Boolean value.
#definekIOPPluginEnvExternalOvertemp"external-overtemp"// the dynamic power step processor speed. OSNumber value.
#definekIOPPluginEnvDynamicPowerStep"dynamic-power-step"// the user has set the processor performance to "Automatic" = Boolean value
#definekIOPPluginEnvUserPowerAuto"user-power-auto"// A/C plugged in. Boolean value.
#definekIOPPluginEnvACPresent"ac-present"// battery present. Boolean value.
#definekIOPPluginEnvBatteryPresent"battery-present"// battery overcurrent condition. Boolean value.
#definekIOPPluginEnvBatteryOvercurrent"battery-overcurrent"// clamshell closed condition. Boolean value.
#definekIOPPluginEnvClamshellClosed"clamshell-closed"// Power status for portables. 32-bit OSNumber value.
#definekIOPPluginEnvPowerStatus"power-status"// if a control failed it will be flagged here. OSArray value.
#definekIOPPluginEnvControlFailed"control-failed"// if a control loop is driving its output control at max, it can set
// this environment array flag so other control loops know it's maxed
// out
#definekIOPPluginEnvCtrlLoopOutputAtMax"ctrlloop-output-at-max"// state of the chassis intrusion switch -- depending on the platform, this
// corresponds to the clamshell switch, or door ajar switch, etc.
#definekIOPPluginEnvChassisSwitch"chassis-switch"// platform flags bitfield defined in at the top level of the thermal
// profile:
// Thermal Profile property key
#definekIOPPluginPlatformFlagsKey"PlatformFlags"// Environment dictionary property key
#definekIOPPluginEnvPlatformFlags"platform-flags"// platform flags bit definitions -- 32-bit field
enum
{
// No bits are defined yet
kIOPPluginFlagNotDefined = 0x00000001
};
/*
* Keys for parsing out the thermal profile
*/
#definekIOPPluginThermalProfileKey"IOPlatformThermalProfile"// Human-readable description
#definekIOPPluginThermalGenericDescKey"Description"// Index into a string table
#definekIOPPluginThermalLocalizedDescKey"Desc-Key"
#definekIOPPluginThermalCreationDateKey"CreationDate"
#definekIOPPluginThermalValidConfigsKey"ValidConfigs"
#definekIOPPluginThermalConfigsKey"ConfigArray"
#definekIOPPluginThermalSensorsKey"SensorArray"
#definekIOPPluginThermalControlsKey"ControlArray"
#definekIOPPluginThermalCtrlLoopsKey"CtrlLoopArray"
#definekIOPPluginThermalSensorIDsKey"SensorIDArray"
#definekIOPPluginThermalControlIDsKey"ControlIDArray"
#definekIOPPluginThermalMetaStatesKey"MetaStateArray"
#definekIOPPluginThermalThresholdsKey"ThresholdArray"
#definekIOPPluginControlClass"IOPlatformControl"
#definekIOPPluginSensorClass"IOPlatformSensor"// Generic PlatformID string
#definekIOPPluginPlatformIDKey"platform-id"
#definekIOPPluginPlatformIDValue"MacRISC4"// Thermal sensor values and thresholds are 16.16 fixed point format
typedefstruct ThermalValue {
SInt16 intValue;
UInt16 fracValue;
};
// Macro to convert integer to sensor temperature format (16.16)
#defineTEMP_SENSOR_FMT(x) ((x) << 16)
// Others sensors are just integers so combine the two formats
typedefunion SensorValue {
SInt32 sensValue;
ThermalValue thermValue;
};
// Sensor value comparison functions
inline bool operator==(SensorValue a, SensorValue b) { return a.sensValue == b.sensValue; };
inline bool operator!=(SensorValue a, SensorValue b) { return a.sensValue != b.sensValue; };
// Control's current-value and target-value are UInt32 type
typedef UInt32 ControlValue;
// Thermal zones
enum {
kIOPPluginAGPThermalZone = 0xFF000002
};
#endif // _IOPLATFORMPLUGINDEFS_H