IOKernelReportStructs.h [plain text]
#ifndef _IOKERNELREPORTSTRUCTS_H_
#define _IOKERNELREPORTSTRUCTS_H_
#include <stdint.h>
#include <IOKit/IOReportTypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#define kIOReportAPIVersion 28
#define kIOReportLegendPublicKey "IOReportLegendPublic" // bool
#define kIOReportLegendKey "IOReportLegend" // arr
#define kIOReportLegendChannelsKey "IOReportChannels" // arr
#define kIOReportLegendGroupNameKey "IOReportGroupName" // str
#define kIOReportLegendSubGroupNameKey "IOReportSubGroupName" // str
#define kIOReportLegendInfoKey "IOReportChannelInfo" // dict
#define kIOReportLegendUnitKey "IOReportChannelUnit" // num
#define kIOReportLegendConfigKey "IOReportChannelConfig" // data
#define kIOReportLegendStateNamesKey "IOReportChannelStateNames" // str[]
#define kIOReportChannelIDIdx 0 // required
#define kIOReportChannelTypeIdx 1 // required
#define kIOReportChannelNameIdx 2 // optional
typedef uint64_t IOReportUnits;
#define __IOR_MAKEUNIT(quantity, scale) \
(((IOReportUnits)quantity << 56) | (uint64_t)scale)
#define IOREPORT_GETUNIT_QUANTITY(unit) \
((IOReportQuantity)((uint64_t)unit >> 56) & 0xff)
#define IOREPORT_GETUNIT_SCALE(unit) \
((IOReportScaleFactor)unit & 0x00ffffffffffffff)
typedef uint8_t IOReportQuantity; typedef uint64_t IOReportScaleFactor;
enum {
kIOReportQuantityUndefined = 0,
kIOReportQuantityTime = 1, kIOReportQuantityPower = 2, kIOReportQuantityEnergy = 3, kIOReportQuantityCurrent = 4, kIOReportQuantityVoltage = 5, kIOReportQuantityCapacitance = 6, kIOReportQuantityInductance = 7, kIOReportQuantityFrequency = 8, kIOReportQuantityData = 9, kIOReportQuantityTemperature = 10,
kIOReportQuantityEventCount = 100,
kIOReportQuantityPacketCount = 101
};
#define kIOReportScaleConstMask 0x000000007fffffff // constant ("uint31")
#define kIOReportScaleOneOver (1LL << 31) // 1/constant
#define kIOReportExpBase (-127) // support base^(-n)
#define kIOReportExpZeroOffset -(kIOReportExpBase) // max exponent = 128
#define kIOReportScaleSIShift 32 // * 10^n
#define kIOReportScaleSIMask 0x000000ff00000000
#define kIOReportScaleIECShift 40 // * 2^n
#define kIOReportScaleIECMask 0x0000ff0000000000
#define kIOReportCardinalShift 48 // placeholders
#define kIOReportCardinalMask 0x00ff000000000000
#define kIOReportScalePico ((-12LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleNano ((-9LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleMicro ((-6LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleMilli ((-3LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleUnity 0 // 10^0 = 2^0 = 1
#define kIOReportScaleKilo ((3LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleMega ((6LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleGiga ((9LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleTera ((12LL + kIOReportExpZeroOffset) \
<< kIOReportScaleSIShift)
#define kIOReportScaleBits kIOReportScaleUnity
#define kIOReportScaleBytes ((3LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleKibi ((10LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleKiBytes ((13LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleMebi ((20LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleMiBytes ((23LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleGibi ((30LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleGiBytes ((33LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleTebi ((40LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleTiBytes ((43LL + kIOReportExpZeroOffset) \
<< kIOReportScaleIECShift)
#define kIOReportScaleMachHWTicks (1LL << kIOReportCardinalShift)
#define kIOReportScaleHWPageSize (2LL << kIOReportCardinalShift)
#define kIOReportScale4KiB (4 | kIOReportScaleKiBytes)
#define kIOReportScale8KiB (8 | kIOReportScaleKiBytes)
#define kIOReportScale1GHz (1 | kIOReportScaleNano)
#define kIOReportScale24MHz (kIOReportScaleOneOver|24 |kIOReportScaleMicro)
#define kIOReportUnitNone __IOR_MAKEUNIT(kIOReportQuantityUndefined, \
kIOReportScaleUnity)
#define kIOReportUnit_s __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleUnity)
#define kIOReportUnit_ms __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleMilli)
#define kIOReportUnit_us __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleMicro)
#define kIOReportUnit_ns __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleNano)
#define kIOReportUnit_J __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleUnity)
#define kIOReportUnit_mJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleMilli)
#define kIOReportUnit_uJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleMicro)
#define kIOReportUnit_nJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScaleNano)
#define kIOReportUnit_pJ __IOR_MAKEUNIT(kIOReportQuantityEnergy, \
kIOReportScalePico)
#define kIOReportUnitHWTicks __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScaleMachHWTicks)
#define kIOReportUnit24MHzTicks __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScale24MHz)
#define kIOReportUnit1GHzTicks __IOR_MAKEUNIT(kIOReportQuantityTime, \
kIOReportScale1GHz)
#define kIOReportUnitBits __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleBits)
#define kIOReportUnitBytes __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleBytes)
#define kIOReportUnit_KiB __IOR_MAKEUNIT(kIOReportQuantityData, \
kIOReportScaleKiBytes)
#define kIOReportUnitEvents __IOR_MAKEUNIT(kIOReportQuantityEventCount, \
kIOReportScaleUnity)
#define kIOReportUnitPackets __IOR_MAKEUNIT(kIOReportQuantityPacketCount, \
kIOReportScaleUnity)
#define kIOHistogramScaleLinear 0
#define kIOHistogramScaleExponential 1
typedef struct {
uint32_t base_bucket_width; uint32_t scale_flag; uint32_t segment_idx; uint32_t segment_bucket_count; } __attribute((packed)) IOHistogramSegmentConfig;
typedef struct {
uint64_t samples;
uint64_t mean;
uint64_t variance;
uint64_t reserved;
} __attribute((packed)) IONormDistReportValues;
#ifdef __cplusplus
}
#endif
#endif // _IOKERNELREPORTSTRUCTS_H_