Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/audio/IOAudioDefines.h
/* * Copyright (c) 1998-2013 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@ */ #ifndef _IOAUDIODEFINES_H #define _IOAUDIODEFINES_H #define kIOAudioDeviceClassName "IOAudioDevice" #define kIOAudioEngineClassName "IOAudioEngine" #define kIOAudioStreamClassName "IOAudioStream" #define kIOAudioPortClassName "IOAudioPort" #define kIOAudioControlClassName "IOAudioControl" /*! * @defined kIOAudioSampleRateKey * @abstract The key in the IORegistry for the IOAudioEngine sample rate attribute * @discussion This value is represented as an integer in samples per second. */ #define kIOAudioSampleRateKey "IOAudioSampleRate" #define kIOAudioSampleRateWholeNumberKey "IOAudioSampleRateWholeNumber" #define kIOAudioSampleRateFractionKey "IOAudioSampleRateFraction" /****** * * IOAudioDevice defines * *****/ /*! * @defined kIOAudioDeviceNameKey * @abstract The key in the IORegistry for the IOAudioDevice name attribute. */ #define kIOAudioDeviceNameKey "IOAudioDeviceName" #define kIOAudioDeviceShortNameKey "IOAudioDeviceShortName" /*! * @defined kIOAudioDeviceManufacturerNameKey * @abstract The key in the IORegistry for the IOAudioDevice manufacturer name attribute. */ #define kIOAudioDeviceManufacturerNameKey "IOAudioDeviceManufacturerName" #define kIOAudioDeviceLocalizedBundleKey "IOAudioDeviceLocalizedBundle" #define kIOAudioDeviceTransportTypeKey "IOAudioDeviceTransportType" #define kIOAudioDeviceConfigurationAppKey "IOAudioDeviceConfigurationApplication" #define kIOAudioDeviceCanBeDefaults "IOAudioDeviceCanBeDefaults" #define kIOAudioDeviceModelIDKey "IOAudioDeviceModelID" /*! * @defined kIOAudioDeviceIconName * @abstract The key in the IORegistry for the IOAudioDevice icon name attribute. */ #define kIOAudioDeviceIconNameKey "IOAudioDeviceIconName" #define kIOAudioDeviceIconTypeKey "IOAudioDeviceIconType" #define kIOAudioDeviceIconSubDirKey "IOAudioDeviceIconSubDir" /***** * * IOAudioEngine defines * *****/ /*! * @defined kIOAudioEngineStateKey * @abstract The key in the IORegistry for the IOAudioEngine state atrribute * @discussion The value for this key may be one of: "Running", "Stopped" or "Paused". Currently the "Paused" * state is unimplemented. */ #define kIOAudioEngineStateKey "IOAudioEngineState" /*! * @defined kIOAudioEngineOutputSampleLatencyKey * @abstract The key in the IORegistry for the IOAudioEngine output sample latency key * @discussion */ #define kIOAudioEngineOutputSampleLatencyKey "IOAudioEngineOutputSampleLatency" /*! * @defined kIOAudioStreamSampleLatencyKey * @abstract The key in the IORegistry for the IOAudioStream output sample latency key * @discussion Tells the HAL how much latency is on a particular stream. If two streams * on the same engine have different latencies (e.g. one is analog, one is digital), then * set this property on both streams to inform the HAL of the latency differences. Alternately, * you can set the engine latency, and just include the latency additional to that for the particular * stream. The HAL will add the engine and stream latency numbers together to get the total latency. */ #define kIOAudioStreamSampleLatencyKey "IOAudioStreamSampleLatency" #define kIOAudioEngineInputSampleLatencyKey "IOAudioEngineInputSampleLatency" #define kIOAudioEngineSampleOffsetKey "IOAudioEngineSampleOffset" #define kIOAudioEngineInputSampleOffsetKey "IOAudioEngineInputSampleOffset" #define kIOAudioEngineNumSampleFramesPerBufferKey "IOAudioEngineNumSampleFramesPerBuffer" #define kIOAudioEngineCoreAudioPlugInKey "IOAudioEngineCoreAudioPlugIn" #define kIOAudioEngineNumActiveUserClientsKey "IOAudioEngineNumActiveUserClients" #define kIOAudioEngineUserClientActiveKey "IOAudioEngineUserClientActive" #define kIOAudioEngineGlobalUniqueIDKey "IOAudioEngineGlobalUniqueID" #define kIOAudioEngineDescriptionKey "IOAudioEngineDescription" #define kIOAudioEngineClockIsStableKey "IOAudioEngineClockIsStable" #define kIOAudioEngineClockDomainKey "IOAudioEngineClockDomain" #define kIOAudioEngineIsHiddenKey "IOAudioEngineIsHidden" #define kIOAudioEngineOutputAutoRouteKey "NoAutoRoute" /*! * @defined kIOAudioEngineUseHiResSampleInterval * @abstract The key in the IORegistry to tell the HAL to use "Hi Resolution" sampleInterval values in performClientIO * @discussion The HAL has always passed two 32 bit values to the performClientIO trap. sampleIntervalHi is the upper * 32 bits and sampleIntervalLo the lower 32 bits of an AbsoluteTime representing the time between two consecutive audio * samples on this Engine's running clock. This time is always very small, meaning that the upper 32 bits are always 0 * but the value is also rounded, meaning that there could be error in the amount of time, especially at higher sample rates * where the value is pretty small (e.g. at a nominal rate of 768kHz, sampleInterval is 1302.0833 nanoseconds which will come * into performClientIO as (0, 1302) thus losing some precision * when kIOAudioEngineUseHiResSampleInterval is set, the HAL will send the sampleInterval as a 32.32 Fixed Point number. * sampleIntervalHi will contain the integer part of the sampleInterval (1302) abd sampleIntervalLo will contain the fractional * part encoded as a standard binary fixed point decimal */ #define kIOAudioEngineUseHiResSampleIntervalKey "IOAudioEngineUseHiResSampleInterval" /*! * @defined kIOAudioEngineFullChannelNamesKey * @abstract The key in the IORegistry for the IOAudioEngine's dictionary of fully constructed names for each channel keyed by the device channel * @discussion */ #define kIOAudioEngineFullChannelNamesKey "IOAudioEngineChannelNames" /*! * @defined kIOAudioEngineFullChannelCategoryNamesKey * @abstract The key in the IORegistry for the IOAudioEngine's dictionary of category names for each channel keyed by the device channel * @discussion */ #define kIOAudioEngineFullChannelCategoryNamesKey "IOAudioEngineChannelCategoryNames" /*! * @defined kIOAudioEngineFullChannelNamesKey * @abstract The key in the IORegistry for the IOAudioEngine's dictionary of number names for each channel keyed by the device channel * @discussion */ #define kIOAudioEngineFullChannelNumberNamesKey "IOAudioEngineChannelNumberNames" #define kIOAudioEngineFullChannelNameKeyInputFormat "InputChannel%u" #define kIOAudioEngineFullChannelNameKeyOutputFormat "OutputChannel%u" #define kIOAudioEngineFlavorKey "IOAudioEngineFlavor" #define kIOAudioEngineAlwaysLoadCoreAudioPlugInKey "IOAudioEngineAlwaysLoadCoreAudioPlugIn" /*! * @defined kIOAudioEngineInputChannelLayoutKey * @abstract The key in the IORegistry for the IOAudioEngine's dictionary describes an array of OSNumber data that describe the spatial position of each channel. See IOAudioTypes.h. * @discussion */ #ifndef __OPEN_SOURCE__ // <rdar://6868206> #endif #define kIOAudioEngineInputChannelLayoutKey "IOAudioEngineInputChannelLayout" /*! * @defined kIOAudioEngineOutputChannelLayoutKey * @abstract The key in the IORegistry for the IOAudioEngine's dictionary describes an array of OSNumber data that describe the spatial position of each channel. See IOAudioTypes.h. * @discussion */ #ifndef __OPEN_SOURCE__ // <rdar://6868206> #endif #define kIOAudioEngineOutputChannelLayoutKey "IOAudioEngineOutputChannelLayout" /*! * @defined kIOAudioEngineDisableClockBoundsCheck * @abstract The key in the IORegistry for the IOAudioEngine's dictionary implemented as an OSBoolean that is used to disable the bounds checking on timestamps being passed to the HAL. * @discussion By using this key and setting the value to true the driver is asserting that it guarantees that all zero timestamps passed to the HAL increment appropriately at the correct period. This key is used to disable the HAL test that the timestamp is within 1ms of the current time, so that a driver may pass a timestamp that is more than 1ms in the future. This may be useful when a timestamp is based on a large DMA read/write which encompasses the wrap point but occurs many samples before the end of that point. */ #define kIOAudioEngineDisableClockBoundsCheck "IOAudioEngineDisableClockBoundsCheck" /***** * * IOAudioStream defines * *****/ #define kIOAudioStreamIDKey "IOAudioStreamID" #define kIOAudioStreamDescriptionKey "IOAudioStreamDescription" #define kIOAudioStreamNumClientsKey "IOAudioStreamNumClients" /*! * @defined kIOAudioStreamDirectionKey * @abstract The key in the IORegistry for the IOAudioStream direction attribute. * @discussion The value for this key may be either "Output" or "Input". */ #define kIOAudioStreamDirectionKey "IOAudioStreamDirection" #define kIOAudioStreamStartingChannelIDKey "IOAudioStreamStartingChannelID" #define kIOAudioStreamStartingChannelNumberKey "IOAudioStreamStartingChannelNumber" #define kIOAudioStreamAvailableKey "IOAudioStreamAvailable" #define kIOAudioStreamFormatKey "IOAudioStreamFormat" #define kIOAudioStreamAvailableFormatsKey "IOAudioStreamAvailableFormats" #define kIOAudioStreamNumChannelsKey "IOAudioStreamNumChannels" #define kIOAudioStreamSampleFormatKey "IOAudioStreamSampleFormat" #define kIOAudioStreamNumericRepresentationKey "IOAudioStreamNumericRepresentation" #define kIOAudioStreamFormatFlagsKey "IOAudioStreamFormatFlags" #define kIOAudioStreamFramesPerPacketKey "IOAudioStreamFramesPerPacket" #define kIOAudioStreamBytesPerPacketKey "IOAudioStreamBytesPerPacket" #define kIOAudioStreamBitDepthKey "IOAudioStreamBitDepth" #define kIOAudioStreamBitWidthKey "IOAudioStreamBitWidth" #define kIOAudioStreamAlignmentKey "IOAudioStreamAlignment" #define kIOAudioStreamByteOrderKey "IOAudioStreamByteOrder" #define kIOAudioStreamIsMixableKey "IOAudioStreamIsMixable" #define kIOAudioStreamMinimumSampleRateKey "IOAudioStreamMinimumSampleRate" #define kIOAudioStreamMaximumSampleRateKey "IOAudioStreamMaximumSampleRate" #define kIOAudioStreamDriverTagKey "IOAudioStreamDriverTag" #define kIOAudioStreamTerminalTypeKey "IOAudioStreamTerminalType" /***** * * IOAudioPort defines * *****/ /*! * @defined kIOAudioPortTypeKey * @abstract The key in the IORegistry for the IOAudioPort type attribute. * @discussion This is a driver-defined text attribute that may contain any type. * Common types are defined as: "Speaker", "Headphones", "Microphone", "CD", "Line", "Digital", "Mixer", "PassThru". */ #define kIOAudioPortTypeKey "IOAudioPortType" /*! * @defined kIOAudioPortSubTypeKey * @abstract The key in the IORegistry for the IOAudioPort subtype attribute. * @discussion The IOAudioPort subtype is a driver-defined text attribute designed to complement the type * attribute. */ #define kIOAudioPortSubTypeKey "IOAudioPortSubType" /*! * @defined kIOAudioPortNameKey * @abstract The key in the IORegistry for the IOAudioPort name attribute. */ #define kIOAudioPortNameKey "IOAudioPortName" /***** * * IOAudioControl defines * *****/ /*! * @defined kIOAudioControlTypeKey * @abstract The key in the IORegistry for the IOAudioCntrol type attribute. * @discussion The value of this text attribute may be defined by the driver, however system-defined * types recognized by the upper-level software are "Level", "Mute", "Selector". */ #define kIOAudioControlTypeKey "IOAudioControlType" #define kIOAudioControlSubTypeKey "IOAudioControlSubType" #define kIOAudioControlUsageKey "IOAudioControlUsage" #define kIOAudioControlIDKey "IOAudioControlID" /*! * @defined kIOAudioControlChannelIDKey * @abstract The key in the IORegistry for the IOAudioControl channel ID attribute * @discussion The value for this key is an integer which may be driver defined. Default values for * common channel types are provided in the following defines. */ #define kIOAudioControlChannelIDKey "IOAudioControlChannelID" #define kIOAudioControlChannelNumberKey "IOAudioControlChannelNumber" #define kIOAudioControlCoreAudioPropertyIDKey "IOAudioControlCoreAudioPropertyID" /*! * @defined kIOAudioControlChannelNameKey * @abstract The key in the IORegistry for the IOAudioControl name attribute. * @discussion This name should be a human-readable name for the channel(s) represented by the port. * *** NOTE *** We really need to make all of the human-readable attributes that have potential to * be used in a GUI localizable. There will need to be localized strings in the kext bundle matching * the text. */ #define kIOAudioControlChannelNameKey "IOAudioControlChannelName" /*! * @defined kIOAudioControlChannelNameAll * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for all channels. */ #define kIOAudioControlChannelNameAll "All Channels" /*! * @defined kIOAudioControlChannelNameLeft * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the left channel. */ #define kIOAudioControlChannelNameLeft "Left" /*! * @defined kIOAudioControlChannelNameRight * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the right channel. */ #define kIOAudioControlChannelNameRight "Right" /*! * @defined kIOAudioControlChannelNameCenter * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the center channel. */ #define kIOAudioControlChannelNameCenter "Center" /*! * @defined kIOAudioControlChannelNameLeftRear * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the left rear channel. */ #define kIOAudioControlChannelNameLeftRear "LeftRear" /*! * @defined kIOAudioControlChannelNameRightRear * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the right rear channel. */ #define kIOAudioControlChannelNameRightRear "RightRear" /*! * @defined kIOAudioControlChannelNameSub * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the sub/LFE channel. */ #define kIOAudioControlChannelNameSub "Sub" /*! * @defined kIOAudioControlChannelNameFrontLeftCenter * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the FrontLeftCenter channel. */ #define kIOAudioControlChannelNameFrontLeftCenter "FrontLeftCenter" /*! * @defined kIOAudioControlChannelNameFrontRightCenter * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the FrontRightCenter channel. */ #define kIOAudioControlChannelNameFrontRightCenter "FrontRightCenter" /*! * @defined kIOAudioControlChannelNameRearCenter * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the RearCenter channel. */ #define kIOAudioControlChannelNameRearCenter "RearCenter" /*! * @defined kIOAudioControlChannelNameSurroundLeft * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the SurroundLeft channel. */ #define kIOAudioControlChannelNameSurroundLeft "SurroundLeft" /*! * @defined kIOAudioControlChannelNameSurroundRight * @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing * the channel name for the SurroundRight channel. */ #define kIOAudioControlChannelNameSurroundRight "SurroundRight" /*! * @defined kIOAudioControlValueKey * @abstract The key in the IORegistry for the IOAudioControl value attribute. * @discussion The value returned by this key is a 32-bit integer representing the current value of the IOAudioControl. */ #define kIOAudioControlValueKey "IOAudioControlValue" /*! * @defined kIOAudioControlValueIsReadOnlyKey * @abstract The key in the IORegistry for the IOAudioControl value-is-read-only attribute. * @discussion The value returned by this key is a 32-bit integer but the value doesn't have any direct meaning. * Instead, the presence of this key indicates that the value for the control is read-only */ #define kIOAudioControlValueIsReadOnlyKey "IOAudioControlValueIsReadOnly" /*! * @defined kIOAudioLevelControlMinValueKey * @abstract The key in the IORegistry for the IOAudioControl minimum value attribute. * @discussion The value returned by this key is a 32-bit integer representing the minimum value for the IOAudioControl. * This is currently only valid for Level controls or other driver-defined controls that have a minimum and maximum * value. */ #define kIOAudioLevelControlMinValueKey "IOAudioLevelControlMinValue" /*! * @defined kIOAudioLevelControlMaxValueKey * @abstract The key in the IORegistry for the IOAudioControl maximum value attribute. * @discussion The value returned by this key is a 32-bit integer representing the maximum value for the IOAudioControl. * This is currently only valid for Level controls or other driver-defined controls that have a minimum and maximum * value. */ #define kIOAudioLevelControlMaxValueKey "IOAudioLevelControlMaxValue" /*! * @defined kIOAudioLevelControlMinDBKey * @abstract The key in the IORgistry for the IOAudioControl minimum db value attribute. * @discussion The value returned by this key is a fixed point value in 16.16 format represented as a 32-bit * integer. It represents the minimum value in db for the IOAudioControl. This value matches the minimum * value attribute. This is currently valid for Level controls or other driver-defined controls that have a * minimum and maximum db value. */ #define kIOAudioLevelControlMinDBKey "IOAudioLevelControlMinDB" /*! * @defined kIOAudioLevelControlMaxDBKey * @abstract The key in the IORgistry for the IOAudioControl maximum db value attribute. * @discussion The value returned by this key is a fixed point value in 16.16 format represented as a 32-bit * integer. It represents the maximum value in db for the IOAudioControl. This value matches the maximum * value attribute. This is currently valid for Level controls or other driver-defined controls that have a * minimum and maximum db value. */ #define kIOAudioLevelControlMaxDBKey "IOAudioLevelControlMaxDB" #define kIOAudioLevelControlRangesKey "IOAudioLevelControlRanges" #define kIOAudioLevelControlUseLinearScale "IOAudioLevelControlUseLinearScale" #define kIOAudioSelectorControlAvailableSelectionsKey "IOAudioSelectorControlAvailableSelections" #define kIOAudioSelectorControlSelectionValueKey "IOAudioSelectorControlSelectionValue" #define kIOAudioSelectorControlSelectionDescriptionKey "IOAudioSelectorControlSelectionDescriptionKey" #define kIOAudioSelectorControlTransportValueKey "IOAudioSelectorControlTransportValue" // <rdar://8202424> #define kIOAudioSelectorControlClockSourceKey "IOAudioSelectorControlClockSourceKey" #endif /* _IOAUDIODEFINES_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/audio/IOAudioDebug.h
/* * Copyright (c) 1998-2014 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@ */ #ifndef _IOAUDIODEBUG_H #define _IOAUDIODEBUG_H #include <IOKit/IOTypes.h> #include <sys/kdebug.h> #ifdef DEBUG #define DEBUG_LEVEL 4 //<rdar://problem/9725460> //#define DEBUG_USE_FIRELOG 1 #define DEBUG_USE_FIREWIRE_KPRINTF 1 #ifdef DEBUG_USE_FIRELOG #include <IOKit/firewire/FireLog.h> #define audioDebugIOLog( level, message... ) \ do {FireLog( message ); FireLog("\n");} while (0) #define audioErrorIOLog( message... ) \ do { FireLog( message ); FireLog("\n"); IOLog( message );} while (0) #endif #ifdef DEBUG_USE_IOUSBLOG #include <IOKit/usb/IOUSBLog.h> #define audioDebugIOLog( level, message... ) \ do {USBLog( level, message );} while (0) #define audioErrorIOLog( level, message... ) \ do { USBLog( DEBUG_LEVEL_BETA, message ); IOLog( message );} while (0) #endif #ifdef DEBUG_USE_FIREWIRE_KPRINTF #define audioDebugIOLog( level, message... ) \ do { if (level <= DEBUG_LEVEL) kprintf( message );} while (0) #define audioErrorIOLog( message... ) \ do { kprintf( message ); IOLog( message );} while (0) #endif #ifdef assert #undef assert #define AssertionMessage( cond, file, line ) \ "assert \"" #cond "\" failed in " #file " at line " #line #define AssertionFailed( cond, file, line ) \ panic(AssertionMessage( cond, file, line )); #define assert( cond ) \ if( !(cond) ) { \ AssertionFailed( cond, __FILE__, __LINE__ ) \ } #endif #else #define DEBUG_LEVEL 3 #include <os/log.h> #define audioDebugIOLog( level, message... ) \ do { if ( __builtin_expect(level <= DEBUG_LEVEL, 0) ) { os_log( OS_LOG_DEFAULT, message ); } } while (0) #define audioErrorIOLog( message... ) \ do { os_log_error( OS_LOG_DEFAULT, message ); IOLog( message );} while (0) #endif #endif /* _IOAUDIODEBUG_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pci/IOPCIDevice.h
/* * Copyright (c) 1998-2021 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@ */ #ifndef _IOKIT_IOPCIDEVICE_H #define _IOKIT_IOPCIDEVICE_H #include <IOKit/IOTypes.h> #include <IOKit/pci/IOPCIFamilyDefinitions.h> #define TARGET_OS_HAS_PCIDRIVERKIT_IOPCIDEVICE __has_include(<PCIDriverKit/IOPCIDevice.h>) #if TARGET_OS_HAS_PCIDRIVERKIT_IOPCIDEVICE #include <PCIDriverKit/IOPCIDevice.h> #endif /* Definitions of PCI Config Registers */ enum { kIOPCIConfigVendorID = kIOPCIConfigurationOffsetVendorID, kIOPCIConfigDeviceID = kIOPCIConfigurationOffsetDeviceID, kIOPCIConfigCommand = kIOPCIConfigurationOffsetCommand, kIOPCIConfigStatus = kIOPCIConfigurationOffsetStatus, kIOPCIConfigRevisionID = kIOPCIConfigurationOffsetRevisionID, kIOPCIConfigClassCode = kIOPCIConfigurationOffsetClassCode, kIOPCIConfigCacheLineSize = kIOPCIConfigurationOffsetCacheLineSize, kIOPCIConfigLatencyTimer = kIOPCIConfigurationOffsetLatencyTimer, kIOPCIConfigHeaderType = kIOPCIConfigurationOffsetHeaderType, kIOPCIConfigBIST = kIOPCIConfigurationOffsetBIST, kIOPCIConfigBaseAddress0 = kIOPCIConfigurationOffsetBaseAddress0, kIOPCIConfigBaseAddress1 = kIOPCIConfigurationOffsetBaseAddress1, kIOPCIConfigBaseAddress2 = kIOPCIConfigurationOffsetBaseAddress2, kIOPCIConfigBaseAddress3 = kIOPCIConfigurationOffsetBaseAddress3, kIOPCIConfigBaseAddress4 = kIOPCIConfigurationOffsetBaseAddress4, kIOPCIConfigBaseAddress5 = kIOPCIConfigurationOffsetBaseAddress5, kIOPCIConfigCardBusCISPtr = kIOPCIConfigurationOffsetCardBusCISPtr, kIOPCIConfigSubSystemVendorID = kIOPCIConfigurationOffsetSubSystemVendorID, kIOPCIConfigSubSystemID = kIOPCIConfigurationOffsetSubSystemID, kIOPCIConfigExpansionROMBase = kIOPCIConfigurationOffsetExpansionROMBase, kIOPCIConfigCapabilitiesPtr = kIOPCIConfigurationOffsetCapabilitiesPtr, kIOPCIConfigInterruptLine = kIOPCIConfigurationOffsetInterruptLine, kIOPCIConfigInterruptPin = kIOPCIConfigurationOffsetInterruptPin, kIOPCIConfigMinimumGrant = kIOPCIConfigurationOffsetMinimumGrant, kIOPCIConfigMaximumLatency = kIOPCIConfigurationOffsetMaximumLatency }; /* Definitions of Capabilities PCI Config Register */ enum { kIOPCIPowerManagementCapability = kIOPCICapabilityIDPowerManagement, kIOPCIAGPCapability = kIOPCICapabilityIDAGP, kIOPCIVitalProductDataCapability = kIOPCICapabilityIDVitalProductData, kIOPCISlotIDCapability = kIOPCICapabilityIDSlotID, kIOPCIMSICapability = kIOPCICapabilityIDMSI, kIOPCICPCIHotswapCapability = kIOPCICapabilityIDCPCIHotswap, kIOPCIPCIXCapability = kIOPCICapabilityIDPCIX, kIOPCILDTCapability = kIOPCICapabilityIDLDT, kIOPCIVendorSpecificCapability = kIOPCICapabilityIDVendorSpecific, kIOPCIDebugPortCapability = kIOPCICapabilityIDDebugPort, kIOPCICPCIResourceControlCapability = kIOPCICapabilityIDCPCIResourceControl, kIOPCIHotplugCapability = kIOPCICapabilityIDHotplug, kIOPCIAGP8Capability = kIOPCICapabilityIDAGP8, kIOPCISecureCapability = kIOPCICapabilityIDSecure, kIOPCIPCIExpressCapability = kIOPCICapabilityIDPCIExpress, kIOPCIMSIXCapability = kIOPCICapabilityIDMSIX, kIOPCIFPBCapability = kIOPCICapabilityIDFPB, kIOPCIExpressErrorReportingCapability = kIOPCIExpressCapabilityIDErrorReporting, kIOPCIExpressVirtualChannelCapability = kIOPCIExpressCapabilityIDVirtualChannel, kIOPCIExpressDeviceSerialNumberCapability = kIOPCIExpressCapabilityIDDeviceSerialNumber, kIOPCIExpressPowerBudgetCapability = kIOPCIExpressCapabilityIDPowerBudget, kIOPCIExpressAccessControlServicesCapability = kIOPCIExpressCapabilityIDAccessControlServices, kIOPCIExpressLatencyTolerenceReportingCapability = kIOPCIExpressCapabilityIDLatencyTolerenceReporting, kIOPCIExpressL1PMSubstatesCapability = kIOPCIExpressCapabilityIDL1PMSubstates, }; /* Space definitions */ enum { kIOPCIConfigSpace = 0, kIOPCIIOSpace = 1, kIOPCI32BitMemorySpace = 2, kIOPCI64BitMemorySpace = 3 }; enum { kPCI2PCIPrimaryBus = 0x18, kPCI2PCISecondaryBus = 0x19, kPCI2PCISubordinateBus = 0x1a, kPCI2PCISecondaryLT = 0x1b, kPCI2PCIIORange = 0x1c, kPCI2PCIMemoryRange = 0x20, kPCI2PCIPrefetchMemoryRange = 0x24, kPCI2PCIPrefetchUpperBase = 0x28, kPCI2PCIPrefetchUpperLimit = 0x2c, kPCI2PCIUpperIORange = 0x30, kPCI2PCIBridgeControl = 0x3e }; #define IOPCIPMCSPMEDISABLEINS3_DEFINED 1 #define IOPCIPMCSPMEWAKEREASON_DEFINED 1 union IOPCIAddressSpace { UInt32 bits; struct { #if __BIG_ENDIAN__ unsigned int reloc:1; unsigned int prefetch:1; unsigned int t:1; unsigned int resv:3; unsigned int space:2; unsigned int busNum:8; unsigned int deviceNum:5; unsigned int functionNum:3; unsigned int registerNum:8; #elif __LITTLE_ENDIAN__ unsigned int registerNum:8; unsigned int functionNum:3; unsigned int deviceNum:5; unsigned int busNum:8; unsigned int space:2; unsigned int resv:3; unsigned int t:1; unsigned int prefetch:1; unsigned int reloc:1; #endif } s; struct { #if __BIG_ENDIAN__ unsigned int resv:4; unsigned int registerNumExtended:4; unsigned int busNum:8; unsigned int deviceNum:5; unsigned int functionNum:3; unsigned int registerNum:8; #elif __LITTLE_ENDIAN__ unsigned int registerNum:8; unsigned int functionNum:3; unsigned int deviceNum:5; unsigned int busNum:8; unsigned int registerNumExtended:4; unsigned int resv:4; #endif } es; }; typedef union IOPCIAddressSpace IOPCIAddressSpace; struct IOPCIPhysicalAddress { IOPCIAddressSpace physHi; #if defined(__i386__) || defined(__x86_64__) UInt32 physMid; UInt32 physLo; UInt32 lengthHi; UInt32 lengthLo; #else UInt32 physLo; UInt32 physMid; UInt32 lengthLo; UInt32 lengthHi; #endif }; #ifndef kIOPlatformDeviceASPMEnableKey #define kIOPlatformDeviceASPMEnableKey "IOPlatformDeviceASPMEnable" #endif #ifndef kIOPCIDeviceASPMSupportedKey #define kIOPCIDeviceASPMSupportedKey "pci-aspm-supported" #endif #define kIOPCIPMEOptionsKey "IOPCIPMEOptions" #define kIOPCITunnelIDKey "IOPCITunnelID" #define kIOPCITunnelControllerIDKey "IOPCITunnelControllerID" #define kIOPCIBridgeInterruptESKey "IOPCIBridgeInterruptES" #define kIOPCIDeviceDeviceTreeEntryKey "IOPCIDeviceDeviceTreeEntry" #if ACPI_SUPPORT #define kIOPCIUseDeviceMapperKey "IOPCIUseDeviceMapper" #define kIOPCIChildBundleIdentifierKey "driver-child-bundle" #define kIOPCIDeviceMapArgLen 1024 #endif enum { kIOPCIDevicePowerStateCount = 4, kIOPCIDeviceOffState = 0, kIOPCIDeviceDozeState = 1, kIOPCIDeviceOnState = 2, kIOPCIDevicePausedState = 3, }; // setLatencyTolerance options enum { kIOPCILatencySnooped = 0x00000001, kIOPCILatencyUnsnooped = 0x00000002, }; enum { kIOPCIProbeOptionDone = 0x80000000, kIOPCIProbeOptionEject = 0x00100000, kIOPCIProbeOptionNeedsScan = 0x00200000, }; // saveDeviceState options enum { kIOPCIConfigShadowPermanent = 0x80000000, }; #if defined(KERNEL) #include <IOKit/IOService.h> #include <IOKit/IOEventSource.h> class IOPCIDevice; class IOPCIBridge; class IOPCI2PCIBridge; class IOPCIMessagedInterruptController; class IOPCIConfigurator; class IOPCIEventSource; class IOPCIHostBridgeData; // IOPCIEvent.event enum { kIOPCIEventCorrectableError = 1, kIOPCIEventNonFatalError = 2, kIOPCIEventFatalError = 3, kIOPCIEventLinkEnableChange = 4, }; struct IOPCIEvent { IOPCIDevice * reporter; uint32_t event; uint32_t data[5]; }; __exported_push class __kpi_deprecated("Use PCIDriverKit") IOPCIEventSource : public IOEventSource { friend class IOPCIBridge; friend class IOPCI2PCIBridge; OSDeclareDefaultStructors(IOPCIEventSource); public: typedef void (*Action)(OSObject * owner, IOPCIEventSource * es, const IOPCIEvent * event ); #define IOPCIEventAction IOPCIEventSource::Action private: queue_chain_t fQ; IOPCI2PCIBridge * fRoot; IOPCIDevice * fDevice; uint8_t fReadIndex; uint8_t fWriteIndex; IOPCIEvent * fEvents; IOPCIHostBridgeData *getHostBridgeData(void); public: virtual void enable( void ) APPLE_KEXT_OVERRIDE; virtual void disable( void ) APPLE_KEXT_OVERRIDE; protected: virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual bool checkForWork( void ) APPLE_KEXT_OVERRIDE; }; __exported_pop typedef IOReturn (*IOPCIDeviceConfigHandler)(void * ref, IOMessage message, IOPCIDevice * device, uint32_t state); /*! @class IOPCIDevice : public IOService @abstract An IOService class representing a PCI device. @discussion The discovery of a PCI device by the PCI bus family results in an instance of the IOPCIDevice being created and published. It provides services for looking up and mapping memory mapped hardware, and access to the PCI configuration and I/O spaces. <br><br>Matching Supported by IOPCIDevice<br><br> Two types of matching are available, OpenFirmware name matching and PCI register matching. Currently, only one of these two matching schemes can be used in the same property table. <br><br>OpenFirmware Name Matching<br><br> IOService performs matching based on the IONameMatch property (see IOService). IOPCIDevices created with OpenFirmware device tree entries will name match based on the standard OpenFirmware name matching properties. <br><br>PCI Register Matching<br><br> A PCI device driver can also match on the values of certain config space registers. In each case, several matching values can be specified, and an optional mask for the value of the config space register may follow the value, preceded by an '&' character. <br> <br> kIOPCIMatchKey, "IOPCIMatch" <br> The kIOPCIMatchKey property matches the vendor and device ID (0x00) register, or the subsystem register (0x2c). <br> <br> kIOPCIPrimaryMatchKey, "IOPCIPrimaryMatch" <br> The kIOPCIPrimaryMatchKey property matches the vendor and device ID (0x00) register. <br> <br> kIOPCISecondaryMatchKey, "IOPCISecondaryMatch" <br> The kIOPCISecondaryMatchKey property matches the subsystem register (0x2c). <br> <br> kIOPCIClassMatchKey, "IOPCIClassMatch" <br> The kIOPCIClassMatchKey property matches the class code register (0x08). The default mask for this register is 0xffffff00. <br> <br> Examples: <br> <br> &ltkey&gtIOPCIMatch&lt/key&gt <br> &ltstring&gt0x00261011&lt/string&gt <br> Matches a device whose vendor ID is 0x1011, and device ID is 0x0026, including subsystem IDs. <br> <br> &ltkey&gtIOPCIMatch&lt/key&gt <br> &ltstring&gt0x00789004&0x00ffffff 0x78009004&0x0xff00ffff&lt/string&gt <br> Matches with any device with a vendor ID of 0x9004, and a device ID of 0xzz78 or 0x78zz, where 'z' is don't care. <br> <br> &ltkey&gtIOPCIClassMatch&lt/key&gt <br> &ltstring&gt0x02000000&0xffff0000&lt/string&gt <br> <br> Matches a device whose class code is 0x0200zz, an ethernet device. */ __exported_push class __kpi_deprecated("Use PCIDriverKit") IOPCIDevice : public IOService { #if TARGET_OS_HAS_PCIDRIVERKIT_IOPCIDEVICE OSDeclareDefaultStructorsWithDispatch(IOPCIDevice) #else OSDeclareDefaultStructors(IOPCIDevice) #endif friend class IOPCIBridge; friend class IOPCI2PCIBridge; friend class IOPCIMessagedInterruptController; friend class IOPCIConfigurator; friend class IOPCIHostBridgeData; protected: IOPCIBridge * parent; IOMemoryMap * ioMap; OSObject * slotNameProperty; /*! @var reserved Reserved for future use. (Internal use only) */ struct IOPCIDeviceExpansionData * reserved; public: IOPCIAddressSpace space; UInt32 * savedConfig; public: /* IOService/IORegistryEntry methods */ virtual bool init( OSDictionary * propTable ) APPLE_KEXT_OVERRIDE; virtual bool init( IORegistryEntry * from, const IORegistryPlane * inPlane ) APPLE_KEXT_OVERRIDE; virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual bool attach( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void detach( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void detachAbove(const IORegistryPlane *) APPLE_KEXT_OVERRIDE; virtual IOReturn newUserClient( task_t owningTask, void * securityID, UInt32 type, OSDictionary * properties, IOUserClient ** handler ) APPLE_KEXT_OVERRIDE; virtual bool handleOpen(IOService * forClient, IOOptionBits options, void * arg); virtual void handleClose(IOService * forClient, IOOptionBits options); virtual IOReturn requestProbe( IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual IOReturn powerStateWillChangeTo (IOPMPowerFlags capabilities, unsigned long stateNumber, IOService* whatDevice) APPLE_KEXT_OVERRIDE; virtual IOReturn setPowerState( unsigned long, IOService * ) APPLE_KEXT_OVERRIDE; virtual unsigned long maxCapabilityForDomainState ( IOPMPowerFlags domainState ) APPLE_KEXT_OVERRIDE; virtual unsigned long initialPowerStateForDomainState ( IOPMPowerFlags domainState ) APPLE_KEXT_OVERRIDE; virtual unsigned long powerStateForDomainState ( IOPMPowerFlags domainState ) APPLE_KEXT_OVERRIDE; virtual bool compareName( OSString * name, OSString ** matched = 0 ) const APPLE_KEXT_OVERRIDE; virtual bool matchPropertyTable(OSDictionary * table) APPLE_KEXT_OVERRIDE; virtual bool matchPropertyTable( OSDictionary * table, SInt32 * score ) APPLE_KEXT_OVERRIDE; virtual IOService * matchLocation( IOService * client ) APPLE_KEXT_OVERRIDE; virtual IOReturn getResources( void ) APPLE_KEXT_OVERRIDE; using IOService::getProperty; virtual OSObject * getProperty( const OSSymbol * aKey) const APPLE_KEXT_OVERRIDE; virtual IOReturn setProperties(OSObject * properties) APPLE_KEXT_OVERRIDE; virtual IOReturn callPlatformFunction(const OSSymbol * functionName, bool waitForFunction, void * p1, void * p2, void * p3, void * p4) APPLE_KEXT_OVERRIDE; virtual IOReturn callPlatformFunction(const char * functionName, bool waitForFunction, void * p1, void * p2, void * p3, void * p4) APPLE_KEXT_OVERRIDE; virtual IODeviceMemory * getDeviceMemoryWithIndex(unsigned int index) APPLE_KEXT_OVERRIDE; private: bool configAccess(bool write); bool initReserved(void); IOReturn setPCIPowerState(uint8_t powerState, uint32_t options); void updateWakeReason(uint16_t pmeState); IOReturn enableLTR(IOPCIDevice * device, bool enable); IOReturn enableACS(IOPCIDevice * device, bool enable); IOReturn clientCrashedThreadCall(thread_call_t threadCall); public: /* Config space accessors */ virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset ); virtual void configWrite32( IOPCIAddressSpace space, UInt8 offset, UInt32 data ); virtual UInt16 configRead16( IOPCIAddressSpace space, UInt8 offset ); virtual void configWrite16( IOPCIAddressSpace space, UInt8 offset, UInt16 data ); virtual UInt8 configRead8( IOPCIAddressSpace space, UInt8 offset ); virtual void configWrite8( IOPCIAddressSpace space, UInt8 offset, UInt8 data ); #if __IOPCIDEVICE_INTERNAL__ #if APPLE_KEXT_VTABLE_PADDING virtual UInt32 configRead32( UInt8 offset ); virtual UInt16 configRead16( UInt8 offset ); virtual UInt8 configRead8( UInt8 offset ); virtual void configWrite32( UInt8 offset, UInt32 data ); virtual void configWrite16( UInt8 offset, UInt16 data ); virtual void configWrite8( UInt8 offset, UInt8 data ); #endif /* APPLE_KEXT_VTABLE_PADDING */ #else /* !__IOPCIDEVICE_INTERNAL__ */ /*! @function configRead32 @abstract Reads a 32-bit value from the PCI device's configuration space. @discussion This method reads a 32-bit configuration space register on the device and returns its value. @param offset An offset into configuration space, of which bits 0-1 are ignored. @result An 32-bit value in host byte order (big endian on PPC). */ UInt32 configRead32( IOByteCount offset ) { return (extendedConfigRead32(offset)); } /*! @function configRead16 @abstract Reads a 16-bit value from the PCI device's configuration space. @discussion This method reads a 16-bit configuration space register on the device and returns its value. @param offset An offset into configuration space, of which bit 0 is ignored. @result An 16-bit value in host byte order (big endian on PPC). */ UInt16 configRead16( IOByteCount offset ) { return (extendedConfigRead16(offset)); } /*! @function configRead8 @abstract Reads a 8-bit value from the PCI device's configuration space. @discussion This method reads a 8-bit configuration space register on the device and returns its value. @param offset An offset into configuration space. @result An 8-bit value. */ UInt8 configRead8( IOByteCount offset ) { return (extendedConfigRead8(offset)); } /*! @function configWrite32 @abstract Writes a 32-bit value to the PCI device's configuration space. @discussion This method write a 32-bit value to a configuration space register on the device. @param offset An offset into configuration space, of which bits 0-1 are ignored. @param data An 32-bit value to be written in host byte order (big endian on PPC). */ void configWrite32( IOByteCount offset, UInt32 data ) { return (extendedConfigWrite32(offset, data)); } /*! @function configWrite16 @abstract Writes a 16-bit value to the PCI device's configuration space. @discussion This method write a 16-bit value to a configuration space register on the device. @param offset An offset into configuration space, of which bit 0 is ignored. @param data An 16-bit value to be written in host byte order (big endian on PPC). */ void configWrite16( IOByteCount offset, UInt16 data ) { return (extendedConfigWrite16(offset, data)); } /*! @function configWrite8 @abstract Writes a 8-bit value to the PCI device's configuration space. @discussion This method write a 8-bit value to a configuration space register on the device. @param offset An offset into configuration space. @param data An 8-bit value to be written. */ void configWrite8( IOByteCount offset, UInt8 data ) { return (extendedConfigWrite8(offset, data)); } OSMetaClassDeclareReservedUnused(IOPCIDevice, 16); OSMetaClassDeclareReservedUnused(IOPCIDevice, 17); OSMetaClassDeclareReservedUnused(IOPCIDevice, 18); OSMetaClassDeclareReservedUnused(IOPCIDevice, 19); OSMetaClassDeclareReservedUnused(IOPCIDevice, 20); OSMetaClassDeclareReservedUnused(IOPCIDevice, 21); public: #endif /* !__IOPCIDEVICE_INTERNAL__ */ virtual IOReturn saveDeviceState( IOOptionBits options = 0 ); virtual IOReturn restoreDeviceState( IOOptionBits options = 0 ); /*! @function setConfigBits @abstract Sets masked bits in a configuration space register. @discussion This method sets masked bits in a configuration space register on the device by reading and writing the register. The value of the masked bits before the write is returned. @param offset An 8-bit offset into configuration space, of which bits 0-1 are ignored. @param mask An 32-bit mask indicating which bits in the value parameter are valid. @param data An 32-bit value to be written in host byte order (big endian on PPC). @result The value of the register masked with the mask before the write. */ virtual UInt32 setConfigBits( UInt8 offset, UInt32 mask, UInt32 value ); /*! @function setMemoryEnable @abstract Sets the device's memory space response. @discussion This method sets the memory space response bit in the device's command config space register to the passed value, and returns the previous state of the enable. @param enable True or false to enable or disable the memory space response. @result True if the memory space response was previously enabled, false otherwise. */ virtual bool setMemoryEnable( bool enable ); /*! @function setIOEnable @abstract Sets the device's I/O space response. @discussion This method sets the I/O space response bit in the device's command config space register to the passed value, and returns the previous state of the enable. The exclusive option allows only one exclusive device on the bus to be enabled concurrently, this should be only for temporary access. @param enable True or false to enable or disable the I/O space response. @param exclusive If true, only one setIOEnable with the exclusive flag set will be allowed at a time on the bus, this should be only for temporary access. @result True if the I/O space response was previously enabled, false otherwise. */ virtual bool setIOEnable( bool enable, bool exclusive = false ); /*! @function setBusMasterEnable @abstract Sets the device's bus master enable. @discussion This method sets the bus master enable bit in the device's command config space register to the passed value, and returns the previous state of the enable. @param enable True or false to enable or disable bus mastering. @result True if bus mastering was previously enabled, false otherwise. */ virtual bool setBusMasterEnable( bool enable ); /*! @function findPCICapability @abstract Search configuration space for a PCI capability register. @discussion This method searches the device's config space for a PCI capability register matching the passed capability ID, if the device supports PCI capabilities. To search for PCI Express extended capabilities or for multiple capablities with the same ID, use the extendedFindPCICapability() method. @param capabilityID An 8-bit PCI capability ID. @param offset An optional pointer to return the offset into config space where the capability was found. @result The 32-bit value of the capability register if one was found, zero otherwise. */ virtual UInt32 findPCICapability( UInt8 capabilityID, UInt8 * offset = 0 ); /*! @function getBusNumber @abstract Accessor to return the PCI device's assigned bus number. @discussion This method is an accessor to return the PCI device's assigned bus number. @result The 8-bit value of device's PCI bus number. */ virtual UInt8 getBusNumber( void ); /*! @function getDeviceNumber @abstract Accessor to return the PCI device's device number. @discussion This method is an accessor to return the PCI device's device number. @result The 5-bit value of device's device number. */ virtual UInt8 getDeviceNumber( void ); /*! @function getFunctionNumber @abstract Accessor to return the PCI device's function number. @discussion This method is an accessor to return the PCI device's function number. @result The 3-bit value of device's function number. */ virtual UInt8 getFunctionNumber( void ); /* Device memory accessors */ /*! @function getDeviceMemoryWithRegister @abstract Returns an instance of IODeviceMemory representing one of the device's memory mapped ranges. @discussion This method will return a pointer to an instance of IODeviceMemory for the physical memory range that was assigned to the configuration space base address register passed in. It is analogous to IOService::getDeviceMemoryWithIndex. @param reg The 8-bit configuration space register that is the base address register for the desired range. @result A pointer to an instance of IODeviceMemory, or zero no such range was found. The IODeviceMemory is retained by the provider, so is valid while attached, or while any mappings to it exist. It should not be released by the caller. */ virtual IODeviceMemory * getDeviceMemoryWithRegister( UInt8 reg ); /*! @function mapDeviceMemoryWithRegister @abstract Maps a physical range of the device. @discussion This method will create a mapping for the IODeviceMemory for the physical memory range that was assigned to the configuration space base address register passed in, with IODeviceMemory::map(options). The mapping is represented by the returned instance of IOMemoryMap, which should not be released until the mapping is no longer required. This method is analogous to IOService::mapDeviceMemoryWithIndex. @param reg The 8-bit configuration space register that is the base address register for the desired range. @param options Options to be passed to the IOMemoryDescriptor::map() method. @result An instance of IOMemoryMap, or zero if the index is beyond the count available. The mapping should be released only when access to it is no longer required. */ virtual IOMemoryMap * mapDeviceMemoryWithRegister( UInt8 reg, IOOptionBits options = 0 ); /*! @function ioDeviceMemory @abstract Accessor to the I/O space aperture for the bus. @discussion This method will return a reference to the IODeviceMemory for the I/O aperture of the bus the device is on. @result A pointer to an IODeviceMemory object for the I/O aperture. The IODeviceMemory is retained by the provider, so is valid while attached, or while any mappings to it exist. It should not be released by the caller. */ virtual IODeviceMemory * ioDeviceMemory( void ); /* I/O space accessors */ /*! @function ioWrite32 @abstract Writes a 32-bit value to an I/O space aperture. @discussion This method will write a 32-bit value to a 4 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is written relative to it, otherwise to the value is written relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC. @param offset An offset into a bus or device's I/O space aperture. @param value The value to be written in host byte order (big endian on PPC). @param map If the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space. */ virtual void ioWrite32( UInt16 offset, UInt32 value, IOMemoryMap * map = 0 ); /*! @function ioWrite16 @abstract Writes a 16-bit value to an I/O space aperture. @discussion This method will write a 16-bit value to a 2 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is written relative to it, otherwise to the value is written relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC. @param offset An offset into a bus or device's I/O space aperture. @param value The value to be written in host byte order (big endian on PPC). @param map If the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space. */ virtual void ioWrite16( UInt16 offset, UInt16 value, IOMemoryMap * map = 0 ); /*! @function ioWrite8 @abstract Writes a 8-bit value to an I/O space aperture. @discussion This method will write a 8-bit value to an offset in an I/O space aperture. If a map object is passed in, the value is written relative to it, otherwise to the value is written relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC. @param offset An offset into a bus or device's I/O space aperture. @param value The value to be written in host byte order (big endian on PPC). @param map If the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space. */ virtual void ioWrite8( UInt16 offset, UInt8 value, IOMemoryMap * map = 0 ); /*! @function ioRead32 @abstract Reads a 32-bit value from an I/O space aperture. @discussion This method will read a 32-bit value from a 4 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is read relative to it, otherwise to the value is read relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC. @param offset An offset into a bus or device's I/O space aperture. @param map If the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space. @result The value read in host byte order (big endian on PPC). */ virtual UInt32 ioRead32( UInt16 offset, IOMemoryMap * map = 0 ); /*! @function ioRead16 @abstract Reads a 16-bit value from an I/O space aperture. @discussion This method will read a 16-bit value from a 2 byte aligned offset in an I/O space aperture. If a map object is passed in, the value is read relative to it, otherwise to the value is read relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC. @param offset An offset into a bus or device's I/O space aperture. @param map If the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space. @result The value read in host byte order (big endian on PPC). */ virtual UInt16 ioRead16( UInt16 offset, IOMemoryMap * map = 0 ); /*! @function ioRead8 @abstract Reads a 8-bit value from an I/O space aperture. @discussion This method will read a 8-bit value from an offset in an I/O space aperture. If a map object is passed in, the value is read relative to it, otherwise to the value is read relative to the I/O space aperture for the bus. This function encapsulates the differences between architectures in generating I/O space operations. An eieio instruction is included on PPC. @param offset An offset into a bus or device's I/O space aperture. @param map If the offset is relative to the beginning of a device's aperture, an IOMemoryMap object for that object should be passed in. Otherwise, passing zero will write the value relative to the beginning of the bus' I/O space. @result The value read. */ virtual UInt8 ioRead8( UInt16 offset, IOMemoryMap * map = 0 ); OSMetaClassDeclareReservedUsed(IOPCIDevice, 0); /*! @function hasPCIPowerManagement @abstract determine whether or not the device supports PCI Bus Power Management. @discussion This method will look at the device's capabilties registers and determine whether or not the device supports the PCI BUS Power Management Specification. @param state(optional) Check for support of a specific state (e.g. kPCIPMCPMESupportFromD3Cold). If state is not suuplied or is 0, then check for a property in the registry which tells which state the hardware expects the device to go to during sleep. @result true if the specified state is supported */ virtual bool hasPCIPowerManagement(IOOptionBits state = 0); OSMetaClassDeclareReservedUsed(IOPCIDevice, 1); /*! @function enablePCIPowerManagement @abstract enable PCI power management for sleep state @discussion This method will enable PCI Bus Powermanagement when going to sleep mode. @param state(optional) Enables PCI Power Management by placing the function in the given state (e.g. kPCIPMCSPowerStateD3). If state is not specified or is 0xffffffff, then the IOPCIDevice determines the desired state. If state is kPCIPMCSPowerStateD0 (0) then PCI Power Management is disabled. @result kIOReturnSuccess if there were no errors */ virtual IOReturn enablePCIPowerManagement(IOOptionBits state = 0xffffffff); OSMetaClassDeclareReservedUsed(IOPCIDevice, 2); /*! @function extendedFindPCICapability @abstract Search configuration space for a PCI capability register. @discussion This method searches the device's config space for a PCI capability register matching the passed capability ID, if the device supports PCI capabilities. @param capabilityID A PCI capability ID. PCI Express devices may support extended capabilities in config space starting at offset 0x100. To search this space, the ID passed should be the negated value of the PCI-SIG assigned ID for the extended capability. @param offset An optional in/out parameter to return the offset into config space where the capability was found, and to set the start point of the next search. Initialize the offset to zero before the first call to extendedFindPCICapability() and subsequent calls will find all capabilty blocks that may exist on the device with the same ID. @result The 32-bit value of the capability register if one was found, zero otherwise. */ virtual UInt32 extendedFindPCICapability( UInt32 capabilityID, IOByteCount * offset = 0 ); // Unused Padding OSMetaClassDeclareReservedUnused(IOPCIDevice, 3); OSMetaClassDeclareReservedUnused(IOPCIDevice, 4); OSMetaClassDeclareReservedUnused(IOPCIDevice, 5); OSMetaClassDeclareReservedUnused(IOPCIDevice, 6); OSMetaClassDeclareReservedUnused(IOPCIDevice, 7); OSMetaClassDeclareReservedUnused(IOPCIDevice, 8); OSMetaClassDeclareReservedUnused(IOPCIDevice, 9); OSMetaClassDeclareReservedUnused(IOPCIDevice, 10); OSMetaClassDeclareReservedUnused(IOPCIDevice, 11); OSMetaClassDeclareReservedUnused(IOPCIDevice, 12); OSMetaClassDeclareReservedUnused(IOPCIDevice, 13); OSMetaClassDeclareReservedUnused(IOPCIDevice, 14); OSMetaClassDeclareReservedUnused(IOPCIDevice, 15); public: /*! @function extendedConfigRead32 @abstract Reads a 32-bit value from the PCI device's configuration space. @discussion This method reads a 32-bit configuration space register on the device and returns its value. @param offset A byte offset into configuration space, of which bits 0-1 are ignored. @result An 32-bit value in host byte order (big endian on PPC). */ UInt32 extendedConfigRead32( IOByteCount offset ); /*! @function extendedConfigRead16 @abstract Reads a 16-bit value from the PCI device's configuration space. @discussion This method reads a 16-bit configuration space register on the device and returns its value. @param offset A byte offset into configuration space, of which bit 0 is ignored. @result An 16-bit value in host byte order (big endian on PPC). */ UInt16 extendedConfigRead16( IOByteCount offset ); /*! @function extendedConfigRead8 @abstract Reads a 8-bit value from the PCI device's configuration space. @discussion This method reads a 8-bit configuration space register on the device and returns its value. @param offset A byte offset into configuration space. @result An 8-bit value. */ UInt8 extendedConfigRead8( IOByteCount offset ); /*! @function extendedConfigWrite32 @abstract Writes a 32-bit value to the PCI device's configuration space. @discussion This method writes a 32-bit value to a configuration space register on the device. @param offset A byte offset into configuration space, of which bits 0-1 are ignored. @param data An 32-bit value to be written in host byte order (big endian on PPC). */ void extendedConfigWrite32( IOByteCount offset, UInt32 data ); /*! @function extendedConfigWrite16 @abstract Writes a 16-bit value to the PCI device's configuration space. @discussion This method writes a 16-bit value to a configuration space register on the device. @param offset A byte offset into configuration space, of which bit 0 is ignored. @param data An 16-bit value to be written in host byte order (big endian on PPC). */ void extendedConfigWrite16( IOByteCount offset, UInt16 data ); /*! @function extendedConfigWrite8 @abstract Writes a 8-bit value to the PCI device's configuration space. @discussion This method writes a 8-bit value to a configuration space register on the device. @param offset A byte offset into configuration space. @param data An 8-bit value to be written. */ void extendedConfigWrite8( IOByteCount offset, UInt8 data ); // pass NULL or currentHandler, currentRef to get current handler installed // pass NULL or handler, ref to set handler for device // messages: kIOMessageDeviceWillPowerOff, kIOMessageDeviceHasPoweredOff, // kIOMessageDeviceWillPowerOn, kIOMessageDeviceHasPoweredOn // state: D3 IOReturn setConfigHandler(IOPCIDeviceConfigHandler handler, void * ref, IOPCIDeviceConfigHandler * currentHandler, void ** currentRef); // IOReturn kernelRequestProbe(uint32_t options); // (kIOPCIConfigSpace, VM_PROT_READ/WRITE to disable that access) IOReturn protectDevice(uint32_t space, uint32_t prot); IOReturn checkLink(uint32_t options = 0); IOReturn relocate(uint32_t options = 0); IOReturn setLatencyTolerance(IOOptionBits type, uint64_t nanoseconds); IOPCIEventSource * createEventSource(OSObject * owner, IOPCIEventSource::Action action, uint32_t options); // allow tunnel controller to enter L1, client should be an attached driver calling // this method in its IOPCIDevice provider. IOReturn setTunnelL1Enable(IOService * client, bool l1Enable); IOReturn setASPMState(IOService * client, IOOptionBits state); enum { kIOPCIAERErrorDescriptionMaxLength = 256 }; void copyAERErrorDescriptionForBit(bool correctable, uint32_t bit, char * string, size_t maxLength); /*! * @brief Reads a 64-bit value from the PCI device's aperture at a given memory index. * @discussion This method reads a 64-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device. * @param offset An offset into the device's memory specified by the index. * @param readData An out parameter containing the 64-bit value in host byte order. -1 is written to readData on error. */ IOReturn deviceMemoryRead64(uint8_t memoryIndex, uint64_t offset, uint64_t* readData); /*! * @brief Reads a 32-bit value from the PCI device's aperture at a given memory index. * @discussion This method reads a 32-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device. * @param offset An offset into the device's memory specified by the index. * @param readData An out parameter containing the 32-bit value in host byte order. -1 is written to readData on error. */ IOReturn deviceMemoryRead32(uint8_t memoryIndex, uint64_t offset, uint32_t* readData); /*! * @brief Reads a 16-bit value from the PCI device's aperture at a given memory index. * @discussion This method reads a 16-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device. * @param offset An offset into the device's memory specified by the index. * @param readData An out parameter containing the 16-bit value in host byte order. -1 is written to readData on error. */ IOReturn deviceMemoryRead16(uint8_t memoryIndex, uint64_t offset, uint16_t* readData); /*! * @brief Reads an 8-bit value from the PCI device's aperture at a given memory index. * @discussion This method reads an 8-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device. * @param offset An offset into the device's memory specified by the index. * @param readData An out parameter containing the 8-bit. -1 is written to readData on error. */ IOReturn deviceMemoryRead8(uint8_t memoryIndex, uint64_t offset, uint8_t* readData); /*! * @brief Writes a 64-bit value to the PCI device's aperture at a given memory index. * @discussion This method writes a 64-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device * @param offset An offset into the device's memory specified by the index. * @param data A 64-bit value to be written in host byte order. */ IOReturn deviceMemoryWrite64(uint8_t memoryIndex, uint64_t offset, uint64_t data); /*! * @brief Writes a 32-bit value to the PCI device's aperture at a given memory index. * @discussion This method writes a 32-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device. * @param offset An offset into the device's memory specified by the index. * @param data A 32-bit value to be written in host byte order. */ IOReturn deviceMemoryWrite32(uint8_t memoryIndex, uint64_t offset, uint32_t data); /*! * @brief Writes a 16-bit value to the PCI device's aperture at a given memory index. * @discussion This method writes a 16-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device. * @param offset An offset into the device's memory specified by the index. * @param data A 16-bit value to be written in host byte order. */ IOReturn deviceMemoryWrite16(uint8_t memoryIndex, uint64_t offset, uint16_t data); /*! * @brief Writes an 8-bit value to the PCI device's aperture at a given memory index. * @discussion This method writes an 8-bit register on the device and returns its value. * @param memoryIndex An index into the array of ranges assigned to the device * @param offset An offset into the device's memory specified by the index. * @param data An 8-bit value. */ IOReturn deviceMemoryWrite8(uint8_t memoryIndex, uint64_t offset, uint8_t data); }; __exported_pop #endif /* defined(KERNEL) */ #endif /* ! _IOKIT_IOPCIDEVICE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pci/IOAGPDevice.h
/* * Copyright (c) 1998-2000 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) 1999 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_IOAGPDEVICE_H #define _IOKIT_IOAGPDEVICE_H #include <IOKit/IORangeAllocator.h> #include <IOKit/pci/IOPCIDevice.h> /* Definitions of AGP config registers */ enum { kIOPCIConfigAGPStatusOffset = 4, kIOPCIConfigAGPCommandOffset = 8 }; /* Definitions of AGP Command & Status registers */ enum { kIOAGPRequestQueueMask = 0xff000000, kIOAGPSideBandAddresssing = 0x00000200, kIOAGPEnable = 0x00000100, kIOAGP4GbAddressing = 0x00000020, kIOAGPFastWrite = 0x00000010, kIOAGP4xDataRate = 0x00000004, kIOAGP2xDataRate = 0x00000002, kIOAGP1xDataRate = 0x00000001 }; enum { kIOAGPGartInvalidate = 0x00000001 }; // getAGPStatus() defines enum { kIOAGPDefaultStatus = 0 }; enum { kIOAGPIdle = 0x00000001, kIOAGPInvalidGARTEntry = 0x00000002, kIOAGPAccessOutOfRange = 0x00000004 }; #define kIOAGPBusFlagsKey "IOAGPFlags" enum { // the AGP target must be idle before invalidating its gart tlb kIOAGPGartIdleInvalidate = 0x00000001, // the AGP target cannot handle operations that cross page boundaries kIOAGPDisablePageSpans = 0x00000002, // the AGP target cannot handle master -> target AGP writes kIOAGPDisableAGPWrites = 0x00000004, // the AGP target cannot handle target -> master PCI reads kIOAGPDisablePCIReads = 0x00000008, // the AGP target cannot handle master -> target PCI writes kIOAGPDisablePCIWrites = 0x00000010, // the AGP target cannot handle all unaligned transactions kIOAGPDisableUnaligned = 0x00000020, kIOAGPDisableFeature6 = 0x00000040, kIOAGPDisableFeature7 = 0x00000080, kIOAGPDisableFeature8 = 0x00000100, kIOAGPDisableFeature9 = 0x00000200 }; // masterState enum { kIOAGPStateEnabled = 0x00000001, kIOAGPStateEnablePending = 0x00010000 }; /*! @class IOAGPDevice @abstract An IOService class representing an AGP master device. @discussion The discovery of an AGP master device by the PCI bus family results in an instance of the IOAGPDevice being created and published. It provides services specific to AGP, in addition to the PCI services supplied by its superclass IOPCIDevice. */ __exported_push class __kpi_deprecated("Use PCIDriverKit") IOAGPDevice : public IOPCIDevice { OSDeclareDefaultStructors(IOAGPDevice) protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; public: UInt32 masterState; UInt8 masterAGPRegisters; /*! @function createAGPSpace @abstract Allocates the AGP space, and enables AGP transactions on the master and slave. @discussion This method should be called by the driver for the AGP master device to set the size of the space and enable AGP transactions. It will destroy any AGP space currently allocated. @param options No options are currently defined, pass zero. @param address The physical range allocated for the AGP space is passed back to the caller. @param length An in/out parameter - the caller sets the devices maximum AGP addressing and the actual size created is passed back. @result Returns an IOReturn code indicating success or failure. */ virtual IOReturn createAGPSpace( IOOptionBits options, IOPhysicalAddress * address, IOPhysicalLength * length ); /*! @function destroyAGPSpace @abstract Destroys the AGP space, and disables AGP transactions on the master and slave. @discussion This method should be called by the driver to shutdown AGP transactions and release resources. */ virtual IOReturn destroyAGPSpace( void ); /*! @function getAGPRangeAllocator @abstract Accessor to obtain the AGP range allocator. @discussion To allocate ranges in AGP space, obtain a range allocator for the space with this method. It is retained while the space is created (until destroyAGPSpace is called) and should not be released by the caller. @result Returns a pointer to the range allocator for the AGP space. */ virtual IORangeAllocator * getAGPRangeAllocator( void ); /*! @function getAGPStatus @abstract Returns the current state of the AGP bus. @discussion Returns state bits for the AGP bus. Only one type of status is currently defined. @param which Type of status - only kIOAGPDefaultStatus is currently valid. @result Returns mask of status bits for the AGP bus. */ virtual IOOptionBits getAGPStatus( IOOptionBits which = kIOAGPDefaultStatus ); /*! @function commitAGPMemory @abstract Makes memory addressable by AGP transactions. @discussion Makes the memory described by the IOMemoryDescriptor object addressable by AGP by entering its pages into the GART array, given an offset into AGP space supplied by the caller (usually allocated by the AGP range allocator). It is the caller's responsibility to prepare non-kernel pageable memory before calling this method, with IOMemoryDescriptor::prepare. @param memory A IOMemoryDescriptor object describing the memory to add to the GART. @param agpOffset An offset into AGP space that the caller has allocated - usually allocated by the AGP range allocator. @param options Pass kIOAGPGartInvalidate if the AGP target should invalidate any GART TLB. @result Returns an IOReturn code indicating success or failure. */ virtual IOReturn commitAGPMemory( IOMemoryDescriptor * memory, IOByteCount agpOffset, IOOptionBits options = 0 ); /*! @function releaseAGPMemory @abstract Releases memory addressable by AGP transactions. @discussion Makes the memory described by the IOMemoryDescriptor object unaddressable by AGP by removing its pages from the GART array, given an offset into AGP space supplied by the caller (usually allocated by the AGP range allocator). It is the caller's responsibility to complete non-kernel pageable memory before calling this method, with IOMemoryDescriptor::complete. @param memory A IOMemoryDescriptor object describing the memory to remove from the GART. @param agpOffset An offset into AGP space that the caller has allocated - usually allocated by the AGP range allocator. @param options Pass kIOAGPGartInvalidate if the AGP target should invalidate any GART TLB. @result Returns an IOReturn code indicating success or failure. */ virtual IOReturn releaseAGPMemory( IOMemoryDescriptor * memory, IOByteCount agpOffset, IOOptionBits options = 0 ); virtual IOReturn resetAGP( IOOptionBits options = 0 ); /*! @function getAGPSpace @abstract Returns the allocated AGP space. @discussion This method can be called by the driver for the AGP master device to retrieve the physical address and size of the space created with createAGPSpace. @param address The physical range allocated for the AGP space is passed back to the caller. Zero may be passed if the address is not needed by the caller. @param length The size of the the AGP space created is passed back. Zero may be passed if the length is not needed by the caller. @result Returns an IOReturn code indicating success or failure. */ virtual IOReturn getAGPSpace( IOPhysicalAddress * address, IOPhysicalLength * length ); // Unused Padding OSMetaClassDeclareReservedUnused(IOAGPDevice, 0); OSMetaClassDeclareReservedUnused(IOAGPDevice, 1); OSMetaClassDeclareReservedUnused(IOAGPDevice, 2); OSMetaClassDeclareReservedUnused(IOAGPDevice, 3); OSMetaClassDeclareReservedUnused(IOAGPDevice, 4); OSMetaClassDeclareReservedUnused(IOAGPDevice, 5); OSMetaClassDeclareReservedUnused(IOAGPDevice, 6); OSMetaClassDeclareReservedUnused(IOAGPDevice, 7); OSMetaClassDeclareReservedUnused(IOAGPDevice, 8); OSMetaClassDeclareReservedUnused(IOAGPDevice, 9); OSMetaClassDeclareReservedUnused(IOAGPDevice, 10); OSMetaClassDeclareReservedUnused(IOAGPDevice, 11); OSMetaClassDeclareReservedUnused(IOAGPDevice, 12); OSMetaClassDeclareReservedUnused(IOAGPDevice, 13); OSMetaClassDeclareReservedUnused(IOAGPDevice, 14); OSMetaClassDeclareReservedUnused(IOAGPDevice, 15); OSMetaClassDeclareReservedUnused(IOAGPDevice, 16); }; __exported_pop #endif /* ! _IOKIT_IOAGPDEVICE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pci/IOPCIBridge.h
/* * Copyright (c) 1998-2021 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) 1998-2000 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_IOPCIBRIDGE_H #define _IOKIT_IOPCIBRIDGE_H #include <IOKit/IOService.h> #include <IOKit/IODeviceMemory.h> #include <IOKit/IOFilterInterruptEventSource.h> #include <IOKit/pwr_mgt/RootDomain.h> #include <IOKit/pci/IOAGPDevice.h> /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ class IOPCIConfigurator; class IOPCIDevice; class IOPCIMessagedInterruptController; class IOPCIHostBridgeData; enum { kIOPCIResourceTypeMemory = 0, kIOPCIResourceTypePrefetchMemory = 1, kIOPCIResourceTypeIO = 2, kIOPCIResourceTypeBusNumber = 3, kIOPCIResourceTypeCount = 4, }; typedef struct { IOService * device; uintptr_t op; void * result; void * arg; } configOpParams; /*! @class IOPCIBridge @abstract Base class for all PCI bridge drivers. */ __exported_push class __kpi_deprecated("Use PCIDriverKit") IOPCIBridge : public IOService { friend class IOPCIDevice; friend class IOPCI2PCIBridge; friend class IOPCIConfigurator; friend class IOPCIEventSource; friend class IOPCIHostBridge; OSDeclareAbstractStructors(IOPCIBridge) private: static void initialize(void); IORegistryEntry * findMatching( OSIterator * in, IOPCIAddressSpace space ); virtual bool isDTNub( IOPCIDevice * nub ); bool checkProperties( IOPCIDevice * entry ); void removeDevice( IOPCIDevice * device, IOOptionBits options = 0 ); void restoreQEnter(IOPCIDevice * device); void restoreQRemove(IOPCIDevice * device); IOReturn restoreTunnelState(IOPCIDevice * rootDevice, IOOptionBits options, bool * didTunnelController); IOReturn restoreMachineState( IOOptionBits options, IOPCIDevice * device ); void tunnelsWait(IOPCIDevice * device); IOReturn _restoreDeviceState( IOPCIDevice * device, IOOptionBits options ); IOReturn _restoreDeviceDependents(IOPCIDevice * device, IOOptionBits options, IOPCIDevice * forDependent); IOReturn resolveInterrupts(IOPCIDevice * nub ); IOReturn resolveLegacyInterrupts( IOService * provider, IOPCIDevice * nub ); IOReturn resolveMSIInterrupts ( IOService * provider, IOPCIDevice * nub ); IOReturn relocate(IOPCIDevice * device, uint32_t options); void spaceFromProperties( IORegistryEntry * regEntry, IOPCIAddressSpace * space ); void updateWakeReason(IOPCIDevice * device); bool childPrefersMSIX( IOPCIDevice * device ); protected: #if !defined(__arm64__) static SInt32 compareAddressCell( UInt32 cellCount, UInt32 cleft[], UInt32 cright[] ); #else static SInt64 compareAddressCell( UInt32 cellCount, UInt32 cleft[], UInt32 cright[] ); #endif IOReturn setDeviceASPMBits(IOPCIDevice * device, uint32_t bits); IOReturn setDeviceASPML1Bit(IOPCIDevice * device, uint32_t bits); IOReturn setDeviceL1PMBits(IOPCIDevice * device, uint32_t bits); IOReturn setDeviceCLKREQBits(IOPCIDevice * device, uint32_t bits); IOReturn setDevicePowerState(IOPCIDevice * device, IOOptionBits options, unsigned long prevState, unsigned long newState); IOReturn configOp(configOpParams *params); static void deferredProbe(IOPCIDevice * device); void * __reserved1; void * __reserved2; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the IOPCIBridge in the future. */ struct ExpansionData { struct IOPCIRange * rangeLists[kIOPCIResourceTypeCount]; IOPCIMessagedInterruptController *messagedInterruptController; IOPCIHostBridgeData *hostBridgeData; IOSimpleLock *lock; // Synchronizes access to 'started' bool started; }; /*! @var reserved Reserved for future use. (Internal use only) */ private: ExpansionData *reserved; protected: IOWorkLoop * getConfiguratorWorkLoop(void) const; public: static IOPCIEventSource * createEventSource(OSObject * owner, IOPCIEventSource::Action action, uint32_t options); public: virtual void probeBus( IOService * provider, UInt8 busNum ); virtual UInt8 firstBusNum( void ); virtual UInt8 lastBusNum( void ); virtual void spaceFromProperties( OSDictionary * propTable, IOPCIAddressSpace * space ); virtual OSDictionary * constructProperties( IOPCIAddressSpace space ); virtual IOPCIDevice * createNub( OSDictionary * from ); virtual bool initializeNub( IOPCIDevice * nub, OSDictionary * from ); virtual bool publishNub( IOPCIDevice * nub, UInt32 index ); virtual bool addBridgeMemoryRange( IOPhysicalAddress start, IOPhysicalLength length, bool host ); virtual bool addBridgeIORange( IOByteCount start, IOByteCount length ); private: virtual bool constructRange( IOPCIAddressSpace * flags, IOPhysicalAddress64 phys, IOPhysicalLength64 len, OSArray * array ); virtual bool matchNubWithPropertyTable( IOService * nub, OSDictionary * propertyTable, SInt32 * score ); virtual bool compareNubName( const IOService * nub, OSString * name, OSString ** matched = 0 ) const; virtual bool pciMatchNub( IOPCIDevice * nub, OSDictionary * table, SInt32 * score); virtual bool matchKeys( IOPCIDevice * nub, const char * keys, UInt32 defaultMask, UInt8 regNum ); virtual IOReturn getNubResources( IOService * nub ); virtual IOReturn getNubAddressing( IOPCIDevice * nub ); virtual IOReturn getDTNubAddressing( IOPCIDevice * nub ); public: virtual void free( void ); virtual bool start( IOService * provider ); virtual void stop( IOService * provider ); virtual bool configure( IOService * provider ); virtual IOReturn setProperties(OSObject * properties); virtual IOReturn newUserClient(task_t owningTask, void * securityID, UInt32 type, OSDictionary * properties, IOUserClient ** handler); virtual unsigned long maxCapabilityForDomainState ( IOPMPowerFlags domainState ); virtual unsigned long initialPowerStateForDomainState ( IOPMPowerFlags domainState ); virtual unsigned long powerStateForDomainState ( IOPMPowerFlags domainState ); virtual IOReturn callPlatformFunction(const OSSymbol * functionName, bool waitForFunction, void * param1, void * param2, void * param3, void * param4); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */ virtual IODeviceMemory * ioDeviceMemory( void ) = 0; virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset ) = 0; virtual void configWrite32( IOPCIAddressSpace space, UInt8 offset, UInt32 data ) = 0; virtual UInt16 configRead16( IOPCIAddressSpace space, UInt8 offset ) = 0; virtual void configWrite16( IOPCIAddressSpace space, UInt8 offset, UInt16 data ) = 0; virtual UInt8 configRead8( IOPCIAddressSpace space, UInt8 offset ) = 0; virtual void configWrite8( IOPCIAddressSpace space, UInt8 offset, UInt8 data ) = 0; virtual IOPCIAddressSpace getBridgeSpace( void ) = 0; virtual UInt32 findPCICapability( IOPCIAddressSpace space, UInt8 capabilityID, UInt8 * offset = 0 ); virtual IOReturn setPowerState(unsigned long powerStateOrdinal, IOService * whatDevice) APPLE_KEXT_OVERRIDE; virtual IOReturn setDevicePowerState( IOPCIDevice * device, unsigned long whatToDo ); virtual IOReturn saveDeviceState( IOPCIDevice * device, IOOptionBits options = 0 ); virtual IOReturn restoreDeviceState( IOPCIDevice * device, IOOptionBits options = 0 ); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */ virtual IOReturn createAGPSpace( IOAGPDevice * master, IOOptionBits options, IOPhysicalAddress * address, IOPhysicalLength * length ); virtual IOReturn destroyAGPSpace( IOAGPDevice * master ); virtual IORangeAllocator * getAGPRangeAllocator( IOAGPDevice * master ); virtual IOOptionBits getAGPStatus( IOAGPDevice * master, IOOptionBits options = 0 ); virtual IOReturn resetAGPDevice( IOAGPDevice * master, IOOptionBits options = 0 ); virtual IOReturn getAGPSpace( IOAGPDevice * master, IOPhysicalAddress * address, IOPhysicalLength * length ); virtual IOReturn commitAGPMemory( IOAGPDevice * master, IOMemoryDescriptor * memory, IOByteCount agpOffset, IOOptionBits options ); virtual IOReturn releaseAGPMemory( IOAGPDevice * master, IOMemoryDescriptor * memory, IOByteCount agpOffset, IOOptionBits options ); protected: OSMetaClassDeclareReservedUsed(IOPCIBridge, 0); private: virtual bool addBridgePrefetchableMemoryRange( IOPhysicalAddress start, IOPhysicalLength length, bool host ); protected: bool addBridgePrefetchableMemoryRange( addr64_t start, addr64_t length ); IOReturn kernelRequestProbe(IOPCIDevice * device, uint32_t options); IOReturn protectDevice(IOPCIDevice * device, uint32_t space, uint32_t prot); OSMetaClassDeclareReservedUsed(IOPCIBridge, 1); virtual UInt32 extendedFindPCICapability( IOPCIAddressSpace space, UInt32 capabilityID, IOByteCount * offset = 0 ); OSMetaClassDeclareReservedUsed(IOPCIBridge, 2); virtual IOReturn setDeviceASPMState(IOPCIDevice * device, IOService * client, IOOptionBits state); OSMetaClassDeclareReservedUsed(IOPCIBridge, 3); virtual IOReturn checkLink(uint32_t options = 0); OSMetaClassDeclareReservedUsed(IOPCIBridge, 4); virtual IOReturn enableLTR(IOPCIDevice * device, bool enable); OSMetaClassDeclareReservedUsed(IOPCIBridge, 5); virtual IOPCIEventSource * createEventSource(IOPCIDevice * device, OSObject * owner, IOPCIEventSource::Action action, uint32_t options); OSMetaClassDeclareReservedUsed(IOPCIBridge, 6); virtual UInt32 extendedFindPCICapability(struct IOPCIConfigEntry * entry, UInt32 capabilityID, IOByteCount * offset = NULL); public: virtual bool init( OSDictionary * propTable ); // Unused Padding OSMetaClassDeclareReservedUnused(IOPCIBridge, 7); OSMetaClassDeclareReservedUnused(IOPCIBridge, 8); OSMetaClassDeclareReservedUnused(IOPCIBridge, 9); OSMetaClassDeclareReservedUnused(IOPCIBridge, 10); OSMetaClassDeclareReservedUnused(IOPCIBridge, 11); OSMetaClassDeclareReservedUnused(IOPCIBridge, 12); OSMetaClassDeclareReservedUnused(IOPCIBridge, 13); OSMetaClassDeclareReservedUnused(IOPCIBridge, 14); OSMetaClassDeclareReservedUnused(IOPCIBridge, 15); OSMetaClassDeclareReservedUnused(IOPCIBridge, 16); OSMetaClassDeclareReservedUnused(IOPCIBridge, 17); OSMetaClassDeclareReservedUnused(IOPCIBridge, 18); OSMetaClassDeclareReservedUnused(IOPCIBridge, 19); OSMetaClassDeclareReservedUnused(IOPCIBridge, 20); OSMetaClassDeclareReservedUnused(IOPCIBridge, 21); OSMetaClassDeclareReservedUnused(IOPCIBridge, 22); OSMetaClassDeclareReservedUnused(IOPCIBridge, 23); OSMetaClassDeclareReservedUnused(IOPCIBridge, 24); OSMetaClassDeclareReservedUnused(IOPCIBridge, 25); OSMetaClassDeclareReservedUnused(IOPCIBridge, 26); OSMetaClassDeclareReservedUnused(IOPCIBridge, 27); OSMetaClassDeclareReservedUnused(IOPCIBridge, 28); OSMetaClassDeclareReservedUnused(IOPCIBridge, 29); OSMetaClassDeclareReservedUnused(IOPCIBridge, 30); OSMetaClassDeclareReservedUnused(IOPCIBridge, 31); #if TARGET_CPU_ARM || TARGET_CPU_ARM64 protected: virtual IOReturn deviceMemoryRead(IOMemoryDescriptor* sourceBase, IOByteCount sourceOffset, IOMemoryDescriptor* destinationBase, IOByteCount destinationOffset, IOByteCount size); virtual IOReturn deviceMemoryRead(IOMemoryDescriptor* sourceBase, IOByteCount sourceOffset, void* destination, IOByteCount size); #endif }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ class __kpi_deprecated("Use PCIDriverKit") IOPCI2PCIBridge : public IOPCIBridge { friend class IOPCIEventSource; friend class IOPCIDevice; OSDeclareDefaultStructors(IOPCI2PCIBridge) protected: IOInterruptEventSource * fBridgeInterruptSource; private: IOPCIDevice * fBridgeDevice; IOTimerEventSource * fTimerProbeES; IOWorkLoop * fWorkLoop; IOPMDriverAssertionID fPMAssertion; IOSimpleLock * fISRLock; struct IOPCIAERRoot * fAERRoot; uint32_t __resvA[6]; int32_t fTunnelL1EnableCount; uint32_t fHotplugCount; uint8_t _resvA[3]; uint8_t fHotPlugInts; uint8_t fIntsPending; uint8_t fIsAERRoot; uint8_t fPresence; uint8_t fWaitingLinkEnable; uint8_t fLinkChangeOnly; uint8_t fBridgeInterruptEnablePending; uint8_t fNeedProbe; uint8_t fPresenceInt; uint8_t fBridgeMSI; uint8_t fNoDevice; uint8_t fLinkControlWithPM; uint8_t fPowerState; char fLogName[32]; ; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData {}; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; public: virtual UInt8 firstBusNum( void ) override; virtual UInt8 lastBusNum( void ) override; public: virtual void free() override; virtual bool serializeProperties( OSSerialize * serialize ) const override; virtual IOService * probe( IOService * provider, SInt32 * score ) override; virtual bool start( IOService * provider ) override; virtual void stop( IOService * provider ) override; virtual bool configure( IOService * provider ) override; virtual void probeBus( IOService * provider, UInt8 busNum ) override; virtual IOReturn requestProbe( IOOptionBits options ) override; virtual void systemWillShutdown(IOOptionBits specifier) override; virtual void saveBridgeState( void ); virtual void restoreBridgeState( void ); IOReturn setPowerState( unsigned long powerState, IOService * whatDevice ) override; void adjustPowerState(unsigned long state); virtual IOReturn saveDeviceState( IOPCIDevice * device, IOOptionBits options = 0 ) override; virtual bool publishNub( IOPCIDevice * nub, UInt32 index ) override; virtual IODeviceMemory * ioDeviceMemory( void ) override; virtual IOPCIAddressSpace getBridgeSpace( void ) override; virtual UInt32 configRead32( IOPCIAddressSpace space, UInt8 offset ) override; virtual void configWrite32( IOPCIAddressSpace space, UInt8 offset, UInt32 data ) override; virtual UInt16 configRead16( IOPCIAddressSpace space, UInt8 offset ) override; virtual void configWrite16( IOPCIAddressSpace space, UInt8 offset, UInt16 data ) override; virtual UInt8 configRead8( IOPCIAddressSpace space, UInt8 offset ) override; virtual void configWrite8( IOPCIAddressSpace space, UInt8 offset, UInt8 data ) override; virtual IOReturn setDeviceASPMState(IOPCIDevice * device, IOService * client, IOOptionBits state) override; virtual IOReturn checkLink(uint32_t options = 0) override; virtual IOReturn enableLTR(IOPCIDevice * device, bool enable) override; virtual IOPCIEventSource * createEventSource(IOPCIDevice * device, OSObject * owner, IOPCIEventSource::Action action, uint32_t options) override; // Unused Padding OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 0); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 1); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 2); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 3); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 4); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 5); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 6); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 7); OSMetaClassDeclareReservedUnused(IOPCI2PCIBridge, 8); protected: void allocateBridgeInterrupts(IOService * provider); void startBridgeInterrupts(IOService * provider); void enableBridgeInterrupts(void); void disableBridgeInterrupts(void); private: IOReturn setTunnelL1Enable(IOPCIDevice * device, IOService * client, bool l1Enable); public: void startBootDefer(IOService * provider); void handleInterrupt( IOInterruptEventSource * source, int count ); void timerProbe(IOTimerEventSource * es); }; __exported_pop #define kIOPCI2PCIBridgeName "IOPP" #endif /* ! _IOKIT_IOPCIBRIDGE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pci/IOPCIFamilyDefinitions.h
/* * Copyright (c) 2018-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef IOPCIDefinitions_h #define IOPCIDefinitions_h #include <TargetConditionals.h> #if TARGET_OS_DRIVERKIT #include <stdint.h> #include <stddef.h> #include <sys/_types/_uuid_t.h> #include <DriverKit/IOTypes.h> #include <DriverKit/IOLib.h> #else #include <IOKit/IOTypes.h> #include <libkern/OSByteOrder.h> #endif // IOPCIDevice matching property names #define kIOPCIMatchKey "IOPCIMatch" #define kIOPCIPrimaryMatchKey "IOPCIPrimaryMatch" #define kIOPCISecondaryMatchKey "IOPCISecondaryMatch" #define kIOPCIClassMatchKey "IOPCIClassMatch" // pci express capabilities #define kIOPCIExpressCapabilitiesKey "IOPCIExpressCapabilities" // pci express link status #define kIOPCIExpressLinkStatusKey "IOPCIExpressLinkStatus" // pci express link capabilities #define kIOPCIExpressLinkCapabilitiesKey "IOPCIExpressLinkCapabilities" // pci express slot status #define kIOPCIExpressSlotStatusKey "IOPCIExpressSlotStatus" // pci express slot capabilities #define kIOPCIExpressSlotCapabilitiesKey "IOPCIExpressSlotCapabilities" #define kIOPCIDeviceMemoryArrayKey "IODeviceMemory" // base address of the device's memory map #define kIOPCIDeviceMemoryMapBase "IOPCIDeviceMemoryMapBase" // size of device memory map #define kIOPCIDeviceMemoryMapSize "IOPCIDeviceMemoryMapSize" // mapper page size #define kIOPCIDeviceMapperPageSize "IOPCIDeviceMapperPageSize" // IOPCIDevice matching property names #define kIOPCITunnelCompatibleKey "IOPCITunnelCompatible" #define kIOPCITunnelledKey "IOPCITunnelled" #define kIOPCITunnelL1EnableKey "IOPCITunnelL1Enable" #define kIOPCITunnelRootDeviceModelIDKey "IOPCITunnelRootDeviceModelID" #define kIOPCITunnelRootDeviceVendorIDKey "IOPCITunnelRootDeviceVendorID" #define kIOPCIPauseCompatibleKey "IOPCIPauseCompatible" // Properties that can be set on the IOPCIDevice // property to control PCI default config space save on sleep. // If false, config space will not be save/restored on power state transitions #define kIOPMPCIConfigSpaceVolatileKey "IOPMPCIConfigSpaceVolatile" // property to disable express link on sleep #define kIOPMPCISleepLinkDisableKey "IOPMPCISleepLinkDisable" // property to issue a secondary bus reset on sleep #define kIOPMPCISleepResetKey "IOPMPCISleepReset" /* bits getInterruptType result */ enum { kIOInterruptTypePCIMessaged = 0x00010000, kIOInterruptTypePCIMessagedX = 0x00020000 }; /* Definitions of PCI Config Registers */ enum { kIOPCIConfigurationOffsetVendorID = 0x00, kIOPCIConfigurationOffsetDeviceID = 0x02, kIOPCIConfigurationOffsetCommand = 0x04, kIOPCIConfigurationOffsetStatus = 0x06, kIOPCIConfigurationOffsetRevisionID = 0x08, kIOPCIConfigurationOffsetClassCode = 0x09, kIOPCIConfigurationOffsetCacheLineSize = 0x0C, kIOPCIConfigurationOffsetLatencyTimer = 0x0D, kIOPCIConfigurationOffsetHeaderType = 0x0E, kIOPCIConfigurationOffsetBIST = 0x0F, kIOPCIConfigurationOffsetBaseAddress0 = 0x10, kIOPCIConfigurationOffsetBaseAddress1 = 0x14, kIOPCIConfigurationOffsetBaseAddress2 = 0x18, kIOPCIConfigurationOffsetBaseAddress3 = 0x1C, kIOPCIConfigurationOffsetBaseAddress4 = 0x20, kIOPCIConfigurationOffsetBaseAddress5 = 0x24, kIOPCIConfigurationOffsetCardBusCISPtr = 0x28, kIOPCIConfigurationOffsetSubSystemVendorID = 0x2C, kIOPCIConfigurationOffsetSubSystemID = 0x2E, kIOPCIConfigurationOffsetExpansionROMBase = 0x30, kIOPCIConfigurationOffsetCapabilitiesPtr = 0x34, kIOPCIConfigurationOffsetInterruptLine = 0x3C, kIOPCIConfigurationOffsetInterruptPin = 0x3D, kIOPCIConfigurationOffsetMinimumGrant = 0x3E, kIOPCIConfigurationOffsetMaximumLatency = 0x3F }; /* Definitions of Capabilities PCI Config Register */ enum { kIOPCICapabilityIDOffset = 0x00, kIOPCINextCapabilityOffset = 0x01, kIOPCICapabilityIDPowerManagement = 0x01, kIOPCICapabilityIDAGP = 0x02, kIOPCICapabilityIDVitalProductData = 0x03, kIOPCICapabilityIDSlotID = 0x04, kIOPCICapabilityIDMSI = 0x05, kIOPCICapabilityIDCPCIHotswap = 0x06, kIOPCICapabilityIDPCIX = 0x07, kIOPCICapabilityIDLDT = 0x08, kIOPCICapabilityIDVendorSpecific = 0x09, kIOPCICapabilityIDDebugPort = 0x0a, kIOPCICapabilityIDCPCIResourceControl = 0x0b, kIOPCICapabilityIDHotplug = 0x0c, kIOPCICapabilityIDAGP8 = 0x0e, kIOPCICapabilityIDSecure = 0x0f, kIOPCICapabilityIDPCIExpress = 0x10, kIOPCICapabilityIDMSIX = 0x11, kIOPCICapabilityIDFPB = 0x15, #if defined(__LP64__) kIOPCIExpressCapabilityIDErrorReporting = -0x01U, kIOPCIExpressCapabilityIDVirtualChannel = -0x02U, kIOPCIExpressCapabilityIDDeviceSerialNumber = -0x03U, kIOPCIExpressCapabilityIDPowerBudget = -0x04U, kIOPCIExpressCapabilityIDAccessControlServices = -0x0DU, kIOPCIExpressCapabilityIDLatencyTolerenceReporting = -0x18U, kIOPCIExpressCapabilityIDL1PMSubstates = -0x1EU, kIOPCIExpressCapabilityIDPrecisionTimeManagement = -0x1FU, #else /* defined(__LP64__) */ kIOPCIExpressCapabilityIDErrorReporting = -0x01UL, kIOPCIExpressCapabilityIDVirtualChannel = -0x02UL, kIOPCIExpressCapabilityIDDeviceSerialNumber = -0x03UL, kIOPCIExpressCapabilityIDPowerBudget = -0x04UL, kIOPCIExpressCapabilityIDAccessControlServices = -0x0DUL, kIOPCIExpressCapabilityIDLatencyTolerenceReporting = -0x18UL, kIOPCIExpressCapabilityIDL1PMSubstates = -0x1EUL, kIOPCIExpressCapabilityIDPrecisionTimeManagement = -0x1FUL, #endif /* !defined(__LP64__) */ }; /* Command register definitions */ enum { kIOPCICommandIOSpace = 0x0001, kIOPCICommandMemorySpace = 0x0002, kIOPCICommandBusMaster = 0x0004, kIOPCICommandSpecialCycles = 0x0008, kIOPCICommandMemWrInvalidate = 0x0010, kIOPCICommandPaletteSnoop = 0x0020, kIOPCICommandParityError = 0x0040, kIOPCICommandAddressStepping = 0x0080, kIOPCICommandSERR = 0x0100, kIOPCICommandFastBack2Back = 0x0200, kIOPCICommandInterruptDisable = 0x0400 }; /* Status register definitions */ enum { kIOPCIStatusInterrupt = 0x0008, kIOPCIStatusCapabilities = 0x0010, kIOPCIStatusPCI66 = 0x0020, kIOPCIStatusUDF = 0x0040, kIOPCIStatusFastBack2Back = 0x0080, kIOPCIStatusDevSel0 = 0x0000, kIOPCIStatusDevSel1 = 0x0200, kIOPCIStatusDevSel2 = 0x0400, kIOPCIStatusDevSel3 = 0x0600, kIOPCIStatusTargetAbortCapable = 0x0800, kIOPCIStatusTargetAbortActive = 0x1000, kIOPCIStatusMasterAbortActive = 0x2000, kIOPCIStatusSERRActive = 0x4000, kIOPCIStatusParityErrActive = 0x8000 }; enum { kPCI2PCIOffsetPrimaryBus = 0x18, kPCI2PCIOffsetSecondaryBus = 0x19, kPCI2PCIOffsetSubordinateBus = 0x1a, kPCI2PCIOffsetSecondaryLT = 0x1b, kPCI2PCIOffsetIORange = 0x1c, kPCI2PCIOffsetMemoryRange = 0x20, kPCI2PCIOffsetPrefetchMemoryRange = 0x24, kPCI2PCIOffsetPrefetchUpperBase = 0x28, kPCI2PCIOffsetPrefetchUpperLimit = 0x2c, kPCI2PCIOffsetUpperIORange = 0x30, kPCI2PCIOffsetBridgeControl = 0x3e }; // constants which are part of the PCI Bus Power Management Spec. enum { // capabilities bits in the 16 bit capabilities register kPCIPMCPMESupportFromD3Cold = 0x8000, kPCIPMCPMESupportFromD3Hot = 0x4000, kPCIPMCPMESupportFromD2 = 0x2000, kPCIPMCPMESupportFromD1 = 0x1000, kPCIPMCPMESupportFromD0 = 0x0800, kPCIPMCD2Support = 0x0400, kPCIPMCD1Support = 0x0200, kPCIPMCD3Support = 0x0001 }; enum { // bits in the power management control/status register kPCIPMCSPMEStatus = 0x8000, kPCIPMCSPMEEnable = 0x0100, kPCIPMCSPowerStateMask = 0x0003, kPCIPMCSPowerStateD3 = 0x0003, kPCIPMCSPowerStateD2 = 0x0002, kPCIPMCSPowerStateD1 = 0x0001, kPCIPMCSPowerStateD0 = 0x0000, kPCIPMCSDefaultEnableBits = (~(IOOptionBits)0), kPCIPMCSPMEDisableInS3 = 0x00010000, kPCIPMCSPMEWakeReason = 0x00020000 }; enum { kIOPCISlotCapabilitiesBitAttentionButtonPresent = (1 << 0), kIOPCISlotCapabilitiesBitPowerControllerPresent = (1 << 1), kIOPCISlotCapabilitiesBitMRLSensorPresent = (1 << 2), kIOPCISlotCapabilitiesBitAttentionIndicatorPresent = (1 << 3), kIOPCISlotCapabilitiesBitPowerIndicatorPresent = (1 << 4), kIOPCISlotCapabilitiesBitHotPlugSurprise = (1 << 5), kIOPCISlotCapabilitiesBitHotPlugCapable = (1 << 6), kIOPCISlotCapabilitiesBitElectromechanicalInterlockPresent = (1 << 17), kIOPCISlotCapabilitiesBitNoCommandCompletedSupport = (1 << 18) }; // PCIe error bits enum { kIOPCIUncorrectableErrorBitDataLinkProtocol = 4, kIOPCIUncorrectableErrorBitSurpriseDown = 5, kIOPCIUncorrectableErrorBitPoisonedTLP = 12, kIOPCIUncorrectableErrorBitFlowControlProtocol = 13, kIOPCIUncorrectableErrorBitCompletionTimeout = 14, kIOPCIUncorrectableErrorBitCompleterAbort = 15, kIOPCIUncorrectableErrorBitUnexpectedCompletion = 16, kIOPCIUncorrectableErrorBitReceiverOverflow = 17, kIOPCIUncorrectableErrorBitMalformedTLP = 18, kIOPCIUncorrectableErrorBitECRC = 19, kIOPCIUncorrectableErrorBitUnsupportedRequest = 20, kIOPCIUncorrectableErrorBitACSViolation = 21, kIOPCIUncorrectableErrorBitInternal = 22, kIOPCIUncorrectableErrorBitMCBlockedTLP = 23, kIOPCIUncorrectableErrorBitAtomicOpEgressBlocked = 24, kIOPCIUncorrectableErrorBitTLPPrefixBlocked = 25 }; enum { kIOPCICorrectableErrorBitReceiver = 0, kIOPCICorrectableErrorBitBadTLP = 6, kIOPCICorrectableErrorBitBadDLLP = 7, kIOPCICorrectableErrorBitReplayNumRollover = 8, kIOPCICorrectableErrorBitReplayTimerTimeout = 12, kIOPCICorrectableErrorBitAdvisoryNonFatal = 13, kIOPCICorrectableErrorBitCorrectedInternal = 14, kIOPCICorrectableErrorBitHeaderLogOverflow = 15, }; #endif /* IOPCIDefinitions_h */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/bluetooth/BluetoothAssignedNumbers.h
/* File: BluetoothAssignedNumbers.h Copyright: (c) 2001-2017 by Apple, Inc. All rights reserved. */ #pragma once #ifdef __cplusplus extern "C" { #endif #pragma mark - #pragma mark === General === //================================================================================================================== // General //================================================================================================================== /* BluetoothCompanyIdentifers The "living document" can be found on the Bluetooth SIG website: https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers */ enum BluetoothCompanyIdentifers { kBluetoothCompanyIdentiferEricssonTechnologyLicensing = 0, kBluetoothCompanyIdentiferNokiaMobilePhones = 1, kBluetoothCompanyIdentiferIntel = 2, kBluetoothCompanyIdentiferIBM = 3, kBluetoothCompanyIdentiferToshiba = 4, kBluetoothCompanyIdentifer3Com = 5, kBluetoothCompanyIdentiferMicrosoft = 6, kBluetoothCompanyIdentiferLucent = 7, kBluetoothCompanyIdentiferMotorola = 8, kBluetoothCompanyIdentiferInfineonTechnologiesAG = 9, kBluetoothCompanyIdentiferCambridgeSiliconRadio = 10, kBluetoothCompanyIdentiferSiliconWave = 11, kBluetoothCompanyIdentiferDigianswerAS = 12, kBluetoothCompanyIdentiferTexasInstruments = 13, kBluetoothCompanyIdentiferParthusTechnologies = 14, kBluetoothCompanyIdentiferBroadcom = 15, kBluetoothCompanyIdentiferMitelSemiconductor = 16, kBluetoothCompanyIdentiferWidcomm = 17, kBluetoothCompanyIdentiferZeevo = 18, kBluetoothCompanyIdentiferAtmel = 19, kBluetoothCompanyIdentiferMistubishiElectric = 20, kBluetoothCompanyIdentiferRTXTelecom = 21, kBluetoothCompanyIdentiferKCTechnology = 22, kBluetoothCompanyIdentiferNewlogic = 23, kBluetoothCompanyIdentiferTransilica = 24, kBluetoothCompanyIdentiferRohdeandSchwarz = 25, kBluetoothCompanyIdentiferTTPCom = 26, kBluetoothCompanyIdentiferSigniaTechnologies = 27, kBluetoothCompanyIdentiferConexantSystems = 28, kBluetoothCompanyIdentiferQualcomm = 29, kBluetoothCompanyIdentiferInventel = 30, kBluetoothCompanyIdentiferAVMBerlin = 31, kBluetoothCompanyIdentiferBandspeed = 32, kBluetoothCompanyIdentiferMansella = 33, kBluetoothCompanyIdentiferNEC = 34, kBluetoothCompanyIdentiferWavePlusTechnology = 35, kBluetoothCompanyIdentiferAlcatel = 36, kBluetoothCompanyIdentiferPhilipsSemiconductor = 37, kBluetoothCompanyIdentiferCTechnologies = 38, kBluetoothCompanyIdentiferOpenInterface = 39, kBluetoothCompanyIdentiferRFCMicroDevices = 40, kBluetoothCompanyIdentiferHitachi = 41, kBluetoothCompanyIdentiferSymbolTechnologies = 42, kBluetoothCompanyIdentiferTenovis = 43, kBluetoothCompanyIdentiferMacronixInternational = 44, kBluetoothCompanyIdentiferGCTSemiconductor = 45, kBluetoothCompanyIdentiferNorwoodSystems = 46, kBluetoothCompanyIdentiferMewTelTechnology = 47, kBluetoothCompanyIdentiferSTMicroelectronics = 48, kBluetoothCompanyIdentiferSynopsys = 49, kBluetoothCompanyIdentiferRedMCommunications = 50, kBluetoothCompanyIdentiferCommil = 51, kBluetoothCompanyIdentiferCATC = 52, kBluetoothCompanyIdentiferEclipse = 53, kBluetoothCompanyIdentiferRenesasTechnology = 54, kBluetoothCompanyIdentiferMobilian = 55, kBluetoothCompanyIdentiferTerax = 56, kBluetoothCompanyIdentiferIntegratedSystemSolution = 57, kBluetoothCompanyIdentiferMatsushitaElectricIndustrial = 58, kBluetoothCompanyIdentiferGennum = 59, kBluetoothCompanyIdentiferResearchInMotion = 60, kBluetoothCompanyIdentiferIPextreme = 61, kBluetoothCompanyIdentiferSystemsAndChips = 62, kBluetoothCompanyIdentiferBluetoothSIG = 63, kBluetoothCompanyIdentiferSeikoEpson = 64, kBluetoothCompanyIdentiferIntegratedSiliconSolution = 65, kBluetoothCompanyIdentiferCONWISETechnology = 66, kBluetoothCompanyIdentiferParrotSA = 67, kBluetoothCompanyIdentiferSocketCommunications = 68, kBluetoothCompanyIdentiferAtherosCommunications = 69, kBluetoothCompanyIdentiferMediaTek = 70, kBluetoothCompanyIdentiferBluegiga = 71, kBluetoothCompanyIdentiferMarvellTechnologyGroup = 72, kBluetoothCompanyIdentifer3DSP = 73, kBluetoothCompanyIdentiferAccelSemiconductor = 74, kBluetoothCompanyIdentiferContinentialAutomotiveSystems = 75, kBluetoothCompanyIdentiferApple = 76, kBluetoothCompanyIdentiferStaccatoCommunications = 77, kBluetoothCompanyIdentiferAvagoTechnologies = 78, kBluetoothCompanyIdentiferAPT = 79, kBluetoothCompanyIdentiferSiRFTechnology = 80, kBluetoothCompanyIdentiferTZeroTechnologies = 81, kBluetoothCompanyIdentiferJandM = 82, kBluetoothCompanyIdentiferFree2Move = 83, kBluetoothCompanyIdentifer3DiJoy = 84, kBluetoothCompanyIdentiferPlantronics = 85, kBluetoothCompanyIdentiferSonyEricssonMobileCommunications = 86, kBluetoothCompanyIdentiferHarmonInternational = 87, kBluetoothCompanyIdentiferVisio = 88, kBluetoothCompanyIdentiferNordicSemiconductor = 89, kBluetoothCompanyIdentiferEMMicroElectronicMarin = 90, kBluetoothCompanyIdentiferRalinkTechnology = 91, kBluetoothCompanyIdentiferBelkinInternational = 92, kBluetoothCompanyIdentiferRealtekSemiconductor = 93, kBluetoothCompanyIdentiferStonestreetOne = 94, kBluetoothCompanyIdentiferWicentric = 95, kBluetoothCompanyIdentiferRivieraWaves = 96, kBluetoothCompanyIdentiferRDAMicroelectronics = 97, kBluetoothCompanyIdentiferGibsonGuitars = 98, kBluetoothCompanyIdentiferMiCommand = 99, kBluetoothCompanyIdentiferBandXIInternational = 100, kBluetoothCompanyIdentiferHewlettPackard = 101, kBluetoothCompanyIdentifer9SolutionsOy = 102, kBluetoothCompanyIdentiferGNNetcom = 103, kBluetoothCompanyIdentiferGeneralMotors = 104, kBluetoothCompanyIdentiferAAndDEngineering = 105, kBluetoothCompanyIdentiferMindTree = 106, kBluetoothCompanyIdentiferPolarElectroOY = 107, kBluetoothCompanyIdentiferBeautifulEnterprise = 108, kBluetoothCompanyIdentiferBriarTek = 109, kBluetoothCompanyIdentiferSummitDataCommunications = 110, kBluetoothCompanyIdentiferSoundID = 111, kBluetoothCompanyIdentiferMonster = 112, kBluetoothCompanyIdentiferConnectBlueAB = 113, kBluetoothCompanyIdentiferShangHaiSuperSmartElectronics = 114, kBluetoothCompanyIdentiferGroupSense = 115, kBluetoothCompanyIdentiferZomm = 116, kBluetoothCompanyIdentiferSamsungElectronics = 117, kBluetoothCompanyIdentiferCreativeTechnology = 118, kBluetoothCompanyIdentiferLairdTechnologies = 119, kBluetoothCompanyIdentiferNike = 120, kBluetoothCompanyIdentiferLessWire = 121, kBluetoothCompanyIdentiferMStarTechnologies = 122, kBluetoothCompanyIdentiferHanlynnTechnologies = 123, kBluetoothCompanyIdentiferAAndRCambridge = 124, kBluetoothCompanyIdentiferSeersTechnology = 125, kBluetoothCompanyIdentiferSportsTrackingTechnologies = 126, kBluetoothCompanyIdentiferAutonetMobile = 127, kBluetoothCompanyIdentiferDeLormePublishingCompany = 128, kBluetoothCompanyIdentiferWuXiVimicro = 129, kBluetoothCompanyIdentiferSennheiserCommunications = 130, kBluetoothCompanyIdentiferTimeKeepingSystems = 131, kBluetoothCompanyIdentiferLudusHelsinki = 132, kBluetoothCompanyIdentiferBlueRadios = 133, kBluetoothCompanyIdentiferEquinux = 134, kBluetoothCompanyIdentiferGarminInternational = 135, kBluetoothCompanyIdentiferEcotest = 136, kBluetoothCompanyIdentiferGNResound = 137, kBluetoothCompanyIdentiferJawbone = 138, kBluetoothCompanyIdentiferTopconPositioningSystems = 139, kBluetoothCompanyIdentiferGimbal = 140, kBluetoothCompanyIdentiferZscanSoftware = 141, kBluetoothCompanyIdentiferQuintic = 142, kBluetoothCompanyIdentiferTelitWirelessSolutions = 143, kBluetoothCompanyIdentiferFunaiElectric = 144, kBluetoothCompanyIdentiferAdvancedPANMOBILSystems = 145, kBluetoothCompanyIdentiferThinkOptics = 146, kBluetoothCompanyIdentiferUniversalElectriconics = 147, kBluetoothCompanyIdentiferAirohaTechnology = 148, kBluetoothCompanyIdentiferNECLightning = 149, kBluetoothCompanyIdentiferODMTechnology = 150, kBluetoothCompanyIdentiferConnecteDevice = 151, kBluetoothCompanyIdentiferZero1TV = 152, kBluetoothCompanyIdentiferITechDynamicGlobalDistribution = 153, kBluetoothCompanyIdentiferAlpwise = 154, kBluetoothCompanyIdentiferJiangsuToppowerAutomotiveElectronics = 155, kBluetoothCompanyIdentiferColorfy = 156, kBluetoothCompanyIdentiferGeoforce = 157, kBluetoothCompanyIdentiferBose = 158, kBluetoothCompanyIdentiferSuuntoOy = 159, kBluetoothCompanyIdentiferKensingtonComputerProductsGroup = 160, kBluetoothCompanyIdentiferSRMedizinelektronik = 161, kBluetoothCompanyIdentiferVertu = 162, kBluetoothCompanyIdentiferMetaWatch = 163, kBluetoothCompanyIdentiferLinak = 164, kBluetoothCompanyIdentiferOTLDynamics = 165, kBluetoothCompanyIdentiferPandaOcean = 166, kBluetoothCompanyIdentiferVisteon = 167, kBluetoothCompanyIdentiferARPDevicesUnlimited = 168, kBluetoothCompanyIdentiferMagnetiMarelli = 169, kBluetoothCompanyIdentiferCaenRFID = 170, kBluetoothCompanyIdentiferIngenieurSystemgruppeZahn = 171, kBluetoothCompanyIdentiferGreenThrottleGames = 172, kBluetoothCompanyIdentiferPeterSystemtechnik = 173, kBluetoothCompanyIdentiferOmegawave = 174, kBluetoothCompanyIdentiferCinetix = 175, kBluetoothCompanyIdentiferPassifSemiconductor = 176, kBluetoothCompanyIdentiferSarisCyclingGroup = 177, kBluetoothCompanyIdentiferBekey = 178, kBluetoothCompanyIdentiferClarinoxTechnologies = 179, kBluetoothCompanyIdentiferBDETechnology = 180, kBluetoothCompanyIdentiferSwirlNetworks = 181, kBluetoothCompanyIdentiferMesoInternational = 182, kBluetoothCompanyIdentiferTreLab = 183, kBluetoothCompanyIdentiferQualcommInnovationCenter = 184, kBluetoothCompanyIdentiferJohnsonControls = 185, kBluetoothCompanyIdentiferStarkeyLaboratories = 186, kBluetoothCompanyIdentiferSPowerElectronics = 187, kBluetoothCompanyIdentiferAceSensor = 188, kBluetoothCompanyIdentiferAplix = 189, kBluetoothCompanyIdentiferAAMPofAmerica = 190, kBluetoothCompanyIdentiferStalmartTechnology = 191, kBluetoothCompanyIdentiferAMICCOMElectronics = 192, kBluetoothCompanyIdentiferShenzhenExcelsecuDataTechnology = 193, kBluetoothCompanyIdentiferGeneq = 194, kBluetoothCompanyIdentiferAdidas = 195, kBluetoothCompanyIdentiferLGElectronics = 196, kBluetoothCompanyIdentiferOnsetComputer = 197, kBluetoothCompanyIdentiferSelflyBV = 198, kBluetoothCompanyIdentiferQuupa = 199, kBluetoothCompanyIdentiferGeLo = 200, kBluetoothCompanyIdentiferEvluma = 201, kBluetoothCompanyIdentiferMC10 = 202, kBluetoothCompanyIdentiferBinauricSE = 203, kBluetoothCompanyIdentiferBeatsElectronics = 204, kBluetoothCompanyIdentiferMicrochipTechnology = 205, kBluetoothCompanyIdentiferElgatoSystems = 206, kBluetoothCompanyIdentiferARCHOS = 207, kBluetoothCompanyIdentiferDexcom = 208, kBluetoothCompanyIdentiferPolarElectroEurope = 209, kBluetoothCompanyIdentiferDialogSemiconductor = 210, kBluetoothCompanyIdentiferTaixingbangTechnology = 211, kBluetoothCompanyIdentiferKawantech = 212, kBluetoothCompanyIdentiferAustcoCommunicationsSystems = 213, kBluetoothCompanyIdentiferTimexGroup = 214, kBluetoothCompanyIdentiferQualcommTechnologies = 215, kBluetoothCompanyIdentiferQualcommConnectedExperiences = 216, kBluetoothCompanyIdentiferVoyetraTurtleBeach = 217, kBluetoothCompanyIdentifertxtrGMBH = 218, kBluetoothCompanyIdentiferBiosentronics = 219, kBluetoothCompanyIdentiferProctorAndGamble = 220, kBluetoothCompanyIdentiferHosiden = 221, kBluetoothCompanyIdentiferMusik = 222, kBluetoothCompanyIdentiferMisfitWearables = 223, kBluetoothCompanyIdentiferGoogle = 224, kBluetoothCompanyIdentiferDanlers = 225, kBluetoothCompanyIdentiferSemilink = 226, kBluetoothCompanyIdentiferInMusicBrands = 227, kBluetoothCompanyIdentiferLSResearch = 228, kBluetoothCompanyIdentiferEdenSoftwareConsultants = 229, kBluetoothCompanyIdentiferFreshtemp = 230, kBluetoothCompanyIdentiferKSTechnologies = 231, kBluetoothCompanyIdentiferACTSTechnologies = 232, kBluetoothCompanyIdentiferVtrackSystems = 233, kBluetoothCompanyIdentiferNielsenKellerman = 234, kBluetoothCompanyIdentiferServerTechnology = 235, kBluetoothCompanyIdentiferBioResearchAssociates = 236, kBluetoothCompanyIdentiferJollyLogic = 237, kBluetoothCompanyIdentiferAboveAverageOutcomes = 238, kBluetoothCompanyIdentiferBitsplitters = 239, kBluetoothCompanyIdentiferPayPal = 240, kBluetoothCompanyIdentiferWitronTechnology = 241, kBluetoothCompanyIdentiferMorseProject = 242, kBluetoothCompanyIdentiferKentDisplays = 243, kBluetoothCompanyIdentiferNautilus = 244, kBluetoothCompanyIdentiferSmartifier = 245, kBluetoothCompanyIdentiferElcometer = 246, kBluetoothCompanyIdentiferVSNTechnologies = 247, kBluetoothCompanyIdentiferAceUni = 248, kBluetoothCompanyIdentiferStickNFind = 249, kBluetoothCompanyIdentiferCrystalCode = 250, kBluetoothCompanyIdentiferKOUKAMM = 251, kBluetoothCompanyIdentiferDelphi = 252, kBluetoothCompanyIdentiferValenceTech = 253, kBluetoothCompanyIdentiferStanleyBlackAndDecker = 254, kBluetoothCompanyIdentiferTypeProducts = 255, kBluetoothCompanyIdentiferTomTomInternational = 256, kBluetoothCompanyIdentiferFuGoo = 257, kBluetoothCompanyIdentiferKeiser = 258, kBluetoothCompanyIdentiferBangAndOlufson = 259, kBluetoothCompanyIdentiferPLUSLocationSystems = 260, kBluetoothCompanyIdentiferUbiquitousComputingTechnology = 261, kBluetoothCompanyIdentiferInnovativeYachtterSolutions = 262, kBluetoothCompanyIdentiferWilliamDemantHolding = 263, kBluetoothCompanyIdentiferInteropIdentifier = 65535 }; #pragma mark - #pragma mark === Baseband === //================================================================================================================== // Baseband //================================================================================================================== // // Service Class Major // enum { kBluetoothServiceClassMajorLimitedDiscoverableMode = 0x001, // Bit 13 - Limited Discoverable Mode kBluetoothServiceClassMajorReserved1 = 0x002, // Bit 14 - Reserved for future use. kBluetoothServiceClassMajorReserved2 = 0x004, // Bit 15 - Reserved for future use. kBluetoothServiceClassMajorPositioning = 0x008, // Bit 16 - Positioning (Location ID) kBluetoothServiceClassMajorNetworking = 0x010, // Bit 17 - LAN, Ad hoc, etc... kBluetoothServiceClassMajorRendering = 0x020, // Bit 18 - Printing, Speaker, etc... kBluetoothServiceClassMajorCapturing = 0x040, // Bit 19 - Scanner, Microphone, etc... kBluetoothServiceClassMajorObjectTransfer = 0x080, // Bit 20 - v-Inbox, v-Folder, etc... kBluetoothServiceClassMajorAudio = 0x100, // Bit 21 - Speaker, Microphone, Headset, etc... kBluetoothServiceClassMajorTelephony = 0x200, // Bit 22 - Cordless telephony, Modem, Headset, etc... kBluetoothServiceClassMajorInformation = 0x400, // Bit 23 - Web server, WAP server, etc... kBluetoothServiceClassMajorAny = '****', // Pseudo-class - means anything acceptable. kBluetoothServiceClassMajorNone = 'none', // Pseudo-class - means no matching. kBluetoothServiceClassMajorEnd }; // // Device Class Major // enum { kBluetoothDeviceClassMajorMiscellaneous = 0x00, // [00000] Miscellaneous kBluetoothDeviceClassMajorComputer = 0x01, // [00001] Desktop, Notebook, PDA, Organizers, etc... kBluetoothDeviceClassMajorPhone = 0x02, // [00010] Cellular, Cordless, Payphone, Modem, etc... kBluetoothDeviceClassMajorLANAccessPoint = 0x03, // [00011] LAN Access Point kBluetoothDeviceClassMajorAudio = 0x04, // [00100] Headset, Speaker, Stereo, etc... kBluetoothDeviceClassMajorPeripheral = 0x05, // [00101] Mouse, Joystick, Keyboards, etc... kBluetoothDeviceClassMajorImaging = 0x06, // [00110] Printing, scanner, camera, display, etc... kBluetoothDeviceClassMajorWearable = 0x07, // [00111] Wearable kBluetoothDeviceClassMajorToy = 0x08, // [01000] Toy kBluetoothDeviceClassMajorHealth = 0x09, // [01001] Health devices kBluetoothDeviceClassMajorUnclassified = 0x1F, // [11111] Specific device code not assigned // Range 0x06 to 0x1E Reserved for future use. kBluetoothDeviceClassMajorAny = '****', // Pseudo-class - means anything acceptable. kBluetoothDeviceClassMajorNone = 'none', // Pseudo-class - means no matching. kBluetoothDeviceClassMajorEnd }; // // Device Class Minor // enum { /// /// Computer Minor Class /// kBluetoothDeviceClassMinorComputerUnclassified = 0x00, // [000000] Specific device code not assigned kBluetoothDeviceClassMinorComputerDesktopWorkstation = 0x01, // [000001] Desktop workstation kBluetoothDeviceClassMinorComputerServer = 0x02, // [000010] Server-class computer kBluetoothDeviceClassMinorComputerLaptop = 0x03, // [000011] Laptop kBluetoothDeviceClassMinorComputerHandheld = 0x04, // [000100] Handheld PC/PDA (clam shell) kBluetoothDeviceClassMinorComputerPalmSized = 0x05, // [000101] Palm-sized PC/PDA kBluetoothDeviceClassMinorComputerWearable = 0x06, // [000110] Wearable computer (watch sized) // Range 0x06 to 0x7F Reserved for future use. /// /// Phone Minor Class /// kBluetoothDeviceClassMinorPhoneUnclassified = 0x00, // [000000] Specific device code not assigned kBluetoothDeviceClassMinorPhoneCellular = 0x01, // [000001] Cellular kBluetoothDeviceClassMinorPhoneCordless = 0x02, // [000010] Cordless kBluetoothDeviceClassMinorPhoneSmartPhone = 0x03, // [000011] Smart phone kBluetoothDeviceClassMinorPhoneWiredModemOrVoiceGateway = 0x04, // [000100] Wired modem or voice gateway kBluetoothDeviceClassMinorPhoneCommonISDNAccess = 0x05, // [000101] Common ISDN Access // Range 0x05 to 0x7F Reserved for future use. /// /// LAN Access Point Minor Class /// // See the Bluetooth specification for LAN Access Point minor classes, which are broken into bits 5-7 for utilization and bits 2-4 for class. /// /// Audio Minor Class /// kBluetoothDeviceClassMinorAudioUnclassified = 0x00, // [000000] Specific device code not assigned kBluetoothDeviceClassMinorAudioHeadset = 0x01, // [000001] Device conforms to the Headset profile kBluetoothDeviceClassMinorAudioHandsFree = 0x02, // [000010] Hands-free kBluetoothDeviceClassMinorAudioReserved1 = 0x03, // [000011] Reserved kBluetoothDeviceClassMinorAudioMicrophone = 0x04, // [000100] Microphone kBluetoothDeviceClassMinorAudioLoudspeaker = 0x05, // [000101] Loudspeaker kBluetoothDeviceClassMinorAudioHeadphones = 0x06, // [000110] Headphones kBluetoothDeviceClassMinorAudioPortable = 0x07, // [000111] Portable Audio kBluetoothDeviceClassMinorAudioCar = 0x08, // [001000] Car Audio kBluetoothDeviceClassMinorAudioSetTopBox = 0x09, // [001001] Set-top box kBluetoothDeviceClassMinorAudioHiFi = 0x0a, // [001010] HiFi Audio Device kBluetoothDeviceClassMinorAudioVCR = 0x0b, // [001011] VCR kBluetoothDeviceClassMinorAudioVideoCamera = 0x0c, // [001100] Video Camera kBluetoothDeviceClassMinorAudioCamcorder = 0x0d, // [001101] Camcorder kBluetoothDeviceClassMinorAudioVideoMonitor = 0x0e, // [001110] Video Monitor kBluetoothDeviceClassMinorAudioVideoDisplayAndLoudspeaker = 0x0f, // [001111] Video Display and Loudspeaker kBluetoothDeviceClassMinorAudioVideoConferencing = 0x10, // [010000] Video Conferencing kBluetoothDeviceClassMinorAudioReserved2 = 0x11, // [010001] Reserved kBluetoothDeviceClassMinorAudioGamingToy = 0x12, // [010010] Gaming/Toy // Range 0x13 to 0x7F Reserved for future use. /// /// Peripheral Minor Class /// // Peripheral1 subclass is bits 7 & 6 kBluetoothDeviceClassMinorPeripheral1Keyboard = 0x10, // [01XXXX] Keyboard kBluetoothDeviceClassMinorPeripheral1Pointing = 0x20, // [10XXXX] Pointing device kBluetoothDeviceClassMinorPeripheral1Combo = 0x30, // [11XXXX] Combo keyboard/pointing device // Peripheral2 subclass is bits 5-2 kBluetoothDeviceClassMinorPeripheral2Unclassified = 0x00, // [XX0000] Uncategorized device kBluetoothDeviceClassMinorPeripheral2Joystick = 0x01, // [XX0001] Joystick kBluetoothDeviceClassMinorPeripheral2Gamepad = 0x02, // [XX0010] Gamepad kBluetoothDeviceClassMinorPeripheral2RemoteControl = 0x03, // [XX0011] Remote control kBluetoothDeviceClassMinorPeripheral2SensingDevice = 0x04, // [XX0100] Sensing device kBluetoothDeviceClassMinorPeripheral2DigitizerTablet = 0x05, // [XX0101] Digitizer Tablet kBluetoothDeviceClassMinorPeripheral2CardReader = 0x06, // [XX0110] Card Reader kBluetoothDeviceClassMinorPeripheral2DigitalPen = 0x07, // [XX0111] Digital Pen kBluetoothDeviceClassMinorPeripheral2HandheldScanner = 0x08, // [XX1000] Handheld scanner for bar-codes, RFID, etc. kBluetoothDeviceClassMinorPeripheral2GesturalInputDevice = 0x09, // [XX1001] Handheld gestural input device (e.g., "wand" form factor) kBluetoothDeviceClassMinorPeripheral2AnyPointing = 'poin', // Anything under MinorPeripheral1Pointing // Range 0x05 to 0x0f reserved for future use /// /// Imaging Minor Class /// // Imaging1 subclass is bits 7 - 4 kBluetoothDeviceClassMinorImaging1Display = 0x04, // [XXX1XX] Display kBluetoothDeviceClassMinorImaging1Camera = 0x08, // [XX1XXX] Camera kBluetoothDeviceClassMinorImaging1Scanner = 0x10, // [X1XXXX] Scanner kBluetoothDeviceClassMinorImaging1Printer = 0x20, // [1XXXXX] Printer // Imaging2 subclass is bits 3 - 2 kBluetoothDeviceClassMinorImaging2Unclassified = 0x00, // [XXXX00] Uncategorized, default // Range 0x01 - 0x03 reserved for future use /// /// Wearable Minor Class /// kBluetoothDeviceClassMinorWearableWristWatch = 0x01, // [000001] Watch kBluetoothDeviceClassMinorWearablePager = 0x02, // [000010] Pager kBluetoothDeviceClassMinorWearableJacket = 0x03, // [000011] Jacket kBluetoothDeviceClassMinorWearableHelmet = 0x04, // [000100] Helmet kBluetoothDeviceClassMinorWearableGlasses = 0x05, // [000101] Glasses /// /// Toy Minor Class /// kBluetoothDeviceClassMinorToyRobot = 0x01, // [000001] Robot kBluetoothDeviceClassMinorToyVehicle = 0x02, // [000010] Vehicle kBluetoothDeviceClassMinorToyDollActionFigure = 0x03, // [000011] Doll / Action Figure kBluetoothDeviceClassMinorToyController = 0x04, // [000100] Controller kBluetoothDeviceClassMinorToyGame = 0x05, // [000101] Game /// /// Health Minor Class /// kBluetoothDeviceClassMinorHealthUndefined = 0x00, // [000000] Undefined kBluetoothDeviceClassMinorHealthBloodPressureMonitor = 0x01, // [000001] Blood Pressure Monitor kBluetoothDeviceClassMinorHealthThermometer = 0x02, // [000010] Thermometer kBluetoothDeviceClassMinorHealthScale = 0x03, // [000011] Scale kBluetoothDeviceClassMinorHealthGlucoseMeter = 0x04, // [000100] Glucose Meter kBluetoothDeviceClassMinorHealthPulseOximeter = 0x05, // [000101] Pulse Oximeter kBluetoothDeviceClassMinorHealthHeartRateMonitor = 0x06, // [000111] Heart Rate Monitor kBluetoothDeviceClassMinorHealthDataDisplay = 0x07, // [001000] Display /// /// Misc /// kBluetoothDeviceClassMinorAny = '****', // Pseudo-class - means anything acceptable. kBluetoothDeviceClassMinorNone = 'none', // Pseudo-class - means no matching. kBluetoothDeviceClassMinorEnd }; // Peripheral devices bits 7 & 6 #define BluetoothCoDMinorPeripheral1(minorClass) (minorClass & 0x30) // Peripheral devices bits 5 - 2 #define BluetoothCoDMinorPeripheral2(minorClass) (minorClass & 0x0f) #pragma mark - LE Appearance enum { kBluetoothGAPAppearanceUnknown = 0, kBluetoothGAPAppearanceGenericPhone = 64, kBluetoothGAPAppearanceGenericComputer = 128, kBluetoothGAPAppearanceGenericWatch = 192, kBluetoothGAPAppearanceGenericClock = 256, kBluetoothGAPAppearanceGenericDisplay = 320, kBluetoothGAPAppearanceGenericRemoteControl = 384, kBluetoothGAPAppearanceGenericEyeGlasses = 448, kBluetoothGAPAppearanceGenericTag = 512, kBluetoothGAPAppearanceGenericKeyring = 576, kBluetoothGAPAppearanceGenericMediaPlayer = 640, kBluetoothGAPAppearanceGenericBarcodeScanner = 704, kBluetoothGAPAppearanceGenericThermometer = 768, kBluetoothGAPAppearanceGenericHeartrateSensor = 832, kBluetoothGAPAppearanceGenericBloodPressure = 896, kBluetoothGAPAppearanceGenericHumanInterfaceDevice = 960, kBluetoothGAPAppearanceHumanInterfaceDeviceKeyboard = 961, kBluetoothGAPAppearanceHumanInterfaceDeviceMouse = 962, kBluetoothGAPAppearanceHumanInterfaceDeviceJoystick = 963, kBluetoothGAPAppearanceHumanInterfaceDeviceGamepad = 964, kBluetoothGAPAppearanceHumanInterfaceDeviceDigitizerTablet = 965, kBluetoothGAPAppearanceHumanInterfaceDeviceCardReader = 966, kBluetoothGAPAppearanceHumanInterfaceDeviceDigitalPen = 967, kBluetoothGAPAppearanceHumanInterfaceDeviceBarcodeScanner = 968, kBluetoothGAPAppearanceGenericGlucoseMeter = 1024, kBluetoothGAPAppearanceGenericRunningWalkingSensor = 1088, kBluetoothGAPAppearanceGenericCycling = 1152, }; #pragma mark - #pragma mark === L2CAP === //=========================================================================================================================== // L2CAP //=========================================================================================================================== enum { kBluetoothL2CAPPSMSDP = 0x0001, kBluetoothL2CAPPSMRFCOMM = 0x0003, kBluetoothL2CAPPSMTCS_BIN = 0x0005, // Telephony Control Specifictation / TCS Binary kBluetoothL2CAPPSMTCS_BIN_Cordless = 0x0007, // Telephony Control Specifictation / TCS Binary kBluetoothL2CAPPSMBNEP = 0x000F, // Bluetooth Network Encapsulation Protocol kBluetoothL2CAPPSMHIDControl = 0x0011, // HID profile - control interface kBluetoothL2CAPPSMHIDInterrupt = 0x0013, // HID profile - interrupt interface kBluetoothL2CAPPSMAVCTP = 0x0017, // Audio/Video Control Transport Protocol kBluetoothL2CAPPSMAVDTP = 0x0019, // Audio/Video Distribution Transport Protocol kBluetoothL2CAPPSMAVCTP_Browsing = 0x001B, // AVTCP (AVRCP) Browsing kBluetoothL2CAPPSMUID_C_Plane = 0x001D, // Unrestricted Digital Information Profile (UDI) kBluetoothL2CAPPSMATT = 0x001F, // Attribute Protocol // Range < 0x1000 reserved. kBluetoothL2CAPPSMReservedStart = 0x0001, kBluetoothL2CAPPSMReservedEnd = 0x1000, // Range 0x1001-0xFFFF dynamically assigned. kBluetoothL2CAPPSMDynamicStart = 0x1001, // AACP kBluetoothL2CAPPSMAACP = 0x1001, kBluetoothL2CAPPSMD2D = 0x100F, kBluetoothL2CAPPSMDynamicEnd = 0xFFFF, kBluetoothL2CAPPSMNone = 0x0000 }; #pragma mark - #pragma mark === SDP === //=========================================================================================================================== // Service Discovery Protocol //=========================================================================================================================== enum { // General kBluetoothSDPUUID16Base = 0x0000, // 00000000-0000-1000-8000-00805f9b34fb // Protocols kBluetoothSDPUUID16SDP = 0x0001, // 00000001-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16UDP = 0x0002, // 00000002-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16RFCOMM = 0x0003, // 00000003-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16TCP = 0x0004, // 00000004-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16TCSBIN = 0x0005, // 00000005-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16TCSAT = 0x0006, // 00000006-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ATT = 0x0007, kBluetoothSDPUUID16OBEX = 0x0008, // 00000008-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16IP = 0x0009, // 00000009-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16FTP = 0x000A, // 0000000A-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16HTTP = 0x000C, // 0000000C-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16WSP = 0x000E, // 0000000E-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16BNEP = 0x000F, kBluetoothSDPUUID16UPNP = 0x0010, kBluetoothSDPUUID16HIDP = 0x0011, kBluetoothSDPUUID16HardcopyControlChannel = 0x0012, kBluetoothSDPUUID16HardcopyDataChannel = 0x0014, kBluetoothSDPUUID16HardcopyNotification = 0x0016, kBluetoothSDPUUID16AVCTP = 0x0017, kBluetoothSDPUUID16AVDTP = 0x0019, kBluetoothSDPUUID16CMPT = 0x001B, kBluetoothSDPUUID16UDI_C_Plane = 0x001D, kBluetoothSDPUUID16MCAPControlChannel = 0x001E, kBluetoothSDPUUID16MCAPDataChannel = 0x001F, kBluetoothSDPUUID16L2CAP = 0x0100, // 00000100-0000-1000-8000-00805f9b34fb }; enum SDPServiceClasses { kBluetoothSDPUUID16ServiceClassServiceDiscoveryServer = 0x1000, // 00001000-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassBrowseGroupDescriptor = 0x1001, // 00001001-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassPublicBrowseGroup = 0x1002, // 00001002-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassSerialPort = 0x1101, // 00001101-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassLANAccessUsingPPP = 0x1102, // 00001102-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassDialupNetworking = 0x1103, // 00001103-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassIrMCSync = 0x1104, // 00001104-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassOBEXObjectPush = 0x1105, // 00001105-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassOBEXFileTransfer = 0x1106, // 00001106-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassIrMCSyncCommand = 0x1107, // 00001107-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassHeadset = 0x1108, // 00001108-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassCordlessTelephony = 0x1109, // 00001109-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassAudioSource = 0x110A, kBluetoothSDPUUID16ServiceClassAudioSink = 0x110B, kBluetoothSDPUUID16ServiceClassAVRemoteControlTarget = 0x110C, kBluetoothSDPUUID16ServiceClassAdvancedAudioDistribution = 0x110D, kBluetoothSDPUUID16ServiceClassAVRemoteControl = 0x110E, kBluetoothSDPUUID16ServiceClassAVRemoteControlController = 0x110F, kBluetoothSDPUUID16ServiceClassIntercom = 0x1110, // 00001110-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassFax = 0x1111, // 00001111-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassHeadsetAudioGateway = 0x1112, // 00001112-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassWAP = 0x1113, kBluetoothSDPUUID16ServiceClassWAPClient = 0x1114, kBluetoothSDPUUID16ServiceClassPANU = 0x1115, kBluetoothSDPUUID16ServiceClassNAP = 0x1116, kBluetoothSDPUUID16ServiceClassGN = 0x1117, kBluetoothSDPUUID16ServiceClassDirectPrinting = 0x1118, kBluetoothSDPUUID16ServiceClassReferencePrinting = 0x1119, kBluetoothSDPUUID16ServiceClassImaging = 0x111A, kBluetoothSDPUUID16ServiceClassImagingResponder = 0x111B, kBluetoothSDPUUID16ServiceClassImagingAutomaticArchive = 0x111C, kBluetoothSDPUUID16ServiceClassImagingReferencedObjects = 0x111D, kBluetoothSDPUUID16ServiceClassHandsFree = 0x111E, kBluetoothSDPUUID16ServiceClassHandsFreeAudioGateway = 0x111F, kBluetoothSDPUUID16ServiceClassDirectPrintingReferenceObjectsService = 0x1120, kBluetoothSDPUUID16ServiceClassReflectedUI = 0x1121, kBluetoothSDPUUID16ServiceClassBasicPrinting = 0x1122, kBluetoothSDPUUID16ServiceClassPrintingStatus = 0x1123, kBluetoothSDPUUID16ServiceClassHumanInterfaceDeviceService = 0x1124, kBluetoothSDPUUID16ServiceClassHardcopyCableReplacement = 0x1125, kBluetoothSDPUUID16ServiceClassHCR_Print = 0x1126, kBluetoothSDPUUID16ServiceClassHCR_Scan = 0x1127, kBluetoothSDPUUID16ServiceClassCommonISDNAccess = 0x1128, kBluetoothSDPUUID16ServiceClassVideoConferencingGW = 0x1129, kBluetoothSDPUUID16ServiceClassUDI_MT = 0x112A, kBluetoothSDPUUID16ServiceClassUDI_TA = 0x112B, kBluetoothSDPUUID16ServiceClassAudioVideo = 0x112C, kBluetoothSDPUUID16ServiceClassSIM_Access = 0x112D, kBluetoothSDPUUID16ServiceClassPhonebookAccess_PCE = 0x112E, kBluetoothSDPUUID16ServiceClassPhonebookAccess_PSE = 0x112F, kBluetoothSDPUUID16ServiceClassPhonebookAccess = 0x1130, kBluetoothSDPUUID16ServiceClassHeadset_HS = 0x1131, kBluetoothSDPUUID16ServiceClassMessageAccessServer = 0x1132, kBluetoothSDPUUID16ServiceClassMessageNotificationServer = 0x1133, kBluetoothSDPUUID16ServiceClassMessageAccessProfile = 0x1134, kBluetoothSDPUUID16ServiceClassGlobalNavigationSatelliteSystem = 0x1135, kBluetoothSDPUUID16ServiceClassGlobalNavigationSatelliteSystemServer = 0x1136, kBluetoothSDPUUID16ServiceClassPnPInformation = 0x1200, // 00001200-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassGenericNetworking = 0x1201, // 00001201-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassGenericFileTransfer = 0x1202, // 00001202-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassGenericAudio = 0x1203, // 00001203-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassGenericTelephony = 0x1204, // 00001204-0000-1000-8000-00805f9b34fb kBluetoothSDPUUID16ServiceClassVideoSource = 0x1303, kBluetoothSDPUUID16ServiceClassVideoSink = 0x1304, kBluetoothSDPUUID16ServiceClassVideoDistribution = 0x1305, kBluetoothSDPUUID16ServiceClassHealthDevice = 0x1400, kBluetoothSDPUUID16ServiceClassHealthDeviceSource = 0x1401, kBluetoothSDPUUID16ServiceClassHealthDeviceSink = 0x1402, kBluetoothSDPUUID16ServiceClassGATT = 0x1801, }; enum SDPAttributeIdentifierCodes { kBluetoothSDPAttributeIdentifierServiceRecordHandle = 0x0000, kBluetoothSDPAttributeIdentifierServiceClassIDList = 0x0001, kBluetoothSDPAttributeIdentifierServiceRecordState = 0x0002, kBluetoothSDPAttributeIdentifierServiceID = 0x0003, kBluetoothSDPAttributeIdentifierProtocolDescriptorList = 0x0004, kBluetoothSDPAttributeIdentifierBrowseGroupList = 0x0005, kBluetoothSDPAttributeIdentifierLanguageBaseAttributeIDList = 0x0006, kBluetoothSDPAttributeIdentifierServiceInfoTimeToLive = 0x0007, kBluetoothSDPAttributeIdentifierServiceAvailability = 0x0008, kBluetoothSDPAttributeIdentifierBluetoothProfileDescriptorList = 0x0009, kBluetoothSDPAttributeIdentifierDocumentationURL = 0x000A, kBluetoothSDPAttributeIdentifierClientExecutableURL = 0x000B, kBluetoothSDPAttributeIdentifierIconURL = 0x000C, kBluetoothSDPAttributeIdentifierAdditionalProtocolsDescriptorList = 0x000D, // Service Discovery Server kBluetoothSDPAttributeIdentifierVersionNumberList = 0x0200, kBluetoothSDPAttributeIdentifierServiceDatabaseState = 0x0201, // Browse Group Descriptor kBluetoothSDPAttributeIdentifierGroupID = 0x0200, // PAN kBluetoothSDPAttributeIdentifierIPSubnet = 0x0200, // HID Required Type Notes kBluetoothSDPAttributeIdentifierHIDReleaseNumber = 0x0200, // O uint16 kBluetoothSDPAttributeIdentifierHIDParserVersion = 0x0201, // M uint16 kBluetoothSDPAttributeIdentifierHIDDeviceSubclass = 0x0202, // M uint8 Should match the low order 8 bits of CoD unless a combo device kBluetoothSDPAttributeIdentifierHIDCountryCode = 0x0203, // M uint8 kBluetoothSDPAttributeIdentifierHIDVirtualCable = 0x0204, // M bool kBluetoothSDPAttributeIdentifierHIDReconnectInitiate = 0x0205, // M bool kBluetoothSDPAttributeIdentifierHIDDescriptorList = 0x0206, // M sequence Layout is defined in Section 6.2 of the HID Specification kBluetoothSDPAttributeIdentifierHIDLangIDBaseList = 0x0207, // M sequence kBluetoothSDPAttributeIdentifierHIDSDPDisable = 0x0208, // O bool kBluetoothSDPAttributeIdentifierHIDBatteryPower = 0x0209, // O bool kBluetoothSDPAttributeIdentifierHIDRemoteWake = 0x020A, // O bool kBluetoothSDPAttributeIdentifierHIDProfileVersion = 0x020B, // M uint16 kBluetoothSDPAttributeIdentifierHIDSupervisionTimeout = 0x020C, // O uint16 Default to 5 seconds or longer if not defined kBluetoothSDPAttributeIdentifierHIDNormallyConnectable = 0x020D, // O bool kBluetoothSDPAttributeIdentifierHIDBootDevice = 0x020E, // M bool Only defined for mice and keyboards as of HID 1.0 kBluetoothSDPAttributeIdentifierHIDSSRHostMaxLatency = 0x020F, // O uint16 kBluetoothSDPAttributeIdentifierHIDSSRHostMinTimeout = 0x0210, // O uint16 kBluetoothSDPAttributeIdentifierServiceVersion = 0x0300, kBluetoothSDPAttributeIdentifierExternalNetwork = 0x0301, // Cordless telephony kBluetoothSDPAttributeIdentifierNetwork = 0x0301, // Handsfree Profile (HFP) kBluetoothSDPAttributeIdentifierSupportedDataStoresList = 0x0301, // Sync Profile kBluetoothSDPAttributeIdentifierFaxClass1Support = 0x0302, // Fax Profile kBluetoothSDPAttributeIdentifierRemoteAudioVolumeControl = 0x0302, // GAP??? kBluetoothSDPAttributeIdentifierFaxClass2_0Support = 0x0303, kBluetoothSDPAttributeIdentifierSupporterFormatsList = 0x0303, kBluetoothSDPAttributeIdentifierFaxClass2Support = 0x0304, kBluetoothSDPAttributeIdentifierAudioFeedbackSupport = 0x0305, kBluetoothSDPAttributeIdentifierNetworkAddress = 0x0306, // WAP kBluetoothSDPAttributeIdentifierWAPGateway = 0x0307, // WAP kBluetoothSDPAttributeIdentifierHomepageURL = 0x0308, // WAP kBluetoothSDPAttributeIdentifierWAPStackType = 0x0309, // WAP kBluetoothSDPAttributeIdentifierSecurityDescription = 0x030A, // PAN kBluetoothSDPAttributeIdentifierNetAccessType = 0x030B, // PAN kBluetoothSDPAttributeIdentifierMaxNetAccessRate = 0x030C, // PAN kBluetoothSDPAttributeIdentifierSupportedCapabilities = 0x0310, // Imaging kBluetoothSDPAttributeIdentifierSupportedFeatures = 0x0311, // Imaging & HFP kBluetoothSDPAttributeIdentifierSupportedFunctions = 0x0312, // Imaging kBluetoothSDPAttributeIdentifierTotalImagingDataCapacity = 0x0313, // Imaging kBluetoothSDPAttributeIdentifierServiceName = 0x0000, /* +language base offset*/ kBluetoothSDPAttributeIdentifierServiceDescription = 0x0001, /* +language base offset*/ kBluetoothSDPAttributeIdentifierProviderName = 0x0002 /* +language base offset*/ }; enum SDPAttributeDeviceIdentificationRecord { // DeviceID v1.3 Required Type Section Notes kBluetoothSDPAttributeDeviceIdentifierServiceDescription = 0x0001, // O string - kBluetoothSDPAttributeDeviceIdentifierDocumentationURL = 0x000A, // O url - kBluetoothSDPAttributeDeviceIdentifierClientExecutableURL = 0x000B, // O url - kBluetoothSDPAttributeDeviceIdentifierSpecificationID = 0x0200, // M uint16 5.1 kBluetoothSDPAttributeDeviceIdentifierVendorID = 0x0201, // M uint16 5.2 kBluetoothSDPAttributeDeviceIdentifierProductID = 0x0202, // M uint16 5.3 kBluetoothSDPAttributeDeviceIdentifierVersion = 0x0203, // M uint16 5.4 kBluetoothSDPAttributeDeviceIdentifierPrimaryRecord = 0x0204, // M bool 5.5 kBluetoothSDPAttributeDeviceIdentifierVendorIDSource = 0x0205, // M uint16 5.6 kBluetoothSDPAttributeDeviceIdentifierReservedRangeStart = 0x0206, kBluetoothSDPAttributeDeviceIdentifierReservedRangeEnd = 0x02FF }; enum ProtocolParameters { kBluetoothSDPProtocolParameterL2CAPPSM = 1, kBluetoothSDPProtocolParameterRFCOMMChannel = 1, kBluetoothSDPProtocolParameterTCPPort = 1, kBluetoothSDPProtocolParameterUDPPort = 1, kBluetoothSDPProtocolParameterBNEPVersion = 1, kBluetoothSDPProtocolParameterBNEPSupportedNetworkPacketTypeList = 2 }; //Inquiries with 'Extended Inquiry Response' (v2.1 specification) enum BluetoothHCIExtendedInquiryResponseDataTypes { kBluetoothHCIExtendedInquiryResponseDataTypeFlags = 0x01, kBluetoothHCIExtendedInquiryResponseDataType16BitServiceClassUUIDsWithMoreAvailable = 0x02, kBluetoothHCIExtendedInquiryResponseDataType16BitServiceClassUUIDsCompleteList = 0x03, kBluetoothHCIExtendedInquiryResponseDataType32BitServiceClassUUIDsWithMoreAvailable = 0x04, kBluetoothHCIExtendedInquiryResponseDataType32BitServiceClassUUIDsCompleteList = 0x05, kBluetoothHCIExtendedInquiryResponseDataType128BitServiceClassUUIDsWithMoreAvailable = 0x06, kBluetoothHCIExtendedInquiryResponseDataType128BitServiceClassUUIDsCompleteList = 0x07, kBluetoothHCIExtendedInquiryResponseDataTypeShortenedLocalName = 0x08, kBluetoothHCIExtendedInquiryResponseDataTypeCompleteLocalName = 0x09, kBluetoothHCIExtendedInquiryResponseDataTypeTransmitPowerLevel = 0x0A, kBluetoothHCIExtendedInquiryResponseDataTypeSSPOOBClassOfDevice = 0x0D, kBluetoothHCIExtendedInquiryResponseDataTypeSSPOOBSimplePairingHashC = 0x0E, kBluetoothHCIExtendedInquiryResponseDataTypeSSPOOBSimplePairingRandomizerR = 0x0F, kBluetoothHCIExtendedInquiryResponseDataTypeDeviceID = 0x10, kBluetoothHCIExtendedInquiryResponseDataTypeSecurityManagerTKValue = 0x10, kBluetoothHCIExtendedInquiryResponseDataTypeSecurityManagerOOBFlags = 0x11, kBluetoothHCIExtendedInquiryResponseDataTypePeripheralConnectionIntervalRange = 0x12, kBluetoothHCIExtendedInquiryResponseDataTypeServiceSolicitation16BitUUIDs = 0x14, kBluetoothHCIExtendedInquiryResponseDataTypeServiceSolicitation128BitUUIDs = 0x15, kBluetoothHCIExtendedInquiryResponseDataTypeServiceData = 0x16, kBluetoothHCIExtendedInquiryResponseDataTypePublicTargetAddress = 0x17, kBluetoothHCIExtendedInquiryResponseDataTypeRandomTargetAddress = 0x18, kBluetoothHCIExtendedInquiryResponseDataTypeAppearance = 0x19, kBluetoothHCIExtendedInquiryResponseDataTypeAdvertisingInterval = 0x1A, kBluetoothHCIExtendedInquiryResponseDataTypeLEBluetoothDeviceAddress = 0x1B, kBluetoothHCIExtendedInquiryResponseDataTypeLERole = 0x1C, kBluetoothHCIExtendedInquiryResponseDataTypeSimplePairingHash = 0x1D, kBluetoothHCIExtendedInquiryResponseDataTypeSimplePairingRandomizer = 0x1E, kBluetoothHCIExtendedInquiryResponseDataTypeServiceSolicitation32BitUUIDs = 0x1F, kBluetoothHCIExtendedInquiryResponseDataTypeServiceData32BitUUID = 0x20, kBluetoothHCIExtendedInquiryResponseDataTypeServiceData128BitUUID = 0x21, kBluetoothHCIExtendedInquiryResponseDataTypeSecureConnectionsConfirmationValue = 0x22, kBluetoothHCIExtendedInquiryResponseDataTypeSecureConnectionsRandomValue = 0x23, kBluetoothHCIExtendedInquiryResponseDataTypeURI = 0x24, kBluetoothHCIExtendedInquiryResponseDataTypeIndoorPositioning = 0x25, kBluetoothHCIExtendedInquiryResponseDataTypeTransportDiscoveryData = 0x26, kBluetoothHCIExtendedInquiryResponseDataType3DInformationData = 0x3D, kBluetoothHCIExtendedInquiryResponseDataTypeManufacturerSpecificData = 0xFF, kBluetoothHCIExtendedInquiryResponseDataTypeSlaveConnectionIntervalRange __attribute__ ((deprecated)) = kBluetoothHCIExtendedInquiryResponseDataTypePeripheralConnectionIntervalRange, }; // HCI Versions // Living Document URL: https://www.bluetooth.com/specifications/assigned-numbers/host-controller-interface typedef enum BluetoothHCIVersions { kBluetoothHCIVersionCoreSpecification1_0b = 0x00, kBluetoothHCIVersionCoreSpecification1_1 = 0x01, kBluetoothHCIVersionCoreSpecification1_2 = 0x02, kBluetoothHCIVersionCoreSpecification2_0EDR = 0x03, kBluetoothHCIVersionCoreSpecification2_1EDR = 0x04, kBluetoothHCIVersionCoreSpecification3_0HS = 0x05, kBluetoothHCIVersionCoreSpecification4_0 = 0x06, kBluetoothHCIVersionCoreSpecification4_1 = 0x07, kBluetoothHCIVersionCoreSpecification4_2 = 0x08, kBluetoothHCIVersionCoreSpecification5_0 = 0x09, kBluetoothHCIVersionCoreSpecification5_1 = 0x0a, kBluetoothHCIVersionCoreSpecification5_2 = 0x0b } BluetoothHCIVersions; // LMP Versions // Living Document URL: https://www.bluetooth.com/specifications/assigned-numbers/link-manager typedef enum BluetoothLMPVersions { kBluetoothLMPVersionCoreSpecification1_0b = 0x00, kBluetoothLMPVersionCoreSpecification1_1 = 0x01, kBluetoothLMPVersionCoreSpecification1_2 = 0x02, kBluetoothLMPVersionCoreSpecification2_0EDR = 0x03, kBluetoothLMPVersionCoreSpecification2_1EDR = 0x04, kBluetoothLMPVersionCoreSpecification3_0HS = 0x05, kBluetoothLMPVersionCoreSpecification4_0 = 0x06, kBluetoothLMPVersionCoreSpecification4_1 = 0x07, kBluetoothLMPVersionCoreSpecification4_2 = 0x08, kBluetoothLMPVersionCoreSpecification5_0 = 0x09, kBluetoothLMPVersionCoreSpecification5_1 = 0x0a, kBluetoothLMPVersionCoreSpecification5_2 = 0x0b } BluetoothLMPVersions; #ifdef __cplusplus } #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/bluetooth/Bluetooth.h
/* File: Bluetooth.h Contains: Public interfaces for Bluetooth technology. Copyright: (c) 2010 by Apple, Inc. All rights reserved. */ #pragma once #ifdef KERNEL #import <IOKit/bluetooth/BluetoothAssignedNumbers.h> #else #import <CoreFoundation/CFBase.h> #import <IOBluetooth/BluetoothAssignedNumbers.h> #endif #import <IOKit/IOTypes.h> #import <libkern/OSByteOrder.h> //--------------------------------------------------------------------------------------------------------------------------- /*! @header Bluetooth Bluetooth wireless technology */ #if defined(__cplusplus) #define IOBLUETOOTH_EXPORT extern "C" #else #define IOBLUETOOTH_EXPORT extern #endif #ifdef __cplusplus extern "C" { #endif #if 0 #pragma mark === Baseband === #endif //=========================================================================================================================== // Baseband //=========================================================================================================================== typedef uint16_t BluetoothConnectionHandle; // Upper 4 bits are reserved. typedef uint8_t BluetoothLMPHandle; enum { kBluetoothConnectionHandleNone = 0xffff }; typedef uint8_t BluetoothReasonCode; typedef uint8_t BluetoothEncryptionEnable; enum { kBluetoothEncryptionEnableOff = 0x00, kBluetoothEncryptionEnableOn = 0x01, kBluetoothEncryptionEnableBREDRE0 = 0x01, kBluetoothEncryptionEnableLEAESCCM = 0x01, kBluetoothEncryptionEnableBREDRAESCCM = 0x02 }; typedef uint8_t BluetoothKeyFlag; enum { kBluetoothKeyFlagSemiPermanent = 0x00, kBluetoothKeyFlagTemporary = 0x01 }; typedef uint8_t BluetoothKeyType; enum { kBluetoothKeyTypeCombination = 0x00, kBluetoothKeyTypeLocalUnit = 0x01, kBluetoothKeyTypeRemoteUnit = 0x02, kBluetoothKeyTypeDebugCombination = 0x03, kBluetoothKeyTypeUnauthenticatedCombination = 0x04, kBluetoothKeyTypeAuthenticatedCombination = 0x05, kBluetoothKeyTypeChangedCombination = 0x06, kBluetoothKeyTypeUnauthenticatedCombinationP256 = 0x07, kBluetoothKeyTypeAuthenticatedCombinationP256 = 0x08 }; // Packet types (Bluetooth spec section 7.1.5 - Create Connection) typedef uint16_t BluetoothPacketType; enum { kBluetoothPacketTypeReserved1 = 0x0001, kBluetoothPacketType2DH1Omit = 0x0002, // Masks OUT this packet type kBluetoothPacketType3DH1Omit = 0x0004, // Masks OUT this packet type kBluetoothPacketTypeDM1 = 0x0008, kBluetoothPacketTypeDH1 = 0x0010, kBluetoothPacketTypeHV1 = 0x0020, // Reserved kBluetoothPacketTypeHV2 = 0x0040, // Reserved kBluetoothPacketTypeHV3 = 0x0080, // Reserved kBluetoothPacketTypeDV = 0x0100, // Reserved kBluetoothPacketType2DH3Omit = 0x0100, // Masks OUT this packet type kBluetoothPacketType3DH3Omit = 0x0200, // Masks OUT this packet type kBluetoothPacketTypeAUX = 0x0200, // Deprecated kBluetoothPacketTypeDM3 = 0x0400, kBluetoothPacketTypeDH3 = 0x0800, kBluetoothPacketType2DH5Omit = 0x1000, // Masks OUT this packet type kBluetoothPacketType3DM5Omit = 0x2000, // Masks OUT this packet type kBluetoothPacketTypeDM5 = 0x4000, kBluetoothPacketTypeDH5 = 0x8000, kBluetoothPacketTypeEnd }; // Setup Synchronous Packet types (Bluetooth 2.1 spec section 7.1.26 - Setup Synchronous Command) enum { kBluetoothSynchronousConnectionPacketTypeNone = 0x0000, kBluetoothSynchronousConnectionPacketTypeHV1 = 0x0001, kBluetoothSynchronousConnectionPacketTypeHV2 = 0x0002, kBluetoothSynchronousConnectionPacketTypeHV3 = 0x0004, kBluetoothSynchronousConnectionPacketTypeEV3 = 0x0008, kBluetoothSynchronousConnectionPacketTypeEV4 = 0x0010, kBluetoothSynchronousConnectionPacketTypeEV5 = 0x0020, // masking out certain types: kBluetoothSynchronousConnectionPacketType2EV3Omit = 0x0040, kBluetoothSynchronousConnectionPacketType3EV3Omit = 0x0080, kBluetoothSynchronousConnectionPacketType2EV5Omit = 0x0100, kBluetoothSynchronousConnectionPacketType3EV5Omit = 0x0200, kBluetoothSynchronousConnectionPacketTypeFutureUse = 0xFC00, kBluetoothSynchronousConnectionPacketTypeAll = 0xFFFF, kBluetoothSynchronousConnectionPacketTypeEnd }; // LAP/Inquiry Access Codes typedef uint32_t BluetoothLAP; enum { kBluetoothGeneralInquiryAccessCodeIndex = 0, // General/Unlimited Inquiry Access Code (GIAC) kBluetoothGeneralInquiryAccessCodeLAPValue = 0x9E8B33, // General/Unlimited Inquiry Access Code (GIAC) kBluetoothLimitedInquiryAccessCodeIndex = 1, // Limited Dedicated Inquiry Access Code (LIAC) kBluetoothLimitedInquiryAccessCodeLAPValue = 0x9E8B00, // Limited Dedicated Inquiry Access Code (LIAC) // All other access codes are reserved for future use (indices 2-63, LAP values 0x9E8B01-0x9E8B32 and 0x9E8B34-0x9E8B3F). kBluetoothLimitedInquiryAccessCodeEnd }; // PageScanRepetitionMode typedef uint8_t BluetoothPageScanRepetitionMode; enum { kBluetoothPageScanRepetitionModeR0 = 0x00, kBluetoothPageScanRepetitionModeR1 = 0x01, kBluetoothPageScanRepetitionModeR2 = 0x02 // All other values are reserved for future use. }; // PageScanPeriodMode typedef uint8_t BluetoothPageScanPeriodMode; enum { kBluetoothPageScanPeriodModeP0 = 0x00, kBluetoothPageScanPeriodModeP1 = 0x01, kBluetoothPageScanPeriodModeP2 = 0x02 // All other values are reserved for future use. }; // PageScanMode typedef uint8_t BluetoothPageScanMode; enum { kBluetoothPageScanModeMandatory = 0x00, kBluetoothPageScanModeOptional1 = 0x01, kBluetoothPageScanModeOptional2 = 0x02, kBluetoothPageScanModeOptional3 = 0x03 // All other values are reserved for future use. }; // PageScanType typedef uint8_t BluetoothHCIPageScanType; enum BluetoothHCIPageScanTypes { kBluetoothHCIPageScanTypeStandard = 0x00, kBluetoothHCIPageScanTypeInterlaced = 0x01, kBluetoothHCIPageScanTypeReservedStart = 0x02, kBluetoothHCIPageScanTypeReservedEnd = 0xFF }; // Erroneous Data Reporting typedef uint8_t BluetoothHCIErroneousDataReporting; enum { kBluetoothHCIErroneousDataReportingDisabled = 0x00, kBluetoothHCIErroneousDataReportingEnabled = 0x01, kBluetoothHCIErroneousDataReportingReservedStart = 0x02, kBluetoothHCIErroneousDataReportingReservedEnd = 0xFF }; #if 0 #pragma mark - #pragma mark === Devices === #endif typedef struct BluetoothDeviceAddress BluetoothDeviceAddress; struct BluetoothDeviceAddress { uint8_t data[ 6 ]; }; typedef struct BluetoothKey BluetoothKey; struct BluetoothKey { uint8_t data[ 16 ]; }; typedef struct BluetoothIRK BluetoothIRK; struct BluetoothIRK { uint8_t data[ 16 ]; }; typedef struct BluetoothPINCode BluetoothPINCode; struct BluetoothPINCode { uint8_t data[ 16 ]; // PIN codes may be up to 128 bits. }; // Physical layout of the "class of device/service" field (see Bluetooth Assigned Numbers section 1.2): // // 2 2 2 2 1 1 1 1 1 1 1 1 1 1 // 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 <- Bit Transmission Order // +---------------+---------------+---------------+ // | octet 3 | octet 2 | octet 1 | <- Octet Transmission Order // +---------------+---------------+---------------+ // <------ 11 bits ----->< 5 bits ><- 6 bits -> // +---------------------+---------+-----------+-+-+ // | Service Classes | Major | Minor | | | // +-+-+-+-+-+-+-+-+-+-+-+ Device | Device |0|0| // | | | | | | | |*|*|*| | Class | Class | | | // +-+-+-+-+-+-+-+-+-+-+-+---------+-----------+-+-+ // | | | | | | | | | // | | | | | | | + Limited Discoverable +- Format Type // | | | | | | +- Networking // | | | | | +- Rendering // | | | | +- Capturing // | | | +- Object Transfer // | | +- Audio // | +- Telephony // +- Information typedef uint32_t BluetoothClassOfDevice; #define BluetoothGetDeviceClassMajor( inCOD ) ( ((inCOD) & 0x00001F00) >> 8 ) #define BluetoothGetDeviceClassMinor( inCOD ) ( ((inCOD) & 0x000000FC) >> 2 ) #define BluetoothGetServiceClassMajor( inCOD ) ( ((inCOD) & 0x00FFE000) >> 13 ) #define BluetoothMakeClassOfDevice( inServiceClassMajor, inDeviceClassMajor, inDeviceClassMinor ) \ ((((inServiceClassMajor) << 13) & 0x00FFE000) | (((inDeviceClassMajor) << 8) & 0x00001F00) | (((inDeviceClassMinor) << 2) & 0x000000FC)) /// /// Major Service Classes (11-bit value - bits 13-23 of Device/Service field) /// typedef uint32_t BluetoothServiceClassMajor; // Service Class Major enum in BluetoothAssignedNumbers.h /// /// Major Device Classes (5-bit value - bits 8-12 of Device/Service field) /// typedef uint32_t BluetoothDeviceClassMajor; // Device Class Major enum in BluetoothAssignedNumbers.h /// /// Minor Device Classes (6-bit value - bits 2-7 of Device/Service field) /// typedef uint32_t BluetoothDeviceClassMinor; // Device Class Minor enum in BluetoothAssignedNumbers.h // Misc Device Types enum { kBluetoothDeviceNameMaxLength = 248 }; typedef uint8_t BluetoothDeviceName[ kBluetoothDeviceNameMaxLength ]; // Max 248 bytes of UTF-8 encoded Unicode. typedef uint16_t BluetoothClockOffset; // Bits 14-0 come from bits 16-2 of CLKslav-CLKmaster. typedef uint8_t BluetoothRole; // typedef uint8_t BluetoothAllowRoleSwitch; // 0x00-0x01 valid, 0x02-0xFF reserved. enum { kBluetoothDontAllowRoleSwitch = 0x00, kBluetoothAllowRoleSwitch = 0x01 }; enum { kBluetoothRoleBecomeCentral = 0x00, kBluetoothRoleRemainPeripheral = 0x01, kBluetoothRoleBecomeMaster __attribute__ ((deprecated)) = kBluetoothRoleBecomeCentral, kBluetoothRoleRemainSlave __attribute__ ((deprecated)) = kBluetoothRoleRemainPeripheral }; typedef struct BluetoothSetEventMask BluetoothSetEventMask; struct BluetoothSetEventMask { uint8_t data[ 8 ]; }; typedef uint8_t BluetoothPINType; #if 0 #pragma mark - #pragma mark === L2CAP === #endif //=========================================================================================================================== // Logical Link Control and Adaptation Protocol (L2CAP) //=========================================================================================================================== // ACL Packet values (Bluetooth L2CAP spec section 1). enum { kBluetoothL2CAPMaxPacketSize = 65535, // Max number of data bytes in an L2CAP packet. kBluetoothACLLogicalChannelReserved = 0, // [00] Reserved for future use kBluetoothACLLogicalChannelL2CAPContinue = 1, // [01] Continuation of L2CAP packet. kBluetoothACLLogicalChannelL2CAPStart = 2, // [10] Start of L2CAP packet. kBluetoothACLLogicalChannelLMP = 3 // [11] Link Manager Protocol packet. }; // Channel Identifiers (Bluetooth L2CAP spec section 2.1). typedef uint16_t BluetoothL2CAPChannelID; enum { kBluetoothL2CAPChannelNull = 0x0000, // Illegal, should not be used kBluetoothL2CAPChannelSignalling = 0x0001, // L2CAP signalling channel kBluetoothL2CAPChannelConnectionLessData = 0x0002, // L2CAP connection less data kBluetoothL2CAPChannelAMPManagerProtocol = 0x0003, // AMP Manager Protocol kBluetoothL2CAPChannelAttributeProtocol = 0x0004, kBluetoothL2CAPChannelLESignalling = 0x0005, kBluetoothL2CAPChannelSecurityManager = 0x0006, kBluetoothL2CAPChannelBREDRSecurityManager = 0x0007, // Range 0x0008 to 0x003E reserved for future use. kBluetoothL2CAPChannelReservedStart = 0x0008, kBluetoothL2CAPChannelLEAP = 0x002A, kBluetoothL2CAPChannelLEAS = 0x002B, kBluetoothL2CAPChannelMagicPairing = 0x0030, kBluetoothL2CAPChannelMagnet = 0x003A, kBluetoothL2CAPChannelReservedEnd = 0x003E, kBluetoothL2CAPChannelAMPTestManager = 0x003F, // Range 0x0040 to 0xFFFF are dynamically allocated. kBluetoothL2CAPChannelDynamicStart = 0x0040, kBluetoothL2CAPChannelDynamicEnd = 0xffff, kBluetoothL2CAPChannelEnd = 0xffff }; typedef BluetoothL2CAPChannelID BluetoothL2CAPGroupID; // Protocol/Service Multiplexor (PSM) values (Bluetooth L2CAP spec section 5.2). typedef uint16_t BluetoothL2CAPPSM; // PSM enum in BluetoothAssignedNumbers.h // Command Codes typedef enum { kBluetoothL2CAPCommandCodeReserved = 0x00, kBluetoothL2CAPCommandCodeCommandReject = 0x01, kBluetoothL2CAPCommandCodeConnectionRequest = 0x02, kBluetoothL2CAPCommandCodeConnectionResponse = 0x03, kBluetoothL2CAPCommandCodeConfigureRequest = 0x04, kBluetoothL2CAPCommandCodeConfigureResponse = 0x05, kBluetoothL2CAPCommandCodeDisconnectionRequest = 0x06, kBluetoothL2CAPCommandCodeDisconnectionResponse = 0x07, kBluetoothL2CAPCommandCodeEchoRequest = 0x08, kBluetoothL2CAPCommandCodeEchoResponse = 0x09, kBluetoothL2CAPCommandCodeInformationRequest = 0x0A, kBluetoothL2CAPCommandCodeInformationResponse = 0x0B, kBluetoothL2CAPCommandCodeCreateChannelRequest = 0x0C, kBluetoothL2CAPCommandCodeCreateChannelResponse = 0x0D, kBluetoothL2CAPCommandCodeMoveChannelRequest = 0x0E, kBluetoothL2CAPCommandCodeMoveChannelResponse = 0x0F, kBluetoothL2CAPCommandCodeMoveChannelConfirmation = 0x10, kBluetoothL2CAPCommandCodeMoveChannelConfirmationResponse = 0x11, kBluetoothL2CAPCommandCodeConnectionParameterUpdateRequest = 0x12, kBluetoothL2CAPCommandCodeConnectionParameterUpdateResponse = 0x13, kBluetoothL2CAPCommandCodeLECreditBasedConnectionRequest = 0x14, kBluetoothL2CAPCommandCodeLECreditBasedConnectionResponse = 0x15, kBluetoothL2CAPCommandCodeLEFlowControlCredit = 0x16, } BluetoothL2CAPCommandCode; // Command Reject typedef enum { kBluetoothL2CAPCommandRejectReasonCommandNotUnderstood = 0x0000, kBluetoothL2CAPCommandRejectReasonSignallingMTUExceeded = 0x0001, kBluetoothL2CAPCommandRejectReasonInvalidCIDInRequest = 0x0002, } BluetoothL2CAPCommandRejectReason; typedef uint16_t BluetoothL2CAPMTU; typedef uint16_t BluetoothL2CAPLinkTimeout; typedef uint16_t BluetoothL2CAPFlushTimeout; enum { kBluetoothL2CAPFlushTimeoutUseExisting = 0x0000, kBluetoothL2CAPFlushTimeoutImmediate = 0x0001, kBluetoothL2CAPFlushTimeoutForever = 0xFFFF, kBluetoothL2CAPFlushTimeoutEnd }; typedef struct BluetoothL2CAPQualityOfServiceOptions BluetoothL2CAPQualityOfServiceOptions; struct BluetoothL2CAPQualityOfServiceOptions { uint8_t flags; uint8_t serviceType; uint32_t tokenRate; uint32_t tokenBucketSize; uint32_t peakBandwidth; uint32_t latency; uint32_t delayVariation; }; typedef struct BluetoothL2CAPRetransmissionAndFlowControlOptions BluetoothL2CAPRetransmissionAndFlowControlOptions; struct BluetoothL2CAPRetransmissionAndFlowControlOptions { uint8_t flags; uint8_t txWindowSize; uint8_t maxTransmit; uint16_t retransmissionTimeout; uint16_t monitorTimeout; uint16_t maxPDUPayloadSize; }; typedef enum BluetoothL2CAPSegmentationAndReassembly { kBluetoothL2CAPSegmentationAndReassemblyUnsegmentedSDU = 0x00, kBluetoothL2CAPSegmentationAndReassemblyStartOfSDU = 0x01, kBluetoothL2CAPSegmentationAndReassemblyEndOfSDU = 0x02, kBluetoothL2CAPSegmentationAndReassemblyContinuationOfSDU = 0x03 } BluetoothL2CAPSegmentationAndReassembly; enum { kBluetoothL2CAPInfoTypeMaxConnectionlessMTUSize = 0x0001 }; // Packets enum { kBluetoothL2CAPPacketHeaderSize = 4 }; typedef uint16_t BluetoothL2CAPByteCount; typedef uint8_t BluetoothL2CAPCommandID; typedef uint16_t BluetoothL2CAPCommandByteCount; typedef enum { kBluetoothL2CAPConnectionResultSuccessful = 0x0000, kBluetoothL2CAPConnectionResultPending = 0x0001, kBluetoothL2CAPConnectionResultRefusedPSMNotSupported = 0x0002, kBluetoothL2CAPConnectionResultRefusedSecurityBlock = 0x0003, kBluetoothL2CAPConnectionResultRefusedNoResources = 0x0004, kBluetoothL2CAPConnectionResultRefusedReserved = 0x0005, kBluetoothL2CAPConnectionResultRefusedInvalidSourceCID = 0x0006, kBluetoothL2CAPConnectionResultRefusedSourceCIDAlreadyAllocated = 0x0007 } BluetoothL2CAPConnectionResult; typedef enum { kBluetoothL2CAPConnectionStatusNoInfoAvailable = 0x0000, kBluetoothL2CAPConnectionStatusAuthenticationPending = 0x0001, kBluetoothL2CAPConnectionStatusAuthorizationPending = 0x0002, } BluetoothL2CAPConnectionStatus; typedef enum { kBluetoothL2CAPConfigurationResultSuccess = 0x0000, kBluetoothL2CAPConfigurationResultUnacceptableParams = 0x0001, kBluetoothL2CAPConfigurationResultRejected = 0x0002, kBluetoothL2CAPConfigurationResultUnknownOptions = 0x0003, } BluetoothL2CAPConfigurationResult; typedef enum { kBluetoothL2CAPConfigurationOptionMTU = 0x01, kBluetoothL2CAPConfigurationOptionFlushTimeout = 0x02, kBluetoothL2CAPConfigurationOptionQoS = 0x03, kBluetoothL2CAPConfigurationOptionRetransmissionAndFlowControl = 0x04, kBluetoothL2CAPConfigurationOptionFrameCheckSequence = 0x05, kBluetoothL2CAPConfigurationOptionExtendedFlowSpecification = 0x06, kBluetoothL2CAPConfigurationOptionExtendedWindowSize = 0x07 } BluetoothL2CAPConfigurationOption; enum { kBluetoothL2CAPConfigurationOptionMTULength = 2, kBluetoothL2CAPConfigurationOptionFlushTimeoutLength = 2, kBluetoothL2CAPConfigurationOptionQoSLength = 22, kBluetoothL2CAPConfigurationOptionRetransmissionAndFlowControlLength = 9 }; typedef enum { kBluetoothL2CAPConfigurationBasicL2CAPModeFlag = 0x00, kBluetoothL2CAPConfigurationRetransmissionModeFlag = 0x01, kBluetoothL2CAPConfigurationFlowControlModeFlag = 0x02, kBluetoothL2CAPConfigurationEnhancedRetransmissionMode = 0x03, kBluetoothL2CAPConfigurationStreamingMode = 0x04 } BluetoothL2CAPConfigurationRetransmissionAndFlowControlFlags; typedef enum { kBluetoothL2CAPInformationTypeConnectionlessMTU = 0x0001, kBluetoothL2CAPInformationTypeExtendedFeatures = 0x0002, kBluetoothL2CAPInformationTypeFixedChannelsSupported = 0x0003, } BluetoothL2CAPInformationType; typedef enum { kBluetoothL2CAPInformationResultSuccess = 0x0000, kBluetoothL2CAPInformationResultNotSupported = 0x0001, } BluetoothL2CAPInformationResult; typedef enum { kBluetoothL2CAPInformationNoExtendedFeatures = 0x00000000, kBluetoothL2CAPInformationFlowControlMode = 0x00000001, kBluetoothL2CAPInformationRetransmissionMode = 0x00000002, kBluetoothL2CAPInformationBidirectionalQoS = 0x00000004, kBluetoothL2CAPInformationEnhancedRetransmissionMode = 0x00000008, kBluetoothL2CAPInformationStreamingMode = 0x00000010, kBluetoothL2CAPInformationFCSOption = 0x00000020, kBluetoothL2CAPInformationExtendedFlowSpecification = 0x00000040, kBluetoothL2CAPInformationFixedChannels = 0x00000080, kBluetoothL2CAPInformationExtendedWindowSize = 0x00000100, kBluetoothL2CAPUnicastConnectionlessDataReception = 0x00000200, } BluetoothL2CAPInformationExtendedFeaturesMask; typedef enum { kBluetoothL2CAPQoSTypeNoTraffic = 0x00, kBluetoothL2CAPQoSTypeBestEffort = 0x01, kBluetoothL2CAPQoSTypeGuaranteed = 0x02, } BluetoothL2CAPQoSType; typedef enum { kBluetoothL2CAPSupervisoryFuctionTypeReceiverReady = 0x0, kBluetoothL2CAPSupervisoryFuctionTypeReject = 0x1, kBluetoothL2CAPSupervisoryFuctionTypeReceiverNotReady = 0x2, kBluetoothL2CAPSupervisoryFuctionTypeSelectiveReject = 0x3 } BluetoothL2CAPSupervisoryFuctionType; enum { kBluetoothLETXTimeMin = 0x0148, // 328 us / 41 octets / 27 (0x1B) byte PDU kBluetoothLETXTimeDefault = 0x0148, // 328 us kBluetoothLETXTimeMax = 0x0848, // 2120 us / 265 octets / 251 (0xFB) byte PDU kBluetoothLETXOctetsMin = 0x001b, // 27 bytes pre-LE DPLE size kBluetoothLETXOctetsDefault = 0x001b, // 27 bytes kBluetoothLETXOctetsMax = 0x00fb, // 251 bytes 4.2 LE DPLE feature }; enum { // kBluetoothL2CAPMTULowEnergyDefault = 0x0080, // 128 bytes - DPLE feature kBluetoothL2CAPMTULowEnergyDefault = kBluetoothLETXOctetsMin, // 27 bytes kBluetoothL2CAPMTULowEnergyMax = kBluetoothLETXOctetsMax, // 251 bytes kBluetoothL2CAPMTUMinimum = 0x0030, // 48 bytes kBluetoothL2CAPMTUDefault = 0x03F9, // 11.10.08 - dropped back to 1017 from 1021 (don't aggravate the 3DH5 problem between CSR<->BRCM just yet) kBluetoothL2CAPMTUMaximum = 0xffff, kBluetoothL2CAPMTUStart = 0x7fff, kBluetoothL2CAPMTUSIG = 0x0030, // 48 bytes kBluetoothL2CAPFlushTimeoutDefault = kBluetoothL2CAPFlushTimeoutForever, // 0xffff kBluetoothL2CAPQoSFlagsDefault = 0, kBluetoothL2CAPQoSTypeDefault = kBluetoothL2CAPQoSTypeBestEffort, // 0x01 kBluetoothL2CAPQoSTokenRateDefault = 0x00000000, kBluetoothL2CAPQoSTokenBucketSizeDefault = 0x00000000, kBluetoothL2CAPQoSPeakBandwidthDefault = 0x00000000, kBluetoothL2CAPQoSLatencyDefault = 0xffffffff, kBluetoothL2CAPQoSDelayVariationDefault = 0xffffffff }; enum { kBluetoothLEMaxTXTimeMin = 0x0148, kBluetoothLEMaxTXTimeDefault = kBluetoothL2CAPMTULowEnergyDefault, kBluetoothLEMaxTXTimeMax = 0x0848, kBluetoothLEMaxTXOctetsMin = 0x001b, // 27 bytes kBluetoothLEMaxTXOctetsDefault = 0x0080, // 128 bytes - DPLE feature kBluetoothLEMaxTXOctetsMax = 0x00fb, // 251 bytes - DPLE feature }; #pragma mark === LE Security Manager === #define kBluetoothLESMPTimeout 30 #define kBluetoothLESMPMinEncryptionKeySize 7 #define kBluetoothLESMPMaxEncryptionKeySize 16 enum BluetoothLESecurityManagerKeyDistributionFormat { kBluetoothLESecurityManagerEncryptionKey = (1 << 0L), // LTK, EDIV, RAND kBluetoothLESecurityManagerIDKey = (1 << 1L), // IRK kBluetoothLESecurityManagerSignKey = (1 << 2L), // CSRK kBluetoothLESecurityManagerLinkKey = (1 << 3L), // LinkKey }; typedef enum { kBluetoothLESecurityManagerCommandCodeReserved = 0x00, kBluetoothLESecurityManagerCommandCodePairingRequest = 0x01, kBluetoothLESecurityManagerCommandCodePairingResponse = 0x02, kBluetoothLESecurityManagerCommandCodePairingConfirm = 0x03, kBluetoothLESecurityManagerCommandCodePairingRandom = 0x04, kBluetoothLESecurityManagerCommandCodePairingFailed = 0x05, kBluetoothLESecurityManagerCommandCodeEncryptionInfo = 0x06, kBluetoothLESecurityManagerCommandCodeMasterIdentification = 0x07, kBluetoothLESecurityManagerCommandCodeIdentityInfo = 0x08, kBluetoothLESecurityManagerCommandCodeIdentityAddressInfo = 0x09, kBluetoothLESecurityManagerCommandCodeSigningInfo = 0x0A, kBluetoothLESecurityManagerCommandCodeSecurityRequest = 0x0B, kBluetoothLESecurityManagerCommandCodePairingPublicKey = 0x0C, kBluetoothLESecurityManagerCommandCodePairingDHKeyCheck = 0x0D, kBluetoothLESecurityManagerCommandCodePairingKeypressNotification = 0x0E, // 0x0C - 0xFF reserved kBluetoothLESecurityManagerCommandCodeReservedStart = 0x0F, kBluetoothLESecurityManagerCommandCodeReservedEnd = 0xFF } BluetoothLESecurityManagerCommandCode; typedef enum { kBluetoothLESecurityManagerUserInputCapabilityNoInput = 0x01, kBluetoothLESecurityManagerUserInputCapabilityYesNo = 0x02, kBluetoothLESecurityManagerUserInputCapabilityKeyboard = 0x03 } BluetoothLESecurityManagerUserInputCapability; typedef enum { kBluetoothLESecurityManagerUserOutputCapabilityNoOutput = 0x01, kBluetoothLESecurityManagerUserOutputCapabilityNumericOutput = 0x02 } BluetoothLESecurityManagerUserOutputCapability; typedef enum { kBluetoothLESecurityManagerIOCapabilityDisplayOnly = 0x00, kBluetoothLESecurityManagerIOCapabilityDisplayYesNo = 0x01, kBluetoothLESecurityManagerIOCapabilityKeyboardOnly = 0x02, kBluetoothLESecurityManagerIOCapabilityNoInputNoOutput = 0x03, kBluetoothLESecurityManagerIOCapabilityKeyboardDisplay = 0x04, // 0x05 - 0xFF reserved kBluetoothLESecurityManagerIOCapabilityReservedStart = 0x05, kBluetoothLESecurityManagerIOCapabilityReservedEnd = 0xFF } BluetoothLESecurityManagerIOCapability; typedef enum { kBluetoothLESecurityManagerOOBAuthenticationDataNotPresent = 0x00, kBluetoothLESecurityManagerOOBAuthenticationDataPresent = 0x01, // 0x02 - 0xFF reserved kBluetoothLESecurityManagerOOBDataReservedStart = 0x02, kBluetoothLESecurityManagerOOBDataReservedEnd = 0xFF, } BluetoothLESecurityManagerOOBData; enum { kBluetoothLESecurityManagerNoBonding = 0, // [00] kBluetoothLESecurityManagerBonding = 1, // [01] kBluetoothLESecurityManagerReservedStart = 2, // [10] kBluetoothLESecurityManagerReservedEnd = 3 // [11] }; typedef enum { kBluetoothLESecurityManagerReasonCodeReserved = 0x00, kBluetoothLESecurityManagerReasonCodePasskeyEntryFailed = 0x01, kBluetoothLESecurityManagerReasonCodeOOBNotAvailbale = 0x02, kBluetoothLESecurityManagerReasonCodeAuthenticationRequirements = 0x03, kBluetoothLESecurityManagerReasonCodeConfirmValueFailed = 0x04, kBluetoothLESecurityManagerReasonCodePairingNotSupported = 0x05, kBluetoothLESecurityManagerReasonCodeEncryptionKeySize = 0x06, kBluetoothLESecurityManagerReasonCodeCommandNotSupported = 0x07, kBluetoothLESecurityManagerReasonCodeUnspecifiedReason = 0x08, kBluetoothLESecurityManagerReasonCodeRepeatedAttempts = 0x09, kBluetoothLESecurityManagerReasonCodeInvalidParameters = 0x0A, kBluetoothLESecurityManagerReasonCodeDHKeyCheckFailed = 0x0B, kBluetoothLESecurityManagerReasonCodeNumericComparisonFailed = 0x0C, kBluetoothLESecurityManagerReasonCodeBREDRPairingInProgress = 0x0D, kBluetoothLESecurityManagerReasonCodeCrossTransportKeyDerivationGenerationNotAllowed = 0x0E, kBluetoothLESecurityManagerReasonCodeReservedStart = 0x0F, kBluetoothLESecurityManagerReasonCodeReservedEnd = 0xFF } BluetoothLESecurityManagerPairingFailedReasonCode; typedef enum { kBluetoothLESecurityManagerNotificationTypePasskeyEntryStarted = 0, kBluetoothLESecurityManagerNotificationTypePasskeyDigitEntered = 1, kBluetoothLESecurityManagerNotificationTypePasskeyDigitErased = 2, kBluetoothLESecurityManagerNotificationTypePasskeyCleared = 3, kBluetoothLESecurityManagerNotificationTypePasskeyEntryCompleted = 4, kBluetoothLESecurityManagerNotificationTypeReservedStart = 5, kBluetoothLESecurityManagerNotificationTypeReservedEnd = 255, } BluetoothLESecurityManagerKeypressNotificationType; #pragma mark === AMP Manager === typedef enum { kBluetoothAMPManagerCodeReserved = 0x00, kBluetoothAMPManagerCodeAMPCommandReject = 0x01, kBluetoothAMPManagerCodeAMPDiscoverRequest = 0x02, kBluetoothAMPManagerCodeAMPDiscoverResponse = 0x03, kBluetoothAMPManagerCodeAMPChangeNotify = 0x04, kBluetoothAMPManagerCodeAMPChangeResponse = 0x05, kBluetoothAMPManagerCodeAMPGetInfoRequest = 0x06, kBluetoothAMPManagerCodeAMPGetInfoResponse = 0x07, kBluetoothAMPManagerCodeAMPGetAssocRequest = 0x08, kBluetoothAMPManagerCodeAMPGetAssocResponse = 0x09, kBluetoothAMPManagerCodeAMPCreatePhysicalLinkRequest = 0x0A, kBluetoothAMPManagerCodeAMPCreatePhysicalLinkResponse = 0x0B, kBluetoothAMPManagerCodeAMPDisconnectPhysicalLinkRequest = 0x0C, kBluetoothAMPManagerCodeAMPDisconnectPhysicalLinkResponse = 0x0D, } BluetoothAMPManagerCode; typedef enum { kBluetoothAMPManagerCommandRejectReasonCommandNotRecognized = 0x0000, } BluetoothAMPCommandRejectReason; typedef enum { kBluetoothAMPManagerDiscoverResponseControllerStatusPoweredDown = 0x00, kBluetoothAMPManagerDiscoverResponseControllerStatusBluetoothOnly = 0x01, kBluetoothAMPManagerDiscoverResponseControllerStatusNoCapacity = 0x02, kBluetoothAMPManagerDiscoverResponseControllerStatusLowCapacity = 0x03, kBluetoothAMPManagerDiscoverResponseControllerStatusMediumCapacity = 0x04, kBluetoothAMPManagerDiscoverResponseControllerStatusHighCapacity = 0x05, kBluetoothAMPManagerDiscoverResponseControllerStatusFullCapacity = 0x06, } BluetoothAMPDiscoverResponseControllerStatus; typedef enum { kBluetoothAMPManagerGetInfoResponseSuccess = 0x00, kBluetoothAMPManagerGetInfoResponseInvalidControllerID = 0x01, } BluetoothAMPGetInfoResponseStatus; typedef enum { kBluetoothAMPManagerGetAssocResponseSuccess = 0x00, kBluetoothAMPManagerGetAssocResponseInvalidControllerID = 0x01, } BluetoothAMPGetAssocResponseStatus; typedef enum { kBluetoothAMPManagerCreatePhysicalLinkResponseSuccess = 0x00, kBluetoothAMPManagerCreatePhysicalLinkResponseInvalidControllerID = 0x01, kBluetoothAMPManagerCreatePhysicalLinkResponseUnableToStartLinkCreation = 0x02, kBluetoothAMPManagerCreatePhysicalLinkResponseCollisionOccurred = 0x03, kBluetoothAMPManagerCreatePhysicalLinkResponseAMPDisconnectedPhysicalLinkRequestReceived = 0x04, kBluetoothAMPManagerCreatePhysicalLinkResponsePhysicalLinkAlreadyExists = 0x05, kBluetoothAMPManagerCreatePhysicalLinkResponseSecurityViolation = 0x06, } BluetoothAMPCreatePhysicalLinkResponseStatus; typedef enum { kBluetoothAMPManagerDisconnectPhysicalLinkResponseSuccess = 0x00, kBluetoothAMPManagerDisconnectPhysicalLinkResponseInvalidControllerID = 0x01, kBluetoothAMPManagerDisconnectPhysicalLinkResponseNoPhysicalLink = 0x02, } BluetoothAMPDisconnectPhysicalLinkResponseStatus; #if 0 #pragma mark - #pragma mark === HCI === #endif //=========================================================================================================================== // Host Controller Interface (HCI) //=========================================================================================================================== // HCI Command Packet // ------------------ // // 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // +--------------------------------+---------------+--------------+ // | OpCode | | | // +--------------------+-----------| Param Length | Params... | // | OCF | OGF | | | // +--------------------+-----------+---------------+--------------+ // | | // | Params... | // | | // +---------------------------------------------------------------+ // Commands typedef uint8_t BluetoothHCICommandOpCodeGroup; typedef uint16_t BluetoothHCICommandOpCodeCommand; typedef uint16_t BluetoothHCICommandOpCode; typedef uint32_t BluetoothHCIVendorCommandSelector; #define BluetoothHCIMakeCommandOpCode( GROUP, CMD ) ( ( ( ( GROUP ) & 0x003F ) << 10 ) | ( ( CMD ) & 0x03FF ) ) #define BluetoothHCIMakeCommandOpCodeEndianSwap( GROUP, CMD ) ( CFSwapInt16HostToLittle ( BluetoothHCIMakeCommandOpCode( GROUP, CMD ) ) ) #define BluetoothHCIExtractCommandOpCodeGroup( OPCODE ) ( ( ( OPCODE ) >> 10 ) & 0x003F ) #define BluetoothHCIExtractCommandOpCodeCommand( OPCODE ) ( ( OPCODE ) & 0x03FF ) #define BluetoothHCIMakeCommandOpCodeHostOrder(GROUP, CMD ) OSSwapLittleToHostConstInt16( ( ( ( GROUP ) & 0x003F ) << 10 ) | ( ( CMD ) & 0x03FF ) ) enum { // Command Group: NoOp kBluetoothHCIOpCodeNoOp = 0, kBluetoothHCICommandGroupNoOp = 0x00, kBluetoothHCICommandNoOp = 0x0000, // Command Group: Link Control kBluetoothHCICommandGroupLinkControl = 0x01, kBluetoothHCICommandInquiry = 0x0001, kBluetoothHCICommandInquiryCancel = 0x0002, kBluetoothHCICommandPeriodicInquiryMode = 0x0003, kBluetoothHCICommandExitPeriodicInquiryMode = 0x0004, kBluetoothHCICommandCreateConnection = 0x0005, kBluetoothHCICommandDisconnect = 0x0006, kBluetoothHCICommandAddSCOConnection = 0x0007, // DEPRECATED kBluetoothHCICommandCreateConnectionCancel = 0x0008, kBluetoothHCICommandAcceptConnectionRequest = 0x0009, kBluetoothHCICommandRejectConnectionRequest = 0x000A, kBluetoothHCICommandLinkKeyRequestReply = 0x000B, kBluetoothHCICommandLinkKeyRequestNegativeReply = 0x000C, kBluetoothHCICommandPINCodeRequestReply = 0x000D, kBluetoothHCICommandPINCodeRequestNegativeReply = 0x000E, kBluetoothHCICommandChangeConnectionPacketType = 0x000F, kBluetoothHCICommandAuthenticationRequested = 0x0011, kBluetoothHCICommandSetConnectionEncryption = 0x0013, kBluetoothHCICommandChangeConnectionLinkKey = 0x0015, kBluetoothHCICommandMasterLinkKey = 0x0017, kBluetoothHCICommandRemoteNameRequest = 0x0019, kBluetoothHCICommandReadRemoteSupportedFeatures = 0x001B, kBluetoothHCICommandReadRemoteExtendedFeatures = 0x001C, kBluetoothHCICommandReadRemoteVersionInformation = 0x001D, kBluetoothHCICommandReadClockOffset = 0x001F, kBluetoothHCICommandRemoteNameRequestCancel = 0x001A, kBluetoothHCICommandReadLMPHandle = 0x0020, kBluetoothHCICommandSetupSynchronousConnection = 0x0028, kBluetoothHCICommandAcceptSynchronousConnectionRequest = 0x0029, kBluetoothHCICommandRejectSynchronousConnectionRequest = 0x002A, kBluetoothHCICommandIOCapabilityRequestReply = 0x002B, kBluetoothHCICommandUserConfirmationRequestReply = 0x002C, kBluetoothHCICommandUserConfirmationRequestNegativeReply = 0x002D, kBluetoothHCICommandUserPasskeyRequestReply = 0x002E, kBluetoothHCICommandUserPasskeyRequestNegativeReply = 0x002F, kBluetoothHCICommandRemoteOOBDataRequestReply = 0x0030, kBluetoothHCICommandRemoteOOBDataRequestNegativeReply = 0x0033, kBluetoothHCICommandIOCapabilityRequestNegativeReply = 0x0034, kBluetoothHCICommandEnhancedSetupSynchronousConnection = 0x003D, kBluetoothHCICommandEnhancedAcceptSynchronousConnectionRequest = 0x003E, kBluetoothHCICommandTruncatedPage = 0x003F, kBluetoothHCICommandTruncatedPageCancel = 0x0040, kBluetoothHCICommandSetConnectionlessPeripheralBroadcast = 0x0041, kBluetoothHCICommandSetConnectionlessPeripheralBroadcastReceive = 0x0042, kBluetoothHCICommandStartSynchronizationTrain = 0x0043, kBluetoothHCICommandReceiveSynchronizationTrain = 0x0044, kBluetoothHCICommandRemoteOOBExtendedDataRequestReply = 0x0045, kBluetoothHCICommandSetConnectionlessSlaveBroadcast __attribute__ ((deprecated)) = kBluetoothHCICommandSetConnectionlessPeripheralBroadcast, kBluetoothHCICommandSetConnectionlessSlaveBroadcastReceive __attribute__ ((deprecated)) = kBluetoothHCICommandSetConnectionlessPeripheralBroadcastReceive, // Command Group: Link Policy kBluetoothHCICommandGroupLinkPolicy = 0x02, kBluetoothHCICommandHoldMode = 0x0001, kBluetoothHCICommandSniffMode = 0x0003, kBluetoothHCICommandExitSniffMode = 0x0004, kBluetoothHCICommandParkMode = 0x0005, kBluetoothHCICommandExitParkMode = 0x0006, kBluetoothHCICommandQoSSetup = 0x0007, kBluetoothHCICommandRoleDiscovery = 0x0009, kBluetoothHCICommandSwitchRole = 0x000B, kBluetoothHCICommandReadLinkPolicySettings = 0x000C, kBluetoothHCICommandWriteLinkPolicySettings = 0x000D, kBluetoothHCICommandReadDefaultLinkPolicySettings = 0x000E, kBluetoothHCICommandWriteDefaultLinkPolicySettings = 0x000F, kBluetoothHCICommandFlowSpecification = 0x0010, kBluetoothHCICommandSniffSubrating = 0x0011, kBluetoothHCICommandAcceptSniffRequest = 0x0031, kBluetoothHCICommandRejectSniffRequest = 0x0032, // Command Group: Host Controller & Baseband kBluetoothHCICommandGroupHostController = 0x03, kBluetoothHCICommandSetEventMask = 0x0001, kBluetoothHCICommandReset = 0x0003, kBluetoothHCICommandSetEventFilter = 0x0005, kBluetoothHCICommandFlush = 0x0008, kBluetoothHCICommandReadPINType = 0x0009, kBluetoothHCICommandWritePINType = 0x000A, kBluetoothHCICommandCreateNewUnitKey = 0x000B, kBluetoothHCICommandReadStoredLinkKey = 0x000D, kBluetoothHCICommandWriteStoredLinkKey = 0x0011, kBluetoothHCICommandDeleteStoredLinkKey = 0x0012, kBluetoothHCICommandChangeLocalName = 0x0013, kBluetoothHCICommandReadLocalName = 0x0014, kBluetoothHCICommandReadConnectionAcceptTimeout = 0x0015, kBluetoothHCICommandWriteConnectionAcceptTimeout = 0x0016, kBluetoothHCICommandReadPageTimeout = 0x0017, kBluetoothHCICommandWritePageTimeout = 0x0018, kBluetoothHCICommandReadScanEnable = 0x0019, kBluetoothHCICommandWriteScanEnable = 0x001A, kBluetoothHCICommandReadPageScanActivity = 0x001B, kBluetoothHCICommandWritePageScanActivity = 0x001C, kBluetoothHCICommandReadInquiryScanActivity = 0x001D, kBluetoothHCICommandWriteInquiryScanActivity = 0x001E, kBluetoothHCICommandReadAuthenticationEnable = 0x001F, kBluetoothHCICommandWriteAuthenticationEnable = 0x0020, kBluetoothHCICommandReadEncryptionMode = 0x0021, // DEPRECATED kBluetoothHCICommandWriteEncryptionMode = 0x0022, // DEPRECATED kBluetoothHCICommandReadClassOfDevice = 0x0023, kBluetoothHCICommandWriteClassOfDevice = 0x0024, kBluetoothHCICommandReadVoiceSetting = 0x0025, kBluetoothHCICommandWriteVoiceSetting = 0x0026, kBluetoothHCICommandReadAutomaticFlushTimeout = 0x0027, kBluetoothHCICommandWriteAutomaticFlushTimeout = 0x0028, kBluetoothHCICommandReadNumberOfBroadcastRetransmissions = 0x0029, kBluetoothHCICommandWriteNumberOfBroadcastRetransmissions = 0x002A, kBluetoothHCICommandReadHoldModeActivity = 0x002B, kBluetoothHCICommandWriteHoldModeActivity = 0x002C, kBluetoothHCICommandReadTransmitPowerLevel = 0x002D, kBluetoothHCICommandReadSCOFlowControlEnable = 0x002E, kBluetoothHCICommandWriteSCOFlowControlEnable = 0x002F, kBluetoothHCICommandSetHostControllerToHostFlowControl = 0x0031, kBluetoothHCICommandHostBufferSize = 0x0033, kBluetoothHCICommandHostNumberOfCompletedPackets = 0x0035, kBluetoothHCICommandReadLinkSupervisionTimeout = 0x0036, kBluetoothHCICommandWriteLinkSupervisionTimeout = 0x0037, kBluetoothHCICommandReadNumberOfSupportedIAC = 0x0038, kBluetoothHCICommandReadCurrentIACLAP = 0x0039, kBluetoothHCICommandWriteCurrentIACLAP = 0x003A, kBluetoothHCICommandReadPageScanPeriodMode = 0x003B, // DEPRECATED kBluetoothHCICommandWritePageScanPeriodMode = 0x003C, // DEPRECATED kBluetoothHCICommandReadPageScanMode = 0x003D, // DEPRECATED kBluetoothHCICommandWritePageScanMode = 0x003E, // DEPRECATED kBluetoothHCICommandSetAFHClassification = 0x003F, kBluetoothHCICommandReadInquiryScanType = 0x0042, kBluetoothHCICommandWriteInquiryScanType = 0x0043, kBluetoothHCICommandReadInquiryMode = 0x0044, kBluetoothHCICommandWriteInquiryMode = 0x0045, kBluetoothHCICommandReadPageScanType = 0x0046, kBluetoothHCICommandWritePageScanType = 0x0047, kBluetoothHCICommandReadAFHChannelAssessmentMode = 0x0048, kBluetoothHCICommandWriteAFHChannelAssessmentMode = 0x0049, kBluetoothHCICommandReadExtendedInquiryResponse = 0x0051, kBluetoothHCICommandWriteExtendedInquiryResponse = 0x0052, kBluetoothHCICommandRefreshEncryptionKey = 0x0053, kBluetoothHCICommandReadSimplePairingMode = 0x0055, kBluetoothHCICommandWriteSimplePairingMode = 0x0056, kBluetoothHCICommandReadLocalOOBData = 0x0057, kBluetoothHCICommandReadInquiryResponseTransmitPower = 0x0058, kBluetoothHCICommandWriteInquiryResponseTransmitPower = 0x0059, kBluetoothHCICommandSendKeypressNotification = 0x0060, kBluetoothHCICommandReadDefaultErroneousDataReporting = 0x005A, kBluetoothHCICommandWriteDefaultErroneousDataReporting = 0x005B, kBluetoothHCICommandEnhancedFlush = 0x005F, kBluetoothHCICommandReadLogicalLinkAcceptTimeout = 0x0061, kBluetoothHCICommandWriteLogicalLinkAcceptTimeout = 0x0062, kBluetoothHCICommandSetEventMaskPageTwo = 0x0063, kBluetoothHCICommandReadLocationData = 0x0064, kBluetoothHCICommandWriteLocationData = 0x0065, kBluetoothHCICommandReadFlowControlMode = 0x0066, kBluetoothHCICommandWriteFlowControlMode = 0x0067, kBluetoothHCICommandReadEnhancedTransmitPowerLevel = 0x0068, kBluetoothHCICommandReadBestEffortFlushTimeout = 0x0069, kBluetoothHCICommandWriteBestEffortFlushTimeout = 0x006A, kBluetoothHCICommandShortRangeMode = 0x006B, kBluetoothHCICommandReadLEHostSupported = 0x006C, kBluetoothHCICommandWriteLEHostSupported = 0x006D, kBluetoothHCICommandSetMWSChannelParameters = 0x006E, kBluetoothHCICommandSetExternalFrameConfiguration = 0x006F, kBluetoothHCICommandSetMWSSignaling = 0x0070, kBluetoothHCICommandSetMWSTransportLayer = 0x0071, kBluetoothHCICommandSetMWSScanFrequencyTable = 0x0072, kBluetoothHCICommandSetMWSPATTERNConfiguration = 0x0073, kBluetoothHCICommandSetReservedLTADDR = 0x0074, kBluetoothHCICommandDeleteReservedLTADDR = 0x0075, kBluetoothHCICommandSetConnectionlessPeripheralBroadcastData = 0x0076, kBluetoothHCICommandReadSynchronizationTrainParameters = 0x0077, kBluetoothHCICommandWriteSynchronizationTrainParameters = 0x0078, kBluetoothHCICommandReadSecureConnectionsHostSupport = 0x0079, kBluetoothHCICommandWriteSecureConnectionsHostSupport = 0x007A, kBluetoothHCICommandReadAuthenticatedPayloadTimeout = 0x007B, kBluetoothHCICommandWriteAuthenticatedPayloadTimeout = 0x007C, kBluetoothHCICommandReadLocalOOBExtendedData = 0x007D, kBluetoothHCICommandReadExtendedPageTimeout = 0x007E, kBluetoothHCICommandWriteExtendedPageTimeout = 0x007F, kBluetoothHCICommandReadExtendedInquiryLength = 0x0080, kBluetoothHCICommandWriteExtendedInquiryLength = 0x0081, kBluetoothHCICommandSetConnectionlessSlaveBroadcastData __attribute__ ((deprecated)) = kBluetoothHCICommandSetConnectionlessPeripheralBroadcastData, // Command Group: Informational kBluetoothHCICommandGroupInformational = 0x04, kBluetoothHCICommandReadLocalVersionInformation = 0x0001, kBluetoothHCICommandReadLocalSupportedCommands = 0x0002, kBluetoothHCICommandReadLocalSupportedFeatures = 0x0003, kBluetoothHCICommandReadLocalExtendedFeatures = 0x0004, kBluetoothHCICommandReadBufferSize = 0x0005, kBluetoothHCICommandReadCountryCode = 0x0007, // DEPRECATED kBluetoothHCICommandReadDeviceAddress = 0x0009, kBluetoothHCICommandReadDataBlockSize = 0x000A, kBluetoothHCICommandReadLocalSupportedCodecs = 0x000B, // Command Group: Status kBluetoothHCICommandGroupStatus = 0x05, kBluetoothHCICommandReadFailedContactCounter = 0x0001, kBluetoothHCICommandResetFailedContactCounter = 0x0002, kBluetoothHCICommandGetLinkQuality = 0x0003, kBluetoothHCICommandReadRSSI = 0x0005, kBluetoothHCICommandReadAFHMappings = 0x0006, kBluetoothHCICommandReadClock = 0x0007, kBluetoothHCICommandReadEncryptionKeySize = 0x0008, kBluetoothHCICommandReadLocalAMPInfo = 0x0009, kBluetoothHCICommandReadLocalAMPASSOC = 0x000A, kBluetoothHCICommandWriteRemoteAMPASSOC = 0x000B, kBluetoothHCICommandGetMWSTransportLayerConfiguration = 0x000C, kBluetoothHCICommandSetTriggeredClockCapture = 0x000D, // Command Group: Testing kBluetoothHCICommandGroupTesting = 0x06, kBluetoothHCICommandReadLoopbackMode = 0x0001, kBluetoothHCICommandWriteLoopbackMode = 0x0002, kBluetoothHCICommandEnableDeviceUnderTestMode = 0x0003, kBluetoothHCICommandWriteSimplePairingDebugMode = 0x0004, kBluetoothHCICommandEnableAMPReceiverReports = 0x0007, kBluetoothHCICommandAMPTestEnd = 0x0008, kBluetoothHCICommandAMPTest = 0x0009, // Command Group: Low Energy kBluetoothHCICommandGroupLowEnergy = 0x08, kBluetoothHCICommandLESetEventMask = 0x0001, kBluetoothHCICommandLEReadBufferSize = 0x0002, kBluetoothHCICommandLEReadLocalSupportedFeatures = 0x0003, kBluetoothHCICommandLESetRandomAddress = 0x0005, kBluetoothHCICommandLESetAdvertisingParameters = 0x0006, kBluetoothHCICommandLEReadAdvertisingChannelTxPower = 0x0007, kBluetoothHCICommandLESetAdvertisingData = 0x0008, kBluetoothHCICommandLESetScanResponseData = 0x0009, kBluetoothHCICommandLESetAdvertiseEnable = 0x000A, kBluetoothHCICommandLESetScanParameters = 0x000B, kBluetoothHCICommandLESetScanEnable = 0x000C, kBluetoothHCICommandLECreateConnection = 0x000D, kBluetoothHCICommandLECreateConnectionCancel = 0x000E, kBluetoothHCICommandLEReadWhiteListSize = 0x000F, kBluetoothHCICommandLEClearWhiteList = 0x0010, kBluetoothHCICommandLEAddDeviceToWhiteList = 0x0011, kBluetoothHCICommandLERemoveDeviceFromWhiteList = 0x0012, kBluetoothHCICommandLEConnectionUpdate = 0x0013, kBluetoothHCICommandLESetHostChannelClassification = 0x0014, kBluetoothHCICommandLEReadChannelMap = 0x0015, kBluetoothHCICommandLEReadRemoteUsedFeatures = 0x0016, kBluetoothHCICommandLEEncrypt = 0x0017, kBluetoothHCICommandLERand = 0x0018, kBluetoothHCICommandLEStartEncryption = 0x0019, kBluetoothHCICommandLELongTermKeyRequestReply = 0x001A, kBluetoothHCICommandLELongTermKeyRequestNegativeReply = 0x001B, kBluetoothHCICommandLEReadSupportedStates = 0x001C, kBluetoothHCICommandLEReceiverTest = 0x001D, kBluetoothHCICommandLETransmitterTest = 0x001E, kBluetoothHCICommandLETestEnd = 0x001F, kBluetoothHCICommandLERemoteConnectionParameterRequestReply = 0x0020, kBluetoothHCICommandLERemoteConnectionParameterRequestNegativeReply = 0x0021, kBluetoothHCICommandLESetDataLength = 0x0022, kBluetoothHCICommandLEReadSuggestedDefaultDataLength = 0x0023, kBluetoothHCICommandLEWriteSuggestedDefaultDataLength = 0x0024, kBluetoothHCICommandLEReadLocalP256PublicKey = 0x0025, kBluetoothHCICommandLEGenerateDHKey = 0x0026, kBluetoothHCICommandLEAddDeviceToResolvingList = 0x0027, kBluetoothHCICommandLERemoveDeviceFromResolvingList = 0x0028, kBluetoothHCICommandLEClearResolvingList = 0x0029, kBluetoothHCICommandLEReadResolvingListSize = 0x002A, kBluetoothHCICommandLEReadPeerResolvableAddress = 0x002B, kBluetoothHCICommandLEReadLocalResolvableAddress = 0x002C, kBluetoothHCICommandLESetAddressResolutionEnable = 0x002D, kBluetoothHCICommandLESetResolvablePrivateAddressTimeout = 0x002E, kBluetoothHCICommandLEReadMaximumDataLength = 0x002F, kBluetoothHCICommandLEReadPhy = 0x0030, kBluetoothHCICommandLESetDefaultPhy = 0x0031, kBluetoothHCICommandLESetPhy = 0x0032, kBluetoothHCICommandLEEnhancedReceiverTest = 0x0033, kBluetoothHCICommandLEEnhancedTransmitterTest = 0x0034, kBluetoothHCICommandLESetAdvertisingSetRandomAddress = 0x0035, kBluetoothHCICommandLESetExtendedAdvertisingParameters = 0x0036, kBluetoothHCICommandLESetExtendedAdvertisingData = 0x0037, kBluetoothHCICommandLESetExtendedScanResponseData = 0x0038, kBluetoothHCICommandLESetExtendedAdvertisingEnableCommand = 0x0039, kBluetoothHCICommandLEReadMaximumAdvertisingDataLength = 0x003A, kBluetoothHCICommandLEReadNumberofSupportedAdvertisingSets = 0x003B, kBluetoothHCICommandLERemoveAdvertisingSet = 0x003C, kBluetoothHCICommandLEClearAdvertisingSets = 0x003D, kBluetoothHCICommandLESetPeriodicAdvertisingParameters = 0x003E, kBluetoothHCICommandLESetPeriodicAdvertisingData = 0x003F, kBluetoothHCICommandLESetPeriodicAdvertisingEnable = 0x0040, kBluetoothHCICommandLESetExtendedScanParameters = 0x0041, kBluetoothHCICommandLESetExtendedScanEnable = 0x0042, kBluetoothHCICommandLEExtendedCreateConnection = 0x0043, kBluetoothHCICommandLEPeriodicAdvertisingCreateSync = 0x0044, kBluetoothHCICommandLEPeriodicAdvertisingCreateSyncCancel = 0x0045, kBluetoothHCICommandLEPeriodicAdvertisingTerminateSync = 0x0046, kBluetoothHCICommandLEAddDeviceToPeriodicAdvertiserList = 0x0047, kBluetoothHCICommandLERemoveDeviceFromPeriodicAdvertiserList = 0x0048, kBluetoothHCICommandLEClearPeriodicAdvertiserList = 0x0049, kBluetoothHCICommandLEReadPeriodicAdvertiserListSize = 0x004A, kBluetoothHCICommandLEReadTransmitPower = 0x004B, kBluetoothHCICommandLEReadRFPathCompensation = 0x004C, kBluetoothHCICommandLEWriteRFPathCompensation = 0x004D, kBluetoothHCICommandLESetPrivacyMode = 0x004E, // Command Group: Logo Testing (no commands yet) kBluetoothHCICommandGroupLogoTesting = 0x3E, // Command Group: Vendor Specific kBluetoothHCICommandGroupVendorSpecific = 0x3F, kBluetoothHCICommandGroupMax = 0x40, kBluetoothHCICommandMax = 0x03FF }; // HCI Data Types typedef uint8_t BluetoothHCIQoSFlags; typedef uint8_t BluetoothHCIParamByteCount; typedef uint16_t BluetoothHCIACLDataByteCount; typedef uint8_t BluetoothHCISCODataByteCount; typedef uint8_t BluetoothHCIInquiryLength; typedef uint8_t BluetoothHCIResponseCount; typedef uint8_t BluetoothHCICountryCode; typedef uint16_t BluetoothHCIModeInterval; typedef uint16_t BluetoothHCISniffAttemptCount; typedef uint16_t BluetoothHCISniffTimeout; typedef uint16_t BluetoothHCIParkModeBeaconInterval; typedef uint8_t BluetoothMaxSlots; typedef uint16_t BluetoothManufacturerName; typedef uint8_t BluetoothLMPVersion; typedef uint16_t BluetoothLMPSubversion; typedef uint8_t BluetoothHCIConnectionMode; enum BluetoothHCIConnectionModes { kConnectionActiveMode = 0, kConnectionHoldMode = 1, kConnectionSniffMode = 2, kConnectionParkMode = 3, kConnectionModeReservedForFutureUse = 4, }; typedef struct BluetoothHCISupportedCommands BluetoothHCISupportedCommands; struct BluetoothHCISupportedCommands { uint8_t data[64]; }; typedef struct BluetoothHCISupportedFeatures BluetoothHCISupportedFeatures; struct BluetoothHCISupportedFeatures { uint8_t data[8]; }; typedef struct BluetoothHCISupportedFeatures BluetoothHCILESupportedFeatures; typedef struct BluetoothHCISupportedFeatures BluetoothHCILEUsedFeatures; typedef uint8_t BluetoothHCIPageNumber; typedef struct BluetoothHCIExtendedFeaturesInfo BluetoothHCIExtendedFeaturesInfo; struct BluetoothHCIExtendedFeaturesInfo { BluetoothHCIPageNumber page; BluetoothHCIPageNumber maxPage; uint8_t data[8]; }; enum BluetoothLEFeatureBits { kBluetoothLEFeatureLEEncryption = (1 << 0L), kBluetoothLEFeatureConnectionParamsRequestProcedure = (1 << 1L), kBluetoothLEFeatureExtendedRejectIndication = (1 << 2L), kBluetoothLEFeaturePeripheralInitiatedFeaturesExchange = (1 << 3L), kBluetoothLEFeatureLEPing = (1 << 4L), kBluetoothLEFeatureLEDataPacketLengthExtension = (1 << 5L), kBluetoothLEFeatureLLPrivacy = (1 << 6L), kBluetoothLEFeatureExtendedScannerFilterPolicies = (1 << 7L), kBluetoothLEFeatureSlaveInitiatedFeaturesExchange __attribute__ ((deprecated)) = kBluetoothLEFeaturePeripheralInitiatedFeaturesExchange, // Three other bytes are RFU }; enum BluetoothFeatureBits { // Byte 0 of the support features data structure. kBluetoothFeatureThreeSlotPackets = (1 << 0L), kBluetoothFeatureFiveSlotPackets = (1 << 1L), kBluetoothFeatureEncryption = (1 << 2L), kBluetoothFeatureSlotOffset = (1 << 3L), kBluetoothFeatureTimingAccuracy = (1 << 4L), kBluetoothFeatureSwitchRoles = (1 << 5L), kBluetoothFeatureHoldMode = (1 << 6L), kBluetoothFeatureSniffMode = (1 << 7L), // Byte 1 of the support features data structure. kBluetoothFeatureParkMode = (1 << 0L), kBluetoothFeatureRSSI = (1 << 1L), kBluetoothFeaturePowerControlRequests = (1 << 1L), kBluetoothFeatureChannelQuality = (1 << 2L), kBluetoothFeatureSCOLink = (1 << 3L), kBluetoothFeatureHV2Packets = (1 << 4L), kBluetoothFeatureHV3Packets = (1 << 5L), kBluetoothFeatureULawLog = (1 << 6L), kBluetoothFeatureALawLog = (1 << 7L), // Byte 2 of the support features data structure. kBluetoothFeatureCVSD = (1 << 0L), kBluetoothFeaturePagingScheme = (1 << 1L), kBluetoothFeaturePowerControl = (1 << 2L), kBluetoothFeatureTransparentSCOData = (1 << 3L), kBluetoothFeatureFlowControlLagBit0 = (1 << 4L), kBluetoothFeatureFlowControlLagBit1 = (1 << 5L), kBluetoothFeatureFlowControlLagBit2 = (1 << 6L), kBluetoothFeatureBroadcastEncryption = (1 << 7L), // Byte 3 of the support features data structure. kBluetoothFeatureScatterMode = (1 << 0L), kBluetoothFeatureEnhancedDataRateACL2MbpsMode = (1 << 1L), kBluetoothFeatureEnhancedDataRateACL3MbpsMode = (1 << 2L), kBluetoothFeatureEnhancedInquiryScan = (1 << 3L), kBluetoothFeatureInterlacedInquiryScan = (1 << 4L), kBluetoothFeatureInterlacedPageScan = (1 << 5L), kBluetoothFeatureRSSIWithInquiryResult = (1 << 6L), kBluetoothFeatureExtendedSCOLink = (1 << 7L), // Byte 4 of the support features data structure. kBluetoothFeatureEV4Packets = (1 << 0L), kBluetoothFeatureEV5Packets = (1 << 1L), kBluetoothFeatureAbsenceMasks = (1 << 2L), kBluetoothFeatureAFHCapablePeripheral = (1 << 3L), kBluetoothFeatureAFHClassificationPeripheral = (1 << 4L), kBluetoothFeatureAliasAuhentication = (1 << 5L), kBluetoothFeatureLESupportedController = (1 << 6L), kBluetoothFeature3SlotEnhancedDataRateACLPackets = (1 << 7L), kBluetoothFeatureAFHCapableSlave __attribute__ ((deprecated)) = kBluetoothFeatureAFHCapablePeripheral, kBluetoothFeatureAFHClassificationSlave __attribute__ ((deprecated)) = kBluetoothFeatureAFHClassificationPeripheral, // Byte 5 of the support features data structure. kBluetoothFeature5SlotEnhancedDataRateACLPackets = (1 << 0L), // 2.0 version of this header had this at the wrong bit location kBluetoothFeatureSniffSubrating = (1 << 1L), kBluetoothFeaturePauseEncryption = (1 << 2L), kBluetoothFeatureAFHCapableMaster = (1 << 3L), kBluetoothFeatureAFHClassificationMaster = (1 << 4L), kBluetoothFeatureEnhancedDataRateeSCO2MbpsMode = (1 << 5L), kBluetoothFeatureEnhancedDataRateeSCO3MbpsMode = (1 << 6L), kBluetoothFeature3SlotEnhancedDataRateeSCOPackets = (1 << 7L), // Byte 6 of the support features data structure. kBluetoothFeatureExtendedInquiryResponse = (1 << 0L), kBluetoothFeatureSecureSimplePairing = (1 << 3L), kBluetoothFeatureEncapsulatedPDU = (1 << 4L), kBluetoothFeatureErroneousDataReporting = (1 << 5L), kBluetoothFeatureNonFlushablePacketBoundaryFlag = (1 << 6L), // Byte 7 of the support features data structure. kBluetoothFeatureLinkSupervisionTimeoutChangedEvent = (1 << 0L), kBluetoothFeatureInquiryTransmissionPowerLevel = (1 << 1L), kBluetoothFeatureExtendedFeatures = (1 << 7L), // Byte 8 of the support features data structure (extended) page 1 kBluetoothExtendedFeatureSimpleSecurePairingHostMode = (1 << 0L), kBluetoothExtendedFeatureLESupportedHostMode = (1 << 1L), kBluetoothExtendedFeatureLEAndBREDRToSameDeviceHostMode = (1 << 2L), KBluetoothExtendedFeatureSecureConnectionsHostMode = (1 << 3L), // Byte 16 of supported features data structure (extended) page 2 kBluetoothExtendedFeatureSecureConnectionsControllerSupport = (1 << 0L), kBluetoothExtendedFeaturePing = (1 << 1L), kBluetoothExtendedFeatureReserved = (1 << 2L), kBluetoothExtendedFeatureTrainNudging = (1 << 3L), kBluetoothExtendedFeatureSlotAvailabilityMask = (1 << 4L), }; typedef struct BluetoothEventFilterCondition BluetoothEventFilterCondition; struct BluetoothEventFilterCondition { uint8_t data[ 7 ]; }; typedef uint16_t BluetoothHCIFailedContactCount; typedef struct BluetoothHCIFailedContactInfo BluetoothHCIFailedContactInfo; struct BluetoothHCIFailedContactInfo { BluetoothHCIFailedContactCount count; BluetoothConnectionHandle handle; }; typedef SInt8 BluetoothHCIRSSIValue; /* Valid Range: -127 to +20 */ typedef struct BluetoothHCIRSSIInfo BluetoothHCIRSSIInfo; struct BluetoothHCIRSSIInfo { BluetoothConnectionHandle handle; BluetoothHCIRSSIValue RSSIValue; }; typedef uint8_t BluetoothHCILinkQuality; typedef struct BluetoothHCILinkQualityInfo BluetoothHCILinkQualityInfo; struct BluetoothHCILinkQualityInfo { BluetoothConnectionHandle handle; BluetoothHCILinkQuality qualityValue; }; typedef uint8_t BluetoothHCIEncryptionKeySize; typedef struct BluetoothHCIEncryptionKeySizeInfo BluetoothHCIEncryptionKeySizeInfo; struct BluetoothHCIEncryptionKeySizeInfo { BluetoothConnectionHandle handle; BluetoothHCIEncryptionKeySize keySize; }; typedef uint8_t BluetoothHCIRole; typedef struct BluetoothHCIRoleInfo BluetoothHCIRoleInfo; struct BluetoothHCIRoleInfo { uint8_t role; BluetoothConnectionHandle handle; }; enum BluetoothHCIRoles { kBluetoothHCICentralRole = 0x00, kBluetoothHCIPeripheralRole = 0x01, kBluetoothHCIMasterRole __attribute__ ((deprecated)) = kBluetoothHCICentralRole, kBluetoothHCISlaveRole __attribute__ ((deprecated)) = kBluetoothHCIPeripheralRole }; typedef uint16_t BluetoothHCILinkPolicySettings; enum BluetoothHCILinkPolicySettingsValues { kDisableAllLMModes = 0x0000, kEnableCentralPeripheralSwitch = 0x0001, kEnableHoldMode = 0x0002, kEnableSniffMode = 0x0004, kEnableParkMode = 0x0008, kReservedForFutureUse = 0x0010, kEnableMasterSlaveSwitch __attribute__ ((deprecated)) = kEnableCentralPeripheralSwitch }; typedef struct BluetoothHCILinkPolicySettingsInfo BluetoothHCILinkPolicySettingsInfo; struct BluetoothHCILinkPolicySettingsInfo { BluetoothHCILinkPolicySettings settings; BluetoothConnectionHandle handle; }; typedef struct BluetoothHCIQualityOfServiceSetupParams BluetoothHCIQualityOfServiceSetupParams; struct BluetoothHCIQualityOfServiceSetupParams { uint8_t flags; uint8_t serviceType; uint32_t tokenRate; uint32_t peakBandwidth; uint32_t latency; uint32_t delayVariation; }; typedef struct BluetoothHCISetupSynchronousConnectionParams BluetoothHCISetupSynchronousConnectionParams; struct BluetoothHCISetupSynchronousConnectionParams { uint32_t transmitBandwidth; uint32_t receiveBandwidth; uint16_t maxLatency; uint16_t voiceSetting; uint8_t retransmissionEffort; uint16_t packetType; }; typedef struct BluetoothHCIAcceptSynchronousConnectionRequestParams BluetoothHCIAcceptSynchronousConnectionRequestParams; struct BluetoothHCIAcceptSynchronousConnectionRequestParams { uint32_t transmitBandwidth; uint32_t receiveBandwidth; uint16_t maxLatency; uint16_t contentFormat; uint8_t retransmissionEffort; uint16_t packetType; }; // Add for EnhancedSetup typedef struct BluetoothHCIEnhancedSetupSynchronousConnectionParams BluetoothHCIEnhancedSetupSynchronousConnectionParams; struct BluetoothHCIEnhancedSetupSynchronousConnectionParams { uint32_t transmitBandwidth; uint32_t receiveBandwidth; uint64_t transmitCodingFormat; uint64_t receiveCodingFormat; uint16_t transmitCodecFrameSize; uint16_t receiveCodecFrameSize; uint32_t inputBandwidth; uint32_t outputBandwidth; uint64_t inputCodingFormat; uint64_t outputCodingFormat; uint16_t inputCodedDataSize; uint16_t outputCodedDataSize; uint8_t inputPCMDataFormat; uint8_t outputPCMDataFormat; uint8_t inputPCMSamplePayloadMSBPosition; uint8_t outputPCMSamplePayloadMSBPosition; uint8_t inputDataPath; uint8_t outputDataPath; uint8_t inputTransportUnitSize; uint8_t outputTransportUnitSize; uint16_t maxLatency; uint16_t packetType; uint8_t retransmissionEffort; }; // Add for EnhancedAccept typedef struct BluetoothHCIEnhancedAcceptSynchronousConnectionRequestParams BluetoothHCIEnhancedAcceptSynchronousConnectionRequestParams; struct BluetoothHCIEnhancedAcceptSynchronousConnectionRequestParams { uint32_t transmitBandwidth; uint32_t receiveBandwidth; uint64_t transmitCodingFormat; uint64_t receiveCodingFormat; uint16_t transmitCodecFrameSize; uint16_t receiveCodecFrameSize; uint32_t inputBandwidth; uint32_t outputBandwidth; uint64_t inputCodingFormat; uint64_t outputCodingFormat; uint16_t inputCodedDataSize; uint16_t outputCodedDataSize; uint8_t inputPCMDataFormat; uint8_t outputPCMDataFormat; uint8_t inputPCMSamplePayloadMSBPosition; uint8_t outputPCMSamplePayloadMSBPosition; uint8_t inputDataPath; uint8_t outputDataPath; uint8_t inputTransportUnitSize; uint8_t outputTransportUnitSize; uint16_t maxLatency; uint16_t packetType; uint8_t retransmissionEffort; }; typedef uint8_t BluetoothHCILoopbackMode; enum { kBluetoothHCILoopbackModeOff = 0x00, kBluetoothHCILoopbackModeLocal = 0x01, kBluetoothHCILoopbackModeRemote = 0x02 }; typedef struct BluetoothReadClockInfo BluetoothReadClockInfo; struct BluetoothReadClockInfo { BluetoothConnectionHandle handle; uint32_t clock; uint16_t accuracy; }; typedef struct BluetoothHCIEventFlowSpecificationData BluetoothHCIEventFlowSpecificationData; struct BluetoothHCIEventFlowSpecificationData { BluetoothConnectionHandle connectionHandle; uint8_t flags; uint8_t flowDirection; uint8_t serviceType; uint32_t tokenRate; uint32_t tokenBucketSize; uint32_t peakBandwidth; uint32_t accessLatency; }; typedef uint32_t BluetoothHCIOperationID; typedef uint32_t BluetoothHCIEventID; typedef uint32_t BluetoothHCIDataID; typedef uint32_t BluetoothHCISignalID; typedef uint32_t BluetoothHCITransportID; typedef uint32_t BluetoothHCITransportCommandID; typedef uint32_t BluetoothHCIRequestID; // Version Information typedef struct BluetoothHCIVersionInfo BluetoothHCIVersionInfo; struct BluetoothHCIVersionInfo { // Local & Remote information BluetoothManufacturerName manufacturerName; BluetoothLMPVersion lmpVersion; BluetoothLMPSubversion lmpSubVersion; // Local information only uint8_t hciVersion; uint16_t hciRevision; }; // HCI buffer sizes. typedef struct BluetoothHCIBufferSize BluetoothHCIBufferSize; struct BluetoothHCIBufferSize { uint16_t ACLDataPacketLength; uint8_t SCODataPacketLength; uint16_t totalNumACLDataPackets; uint16_t totalNumSCODataPackets; }; typedef struct BluetoothHCILEBufferSize BluetoothHCILEBufferSize; struct BluetoothHCILEBufferSize { uint16_t ACLDataPacketLength; uint8_t totalNumACLDataPackets; }; // Timeouts typedef uint16_t BluetoothHCIConnectionAcceptTimeout; typedef uint16_t BluetoothHCIPageTimeout; enum BluetoothHCITimeoutValues { kDefaultPageTimeout = 0x2710, }; #define BluetoothGetSlotsFromSeconds( inSeconds ) ( (inSeconds/.000625 ) ) #define BluetoothGetSecondsFromSlots( inSlots ) ( (inSlots*.000625 ) ) // Link Keys typedef uint16_t BluetoothHCINumLinkKeysDeleted; typedef uint8_t BluetoothHCINumLinkKeysToWrite; typedef uint8_t BluetoothHCIDeleteStoredLinkKeyFlag; enum BluetoothHCIDeleteStoredLinkKeyFlags { kDeleteKeyForSpecifiedDeviceOnly = 0x00, kDeleteAllStoredLinkKeys = 0x01, }; typedef uint8_t BluetoothHCIReadStoredLinkKeysFlag; enum BluetoothHCIReadStoredLinkKeysFlags { kReturnLinkKeyForSpecifiedDeviceOnly = 0x00, kReadAllStoredLinkKeys = 0x01, }; typedef struct BluetoothHCIStoredLinkKeysInfo BluetoothHCIStoredLinkKeysInfo; struct BluetoothHCIStoredLinkKeysInfo { uint16_t numLinkKeysRead; uint16_t maxNumLinkKeysAllowedInDevice; }; // Page Scan typedef uint8_t BluetoothHCIPageScanMode; enum BluetoothHCIPageScanModes { kMandatoryPageScanMode = 0x00, kOptionalPageScanMode1 = 0x01, kOptionalPageScanMode2 = 0x02, kOptionalPageScanMode3 = 0x03, }; typedef uint8_t BluetoothHCIPageScanPeriodMode; enum BluetoothHCIPageScanPeriodModes { kP0Mode = 0x00, kP1Mode = 0x01, kP2Mode = 0x02, }; typedef uint8_t BluetoothHCIPageScanEnableState; enum BluetoothHCIPageScanEnableStates { kNoScansEnabled = 0x00, kInquiryScanEnabledPageScanDisabled = 0x01, kInquiryScanDisabledPageScanEnabled = 0x02, kInquiryScanEnabledPageScanEnabled = 0x03, }; typedef struct BluetoothHCIScanActivity BluetoothHCIScanActivity; struct BluetoothHCIScanActivity { uint16_t scanInterval; uint16_t scanWindow; }; typedef struct BluetoothHCIInquiryAccessCode BluetoothHCIInquiryAccessCode; struct BluetoothHCIInquiryAccessCode { uint8_t data[3]; }; typedef uint8_t BluetoothHCIInquiryAccessCodeCount; typedef struct BluetoothHCICurrentInquiryAccessCodes BluetoothHCICurrentInquiryAccessCodes; struct BluetoothHCICurrentInquiryAccessCodes { BluetoothHCIInquiryAccessCodeCount count; // Number of codes in array. BluetoothHCIInquiryAccessCode * codes; // Ptr to array of codes. }; enum { kMaximumNumberOfInquiryAccessCodes = 0x40 }; typedef struct BluetoothHCICurrentInquiryAccessCodesForWrite BluetoothHCICurrentInquiryAccessCodesForWrite; struct BluetoothHCICurrentInquiryAccessCodesForWrite { BluetoothHCIInquiryAccessCodeCount count; // Number of codes in array (Range 0x01 to 0x40) uint8_t codes [kMaximumNumberOfInquiryAccessCodes * sizeof (BluetoothHCIInquiryAccessCode)]; // Array of bytes (maximum 192 bytes -- 64 * 3). }; typedef struct BluetoothHCILinkSupervisionTimeout BluetoothHCILinkSupervisionTimeout; struct BluetoothHCILinkSupervisionTimeout { BluetoothConnectionHandle handle; uint16_t timeout; }; typedef uint8_t BluetoothHCIFlowControlState; enum BluetoothHCISCOFlowControlStates { kSCOFlowControlDisabled = 0x00, kSCOFlowControlEnabled = 0x01 }; enum BluetoothHCIGeneralFlowControlStates { kHostControllerToHostFlowControlOff = 0x00, kHCIACLDataPacketsOnHCISCODataPacketsOff = 0x01, kHCIACLDataPacketsOffHCISCODataPacketsOn = 0x02, kHCIACLDataPacketsOnHCISCODataPacketsOn = 0x03, }; typedef SInt8 BluetoothHCITransmitPowerLevel; typedef uint8_t BluetoothHCITransmitPowerLevelType; enum BluetoothHCITransmitReadPowerLevelTypes { kReadCurrentTransmitPowerLevel = 0x00, kReadMaximumTransmitPowerLevel = 0x01, }; typedef uint8_t BluetoothHCIAFHChannelAssessmentMode; enum BluetoothHCIAFHChannelAssessmentModes { kAFHChannelAssessmentModeDisabled = 0x00, kAFHChannelAssessmentModeEnabled = 0x01 }; typedef struct BluetoothHCITransmitPowerLevelInfo BluetoothHCITransmitPowerLevelInfo; struct BluetoothHCITransmitPowerLevelInfo { BluetoothConnectionHandle handle; BluetoothHCITransmitPowerLevel level; // Range: -70 <= N <= 20 (units are dBm) }; typedef uint8_t BluetoothHCINumBroadcastRetransmissions; typedef uint8_t BluetoothHCIHoldModeActivity; enum BluetoothHCIHoldModeActivityStates { kMaintainCurrentPowerState = 0x00, kSuspendPageScan = 0x01, kSuspendInquiryScan = 0x02, kSuspendPeriodicInquiries = 0x03, }; typedef uint8_t BluetoothHCIAuthenticationEnable; enum BluetoothHCIAuthentionEnableModes { kAuthenticationDisabled = 0x00, kAuthenticationEnabled = 0x01, }; typedef uint8_t BluetoothHCIEncryptionMode; enum BluetoothHCIEncryptionModes { kEncryptionDisabled = 0x00, // Default. kEncryptionOnlyForPointToPointPackets = 0x01, kEncryptionForBothPointToPointAndBroadcastPackets = 0x02, }; typedef uint16_t BluetoothHCIAutomaticFlushTimeout; typedef struct BluetoothHCIAutomaticFlushTimeoutInfo BluetoothHCIAutomaticFlushTimeoutInfo; struct BluetoothHCIAutomaticFlushTimeoutInfo { BluetoothConnectionHandle handle; BluetoothHCIAutomaticFlushTimeout timeout; }; #define kInfoStringMaxLength 35 typedef struct BluetoothTransportInfo BluetoothTransportInfo; typedef BluetoothTransportInfo* BluetoothTransportInfoPtr; struct BluetoothTransportInfo { uint32_t productID; uint32_t vendorID; uint32_t type; char productName[kInfoStringMaxLength]; char vendorName[kInfoStringMaxLength]; uint64_t totalDataBytesSent; uint64_t totalSCOBytesSent; uint64_t totalDataBytesReceived; uint64_t totalSCOBytesReceived; }; enum BluetoothTransportTypes { kBluetoothTransportTypeUSB = 0x01, kBluetoothTransportTypePCCard = 0x02, kBluetoothTransportTypePCICard = 0x03, kBluetoothTransportTypeUART = 0x04, kBluetoothTransportTypePCIe = 0x05 }; // Inquiries typedef struct BluetoothHCIInquiryResult BluetoothHCIInquiryResult; struct BluetoothHCIInquiryResult { BluetoothDeviceAddress deviceAddress; BluetoothPageScanRepetitionMode pageScanRepetitionMode; BluetoothHCIPageScanPeriodMode pageScanPeriodMode; BluetoothHCIPageScanMode pageScanMode; BluetoothClassOfDevice classOfDevice; BluetoothClockOffset clockOffset; }; #define kBluetoothHCIInquiryResultsMaxResults 50 typedef struct BluetoothHCIInquiryResults BluetoothHCIInquiryResults; struct BluetoothHCIInquiryResults { BluetoothHCIInquiryResult results[kBluetoothHCIInquiryResultsMaxResults]; IOItemCount count; }; //Inquiries with RSSI (v1.2 specification) typedef struct BluetoothHCIInquiryWithRSSIResult BluetoothHCIInquiryWithRSSIResult; struct BluetoothHCIInquiryWithRSSIResult { BluetoothDeviceAddress deviceAddress; BluetoothPageScanRepetitionMode pageScanRepetitionMode; uint8_t reserved; BluetoothClassOfDevice classOfDevice; BluetoothClockOffset clockOffset; BluetoothHCIRSSIValue RSSIValue; }; typedef struct BluetoothHCIInquiryWithRSSIResults BluetoothHCIInquiryWithRSSIResults; struct BluetoothHCIInquiryWithRSSIResults { BluetoothHCIInquiryWithRSSIResult results[50]; IOItemCount count; }; //Inquiries with 'Extended Inquiry Response' (v2.1 specification) typedef uint8_t BluetoothHCIFECRequired; enum BluetoothHCIFECRequiredValues { kBluetoothHCIFECRequired = 0x00, kBluetoothHCIFECNotRequired = 0x01 }; typedef uint8_t BluetoothHCIInquiryMode; enum BluetoothHCIInquiryModes { kBluetoothHCIInquiryModeResultFormatStandard = 0x00, kBluetoothHCIInquiryModeResultFormatWithRSSI = 0x01, kBluetoothHCIInquiryModeResultFormatWithRSSIOrExtendedInquiryResultFormat = 0x02 }; typedef uint8_t BluetoothHCIInquiryScanType; enum BluetoothHCIInquiryScanTypes { kBluetoothHCIInquiryScanTypeStandard = 0x00, kBluetoothHCIInquiryScanTypeInterlaced = 0x01, kBluetoothHCIInquiryScanTypeReservedStart = 0x02, kBluetoothHCIInquiryScanTypeReservedEnd = 0xFF }; typedef uint8_t BluetoothHCIExtendedInquiryResponseDataType; typedef struct BluetoothHCIExtendedInquiryResponse BluetoothHCIExtendedInquiryResponse; /* Extended Inquiry Response [EIR] data, consisting of a sequence of data structures in this format: [length(1byte)][data type(1byte)][data(e.g. device name)] */ struct BluetoothHCIExtendedInquiryResponse { uint8_t data[ 240 ]; }; typedef struct BluetoothHCIReadExtendedInquiryResponseResults BluetoothHCIReadExtendedInquiryResponseResults; struct BluetoothHCIReadExtendedInquiryResponseResults { BluetoothHCIFECRequired outFECRequired; BluetoothHCIExtendedInquiryResponse extendedInquiryResponse; }; typedef struct BluetoothHCIExtendedInquiryResult BluetoothHCIExtendedInquiryResult; struct BluetoothHCIExtendedInquiryResult { uint8_t numberOfReponses; /* always a value of 1 */ BluetoothDeviceAddress deviceAddress; BluetoothPageScanRepetitionMode pageScanRepetitionMode; uint8_t reserved; BluetoothClassOfDevice classOfDevice; BluetoothClockOffset clockOffset; BluetoothHCIRSSIValue RSSIValue; BluetoothHCIExtendedInquiryResponse extendedInquiryResponse; }; typedef struct BluetoothHCIReadLMPHandleResults BluetoothHCIReadLMPHandleResults; struct BluetoothHCIReadLMPHandleResults { BluetoothConnectionHandle handle; BluetoothLMPHandle lmp_handle; uint32_t reserved; }; // 'Simple Pairing' (v2.1 specification) typedef uint8_t BluetoothHCISimplePairingMode; enum BluetoothHCISimplePairingModes { kBluetoothHCISimplePairingModeNotSet = 0x00, kBluetoothHCISimplePairingModeEnabled = 0x01 }; typedef uint8_t BluetoothSimplePairingDebugMode; enum BluetoothSimplePairingDebugModes { kBluetoothHCISimplePairingDebugModeDisabled = 0x00, kBluetoothHCISimplePairingDebugModeEnabled = 0x01 }; typedef struct BluetoothHCISimplePairingOOBData BluetoothHCISimplePairingOOBData; struct BluetoothHCISimplePairingOOBData { uint8_t data[ 16 ]; }; typedef struct BluetoothHCIReadLocalOOBDataResults BluetoothHCIReadLocalOOBDataResults; struct BluetoothHCIReadLocalOOBDataResults { BluetoothHCISimplePairingOOBData hash; BluetoothHCISimplePairingOOBData randomizer; }; typedef uint8_t BluetoothIOCapability; enum BluetoothIOCapabilities { kBluetoothCapabilityTypeDisplayOnly = 0x00, kBluetoothCapabilityTypeDisplayYesNo = 0x01, kBluetoothCapabilityTypeKeyboardOnly = 0x02, kBluetoothCapabilityTypeNoInputNoOutput = 0x03 }; typedef uint8_t BluetoothOOBDataPresence; enum BluetoothOOBDataPresenceValues { kBluetoothOOBAuthenticationDataNotPresent = 0x00, kBluetoothOOBAuthenticationDataFromRemoteDevicePresent = 0x01 }; typedef uint8_t BluetoothAuthenticationRequirements; enum BluetoothAuthenticationRequirementsValues { kBluetoothAuthenticationRequirementsMITMProtectionNotRequired = 0x00, /* Numeric comparison with automatic accept allowed */ kBluetoothAuthenticationRequirementsMITMProtectionRequired = 0x01, /* Refer to BluetoothIOCapabilities to determine authentication procedure */ kBluetoothAuthenticationRequirementsMITMProtectionNotRequiredNoBonding = 0x00, kBluetoothAuthenticationRequirementsMITMProtectionRequiredNoBonding = 0x01, kBluetoothAuthenticationRequirementsMITMProtectionNotRequiredDedicatedBonding = 0x02, kBluetoothAuthenticationRequirementsMITMProtectionRequiredDedicatedBonding = 0x03, kBluetoothAuthenticationRequirementsMITMProtectionNotRequiredGeneralBonding = 0x04, kBluetoothAuthenticationRequirementsMITMProtectionRequiredGeneralBonding = 0x05 }; typedef struct BluetoothIOCapabilityResponse BluetoothIOCapabilityResponse; struct BluetoothIOCapabilityResponse { BluetoothDeviceAddress deviceAddress; BluetoothIOCapability ioCapability; /* possible values from BluetoothIOCapabilities above */ BluetoothOOBDataPresence OOBDataPresence; BluetoothAuthenticationRequirements authenticationRequirements; }; typedef uint32_t BluetoothPasskey; typedef struct BluetoothUserPasskeyNotification BluetoothUserPasskeyNotification; struct BluetoothUserPasskeyNotification { BluetoothDeviceAddress deviceAddress; BluetoothPasskey passkey; /* passkey for display. valid values are 000000 - 999999 */ }; typedef uint8_t BluetoothKeypressNotificationType; enum BluetoothKeypressNotificationTypes { kBluetoothKeypressNotificationTypePasskeyEntryStarted = 0, kBluetoothKeypressNotificationTypePasskeyDigitEntered = 1, kBluetoothKeypressNotificationTypePasskeyDigitErased = 2, kBluetoothKeypressNotificationTypePasskeyCleared = 3, kBluetoothKeypressNotificationTypePasskeyEntryCompleted = 4 }; typedef struct BluetoothKeypressNotification BluetoothKeypressNotification; struct BluetoothKeypressNotification { BluetoothDeviceAddress deviceAddress; BluetoothKeypressNotificationType notificationType; }; typedef struct BluetoothRemoteHostSupportedFeaturesNotification BluetoothRemoteHostSupportedFeaturesNotification; struct BluetoothRemoteHostSupportedFeaturesNotification { BluetoothDeviceAddress deviceAddress; BluetoothHCISupportedFeatures hostSupportedFeatures; }; typedef SInt8 TransmissionPower; typedef struct BluetoothAFHHostChannelClassification BluetoothAFHHostChannelClassification; struct BluetoothAFHHostChannelClassification { uint8_t data[ 10 ]; /* 79 bits meaningful */ }; typedef uint8_t BluetoothAFHMode; typedef struct BluetoothAFHResults BluetoothAFHResults; struct BluetoothAFHResults { BluetoothConnectionHandle handle; BluetoothAFHMode mode; uint8_t afhMap[10]; }; typedef uint32_t BluetoothNumericValue; typedef struct BluetoothUserConfirmationRequest BluetoothUserConfirmationRequest; struct BluetoothUserConfirmationRequest { BluetoothDeviceAddress deviceAddress; BluetoothNumericValue numericValue; /* numeric value for display. valid values are 000000 - 999999 */ }; typedef struct BluetoothHCIEventSimplePairingCompleteResults BluetoothHCIEventSimplePairingCompleteResults; struct BluetoothHCIEventSimplePairingCompleteResults { BluetoothDeviceAddress deviceAddress; }; // Packet Sizes enum { kBluetoothHCICommandPacketHeaderSize = 3, kBluetoothHCICommandPacketMaxDataSize = 255, kBluetoothHCIMaxCommandPacketSize = kBluetoothHCICommandPacketHeaderSize + kBluetoothHCICommandPacketMaxDataSize, kBluetoothHCIEventPacketHeaderSize = 2, kBluetoothHCIEventPacketMaxDataSize = 255, kBluetoothHCIMaxEventPacketSize = kBluetoothHCIEventPacketHeaderSize + kBluetoothHCIEventPacketMaxDataSize, kBluetoothHCIDataPacketHeaderSize = 4, kBluetoothHCIDataPacketMaxDataSize = 65535, kBluetoothHCIMaxDataPacketSize = kBluetoothHCIDataPacketHeaderSize + kBluetoothHCIDataPacketMaxDataSize }; typedef uint8_t BluetoothHCIEventCode; typedef uint8_t BluetoothLinkType; enum BluetoothLinkTypes { kBluetoothSCOConnection = 0, kBluetoothACLConnection = 1, kBluetoothESCOConnection = 2, kBluetoothLinkTypeNone = 0xff }; typedef uint16_t BluetoothHCIContentFormat; // 10 bits meaningful typedef uint16_t BluetoothHCIVoiceSetting; // 10 bits meaningful enum { // Input Coding kBluetoothVoiceSettingInputCodingMask = 0x300, kBluetoothVoiceSettingInputCodingLinearInputCoding = 0x000, kBluetoothVoiceSettingInputCodingULawInputCoding = 0x100, kBluetoothVoiceSettingInputCodingALawInputCoding = 0x200, }; enum { // Input Data Format kBluetoothVoiceSettingInputDataFormatMask = 0x0C0, kBluetoothVoiceSettingInputDataFormat1sComplement = 0x000, kBluetoothVoiceSettingInputDataFormat2sComplement = 0x040, kBluetoothVoiceSettingInputDataFormatSignMagnitude = 0x080, kBluetoothVoiceSettingInputDataFormatUnsigned = 0x0C0, }; enum { // Input Sample Size kBluetoothVoiceSettingInputSampleSizeMask = 0x020, kBluetoothVoiceSettingInputSampleSize8Bit = 0x000, kBluetoothVoiceSettingInputSampleSize16Bit = 0x020, }; enum { // Linear PCM Bit Position kBluetoothVoiceSettingPCMBitPositionMask = 0x01C, }; enum { // Air Coding Format kBluetoothVoiceSettingAirCodingFormatMask = 0x003, kBluetoothVoiceSettingAirCodingFormatCVSD = 0x000, kBluetoothVoiceSettingAirCodingFormatULaw = 0x001, kBluetoothVoiceSettingAirCodingFormatALaw = 0x002, kBluetoothVoiceSettingAirCodingFormatTransparentData = 0x003, }; typedef uint8_t BluetoothHCISupportedIAC; typedef uint32_t BluetoothHCITransmitBandwidth; typedef uint32_t BluetoothHCIReceiveBandwidth; typedef uint64_t BluetoothHCITransmitCodingFormat; typedef uint64_t BluetoothHCIReceiveCodingFormat; typedef uint16_t BluetoothHCITransmitCodecFrameSize; typedef uint16_t BluetoothHCIReceiveCodecFrameSize; typedef uint32_t BluetoothHCIInputBandwidth; typedef uint32_t BluetoothHCIOutputBandwidth; typedef uint64_t BluetoothHCIInputCodingFormat; typedef uint64_t BluetoothHCIOutputCodingFormat; typedef uint16_t BluetoothHCIInputCodedDataSize; typedef uint16_t BluetoothHCIOutputCodedDataSize; typedef uint8_t BluetoothHCIInputPCMDataFormat; typedef uint8_t BluetoothHCIOutputPCMDataFormat; typedef uint8_t BluetoothHCIInputPCMSamplePayloadMSBPosition; typedef uint8_t BluetoothHCIOutputPCMSamplePayloadMSBPosition; typedef uint8_t BluetoothHCIInputDataPath; typedef uint8_t BluetoothHCIOutputDataPath; typedef uint8_t BluetoothHCIInputTransportUnitSize; typedef uint8_t BluetoothHCIOutputTransportUnitSize; typedef uint16_t BluetoothHCIMaxLatency; typedef uint8_t BluetoothHCIRetransmissionEffort; enum BluetoothHCIRetransmissionEffortTypes { kHCIRetransmissionEffortTypeNone = 0x00, kHCIRetransmissionEffortTypeAtLeastOneAndOptimizeForPower = 0x01, kHCIRetransmissionEffortTypeAtLeastOneAndOptimizeLinkQuality = 0x02, kHCIRetransmissionEffortTypeDontCare = 0xFF, }; // Setup Synchronous Packet types (Bluetooth 2.1 spec section 7.7.35 - Setup Synchronous Command Complete Event) typedef uint8_t BluetoothAirMode; enum { kBluetoothAirModeULawLog = 0x00, kBluetoothAirModeALawLog = 0x01, kBluetoothAirModeCVSD = 0x02, kBluetoothAirModeTransparentData = 0x03 }; typedef struct BluetoothSynchronousConnectionInfo BluetoothSynchronousConnectionInfo; struct BluetoothSynchronousConnectionInfo { BluetoothHCITransmitBandwidth transmitBandWidth; BluetoothHCIReceiveBandwidth receiveBandWidth; BluetoothHCIMaxLatency maxLatency; BluetoothHCIVoiceSetting voiceSetting; BluetoothHCIRetransmissionEffort retransmissionEffort; BluetoothPacketType packetType; }; typedef struct BluetoothEnhancedSynchronousConnectionInfo BluetoothEnhancedSynchronousConnectionInfo; struct BluetoothEnhancedSynchronousConnectionInfo { BluetoothHCITransmitBandwidth transmitBandWidth; BluetoothHCIReceiveBandwidth receiveBandWidth; BluetoothHCITransmitCodingFormat transmitCodingFormat; BluetoothHCIReceiveCodingFormat receiveCodingFormat; BluetoothHCITransmitCodecFrameSize transmitCodecFrameSize; BluetoothHCIReceiveCodecFrameSize receiveCodecFrameSize; BluetoothHCIInputBandwidth inputBandwidth; BluetoothHCIOutputBandwidth outputBandwidth; BluetoothHCIInputCodingFormat inputCodingFormat; BluetoothHCIOutputCodingFormat outputCodingFormat; BluetoothHCIInputCodedDataSize inputCodedDataSize; BluetoothHCIOutputCodedDataSize outputCodedDataSize; BluetoothHCIInputPCMDataFormat inputPCMDataFormat; BluetoothHCIOutputPCMDataFormat outputPCMDataFormat; BluetoothHCIInputPCMSamplePayloadMSBPosition inputPCMSampelPayloadMSBPosition; BluetoothHCIOutputPCMSamplePayloadMSBPosition outputPCMSampelPayloadMSBPosition; BluetoothHCIInputDataPath inputDataPath; BluetoothHCIOutputDataPath outputDataPath; BluetoothHCIInputTransportUnitSize inputTransportUnitSize; BluetoothHCIOutputTransportUnitSize outputTransportUnitSize; BluetoothHCIMaxLatency maxLatency; BluetoothHCIVoiceSetting voiceSetting; BluetoothHCIRetransmissionEffort retransmissionEffort; BluetoothPacketType packetType; }; typedef struct BluetoothHCIEventSynchronousConnectionCompleteResults BluetoothHCIEventSynchronousConnectionCompleteResults; struct BluetoothHCIEventSynchronousConnectionCompleteResults { BluetoothConnectionHandle connectionHandle; BluetoothDeviceAddress deviceAddress; BluetoothLinkType linkType; uint8_t transmissionInterval; uint8_t retransmissionWindow; uint16_t receivePacketLength; uint16_t transmitPacketLength; BluetoothAirMode airMode; }; typedef struct BluetoothHCIEventSynchronousConnectionChangedResults BluetoothHCIEventSynchronousConnectionChangedResults; struct BluetoothHCIEventSynchronousConnectionChangedResults { BluetoothConnectionHandle connectionHandle; uint8_t transmissionInterval; uint8_t retransmissionWindow; uint16_t receivePacketLength; uint16_t transmitPacketLength; }; typedef uint8_t BluetoothHCIStatus; typedef uint8_t BluetoothHCIEventStatus; // Events. enum { kBluetoothHCIEventInquiryComplete = 0x01, kBluetoothHCIEventInquiryResult = 0x02, kBluetoothHCIEventConnectionComplete = 0x03, kBluetoothHCIEventConnectionRequest = 0x04, kBluetoothHCIEventDisconnectionComplete = 0x05, kBluetoothHCIEventAuthenticationComplete = 0x06, kBluetoothHCIEventRemoteNameRequestComplete = 0x07, kBluetoothHCIEventEncryptionChange = 0x08, kBluetoothHCIEventChangeConnectionLinkKeyComplete = 0x09, kBluetoothHCIEventMasterLinkKeyComplete = 0x0A, kBluetoothHCIEventReadRemoteSupportedFeaturesComplete = 0x0B, kBluetoothHCIEventReadRemoteVersionInformationComplete = 0x0C, kBluetoothHCIEventQoSSetupComplete = 0x0D, kBluetoothHCIEventCommandComplete = 0x0E, kBluetoothHCIEventCommandStatus = 0x0F, kBluetoothHCIEventHardwareError = 0x10, kBluetoothHCIEventFlushOccurred = 0x11, kBluetoothHCIEventRoleChange = 0x12, kBluetoothHCIEventNumberOfCompletedPackets = 0x13, kBluetoothHCIEventModeChange = 0x14, kBluetoothHCIEventReturnLinkKeys = 0x15, kBluetoothHCIEventPINCodeRequest = 0x16, kBluetoothHCIEventLinkKeyRequest = 0x17, kBluetoothHCIEventLinkKeyNotification = 0x18, kBluetoothHCIEventLoopbackCommand = 0x19, kBluetoothHCIEventDataBufferOverflow = 0x1A, kBluetoothHCIEventMaxSlotsChange = 0x1B, kBluetoothHCIEventReadClockOffsetComplete = 0x1C, kBluetoothHCIEventConnectionPacketType = 0x1D, kBluetoothHCIEventQoSViolation = 0x1E, kBluetoothHCIEventPageScanModeChange = 0x1F, // DEPRECATED kBluetoothHCIEventPageScanRepetitionModeChange = 0x20, // [v1.2] kBluetoothHCIEventFlowSpecificationComplete = 0x21, kBluetoothHCIEventInquiryResultWithRSSI = 0x22, kBluetoothHCIEventReadRemoteExtendedFeaturesComplete = 0x23, kBluetoothHCIEventSynchronousConnectionComplete = 0x2C, kBluetoothHCIEventSynchronousConnectionChanged = 0x2D, // [v2.1] kBluetoothHCIEventSniffSubrating = 0x2E, kBluetoothHCIEventExtendedInquiryResult = 0x2F, kBluetoothHCIEventEncryptionKeyRefreshComplete = 0x30, kBluetoothHCIEventIOCapabilityRequest = 0x31, kBluetoothHCIEventIOCapabilityResponse = 0x32, kBluetoothHCIEventUserConfirmationRequest = 0x33, kBluetoothHCIEventUserPasskeyRequest = 0x34, kBluetoothHCIEventRemoteOOBDataRequest = 0x35, kBluetoothHCIEventSimplePairingComplete = 0x36, kBluetoothHCIEventLinkSupervisionTimeoutChanged = 0x38, kBluetoothHCIEventEnhancedFlushComplete = 0x39, kBluetoothHCIEventUserPasskeyNotification = 0x3B, kBluetoothHCIEventKeypressNotification = 0x3C, kBluetoothHCIEventRemoteHostSupportedFeaturesNotification = 0x3D, // [v4.0] (All LE Events come through this event, and the first following byte is the subevent kBluetoothHCIEventLEMetaEvent = 0x3E, kBluetoothHCISubEventLEConnectionComplete = 0x01, kBluetoothHCISubEventLEAdvertisingReport = 0x02, kBluetoothHCISubEventLEConnectionUpdateComplete = 0x03, kBluetoothHCISubEventLEReadRemoteUsedFeaturesComplete = 0x04, kBluetoothHCISubEventLELongTermKeyRequest = 0x05, kBluetoothHCISubEventLERemoteConnectionParameterRequest = 0x06, kBluetoothHCISubEventLEDataLengthChange = 0x07, kBluetoothHCISubEventLEReadLocalP256PublicKeyComplete = 0x08, kBluetoothHCISubEventLEGenerateDHKeyComplete = 0x09, kBluetoothHCISubEventLEEnhancedConnectionComplete = 0x0A, kBluetoothHCISubEventLEDirectAdvertisingReport = 0x0B, kBluetoothHCISubEventLEPhyUpdateComplete = 0x0C, kBluetoothHCISubEventLEExtendedAdvertising = 0x0D, kBluetoothHCISubEventLEPeriodicAdvertisingSyncEstablished = 0x0E, kBluetoothHCISubEventLEPeriodicAdvertisingReport = 0x0F, kBluetoothHCISubEventLEPeriodicAdvertisingSyncLost = 0x10, kBluetoothHCISubEventLEScanTimeout = 0x11, kBluetoothHCISubEventLEAdvertisingSetTerminated = 0x12, kBluetoothHCISubEventLEScanRequestReceived = 0x13, kBluetoothHCISubEventLEChannelSelectionAlgorithm = 0x14, // [v3.0] kBluetoothHCIEventPhysicalLinkComplete = 0x40, kBluetoothHCIEventChannelSelected = 0x41, kBluetoothHCIEventDisconnectionPhysicalLinkComplete = 0x42, kBluetoothHCIEventPhysicalLinkLossEarlyWarning = 0x43, kBluetoothHCIEventPhysicalLinkRecovery = 0x44, kBluetoothHCIEventLogicalLinkComplete = 0x45, kBluetoothHCIEventDisconnectionLogicalLinkComplete = 0x46, kBluetoothHCIEventFlowSpecModifyComplete = 0x47, kBluetoothHCIEventNumberOfCompletedDataBlocks = 0x48, kBluetoothHCIEventShortRangeModeChangeComplete = 0x4C, kBluetoothHCIEventAMPStatusChange = 0x4D, kBluetoothHCIEventAMPStartTest = 0x49, kBluetoothHCIEventAMPTestEnd = 0x4A, kBluetoothHCIEventAMPReceiverReport = 0x4B, kBluetoothHCIEventLogoTesting = 0xFE, kBluetoothHCIEventVendorSpecific = 0xFF }; // HCI Event Masks // Event masks are 8 octets according to the spec. v2.1 introduces some event masks that // actually exceed 32 bits so the 4 byte enum we had before Bluetooth 2.0 will still work for old // the masks, but the new masks need to be defined as 64 bits. typedef uint64_t BluetoothHCIEventMask; #define kBluetoothHCIEventMaskLEDefault64Bit 0x000000000000001FLL #define kBluetoothHCIEventMaskDefault64Bit 0x00001FFFFFFFFFFFLL #define kBluetoothHCIEventMaskAll64Bit 0xFFFFFFFFFFFFFFFFLL // [v1.2] #define kBluetoothHCIEventMaskFlowSpecificationCompleteEvent 0x0000000100000000LL #define kBluetoothHCIEventMaskInquiryResultWithRSSIEvent 0x0000000200000000LL #define kBluetoothHCIEventMaskReadRemoteExtendedFeaturesCompleteEvent 0x0000000400000000LL #define kBluetoothHCIEventMaskSynchronousConnectionCompleteEvent 0x0000080000000000LL #define kBluetoothHCIEventMaskSynchronousConnectionChangedEvent 0x0000100000000000LL // [v2.1] #define kBluetoothHCIEventMaskSniffSubratingEvent 0x0000200000000000LL #define kBluetoothHCIEventMaskExtendedInquiryResultEvent 0x0000400000000000LL #define kBluetoothHCIEventMaskEncryptionChangeEvent 0x0000000000000080LL #define kBluetoothHCIEventMaskEncryptionKeyRefreshCompleteEvent 0x0000800000000000LL #define kBluetoothHCIEventMaskLinkSupervisionTimeoutChangedEvent 0x0080000000000000LL #define kBluetoothHCIEventMaskEnhancedFlushCompleteEvent 0x0100000000000000LL // [v2.1 Secure Simple Pairing] #define kBluetoothHCIEventMaskIOCapabilityRequestEvent 0x0001000000000000LL #define kBluetoothHCIEventMaskIOCapabilityRequestReplyEvent 0x0002000000000000LL #define kBluetoothHCIEventMaskUserConfirmationRequestEvent 0x0004000000000000LL #define kBluetoothHCIEventMaskUserPasskeyRequestEvent 0x0008000000000000LL #define kBluetoothHCIEventMaskRemoteOOBDataRequestEvent 0x0010000000000000LL #define kBluetoothHCIEventMaskSimplePairingCompleteEvent 0x0020000000000000LL #define kBluetoothHCIEvnetMaskLinkSupervisionTimeoutChangedEvent 0x0080000000000000LL #define kBluetoothHCIEvnetMaskEnhancedFlushCompleteEvent 0x0100000000000000LL #define kBluetoothHCIEventMaskUserPasskeyNotificationEvent 0x0400000000000000LL #define kBluetoothHCIEventMaskKeypressNotificationEvent 0x0800000000000000LL #define kBluetoothHCIEventMaskRemoteHostSupportedFeaturesNotificationEvent 0x1000000000000000LL #define kBluetoothHCIEventMaskLEMetaEvent 0x2000000000000000LL enum { kBluetoothHCIEventMaskNone = 0x00000000, kBluetoothHCIEventMaskInquiryComplete = 0x00000001, kBluetoothHCIEventMaskInquiryResult = 0x00000002, kBluetoothHCIEventMaskConnectionComplete = 0x00000004, kBluetoothHCIEventMaskConnectionRequest = 0x00000008, kBluetoothHCIEventMaskDisconnectionComplete = 0x00000010, kBluetoothHCIEventMaskAuthenticationComplete = 0x00000020, kBluetoothHCIEventMaskRemoteNameRequestComplete = 0x00000040, kBluetoothHCIEventMaskEncryptionChange = 0x00000080, kBluetoothHCIEventMaskChangeConnectionLinkKeyComplete = 0x00000100, kBluetoothHCIEventMaskMasterLinkKeyComplete = 0x00000200, kBluetoothHCIEventMaskReadRemoteSupportedFeaturesComplete = 0x00000400, kBluetoothHCIEventMaskReadRemoteVersionInformationComplete = 0x00000800, kBluetoothHCIEventMaskQoSSetupComplete = 0x00001000, kBluetoothHCIEventMaskCommandComplete = 0x00002000, kBluetoothHCIEventMaskCommandStatus = 0x00004000, kBluetoothHCIEventMaskHardwareError = 0x00008000, kBluetoothHCIEventMaskFlushOccurred = 0x00010000, kBluetoothHCIEventMaskRoleChange = 0x00020000, kBluetoothHCIEventMaskNumberOfCompletedPackets = 0x00040000, kBluetoothHCIEventMaskModeChange = 0x00080000, kBluetoothHCIEventMaskReturnLinkKeys = 0x00100000, kBluetoothHCIEventMaskPINCodeRequest = 0x00200000, kBluetoothHCIEventMaskLinkKeyRequest = 0x00400000, kBluetoothHCIEventMaskLinkKeyNotification = 0x00800000, kBluetoothHCIEventMaskLoopbackCommand = 0x01000000, kBluetoothHCIEventMaskDataBufferOverflow = 0x02000000, kBluetoothHCIEventMaskMaxSlotsChange = 0x04000000, kBluetoothHCIEventMaskReadClockOffsetComplete = 0x08000000, kBluetoothHCIEventMaskConnectionPacketTypeChanged = 0x10000000, kBluetoothHCIEventMaskQoSViolation = 0x20000000, kBluetoothHCIEventMaskPageScanModeChange = 0x40000000, kBluetoothHCIEventMaskPageScanRepetitionModeChange = 0x80000000, kBluetoothHCIEventMaskAll = 0xFFFFFFFF, kBluetoothHCIEventMaskDefault = kBluetoothHCIEventMaskAll /* Use kBluetoothHCIEventMaskDefault64Bit above! */ }; // Event results structures. typedef struct BluetoothHCIEventConnectionCompleteResults BluetoothHCIEventConnectionCompleteResults; struct BluetoothHCIEventConnectionCompleteResults { BluetoothConnectionHandle connectionHandle; BluetoothDeviceAddress deviceAddress; BluetoothLinkType linkType; BluetoothHCIEncryptionMode encryptionMode; }; typedef struct BluetoothHCIEventLEConnectionCompleteResults BluetoothHCIEventLEConnectionCompleteResults; struct BluetoothHCIEventLEConnectionCompleteResults { BluetoothConnectionHandle connectionHandle; uint8_t role; uint8_t peerAddressType; BluetoothDeviceAddress peerAddress; uint16_t connInterval; uint16_t connLatency; uint16_t supervisionTimeout; uint8_t masterClockAccuracy; } __attribute__((packed)); typedef struct BluetoothHCIEventLEEnhancedConnectionCompleteResults BluetoothHCIEventLEEnhancedConnectionCompleteResults; struct BluetoothHCIEventLEEnhancedConnectionCompleteResults { BluetoothConnectionHandle connectionHandle; uint8_t role; uint8_t peerAddressType; BluetoothDeviceAddress peerAddress; BluetoothDeviceAddress localResolvablePrivateAddress; BluetoothDeviceAddress peerResolvablePrivateAddress; uint16_t connInterval; uint16_t connLatency; uint16_t supervisionTimeout; uint8_t masterClockAccuracy; } __attribute__((packed)); typedef struct BluetoothHCIEventLEConnectionUpdateCompleteResults BluetoothHCIEventLEConnectionUpdateCompleteResults; struct BluetoothHCIEventLEConnectionUpdateCompleteResults { BluetoothConnectionHandle connectionHandle; uint16_t connInterval; uint16_t connLatency; uint16_t supervisionTimeout; } __attribute__((packed)); typedef struct BluetoothHCIEventLEReadRemoteUsedFeaturesCompleteResults BluetoothHCIEventLEReadRemoteUsedFeaturesCompleteResults; struct BluetoothHCIEventLEReadRemoteUsedFeaturesCompleteResults { BluetoothConnectionHandle connectionHandle; BluetoothHCISupportedFeatures usedFeatures; } __attribute__((packed)); typedef struct BluetoothHCIEventDisconnectionCompleteResults BluetoothHCIEventDisconnectionCompleteResults; struct BluetoothHCIEventDisconnectionCompleteResults { BluetoothConnectionHandle connectionHandle; BluetoothReasonCode reason; }; typedef struct BluetoothHCIEventReadSupportedFeaturesResults BluetoothHCIEventReadSupportedFeaturesResults; struct BluetoothHCIEventReadSupportedFeaturesResults { BluetoothConnectionHandle connectionHandle; BluetoothHCISupportedFeatures supportedFeatures; }; typedef struct BluetoothHCIEventReadExtendedFeaturesResults BluetoothHCIEventReadExtendedFeaturesResults; struct BluetoothHCIEventReadExtendedFeaturesResults { BluetoothConnectionHandle connectionHandle; BluetoothHCIExtendedFeaturesInfo supportedFeaturesInfo; }; typedef struct BluetoothHCIEventReadRemoteVersionInfoResults BluetoothHCIEventReadRemoteVersionInfoResults; struct BluetoothHCIEventReadRemoteVersionInfoResults { BluetoothConnectionHandle connectionHandle; BluetoothLMPVersion lmpVersion; BluetoothManufacturerName manufacturerName; BluetoothLMPSubversion lmpSubversion; }; typedef struct BluetoothHCIEventRemoteNameRequestResults BluetoothHCIEventRemoteNameRequestResults; struct BluetoothHCIEventRemoteNameRequestResults { BluetoothDeviceAddress deviceAddress; BluetoothDeviceName deviceName; }; typedef struct BluetoothHCIEventReadClockOffsetResults BluetoothHCIEventReadClockOffsetResults; struct BluetoothHCIEventReadClockOffsetResults { BluetoothConnectionHandle connectionHandle; BluetoothClockOffset clockOffset; }; typedef struct BluetoothHCIEventConnectionRequestResults BluetoothHCIEventConnectionRequestResults; struct BluetoothHCIEventConnectionRequestResults { BluetoothDeviceAddress deviceAddress; BluetoothClassOfDevice classOfDevice; BluetoothLinkType linkType; }; typedef struct BluetoothHCIEventLinkKeyNotificationResults BluetoothHCIEventLinkKeyNotificationResults; struct BluetoothHCIEventLinkKeyNotificationResults { BluetoothDeviceAddress deviceAddress; BluetoothKey linkKey; BluetoothKeyType keyType; }; typedef struct BluetoothHCIEventMaxSlotsChangeResults BluetoothHCIEventMaxSlotsChangeResults; struct BluetoothHCIEventMaxSlotsChangeResults { BluetoothConnectionHandle connectionHandle; BluetoothMaxSlots maxSlots; }; typedef struct BluetoothHCIEventModeChangeResults BluetoothHCIEventModeChangeResults; struct BluetoothHCIEventModeChangeResults { BluetoothConnectionHandle connectionHandle; BluetoothHCIConnectionMode mode; BluetoothHCIModeInterval modeInterval; }; typedef struct BluetoothHCIEventReturnLinkKeysResults BluetoothHCIEventReturnLinkKeysResults; struct BluetoothHCIEventReturnLinkKeysResults { uint8_t numLinkKeys; struct { BluetoothDeviceAddress deviceAddress; BluetoothKey linkKey; } linkKeys[1]; }; typedef struct BluetoothHCIEventAuthenticationCompleteResults BluetoothHCIEventAuthenticationCompleteResults; struct BluetoothHCIEventAuthenticationCompleteResults { BluetoothConnectionHandle connectionHandle; }; typedef struct BluetoothHCIEventEncryptionChangeResults BluetoothHCIEventEncryptionChangeResults; struct BluetoothHCIEventEncryptionChangeResults { BluetoothConnectionHandle connectionHandle; BluetoothEncryptionEnable enable; }; typedef struct BluetoothHCIEventChangeConnectionLinkKeyCompleteResults BluetoothHCIEventChangeConnectionLinkKeyCompleteResults; struct BluetoothHCIEventChangeConnectionLinkKeyCompleteResults { BluetoothConnectionHandle connectionHandle; }; typedef struct BluetoothHCIEventMasterLinkKeyCompleteResults BluetoothHCIEventMasterLinkKeyCompleteResults; struct BluetoothHCIEventMasterLinkKeyCompleteResults { BluetoothConnectionHandle connectionHandle; BluetoothKeyFlag keyFlag; }; typedef struct BluetoothHCIEventQoSSetupCompleteResults BluetoothHCIEventQoSSetupCompleteResults; struct BluetoothHCIEventQoSSetupCompleteResults { BluetoothConnectionHandle connectionHandle; BluetoothHCIQualityOfServiceSetupParams setupParams; }; typedef struct BluetoothHCIEventHardwareErrorResults BluetoothHCIEventHardwareErrorResults; struct BluetoothHCIEventHardwareErrorResults { BluetoothHCIStatus error; }; typedef struct BluetoothHCIEventFlushOccurredResults BluetoothHCIEventFlushOccurredResults; struct BluetoothHCIEventFlushOccurredResults { BluetoothConnectionHandle connectionHandle; }; typedef struct BluetoothHCIEventRoleChangeResults BluetoothHCIEventRoleChangeResults; struct BluetoothHCIEventRoleChangeResults { BluetoothConnectionHandle connectionHandle; BluetoothDeviceAddress deviceAddress; BluetoothRole role; }; typedef struct BluetoothHCIEventDataBufferOverflowResults BluetoothHCIEventDataBufferOverflowResults; struct BluetoothHCIEventDataBufferOverflowResults { BluetoothLinkType linkType; }; typedef struct BluetoothHCIEventConnectionPacketTypeResults BluetoothHCIEventConnectionPacketTypeResults; struct BluetoothHCIEventConnectionPacketTypeResults { BluetoothConnectionHandle connectionHandle; BluetoothPacketType packetType; }; typedef struct BluetoothHCIEventReadRemoteSupportedFeaturesResults BluetoothHCIEventReadRemoteSupportedFeaturesResults; struct BluetoothHCIEventReadRemoteSupportedFeaturesResults { BluetoothHCIStatus error; BluetoothConnectionHandle connectionHandle; BluetoothHCISupportedFeatures lmpFeatures; }; typedef struct BluetoothHCIEventReadRemoteExtendedFeaturesResults BluetoothHCIEventReadRemoteExtendedFeaturesResults; struct BluetoothHCIEventReadRemoteExtendedFeaturesResults { BluetoothHCIStatus error; BluetoothConnectionHandle connectionHandle; BluetoothHCIPageNumber page; BluetoothHCIPageNumber maxPage; BluetoothHCISupportedFeatures lmpFeatures; }; typedef struct BluetoothHCIEventQoSViolationResults BluetoothHCIEventQoSViolationResults; struct BluetoothHCIEventQoSViolationResults { BluetoothConnectionHandle connectionHandle; }; typedef struct BluetoothHCIEventPageScanModeChangeResults BluetoothHCIEventPageScanModeChangeResults; struct BluetoothHCIEventPageScanModeChangeResults { BluetoothDeviceAddress deviceAddress; BluetoothPageScanMode pageScanMode; }; typedef struct BluetoothHCIEventPageScanRepetitionModeChangeResults BluetoothHCIEventPageScanRepetitionModeChangeResults; struct BluetoothHCIEventPageScanRepetitionModeChangeResults { BluetoothDeviceAddress deviceAddress; BluetoothPageScanRepetitionMode pageScanRepetitionMode; }; typedef struct BluetoothHCIEventVendorSpecificResults BluetoothHCIEventVendorSpecificResults; struct BluetoothHCIEventVendorSpecificResults { uint8_t length; uint8_t data[255]; }; typedef struct BluetoothHCIEventEncryptionKeyRefreshCompleteResults BluetoothHCIEventEncryptionKeyRefreshCompleteResults; struct BluetoothHCIEventEncryptionKeyRefreshCompleteResults { BluetoothConnectionHandle connectionHandle; }; typedef struct BluetoothHCIEventSniffSubratingResults BluetoothHCIEventSniffSubratingResults; struct BluetoothHCIEventSniffSubratingResults { BluetoothConnectionHandle connectionHandle; uint16_t maxTransmitLatency; uint16_t maxReceiveLatency; uint16_t minRemoteTimeout; uint16_t minLocalTimeout; }; // LE Meta Events typedef struct BluetoothHCIEventLEMetaResults BluetoothHCIEventLEMetaResults; struct BluetoothHCIEventLEMetaResults { uint8_t length; uint8_t data[255]; }; typedef struct BluetoothHCIEventLELongTermKeyRequestResults BluetoothHCIEventLELongTermKeyRequestResults; struct BluetoothHCIEventLELongTermKeyRequestResults { BluetoothConnectionHandle connectionHandle; uint8_t randomNumber[8]; uint16_t ediv; }; #define kNoNotifyProc NULL #define kNoUserRefCon NULL typedef struct BluetoothHCIRequestCallbackInfo BluetoothHCIRequestCallbackInfo; struct BluetoothHCIRequestCallbackInfo { mach_vm_address_t userCallback; // Proc to call when async handler is called. mach_vm_address_t userRefCon; // For user's info. mach_vm_address_t internalRefCon; // For our purposes. mach_vm_address_t asyncIDRefCon; // For our aync calls. mach_vm_address_t reserved; // For the future. Currently Unused. }; // Error codes enum { kBluetoothHCIErrorSuccess = 0x00, kBluetoothHCIErrorUnknownHCICommand = 0x01, kBluetoothHCIErrorNoConnection = 0x02, kBluetoothHCIErrorHardwareFailure = 0x03, kBluetoothHCIErrorPageTimeout = 0x04, kBluetoothHCIErrorAuthenticationFailure = 0x05, kBluetoothHCIErrorKeyMissing = 0x06, kBluetoothHCIErrorMemoryFull = 0x07, kBluetoothHCIErrorConnectionTimeout = 0x08, kBluetoothHCIErrorMaxNumberOfConnections = 0x09, kBluetoothHCIErrorMaxNumberOfSCOConnectionsToADevice = 0x0A, kBluetoothHCIErrorACLConnectionAlreadyExists = 0x0B, kBluetoothHCIErrorCommandDisallowed = 0x0C, kBluetoothHCIErrorHostRejectedLimitedResources = 0x0D, kBluetoothHCIErrorHostRejectedSecurityReasons = 0x0E, kBluetoothHCIErrorHostRejectedRemoteDeviceIsPersonal = 0x0F, kBluetoothHCIErrorHostTimeout = 0x10, kBluetoothHCIErrorUnsupportedFeatureOrParameterValue = 0x11, kBluetoothHCIErrorInvalidHCICommandParameters = 0x12, kBluetoothHCIErrorOtherEndTerminatedConnectionUserEnded = 0x13, kBluetoothHCIErrorOtherEndTerminatedConnectionLowResources = 0x14, kBluetoothHCIErrorOtherEndTerminatedConnectionAboutToPowerOff = 0x15, kBluetoothHCIErrorConnectionTerminatedByLocalHost = 0x16, kBluetoothHCIErrorRepeatedAttempts = 0x17, kBluetoothHCIErrorPairingNotAllowed = 0x18, kBluetoothHCIErrorUnknownLMPPDU = 0x19, kBluetoothHCIErrorUnsupportedRemoteFeature = 0x1A, kBluetoothHCIErrorSCOOffsetRejected = 0x1B, kBluetoothHCIErrorSCOIntervalRejected = 0x1C, kBluetoothHCIErrorSCOAirModeRejected = 0x1D, kBluetoothHCIErrorInvalidLMPParameters = 0x1E, kBluetoothHCIErrorUnspecifiedError = 0x1F, kBluetoothHCIErrorUnsupportedLMPParameterValue = 0x20, kBluetoothHCIErrorRoleChangeNotAllowed = 0x21, kBluetoothHCIErrorLMPResponseTimeout = 0x22, kBluetoothHCIErrorLMPErrorTransactionCollision = 0x23, kBluetoothHCIErrorLMPPDUNotAllowed = 0x24, kBluetoothHCIErrorEncryptionModeNotAcceptable = 0x25, // Added Core Spec, v1.1 kBluetoothHCIErrorUnitKeyUsed = 0x26, // 1.1 kBluetoothHCIErrorQoSNotSupported = 0x27, // 1.1 kBluetoothHCIErrorInstantPassed = 0x28, // 1.1 kBluetoothHCIErrorPairingWithUnitKeyNotSupported = 0x29, // 1.1 kBluetoothHCIErrorHostRejectedUnacceptableDeviceAddress = 0x0F, // 2.0+ kBluetoothHCIErrorDifferentTransactionCollision = 0x2A, // 1.2 kBluetoothHCIErrorQoSUnacceptableParameter = 0x2C, // 1.2 kBluetoothHCIErrorQoSRejected = 0x2D, // 1.2 kBluetoothHCIErrorChannelClassificationNotSupported = 0x2E, // 1.2 kBluetoothHCIErrorInsufficientSecurity = 0x2F, // 1.2 kBluetoothHCIErrorParameterOutOfMandatoryRange = 0x30, // 1.2 kBluetoothHCIErrorRoleSwitchPending = 0x31, // 1.2 kBluetoothHCIErrorReservedSlotViolation = 0x34, // 1.2 kBluetoothHCIErrorRoleSwitchFailed = 0x35, // 1.2 kBluetoothHCIErrorExtendedInquiryResponseTooLarge = 0x36, // 2.1 kBluetoothHCIErrorSecureSimplePairingNotSupportedByHost = 0x37, // 2.1 kBluetoothHCIErrorHostBusyPairing = 0x38, kBluetoothHCIErrorConnectionRejectedDueToNoSuitableChannelFound = 0x39, kBluetoothHCIErrorControllerBusy = 0x3A, kBluetoothHCIErrorUnacceptableConnectionInterval = 0x3B, kBluetoothHCIErrorDirectedAdvertisingTimeout = 0x3C, kBluetoothHCIErrorConnectionTerminatedDueToMICFailure = 0x3D, kBluetoothHCIErrorConnectionFailedToBeEstablished = 0x3E, kBluetoothHCIErrorMACConnectionFailed = 0x3F, kBluetoothHCIErrorCoarseClockAdjustmentRejected = 0x40, kBluetoothHCIErrorMax = 0x40 }; #if 0 #pragma mark === HCI Power Mode === #endif //=========================================================================================================================== // HCI Power Mode //=========================================================================================================================== typedef enum { kBluetoothHCIPowerStateON = 0x01, kBluetoothHCIPowerStateOFF = 0x00, kBluetoothHCIPowerStateUnintialized = 0xFF, } BluetoothHCIPowerState; enum { kBluetoothHCIErrorPowerIsOFF = (kBluetoothHCIErrorMax + 1) }; #if 0 #pragma mark === HCI USB Transport === #endif //=========================================================================================================================== // HCI USB Transport //=========================================================================================================================== //--------------------------------------------------------------------------------------------------------------------------- /*! @enum BluetoothHCIUSBDeviceMatchingConstants @abstract Bluetooth USB device matching constants @constant kBluetoothHCITransportUSBClassCode Wireless Controller @constant kBluetoothHCITransportUSBSubClassCode RF Controller @constant kBluetoothHCITransportUSBProtocolCode Bluetooth Programming */ enum { kBluetoothHCITransportUSBClassCode = 0xE0, kBluetoothHCITransportUSBSubClassCode = 0x01, kBluetoothHCITransportUSBProtocolCode = 0x01 }; #if 0 #pragma mark === TCI - L2CAP === #endif //=========================================================================================================================== // TCI - L2CAP //=========================================================================================================================== enum { kBluetoothL2CAPTCIEventIDReserved = 0x00, kBluetoothL2CAPTCIEventIDL2CA_ConnectInd = 0x01, kBluetoothL2CAPTCIEventIDL2CA_ConfigInd = 0x02, kBluetoothL2CAPTCIEventIDL2CA_DisconnectInd = 0x03, kBluetoothL2CAPTCIEventIDL2CA_QoSViolationInd = 0x04, kBluetoothL2CAPTCIEventIDL2CA_TimeOutInd = 0x05 }; enum { kBluetoothL2CAPTCICommandReserved = 0x0000, kBluetoothL2CAPTCICommandL2CA_ConnectReq = 0x0001, kBluetoothL2CAPTCICommandL2CA_DisconnectReq = 0x0002, kBluetoothL2CAPTCICommandL2CA_ConfigReq = 0x0003, kBluetoothL2CAPTCICommandL2CA_DisableCLT = 0x0004, kBluetoothL2CAPTCICommandL2CA_EnableCLT = 0x0005, kBluetoothL2CAPTCICommandL2CA_GroupCreate = 0x0006, kBluetoothL2CAPTCICommandL2CA_GroupClose = 0x0007, kBluetoothL2CAPTCICommandL2CA_GroupAddMember = 0x0008, kBluetoothL2CAPTCICommandL2CA_GroupRemoveMember = 0x0009, kBluetoothL2CAPTCICommandL2CA_GroupMembership = 0x000A, kBluetoothL2CAPTCICommandL2CA_WriteData = 0x000B, kBluetoothL2CAPTCICommandL2CA_ReadData = 0x000C, kBluetoothL2CAPTCICommandL2CA_Ping = 0x000D, kBluetoothL2CAPTCICommandL2CA_GetInfo = 0x000E, kBluetoothL2CAPTCICommandL2CA_Reserved1 = 0x000F, kBluetoothL2CAPTCICommandL2CA_Reserved2 = 0x0010, kBluetoothL2CAPTCICommandL2CA_ConnectResp = 0x0011, kBluetoothL2CAPTCICommandL2CA_DisconnectResp = 0x0012, kBluetoothL2CAPTCICommandL2CA_ConfigResp = 0x0013 }; #if 0 #pragma mark - #pragma mark === RFCOMM === #endif //=========================================================================================================================== // RFCOMM //=========================================================================================================================== #define kMaxChannelIDPerSide 31 typedef uint8_t BluetoothRFCOMMChannelID; #define RFCOMM_CHANNEL_ID_IS_VALID( CHANNEL ) (( CHANNEL >= 1 ) && ( CHANNEL <= 30 )) typedef uint16_t BluetoothRFCOMMMTU; typedef enum BluetoothRFCOMMParityType { kBluetoothRFCOMMParityTypeNoParity = 0, kBluetoothRFCOMMParityTypeOddParity, kBluetoothRFCOMMParityTypeEvenParity, kBluetoothRFCOMMParityTypeMaxParity } BluetoothRFCOMMParityType; typedef enum BluetoothRFCOMMLineStatus { BluetoothRFCOMMLineStatusNoError = 0, BluetoothRFCOMMLineStatusOverrunError, BluetoothRFCOMMLineStatusParityError, BluetoothRFCOMMLineStatusFramingError } BluetoothRFCOMMLineStatus; #if 0 #pragma mark - #pragma mark === SDP === #endif //=========================================================================================================================== // SDP //=========================================================================================================================== typedef uint8_t BluetoothSDPPDUID; enum { kBluetoothSDPPDUIDReserved = 0, kBluetoothSDPPDUIDErrorResponse = 1, kBluetoothSDPPDUIDServiceSearchRequest = 2, kBluetoothSDPPDUIDServiceSearchResponse = 3, kBluetoothSDPPDUIDServiceAttributeRequest = 4, kBluetoothSDPPDUIDServiceAttributeResponse = 5, kBluetoothSDPPDUIDServiceSearchAttributeRequest = 6, kBluetoothSDPPDUIDServiceSearchAttributeResponse = 7 }; #define IS_REQUEST_PDU( _pduID ) ( ( _pduID == kBluetoothSDPPDUIDServiceSearchRequest ) || \ ( _pduID == kBluetoothSDPPDUIDServiceAttributeRequest ) || \ ( _pduID == kBluetoothSDPPDUIDServiceSearchAttributeRequest ) ) #define IS_RESPONSE_PDU( _pduID ) ( ( _pduID == kBluetoothSDPPDUIDErrorResponse ) || \ ( _pduID == kBluetoothSDPPDUIDServiceSearchResponse ) || \ ( _pduID == kBluetoothSDPPDUIDServiceAttributeResponse ) || \ ( _pduID == kBluetoothSDPPDUIDServiceSearchAttributeResponse ) ) typedef uint16_t BluetoothSDPErrorCode; enum { kBluetoothSDPErrorCodeSuccess = 0x0000, kBluetoothSDPErrorCodeReserved = 0x0000, kBluetoothSDPErrorCodeInvalidSDPVersion = 0x0001, kBluetoothSDPErrorCodeInvalidServiceRecordHandle = 0x0002, kBluetoothSDPErrorCodeInvalidRequestSyntax = 0x0003, kBluetoothSDPErrorCodeInvalidPDUSize = 0x0004, kBluetoothSDPErrorCodeInvalidContinuationState = 0x0005, kBluetoothSDPErrorCodeInsufficientResources = 0x0006, kBluetoothSDPErrorCodeReservedStart = 0x0007, kBluetoothSDPErrorCodeReservedEnd = 0xFFFF }; typedef uint16_t BluetoothSDPTransactionID; typedef uint32_t BluetoothSDPServiceRecordHandle; enum { kBluetoothSDPDataElementTypeNil = 0, kBluetoothSDPDataElementTypeUnsignedInt = 1, kBluetoothSDPDataElementTypeSignedInt = 2, kBluetoothSDPDataElementTypeUUID = 3, kBluetoothSDPDataElementTypeString = 4, kBluetoothSDPDataElementTypeBoolean = 5, kBluetoothSDPDataElementTypeDataElementSequence = 6, kBluetoothSDPDataElementTypeDataElementAlternative = 7, kBluetoothSDPDataElementTypeURL = 8, kBluetoothSDPDataElementTypeReservedStart = 9, kBluetoothSDPDataElementTypeReservedEnd = 31 }; typedef uint16_t BluetoothSDPUUID16; typedef uint32_t BluetoothSDPUUID32; typedef uint8_t BluetoothSDPDataElementTypeDescriptor; typedef uint8_t BluetoothSDPDataElementSizeDescriptor; typedef uint16_t BluetoothSDPServiceAttributeID; #if 0 #pragma mark - #pragma mark === LE === #endif typedef enum { BluetoothLEScanTypePassive = 0x00, BluetoothLEScanTypeActive = 0x01 } BluetoothLEScanType; typedef enum { BluetoothLEAddressTypePublic = 0x00, BluetoothLEAddressTypeRandom = 0x01 } BluetoothLEAddressType; typedef enum { BluetoothLEScanFilterNone = 0x00, BluetoothLEScanFilterSafelist = 0x01, BluetoothLEScanFilterWhitelist __attribute__ ((deprecated)) = BluetoothLEScanFilterSafelist } BluetoothLEScanFilter; typedef enum { BluetoothLEScanDisable = 0x00, BluetoothLEScanEnable = 0x01 } BluetoothLEScan; typedef enum { BluetoothLEConnectionIntervalMin = 0x06, BluetoothLEConnectionIntervalMax = 0x0C80 } BluetoothLEConnectionInterval; typedef enum { BluetoothLEScanDuplicateFilterDisable = 0x00, BluetoothLEScanDuplicateFilterEnable = 0x01, } BluetoothLEScanDuplicateFilter; typedef enum { BluetoothLEAdvertisingTypeConnectableUndirected = 0x00, BluetoothLEAdvertisingTypeConnectableDirected = 0x01, BluetoothLEAdvertisingTypeDiscoverableUndirected = 0x02, BluetoothLEAdvertisingTypeNonConnectableUndirected = 0x03, BluetoothLEAdvertisingTypeScanResponse = 0x04 } BluetoothLEAdvertisingType; #ifdef __cplusplus } #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/bluetooth/IOBluetoothHIDDriver.h
/* File: IOBluetoothHIDDriver.h Contains: Driver for generic Bluetooth HID devices. Copyright: (c) 2001-2008 by Apple, all rights reserved. */ #ifndef IOBLUETOOTHHIDDRIVER_H #define IOBLUETOOTHHIDDRIVER_H #import <IOKit/hid/IOHIDDevice.h> #import <IOKit/bluetooth/Bluetooth.h> #import "IOKit/pwr_mgt/RootDomain.h" //=========================================================================================================================== // Macros //=========================================================================================================================== #define kBSKernelMonitor2Notification 'bsk2' //=========================================================================================================================== // Forwards //=========================================================================================================================== class IOTimerEventSource; class IOWorkLoop; class IOBluetoothL2CAPChannel; class IOBluetoothDevice; class IOWorkQueue; //=========================================================================================================================== // IOBluetoothHIDDriver //=========================================================================================================================== class IOBluetoothHIDDriver : public IOHIDDevice { OSDeclareDefaultStructors( IOBluetoothHIDDriver ) IOWorkLoop* _workLoop; IOCommandGate* _commandGate; IOWorkQueue *_desyncWorkQueue; IOBluetoothL2CAPChannel* _controlChannel; IOBluetoothL2CAPChannel* _interruptChannel; IOBluetoothDevice* _device; IOMemoryDescriptor* _memDescriptor; IOMemoryDescriptor* _getReportDescriptor; IONotifier* _interruptOpenNotification; IOTimerEventSource* _timer; IONotifier* _sleepWakeNotifier; bool _deviceReady; UInt8 _expectedReportID; UInt8 _expectedReportType; UInt8 _handshake; OSDictionary* _deviceProperties; UInt16 _vendorIDSource; UInt16 _vendorID; UInt16 _productID; UInt16 _deviceVersion; uint32_t _classOfDevice; UInt16 _countryCode; BluetoothDeviceAddress _deviceAddress; char _deviceAddressString[20]; uint32_t _outstandingIO; bool _sendOutstanding; // Debug / Behavior Modifiers UInt8 _verboseLevel; bool _logPackets; bool _decodePackets; bool _logOutstandingIO; bool _suppressDisconnectNotifications; bool _suppressSetProtocol; bool _driverIsAwake; bool _reservedFlag4; UInt8 _reservedByte; struct ExpansionData { OSArray* _sendQueue; uint8_t *interruptBuffer; uint32_t interruptBufferUsed; uint8_t *controlBuffer; uint32_t controlBufferUsed; uint8_t deviceSupportsSuspend; uint32_t getReportTimeoutMS; uint32_t setReportTimeoutMS; uint32_t outstandingMemoryBlockCount; bool waitingForMemoryBlockCount; IOPMrootDomain * fRootDomain; IOPMDriverAssertionID fNoDeepSleepAssertionId; bool mCommandGateCreated; bool mCommandGateAdded; bool mControlChannelRetained; bool mWorkLoopRetained; bool mCloseDownServicesCalled; bool mGotNoDeepSleepAssertionID; OSString* disconnectionNotificationString; OSString* connectionNotificationString; IOTimerEventSource* deviceConnectTimer; bool mNeedToDropData; UInt32 mWakeTime; UInt32 mDriverLoadTime; IOTimerEventSource* mReadyToSleepTimer; bool mHandleStopBeingCalled; bool mHandleStartCompleted; bool mHIDSuspendSent; IOReturn mExitHIDSuspendResult; bool mPrintDebug; IOTimerEventSource* mPrintDebugTimer; UInt32 mPrintDebugDuration; uint32_t mCanSendData; bool mReturnDeviceError; UInt8 mHandshakeTimeoutCounter; bool mUseLongTimeout; }; ExpansionData *_expansionData; public: // Standard IOService Methods virtual IOService* probe( IOService * provider, SInt32 * score ); virtual bool init( OSDictionary *properties ); virtual void free(void); virtual bool willTerminate( IOService * provider, IOOptionBits options ); // Starting & Stopping virtual bool handleStart( IOService * provider ); virtual void handleStop( IOService * provider ); virtual void deviceReady(void); virtual void closeDownServices(void); // Power Management virtual void handleSleep(void); virtual void handleWake(void); virtual void handleShutdown(void); // Does nothing virtual void handleRestart(void); // Does nothing // HID Properties virtual OSString* newTransportString(void) const; virtual OSString* newManufacturerString(void) const; virtual OSString* newProductString(void) const; virtual OSNumber* newVendorIDSourceNumber(void) const; virtual OSNumber* newVendorIDNumber(void) const; virtual OSNumber* newProductIDNumber(void) const; virtual OSNumber* newVersionNumber(void) const; virtual IOReturn newReportDescriptor( IOMemoryDescriptor ** descriptor ) const; virtual OSString* newSerialNumberString(void) const; virtual OSNumber* newLocationIDNumber(void) const; virtual OSNumber* newCountryCodeNumber(void) const; virtual OSNumber* newReportIntervalNumber(void) const; // Main UserLand Entry Points virtual IOReturn getReport( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options = 0 ); virtual IOReturn setReport( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options = 0 ); virtual IOReturn setProperties( OSObject* properties ); // General IO virtual IOReturn sendData( IOBluetoothL2CAPChannel* theChannel, void* theData, IOByteCount theSize ); virtual void processControlData( UInt8 *buffer, UInt16 length ); virtual void processInterruptData( UInt8 *buffer, UInt16 length ); virtual IOReturn waitForData( IOMemoryDescriptor* report, UInt8 btReportType, UInt8 reportID ); virtual IOReturn waitForHandshake(void); // HID Transaction Methods virtual IOReturn hidControl( UInt8 controlOperation ); virtual int getProtocol(void); virtual IOReturn setProtocol( UInt8 protocol ); virtual int getIdle(void); virtual IOReturn setIdle( UInt8 idleRate ); // Device Introspection virtual bool isKeyboard(void); virtual bool isMouse(void); // Misc virtual IOReturn setPowerState( unsigned long powerStateOrdinal, IOService* whatDevice ); virtual IOReturn createCommandGate( IOService* provider ); virtual IOReturn getDeviceProperties( IOService* provider ); virtual bool readDeviceName(void); // Command Gate Actions static IOReturn staticCloseDownServicesAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 ); static IOReturn staticSendToAction( OSObject* owner, void* theChannel, void* theData, void *theSize, void* arg4); static IOReturn staticPrepControlChannelAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 ); static IOReturn staticInterruptChannelOpeningAction( OSObject* owner, void* newService, void* arg2, void* arg3, void* arg4 ); static IOReturn staticWillTerminateAction( OSObject* owner, void* arg1, void* arg2, void* arg3, void* arg4 ); // Work Loop Methods virtual void closeDownServicesWL(void); virtual IOReturn prepInterruptChannelWL(void); virtual IOReturn getReportWL( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options ); virtual IOReturn setReportWL( IOMemoryDescriptor* report, IOHIDReportType reportType, IOOptionBits options ); virtual IOReturn processCommandWL( OSString* command, OSNumber* commandParameter ); virtual IOReturn getDevicePropertiesWL( IOService* provider ); virtual IOReturn interruptChannelOpeningWL( IOBluetoothL2CAPChannel* theChannel ); // Timeout Handler static void deviceConnectTimerFired( OSObject* owner, IOTimerEventSource* sender ); static void timerFired( OSObject* owner, IOTimerEventSource* sender ); virtual void handleTimeout(void); // IO Counting virtual void incrementOutstandingIO(void); virtual void decrementOutstandingIO(void); // ReadyToSleepTimeout Handler static void ReadyToSleepTimerFired( OSObject* owner, IOTimerEventSource* sender ); // mPrintDebugTimer Handler static void debugPrintTimerFired( OSObject* owner, IOTimerEventSource* sender ); private: // Lazy Interrupt Channel Methods static bool interruptChannelOpeningCallback( void* me, void* ignoreMe, IOService* newService, IONotifier *notifier ); static IOReturn powerStateHandler( void *target, void *refCon, UInt32 messageType, IOService *service, void *messageArgument, vm_size_t argSize ); static UInt32 ConvertAddressToUInt32 (void * address); public: OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 0 ); virtual void sendDeviceDisconnectNotifications( void ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 1 ); virtual IOReturn setPowerStateWL( unsigned long powerStateOrdinal, IOService* whatDevice ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 2 ); virtual void sendDeviceConnectNotifications( void ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 3 ); virtual void decrementOutstandingMemoryBlockCount( void ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 4 ); virtual IOReturn willTerminateWL( void ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 5 ); virtual void messageClientsWithString( UInt32 type, OSString* message ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 6 ); virtual void waitForInterruptChannel( void ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 7 ); virtual void handleStopWL( IOService * provider ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 8 ); virtual UInt32 GetCurrentTime( void ); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 9 ); virtual void handleReadyToSleepTimerFired(void); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 10 ); virtual IOReturn HIDCommandSleep (void * event, UInt32 milliseconds, char * calledByFunction, bool panicMachine); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 11 ); virtual void SuppressConnectionLostNotification(void); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 12 ); virtual void handleDebugPrintTimerFired(void); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 13 ); virtual void DeviceTerminated(void); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 14 ); virtual IOReturn waitForOkToSend(void); OSMetaClassDeclareReservedUsed( IOBluetoothHIDDriver, 15 ); virtual void processOkToSendNotification(void); OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 16 ); OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 17 ); OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 18 ); OSMetaClassDeclareReservedUnused( IOBluetoothHIDDriver, 19 ); }; #endif // IOBLUETOOTHHIDDRIVER_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/bluetooth/IOBluetoothTypes.h
/* File: IOBluetoothTypes.h Copyright: � 2010 by Apple Inc. All rights reserved. */ #pragma once #import <IOKit/IOReturn.h> // Error returns #ifndef sub_iokit_bluetooth #define sub_iokit_bluetooth err_sub(8) #endif #define iokit_bluetooth_err(return) (sys_iokit|sub_iokit_bluetooth|return) #define kIOBluetoothDeviceResetError iokit_bluetooth_err(1) // Device reset interrupted pending operation #define kIOBluetoothConnectionAlreadyExists iokit_bluetooth_err(2) // Attempting to open a connection that already exists #define kIOBluetoothNoHCIController iokit_bluetooth_err(3) // No HCI controller is present #define kIOBluetoothHCIPowerStatesNotSupported iokit_bluetooth_err(4) // HCI controller does not support changing power states
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/bluetooth/IOBluetoothHIDDriverTypes.h
/* File: IOBluetoothHIDDriverTypes.h Contains: Type defined for the IOBluetoothHIDDriver.h. Copyright: (c) 2001-2008 by Apple, all rights reserved. */ #ifndef IOBLUETOOTHHIDDRIVERTYPES_H #define IOBLUETOOTHHIDDRIVERTYPES_H // Vendor ID Sources //------------------ #define kVendorIDSourceBluetoothSIG 0x1 #define kVendorIDSourceUSBIF 0x2 // Bluetooth HID Transaction Headers //---------------------------------- #define IOBTHID_HANDSHAKE_HEADER 0x00 #define IOBTHID_HID_CONTROL_HEADER 0x10 #define IOBTHID_GET_REPORT_HEADER 0x40 #define IOBTHID_SET_REPORT_HEADER 0x50 #define IOBTHID_GET_PROTOCOL_HEADER 0x60 #define IOBTHID_SET_PROTOCOL_HEADER 0x70 #define IOBTHID_GET_IDLE_HEADER 0x80 #define IOBTHID_SET_IDLE_HEADER 0x90 #define IOBTHID_DATA_HEADER 0xA0 #define IOBTHID_DATC_HEADER 0xB0 // Handshake Types //---------------- #define IOBTHID_HANDSHAKE_SUCCESSFUL 0x0 #define IOBTHID_HANDSHAKE_NOT_READY 0x1 #define IOBTHID_HANDSHAKE_INVALID_REPORT_ID 0x2 #define IOBTHID_HANDSHAKE_UNSUPPORTED_REQUEST 0x3 #define IOBTHID_HANDSHAKE_INVALID_PARAMETER 0x4 #define IOBTHID_HANDSHAKE_ERR_UNKNOWN 0xD #define IOBTHID_HANDSHAKE_ERR_FATAL 0xF // HID_Control Types //------------------ #define IOBTHID_CONTROL_NOP 0x0 #define IOBTHID_CONTROL_HARD_RESET 0x1 #define IOBTHID_CONTROL_SOFT_RESET 0x2 #define IOBTHID_CONTROL_SUSPEND 0x3 #define IOBTHID_CONTROL_EXIT_SUSPEND 0x4 #define IOBTHID_CONTROL_VC_UNPLUG 0x5 // Protocol Types //--------------- #define IOBTHID_BOOT_PROTOCOL 0x0 #define IOBTHID_REPORT_PROTOCOL 0x1 // Report Types //------------- #define IOBTHID_RESERVED_REPORT 0x0 #define IOBTHID_OTHER_REPORT 0x0 #define IOBTHID_INPUT_REPORT 0x1 #define IOBTHID_OUTPUT_REPORT 0x2 #define IOBTHID_FEATURE_REPORT 0x3 #endif // IOBLUETOOTHHIDDRIVERTYPES_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/platform/ApplePlatformExpert.h
/* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_APPLEPLATFORM_H #define _IOKIT_APPLEPLATFORM_H #include <IOKit/IOPlatformExpert.h> enum { kBootROMTypeOldWorld = 0, kBootROMTypeNewWorld }; enum { kChipSetTypePowerSurge = 0, kChipSetTypePowerStar, kChipSetTypeGossamer, kChipSetTypePowerExpress, kChipSetTypeCore99, kChipSetTypeCore2001 }; enum { kMachineTypeUnknown = 0 }; extern const OSSymbol *gGetDefaultBusSpeedsKey; class ApplePlatformExpert : public IODTPlatformExpert { OSDeclareAbstractStructors(ApplePlatformExpert); private: SInt32 _timeToGMT; struct ExpansionData { }; ExpansionData *reserved; public: virtual bool start( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual bool configure( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual const char * deleteList( void ) APPLE_KEXT_OVERRIDE; virtual const char * excludeList( void ) APPLE_KEXT_OVERRIDE; virtual void registerNVRAMController( IONVRAMController * nvram ) APPLE_KEXT_OVERRIDE; virtual long getGMTTimeOfDay(void) APPLE_KEXT_OVERRIDE; virtual void setGMTTimeOfDay(long secs) APPLE_KEXT_OVERRIDE; virtual bool getMachineName(char *name, int maxLength) APPLE_KEXT_OVERRIDE; OSMetaClassDeclareReservedUnused(ApplePlatformExpert, 0); OSMetaClassDeclareReservedUnused(ApplePlatformExpert, 1); OSMetaClassDeclareReservedUnused(ApplePlatformExpert, 2); OSMetaClassDeclareReservedUnused(ApplePlatformExpert, 3); }; #endif /* ! _IOKIT_APPLEPLATFORM_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/platform/AppleMacIODevice.h
/* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_APPLEMACIODEVICE_H #define _IOKIT_APPLEMACIODEVICE_H #include <IOKit/IOService.h> class AppleMacIODevice : public IOService { OSDeclareDefaultStructors(AppleMacIODevice); private: struct ExpansionData { }; ExpansionData *reserved; public: virtual bool compareName( OSString * name, OSString ** matched = 0 ) const APPLE_KEXT_OVERRIDE; virtual IOService *matchLocation(IOService *client) APPLE_KEXT_OVERRIDE; virtual IOReturn getResources( void ) APPLE_KEXT_OVERRIDE; OSMetaClassDeclareReservedUnused(AppleMacIODevice, 0); OSMetaClassDeclareReservedUnused(AppleMacIODevice, 1); OSMetaClassDeclareReservedUnused(AppleMacIODevice, 2); OSMetaClassDeclareReservedUnused(AppleMacIODevice, 3); }; #endif /* ! _IOKIT_APPLEMACIODEVICE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/platform/IOPlatformIO.h
/* * Copyright (c) 2019 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_PLATFORM_IOPLATFORMIO_H #define _IOKIT_PLATFORM_IOPLATFORMIO_H extern "C" { #include <kern/kern_types.h> } #include <IOKit/IOService.h> /*! * @class IOPlatformIO * @abstract The base class for platform I/O drivers, such as AppleARMIO. */ class IOPlatformIO : public IOService { OSDeclareAbstractStructors(IOPlatformIO); public: virtual bool start(IOService * provider) APPLE_KEXT_OVERRIDE; /*! * @function handlePlatformError * @abstract Handler for platform-defined errors. * @discussion If the CPU reports an error that XNU does not know how * to handle, such as a parity error or SError, XNU will * invoke this method if there is an IOPlatformIO * driver loaded. * @param far Fault address provided by the CPU, if any. * @result true if the exception was handled, false if not. */ virtual bool handlePlatformError(vm_offset_t far) = 0; }; #endif /* ! _IOKIT_PLATFORM_IOPLATFORMIO_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/platform/AppleNMI.h
/* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1998-9 Apple Computer, Inc. All rights reserved. * * DRI: Josh de Cesare * */ #ifndef _IOKIT_APPLENMI_H #define _IOKIT_APPLENMI_H #include <IOKit/IOService.h> #include <IOKit/IOInterrupts.h> // NMI Interrupt Constants enum{ kExtInt9_NMIIntSource = 0x800506E0, kNMIIntLevelMask = 0x00004000, kNMIIntMask = 0x00000080 }; class AppleNMI : public IOService { OSDeclareDefaultStructors(AppleNMI); private: bool enable_debugger; bool mask_NMI; struct ExpansionData { }; ExpansionData * reserved; // Reserved for future use public: IOService *rootDomain; virtual bool start(IOService *provider) APPLE_KEXT_OVERRIDE; virtual IOReturn initNMI(IOInterruptController *parentController, OSData *parentSource); virtual IOReturn handleInterrupt(void *refCon, IOService *nub, int source); // Power handling methods: virtual IOReturn powerStateWillChangeTo(IOPMPowerFlags, unsigned long, IOService*) APPLE_KEXT_OVERRIDE; OSMetaClassDeclareReservedUnused(AppleNMI, 0); OSMetaClassDeclareReservedUnused(AppleNMI, 1); OSMetaClassDeclareReservedUnused(AppleNMI, 2); OSMetaClassDeclareReservedUnused(AppleNMI, 3); }; #endif /* ! _IOKIT_APPLENMI_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/platform/AppleMacIO.h
/* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_APPLEMACIO_H #define _IOKIT_APPLEMACIO_H #include <IOKit/IOService.h> #include <IOKit/platform/AppleMacIODevice.h> class AppleMacIO : public IOService { OSDeclareAbstractStructors(AppleMacIO); IOService * fNub; IOMemoryMap * fMemory; struct ExpansionData { }; ExpansionData *fReserved; protected: virtual bool selfTest( void ); public: virtual bool start( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual IOService * createNub( IORegistryEntry * from ); virtual void processNub( IOService * nub ); virtual void publishBelow( IORegistryEntry * root ); virtual const char * deleteList( void ); virtual const char * excludeList( void ); virtual bool compareNubName( const IOService * nub, OSString * name, OSString ** matched = 0 ) const; virtual IOReturn getNubResources( IOService * nub ); OSMetaClassDeclareReservedUnused(AppleMacIO, 0); OSMetaClassDeclareReservedUnused(AppleMacIO, 1); OSMetaClassDeclareReservedUnused(AppleMacIO, 2); OSMetaClassDeclareReservedUnused(AppleMacIO, 3); }; #endif /* ! _IOKIT_APPLEMACIO_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWPHYPacketListener.h
/* * Copyright (c) 2007 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@ */ #ifndef _IOFWPHYPACKETLISTENER_H_ #define _IOFWPHYPACKETLISTENER_H_ #include <libkern/c++/OSObject.h> class IOFireWireController; // Callback when phy packet is received typedef void (*FWPHYPacketCallback)( void *refcon, UInt32 data1, UInt32 data2 ); /*! @class IOFWPHYPacketListener */ class IOFWPHYPacketListener : public OSObject { OSDeclareDefaultStructors( IOFWPHYPacketListener ); friend class IOFireWireController; protected: IOFireWireController * fControl; FWPHYPacketCallback fCallback; void * fRefCon; static IOFWPHYPacketListener * createWithController( IOFireWireController * controller ); virtual bool initWithController( IOFireWireController * control ); virtual void free( void ) APPLE_KEXT_OVERRIDE; public: virtual IOReturn activate( void ); virtual void deactivate( void ); virtual void setCallback( FWPHYPacketCallback callback ); virtual void setRefCon( void * refcon ); virtual void * getRefCon( void ); protected: virtual void processPHYPacket( UInt32 data1, UInt32 data2 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 0 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 1 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 2 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 3 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 4 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 5 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 6 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 7 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 8 ); OSMetaClassDeclareReservedUnused( IOFWPHYPacketListener, 9 ); }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWIsochChannel.h
/* * Copyright (c) 1998-2002 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) 1999-2002 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_IOFWISOCHCHANNEL_H #define _IOKIT_IOFWISOCHCHANNEL_H #include <libkern/c++/OSObject.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> enum { kFWIsochChannelUnknownCondition = 0, kFWIsochChannelNotEnoughBandwidth = 1, kFWIsochChannelChannelNotAvailable = 2 }; class IOFireWireController; class IOFWIsochChannel; class IOFWIsochPort; class OSSet; class IOFWReadQuadCommand; class IOFWCompareAndSwapCommand; /*! @class IOFWIsochChannel */ class IOFWIsochChannel : public OSObject { OSDeclareDefaultStructors(IOFWIsochChannel) public: typedef IOReturn (ForceStopNotificationProc)(void* refCon, IOFWIsochChannel* channel, UInt32 stopCondition ); protected: IOFireWireController * fControl; ForceStopNotificationProc* fStopProc; void * fStopRefCon; IOFWIsochPort * fTalker; OSSet * fListeners; bool fDoIRM; UInt32 fBandwidth; // Allocation units used UInt32 fPacketSize; IOFWSpeed fPrefSpeed; IOFWSpeed fSpeed; // Actual speed used UInt32 fChannel; // Actual channel used IOFWReadQuadCommand * fReadCmd; IOFWCompareAndSwapCommand * fLockCmd; UInt32 fGeneration; // When bandwidth was allocated IOLock * fLock; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; static void threadFunc( void * arg ); virtual IOReturn updateBandwidth(bool claim); virtual void reallocBandwidth( UInt32 generation ); virtual void free() APPLE_KEXT_OVERRIDE; public: // Called from IOFireWireController virtual bool init( IOFireWireController *control, bool doIRM, UInt32 packetSize, IOFWSpeed prefSpeed, ForceStopNotificationProc* stopProc, void *stopRefCon ); virtual void handleBusReset(); // Called by clients virtual IOReturn setTalker(IOFWIsochPort *talker); virtual IOReturn addListener(IOFWIsochPort *listener); virtual IOReturn allocateChannel(); virtual IOReturn releaseChannel(); virtual IOReturn start(); virtual IOReturn stop(); protected: // handles IRM and channel determination and allocation. // called by both user and kernel isoch channels IOReturn allocateChannelBegin( IOFWSpeed speed, UInt64 allowedChans, UInt32 * channel = NULL ) ; // handles IRM and channel allocation. // called by both user and kernel isoch channels IOReturn releaseChannelComplete() ; IOReturn checkMemoryInRange( IOMemoryDescriptor * memory ); private: OSMetaClassDeclareReservedUnused(IOFWIsochChannel, 0); OSMetaClassDeclareReservedUnused(IOFWIsochChannel, 1); OSMetaClassDeclareReservedUnused(IOFWIsochChannel, 2); OSMetaClassDeclareReservedUnused(IOFWIsochChannel, 3); }; typedef IOFWIsochChannel::ForceStopNotificationProc FWIsochChannelForceStopNotificationProc ; typedef IOFWIsochChannel::ForceStopNotificationProc* FWIsochChannelForceStopNotificationProcPtr ; #endif /* ! _IOKIT_IOFWISOCHCHANNEL_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IORemoteConfigDirectory.h
/* * Copyright (c) 1998-2002 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@ */ #ifndef __IOREMOTECONFIGDIRECTORY_H__ #define __IOREMOTECONFIGDIRECTORY_H__ #include <libkern/c++/OSObject.h> #include <IOKit/IOReturn.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> #include <IOKit/firewire/IOConfigDirectory.h> #include "IOFireWireROMCache.h" class OSString; class OSIterator; class IOFireWireDevice; /*! @class IORemoteConfigDirectory */ class IORemoteConfigDirectory : public IOConfigDirectory { OSDeclareDefaultStructors(IORemoteConfigDirectory); protected: IOFireWireROMCache *fROM; // Our cache of the ROM /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; virtual bool initWithOwnerOffset(IOFireWireROMCache *rom, int start, int type); virtual void free(void) APPLE_KEXT_OVERRIDE; virtual const UInt32 *getBase(void) APPLE_KEXT_OVERRIDE; virtual IOConfigDirectory *getSubDir(int start, int type) APPLE_KEXT_OVERRIDE; public: static IOConfigDirectory *withOwnerOffset(IOFireWireROMCache *rom, int start, int type); /*! @function update makes sure that the ROM has at least the specified capacity, and that the ROM is uptodate from its start to at least the specified quadlet offset. @result kIOReturnSuccess if the specified offset is now accessable at romBase[offset]. */ virtual IOReturn update(UInt32 offset, const UInt32 *&romBase) APPLE_KEXT_OVERRIDE; protected: virtual const UInt32 * lockData( void ) APPLE_KEXT_OVERRIDE; virtual void unlockData( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn updateROMCache( UInt32 offset, UInt32 length ) APPLE_KEXT_OVERRIDE; virtual IOReturn checkROMState( void ) APPLE_KEXT_OVERRIDE; private: OSMetaClassDeclareReservedUnused(IORemoteConfigDirectory, 0); OSMetaClassDeclareReservedUnused(IORemoteConfigDirectory, 1); OSMetaClassDeclareReservedUnused(IORemoteConfigDirectory, 2); }; #endif /* __IOREMOTECONFIGDIRECTORY_H__ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireMultiIsochReceive.h
/* * Copyright (c) 2008 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@ */ #ifndef _IOKIT_IOFIREWIREMULTIISOCHRECEIVE_H_ #define _IOKIT_IOFIREWIREMULTIISOCHRECEIVE_H_ class IOFireWireMultiIsochReceiveListener; class IOFireWireMultiIsochReceivePacket; class IOFireWireController; typedef IOReturn (*FWMultiIsochReceiveListenerCallback)(void *refcon, IOFireWireMultiIsochReceivePacket *pPacket); // These are the parameters clients can set which help us to optimize the mult-isoch-receiver // polling interval, and memory resources typedef struct FWMultiIsochReceiveListenerParamsStruct { // How much latency, from when the packet arrives to when the client is notified, can the client tolerate. UInt32 maxLatencyInFireWireCycles; // In bits per second, the expected bit-rate of the incoming stream UInt32 expectedStreamBitRate; // How long does the client expect to hold onto packets objects before returning them back to the receiver UInt32 clientPacketReturnLatencyInFireWireCycles; }FWMultiIsochReceiveListenerParams; /*! @class IOFireWireMultiIsochReceiveListener */ class IOFireWireMultiIsochReceiveListener : public OSObject { friend class IOFireWireLink; protected: OSDeclareDefaultStructors(IOFireWireMultiIsochReceiveListener) bool init(IOFireWireController *fwController, UInt32 receiveChannel, FWMultiIsochReceiveListenerCallback callback, void *pCallbackRefCon, FWMultiIsochReceiveListenerParams *pListenerParams); void free() APPLE_KEXT_OVERRIDE; public: static IOFireWireMultiIsochReceiveListener *create(IOFireWireController *fwController, UInt32 channel, FWMultiIsochReceiveListenerCallback callback, void *pCallbackRefCon, FWMultiIsochReceiveListenerParams *pListenerParams); // Call this to activate the listener IOReturn Activate(); // Call this to deactivate the listener IOReturn Deactivate(); // Call this to modify the callback/refcon pointers. Only call this when not activated! IOReturn SetCallback(FWMultiIsochReceiveListenerCallback callback, void *pCallbackRefCon); // Accessors inline UInt32 getReceiveChannel(void) {return fChannel;}; inline FWMultiIsochReceiveListenerCallback getCallback(void){return fClientCallback;}; inline void * getRefCon(void){return fClientCallbackRefCon;}; inline bool getActivatedState(void) {return fActivated;}; protected: IOFireWireController *fControl; UInt32 fChannel; FWMultiIsochReceiveListenerCallback fClientCallback; void *fClientCallbackRefCon; bool fActivated; FWMultiIsochReceiveListenerParams *fListenerParams; }; #define kMaxRangesPerMultiIsochReceivePacket 6 /*! @class IOFireWireMultiIsochReceivePacket */ class IOFireWireMultiIsochReceivePacket : public OSObject { OSDeclareDefaultStructors(IOFireWireMultiIsochReceivePacket) bool init(IOFireWireController *fwController); void free() APPLE_KEXT_OVERRIDE; public: static IOFireWireMultiIsochReceivePacket *create(IOFireWireController *fwController); // The clients who are passed this packet by the // multi-isoch receiver calling their callback // MUST call clientDone() on this packet to // return it back for reuse! void clientDone(void); UInt32 isochChannel(void); UInt32 packetReceiveTime(void); UInt32 isochPayloadSize(void); // The size of just the isoch payload, not including header/trailer quads. inline UInt32 isochPacketSize(void) {return isochPayloadSize()+8; }; // The size of the packet, including header/trailer quads. // This returns a memory descriptor to the client. The client must call complete(), and release() on the // memory descriptor when done. IOMemoryDescriptor *createMemoryDescriptorForRanges(void); // These should be treated as read-only by clients, // as should the data contained in these buffers! IOAddressRange ranges[kMaxRangesPerMultiIsochReceivePacket] ; UInt32 numRanges; // These should be treated private for clients! // Messing with them will screw up the bookkeepping // in the Multi-Isoch Receiver! UInt32 numClientReferences; void* elements[kMaxRangesPerMultiIsochReceivePacket]; protected: IOFireWireController *fControl; }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWSyncer.h
/* * Copyright (c) 1998-2007 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@ */ #ifndef _IOFWSYNCER_H #define _IOFWSYNCER_H #include <libkern/c++/OSObject.h> #include <IOKit/IOTypes.h> #include <IOKit/IOLocks.h> class IOFWSyncer : public OSObject { OSDeclareDefaultStructors(IOFWSyncer) private: // The spin lock that is used to guard the 'threadMustStop' variable. IOSimpleLock *guardLock; volatile bool threadMustStop; IOReturn fResult; virtual void free() APPLE_KEXT_OVERRIDE; virtual void privateSignal(); public: static IOFWSyncer * create(bool twoRetains = true); virtual bool init(bool twoRetains); virtual void reinit(); virtual IOReturn wait(bool autoRelease = true); virtual void signal(IOReturn res = kIOReturnSuccess, bool autoRelease = true); }; #endif /* !_IOFWSYNCER */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWIsochPort.h
/* * Copyright (c) 1998-2002 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) 1999-2002 Apple Computer, Inc. All rights reserved. * * IOFWIsochPort is an abstract object that represents hardware on the bus * (locally or remotely) that sends or receives isochronous packets. * Local ports are implemented by the local device driver, * Remote ports are implemented by the driver for the remote device. * * HISTORY * */ #ifndef _IOKIT_IOFWISOCHPORT_H #define _IOKIT_IOFWISOCHPORT_H #include <libkern/c++/OSObject.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> /*! @class IOFWIsochPort */ class IOFWIsochPort : public OSObject { OSDeclareAbstractStructors(IOFWIsochPort) public: // Return maximum speed and channels supported // (bit n set = chan n supported) virtual IOReturn getSupported(IOFWSpeed &maxSpeed, UInt64 &chanSupported) = 0; // Allocate hardware resources for port virtual IOReturn allocatePort(IOFWSpeed speed, UInt32 chan) = 0; virtual IOReturn releasePort() = 0; // Free hardware resources virtual IOReturn start() = 0; // Start port processing packets virtual IOReturn stop() = 0; // Stop processing packets private: OSMetaClassDeclareReservedUnused(IOFWIsochPort, 0); OSMetaClassDeclareReservedUnused(IOFWIsochPort, 1); }; #endif /* ! _IOKIT_IOFWISOCHPORT_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWAddressSpace.h
/* * Copyright (c) 1998-2002 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@ */ /* * * IOFWAddressSpace.h * * Classes which describe addresses in the local node which are accessable to other nodes * via firewire asynchronous read/write/lock requests. */ #ifndef _IOKIT_IOFWADDRESSSPACE_H #define _IOKIT_IOFWADDRESSSPACE_H #include <IOKit/IOMemoryDescriptor.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> class IOFireWireDevice; class IOFireWireBus; class IOFireWireController; typedef void * IOFWRequestRefCon; /*! @function FWWriteCallback @abstract Callback called when a write request packet is received for a 'virtual' firewire address. @param device is the node originating the request @param speed is the FireWire speed of the request, update it if you need to control the speed of the reply, otherwise the response will be the same speed. @param addr is the address the device is requesting to write to @param len is the number of bytes to write @param buf contains the packet data @param requestRefcon refcon Can be queried for extra info about the request, using IOFireWireController::isLockRequest(), isQuadRequest() @result return: kFWResponseComplete = 0, OK kFWResponseConflictError = 4, Resource conflict, may retry kFWResponseDataError = 5, Data not available kFWResponseTypeError = 6, Operation not supported kFWResponseAddressError = 7 Address not valid in target device */ typedef UInt32 (*FWWriteCallback)(void *refcon, UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, const void *buf, IOFWRequestRefCon requestRefcon); /*! @function FWReadCallback @abstract Callback called when a read request packet is received for a 'virtual' firewire address. @param nodeID is the node originating the request @param speed is the FireWire speed of the request, update it if you need to control the speed of the reply, otherwise the response will be the same speed. @param addr is the address the device is requesting to read from @param len is the number of bytes to read @param buf contains the packet data @param offset on return points to the offset into *buf of the packet data @param requestRefcon refcon to pass back if sending a delayed response. Also can be queried for extra info about the request @result return: kFWResponsePending = -1, Pseudo response, real response sent later. kFWResponseComplete = 0, OK! kFWResponseConflictError = 4, Resource conflict, may retry kFWResponseDataError = 5, Data not available kFWResponseTypeError = 6, Operation not supported kFWResponseAddressError = 7 Address not valid in target device A return of kFWResponsePending should be followed at some later time by a call to IOFireWireController::asyncReadResponse */ typedef UInt32 (*FWReadCallback)(void *refcon, UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, IOMemoryDescriptor **buf, IOByteCount * offset, IOFWRequestRefCon requestRefcon); class IOFWAddressSpace; #pragma mark - /*! @class IOFWAddressSpaceAux @discussion An IOFWAddressSpaceAux is for internal use only. You should never subclass IOFWAddressSpaceAux */ class IOFWAddressSpaceAux : public OSObject { OSDeclareDefaultStructors(IOFWAddressSpaceAux) friend class IOFWAddressSpace; protected: IOFWAddressSpace * fPrimary; IOFireWireController * fControl; OSSet * fTrustedNodeSet; OSIterator * fTrustedNodeSetIterator; bool fExclusive; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * reserved; virtual bool init( IOFWAddressSpace * primary ); virtual void free() APPLE_KEXT_OVERRIDE; virtual bool isTrustedNode( UInt16 nodeID ); virtual void addTrustedNode( IOFireWireDevice * device ); virtual void removeTrustedNode( IOFireWireDevice * device ); virtual void removeAllTrustedNodes( void ); bool isExclusive( void ); void setExclusive( bool exclusive ); virtual bool intersects( IOFWAddressSpace * space ); private: OSMetaClassDeclareReservedUsed(IOFWAddressSpaceAux, 0); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 1); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 2); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 3); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 4); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 5); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 6); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 7); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 8); OSMetaClassDeclareReservedUnused(IOFWAddressSpaceAux, 9); }; #pragma mark - /* * Base class for FireWire address space objects */ /*! @class IOFWAddressSpace */ class IOFWAddressSpace : public OSObject { OSDeclareAbstractStructors(IOFWAddressSpace) friend class IOFWAddressSpaceAux; protected: IOFireWireController *fControl; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { IOFWAddressSpaceAux * fAuxiliary; }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * fIOFWAddressSpaceExpansion; virtual bool init(IOFireWireBus *bus); virtual void free() APPLE_KEXT_OVERRIDE; public: /*! @function doRead @abstract An abstract method for processing an address space read request @param nodeID FireWire Read from nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len read 'len' bytes from nodeID. @param buf points to a memory descriptor containing the packet data. @param offset start from this 'offset' in 'buf'. @param refcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ virtual UInt32 doRead(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, IOMemoryDescriptor **buf, IOByteCount * offset, IOFWRequestRefCon refcon) = 0; /*! @function doWrite @abstract An abstract method for processing an address space write request @param nodeID FireWire Write to nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len write 'len' bytes to nodeID. @param buf obtain bytes from location given by 'buf'. @param refcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, const void *buf, IOFWRequestRefCon refcon) = 0; /*! @function doLock @abstract A method for processing a lock request. @param nodeID FireWire Lock request for nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param inlen 'inlen' bytes to use. @param newVal new value to write at 'addr' location . @param outLen 'outLen' bytes for result. @param oldVal old value read from 'addr' location. @param extType Type like kFWExtendedTCodeCompareSwap. @param refcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ virtual UInt32 doLock(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 inlen, const UInt32 *newVal, UInt32 &outLen, UInt32 *oldVal, UInt32 extType, IOFWRequestRefCon refcon); /*! @function activate @abstract Address space is ready for handling requests. @result IOReturn */ virtual IOReturn activate(); /*! @function deactivate @abstract Address space request handler is disabled. @result none */ virtual void deactivate(); /*! @function contains @abstract returns number of bytes starting at addr in this space @result 0 if it doesn't contain the address */ virtual UInt32 contains(FWAddress addr); /*! @function isTrustedNode @abstract returns true if the node is added as a trusted node @param nodeID is the nodeID to verify whether its trusted. @result false if nodeID is not trusted */ inline bool isTrustedNode( UInt16 nodeID ) { return fIOFWAddressSpaceExpansion->fAuxiliary->isTrustedNode( nodeID ); } /*! @function addTrustedNode @abstract Add a trusted node. @param device object pointing to a FireWire node on the bus. @result none */ inline void addTrustedNode( IOFireWireDevice * device ) { fIOFWAddressSpaceExpansion->fAuxiliary->addTrustedNode( device ); } /*! @function removeTrustedNode @abstract Remove a trusted node. @param device object pointing to a FireWire node on the bus. @result none */ inline void removeTrustedNode( IOFireWireDevice * device ) { fIOFWAddressSpaceExpansion->fAuxiliary->removeTrustedNode( device ); } /*! @function removeAllTrustedNodes @abstract Remove all trusted nodes. @result none */ inline void removeAllTrustedNodes( void ) { fIOFWAddressSpaceExpansion->fAuxiliary->removeAllTrustedNodes(); } /*! @function isExclusive @abstract Checks if an address space wants exclusive control of its address range @result True if the address space is marked exclusive false otherwise */ inline bool isExclusive( void ) { return fIOFWAddressSpaceExpansion->fAuxiliary->isExclusive(); } /*! @function setExclusive @abstract Sets if this address space requires exclusive control of its address range. Exclusivity should be set before an address space is activated. @param exclusive True if address space should be exclusive, false otherwise @result none */ inline void setExclusive( bool exclusive ) { fIOFWAddressSpaceExpansion->fAuxiliary->setExclusive( exclusive ); } /*! @function intersects @abstract Checks this address space intersects with the given address range. Currently only supports IOFWPsuedoAddressSpaces. @param space An address space to compare against @result True if the address spaces intersect false otherwise */ inline bool intersects( IOFWAddressSpace * space ) { return fIOFWAddressSpaceExpansion->fAuxiliary->intersects( space ); } protected: virtual IOFWAddressSpaceAux * createAuxiliary( void ); private: OSMetaClassDeclareReservedUsed(IOFWAddressSpace, 0); OSMetaClassDeclareReservedUsed(IOFWAddressSpace, 1); }; // the physical and psuedo address space classes used to be defined here // for backwards compatibility, we pull them in now. the ifdefs surrounding // the content of the header files ensures we do not multiply include a header. #include <IOKit/firewire/IOFWPseudoAddressSpace.h> #include <IOKit/firewire/IOFWPhysicalAddressSpace.h> #endif /* _IOKIT_IOFWADDRESSSPACE */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWPhysicalAddressSpace.h
/* * Copyright (c) 1998-2002 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@ */ #ifndef _IOKIT_IOFWPHYSICALADDRESSSPACE_H #define _IOKIT_IOFWPHYSICALADDRESSSPACE_H #include <IOKit/firewire/IOFWAddressSpace.h> #include <IOKit/IODMACommand.h> /* * Direct physical memory <-> FireWire address. * Accesses to these addresses may be handled automatically by the * hardware without notification. * * The 64 bit FireWire address of (32 bit) physical addr xxxx:xxxx is hostNode:0000:xxxx:xxxx */ class IOFWPhysicalAddressSpace; struct FWSegment { FWAddress address; UInt32 length; }; #pragma mark - /*! @class IOFWPhysicalAddressSpaceAux */ class IOFWPhysicalAddressSpaceAux : public IOFWAddressSpaceAux { OSDeclareDefaultStructors(IOFWPhysicalAddressSpaceAux) friend class IOFWAddressSpace; friend class IOFWPhysicalAddressSpace; protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; IODMACommand * fDMACommand; bool fDMACommandPrepared; public: virtual bool init( IOFWAddressSpace * primary ) APPLE_KEXT_OVERRIDE; virtual void free() APPLE_KEXT_OVERRIDE; void setDMACommand( IODMACommand * dma_command ); IODMACommand * getDMACommand( void ); UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length ); IOReturn prepare( void ); IOReturn synchronize( IOOptionBits options ); IOReturn complete( void ); bool isPrepared( void ); IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments ); private: OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 0); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 1); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 2); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 3); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 4); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 5); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 6); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 7); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 8); OSMetaClassDeclareReservedUnused(IOFWPhysicalAddressSpaceAux, 9); }; #pragma mark - /*! @class IOFWPhysicalAddressSpace */ class IOFWPhysicalAddressSpace : public IOFWAddressSpace { OSDeclareDefaultStructors(IOFWPhysicalAddressSpace) friend class IOFWPhysicalAddressSpaceAux; protected: IOMemoryDescriptor * fMem; // unused vm_size_t fLen; // unused virtual void free() APPLE_KEXT_OVERRIDE; public: /*! @function init @abstract Initialize physical address space. @param bus Points to IOFireWireBus object. @result returns true if success, else false */ virtual bool init( IOFireWireBus * bus ) APPLE_KEXT_OVERRIDE; /*! @function initWithDesc @abstract Initialize physical address space with IOMemoryDescriptor. @param bus Points to IOFireWireBus object. @param mem Points to IOMemoryDescriptor. @result returns true if success, else false */ virtual bool initWithDesc(IOFireWireBus *bus, IOMemoryDescriptor *mem); /*! @function doRead @abstract A method for processing an address space read request @param nodeID FireWire Read from nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len read 'len' bytes from nodeID. @param buf points to a memory descriptor containing the packet data. @param offset start from this 'offset' in 'buf'. @param refcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ virtual UInt32 doRead(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, IOMemoryDescriptor **buf, IOByteCount * offset, IOFWRequestRefCon refcon) APPLE_KEXT_OVERRIDE; /*! @function doWrite @abstract A method for processing an address space write request @param nodeID FireWire Write to nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len write 'len' bytes to nodeID. @param buf obtain bytes from location given by 'buf'. @param reqrefcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, const void *buf, IOFWRequestRefCon refcon) APPLE_KEXT_OVERRIDE; /*! @function getMemoryDescriptor @abstract Gets the memory descriptor, which is associated to this PhysicalAddressSpace. @param none. @result returns the IOMemoryDescriptor */ IOMemoryDescriptor * getMemoryDescriptor( void ); /*! @function setMemoryDescriptor @abstract Sets the memory descriptor, which will be associated to this PhysicalAddressSpace. @param none. @result returns the IOMemoryDescriptor */ IOReturn setMemoryDescriptor( IOMemoryDescriptor * descriptor ); /*! @function getLength @abstract Get the length of the memory backed by PhysicalAddressSpace. @param none. @result returns the length */ UInt64 getLength( void ); /*! @function setDMACommand @abstract Set the DMACommand for this PhysicalAddressSpace. @param dma_command Points to IODMACommand object. @result none */ inline void setDMACommand( IODMACommand * dma_command ) { ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->setDMACommand( dma_command ); }; /*! @function getDMACommand @abstract Get the DMACommand from this PhysicalAddressSpace. @param none. @result return previously assigned IODMACommand, null if not initialized */ inline IODMACommand * getDMACommand( void ) { return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getDMACommand(); }; /*! @function initWithDMACommand @abstract Initialize physical address space with IODMACommand. @param bus Points to IOFireWireBus object. @param command Points to IODMACommand. @result returns true if success, else false */ virtual bool initWithDMACommand( IOFireWireBus * control, IODMACommand * command ); /*! @function prepare @abstract Prepare the IODMACommand used by this PhysicalAddressSpace. @param none. @result returns kIOReturnSuccess on success */ inline IOReturn prepare( void ) { return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->prepare(); }; /*! @function synchronize @abstract synchronize the IODMACommand used by this PhysicalAddressSpace. @param none. @result returns kIOReturnSuccess on success */ inline IOReturn synchronize( IOOptionBits options ) { return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->synchronize( options ); }; /*! @function complete @abstract complete the IODMACommand used by this PhysicalAddressSpace. @param none. @result returns kIOReturnSuccess on success */ inline IOReturn complete( void ) { return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->complete(); }; /*! @function isPrepared @abstract Inspects whether the IODMACommand was prepared in this PhysicalAddressSpace. @param none. @result returns true if prepared, else false */ inline bool isPrepared( void ) { return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->isPrepared(); }; /*! @function getSegments @abstract Returns the scatter gather list of memory segments from the IODMACommand used in this PhysicalAddressSpace. @param offset input/output parameter, defines the starting and ending offset in the memory descriptor, relative to any offset passed to the prepare() method. FWSegment Points to an array of memory segments. num_segments Size of the FWSegment array. @result returns kIOReturnSuccess on success */ inline IOReturn getSegments( UInt64 * offset, FWSegment * fw_segments, UInt32 * num_segments ) { return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getSegments( offset, fw_segments, num_segments ); }; /*! @function checkMemoryInRange @abstract Validates the IOMemoryDescriptor, which is used to initialize the PhysicalAddressSpace. @param memory Points to a valid IOMemoryDescriptor. @result returns kIOReturnSuccess on success */ IOReturn checkMemoryInRange( IOMemoryDescriptor * memory ); protected: UInt64 getPhysicalSegment( UInt64 offset, UInt64 * length ) { return ((IOFWPhysicalAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->getPhysicalSegment( offset, length); }; virtual IOFWAddressSpaceAux * createAuxiliary( void ) APPLE_KEXT_OVERRIDE; }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireBus.h
/* * Copyright (c) 1998-2002 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) 1999-2002 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_IOFIREWIREBUS_H #define _IOKIT_IOFIREWIREBUS_H #include <IOKit/IOService.h> #include <IOKit/firewire/IOFWIsochChannel.h> #include <IOKit/firewire/IOFWAddressSpace.h> #include <IOKit/firewire/IOFWCommand.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> extern const OSSymbol *gFireWireROM; extern const OSSymbol *gFireWireNodeID; extern const OSSymbol *gFireWireSelfIDs; extern const OSSymbol *gFireWireSpeed; extern const OSSymbol *gFireWireUnit_Spec_ID; extern const OSSymbol *gFireWireUnit_SW_Version; extern const OSSymbol *gFireWireVendor_ID; extern const OSSymbol *gFireWire_GUID; extern const OSSymbol *gFireWireVendor_Name; extern const OSSymbol *gFireWireProduct_Name; extern const OSSymbol *gFireWireModel_ID; extern const OSSymbol *gFireWireTDM; class IOFireWireDevice; class IOLocalConfigDirectory; class IOFWLocalIsochPort; class IOFireWirePowerManager; class IOFireWireBus; class IOFWDCLPool; class IOFWSimpleContiguousPhysicalAddressSpace; class IOFWSimplePhysicalAddressSpace; class IOFWUserObjectExporter; #pragma mark - /*! @class IOFireWireBusAux */ class IOFireWireBusAux : public OSObject { OSDeclareAbstractStructors(IOFireWireBusAux) friend class IOFireWireBus; protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * reserved; public : virtual IOFWDCLPool * createDCLPool ( unsigned capacity ) const = 0 ; OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 32); virtual UInt8 getMaxRec( void ) = 0; virtual UInt64 getFireWirePhysicalAddressMask( void ) = 0; virtual UInt32 getFireWirePhysicalAddressBits( void ) = 0; virtual UInt64 getFireWirePhysicalBufferMask( void ) = 0; virtual UInt32 getFireWirePhysicalBufferBits( void ) = 0; virtual IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ) = 0; virtual IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ) = 0; virtual IOFWUserObjectExporter * getSessionRefExporter( void ) = 0; private: OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 0); OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 1); OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 2); OSMetaClassDeclareReservedUsed(IOFireWireBusAux, 3); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 4); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 5); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 6); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 7); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 8); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 9); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 10); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 11); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 12); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 13); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 14); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 15); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 16); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 17); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 18); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 19); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 20); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 21); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 22); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 23); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 24); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 25); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 26); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 27); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 28); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 29); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 30); OSMetaClassDeclareReservedUnused(IOFireWireBusAux, 31); }; #pragma mark - /*! @class IOFireWireBus @abstract IOFireWireBus is a public class the provides access to general FireWire functionality... */ class IOFireWireBus : public IOService { OSDeclareAbstractStructors(IOFireWireBus) public: struct DCLTaskInfoAux { unsigned version ; union // u { struct // v0 { IOMemoryMap * bufferMemoryMap ; // This field required to get physical addresses to program DMA. // If NULL, we try to make the map ourselves. // If you created a buffer memory descriptor // for your program's buffers, just call map() on it // and pass the returned object here... } v0 ; struct // v1 { IOMemoryMap * bufferMemoryMap ; // same as 'bufferMemoryMap' from version 0, above. IOWorkLoop * workloop ; // A workloop on which to run callbacks for this port.. // Can be NULL to use FireWire isochronous workloop... // The workloop will be retained by the program object. } v1 ; struct { IOMemoryMap * bufferMemoryMap ; // same as 'bufferMemoryMap' from version 0, above. IOWorkLoop * workloop ; // A workloop on which to run callbacks for this port.. // Can be NULL to use FireWire isochronous workloop... // The workloop will be retained by the program object. IOFWIsochPortOptions options ; // extra options } v2 ; } u ; } ; // this struct has been redefined for our next generation isochronous architecture, // but is backwards compatible with the old definition.. This means we should // be safe when an old-style driver is loaded.. // To use DCLTaskInfo (see createLocalIsochPort) make sure all 'unused' fields are set to 0 or NULL // and that auxInfo points to a valid DCLTaskInfoAux struct, defined above. struct DCLTaskInfo { task_t unused0 ; vm_address_t unused1 ; UInt32 unused2 ; vm_address_t unused3 ; UInt32 unused4 ; void (*unused5)(void) ; DCLTaskInfoAux * auxInfo ; // Refcon for user call } ; static const IORegistryPlane * gIOFireWirePlane; IOFireWireBusAux * fAuxiliary; // Create an Isochronous Channel object virtual IOFWIsochChannel *createIsochChannel( bool doIRM, UInt32 bandwidth, IOFWSpeed prefSpeed, IOFWIsochChannel::ForceStopNotificationProc stopProc=NULL, void *stopRefCon=NULL) = 0; /*! @function createLocalIsochPort @abstract Create a local isochronous port to run the given DCL program @param talking Pass true to create a talker port; pass false to create a listener port. @param opcodes A pointer to your DCL program (linked list of DCLCommand structs) To use an IOFWDCL/IOFWDCLPool program, pass the DCLCommand returned by IOFWDCLPool::getProgram(). @param info (Optional) Pointer to DCLTaskInfo struct containing additional configuration information. If you have an IOMemoryMap for your DCL program data buffers, pass it here. You can also pass an IOWorkLoop if you want to use your own workloop to handle callbacks for the created port object. @param startEvent Specifies a bus condition on which the port should start receiving/sending packets Must be kFWDCLImmediateEvent, kFWDCLCycleEvent, or kFWDCLSyBitsEvent. Pass kFWDCLImmediateEvent to start without waiting when start() is called. Pass kFWDCLCycleEvent to start() transmitting at a specified bus cycle time. Pass kFWDCLSyBitsEvent (receive only) to start receiving packets once an isochronous packet with a specified sync field arrives. @param startState Pass the value for the desired start condition, as specified by 'startEvent' kFWDCLImmediateEvent: set to 0 kFWDCLCycleEvent: the cycle timer value on which to start processing packets. For talker ports, This value will be masked by 'startMask' and packet processing will be begin on the next cycle whose lowest bits match the masked value. For listener ports, pass a 15-bit value containg to the low order two bits of cycleSeconds and the 13-bit cycleCount on which to start processing packets. kFWDCLSyBitsEvent: The value of the sync field on which to start receive packets. The value will be masked by 'startMask'. For DCLCommand based isoch ports, processing will begin on the first received packet that has an isochronous header sync field matching 'startState'. For IOFWDCL/IOFWDCLPool based ports, processing will pause on each IOFWDCL that has wait set to true until a packet that has an isochronous header sync field matching 'startState' is received. @result Returns an IOFWLocalIsochPort on success.*/ virtual IOFWLocalIsochPort *createLocalIsochPort(bool talking, DCLCommand *opcodes, DCLTaskInfo *info = 0, UInt32 startEvent = 0, UInt32 startState = 0, UInt32 startMask = 0) = 0; virtual IOReturn getCycleTime(UInt32 &cycleTime) = 0; virtual IOReturn getBusCycleTime(UInt32 &busTime, UInt32 &cycleTime) = 0; // Methods to manipulate the local Config ROM virtual IOReturn AddUnitDirectory(IOLocalConfigDirectory *unitDir) = 0; virtual IOReturn RemoveUnitDirectory(IOLocalConfigDirectory *unitDir) = 0; // Cause a bus reset virtual IOReturn resetBus() = 0; // Convert a firewire nodeID into the IOFireWireDevice for it virtual IOFireWireDevice * nodeIDtoDevice(UInt32 generation, UInt16 nodeID) = 0; // Execute specified function on workloop after specified delay // Returned command is for delay, call it's cancel() function to cancel timeout. virtual IOFWDelayCommand * createDelayedCmd(UInt32 uSecDelay, FWBusCallback func, void *refcon) = 0; virtual IOFWPhysicalAddressSpace *createPhysicalAddressSpace(IOMemoryDescriptor *mem) = 0; virtual IOFWPseudoAddressSpace *createPseudoAddressSpace(FWAddress *addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void *refcon) = 0; // Extract info about the async request virtual bool isLockRequest(IOFWRequestRefCon refcon) = 0; virtual bool isQuadRequest(IOFWRequestRefCon refcon) = 0; virtual UInt32 getExtendedTCode(IOFWRequestRefCon refcon) = 0; // How big (as a power of two) can packets sent to/received from the node be? virtual int maxPackLog ( bool forSend, UInt16 nodeAddress) const = 0; // How big (as a power of two) can packets sent from A to B be? virtual int maxPackLog ( UInt16 nodeA, UInt16 nodeB) const = 0; // Force given node to be root (via root holdoff Phy packet) virtual IOReturn makeRoot ( UInt32 generation, UInt16 nodeID) = 0; // Create address space at fixed address in initial register space virtual IOFWPseudoAddressSpace * createInitialAddressSpace ( UInt32 addressLo, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void *refcon) = 0; // Get address space object for given address, if any virtual IOFWAddressSpace * getAddressSpace(FWAddress address) = 0; // Extract info about the async request - was the request ack'ed complete already? virtual bool isCompleteRequest(IOFWRequestRefCon refcon) = 0; virtual IOFWAsyncStreamCommand * createAsyncStreamCommand( UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor *hostMem, UInt32 size, int speed,FWAsyncStreamCallback completion=NULL, void *refcon=NULL) = 0; virtual UInt32 hopCount(UInt16 nodeAAddress, UInt16 nodeBAddress ) = 0; virtual UInt32 hopCount(UInt16 nodeAAddress ) = 0; virtual IOFireWirePowerManager * getBusPowerManager( void ) = 0; protected: virtual IOFireWireBusAux * createAuxiliary( void ) = 0; public : inline IOFWDCLPool * createDCLPool ( UInt32 capacity = 0 ) { return fAuxiliary->createDCLPool ( capacity ) ; } inline UInt8 getMaxRec( void ) { return fAuxiliary->getMaxRec(); } // get the physical addressing limitations for this controller // returns the physical mask for memory addressable by the bus and this controller's DMA engine // intended for use with IOBufferMemoryDescriptor::inTaskWithPhysicalMask() // all current hardware is 32 bit --- currently returns 0x00000000FFFFFFFF // this API is intended for allocating physical buffers. // it will not return more than 48 bits so that buffer addresses can be turned into FWAddresses inline UInt64 getFireWirePhysicalAddressMask( void ) { return fAuxiliary->getFireWirePhysicalAddressMask(); } // returns a count of the maximum addressing bits supported by the bus and this controller // intended for use with IODMACommand::withSpecification() // all current hardware is 32 bit --- currently returns 32 // this API is intended for allocating physical buffers. // it will not return more than 48 bits so that buffer addresses can be turned into FWAddresses inline UInt32 getFireWirePhysicalAddressBits( void ) { return fAuxiliary->getFireWirePhysicalAddressBits(); } // returns the physical mask for memory addressable by this controller's DMA engine // intended for use with IOBufferMemoryDescriptor::inTaskWithPhysicalMask() // all current hardware is 32 bit --- currently returns 0x00000000FFFFFFFF // this API is to allocate isoch and other buffers that don't need to be addressable by the bus // it may someday return as high 64 bits inline UInt64 getFireWirePhysicalBufferMask( void ) { return fAuxiliary->getFireWirePhysicalBufferMask(); } // returns a count of the maximum addressing bits supported by this controller // intended for use with IODMACommand::withSpecification() // all current hardware is 32 bit --- currently returns 32 // this API is to allocate isoch and other buffers that don't need to be addressable by the bus // it may someday return as high 64 bits inline UInt32 getFireWirePhysicalBufferBits( void ) { return fAuxiliary->getFireWirePhysicalBufferBits(); } inline IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ) { return fAuxiliary->createSimpleContiguousPhysicalAddressSpace( size, direction ); } inline IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ) { return fAuxiliary->createSimplePhysicalAddressSpace( size, direction ); } virtual IOFWAsyncStreamCommand * createAsyncStreamCommand( UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor *hostMem, UInt32 size, int speed,FWAsyncStreamCallback completion, void *refcon, bool failOnReset) = 0; inline IOFWUserObjectExporter * getSessionRefExporter( void ) { return fAuxiliary->getSessionRefExporter(); } private: OSMetaClassDeclareReservedUsed(IOFireWireBus, 0); OSMetaClassDeclareReservedUsed(IOFireWireBus, 1); OSMetaClassDeclareReservedUsed(IOFireWireBus, 2); OSMetaClassDeclareReservedUsed(IOFireWireBus, 3); OSMetaClassDeclareReservedUsed(IOFireWireBus, 4); OSMetaClassDeclareReservedUsed(IOFireWireBus, 5); OSMetaClassDeclareReservedUsed(IOFireWireBus, 6); OSMetaClassDeclareReservedUsed(IOFireWireBus, 7); }; #endif /* ! _IOKIT_IOFIREWIREBUS_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireUnit.h
/* * Copyright (c) 1998-2002 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@ */ /* * * IOFireWireUnit.h * * */ #ifndef _IOKIT_IOFIREWIREUNIT_H #define _IOKIT_IOFIREWIREUNIT_H // public #include <IOKit/firewire/IOFireWireNub.h> class IOFireWireDevice; class IOFireWireUnit; #pragma mark - /*! @class IOFireWireUnitAux */ class IOFireWireUnitAux : public IOFireWireNubAux { OSDeclareDefaultStructors(IOFireWireUnitAux) friend class IOFireWireUnit; protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * reserved; virtual bool init( IOFireWireUnit * primary ); virtual void free() APPLE_KEXT_OVERRIDE; virtual bool isPhysicalAccessEnabled( void ) APPLE_KEXT_OVERRIDE; virtual IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ) APPLE_KEXT_OVERRIDE; virtual IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ) APPLE_KEXT_OVERRIDE; private: OSMetaClassDeclareReservedUnused(IOFireWireUnitAux, 0); OSMetaClassDeclareReservedUnused(IOFireWireUnitAux, 1); OSMetaClassDeclareReservedUnused(IOFireWireUnitAux, 2); OSMetaClassDeclareReservedUnused(IOFireWireUnitAux, 3); }; #pragma mark - /*! @class IOFireWireUnit */ class IOFireWireUnit : public IOFireWireNub { OSDeclareDefaultStructors(IOFireWireUnit) friend class IOFireWireUnitAux; friend class IOFireWireDevice; protected: IOFireWireDevice *fDevice; // The device unit is part of /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; /*------------------Methods provided to FireWire device clients-----------------------*/ public: virtual bool init(OSDictionary *propTable, IOConfigDirectory *directory); /* * Standard nub initialization */ virtual bool attach(IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void free() APPLE_KEXT_OVERRIDE; /* * Matching language support * Match on the following properties of the unit: * Vendor_ID * GUID * Unit_Spec_ID * Unit_SW_Version */ virtual bool matchPropertyTable(OSDictionary * table) APPLE_KEXT_OVERRIDE; virtual IOReturn message( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; // Override handleOpen() and handleClose() to pass on to device virtual bool handleOpen( IOService * forClient, IOOptionBits options, void * arg ) APPLE_KEXT_OVERRIDE; virtual void handleClose( IOService * forClient, IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual void setNodeFlags( UInt32 flags ) APPLE_KEXT_OVERRIDE; virtual void clearNodeFlags( UInt32 flags ) APPLE_KEXT_OVERRIDE; virtual UInt32 getNodeFlags( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn setConfigDirectory( IOConfigDirectory *directory ) APPLE_KEXT_OVERRIDE; /* * Create local FireWire address spaces for the device to access */ virtual IOFWPhysicalAddressSpace *createPhysicalAddressSpace(IOMemoryDescriptor *mem) APPLE_KEXT_OVERRIDE; virtual IOFWPseudoAddressSpace *createPseudoAddressSpace(FWAddress *addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void *refcon) APPLE_KEXT_OVERRIDE; protected: virtual IOFireWireNubAux * createAuxiliary( void ) APPLE_KEXT_OVERRIDE; public: void setMaxSpeed( IOFWSpeed speed ); protected: void terminateUnit( void ); static void terminateUnitThreadFunc( void * refcon ); private: OSMetaClassDeclareReservedUnused(IOFireWireUnit, 0); OSMetaClassDeclareReservedUnused(IOFireWireUnit, 1); }; #endif /* ! _IOKIT_IOFIREWIREDEVICE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWUtils.h
/* * IOFWUtils.h * IOFireWireFamily * * Created by Niels on Fri Aug 16 2002. * Copyright (c) 2002 Apple Computer, Inc. All rights reserved. * */ #import <IOKit/IOTypes.h> //////////////////////////////////////////////////////////////////////////////// // // Useful FireWire utility functions. // #ifdef __cplusplus extern "C" { #endif UInt16 FWComputeCRC16(const UInt32 *pQuads, UInt32 numQuads); UInt16 FWUpdateCRC16(UInt16 crc16, UInt32 quad); UInt32 AddFWCycleTimeToFWCycleTime( UInt32 cycleTime1, UInt32 cycleTime2 ); UInt32 SubtractFWCycleTimeFromFWCycleTime( UInt32 cycleTime1, UInt32 cycleTime2); void IOFWGetAbsoluteTime( AbsoluteTime * result ); #ifdef __cplusplus } #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireIRMAllocation.h
/* * Copyright (c) 1998-2006 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@ */ #ifndef _IOKIT_IOFIREWIREIRMALLOCATION_H #define _IOKIT_IOFIREWIREIRMALLOCATION_H #include <libkern/c++/OSObject.h> class IOFireWireController; //#include <IOKit/firewire/IOFireWireController.h> //#include <IOKit/firewire/IOFireWireFamilyCommon.h> /*! @class IOFireWireIRMAllocation */ class IOFireWireIRMAllocation : public OSObject { friend class IOFireWireController; OSDeclareDefaultStructors(IOFireWireIRMAllocation) public: // Prototype for the callback if reallocation after bus-reset is unsuccessful. typedef IOReturn (*AllocationLostNotificationProc)(void* refCon, class IOFireWireIRMAllocation* allocation); // Initialize the IRM allocation object. virtual bool init( IOFireWireController * control, Boolean releaseIRMResourcesOnFree = true, AllocationLostNotificationProc allocationLostProc = NULL, void *pLostProcRefCon = NULL); // Specify whether of not the IRM resources should automatically // be released when freeing this allocation object. virtual void setReleaseIRMResourcesOnFree(Boolean doRelease); // Use the IRMAllocation object to allocate isoch resources virtual IOReturn allocateIsochResources(UInt8 isochChannel, UInt32 bandwidthUnits); // Free isoch resources previously allocated with a call to allocateIsochResources virtual IOReturn deallocateIsochResources(void); // Returns true if isoch resources are currently allocated, and if true, the allocated channel, and amount of isoch bandwidth. virtual Boolean areIsochResourcesAllocated(UInt8 *pAllocatedIsochChannel, UInt32 *pAllocatedBandwidthUnits); // Get the refcon virtual void * GetRefCon(void); virtual void SetRefCon(void* refCon); // Override the base-class release function for special processing virtual void release() const APPLE_KEXT_OVERRIDE; protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; // Free the allocation object (and release IRM resources if needed) virtual void free( void ) APPLE_KEXT_OVERRIDE; // Controller will call this to notify about bus-reset complete. virtual void handleBusReset(UInt32 generation); virtual void failedToRealloc(void); virtual UInt32 getAllocationGeneration(void); static void threadFunc( void * arg ); private: AllocationLostNotificationProc fAllocationLostProc; void *fLostProcRefCon; Boolean fReleaseIRMResourcesOnFree; UInt8 fIsochChannel; UInt32 fBandwidthUnits; UInt32 fAllocationGeneration; IORecursiveLock *fLock ; IOFireWireController *fControl; Boolean isAllocated; OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 0); OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 1); OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 2); OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 3); OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 4); OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 5); OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 6); OSMetaClassDeclareReservedUnused(IOFireWireIRMAllocation, 7); }; #endif // _IOKIT_IOFIREWIREIRMALLOCATION_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWLocalIsochPort.h
/* * Copyright (c) 1998-2002 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) 1999-2002 Apple Computer, Inc. All rights reserved. * * IOFWIsochPort is an abstract object that represents hardware on the bus * (locally or remotely) that sends or receives isochronous packets. * Local ports are implemented by the local device driver, * Remote ports are implemented by the driver for the remote device. * * HISTORY * * $Log: not supported by cvs2svn $ * Revision 1.9 2003/08/30 00:16:44 collin * *** empty log message *** * * Revision 1.8 2003/08/15 04:36:55 niels * *** empty log message *** * * Revision 1.7 2003/07/29 22:49:22 niels * *** empty log message *** * * Revision 1.6 2003/07/21 06:52:58 niels * merge isoch to TOT * * Revision 1.5.14.1 2003/07/01 20:54:07 niels * isoch merge * */ #ifndef _IOKIT_IOFWLOCALISOCHPORT_H #define _IOKIT_IOFWLOCALISOCHPORT_H #import <IOKit/firewire/IOFireWireFamilyCommon.h> #import <IOKit/firewire/IOFWIsochPort.h> class IOFireWireController; class IODCLProgram; /*! @class IOFWLocalIsochPort */ class IOFWLocalIsochPort : public IOFWIsochPort { OSDeclareDefaultStructors(IOFWLocalIsochPort) protected: IOFireWireController * fControl; IODCLProgram * fProgram; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { } ; ExpansionData * fExpansion ; protected : virtual void free ( void ) APPLE_KEXT_OVERRIDE; public: virtual bool init ( IODCLProgram * program, IOFireWireController * control ) ; // Return maximum speed and channels supported // (bit n set = chan n supported) virtual IOReturn getSupported ( IOFWSpeed & maxSpeed, UInt64 & chanSupported ) APPLE_KEXT_OVERRIDE; // Allocate hardware resources for port virtual IOReturn allocatePort ( IOFWSpeed speed, UInt32 chan ) APPLE_KEXT_OVERRIDE; virtual IOReturn releasePort ( void ) APPLE_KEXT_OVERRIDE; // Free hardware resources virtual IOReturn start ( void ) APPLE_KEXT_OVERRIDE; // Start port processing packets virtual IOReturn stop ( void ) APPLE_KEXT_OVERRIDE; // Stop processing packets /*! @function notify @abstract Informs hardware of a change to the DCL program. @param notificationType Type of change. @param dclCommandList List of DCL commands that have been changed. @param numDCLCommands Number of commands in list. @result IOKit error code. */ virtual IOReturn notify( IOFWDCLNotificationType notificationType, DCLCommand ** dclCommandList, UInt32 numDCLCommands ) ; static void printDCLProgram ( const DCLCommand * dcl, UInt32 count = 0, void (*printFN)( const char *format, ...) = NULL, unsigned lineDelayMS = 0 ) ; IOReturn setIsochResourceFlags ( IOFWIsochResourceFlags flags ) ; IODCLProgram * getProgramRef() const ; IOReturn synchronizeWithIO() ; private: OSMetaClassDeclareReservedUnused ( IOFWLocalIsochPort, 0 ) ; OSMetaClassDeclareReservedUnused ( IOFWLocalIsochPort, 1 ) ; }; #endif /* ! _IOKIT_IOFWLOCALISOCHPORT_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWDCLTranslator.h
/* * Copyright (c) 1998-2002 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) 1999-2002 Apple Computer, Inc. All rights reserved. * * A DCL program to interpret (in software) a program that's too complicated * for the DMA engine. * * HISTORY * */ #ifndef _IOKIT_IOFWDCLTRANSLATOR_H #define _IOKIT_IOFWDCLTRANSLATOR_H #include <libkern/c++/OSObject.h> #include <IOKit/firewire/IOFWDCLProgram.h> /*! @class IODCLTranslator */ class IODCLTranslator : public IODCLProgram { OSDeclareAbstractStructors(IODCLTranslator) protected: enum { kNumPingPongs = 2, kNumPacketsPerPingPong = 500, kMaxIsochPacketSize = 1000, kPingPongBufferSize = kNumPingPongs * kNumPacketsPerPingPong * kMaxIsochPacketSize }; // Opcodes and buffer for pingpong program DCLLabel fStartLabel; DCLTransferPacket fTransfers[kNumPingPongs*kNumPacketsPerPingPong]; DCLCallProc fCalls[kNumPingPongs]; DCLJump fJumpToStart; UInt8 fBuffer[kPingPongBufferSize]; IODCLProgram * fHWProgram; // Hardware program executing our opcodes DCLCommand* fToInterpret; // The commands to interpret DCLCommand* fCurrentDCLCommand; // Current command to interpret int fPingCount; // Are we pinging or ponging? UInt32 fPacketHeader; static void ListeningDCLPingPongProc(DCLCommand* pDCLCommand); static void TalkingDCLPingPongProc(DCLCommand* pDCLCommand); public: virtual bool init(DCLCommand* toInterpret); virtual IOReturn allocateHW(IOFWSpeed speed, UInt32 chan) APPLE_KEXT_OVERRIDE; virtual IOReturn releaseHW() APPLE_KEXT_OVERRIDE; virtual IOReturn notify(IOFWDCLNotificationType notificationType, DCLCommand** dclCommandList, UInt32 numDCLCommands) APPLE_KEXT_OVERRIDE; virtual void stop() APPLE_KEXT_OVERRIDE; DCLCommand* getTranslatorOpcodes(); void setHWProgram(IODCLProgram *program); }; /*! @class IODCLTranslateTalk */ class IODCLTranslateTalk : public IODCLTranslator { OSDeclareDefaultStructors(IODCLTranslateTalk) protected: public: virtual IOReturn compile(IOFWSpeed speed, UInt32 chan) APPLE_KEXT_OVERRIDE; virtual IOReturn start() APPLE_KEXT_OVERRIDE; }; /*! @class IODCLTranslateListen */ class IODCLTranslateListen : public IODCLTranslator { OSDeclareDefaultStructors(IODCLTranslateListen) protected: public: virtual IOReturn compile(IOFWSpeed speed, UInt32 chan) APPLE_KEXT_OVERRIDE; virtual IOReturn start() APPLE_KEXT_OVERRIDE; }; #endif /* ! _IOKIT_IOFWDCLPROGRAM_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOLocalConfigDirectory.h
/* * Copyright (c) 1998-2002 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@ */ #ifndef __IOLOCALCONFIGDIRECTORY_H__ #define __IOLOCALCONFIGDIRECTORY_H__ #include <libkern/c++/OSObject.h> #include <IOKit/IOReturn.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> #include <IOKit/firewire/IOConfigDirectory.h> class OSArray; class OSData; class IOFireWireController; class IOFWUserObjectExporter ; /*! @class IOLocalConfigDirectory */ class IOLocalConfigDirectory : public IOConfigDirectory { friend class IOFireWireController; friend class IOFireWireUserClient ; OSDeclareDefaultStructors(IOLocalConfigDirectory); protected: OSArray *fEntries; // Entries for this directory. OSData *fROM; // Local ROM, if compiled. UInt32 fHeader; // Num entries and CRC. /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; virtual bool init(void) APPLE_KEXT_OVERRIDE; virtual void free(void) APPLE_KEXT_OVERRIDE; virtual const UInt32 *getBase(void) APPLE_KEXT_OVERRIDE; virtual IOConfigDirectory *getSubDir(int start, int type) APPLE_KEXT_OVERRIDE; public: static IOLocalConfigDirectory *create(); /*! @function update makes sure that the ROM has at least the specified capacity, and that the ROM is uptodate from its start to at least the specified quadlet offset. @result kIOReturnSuccess if the specified offset is now accessable at romBase[offset]. */ virtual IOReturn update(UInt32 offset, const UInt32 *&romBase) APPLE_KEXT_OVERRIDE; virtual IOReturn compile(OSData *rom); // All flavours of addEntry eat a retain of the desc string virtual IOReturn addEntry(int key, UInt32 value, OSString *desc = NULL); virtual IOReturn addEntry(int key, IOLocalConfigDirectory *value, OSString *desc = NULL); virtual IOReturn addEntry(int key, OSData *value, OSString *desc = NULL); virtual IOReturn addEntry(int key, FWAddress value, OSString *desc = NULL); virtual IOReturn removeSubDir(IOLocalConfigDirectory *value); const OSArray *getEntries() const; virtual IOReturn getIndexValue(int index, IOConfigDirectory *&value) APPLE_KEXT_OVERRIDE; protected: virtual const UInt32 * lockData( void ) APPLE_KEXT_OVERRIDE; virtual void unlockData( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn updateROMCache( UInt32 offset, UInt32 length ) APPLE_KEXT_OVERRIDE; virtual IOReturn checkROMState( void ) APPLE_KEXT_OVERRIDE; // call eats a retain count virtual IOReturn addEntry(OSString *desc); IOReturn incrementGeneration( void ); static void exporterCleanup( const OSObject * self, IOFWUserObjectExporter * exporter ) ; private: OSMetaClassDeclareReservedUsed(IOLocalConfigDirectory, 0); OSMetaClassDeclareReservedUnused(IOLocalConfigDirectory, 1); OSMetaClassDeclareReservedUnused(IOLocalConfigDirectory, 2); }; #endif /* __IOLOCALCONFIGDIRECTORY_H__ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOConfigDirectory.h
/* * Copyright (c) 1998-2002 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@ */ #ifndef __IOCONFIGDIRECTORY_H__ #define __IOCONFIGDIRECTORY_H__ #include <libkern/c++/OSObject.h> #include <IOKit/IOReturn.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> class OSData; class OSString; class OSIterator; class IOFireWireDevice; /*! @class IOConfigDirectory */ class IOConfigDirectory : public OSObject { OSDeclareAbstractStructors(IOConfigDirectory); protected: int fStart; // Offset into ROM of start of this dir int fType; // Directory type int fNumEntries; // In directory /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; virtual bool initWithOffset(int start, int type); virtual const UInt32 *getBase() = 0; virtual IOReturn createIterator(UInt32 testVal, UInt32 testMask, OSIterator *&iterator); virtual IOConfigDirectory *getSubDir(int start, int type) = 0; public: /*! @function update makes sure that the ROM has at least the specified capacity, and that the ROM is uptodate from its start to at least the specified quadlet offset. @result kIOReturnSuccess if the specified offset is now accessable at romBase[offset]. */ virtual IOReturn update(UInt32 offset, const UInt32 *&romBase) = 0; /*! @function getKeyType Gets the data type for the specified key @param type on return, set to the data type @result kIOReturnSuccess if the key exists in the dictionary */ virtual IOReturn getKeyType(int key, IOConfigKeyType &type); /*! @function getKeyValue Gets the value for the specified key, in a variety of forms. @param value on return, set to the data type @param text if non-zero, on return points to the string description of the field, or NULL if no text found. @result kIOReturnSuccess if the key exists in the dictionary and is of a type appropriate for the value parameter @param value reference to variable to store the entry's value */ virtual IOReturn getKeyValue(int key, UInt32 &value, OSString** text = NULL); virtual IOReturn getKeyValue(int key, OSData *&value, OSString** text = NULL); virtual IOReturn getKeyValue(int key, IOConfigDirectory *&value, OSString** text = NULL); virtual IOReturn getKeyOffset(int key, FWAddress &value, OSString** text = NULL); /*! @function getIndexType Gets the data type for entry at the specified index @param type on return, set to the data type @result kIOReturnSuccess if the index exists in the dictionary */ virtual IOReturn getIndexType(int index, IOConfigKeyType &type); /*! @function getIndexKey Gets the key for entry at the specified index @param key on return, set to the key @result kIOReturnSuccess if the index exists in the dictionary */ virtual IOReturn getIndexKey(int index, int &key); /*! @function getIndexValue Gets the value at the specified index of the directory, in a variety of forms. @param type on return, set to the data type @result kIOReturnSuccess if the index exists in the dictionary and is of a type appropriate for the value parameter @param value reference to variable to store the entry's value */ virtual IOReturn getIndexValue(int index, UInt32 &value); virtual IOReturn getIndexValue(int index, OSData *&value); virtual IOReturn getIndexValue(int index, OSString *&value); virtual IOReturn getIndexValue(int index, IOConfigDirectory *&value); virtual IOReturn getIndexOffset(int index, FWAddress &value); virtual IOReturn getIndexOffset(int index, UInt32 &value); /*! @function getIndexEntry Gets the entry at the specified index of the directory, as a raw UInt32. @param entry on return, set to the entry value @result kIOReturnSuccess if the index exists in the dictionary @param value reference to variable to store the entry's value */ virtual IOReturn getIndexEntry(int index, UInt32 &value); /*! @function getSubdirectories Creates an iterator over the subdirectories of the directory. @param iterator on return, set to point to an OSIterator @result kIOReturnSuccess if the iterator could be created */ virtual IOReturn getSubdirectories(OSIterator *&iterator); /*! @function getKeySubdirectories Creates an iterator over subdirectories of a given type of the directory. @param key type of subdirectory to iterate over @param iterator on return, set to point to an OSIterator @result kIOReturnSuccess if the iterator could be created */ virtual IOReturn getKeySubdirectories(int key, OSIterator *&iterator); int getType() const; int getNumEntries() const; protected: virtual const UInt32 * lockData( void ) = 0; virtual void unlockData( void ) = 0; virtual IOReturn updateROMCache( UInt32 offset, UInt32 length ) = 0; virtual IOReturn checkROMState( void ) = 0; private: OSMetaClassDeclareReservedUnused(IOConfigDirectory, 0); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 1); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 2); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 3); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 4); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 5); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 6); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 7); OSMetaClassDeclareReservedUnused(IOConfigDirectory, 8); }; #endif /* __IOCONFIGDIRECTORY_H__ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWDCLPool.h
/* * IOFWNuDCLPool.h * IOFireWireFamily * * Created by Niels on Fri Mar 07 2003. * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. * * $Log: not supported by cvs2svn $ * Revision 1.14 2008/03/03 23:31:42 ayanowit * another gcc-42 fix. * * Revision 1.13 2007/01/26 20:52:31 ayanowit * changes to user-space isoch stuff to support 64-bit apps. * * Revision 1.12 2006/02/09 00:21:50 niels * merge chardonnay branch to tot * * Revision 1.11 2005/04/12 20:09:13 niels * fix memory leak importing NuDCL programs from user space * * Revision 1.10.20.2 2006/01/31 04:49:50 collin * *** empty log message *** * * Revision 1.10 2003/11/07 21:24:28 niels * *** empty log message *** * * Revision 1.9 2003/11/07 21:01:18 niels * *** empty log message *** * * Revision 1.8 2003/08/25 08:39:15 niels * *** empty log message *** * * Revision 1.7 2003/08/22 18:15:16 niels * *** empty log message *** * * Revision 1.6 2003/08/15 04:36:55 niels * *** empty log message *** * * Revision 1.5 2003/07/30 05:22:14 niels * *** empty log message *** * * Revision 1.4 2003/07/21 08:48:20 niels * *** empty log message *** * * Revision 1.3 2003/07/21 07:52:13 niels * *** empty log message *** * * Revision 1.2 2003/07/21 06:52:58 niels * merge isoch to TOT * * Revision 1.1.2.3 2003/07/11 18:15:34 niels * *** empty log message *** * * Revision 1.1.2.2 2003/07/09 21:24:00 niels * *** empty log message *** * * Revision 1.1.2.1 2003/07/01 20:54:06 niels * isoch merge * */ #import <libkern/c++/OSObject.h> #import <libkern/c++/OSArray.h> #import <IOKit/IOTypes.h> class IOFireWireLink ; class IOFWDCL ; class IOFWReceiveDCL ; class IOFWSendDCL ; class IOFWSkipCycleDCL ; class IOFireWireUserClient ; class IOMemoryDescriptor ; class IOMemoryMap ; class OSSet; /*! @class IOFWDCLPool @discussion You should never subclass IOFWDCLPool */ class IOFWDCLPool : public OSObject { OSDeclareAbstractStructors( IOFWDCLPool ) friend class IOFireWireUserClient ; friend class IOFWUserLocalIsochPort ; protected: class Expansion* fReserved ; // for class expansion IOFireWireLink * fLink ; UInt8 fCurrentTag ; UInt8 fCurrentSync ; OSArray* fProgram ; DCLNuDCLLeader fLeader ; public: // OSObject virtual void free(void) APPLE_KEXT_OVERRIDE; // me virtual bool initWithLink ( IOFireWireLink& link, UInt32 capacity ) ; virtual void setCurrentTagAndSync ( UInt8 tag, UInt8 sync ) ; virtual IOFWReceiveDCL* appendReceiveDCL ( OSSet * updateSet, UInt8 headerBytes, UInt32 rangesCount, IOVirtualRange ranges[] ) ; virtual IOFWSendDCL* appendSendDCL ( OSSet * updateSet, UInt32 rangesCount, IOVirtualRange ranges[] ) ; virtual IOFWSkipCycleDCL* appendSkipCycleDCL () ; virtual const OSArray * getProgramRef () const ; protected : IOReturn importUserProgram ( IOMemoryDescriptor * userExportDesc, unsigned bufferRangeCount, IOAddressRange bufferRanges[], IOMemoryMap * bufferMap ) ; IOReturn importUserDCL( IOFWDCL * dcl, void * importData, IOByteCount & dataSize, IOMemoryMap * bufferMap ) ; protected : virtual IOFWReceiveDCL * allocReceiveDCL () = 0 ; virtual IOFWSendDCL * allocSendDCL () = 0 ; virtual IOFWSkipCycleDCL * allocSkipCycleDCL () = 0 ; private : void appendDCL( IOFWDCL * dcl ) ; public : DCLCommand * getProgram() ; OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 0); OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 1); OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 2); OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 3); OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 4); OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 5); OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 6); OSMetaClassDeclareReservedUnused ( IOFWDCLPool, 7); } ;
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWUserObjectExporter.h
/* * Copyright (c) 1998-2008 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@ */ /*! @class IOFWUserObjectExporter @discussion An IOFWUserObjectExporter is for internal use only. You should never subclass IOFWUserObjectExporter */ namespace IOFireWireLib { typedef UInt32 UserObjectHandle; } #ifdef KERNEL class IOFWUserObjectExporter : public OSObject { OSDeclareDefaultStructors (IOFWUserObjectExporter ) public : typedef void (*CleanupFunction)( const OSObject * obj ); typedef void (*CleanupFunctionWithExporter)( const OSObject * obj, IOFWUserObjectExporter * ); private : unsigned fCapacity; unsigned fObjectCount; const OSObject ** fObjects; CleanupFunctionWithExporter * fCleanupFunctions; IOLock * fLock; OSObject * fOwner; public : static IOFWUserObjectExporter * createWithOwner( OSObject * owner ); bool initWithOwner( OSObject * owner ); virtual bool init(void) APPLE_KEXT_OVERRIDE; virtual void free (void) APPLE_KEXT_OVERRIDE; virtual bool serialize ( OSSerialize * s ) const APPLE_KEXT_OVERRIDE; // me IOReturn addObject ( OSObject * obj, CleanupFunction cleanup, IOFireWireLib::UserObjectHandle * outHandle ); void removeObject ( IOFireWireLib::UserObjectHandle handle ); // the returned object is retained! This is for thread safety.. if someone else released // the object from the pool after you got it, you be in for Trouble // Release the returned value when you're done!! const OSObject * lookupObject ( IOFireWireLib::UserObjectHandle handle ) const; const OSObject * lookupObjectForType( IOFireWireLib::UserObjectHandle handle, const OSMetaClass * toType ) const; void removeAllObjects (); void lock () const; void unlock () const; OSObject * getOwner() const; // *** WARNING: (when building SBP2) 'const' type qualifier on return type has no effect const IOFireWireLib::UserObjectHandle lookupHandle ( OSObject * object ) const; // don't subclass, but just in case someone does... private: OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 0); OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 1); OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 2); OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 3); OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 4); OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 5); OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 6); OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 7); }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireController.h
/* * Copyright (c) 1998-2002 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) 1999-2002 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_IOFIREWIRECONTROLLER_H #define _IOKIT_IOFIREWIRECONTROLLER_H #ifndef FIREWIREPRIVATE #warning Please do not include this file. Include IOFireWireBus.h instead. #endif #include <IOKit/IOEventSource.h> #include <IOKit/firewire/IOFireWireBus.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> #include <IOKit/firewire/IOFireWireIRMAllocation.h> #include <IOKit/firewire/IOFWPHYPacketListener.h> #include <IOKit/firewire/IOFireWireMultiIsochReceive.h> #include <IOKit/IOMapper.h> class OSData; class IOWorkLoop; class IOEventSource; class IOFWQEventSource; class IOTimerEventSource; class IOMemoryDescriptor; class IOFireWireController; class IOFWAddressSpace; class IOFWPseudoAddressSpace; class IOFireWireNub; class IOFireWireDevice; class IOFireWireDeviceAux; class IOFireWireUnit; class IODCLProgram; class IOLocalConfigDirectory; class IOFireWireLink; class IOFireWireSBP2ORB; class IOFireWireSBP2Login; class IOFireWireROMCache; class IOFireWireLocalNode; class IOFWWorkLoop; class IOFireWireIRM; class IOFireWirePowerManager; class IOFWSimplePhysicalAddressSpace; class IOFWSimpleContiguousPhysicalAddressSpace; class IOFWAsyncStreamReceiver; class IOFWAsyncStreamListener; class IOFWUserVectorCommand; class IOFWAsyncPHYCommand; class IOFWPHYPacketListener; class IOFWUserPHYPacketListener; class IOFireWireUserClient; const UInt32 kMaxWaitForValidSelfID = 20; // Still invalid SelfID after 20 retries // Phy packet defs. enum { kFWPhyPacketID = FWBitRange (0, 1), kFWPhyPacketIDPhase = FWBitRangePhase (0, 1), kFWPhyPacketPhyID = FWBitRange (2, 7), kFWPhyPacketPhyIDPhase = FWBitRangePhase (2, 7) }; enum { kSelfIDPacketSize = 8, kMaxSelfIDs = 4 // SelfID 0,1,3,8 }; enum { kFWConfigurationPacketID = 0, kFWLinkOnPacketID = 1, kFWSelfIDPacketID = 2 }; enum { kFWPhyConfigurationR = FW_BIT(8), kFWPhyConfigurationT = FW_BIT(9), kFWPhyConfigurationGapCnt = FWBitRange (10, 15), kFWPhyConfigurationGapCntPhase = FWBitRangePhase (10, 15) }; enum { kFWSelfIDPortStatusChild = 3, kFWSelfIDPortStatusParent = 2, kFWSelfIDPortStatusNotConnected = 1, kFWSelfIDPortStatusNotPresent = 0, kFWSelfIDNoPower = 0, kFWSelfIDSelfPowered15W = 1, kFWSelfIDSelfPowered30W = 2, kFWSelfIDSelfPowered45W = 3, kFWSelfIDBusPowered1W = 4, kFWSelfIDBusPowered3W = 5, kFWSelfIDBusPowered6W = 6, kFWSelfIDBusPowered10W = 7, kFWSelfIDPhyID = kFWPhyPacketPhyID,//zzz do we need or want this? kFWSelfIDPhyIDPhase = kFWPhyPacketPhyIDPhase, kFWSelfIDM = FW_BIT(31), kFWSelfID0L = FW_BIT(9), kFWSelfID0GapCnt = FWBitRange (10, 15), kFWSelfID0GapCntPhase = FWBitRangePhase (10, 15), kFWSelfID0SP = FWBitRange (16, 17), kFWSelfID0SPPhase = FWBitRangePhase (16, 17), kFWSelfID0Del = FWBitRange (18, 19), kFWSelfID0DelPhase = FWBitRangePhase (18, 19), kFWSelfID0C = FW_BIT(20), kFWSelfID0Pwr = FWBitRange (21, 23), kFWSelfID0PwrPhase = FWBitRangePhase (21, 23), kFWSelfID0P0 = FWBitRange (24, 25), kFWSelfID0P0Phase = FWBitRangePhase (24, 25), kFWSelfID0P1 = FWBitRange (26, 27), kFWSelfID0P1Phase = FWBitRangePhase (26, 27), kFWSelfID0P2 = FWBitRange (28, 29), kFWSelfID0P2Phase = FWBitRangePhase (28, 29), kFWSelfID0I = FW_BIT(30), kFWSelfIDPacketType = FW_BIT(8), kFWSelfIDNN = FWBitRange (9, 11), kFWSelfIDNNPhase = FWBitRangePhase (9, 11), kFWSelfIDNPa = FWBitRange (14, 15), kFWSelfIDNPaPhase = FWBitRangePhase (14, 15), kFWSelfIDNPb = FWBitRange (16, 17), kFWSelfIDNPbPhase = FWBitRangePhase (16, 17), kFWSelfIDNPc = FWBitRange (18, 19), kFWSelfIDNPcPhase = FWBitRangePhase (18, 19), kFWSelfIDNPd = FWBitRange (20, 21), kFWSelfIDNPdPhase = FWBitRangePhase (20, 21), kFWSelfIDNPe = FWBitRange (22, 23), kFWSelfIDNPePhase = FWBitRangePhase (22, 23), kFWSelfIDNPf = FWBitRange (24, 25), kFWSelfIDNPfPhase = FWBitRangePhase (24, 25), kFWSelfIDNPg = FWBitRange (26, 27), kFWSelfIDNPgPhase = FWBitRangePhase (26, 27), kFWSelfIDNPh = FWBitRange (28, 29), kFWSelfIDNPhPhase = FWBitRangePhase (28, 29), kFWSelfIDMore = FW_BIT(31) }; // Primary packet defs. enum { kFWPacketTCode = FWBitRange (24, 27), kFWPacketTCodePhase = FWBitRangePhase (24, 27) }; enum { kFWAsynchSpd = FWBitRange (14, 15), kFWAsynchSpdPhase = FWBitRangePhase (14, 15), kFWAsynchTLabel = FWBitRange (16, 21), kFWAsynchTLabelPhase = FWBitRangePhase (16, 21), kFWAsynchTTotal = ((0xffffffff & kFWAsynchTLabel) >> kFWAsynchTLabelPhase)+1, kFWAsynchRt = FWBitRange (22, 23), kFWAsynchRtPhase = FWBitRangePhase (22, 23), kFWAsynchNew = 0, kFWAsynchRetryA = 2, kTIAsycnhRetryB = 3, kFWAsynchPriority = FWBitRange (28, 31), kFWAsynchPriorityPhase = FWBitRangePhase (28, 31), kFWAsynchDestinationID = FWBitRange (0, 15), kFWAsynchDestinationIDPhase = FWBitRangePhase (0, 15), kFWAsynchSourceID = FWBitRange (0, 15), kFWAsynchSourceIDPhase = FWBitRangePhase (0, 15), kFWAsynchDestinationOffsetHigh = FWBitRange (16, 31), kFWAsynchDestinationOffsetHighPhase = FWBitRangePhase (16, 31), kFWAsynchDestinationOffsetLow = FWBitRange (0, 31), kFWAsynchDestinationOffsetLowPhase = FWBitRangePhase (0, 31), kFWAsynchDataLength = FWBitRange (0, 15), kFWAsynchDataLengthPhase = FWBitRangePhase (0, 15), kFWAsynchExtendedTCode = FWBitRange (16, 31), kFWAsynchExtendedTCodePhase = FWBitRangePhase (16, 31), kFWAsynchAckSent = FWBitRange (28, 31), kFWAsynchAckSentPhase = FWBitRangePhase (28, 31), kFWAsynchRCode = FWBitRange (16, 19), kFWAsynchRCodePhase = FWBitRangePhase (16, 19) }; enum { kFWTCodeWriteQuadlet = 0, kFWTCodeWriteBlock = 1, kFWTCodeWriteResponse = 2, kFWTCodeReadQuadlet = 4, kFWTCodeReadBlock = 5, kFWTCodeReadQuadletResponse = 6, kFWTCodeReadBlockResponse = 7, kFWTCodeCycleStart = 8, kFWTCodeLock = 9, kFWTCodeIsochronousBlock = 10, kFWTCodeLockResponse = 11, kFWTCodePHYPacket = 14 }; enum { kFWExtendedTCodeMaskSwap = 1, kFWExtendedTCodeCompareSwap = 2, kFWExtendedTCodeFetchAdd = 3, kFWExtendedTCodeLittleAdd = 4, kFWExtendedTCodeBoundedAdd = 5, kFWExtendedTCodeWrapAdd = 6, kFWExtendedTCodeVendorDependent = 7 }; // debug boot-arg constants enum { kFWDebugIgnoreNodeNone = 0xFFFFFFFF }; struct AsyncPendingTrans { IOFWAsyncCommand * fHandler; IOFWCommand * fAltHandler; int fTCode; bool fInUse; }; struct IOFWNodeScan { IOFireWireController * fControl; FWAddress fAddr; UInt32 fBuf[5]; // Enough for bus info block UInt32 * fSelfIDs; int fNumSelfIDs; int fROMSize; int fRead; IOFWReadQuadCommand * fCmd; IOFWCompareAndSwapCommand * fLockCmd; UInt32 generation; UInt32 fIRMBitBucketOld; UInt32 fIRMBitBucketNew; bool fIRMisBad; bool speedChecking; bool fContenderNeedsChecking; bool fIRMCheckingRead; bool fIRMCheckingLock; int fRetriesBumped; bool fMustNotBeRoot; }; typedef struct IOFWDuplicateGUIDStruct IOFWDuplicateGUIDRec; struct IOFWDuplicateGUIDStruct { IOFWDuplicateGUIDRec * fNextGUID; CSRNodeUniqueID fGUID; UInt32 fLastGenSeen; }; // IOFireWireDuplicateGUIDList // // A little class for keeping track of GUIDs which where we have observed 2 nodes with // the same GUID class IOFireWireDuplicateGUIDList : public OSObject { OSDeclareDefaultStructors(IOFireWireDuplicateGUIDList); private: IOFWDuplicateGUIDRec * fFirstGUID; protected: virtual void free(void) APPLE_KEXT_OVERRIDE; public: static IOFireWireDuplicateGUIDList * create( void ); void addDuplicateGUID( CSRNodeUniqueID guid, UInt32 gen ); void removeDuplicateGUID( CSRNodeUniqueID guid ); bool findDuplicateGUID( CSRNodeUniqueID guid, UInt32 gen ); }; #define kMaxPendingTransfers kFWAsynchTTotal class IOFireWireController; #pragma mark - /*! @class IOFireWireControllerAux */ class IOFireWireControllerAux : public IOFireWireBusAux { OSDeclareDefaultStructors(IOFireWireControllerAux) friend class IOFireWireController; protected: IOFireWireController * fPrimary; UInt8 fMaxRec; UInt8 fPadding; UInt16 fPadding2; IOFWUserObjectExporter * fSessionRefExporter; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * reserved; virtual bool init ( IOFireWireController * primary ); virtual void free (void) APPLE_KEXT_OVERRIDE; virtual IOFWDCLPool * createDCLPool ( unsigned capacity ) const APPLE_KEXT_OVERRIDE; virtual UInt8 getMaxRec( void ) APPLE_KEXT_OVERRIDE; virtual UInt64 getFireWirePhysicalAddressMask( void ) APPLE_KEXT_OVERRIDE; virtual UInt32 getFireWirePhysicalAddressBits( void ) APPLE_KEXT_OVERRIDE; virtual UInt64 getFireWirePhysicalBufferMask( void ) APPLE_KEXT_OVERRIDE; virtual UInt32 getFireWirePhysicalBufferBits( void ) APPLE_KEXT_OVERRIDE; virtual IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ) APPLE_KEXT_OVERRIDE; virtual IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ) APPLE_KEXT_OVERRIDE; virtual IOFWUserObjectExporter * getSessionRefExporter( void ) APPLE_KEXT_OVERRIDE; private: OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 0); OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 1); OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 2); OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 3); OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 4); OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 5); OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 6); OSMetaClassDeclareReservedUnused(IOFireWireControllerAux, 7); }; #pragma mark - /*! @class IOFireWireController */ class IOFireWireController : public IOFireWireBus { OSDeclareAbstractStructors(IOFireWireController) protected: enum busState { kStarting = 0, kAsleep, // Link off, zzzzzz kWaitingBusReset, kWaitingSelfIDs, // Bus has been reset, no selfIDs yet kWaitingScan, // Got selfIDs, waiting a bit before hitting lame devices kScanning, // Reading node ROMs kWaitingPrune, // Read all ROMs, pausing before pruning missing devices kRunning, // Normal happy state, kWaitingBusResetStart // bus reset is desired, but not yet sent to the fwim }; enum ResetState { kResetStateResetting, kResetStateDisabled, kResetStateArbitrated }; enum { kDisablePhysicalAccess = (1 << 0) }; struct timeoutQ: public IOFWCmdQ { IOTimerEventSource *fTimer; virtual void headChanged(IOFWCommand *oldHead); void busReset(); }; struct pendingQ: public IOFWCmdQ { IOFWQEventSource *fSource; virtual void headChanged(IOFWCommand *oldHead); }; friend class IOFireWireLink; friend class IOFireWireDevice; friend class IOFireWireDeviceAux; friend class IOFWAddressSpace; friend class IOFWAddressSpaceAux; friend class IOFWPseudoAddressSpace; friend class IOFireWireSBP2ORB; friend class IOFireWireSBP2Login; friend class IOFWLocalIsochPort; friend class IOFWCommand; friend class IOFireWireUnit; friend class IOFireWirePCRSpace; friend class IOFireWireROMCache; friend class IOFWAsyncStreamCommand; friend class IOFireWireAVCLocalUnit; friend class IOFireWireAVCUnit; friend class IOFireWireAVCCommand; friend class IOFireWirePowerManager; friend class IOFWWriteQuadCommand; friend class IOFWWriteCommand; friend class IOFWCompareAndSwapCommand; friend class IOFWAsyncCommand; friend class IOFireWireAVCTargetSpace; friend class AppleFWOHCI; friend class IOFireWireNub; friend class IOFWAsyncStreamListener; friend class IOFireWireLocalNode; friend class IOFireWireIRMAllocation; friend class IOFWUserVectorCommand; friend class IOFWAsyncPHYCommand; friend class IOFWUserPHYPacketListener; friend class IOFWAsyncStreamReceiver; friend class IOFireWireUserClient; IOFireWireLink * fFWIM; IOFWWorkLoop * fWorkLoop; IOTimerEventSource * fTimer; OSSet * fLocalAddresses; // Collection of local adress spaces OSIterator * fSpaceIterator; // Iterator over local addr spaces OSSet * fAllocatedChannels; // Need to be informed of bus resets OSIterator * fAllocChannelIterator; // Iterator over channels OSSet * fIRMAllocations; // Need to be informed of bus resets OSIterator * fIRMAllocationsIterator; // Iterator over channels OSSet * fIRMAllocationsAllocated; // Need to be informed of bus resets // Bus management variables (although we aren't a FireWire Bus Manager...) AbsoluteTime fResetTime; // Time of last reset UInt32 fBusGeneration; // ID of current bus topology. UInt16 fLocalNodeID; // ID of local node, ie. this computer UInt16 fRootNodeID; // ID of root, ie. highest node id in use. UInt16 fIRMNodeID; // ID of Isochronous resource manager, or kFWBadNodeID bool fBusMgr; // true if at least one node is bus manager capable IORegistryEntry * fNodes[kFWMaxNodesPerBus]; // FireWire nodes on this bus UInt32 * fNodeIDs[kFWMaxNodesPerBus+1]; // Pointer to SelfID list for each node // +1 so we know how many selfIDs the last node has UInt32 fGapCount; // What we think the gap count should be //UInt8 fSpeedCodes[(kFWMaxNodesPerBus+1)*kFWMaxNodesPerBus]; UInt8 fSpeedVector[((kFWMaxNodesPerBus+1)*kFWMaxNodesPerBus)/2]; // Max speed between two nodes busState fBusState; // Which state are we in? int fNumROMReads; // Number of device ROMs we are still reading // SelfIDs int fNumSelfIDs; // Total number of SelfID packets UInt32 fSelfIDs[kMaxSelfIDs*kFWMaxNodesPerBus]; // The local device's Config ROM UInt32 fROMHeader[5]; // More or less fixed header and bus info block IOLocalConfigDirectory * fRootDir; // Local Config ROM root directory. // log base 2 of maximum packet size the FWIM can send/receive // Normally calculated from bus info block. int fMaxSendLog; int fMaxRecvLog; IOFWAddressSpace * fROMAddrSpace; IOMemoryDescriptor * fBadReadResponse; // Send back easily identified bad data to out of range addrs. // Array for outstanding requests (up to 64) AsyncPendingTrans fTrans[kMaxPendingTransfers]; int fLastTrans; // queue for executing commands that may timeout timeoutQ fTimeoutQ; // queue for commands that can't execute yet pendingQ fPendingQ; // queue for async commands interrupted by bus reset IOFWCmdQ fAfterResetHandledQ; // Command to change bus state after a delay. IOFWDelayCommand * fDelayedStateChangeCmd; bool fDelayedStateChangeCmdNeedAbort; UInt32 fDelayedPhyPacket; bool fBusResetScheduled; ResetState fBusResetState; IOFWDelayCommand * fBusResetStateChangeCmd; UInt32 fBusResetDisabledCount; void * fFireLogPublisher; // DEPRECATED OSData * fAllocatedAddresses; UInt32 fDevicePruneDelay; IOFWPhysicalAccessMode fPhysicalAccessMode; IOFWSecurityMode fSecurityMode; IONotifier * fKeyswitchNotifier; IOFireWireIRM * fIRM; IOFireWirePowerManager * fBusPowerManager; bool fGapCountMismatch; bool fUseHalfSizePackets; bool fRequestedHalfSizePackets; IOFWNodeScan * fScans[kFWMaxNodesPerBus]; IOFireWireDuplicateGUIDList * fGUIDDups; bool fDelegateCycleMaster; bool fBadIRMsKnown; UInt32 fPreviousGap; UInt32 fOutOfTLabels; UInt32 fOutOfTLabels10S; UInt32 fOutOfTLabelsThreshold; #ifdef LEGACY_SHUTDOWN IONotifier * fPowerEventNotifier; #endif bool fStarted; UInt32 fIOCriticalSectionCount; UInt32 fHubPort; UInt32 fDebugIgnoreNode; OSSet * fLocalAsyncStreamReceivers; OSIterator * fAsyncStreamReceiverIterator; bool fInstantiated; IOReturn fStartStatus; UInt32 fWaitingForSelfID; UInt32 fForcedRootNodeID; bool fNodeMustBeRootFlag; bool fNodeMustNotBeRootFlag; UInt32 fForcedGapCount; bool fForcedGapFlag; OSSet * fPHYPacketListeners; OSIterator * fPHYPacketListenersIterator; bool fDSLimited; IONotifier * fConsoleLockNotifier; IOFireWireLocalNode * fLocalNode; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; static void clockTick(OSObject *, IOTimerEventSource *); static void readROMGlue(void *refcon, IOReturn status, IOFireWireNub *device, IOFWCommand *fwCmd); static void delayedStateChange(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWBusCommand *fwCmd); virtual void processBusReset(); virtual void processSelfIDs(UInt32 *IDs, int numIDs, UInt32 *ownIDs, int numOwnIDs); virtual void processTimeout(IOTimerEventSource *src); virtual void processRcvPacket( UInt32 *data, int numQuads, IOFWSpeed speed ); virtual void processWriteRequest(UInt16 sourceID, UInt32 tlabel, UInt32 *hdr, void *buf, int len, IOFWSpeed speed); virtual void processLockRequest(UInt16 sourceID, UInt32 tlabel, UInt32 *hdr, void *buf, int len, IOFWSpeed speed); // Process read from a local address, return rcode virtual UInt32 doReadSpace(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, IOMemoryDescriptor **buf, IOByteCount * offset, IODMACommand **dma_command, IOFWRequestRefCon refcon); // Process write to a local address, return rcode virtual UInt32 doWriteSpace(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, const void *buf, IOFWRequestRefCon refcon); // Process lock to a local address, return rcode UInt32 doLockSpace(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 inlen, const UInt32 *newVal, UInt32 &outLen, UInt32 *oldVal, UInt32 extType, IOFWRequestRefCon refcon); virtual void updatePlane(); virtual void startBusScan(); // Called when all devices on bus have been examined virtual void finishedBusScan(); virtual void buildTopology(bool doFWPlane); virtual void readDeviceROM(IOFWNodeScan *refCon, IOReturn status); virtual IOReturn UpdateROM(); virtual IOReturn allocAddress(IOFWAddressSpace *space); virtual void freeAddress(IOFWAddressSpace *space); IOFireWireBusAux * createAuxiliary( void ) APPLE_KEXT_OVERRIDE; public: // Initialization virtual bool init(IOFireWireLink *fwim); virtual void free(void) APPLE_KEXT_OVERRIDE; virtual bool start(IOService *provider) APPLE_KEXT_OVERRIDE; virtual void stop( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual bool finalize( IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual bool requestTerminate( IOService * provider, IOOptionBits options ) APPLE_KEXT_OVERRIDE; // Power management virtual IOReturn setPowerState ( unsigned long powerStateOrdinal, IOService* whatDevice ) APPLE_KEXT_OVERRIDE; // Implement IOService::getWorkLoop virtual IOWorkLoop *getWorkLoop() const APPLE_KEXT_OVERRIDE; // Allocate struct for tracking a transaction virtual AsyncPendingTrans *allocTrans(IOFWAsyncCommand *cmd=NULL); virtual void freeTrans(AsyncPendingTrans *trans); // Really public methods virtual IOReturn getCycleTime(UInt32 &cycleTime) APPLE_KEXT_OVERRIDE; virtual IOReturn getBusCycleTime(UInt32 &busTime, UInt32 &cycleTime) APPLE_KEXT_OVERRIDE; // Methods to manipulate the local Config ROM virtual IOReturn AddUnitDirectory(IOLocalConfigDirectory *unitDir) APPLE_KEXT_OVERRIDE; virtual IOReturn RemoveUnitDirectory(IOLocalConfigDirectory *unitDir) APPLE_KEXT_OVERRIDE; // Cause a bus reset virtual IOReturn resetBus(void) APPLE_KEXT_OVERRIDE; // Send async request packets virtual IOReturn asyncRead( UInt32 generation, UInt16 nodeID, UInt16 addrHi, UInt32 addrLo, int speed, int label, int size, IOFWAsyncCommand * cmd ); virtual IOReturn asyncWrite( UInt32 generation, UInt16 nodeID, UInt16 addrHi, UInt32 addrLo, int speed, int label, IOMemoryDescriptor * buf, IOByteCount offset, int size, IOFWAsyncCommand * cmd ); /* DEPRECATED */ virtual IOReturn asyncWrite( UInt32 generation, /* DEPRECATED */ UInt16 nodeID, /* DEPRECATED */ UInt16 addrHi, /* DEPRECATED */ UInt32 addrLo, /* DEPRECATED */ int speed, /* DEPRECATED */ int label, /* DEPRECATED */ void * data, /* DEPRECATED */ int size, /* DEPRECATED */ IOFWAsyncCommand * cmd ); /* DEPRECATED */ virtual IOReturn asyncLock( UInt32 generation, /* DEPRECATED */ UInt16 nodeID, /* DEPRECATED */ UInt16 addrHi, /* DEPRECATED */ UInt32 addrLo, /* DEPRECATED */ int speed, /* DEPRECATED */ int label, /* DEPRECATED */ int type, /* DEPRECATED */ void * data, /* DEPRECATED */ int size, /* DEPRECATED */ IOFWAsyncCommand * cmd); // Send async read response packets // useful for pseudo address spaces that require servicing outside the FireWire work loop. virtual IOReturn asyncReadResponse( UInt32 generation, UInt16 nodeID, int speed, IOMemoryDescriptor * buf, IOByteCount offset, int len, IOFWRequestRefCon refcon ); virtual IOReturn asyncLockResponse( UInt32 generation, UInt16 nodeID, int speed, IOMemoryDescriptor * buf, IOByteCount offset, int len, IOFWRequestRefCon refcon ); // Try to fix whatever might have caused the other device to not respond virtual IOReturn handleAsyncTimeout(IOFWAsyncCommand *cmd); // Convert a firewire nodeID into the IOFireWireDevice for it virtual IOFireWireDevice * nodeIDtoDevice(UInt32 generation, UInt16 nodeID) APPLE_KEXT_OVERRIDE; // Add/remove a channel from the list informed of bus resets virtual void addAllocatedChannel(IOFWIsochChannel *channel); virtual void removeAllocatedChannel(IOFWIsochChannel *channel); // Add/remove a IRM allocation from the list informed of bus resets virtual void addIRMAllocation(IOFireWireIRMAllocation *irmAllocation); virtual void removeIRMAllocation(IOFireWireIRMAllocation *irmAllocation); // Create an Isochronous Channel object // doIRM = true => allocate channel and bandwith in Isochronous Resource Manager // packetSize packet size (in bytes), used to calculate bandwidth needed. virtual IOFWIsochChannel *createIsochChannel( bool doIRM, UInt32 packetSize, IOFWSpeed prefSpeed, FWIsochChannelForceStopNotificationProc stopProc=NULL, void *stopRefCon=NULL) APPLE_KEXT_OVERRIDE; // Create a local isochronous port to run the given DCL program // if task is 0, the DCL program is for the kernel task, // otherwise all DCL pointers are valid in the specified task. // opcodes is also pointer valid in the specified task. virtual IOFWLocalIsochPort *createLocalIsochPort(bool talking, DCLCommand* opcodes, DCLTaskInfo *info = 0, UInt32 startEvent = 0, UInt32 startState = 0, UInt32 startMask = 0) APPLE_KEXT_OVERRIDE; // Execute specified function on workloop after specified delay // Returned command is for delay, call it's cancel() function to cancel timeout. virtual IOFWDelayCommand * createDelayedCmd(UInt32 uSecDelay, FWBusCallback func, void *refcon) APPLE_KEXT_OVERRIDE; virtual IOFWPhysicalAddressSpace *createPhysicalAddressSpace(IOMemoryDescriptor *mem) APPLE_KEXT_OVERRIDE; virtual IOFWPseudoAddressSpace *createPseudoAddressSpace(FWAddress *addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void *refcon) APPLE_KEXT_OVERRIDE; // Extract info about the async request virtual bool isLockRequest(IOFWRequestRefCon refcon) APPLE_KEXT_OVERRIDE; virtual bool isQuadRequest(IOFWRequestRefCon refcon) APPLE_KEXT_OVERRIDE; virtual UInt32 getExtendedTCode(IOFWRequestRefCon refcon) APPLE_KEXT_OVERRIDE; // Inline accessors for protected member variables IOFWCmdQ &getTimeoutQ(); IOFWCmdQ &getPendingQ(); IOFWCmdQ &getAfterResetHandledQ(); IOFireWireLink * getLink() const; IOLocalConfigDirectory *getRootDir() const; bool checkGeneration(UInt32 gen) const; UInt32 getGeneration() const; UInt16 getLocalNodeID() const; IOReturn getIRMNodeID(UInt32 &generation, UInt16 &id); const AbsoluteTime * getResetTime() const; IOFWSpeed FWSpeed(UInt16 nodeAddress) const; IOFWSpeed FWSpeed(UInt16 nodeA, UInt16 nodeB) const; // How big (as a power of two) can packets sent to/received from the node be? virtual int maxPackLog(bool forSend, UInt16 nodeAddress) const APPLE_KEXT_OVERRIDE; // How big (as a power of two) can packets sent from A to B be? virtual int maxPackLog(UInt16 nodeA, UInt16 nodeB) const APPLE_KEXT_OVERRIDE; // Force given node to be root (via root holdoff Phy packet) virtual IOReturn makeRoot(UInt32 generation, UInt16 nodeID) APPLE_KEXT_OVERRIDE; virtual IOFWPseudoAddressSpace *createInitialAddressSpace(UInt32 addressLo, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void *refcon) APPLE_KEXT_OVERRIDE; virtual IOFWAddressSpace *getAddressSpace(FWAddress address) APPLE_KEXT_OVERRIDE; // Extract info about the async request - was the request ack'ed complete already? virtual bool isCompleteRequest(IOFWRequestRefCon refcon) APPLE_KEXT_OVERRIDE; // Are we currently scanning the bus? bool scanningBus() const; protected: void openGate(); void closeGate(); protected: virtual void doBusReset( void ); static void resetStateChange( void *refcon, IOReturn status, IOFireWireBus *bus, IOFWBusCommand *fwCmd); public: virtual IOReturn disableSoftwareBusResets( void ); virtual void enableSoftwareBusResets( void ); virtual IOFWAsyncStreamCommand * createAsyncStreamCommand( UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor *hostMem, UInt32 size, int speed,FWAsyncStreamCallback completion, void *refcon) APPLE_KEXT_OVERRIDE; virtual IOReturn asyncStreamWrite(UInt32 generation, int speed, int tag, int sync, int channel, IOMemoryDescriptor *buf, IOByteCount offset, int size, IOFWAsyncStreamCommand *cmd); protected: bool inGate(); virtual IOReturn allocatePseudoAddress(FWAddress *addr, UInt32 lenDummy); virtual void freePseudoAddress(FWAddress addr, UInt32 lenDummy); virtual IORegistryEntry * createDummyRegistryEntry( IOFWNodeScan *scan ); static IOFireWireLocalNode * getLocalNode(IOFireWireController *control); virtual void setPhysicalAccessMode( IOFWPhysicalAccessMode mode ); virtual IOFWPhysicalAccessMode getPhysicalAccessMode( void ); virtual void physicalAccessProcessBusReset( void ); virtual void setNodeIDPhysicalFilter( UInt16 nodeID, bool state ); virtual void initSecurity( void ); virtual void freeSecurity( void ); static bool serverKeyswitchCallback( void * target, void * refCon, IOService * service, IONotifier * notifier ); virtual void setSecurityMode( IOFWSecurityMode mode ); virtual IOFWSecurityMode getSecurityMode( void ); virtual IOReturn createTimeoutQ( void ); virtual void destroyTimeoutQ( void ); virtual IOReturn createPendingQ( void ); virtual void destroyPendingQ( void ); virtual UInt32 countNodeIDChildren( UInt16 nodeID, int hub_port = 0, int * hubChildRemainder = NULL, bool * hubParentFlag = NULL ); public: virtual UInt32 hopCount(UInt16 nodeAAddress, UInt16 nodeBAddress ) APPLE_KEXT_OVERRIDE; virtual UInt32 hopCount(UInt16 nodeAAddress ) APPLE_KEXT_OVERRIDE; virtual IOFireWirePowerManager * getBusPowerManager( void ) APPLE_KEXT_OVERRIDE; protected: virtual void handleARxReqIntComplete(); virtual IOReturn asyncLock( UInt32 generation, UInt16 nodeID, UInt16 addrHi, UInt32 addrLo, int speed, int label, int type, IOMemoryDescriptor * buf, IOByteCount offset, int size, IOFWAsyncCommand * cmd ); virtual IOReturn asyncWrite( UInt32 generation, UInt16 nodeID, UInt16 addrHi, UInt32 addrLo, int speed, int label, IOMemoryDescriptor * buf, IOByteCount offset, int size, IOFWAsyncCommand * cmd, IOFWWriteFlags flags ); protected: bool delayedStateCommandInUse() const; void enterBusResetDisabledState( ); virtual UInt32 getPortNumberFromIndex( UInt16 index ); virtual bool checkForDuplicateGUID(IOFWNodeScan *scan, CSRNodeUniqueID *currentGUIDs ); virtual void updateDevice(IOFWNodeScan *scan ); virtual bool AssignCycleMaster(); public: IOReturn clipMaxRec2K(Boolean clipMaxRec ); void setNodeSpeed( UInt16 nodeAddress, IOFWSpeed speed ); void useHalfSizePackets( void ); void disablePhyPortOnSleepForNodeID( UInt32 nodeID ); IOReturn handleAsyncCompletion( IOFWCommand *cmd, IOReturn status ); void processCycle64Int(); #ifdef LEGACY_SHUTDOWN static IOReturn systemShutDownHandler( void * target, void * refCon, UInt32 messageType, IOService * service, void * messageArgument, vm_size_t argSize ); #else virtual void systemWillShutdown( IOOptionBits specifier ) APPLE_KEXT_OVERRIDE; #endif IOReturn beginIOCriticalSection( void ); void endIOCriticalSection( void ); protected: IOReturn poweredStart( void ); void setNodeSpeed( UInt16 nodeA, UInt16 nodeB, UInt8 speed ); void setNodeSpeed( UInt16 nodeAddress, UInt8 speed ); public: bool isPhysicalAccessEnabledForNodeID( UInt16 nodeID ); // Allocate IRM bandwidth if the specified generation is the current FireWire generation. IOReturn allocateIRMBandwidthInGeneration(UInt32 bandwidthUnits, UInt32 generation) ; // Release IRM bandwidth if the specified generation is the current FireWire generation. IOReturn releaseIRMBandwidthInGeneration(UInt32 bandwidthUnits, UInt32 generation) ; // Allocate IRM channel if the specified generation is the current FireWire generation. IOReturn allocateIRMChannelInGeneration(UInt8 isochChannel, UInt32 generation) ; // Release IRM channel if the specified generation is the current FireWire generation. IOReturn releaseIRMChannelInGeneration(UInt8 isochChannel, UInt32 generation) ; // Create an IOFireWireIRMAllocation object which can be used to allocate isoch resources that are automatically reallocated after bus-resets! IOFireWireIRMAllocation *createIRMAllocation(Boolean releaseIRMResourcesOnFree = true, IOFireWireIRMAllocation::AllocationLostNotificationProc allocationLostProc = NULL, void *pLostNotificationProcRefCon = NULL); IOFWAsyncStreamListener *createAsyncStreamListener( UInt32 channel, FWAsyncStreamReceiveCallback proc, void *refcon ); void removeAsyncStreamListener( IOFWAsyncStreamListener *listener ); IOFWSpeed getBroadcastSpeed(){ return FWSpeed( fLocalNodeID ); }; private: IOFWAsyncStreamReceiver *allocAsyncStreamReceiver( UInt32 channel, FWAsyncStreamReceiveCallback proc, void *refcon ); IOFWAsyncStreamReceiver *getAsyncStreamReceiver( UInt32 channel ); void freeAllAsyncStreamReceiver(); void activateAsyncStreamReceivers(); void deactivateAsyncStreamReceivers(); protected: IOService *findKeyswitchDevice( void ); void suspendBus( void ); public: virtual IOReturn asyncRead( UInt32 generation, UInt16 nodeID, UInt16 addrHi, UInt32 addrLo, int speed, int label, int size, IOFWAsyncCommand * cmd, IOFWReadFlags flags ); void checkProgress( void ); void terminateDevice( IOFireWireDevice * device ); void nodeMustBeRoot( UInt32 nodeID ); void nodeMustNotBeRoot( UInt32 nodeID ); void setGapCount( UInt32 gapCount ); IOReturn asyncPHYPacket( UInt32 generation, UInt32 data, UInt32 data2, IOFWAsyncPHYCommand * cmd ); IOFWAsyncPHYCommand * createAsyncPHYCommand( UInt32 generation, UInt32 data1, UInt32 data2, FWAsyncPHYCallback completion, void * refcon, bool failOnReset ); private: AsyncPendingTrans * allocTrans( IOFWAsyncCommand * cmd, IOFWCommand * altcmd ); public: IOReturn activatePHYPacketListener( IOFWPHYPacketListener * listener ); void deactivatePHYPacketListener( IOFWPHYPacketListener * listener ); IOFWPHYPacketListener * createPHYPacketListener( FWPHYPacketCallback proc, void * refcon ); private: void processPHYPacket( UInt32 data1, UInt32 data2 ); void enterLoggingMode( void ); public: IOReturn getCycleTimeAndUpTime( UInt32 &cycleTime, UInt64 &uptime ); protected: void removeAsyncStreamReceiver( IOFWAsyncStreamReceiver *receiver ); public: // Create a multi-isoch-receive listener IOFireWireMultiIsochReceiveListener * createMultiIsochReceiveListener(UInt32 channel, FWMultiIsochReceiveListenerCallback callback, void *pCallbackRefCon, FWMultiIsochReceiveListenerParams *pListenerParams = NULL); // Activate a multi-isoch-receive listener IOReturn activateMultiIsochReceiveListener(IOFireWireMultiIsochReceiveListener *pListener); // Deactivate a multi-isoch-receive listener IOReturn deactivateMultiIsochReceiveListener(IOFireWireMultiIsochReceiveListener *pListener); // Call for client to specify he is done with a multi-isoch receiver isoch packet void clientDoneWithMultiIsochReceivePacket(IOFireWireMultiIsochReceivePacket *pPacket); public: virtual IOFWAsyncStreamCommand * createAsyncStreamCommand( UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor *hostMem, UInt32 size, int speed,FWAsyncStreamCallback completion, void *refcon, bool failOnReset) APPLE_KEXT_OVERRIDE; private: void addToIRMAllocationSet(IOFireWireIRMAllocation *anObject); void removeFromIRMAllocationSet(IOFireWireIRMAllocation *anObject); static IOReturn consoleLockInterestHandler( void * target, void * refCon, UInt32 messageType, IOService * provider, void * messageArgument, vm_size_t argSize ); public: IOMapper * copyMapper( void ); protected: OSMetaClassDeclareReservedUnused(IOFireWireController, 0); OSMetaClassDeclareReservedUnused(IOFireWireController, 1); OSMetaClassDeclareReservedUnused(IOFireWireController, 2); OSMetaClassDeclareReservedUnused(IOFireWireController, 3); OSMetaClassDeclareReservedUnused(IOFireWireController, 4); OSMetaClassDeclareReservedUnused(IOFireWireController, 5); OSMetaClassDeclareReservedUnused(IOFireWireController, 6); OSMetaClassDeclareReservedUnused(IOFireWireController, 7); OSMetaClassDeclareReservedUnused(IOFireWireController, 8); }; #endif /* ! _IOKIT_IOFIREWIRECONTROLLER_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWAsyncStreamListener.h
/* * Copyright (c) 1998-2001 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@ */ #ifndef _IOKIT_IOFWASYNCSTREAMLISTENER_H #define _IOKIT_IOFWASYNCSTREAMLISTENER_H #include <IOKit/firewire/IOFireWireLink.h> #include <IOKit/firewire/IOFWCommand.h> #include <IOKit/IOBufferMemoryDescriptor.h> #include <IOKit/firewire/IOFWDCLProgram.h> class IOFWAsyncStreamReceiver; class IOFWAsyncStreamReceivePort; /*! @class IOFWAsyncStreamListener */ class IOFWAsyncStreamListener : public OSObject { OSDeclareDefaultStructors(IOFWAsyncStreamListener) friend class IOFWAsyncStreamReceiver; friend class IOFireWireController; public: /*! @function initAll @abstract Creates an AsyncStream client for an Isoch channel. @param control Points to IOFireWireController. @param channel Isoch channel for listening. @param proc Callback on packet reception. @param obj Client's callback object. @result returns true on success, else false. */ bool initAll( IOFireWireController *control, UInt32 channel, FWAsyncStreamReceiveCallback proc, void *refcon ); /*! @function setListenerHandler @abstract Set the callback that should be called to handle incoming async stream packets @param inReceiver The callback to set. @result Returns the callback that was previously set or nil for none.*/ const FWAsyncStreamReceiveCallback setListenerHandler( FWAsyncStreamReceiveCallback inReceiver ); /*! @function TurnOffNotification @abstract Turns off client callback notification. @result none. */ inline void TurnOffNotification() { fNotify = false; }; /*! @function TurnOnNotification @abstract Turns on client callback notification. @result none. */ inline void TurnOnNotification() { fNotify = true; }; /*! @function IsNotificationOn @abstract checks the notification state. @result true if ON, else false */ inline bool IsNotificationOn() { return fNotify; }; /*! @function setFlags @abstract set flags for the listener. @param flags indicate performance metrics. @result none. */ void setFlags( UInt32 flags ); /*! @function getFlags @abstract get the flags of listener. @param none. @result flags. */ UInt32 getFlags(); /*! @function getRefCon @abstract get the refcon specific to this listener. @param none. @result fRefCon refcon passed during initialization. */ inline void* getRefCon() { return fRefCon; }; /*! @function getOverrunCounter @abstract get overrun counter from the DCL program. @param none. @result returns the counter value. */ UInt32 getOverrunCounter(); protected: FWAsyncStreamReceiveCallback fClientProc; void *fRefCon; IOFWAsyncStreamReceiver *fReceiver; bool fNotify; UInt32 fFlags; IOFireWireController *fControl; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; virtual void free(void) APPLE_KEXT_OVERRIDE; private: /*! function getReceiver abstract Returns the Async Stream receiver object which tracks multiple IOFWAsyncStreamListeners for the same Isoc channel. */ inline IOFWAsyncStreamReceiver *getReceiver() { return fReceiver; }; /*! function invokeClients abstract Invokes client's callback function with fRefCon. */ void invokeClients( UInt8 *buffer ); OSMetaClassDeclareReservedUnused(IOFWAsyncStreamListener, 0); OSMetaClassDeclareReservedUnused(IOFWAsyncStreamListener, 1); }; #endif // _IOKIT_IOFWASYNCSTREAMLISTENER_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireDevice.h
/* * Copyright (c) 1998-2002 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@ */ /*! @header This header contains the definition of the <code>IOFireWireDevice</code> and <code>IOFireWireDeviceAux</code> classes. An <code>IOFireWireDevice</code> object represents a FireWire device in the I/O Registry. It is strongly recommended that you write applications that access FireWire devices rather than in-kernel device drivers. For more information on how to do this, see {@linkdoc //apple_ref/doc/uid/TP40000969 FireWire Device Interface Guide}. @indexgroup FireWire */ #ifndef _IOKIT_IOFIREWIREDEVICE_H #define _IOKIT_IOFIREWIREDEVICE_H #include <IOKit/firewire/IOFireWireNub.h> class IOFireWireROMCache; struct IOFWNodeScan; struct RomScan; class IOFireWireDevice; #pragma mark - /*! @class IOFireWireDeviceAux @discussion An IOFireWireDeviceAux is for internal use only. You should never subclass IOFireWireDeviceAux */ class IOFireWireDeviceAux : public IOFireWireNubAux { OSDeclareDefaultStructors(IOFireWireDeviceAux) friend class IOFireWireDevice; protected: UInt32 fUnitCount; IOFWSpeed fMaxSpeed; OSSet * fOpenUnitSet; AbsoluteTime fResumeTime; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * reserved; virtual bool init( IOFireWireDevice * primary ); virtual void free(void) APPLE_KEXT_OVERRIDE; virtual bool isTerminated( void ); virtual void setTerminationState( TerminationState state ) APPLE_KEXT_OVERRIDE; void setMaxSpeed( IOFWSpeed speed ); void setUnitCount( UInt32 count ); UInt32 getUnitCount( void ); bool isPhysicalAccessEnabled( void ) APPLE_KEXT_OVERRIDE; virtual IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ) APPLE_KEXT_OVERRIDE; virtual IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ) APPLE_KEXT_OVERRIDE; OSSet * getOpenUnitSet() const; void latchResumeTime( void ); AbsoluteTime getResumeTime( void ); private: OSMetaClassDeclareReservedUnused(IOFireWireDeviceAux, 0); OSMetaClassDeclareReservedUnused(IOFireWireDeviceAux, 1); OSMetaClassDeclareReservedUnused(IOFireWireDeviceAux, 2); OSMetaClassDeclareReservedUnused(IOFireWireDeviceAux, 3); }; #pragma mark - /*! @class IOFireWireDevice @abstract Represents a FireWire device. @discussion The FireWire family tries to read the configuration ROM of each device on the FireWire bus. For each device that responds with its bus information block, the FireWire family publishes an <code>IOFireWireDevice</code> object in the I/O Registry. An <code>IOFireWireDevice</code> object keeps track of the device's node ID, copies config ROM properties into the object's property list, and scans the config ROM for unit directories, publishing an <code>IOFireWireUnit</code> object for each unit directory it finds. */ class IOFireWireDevice : public IOFireWireNub { OSDeclareDefaultStructors(IOFireWireDevice) friend class IOFireWireController; friend class IOFireWireDeviceAux; protected: enum RegistrationState { kDeviceRegistered, kDeviceNeedsRegisterService, kDeviceNotRegistered }; IOFireWireROMCache *fDeviceROM; bool fOpenFromDevice; UInt32 fOpenFromUnitCount; UInt32 fROMGeneration; IORecursiveLock *fROMLock; RegistrationState fRegistrationState; UInt32 fROMReadRetry; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; static void readROMDirGlue(void *refcon, IOReturn status, IOFireWireNub *device, IOFWCommand *fwCmd); static void readROMThreadFunc(void *arg); static void terminateDevice(void *arg); void processROM(RomScan *romScan); virtual void free() APPLE_KEXT_OVERRIDE; public: virtual IOReturn message( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; virtual bool handleOpen( IOService * forClient, IOOptionBits options, void * arg ) APPLE_KEXT_OVERRIDE; virtual void handleClose( IOService * forClient, IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual bool handleIsOpen( const IOService * forClient ) const APPLE_KEXT_OVERRIDE; protected: virtual IOReturn cacheROM(OSData *rom, UInt32 offset, const UInt32 *&romBase); virtual const UInt32 * getROMBase(); virtual void setNodeROM(UInt32 generation, UInt16 localNodeID, const IOFWNodeScan *info); public: virtual bool matchPropertyTable(OSDictionary * table) APPLE_KEXT_OVERRIDE; /*! @function init @abstract Initializes the nub. @param propTable Property table passed to the standard nub initialization. @param scan Pointer to the node scan structure. @result Returns <code>true</code> if initialization was successful; <code>false</code> otherwise. */ virtual bool init(OSDictionary * propTable, const IOFWNodeScan *scan); virtual bool attach(IOService * provider ) APPLE_KEXT_OVERRIDE; virtual bool finalize( IOOptionBits options ) APPLE_KEXT_OVERRIDE; /*! @function setNodeFlags @abstract Sets the node's characteristics. @param flags Refer to "node flags" in IOFireWireFamilyCommon.h. */ virtual void setNodeFlags( UInt32 flags ) APPLE_KEXT_OVERRIDE; /*! @function clearNodeFlags @abstract Resets the node's characteristics. @param flags Refer to "node flags" in IOFireWireFamilyCommon.h. */ virtual void clearNodeFlags( UInt32 flags ) APPLE_KEXT_OVERRIDE; /*! @function getNodeFlags @abstract Retrieves the node's characteristics. @param flags Refer to "node flags" in IOFireWireFamilyCommon.h. @result UInt32 The flags set for a particular node. */ virtual UInt32 getNodeFlags( void ) APPLE_KEXT_OVERRIDE; protected: virtual IOReturn configureNode( void ); public: /*! @function createPhysicalAddressSpace @abstract Creates local physical FireWire address spaces for the device to access. @param mem Memory area allocated to back the physical access by Link hardware. @result A valid <code>IOFWPhysicalAddressSpace</code> object on success; NULL on failure. */ virtual IOFWPhysicalAddressSpace *createPhysicalAddressSpace(IOMemoryDescriptor *mem) APPLE_KEXT_OVERRIDE; /*! @function createPseudoAddressSpace @abstract Creates local pseudo FireWire address spaces for the device to access. @param addr The FireWire address that is mapped to the pseudo address access. @param len Size of the address space to allocate. @param reader Read callback, when the device reads from this address space. @param writer Write callback, when the device writes to this address space. @param refcon Client's callback object returned during reader/writer callbacks. @result A valid <code>IOFWPseudoAddressSpace</code> object on success; NULL on failure. */ virtual IOFWPseudoAddressSpace *createPseudoAddressSpace(FWAddress *addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void *refcon) APPLE_KEXT_OVERRIDE; protected: virtual IOReturn readRootDirectory( IOConfigDirectory * directory, OSDictionary * propTable ); virtual IOReturn processRootDirectory( OSDictionary * propTable ); virtual IOReturn readUnitDirectories( IOConfigDirectory * directory, OSSet * unitInfo ); virtual IOReturn processUnitDirectories( OSSet * unitSet ); virtual void setRegistrationState( RegistrationState fRegistrationState ); virtual void preprocessDirectories( OSDictionary * rootPropTable, OSSet * unitSet ); virtual void configurePhysicalFilter( void ); protected: virtual IOFireWireNubAux * createAuxiliary( void ) APPLE_KEXT_OVERRIDE; public: inline bool isTerminated( void ) { return ((IOFireWireDeviceAux*)fAuxiliary)->isTerminated(); } /*! @function setMaxSpeed @abstract Sets the maximum speed for this node. @param speed Maximum speed. Refer to "bus speed numbers" in IOFireWireFamilyCommon.h. */ inline void setMaxSpeed( IOFWSpeed speed ) { ((IOFireWireDeviceAux*)fAuxiliary)->setMaxSpeed( speed ); } protected: inline void setUnitCount( UInt32 count ) { ((IOFireWireDeviceAux*)fAuxiliary)->setUnitCount( count ); } inline OSSet * getOpenUnitSet( void ) const { return ((IOFireWireDeviceAux*)fAuxiliary)->getOpenUnitSet(); } public: /*! @function getUnitCount @abstract Returns number of units attached to this device. @result UInt32 The number of units attached to this device. */ inline UInt32 getUnitCount( void ) { return ((IOFireWireDeviceAux*)fAuxiliary)->getUnitCount(); } protected: inline AbsoluteTime getResumeTime( void ) { return ((IOFireWireDeviceAux*)fAuxiliary)->getResumeTime(); } inline void latchResumeTime( void ) { ((IOFireWireDeviceAux*)fAuxiliary)->latchResumeTime(); } private: OSMetaClassDeclareReservedUnused(IOFireWireDevice, 0); OSMetaClassDeclareReservedUnused(IOFireWireDevice, 1); }; #endif /* ! _IOKIT_IOFIREWIREDEVICE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireNub.h
/* * Copyright (c) 1998-2002 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@ */ /* * * IOFireWireNub.h * * * Note: IOFWCommand(s) are allocated by methods in this class. * The remaining methods to setup and submit IOFWCommands are defined in * IOFWCommand.h */ #ifndef _IOKIT_IOFIREWIRENUB_H #define _IOKIT_IOFIREWIRENUB_H // public #include <IOKit/IOService.h> #include <IOKit/firewire/IOFWCommand.h> #include <IOKit/firewire/IOFWAddressSpace.h> class IOFireWireController; class IOFireWireBus; class IOConfigDirectory; class IOFireWireNub; class IOFireWireDevice; class IOFireWireUnit; class IOFWSimplePhysicalAddressSpace; class IOFWSimpleContiguousPhysicalAddressSpace; enum TerminationState { kNotTerminated = 0, kNeedsTermination, kTerminated }; #pragma mark - /*! @class IOFireWireNubAux */ class IOFireWireNubAux : public OSObject { OSDeclareDefaultStructors(IOFireWireNubAux) friend class IOFireWireNub; protected: IOFireWireNub * fPrimary; TerminationState fTerminationState; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * reserved; virtual bool init( IOFireWireNub * primary ); virtual void free(void) APPLE_KEXT_OVERRIDE; virtual UInt32 hopCount( IOFireWireNub * nub ); virtual UInt32 hopCount( void ); virtual TerminationState getTerminationState( void ); virtual void setTerminationState( TerminationState state ); virtual bool isPhysicalAccessEnabled( void ); virtual IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ); virtual IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ); private: OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 0); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 1); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 2); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 3); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 4); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 5); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 6); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 7); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 8); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 9); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 10); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 11); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 12); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 13); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 14); OSMetaClassDeclareReservedUnused(IOFireWireNubAux, 15); }; #pragma mark - /*! @class IOFireWireNub */ class IOFireWireNub : public IOService { OSDeclareAbstractStructors(IOFireWireNub) friend class IOFireWireController; friend class IOFireWireNubAux; friend class IOFireWireDeviceAux; friend class IOFireWireUnitAux; friend class IOFireWireDevice; friend class IOFireWireUnit; /*------------------Useful info about device (also available in the registry)--------*/ protected: int fDeviceSpeed; // Max supported by device int fCommsSpeed; // Max speed this node can communicate with device UInt16 fNodeID; // Current node ID (could change after bus reset!) UInt16 fLocalNodeID; // ID of the local node (could change after bus reset!) UInt32 fGeneration; // ID Of bus topology that fNodeID is valid for. CSRNodeUniqueID fUniqueID; // Device's globally unique ID (never changes) mach_timespec_t fAsyncTimeout; // Guesstimate of how long to wait for response // from device when making async requests // Different values for quad/block transfers? // OS8 FW has 40/100 mSec. int fMaxReadPackLog; int fMaxWritePackLog; int fMaxReadROMPackLog; IOFireWireController *fControl; IOConfigDirectory *fDirectory; UInt32 fNodeFlags; OSSet * fConfigDirectorySet; IOFireWireNubAux * fAuxiliary; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; virtual void free(void) APPLE_KEXT_OVERRIDE; /*------------------Methods provided to FireWire device clients-----------------------*/ public: // Get nodeID and bus generation info IOReturn getNodeIDGeneration(UInt32 &generation, UInt16 &nodeID, UInt16 &localID) const; IOReturn getNodeIDGeneration(UInt32 &generation, UInt16 &nodeID) const; // How fast can this system talk to the node? virtual IOFWSpeed FWSpeed() const; // How fast can this node talk to another node? virtual IOFWSpeed FWSpeed(const IOFireWireNub *dst) const; // How big (as a power of two) can packets sent to/received from the node be? virtual int maxPackLog(bool forSend) const; // How big (as a power of two) can packets sent to/received from a specified address in the node be? virtual int maxPackLog(bool forSend, FWAddress address) const; // How big (as a power of two) can packets sent from this node to dst node/received from dst be? virtual int maxPackLog(bool forSend, const IOFireWireNub *dst) const; // Set maximum packet size nub can handle virtual void setMaxPackLog(bool forSend, bool forROM, int maxPackLog); /* * Create various FireWire commands to send to the device */ virtual IOFWReadCommand *createReadCommand(FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false); virtual IOFWReadQuadCommand *createReadQuadCommand(FWAddress devAddress, UInt32 *quads, int numQuads, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false); virtual IOFWWriteCommand *createWriteCommand(FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false); virtual IOFWWriteQuadCommand *createWriteQuadCommand(FWAddress devAddress, UInt32 *quads, int numQuads, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false); // size is 1 for 32 bit compare, 2 for 64 bit. virtual IOFWCompareAndSwapCommand *createCompareAndSwapCommand(FWAddress devAddress, const UInt32 *cmpVal, const UInt32 *newVal, int size, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false); /* * Create local FireWire address spaces for the device to access */ virtual IOFWPhysicalAddressSpace *createPhysicalAddressSpace(IOMemoryDescriptor *mem); virtual IOFWPseudoAddressSpace *createPseudoAddressSpace(FWAddress *addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void *refcon); /* * Get Config directory for nub * Device nub directory is root directory, Unit nub directory is Unit directory. * * Depricated use getConfigDirectoryRef * */ virtual IOReturn getConfigDirectory(IOConfigDirectory *&dir); /* * Get bus for nub */ IOFireWireBus * getBus() const; IOFireWireController * getController() const; const CSRNodeUniqueID &getUniqueID() const; /* * Standard nub initialization */ virtual bool init(OSDictionary * propTable) APPLE_KEXT_OVERRIDE; virtual void setNodeFlags( UInt32 flags ); virtual UInt32 getNodeFlags( void ); virtual void clearNodeFlags( UInt32 flags ); virtual IOReturn setConfigDirectory( IOConfigDirectory *directory ); virtual IOReturn getConfigDirectoryRef( IOConfigDirectory *&dir ); inline UInt32 hopCount( IOFireWireNub * nub ) { return fAuxiliary->hopCount( nub ); } inline UInt32 hopCount( void ) { return fAuxiliary->hopCount(); } inline TerminationState getTerminationState( void ) { return fAuxiliary->getTerminationState(); } protected: inline void setTerminationState( TerminationState state ) { fAuxiliary->setTerminationState( state ); } virtual IOFireWireNubAux * createAuxiliary( void ); public: inline bool isPhysicalAccessEnabled( void ) { return fAuxiliary->isPhysicalAccessEnabled(); } inline IOFWSimpleContiguousPhysicalAddressSpace * createSimpleContiguousPhysicalAddressSpace( vm_size_t size, IODirection direction ) { return fAuxiliary->createSimpleContiguousPhysicalAddressSpace( size, direction ); } inline IOFWSimplePhysicalAddressSpace * createSimplePhysicalAddressSpace( vm_size_t size, IODirection direction ) { return fAuxiliary->createSimplePhysicalAddressSpace( size, direction ); } private: OSMetaClassDeclareReservedUsed(IOFireWireNub, 0); OSMetaClassDeclareReservedUsed(IOFireWireNub, 1); OSMetaClassDeclareReservedUnused(IOFireWireNub, 2); OSMetaClassDeclareReservedUnused(IOFireWireNub, 3); }; #endif /* ! _IOKIT_IOFIREWIRENUB_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWirePowerManager.h
/* * Copyright (c) 1998-2002 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@ */ #ifndef _IOKIT_IOFIREWIREPOWERMANAGER_H #define _IOKIT_IOFIREWIREPOWERMANAGER_H #include <IOKit/firewire/IOFireWireFamilyCommon.h> #include <libkern/c++/OSObject.h> #include <IOKit/IOReturn.h> class IOFireWireController; /*! @class IOFireWirePowerManager */ class IOFireWirePowerManager : public OSObject { OSDeclareAbstractStructors(IOFireWirePowerManager); protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; IOFireWireController * fControl; UInt32 fMaximumDeciwatts; UInt32 fAllocatedDeciwatts; public: static IOFireWirePowerManager * createWithController( IOFireWireController * controller ); virtual bool initWithController( IOFireWireController * controller ); virtual void setMaximumDeciwatts( UInt32 deciwatts ); virtual IOReturn allocateDeciwatts( UInt32 deciwatts ); virtual void deallocateDeciwatts( UInt32 deciwatts ); private: OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 0); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 1); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 2); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 3); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 4); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 5); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 6); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 7); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 8); OSMetaClassDeclareReservedUnused(IOFireWirePowerManager, 9); }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFireWireLocalNode.h
/* * IOFireWireLocalNode.h * IOFireWireFamily * * Created by Niels on Fri Aug 16 2002. * Copyright (c) 2002 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@ */ /* $Log: not supported by cvs2svn $ Revision 1.7 2008/11/14 00:17:12 arulchan fix for rdar://5939334 Revision 1.6 2005/02/18 22:56:53 gecko1 3958781 Q45C EVT: FireWire ASP reporter says port speed is 800 Mb/sec Revision 1.5 2003/02/20 02:00:12 collin *** empty log message *** Revision 1.4 2003/02/17 21:47:53 collin *** empty log message *** Revision 1.3 2002/10/18 23:29:44 collin fix includes, fix cast which fails on new compiler Revision 1.2 2002/09/25 00:27:24 niels flip your world upside-down */ // public #import <IOKit/firewire/IOFireWireNub.h> class IOFireWireLocalNode; #pragma mark - /*! @class IOFireWireLocalNodeAux */ class IOFireWireLocalNodeAux : public IOFireWireNubAux { OSDeclareDefaultStructors(IOFireWireLocalNodeAux) friend class IOFireWireLocalNode; protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * reserved; virtual bool init( IOFireWireLocalNode * primary ); virtual void free(void) APPLE_KEXT_OVERRIDE; private: OSMetaClassDeclareReservedUnused(IOFireWireLocalNodeAux, 0); OSMetaClassDeclareReservedUnused(IOFireWireLocalNodeAux, 1); OSMetaClassDeclareReservedUnused(IOFireWireLocalNodeAux, 2); OSMetaClassDeclareReservedUnused(IOFireWireLocalNodeAux, 3); }; #pragma mark - /*! @class IOFireWireLocalNode */ class IOFireWireLocalNode : public IOFireWireNub { OSDeclareDefaultStructors(IOFireWireLocalNode) friend class IOFireWireLocalNodeAux; /*------------------Useful info about device (also available in the registry)--------*/ protected: /*-----------Methods provided to FireWire device clients-------------*/ public: // Set up properties affected by bus reset virtual void setNodeProperties(UInt32 generation, UInt16 nodeID, UInt32 *selfIDs, int numIDs, IOFWSpeed maxSpeed ); /* * Standard nub initialization */ virtual bool init(OSDictionary * propTable) APPLE_KEXT_OVERRIDE; virtual bool attach(IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void handleClose( IOService * forClient, IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual bool handleOpen( IOService * forClient, IOOptionBits options, void * arg ) APPLE_KEXT_OVERRIDE; virtual bool handleIsOpen( const IOService * forClient ) const APPLE_KEXT_OVERRIDE; /* * Trick method to create protocol user clients */ virtual IOReturn setProperties( OSObject * properties ) APPLE_KEXT_OVERRIDE; protected: virtual IOFireWireNubAux * createAuxiliary( void ) APPLE_KEXT_OVERRIDE; public: virtual IOReturn message( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; virtual void free(void) APPLE_KEXT_OVERRIDE; protected: OSSet * fOpenClients; };
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWCommand.h
/* * Copyright (c) 1998-2002 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@ */ /* * * IOFWCommand.h * */ #ifndef _IOKIT_IOFWCOMMAND_H #define _IOKIT_IOFWCOMMAND_H #include <IOKit/IOCommand.h> #include <IOKit/IOLib.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> #include <IOKit/firewire/IOFWSyncer.h> #define kFWCmdDefaultRetries 3 #define kFWCmdZeroRetries 0 #define kFWCmdReducedRetries 2 #define kFWCmdIncreasedRetries 6 class IOMemoryDescriptor; class IOSyncer; class IOFireWireBus; class IOFireWireController; class IOFireWireNub; class IOFWAddressSpace; // Description of chunk of local FW address space class IOFWCommand; class IOFWBusCommand; class IOFWAsyncStreamCommand; class IOCommandGate; class IOFWAsyncPHYCommand; struct AsyncPendingTrans; // Struct for head of command queue /*! @struct IOFWCmdQ @abstract Structure for head of a queue of IOFWCommands @field fHead Points to the head of the queue, or NULL if queue is empty @field fTail Points to the tail of the queue, or NULL if queue is empty @function headChanged called when head command is changed, or the command itself changes state. */ struct IOFWCmdQ { IOFWCommand *fHead; IOFWCommand *fTail; bool executeQueue(bool all); virtual void headChanged(IOFWCommand *oldHead); virtual ~IOFWCmdQ() {} void checkProgress( void ); }; // Callback when device command completes asynchronously typedef void (*FWDeviceCallback)(void *refcon, IOReturn status, IOFireWireNub *device, IOFWCommand *fwCmd); // Callback when bus command completes asynchronously typedef void (*FWBusCallback)(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWBusCommand *fwCmd); // Callback when async stream command completes asynchronously typedef void (*FWAsyncStreamCallback)(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWAsyncStreamCommand *fwCmd); // Callback when async stream command completes asynchronously typedef void (*FWAsyncPHYCallback)(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWAsyncPHYCommand *fwCmd ); // Callback when async stream packet is received typedef void (*FWAsyncStreamReceiveCallback)(void *refcon, const void *buf); #pragma mark - /* * Base class for FireWire commands */ /*! @class IOFWCommand */ class IOFWCommand : public IOCommand { OSDeclareAbstractStructors(IOFWCommand) protected: IOReturn fStatus; IOFireWireController *fControl; IOFWCommand * fQueuePrev; IOFWCommand * fQueueNext; IOFWCmdQ * fQueue; UInt32 fTimeout; // How long (in microsecs) after execute() to timeout AbsoluteTime fDeadline; // Time after which this command has timed out. IOFWSyncer * fSyncWakeup; UInt8 fSync; UInt8 fCancelOnReset; UInt8 spare[2]; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct MemberVariables { void * fFWIMRefCon; IOReturn fCompletionStatus; bool fSubmitTimeLatched; AbsoluteTime fSubmitTime; bool fFlush; }; /*! @var reserved Reserved for future use. (Internal use only) */ MemberVariables * fMembers; virtual IOReturn complete(IOReturn status); virtual void updateTimer(); virtual IOReturn startExecution(); /* * Execute the FWCommand immediately * must be called with the workloop gate closed */ virtual IOReturn execute() = 0; public: virtual bool initWithController(IOFireWireController *control); virtual void free( void ) APPLE_KEXT_OVERRIDE; IOReturn getStatus() const { return fStatus; }; /* * Submit the FWCommand. * if queue is false the command's execute() * method will be called on the caller's thread, otherwise * the command wil be queued for execution on the work loop thread. */ virtual IOReturn submit(bool queue = false); /* * Cancel command, causes it to complete with given status */ virtual IOReturn cancel(IOReturn reason); /*! @function setHead inserts a command at the head of a queue. @param queue queue command is being added to */ virtual void setHead(IOFWCmdQ &queue); /*! @function insertAfter inserts a command after the specified one. @param prev command to insert after @param queue queue command is being added to */ virtual void insertAfter(IOFWCommand &prev); /*! @function removeFromQ Removes command from current queue. */ virtual void removeFromQ(); IOFWCommand *getPrevious() const { return fQueuePrev; }; IOFWCommand *getNext() const { return fQueueNext; }; const AbsoluteTime &getDeadline() const { return fDeadline; }; bool cancelOnReset() const { return fCancelOnReset; }; bool Busy() const { return fStatus == kIOReturnBusy || fStatus == kIOFireWirePending;}; void setTimeout( UInt32 timeout ) { fTimeout = timeout; }; friend struct IOFWCmdQ; void * getFWIMRefCon( void ) { return fMembers->fFWIMRefCon; } void setFWIMRefCon( void * refcon ) { fMembers->fFWIMRefCon = refcon; } void setFlush( bool flush ) { fMembers->fFlush = flush; } virtual IOReturn checkProgress( void ); private: OSMetaClassDeclareReservedUsed(IOFWCommand, 0); OSMetaClassDeclareReservedUnused(IOFWCommand, 1); }; #pragma mark - /* * Bus control commands */ /*! @class IOFWBusCommand */ class IOFWBusCommand : public IOFWCommand { OSDeclareAbstractStructors(IOFWBusCommand) protected: FWBusCallback fComplete; void * fRefCon; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; virtual IOReturn complete(IOReturn status) APPLE_KEXT_OVERRIDE; virtual bool initWithController(IOFireWireController *control, FWBusCallback completion=NULL, void *refcon=NULL); virtual IOReturn reinit(FWBusCallback completion, void *refcon); private: OSMetaClassDeclareReservedUnused(IOFWBusCommand, 0); }; #pragma mark - /* * Command to execute some code after a specified delay (in microseconds) * All it does is timeout after the specified delay, hence calling the completion * callback. */ /*! @class IOFWDelayCommand */ class IOFWDelayCommand : public IOFWBusCommand { OSDeclareDefaultStructors(IOFWDelayCommand) /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; protected: virtual IOReturn execute() APPLE_KEXT_OVERRIDE; public: virtual bool initWithDelay(IOFireWireController *control, UInt32 uSecs, FWBusCallback completion, void *refcon); virtual IOReturn reinit(UInt32 uSecs, FWBusCallback completion, void *refcon); private: OSMetaClassDeclareReservedUnused(IOFWDelayCommand, 0); }; /* * Send an async request to a device */ class IOFWUserReadQuadletCommand ; class IOFWUserWriteCommand ; #pragma mark - /*! @class IOFWAsyncCommand */ class IOFWAsyncCommand : public IOFWCommand { OSDeclareAbstractStructors(IOFWAsyncCommand) protected: IOFireWireNub * fDevice; FWDeviceCallback fComplete; void * fRefCon; IOMemoryDescriptor *fMemDesc; AsyncPendingTrans * fTrans; UInt32 fAddressHi; UInt32 fAddressLo; IOByteCount fBytesTransferred; int fSize; int fSpeed; int fMaxPack; int fCurRetries; int fMaxRetries; UInt32 fGeneration; // bus topology fNodeID is valid for. UInt16 fNodeID; bool fFailOnReset; bool fWrite; typedef struct { // some of our subclasses didn't have room for expansion data, so // we've reserved space for their use here. void * fSubclassMembers; int fMaxSpeed; int fAckCode; UInt32 fResponseCode; UInt32 fFastRetryCount; int fResponseSpeed; bool fForceBlockRequests; } MemberVariables; MemberVariables * fMembers; virtual IOReturn complete(IOReturn status) APPLE_KEXT_OVERRIDE; virtual bool initWithController(IOFireWireController *control) APPLE_KEXT_OVERRIDE; virtual bool initAll(IOFireWireNub *device, FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion, void *refcon, bool failOnReset); virtual bool initAll(IOFireWireController *control, UInt32 generation, FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion, void *refcon); virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit(FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion, void *refcon, bool failOnReset); virtual IOReturn reinit(UInt32 generation, FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion, void *refcon); bool createMemberVariables( void ); void destroyMemberVariables( void ); public: // Utility for setting generation on newly created command virtual void setGeneration(UInt32 generation) { fGeneration = generation; } // To be called by IOFireWireController and derived classes. virtual void gotPacket(int rcode, const void* data, int size) = 0; virtual void gotAck(int ackCode); // update nodeID/generation after bus reset, from the device object IOReturn updateGeneration(); // explicitly update nodeID/generation after bus reset IOReturn updateNodeID(UInt32 generation, UInt16 nodeID); // Generally useful stuff IOByteCount getBytesTransferred() const { return fBytesTransferred; }; FWAddress getAddress() const { return FWAddress(fAddressHi, fAddressLo, fNodeID); } bool failOnReset() const { return fFailOnReset; } IOFireWireNub * getDevice() const { return fDevice; } /*! @function setMaxPacket Sets the maximum size for block transfers used by the command. The command is initialized to use the maximum packet size calculated from the device's PHY speed, bus info block and the bus topology. Call this method before calling submit(). @param maxBytes Maximum packet size in bytes. If the maxsize is 4 then quadlet transfers will be used. */ IOReturn setMaxPacket(UInt32 maxBytes) { if(fStatus == kIOReturnBusy || fStatus == kIOFireWirePending) return fStatus; fMaxPack = maxBytes; return kIOReturnSuccess; } void setMaxSpeed( int speed ); void setAckCode( int ack ); int getAckCode( void ); void setRetries( int retries); int getMaxRetries( void ); void setResponseCode( UInt32 rcode ); UInt32 getResponseCode( void ) const; void setFastRetryCount( UInt32 count ) { fMembers->fFastRetryCount = count; }; UInt32 getFastRetryCount( void ) { return fMembers->fFastRetryCount; }; void setResponseSpeed( int speed ) { fMembers->fResponseSpeed = speed; }; int getResponseSpeed( void ) { return fMembers->fResponseSpeed; }; // forces even 4 byte transactions to be block requests void setForceBlockRequests( bool enabled ) { fMembers->fForceBlockRequests = enabled; } virtual IOReturn checkProgress( void ) APPLE_KEXT_OVERRIDE; private: OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 0); OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 1); OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 2); OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 3); }; #pragma mark - /* * Concrete async requests - read, write and hordes of read/modify/write */ class IOFWReadCommand : public IOFWAsyncCommand { OSDeclareDefaultStructors(IOFWReadCommand) protected: virtual void gotPacket(int rcode, const void* data, int size) APPLE_KEXT_OVERRIDE; virtual IOReturn execute() APPLE_KEXT_OVERRIDE; public: virtual bool initAll(IOFireWireNub *device, FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion, void *refcon, bool failOnReset) APPLE_KEXT_OVERRIDE; virtual bool initAll(IOFireWireController *control, UInt32 generation, FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion, void *refcon) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit(FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit(UInt32 generation, FWAddress devAddress, IOMemoryDescriptor *hostMem, FWDeviceCallback completion=NULL, void *refcon=NULL) APPLE_KEXT_OVERRIDE; private: OSMetaClassDeclareReservedUnused(IOFWReadCommand, 0); OSMetaClassDeclareReservedUnused(IOFWReadCommand, 1); }; #pragma mark - /*! @class IOFWReadQuadCommand @discussion An easier to use version of IOFWReadCommand for use when the data to be transferred is an integer number of quads. Note that block read requests will be used for transfers greater than one quad unless setMaxPacket(4) is called. */ class IOFWReadQuadCommand : public IOFWAsyncCommand { OSDeclareDefaultStructors(IOFWReadQuadCommand) protected: UInt32 * fQuads; typedef struct { bool fPingTime; } MemberVariables; bool createMemberVariables( void ); void destroyMemberVariables( void ); virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual void gotPacket(int rcode, const void* data, int size) APPLE_KEXT_OVERRIDE; virtual IOReturn execute() APPLE_KEXT_OVERRIDE; public: virtual bool initAll(IOFireWireNub *device, FWAddress devAddress, UInt32 *quads, int numQuads, FWDeviceCallback completion, void *refcon, bool failOnReset); virtual bool initAll(IOFireWireController *control, UInt32 generation, FWAddress devAddress, UInt32 *quads, int numQuads, FWDeviceCallback completion, void *refcon); virtual IOReturn reinit(FWAddress devAddress, UInt32 *quads, int numQuads, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false); virtual IOReturn reinit(UInt32 generation, FWAddress devAddress, UInt32 *quads, int numQuads, FWDeviceCallback completion=NULL, void *refcon=NULL); void setPingTime( bool state ) { ((MemberVariables*)fMembers->fSubclassMembers)->fPingTime = state; }; private: OSMetaClassDeclareReservedUnused(IOFWReadQuadCommand, 0); OSMetaClassDeclareReservedUnused(IOFWReadQuadCommand, 1); }; #pragma mark - class IOFWWriteCommand : public IOFWAsyncCommand { OSDeclareDefaultStructors(IOFWWriteCommand) protected: int fPackSize; typedef struct { bool fDeferredNotify; bool fFastRetryOnBusy; } MemberVariables; virtual IOReturn execute() APPLE_KEXT_OVERRIDE; virtual void gotPacket( int rcode, const void* data, int size ) APPLE_KEXT_OVERRIDE; bool createMemberVariables( void ); void destroyMemberVariables( void ); public: virtual bool initWithController(IOFireWireController *control) APPLE_KEXT_OVERRIDE; virtual bool initAll( IOFireWireNub * device, FWAddress devAddress, IOMemoryDescriptor * hostMem, FWDeviceCallback completion, void * refcon, bool failOnReset ) APPLE_KEXT_OVERRIDE; virtual bool initAll( IOFireWireController * control, UInt32 generation, FWAddress devAddress, IOMemoryDescriptor * hostMem, FWDeviceCallback completion, void * refcon ) APPLE_KEXT_OVERRIDE; virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit( FWAddress devAddress, IOMemoryDescriptor * hostMem, FWDeviceCallback completion = NULL, void * refcon = NULL, bool failOnReset = false ) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit( UInt32 generation, FWAddress devAddress, IOMemoryDescriptor * hostMem, FWDeviceCallback completion = NULL, void * refcon = NULL ) APPLE_KEXT_OVERRIDE; void setDeferredNotify( bool state ) { ((MemberVariables*)fMembers->fSubclassMembers)->fDeferredNotify = state; }; void setFastRetryOnBusy( bool state ) { ((MemberVariables*)fMembers->fSubclassMembers)->fFastRetryOnBusy = state; }; private: OSMetaClassDeclareReservedUnused(IOFWWriteCommand, 0); OSMetaClassDeclareReservedUnused(IOFWWriteCommand, 1); }; #pragma mark - /*! @class IOFWWriteQuadCommand @discussion An easier to use version of IOFWWriteCommand for use when the data to be transferred is small and an integer number of quads. Note that block read requests will be used for transfers greater than one quad unless setMaxPacket(4) is called. kMaxWriteQuads is the largest legal number of quads that this object can be asked to transfer (the data is copied into an internal buffer in init() and reinit()). */ class IOFWWriteQuadCommand : public IOFWAsyncCommand { OSDeclareDefaultStructors(IOFWWriteQuadCommand) public: enum { kMaxWriteQuads = 8 }; protected: UInt32 fQuads[kMaxWriteQuads]; UInt32 * fQPtr; int fPackSize; typedef struct { bool fDeferredNotify; IOMemoryDescriptor * fMemory; } MemberVariables; virtual void gotPacket( int rcode, const void* data, int size ) APPLE_KEXT_OVERRIDE; virtual IOReturn execute() APPLE_KEXT_OVERRIDE; bool createMemberVariables( void ); void destroyMemberVariables( void ); public: virtual bool initWithController(IOFireWireController *control) APPLE_KEXT_OVERRIDE; virtual bool initAll( IOFireWireNub * device, FWAddress devAddress, UInt32 * quads, int numQuads, FWDeviceCallback completion, void * refcon, bool failOnReset ); virtual bool initAll( IOFireWireController * control, UInt32 generation, FWAddress devAddress, UInt32 * quads, int numQuads, FWDeviceCallback completion, void * refcon ); virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit( FWAddress devAddress, UInt32 * quads, int numQuads, FWDeviceCallback completion = NULL, void * refcon = NULL, bool failOnReset = false ); virtual IOReturn reinit( UInt32 generation, FWAddress devAddress, UInt32 * quads, int numQuads, FWDeviceCallback completion = NULL, void * refcon = NULL ); protected: void setQuads( UInt32 * quads, int numQuads ); bool createMemoryDescriptor( void ); void destroyMemoryDescriptor( void ); public: void setDeferredNotify( bool state ) { ((MemberVariables*)fMembers->fSubclassMembers)->fDeferredNotify = state; }; private: OSMetaClassDeclareReservedUnused(IOFWWriteQuadCommand, 0); OSMetaClassDeclareReservedUnused(IOFWWriteQuadCommand, 1); }; /* * May need more parameters for some of these, * and/or derive from a base Lock transaction command */ #pragma mark - /*! @class IOFWCompareAndSwapCommand */ class IOFWCompareAndSwapCommand : public IOFWAsyncCommand { OSDeclareDefaultStructors(IOFWCompareAndSwapCommand) protected: UInt32 fInputVals[4]; UInt32 fOldVal[2]; typedef struct { IOMemoryDescriptor * fMemory; } MemberVariables; MemberVariables * fMembers; virtual void gotPacket(int rcode, const void* data, int size) APPLE_KEXT_OVERRIDE; virtual IOReturn execute() APPLE_KEXT_OVERRIDE; public: // Compare to cmpVal, and if equal replace with newVal. // Size = 1 for 32 bit operation (one quad), 2 for 64 bit (two quads) virtual bool initWithController(IOFireWireController *control) APPLE_KEXT_OVERRIDE; virtual bool initAll(IOFireWireNub *device, FWAddress devAddress, const UInt32 *cmpVal, const UInt32 *newVal, int size, FWDeviceCallback completion, void *refcon, bool failOnReset); virtual bool initAll(IOFireWireController *control, UInt32 generation, FWAddress devAddress, const UInt32 *cmpVal, const UInt32 *newVal, int size, FWDeviceCallback completion, void *refcon); virtual IOReturn reinit(FWAddress devAddress, const UInt32 *cmpVal, const UInt32 *newVal, int size, FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false); virtual IOReturn reinit(UInt32 generation, FWAddress devAddress, const UInt32 *cmpVal, const UInt32 *newVal, int size, FWDeviceCallback completion=NULL, void *refcon=NULL); // sets oldVal to the old value returned by the device, and // returns true if it was the expected value, ie. the lock succeeded virtual bool locked(UInt32 *oldVal); virtual void free( void ) APPLE_KEXT_OVERRIDE; protected: bool createMemberVariables( void ); void destroyMemberVariables( void ); void setInputVals( const UInt32 * cmpVal, const UInt32 * newVal, int size ); bool createMemoryDescriptor( void ); void destroyMemoryDescriptor( void ); private: OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 0); OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 1); OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 2); OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 3); }; /* * Send an async stream packet */ #pragma mark - /*! @class IOFWAsyncStreamCommand */ class IOFWAsyncStreamCommand : public IOFWCommand { // temporary for debugging: friend class IOFireWireUserClient ; OSDeclareDefaultStructors(IOFWAsyncStreamCommand) protected: FWAsyncStreamCallback fComplete; void * fRefCon; IOMemoryDescriptor * fMemDesc; int fSpeed; int fSize; int fCurRetries; int fMaxRetries; int fChannel; int fSyncBits; int fTag; UInt32 fGeneration; // bus topology fNodeID is valid for. bool fFailOnReset; typedef struct { } MemberVariables; MemberVariables * fMembers; virtual IOReturn complete( IOReturn status) APPLE_KEXT_OVERRIDE; // To be called by IOFireWireController and derived classes. virtual IOReturn execute() APPLE_KEXT_OVERRIDE; public: virtual bool initAll( IOFireWireController * control, UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor * hostMem, UInt32 size, int speed, FWAsyncStreamCallback completion, void * refcon); virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit( UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor * hostMem, UInt32 size, int speed, FWAsyncStreamCallback completion, void * refcon); virtual void gotAck( int ackCode); // Utility for setting generation on newly created command virtual void setGeneration( UInt32 generation) { fGeneration = generation; } // update nodeID/generation after bus reset, from the device object IOReturn updateGeneration(); bool failOnReset() const { return fFailOnReset; } private: OSMetaClassDeclareReservedUnused(IOFWAsyncStreamCommand, 0); OSMetaClassDeclareReservedUnused(IOFWAsyncStreamCommand, 1); public: virtual bool initAll( IOFireWireController * control, UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor * hostMem, UInt32 size, int speed, FWAsyncStreamCallback completion, void * refcon, bool failOnReset ); virtual IOReturn reinit( UInt32 generation, UInt32 channel, UInt32 sync, UInt32 tag, IOMemoryDescriptor * hostMem, UInt32 size, int speed, FWAsyncStreamCallback completion, void * refcon, bool failOnReset); }; /* * Send an async PHY packet */ #pragma mark - /*! @class IOFWAsyncPHYCommand */ class IOFWAsyncPHYCommand : public IOFWCommand { // temporary for debugging: friend class IOFireWireUserClient; OSDeclareDefaultStructors( IOFWAsyncPHYCommand ) protected: AsyncPendingTrans * fTrans; FWAsyncPHYCallback fComplete; void * fRefCon; int fCurRetries; int fMaxRetries; UInt32 fGeneration; bool fFailOnReset; UInt32 fData1; UInt32 fData2; int fAckCode; UInt32 fResponseCode; typedef struct { } MemberVariables; MemberVariables * fMembers; virtual IOReturn complete( IOReturn status ) APPLE_KEXT_OVERRIDE; // To be called by IOFireWireController and derived classes. virtual IOReturn execute() APPLE_KEXT_OVERRIDE; void setResponseCode( UInt32 rcode ); void setAckCode( int ack ); public: virtual bool initAll( IOFireWireController * control, UInt32 generation, UInt32 data1, UInt32 data2, FWAsyncPHYCallback completion, void * refcon, bool failOnReset ); virtual void free( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reinit( UInt32 generation, UInt32 data1, UInt32 data2, FWAsyncPHYCallback completion, void * refcon, bool failOnReset ); virtual void gotAck( int ackCode ); // Utility for setting generation on newly created command virtual void setGeneration( UInt32 generation ) { fGeneration = generation; } // update nodeID/generation after bus reset, from the device object IOReturn updateGeneration(); bool failOnReset() const { return fFailOnReset; } virtual void gotPacket( int rcode ); int getAckCode( void ); UInt32 getResponseCode( void ) const; void setRetries( int retries); private: OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 0); OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 1); OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 2); OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 3); OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 4); OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 5); OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 6); OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 7); }; #endif /* _IOKIT_IOFWCOMMAND_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWDCL.h
/* * IOFWDCL.h * IOFireWireFamily * * Created by Niels on Fri Feb 21 2003. * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. * * $Log: not supported by cvs2svn $ * Revision 1.19 2007/03/14 01:01:12 collin * *** empty log message *** * * Revision 1.18 2007/01/26 23:42:19 ayanowit * another fix for nuDCL rosetta mode * * Revision 1.17 2006/08/16 01:41:41 collin * *** empty log message *** * * Revision 1.16 2006/03/09 22:26:46 niels * fix 4466075 * * Revision 1.15 2006/03/09 22:20:14 niels * fix 4466075 * * Revision 1.14 2006/03/09 21:40:44 niels * fix 4466075 * * Revision 1.13 2006/02/09 00:21:50 niels * merge chardonnay branch to tot * * Revision 1.12.4.1 2005/08/06 01:31:31 collin * *** empty log message *** * * Revision 1.12 2005/02/18 03:19:03 niels * fix isight * * Revision 1.11 2004/04/19 21:51:49 niels * *** empty log message *** * * Revision 1.10 2004/03/25 00:00:23 niels * fix panic allocating large physical address spaces * * Revision 1.9 2003/10/31 02:40:58 niels * *** empty log message *** * * Revision 1.8 2003/08/26 05:11:21 niels * *** empty log message *** * * Revision 1.7 2003/08/25 08:39:15 niels * *** empty log message *** * * Revision 1.6 2003/08/18 23:18:14 niels * *** empty log message *** * * Revision 1.5 2003/08/08 22:30:32 niels * *** empty log message *** * * Revision 1.4 2003/07/30 05:22:14 niels * *** empty log message *** * * Revision 1.3 2003/07/29 22:49:22 niels * *** empty log message *** * * Revision 1.2 2003/07/21 06:52:58 niels * merge isoch to TOT * * Revision 1.1.2.5 2003/07/18 00:17:41 niels * *** empty log message *** * * Revision 1.1.2.4 2003/07/14 22:08:53 niels * *** empty log message *** * * Revision 1.1.2.3 2003/07/11 18:15:33 niels * *** empty log message *** * * Revision 1.1.2.2 2003/07/03 22:10:24 niels * fix iidc/dv rcv * * Revision 1.1.2.1 2003/07/01 20:54:06 niels * isoch merge * */ #import <IOKit/firewire/IOFireWireFamilyCommon.h> #import <libkern/c++/OSObject.h> #import <libkern/c++/OSSet.h> #import <IOKit/IOTypes.h> class IODCLProgram ; class OSIterator ; class IOFireWireLink ; class IOMemoryMap ; /*! @class IOFWDCL */ class IOFWDCL : public OSObject { OSDeclareAbstractStructors( IOFWDCL ) ; public: typedef void (*Callback)( void * refcon ) ; enum { kDynamic = BIT(1)//kNuDCLDynamic, ,kUpdateBeforeCallback = BIT(2)//kNuDCLUpdateBeforeCallback ,kUser = BIT(18) // kNuDCLUser ,kBigEndianUpdates = BIT(19) // NOTE: Don't change this without making similar change to IOFireWireLib's NuDCL::Export(...)! } ; class InternalData { public: IOFWDCL * lastBranch ; } ; protected: IOFWDCL* fBranch ; Callback fCallback ; volatile UInt32 * fTimeStampPtr ; UInt32 fRangeCount ; IOVirtualRange * fRanges ; OSSet* fUpdateList ; OSIterator * fUpdateIterator ; volatile UInt32 * fUserStatusPtr ; void* fRefcon ; UInt32 fFlags ; InternalData * fLoLevel ; public: // // IOFWDCL public API: // virtual bool initWithRanges ( OSSet * updateSet, unsigned rangesCount = 0, IOVirtualRange ranges [] = NULL ) ; void setBranch( IOFWDCL* branch ) ; IOFWDCL* getBranch() const ; void setTimeStampPtr ( UInt32* timeStampPtr ) ; UInt32* getTimeStampPtr () const ; void setCallback( Callback callback ) ; Callback getCallback() const ; void setStatusPtr( UInt32* statusPtr ) ; UInt32* getStatusPtr() const ; void setRefcon( void * refcon ) ; void * getRefcon() const ; const OSSet* getUpdateList() const ; virtual IOReturn addRange ( IOVirtualRange& range ) ; virtual IOReturn setRanges ( UInt32 numRanges, IOVirtualRange ranges[] ) ; virtual UInt32 getRanges( UInt32 maxRanges, IOVirtualRange ranges[] ) const ; virtual UInt32 countRanges() ; virtual IOReturn getSpan( IOVirtualRange& result ) const ; virtual IOByteCount getSize() const ; IOReturn appendUpdateList( IOFWDCL* updateDCL ) ; IOReturn setUpdateList( OSSet* updateList ) ; void emptyUpdateList() ; void setFlags( UInt32 flags ) ; UInt32 getFlags() const ; virtual void update() = 0 ; // OSObject virtual void free (void) APPLE_KEXT_OVERRIDE; public: // // internal use only; please don't use... // virtual IOReturn compile( IODCLProgram & , bool & ) = 0 ; virtual void link () = 0 ; OSMetaClassDeclareReservedUnused ( IOFWDCL, 4 ) ; // used to be relink() public : virtual bool interrupt( bool &, IOFWDCL * & ) = 0 ; virtual void finalize ( IODCLProgram & ) ; virtual IOReturn importUserDCL ( UInt8 * data, IOByteCount & dataSize, IOMemoryMap * bufferMap, const OSArray * dcl ) ; protected : friend class IOFWDCLFriend ; public : // dump DCL info... virtual void debug(void) ; public: // // internal use only; please don't use... // virtual bool checkForInterrupt() = 0 ; OSMetaClassDeclareReservedUsed ( IOFWDCL, 0 ) ; OSMetaClassDeclareReservedUnused ( IOFWDCL, 1 ) ; OSMetaClassDeclareReservedUnused ( IOFWDCL, 2 ) ; OSMetaClassDeclareReservedUnused ( IOFWDCL, 3 ) ; // OSMetaClassDeclareReservedUnused ( ***, 4 ) ; // used above } ; #pragma mark - /*! @class IOFWReceiveDCL */ class IOFWReceiveDCL : public IOFWDCL { OSDeclareAbstractStructors( IOFWReceiveDCL ) protected : UInt8 fHeaderBytes ; bool fWait ; public: // me virtual bool initWithParams( OSSet * updateSet, UInt8 headerBytes, unsigned rangesCount, IOVirtualRange ranges [] ) ; IOReturn setWaitControl( bool wait ) ; public : // internal use only: virtual IOReturn importUserDCL ( UInt8 * data, IOByteCount & dataSize, IOMemoryMap * bufferMap, const OSArray * dcl ) APPLE_KEXT_OVERRIDE; protected : virtual void debug(void) APPLE_KEXT_OVERRIDE; } ; #pragma mark - /*! @class IOFWSendDCL */ class IOFWSendDCL : public IOFWDCL { OSDeclareAbstractStructors( IOFWSendDCL ) protected: UInt32 * fUserHeaderPtr ; // pointer to 2 quadlets containing isoch header for this packet UInt32 * fUserHeaderMaskPtr ; // pointer to 2 quadlets; used to mask header quadlets IOFWDCL * fSkipBranchDCL ; Callback fSkipCallback ; void * fSkipRefcon ; UInt8 fSync ; UInt8 fTag ; public: // OSObject virtual void free(void) APPLE_KEXT_OVERRIDE; // IOFWDCL virtual IOReturn addRange ( IOVirtualRange& range ) APPLE_KEXT_OVERRIDE; virtual IOReturn setRanges ( UInt32 numRanges, IOVirtualRange ranges[] ) APPLE_KEXT_OVERRIDE; // me virtual bool initWithParams( OSSet * updateSet, unsigned rangesCount = 0, IOVirtualRange ranges [] = NULL, UInt8 sync = 0, UInt8 tag = 0 ) ; void setUserHeaderPtr( UInt32* userHeaderPtr, UInt32 * maskPtr ) ; UInt32 * getUserHeaderPtr() ; UInt32 * getUserHeaderMask() ; void setSkipBranch( IOFWDCL * skipBranchDCL ) ; IOFWDCL * getSkipBranch() const ; void setSkipCallback( Callback callback ) ; Callback getSkipCallback() const ; void setSkipRefcon( void * refcon = 0 ) ; void * getSkipRefcon() const ; void setSync( UInt8 sync ) ; UInt8 getSync() const ; void setTag( UInt8 tag ) ; UInt8 getTag() const ; public : // internal use only: virtual IOReturn importUserDCL ( UInt8 * data, IOByteCount & dataSize, IOMemoryMap * bufferMap, const OSArray * dcl ) APPLE_KEXT_OVERRIDE; protected : virtual void debug(void) APPLE_KEXT_OVERRIDE; } ; #pragma mark - /*! @class IOFWSkipCycleDCL */ class IOFWSkipCycleDCL : public IOFWDCL { OSDeclareAbstractStructors( IOFWSkipCycleDCL ) public: virtual bool init(void) APPLE_KEXT_OVERRIDE; virtual IOReturn addRange ( IOVirtualRange& range ) APPLE_KEXT_OVERRIDE; virtual IOReturn setRanges ( UInt32 numRanges, IOVirtualRange ranges[] ) APPLE_KEXT_OVERRIDE; virtual IOReturn getSpan( IOVirtualRange& result ) ; protected : virtual void debug(void) APPLE_KEXT_OVERRIDE; } ;
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWSimplePhysicalAddressSpace.h
/* * Copyright (c) 1998-2006 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@ */ #ifndef _IOFWSIMPLEPHYSICALADDRESSSPACE_H_ #define _IOFWSIMPLEPHYSICALADDRESSSPACE_H_ #include <libkern/c++/OSObject.h> #include <IOKit/IOBufferMemoryDescriptor.h> #include <IOKit/IODMACommand.h> #include <IOKit/firewire/IOFWPhysicalAddressSpace.h> /*! @class IOFWSimplePhysicalAddressSpace */ class IOFWSimplePhysicalAddressSpace : public IOFWPhysicalAddressSpace { OSDeclareDefaultStructors( IOFWSimplePhysicalAddressSpace ) private: void * fSimplePhysSpaceMembers; IOReturn allocateMemory( void ); void deallocateMemory( void ); protected: virtual bool createMemberVariables( void ); virtual void destroyMemberVariables( void ); public: virtual bool init( IOFireWireBus * control, vm_size_t size, IODirection direction, bool contiguous = false ); virtual void free( void ) APPLE_KEXT_OVERRIDE; IOVirtualAddress getVirtualAddress( void ); private: OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 0); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 1); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 2); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 3); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 4); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 5); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 6); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 7); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 8); OSMetaClassDeclareReservedUnused(IOFWSimplePhysicalAddressSpace, 9); }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWSimpleContiguousPhysicalAddressSpace.h
/* * Copyright (c) 1998-2006 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@ */ #ifndef _IOFWSIMPLECONTIGUOUSPHYSICALADDRESSSPACE_H_ #define _IOFWSIMPLECONTIGUOUSPHYSICALADDRESSSPACE_H_ #include <IOKit/firewire/IOFWSimplePhysicalAddressSpace.h> /*! @class IOFWSimpleContiguousPhysicalAddressSpace */ class IOFWSimpleContiguousPhysicalAddressSpace : public IOFWSimplePhysicalAddressSpace { OSDeclareDefaultStructors( IOFWSimpleContiguousPhysicalAddressSpace ) private: void * fSimpleContigPhysSpaceMembers; IOReturn cachePhysicalAddress( void ); protected: virtual bool createMemberVariables( void ) APPLE_KEXT_OVERRIDE; virtual void destroyMemberVariables( void ) APPLE_KEXT_OVERRIDE; public: virtual bool init( IOFireWireBus * control, vm_size_t size, IODirection direction ); virtual void free( void ) APPLE_KEXT_OVERRIDE; FWAddress getFWAddress( void ); private: OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 0); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 1); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 2); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 3); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 4); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 5); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 6); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 7); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 8); OSMetaClassDeclareReservedUnused(IOFWSimpleContiguousPhysicalAddressSpace, 9); }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWDCLProgram.h
/* * Copyright (c) 1998-2002 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) 1999-2002 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_IOFWDCLPROGRAM_H #define _IOKIT_IOFWDCLPROGRAM_H #include <libkern/c++/OSObject.h> #include <IOKit/firewire/IOFireWireFamilyCommon.h> #include <IOKit/firewire/IOFireWireBus.h> #include <IOKit/IOMemoryCursor.h> #include <IOKit/IOMapper.h> /*! @class IODCLProgram */ class IODCLProgram : public OSObject { OSDeclareAbstractStructors(IODCLProgram) private : void * reserved0 ;//fDCLTaskToKernel; void * reserved1 ;//fDataTaskToKernel; void * reserved2 ;//fDataBase; void * reserved3 ;// IOMemoryDescriptor * fDCLDesc; IOMemoryMap * fBufferMem ; void * reserved5 ;// IOMemoryCursor * fDataCursor; protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { IOFWIsochResourceFlags resourceFlags ; IODMACommand * fDMACommand; }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData * fExpansionData ; public : virtual void setIsochResourceFlags ( IOFWIsochResourceFlags flags ) ; // formerly getPhysicalSegs() IOFWIsochResourceFlags getIsochResourceFlags () const ; protected: virtual void free (void) APPLE_KEXT_OVERRIDE; public: virtual bool init ( IOFireWireBus::DCLTaskInfo * info = NULL ) ; virtual IOReturn allocateHW ( IOFWSpeed speed, UInt32 chan) = 0; virtual IOReturn releaseHW () = 0; virtual IOReturn compile ( IOFWSpeed speed, UInt32 chan) = 0; virtual IOReturn notify ( IOFWDCLNotificationType notificationType, DCLCommand ** dclCommandList, UInt32 numDCLCommands ) = 0; virtual IOReturn start () = 0; virtual void stop () = 0; virtual IOReturn pause (); virtual IOReturn resume (); virtual void setForceStopProc( IOFWIsochChannel::ForceStopNotificationProc proc, void * refCon, IOFWIsochChannel * channel ) ; protected : void generateBufferMap( DCLCommand * program ) ; IOReturn virtualToPhysical( IOVirtualRange ranges[], unsigned rangeCount, IOMemoryCursor::IOPhysicalSegment outSegments[], unsigned & outPhysicalSegmentCount, unsigned maxSegments ) ; public : IOMemoryMap * getBufferMap() const ; public : // close/open isoch workloop gate... // clients should not need to call these. virtual void closeGate() = 0 ; virtual void openGate() = 0 ; virtual IOReturn synchronizeWithIO() = 0 ; virtual IOMapper * copyMapper() = 0; private: OSMetaClassDeclareReservedUsed(IODCLProgram, 0); OSMetaClassDeclareReservedUsed(IODCLProgram, 1); // *** VERIFY: IODCLProgram is now using one of the OSMetaClassDeclareReservedUsed OSMetaClassDeclareReservedUsed(IODCLProgram, 2); OSMetaClassDeclareReservedUnused(IODCLProgram, 3); OSMetaClassDeclareReservedUnused(IODCLProgram, 4); }; #endif /* ! _IOKIT_IOFWDCLPROGRAM_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/firewire/IOFWPseudoAddressSpace.h
/* * Copyright (c) 1998-2002 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@ */ #ifndef _IOKIT_IOFWPSEUDOADDRESSSPACE_H #define _IOKIT_IOFWPSEUDOADDRESSSPACE_H #include <IOKit/firewire/IOFWAddressSpace.h> /* * If installed, this callback is invoked for drivers which * would like to coalesce incoming writes and do batch processing * of incoming block write packets. * This callback can be installed by calling setARxReqIntCompleteHandler * method in IOFWPseudoAddressSpace object. */ typedef void (*IOFWARxReqIntCompleteHandler)( void * refcon ); /* * Pseudo firewire addresses usually represent emulated registers of some kind. * Accesses to these addresses will result in the owner being notified. * * Virtual addresses should not have zero as the top 16 bits of the 48 bit local address, * since that may look like a physical address to hardware (eg. OHCI). * if reader is NULL then reads will not be allowed. * if writer is NULL then writes will not be allowed. * if either is NULL then lock requests will not be allowed. * refcon is passed back as the first argument of read and write callbacks. */ class IOFWPseudoAddressSpace; #pragma mark - /*! @class IOFWPseudoAddressSpaceAux */ class IOFWPseudoAddressSpaceAux : public IOFWAddressSpaceAux { OSDeclareDefaultStructors(IOFWPseudoAddressSpaceAux) friend class IOFWAddressSpace; friend class IOFWPseudoAddressSpace; friend class IOFireWireController; protected: struct MemberVariables { IOFWARxReqIntCompleteHandler fARxReqIntCompleteHandler; void * fARxReqIntCompleteHandlerRefcon; }; MemberVariables * fMembers; public: virtual bool init( IOFWAddressSpace * primary ) APPLE_KEXT_OVERRIDE; virtual void free() APPLE_KEXT_OVERRIDE; protected: bool createMemberVariables( void ); void destroyMemberVariables( void ); virtual void handleARxReqIntComplete(); public: /*! @function setARxReqIntCompleteHandler @abstract Installs a callback to receive notification, when FWIM has completed ARxReqInt processing and no incoming packets are left in the queue. @param refcon Client's callback object. @param handler Client callback to be invoked, at the end of interrupt processing. @result none. */ virtual void setARxReqIntCompleteHandler( void * refcon, IOFWARxReqIntCompleteHandler handler ); virtual bool intersects( IOFWAddressSpace * space ) APPLE_KEXT_OVERRIDE; private: OSMetaClassDeclareReservedUsed(IOFWPseudoAddressSpaceAux, 0); OSMetaClassDeclareReservedUsed(IOFWPseudoAddressSpaceAux, 1); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 2); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 3); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 4); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 5); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 6); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 7); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 8); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpaceAux, 9); }; /*! @class IOFWPseudoAddressSpace */ class IOFWPseudoAddressSpace : public IOFWAddressSpace { OSDeclareDefaultStructors(IOFWPseudoAddressSpace) friend class IOFWPseudoAddressSpaceAux; friend class IOFireWireController; protected: IOMemoryDescriptor* fDesc; void * fRefCon; FWReadCallback fReader; FWWriteCallback fWriter; FWAddress fBase; UInt32 fLen; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; static OSData * allocatedAddresses; // unused virtual void free() APPLE_KEXT_OVERRIDE; public: /*! @function simpleReader @abstract A method for processing an address space read request @param refcon Client's callback object. @param nodeID FireWire Read from nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len read 'len' bytes from nodeID. @param buf points to a memory descriptor containing the packet data. @param offset start from this 'offset' in 'buf'. @param reqrefcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ static UInt32 simpleReader( void* refcon, UInt16 nodeID, IOFWSpeed & speed, FWAddress addr, UInt32 len, IOMemoryDescriptor** buf, IOByteCount* offset, IOFWRequestRefCon reqrefcon); /*! @function simpleWriter @abstract A method for processing an address space write request @param refcon Client's callback object. @param nodeID FireWire Write to nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len write 'len' bytes to nodeID. @param buf obtain bytes from location given by 'buf'. @param reqrefcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ static UInt32 simpleWriter( void* refcon, UInt16 nodeID, IOFWSpeed& speed, FWAddress addr, UInt32 len, const void* buf, IOFWRequestRefCon reqrefcon); protected: // Get a unique address range IOReturn allocateAddress( FWAddress* addr, UInt32 len); // free address void freeAddress( FWAddress addr, UInt32 len); public: static IOFWPseudoAddressSpace* readWrite( FWAddress addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void* refcon); /*! @function simpleRead @abstract Create an address space object to handle read-only memory (eg. the local ROM) handles everything itself @param bus Points to IOFireWireBus object. @param addr Points to starting address for the Pseudo Address Space. @param len Length of the Pseudo Address Space. @param data The virtual address of the first byte in the memory. @result returns valid IOFWPseudoAddressSpace on success, null on failure */ static IOFWPseudoAddressSpace* simpleRead( IOFireWireBus* bus, FWAddress* addr, UInt32 len, const void* data); /*! @function simpleReadFixed @abstract Create an address space object to handle fixed read-only memory (eg. the local ROM) handles everything itself @param bus Points to IOFireWireBus object. @param addr Points to starting address for the Pseudo Address Space. @param len Length of the Pseudo Address Space. @param data The virtual address of the first byte in the memory. @result returns valid IOFWPseudoAddressSpace on success, null on failure */ static IOFWPseudoAddressSpace* simpleReadFixed( IOFireWireBus* bus, FWAddress addr, UInt32 len, const void* data); /*! @function simpleRW @abstract Create an address space object to handle r/w memory handles everything itself @param bus Points to IOFireWireBus object. @param addr Points to starting address for the Pseudo Address Space. @param len Length of the Pseudo Address Space. @param data The virtual address of the first byte in the memory. @result returns valid IOFWPseudoAddressSpace on success, null on failure */ static IOFWPseudoAddressSpace* simpleRW( IOFireWireBus* bus, FWAddress* addr, UInt32 len, void * data); /*! @function simpleRW @abstract Create an address space object to handle r/w memory handles everything itself @param bus Points to IOFireWireBus object. @param addr Points to starting address for the Pseudo Address Space. @param data The virtual address of the first byte in the memory. @result returns valid IOFWPseudoAddressSpace on success, null on failure */ static IOFWPseudoAddressSpace* simpleRW( IOFireWireBus* bus, FWAddress* addr, IOMemoryDescriptor * data); /*! @function initAll @abstract Initialize an address space object to handle r/w memory @param bus Points to IOFireWireBus object. @param addr Points to starting address for the Pseudo Address Space. @param len Length of the Pseudo Address Space. @param reader Callback handler for incoming Read. @param writer Callback handler for incoming Write. @param refcon Client's callback object. @result returns true on success, false on failure */ virtual bool initAll( IOFireWireBus* bus, FWAddress* addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void* refcon); /*! @function initFixed @abstract Initialize a fixed address space at top of kCSRRegisterSpaceBaseAddressHi @param bus Points to IOFireWireBus object. @param addr Points to starting address for the Pseudo Address Space. @param reader Callback handler for incoming Read. @param writer Callback handler for incoming Write. @param refcon Client's callback object. @result returns true on success, false on failure */ virtual bool initFixed( IOFireWireBus* bus, FWAddress addr, UInt32 len, FWReadCallback reader, FWWriteCallback writer, void* refcon); /*! @function doRead @abstract A method for processing an address space read request @param nodeID FireWire Read from nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len read 'len' bytes from nodeID. @param buf points to a memory descriptor containing the packet data. @param offset start from this 'offset' in 'buf'. @param reqrefcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ virtual UInt32 doRead( UInt16 nodeID, IOFWSpeed & speed, FWAddress addr, UInt32 len, IOMemoryDescriptor ** buf, IOByteCount * offset, IOFWRequestRefCon reqrefcon) APPLE_KEXT_OVERRIDE; /*! @function doWrite @abstract A method for processing an address space write request @param nodeID FireWire Write to nodeID. @param speed at this 'speed'. @param addr with FireWire address 'addr'. @param len write 'len' bytes to nodeID. @param buf obtain bytes from location given by 'buf'. @param reqrefcon Can be queried for extra info about the request. @result UIn32 returns kFWResponseComplete on success */ virtual UInt32 doWrite( UInt16 nodeID, IOFWSpeed& speed, FWAddress addr, UInt32 len, const void* buf, IOFWRequestRefCon reqrefcon) APPLE_KEXT_OVERRIDE; /*! @function contains @abstract returns number of bytes starting at addr in this space @result 0 if it doesn't contain the address */ virtual UInt32 contains(FWAddress addr) APPLE_KEXT_OVERRIDE; /*! @function simpleRWFixed @abstract Create a Read/Write fixed address space at top of kCSRRegisterSpaceBaseAddressHi. @param control Points to IOFireWireBus object. @param addr Points to starting address for the Pseudo Address Space. @param len Length of the address range. @param data The virtual address of the first byte in the memory. @result returns valid IOFWPseudoAddressSpace on success, null on failure */ static IOFWPseudoAddressSpace * simpleRWFixed( IOFireWireBus *control, FWAddress addr, UInt32 len, const void *data ); protected: virtual IOFWAddressSpaceAux * createAuxiliary( void ) APPLE_KEXT_OVERRIDE; protected: inline void handleARxReqIntComplete( void ) { ((IOFWPseudoAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->handleARxReqIntComplete(); } public: /*! @function setARxReqIntCompleteHandler @abstract Installs a callback to receive notification, when FWIM has completed ARxReqInt processing and no incoming packets are left in the queue. @param refcon Client's callback object. @param handler Client callback to be invoked, at the end of interrupt processing. @result none. */ inline void setARxReqIntCompleteHandler( void * refcon, IOFWARxReqIntCompleteHandler handler ) { ((IOFWPseudoAddressSpaceAux*)fIOFWAddressSpaceExpansion->fAuxiliary)->setARxReqIntCompleteHandler( refcon, handler ); } private: OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpace, 0); OSMetaClassDeclareReservedUnused(IOFWPseudoAddressSpace, 1); }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/nvram/IONVRAMController.h
/* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IONVRAMCONTROLLER_H #define _IOKIT_IONVRAMCONTROLLER_H #include <IOKit/IOService.h> class IONVRAMController : public IOService { OSDeclareAbstractStructors(IONVRAMController); public: virtual void registerService(IOOptionBits options = 0) APPLE_KEXT_OVERRIDE; virtual void sync(void); virtual IOReturn read(IOByteCount offset, UInt8 *buffer, IOByteCount length) = 0; virtual IOReturn write(IOByteCount offset, UInt8 *buffer, IOByteCount length) = 0; }; #endif /* !_IOKIT_IONVRAMCONTROLLER_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPM.h
/* * Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IOPM_H #define _IOKIT_IOPM_H #include <IOKit/IOTypes.h> #include <IOKit/IOMessage.h> #include <IOKit/IOReturn.h> /*! @header IOPM.h * @abstract Defines power management constants and keys used by both in-kernel and user space power management. * @discussion IOPM.h defines a range of power management constants used in several in-kernel and user space APIs. Most significantly, the IOPMPowerFlags used to specify the fields of an IOPMPowerState struct are defined here. * * Most of the constants defined in IOPM.h are deprecated or for Apple internal use only, and are not elaborated on in headerdoc. */ enum { kIOPMMaxPowerStates = 10, IOPMMaxPowerStates = kIOPMMaxPowerStates }; /*! @enum IOPMPowerFlags * @abstract Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure. * @discussion These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field. * * The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three. * * The value of capabilityFlags, inputPowerRequirement or outputPowerCharacter may be 0. Most drivers implement their 'OFF' state, used when asleep, by defininf each of the 3 fields as 0. * * The bits listed below are only the most common bits used to define a device's power states. Your device's IO family may require that your device specify other input or output power flags to interact properly. Consult family-specific documentation to determine if your IOPower plane parents or children require other power flags; they probably don't. * * @constant kIOPMPowerOn Indicates the device is on, requires power, and provides power. Useful as a: Capability, InputPowerRequirement, OutputPowerCharacter * * @constant kIOPMDeviceUsable Indicates the device is usable in this state. Useful only as a Capability * * @constant kIOPMLowPower * Indicates device is in a low power state. May be bitwis-OR'd together * with kIOPMDeviceUsable flag, to indicate the device is still usable. * * A device with a capability of kIOPMLowPower may: * Require either 0 or kIOPMPowerOn from its power parent * Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all) * to its power plane children. * * Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit. * * @constant kIOPMPreventIdleSleep * In the capability field of a power state, disallows idle system sleep while the device is in that state. * * For example, displays and disks set this capability for their ON power state; since the system may not idle sleep while the display (and thus keyboard or mouse) or the disk is active. * * Useful only as a Capability. * * @constant kIOPMSleepCapability * Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities. * * @constant kIOPMRestartCapability * Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities. * * @constant kIOPMSleep * Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities. * * @constant kIOPMRestart * Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities. * * @constant kIOPMInitialDeviceState * Indicates the initial power state for the device. If <code>initialPowerStateForDomainState()</code> returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's <code>setPowerState()</code>. * * @constant kIOPMRootDomainState * An indication that the power flags represent the state of the root power * domain. This bit must not be set in the IOPMPowerState structure. * Power Management may pass this bit to initialPowerStateForDomainState() * to map from a global system state to the desired device state. */ typedef unsigned long IOPMPowerFlags; enum { kIOPMPowerOn = 0x00000002, kIOPMDeviceUsable = 0x00008000, kIOPMLowPower = 0x00010000, kIOPMPreventIdleSleep = 0x00000040, kIOPMSleepCapability = 0x00000004, kIOPMRestartCapability = 0x00000080, kIOPMSleep = 0x00000001, kIOPMRestart = 0x00000080, kIOPMInitialDeviceState = 0x00000100, kIOPMRootDomainState = 0x00000200 }; /* * Private IOPMPowerFlags * * For Apple use only * Not for use with non-Apple drivers * Their behavior is undefined */ enum { kIOPMClockNormal = 0x0004, kIOPMClockRunning = 0x0008, kIOPMPreventSystemSleep = 0x0010, kIOPMDoze = 0x0400, kIOPMChildClamp = 0x0080, kIOPMChildClamp2 = 0x0200, kIOPMNotPowerManaged = 0x0800 }; /* * Deprecated IOPMPowerFlags * Their behavior is undefined when used in IOPMPowerState * Capability, InputPowerRequirement, or OutputPowerCharacter fields. */ enum { kIOPMMaxPerformance = 0x4000, kIOPMPassThrough = 0x0100, kIOPMAuxPowerOn = 0x0020, kIOPMNotAttainable = 0x0001, kIOPMContextRetained = 0x2000, kIOPMConfigRetained = 0x1000, kIOPMStaticPowerValid = 0x0800, kIOPMSoftSleep = 0x0400, kIOPMCapabilitiesMask = kIOPMPowerOn | kIOPMDeviceUsable | kIOPMMaxPerformance | kIOPMContextRetained | kIOPMConfigRetained | kIOPMSleepCapability | kIOPMRestartCapability }; /* * Support for old names of IOPMPowerFlag constants */ enum { IOPMNotAttainable = kIOPMNotAttainable, IOPMPowerOn = kIOPMPowerOn, IOPMClockNormal = kIOPMClockNormal, IOPMClockRunning = kIOPMClockRunning, IOPMAuxPowerOn = kIOPMAuxPowerOn, IOPMDeviceUsable = kIOPMDeviceUsable, IOPMMaxPerformance = kIOPMMaxPerformance, IOPMContextRetained = kIOPMContextRetained, IOPMConfigRetained = kIOPMConfigRetained, IOPMNotPowerManaged = kIOPMNotPowerManaged, IOPMSoftSleep = kIOPMSoftSleep }; enum { kIOPMNextHigherState = 1, kIOPMHighestState = 2, kIOPMNextLowerState = 3, kIOPMLowestState = 4 }; enum { IOPMNextHigherState = kIOPMNextHigherState, IOPMHighestState = kIOPMHighestState, IOPMNextLowerState = kIOPMNextLowerState, IOPMLowestState = kIOPMLowestState }; // Internal commands used by power managment command queue enum { kIOPMBroadcastAggressiveness = 1, kIOPMUnidleDevice }; // Power consumption unknown value enum { kIOPMUnknown = 0xFFFF }; /******************************************************************************* * * Root Domain property keys of interest * ******************************************************************************/ /* AppleClamshellState * reflects the state of the clamshell (lid) on a portable. * It has a boolean value. * true == clamshell is closed * false == clamshell is open * not present == no clamshell on this hardware */ #define kAppleClamshellStateKey "AppleClamshellState" /* AppleClamshellCausesSleep * reflects the clamshell close behavior on a portable. * It has a boolean value. * true == system will sleep when clamshell is closed * false == system will not sleep on clamshell close * (typically external display mode) * not present == no clamshell on this hardware */ #define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep" /* kIOPMSleepWakeUUIDKey * Key refers to a CFStringRef that will uniquely identify * a sleep/wake cycle for logging & tracking. * The key becomes valid at the beginning of a sleep cycle - before we * initiate any sleep/wake notifications. * The key becomes invalid at the completion of a system wakeup. The * property will not be present in the IOPMrootDomain's registry entry * when it is invalid. * * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange */ #define kIOPMSleepWakeUUIDKey "SleepWakeUUID" /* kIOPMBootSessionUUIDKey * Key refers to a CFStringRef that will uniquely identify * a boot cycle. * The key becomes valid at boot time and remains valid * till shutdown. The property value will remain same across * sleep/wake/hibernate cycle. */ #define kIOPMBootSessionUUIDKey "BootSessionUUID" /* kIOPMDeepSleepEnabledKey * Indicates the Deep Sleep enable state. * It has a boolean value. * true == Deep Sleep is enabled * false == Deep Sleep is disabled * not present == Deep Sleep is not supported on this hardware */ #define kIOPMDeepSleepEnabledKey "Standby Enabled" /* kIOPMDeepSleepDelayKey * Key refers to a CFNumberRef that represents the delay in seconds before * entering Deep Sleep state when on battery power and when remaining * battery capacity is below a particular threshold (e.g., 50%.) The * property is not present if Deep Sleep is unsupported. */ #define kIOPMDeepSleepDelayKey "Standby Delay" /* kIOPMDeepSleepDelayHighKey * Key refers to a CFNumberRef that represents the delay in seconds before * entering Deep Sleep state. This is used instead of the value specified by * kIOPMDeepSleepDelayKey if the remaining battery capacity is above a * particular threshold (e.g. 50%) or on AC power. The property is not * present if Deep Sleep is unsupported. */ #define kIOPMDeepSleepDelayHighKey "High Standby Delay" /* kIOPMLowBatteryThresholdKey * Key refers to a CFNumberRef that represents the threshold used to choose * between the normal deep sleep delay and the high deep sleep delay (as a * percentage of total battery capacity remaining.) The property is not * present if Deep Sleep is unsupported. */ #define kIOPMStandbyBatteryThresholdKey "Standby Battery Threshold" /* kIOPMDestroyFVKeyOnStandbyKey * Specifies if FileVault key can be stored when going to standby mode * It has a boolean value, * true == Destroy FV key when going to standby mode * false == Retain FV key when going to standby mode * not present == Retain FV key when going to standby mode */ #define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby" /******************************************************************************* * * Properties that can control power management behavior * ******************************************************************************/ /* kIOPMResetPowerStateOnWakeKey * If an IOService publishes this key with the value of kOSBooleanTrue, * then PM will disregard the influence from changePowerStateToPriv() or * any activity tickles that occurred before system sleep when resolving * the initial device power state on wake. Influences from power children * and changePowerStateTo() are not eliminated. At the earliest opportunity * upon system wake, PM will query the driver for a new power state to be * installed as the initial changePowerStateToPriv() influence, by calling * initialPowerStateForDomainState() with both kIOPMRootDomainState and * kIOPMPowerOn flags set. The default implementation will always return * the lowest power state. Drivers can override this default behavior to * immediately raise the power state when there are work blocked on the * power change, and cannot afford to wait until the next activity tickle. * This property should be statically added to a driver's plist or set at * runtime before calling PMinit(). */ #define kIOPMResetPowerStateOnWakeKey "IOPMResetPowerStateOnWake" /******************************************************************************* * * Driver PM Assertions * ******************************************************************************/ /* Driver Assertion bitfield description * Driver PM assertions are defined by these bits. */ enum { /*! kIOPMDriverAssertionCPUBit * When set, PM kernel will prefer to leave the CPU and core hardware * running in "Dark Wake" state, instead of sleeping. */ kIOPMDriverAssertionCPUBit = 0x01, /*! kIOPMDriverAssertionPreventSystemIdleSleepBit * When set, the system should not idle sleep. This does not prevent * demand sleep. */ kIOPMDriverAssertionPreventSystemIdleSleepBit = 0x02, /*! kIOPMDriverAssertionUSBExternalDeviceBit * When set, driver is informing PM that an external USB device is attached. */ kIOPMDriverAssertionUSBExternalDeviceBit = 0x04, /*! kIOPMDriverAssertionBluetoothHIDDevicePairedBit * When set, driver is informing PM that a Bluetooth HID device is paired. */ kIOPMDriverAssertionBluetoothHIDDevicePairedBit = 0x08, /*! kIOPMDriverAssertionExternalMediaMountedBit * When set, driver is informing PM that an external media is mounted. */ kIOPMDriverAssertionExternalMediaMountedBit = 0x10, /*! kIOPMDriverAssertionReservedBit5 * Reserved for Thunderbolt. */ kIOPMDriverAssertionReservedBit5 = 0x20, /*! kIOPMDriverAssertionPreventDisplaySleepBit * When set, the display should remain powered on while the system's awake. */ kIOPMDriverAssertionPreventDisplaySleepBit = 0x40, /*! kIOPMDriverAssertionReservedBit7 * Reserved for storage family. */ kIOPMDriverAssertionReservedBit7 = 0x80, /*! kIOPMDriverAssertionMagicPacketWakeEnabledBit * When set, driver is informing PM that magic packet wake is enabled. */ kIOPMDriverAssertionMagicPacketWakeEnabledBit = 0x100, /*! kIOPMDriverAssertionNetworkKeepAliveActiveBit * When set, driver is informing PM that it is holding the network * interface up to do TCPKeepAlive */ kIOPMDriverAssertionNetworkKeepAliveActiveBit = 0x200 }; /* kIOPMAssertionsDriverKey * This kIOPMrootDomain key refers to a CFNumberRef property, containing * a bitfield describing the aggregate PM assertion levels. * Example: A value of 0 indicates that no driver has asserted anything. * Or, a value of <link>kIOPMDriverAssertionCPUBit</link> * indicates that a driver (or drivers) have asserted a need for CPU and video. */ #define kIOPMAssertionsDriverKey "DriverPMAssertions" /* kIOPMAssertionsDriverKey * This kIOPMrootDomain key refers to a CFNumberRef property, containing * a bitfield describing the aggregate PM assertion levels. * Example: A value of 0 indicates that no driver has asserted anything. * Or, a value of <link>kIOPMDriverAssertionCPUBit</link> * indicates that a driver (or drivers) have asserted a need for CPU and video. */ #define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed" /******************************************************************************* * * Kernel Driver assertion detailed dictionary keys * * Keys decode the Array & dictionary data structure under IOPMrootDomain property * kIOPMAssertionsDriverKey. * */ #define kIOPMDriverAssertionIDKey "ID" #define kIOPMDriverAssertionCreatedTimeKey "CreatedTime" #define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime" #define kIOPMDriverAssertionOwnerStringKey "Owner" #define kIOPMDriverAssertionOwnerServiceKey "ServicePtr" #define kIOPMDriverAssertionRegistryEntryIDKey "RegistryEntryID" #define kIOPMDriverAssertionLevelKey "Level" #define kIOPMDriverAssertionAssertedKey "Assertions" /******************************************************************************* * * Root Domain general interest messages * * Available by registering for interest type 'gIOGeneralInterest' * on IOPMrootDomain. * ******************************************************************************/ /* kIOPMMessageClamshellStateChange * Delivered as a general interest notification on the IOPMrootDomain * IOPMrootDomain sends this message when state of either AppleClamshellState * or AppleClamshellCausesSleep changes. If this clamshell change results in * a sleep, the sleep will initiate soon AFTER delivery of this message. * The state of both variables is encoded in a bitfield argument sent with * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit */ enum { kClamshellStateBit = (1 << 0), kClamshellSleepBit = (1 << 1) }; #define kIOPMMessageClamshellStateChange \ iokit_family_msg(sub_iokit_powermanagement, 0x100) /* kIOPMMessageFeatureChange * Delivered when the set of supported features ("Supported Features" dictionary * under IOPMrootDomain registry) changes in some way. Typically addition or * removal of a supported feature. * RootDomain passes no argument with this message. */ #define kIOPMMessageFeatureChange \ iokit_family_msg(sub_iokit_powermanagement, 0x110) /* kIOPMMessageInflowDisableCancelled * The battery has drained completely to its "Fully Discharged" state. * If a user process has disabled battery inflow for battery * calibration, we forcibly re-enable Inflow at this point. * If inflow HAS been forcibly re-enabled, bit 0 * (kInflowForciblyEnabledBit) will be set. */ enum { kInflowForciblyEnabledBit = (1 << 0) }; /* kIOPMMessageInternalBatteryFullyDischarged * The battery has drained completely to its "Fully Discharged" state. */ #define kIOPMMessageInternalBatteryFullyDischarged \ iokit_family_msg(sub_iokit_powermanagement, 0x120) /* kIOPMMessageSystemPowerEventOccurred * Some major system thermal property has changed, and interested clients may * modify their behavior. */ #define kIOPMMessageSystemPowerEventOccurred \ iokit_family_msg(sub_iokit_powermanagement, 0x130) /* kIOPMMessageSleepWakeUUIDChange * Either a new SleepWakeUUID has been specified at the beginning of a sleep, * or we're removing the existing property upon completion of a wakeup. */ #define kIOPMMessageSleepWakeUUIDChange \ iokit_family_msg(sub_iokit_powermanagement, 0x140) /* kIOPMMessageSleepWakeUUIDSet * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when * a new UUID has been specified. */ #define kIOPMMessageSleepWakeUUIDSet ((void *)1) /* kIOPMMessageSleepWakeUUIDCleared * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when * the current UUID has been removed. */ #define kIOPMMessageSleepWakeUUIDCleared ((void *)NULL) /*! kIOPMMessageDriverAssertionsChanged * Sent when kernel PM driver assertions have changed. */ #define kIOPMMessageDriverAssertionsChanged \ iokit_family_msg(sub_iokit_powermanagement, 0x150) /*! kIOPMMessageDarkWakeThermalEmergency * Sent when machine becomes unsustainably warm in DarkWake. * Kernel PM might choose to put the machine back to sleep right after. */ #define kIOPMMessageDarkWakeThermalEmergency \ iokit_family_msg(sub_iokit_powermanagement, 0x160) /******************************************************************************* * * Power commands issued to root domain * Use with IOPMrootDomain::receivePowerNotification() * * These commands are issued from system drivers only: * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily * * TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep ******************************************************************************/ enum { kIOPMSleepNow = (1 << 0),// put machine to sleep now kIOPMAllowSleep = (1 << 1),// allow idle sleep kIOPMPreventSleep = (1 << 2),// do not allow idle sleep kIOPMPowerButton = (1 << 3),// power button was pressed kIOPMClamshellClosed = (1 << 4),// clamshell was closed kIOPMPowerEmergency = (1 << 5),// battery dangerously low kIOPMDisableClamshell = (1 << 6),// do not sleep on clamshell closure kIOPMEnableClamshell = (1 << 7),// sleep on clamshell closure kIOPMProcessorSpeedChange = (1 << 8),// change the processor speed kIOPMOverTemp = (1 << 9),// system dangerously hot kIOPMClamshellOpened = (1 << 10),// clamshell was opened kIOPMDWOverTemp = (1 << 11),// DarkWake thermal limits exceeded. kIOPMPowerButtonUp = (1 << 12),// Power button up kIOPMProModeEngaged = (1 << 13),// Fans entered 'ProMode' kIOPMProModeDisengaged = (1 << 14) // Fans exited 'ProMode' }; /******************************************************************************* * * Power Management Return Codes * ******************************************************************************/ enum { kIOPMNoErr = 0, // Returned by driver's setPowerState(), powerStateWillChangeTo(), // powerStateDidChangeTo(), or acknowledgeSetPowerState() to // implicitly acknowledge power change upon function return. kIOPMAckImplied = 0, // Deprecated kIOPMWillAckLater = 1, // Returned by requestPowerDomainState() to indicate // unrecognized specification parameter. kIOPMBadSpecification = 4, // Returned by requestPowerDomainState() to indicate // no power state matches search specification. kIOPMNoSuchState = 5, // Deprecated kIOPMCannotRaisePower = 6, // Deprecated kIOPMParameterError = 7, // Returned when power management state is accessed // before driver has called PMinit(). kIOPMNotYetInitialized = 8, // And the old constants; deprecated IOPMNoErr = kIOPMNoErr, IOPMAckImplied = kIOPMAckImplied, IOPMWillAckLater = kIOPMWillAckLater, IOPMBadSpecification = kIOPMBadSpecification, IOPMNoSuchState = kIOPMNoSuchState, IOPMCannotRaisePower = kIOPMCannotRaisePower, IOPMParameterError = kIOPMParameterError, IOPMNotYetInitialized = kIOPMNotYetInitialized }; // IOPMPowerSource class descriptive strings // Power Source state is published as properties to the IORegistry under these // keys. #define kIOPMPSExternalConnectedKey "ExternalConnected" #define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable" #define kIOPMPSBatteryInstalledKey "BatteryInstalled" #define kIOPMPSIsChargingKey "IsCharging" #define kIOPMFullyChargedKey "FullyCharged" #define kIOPMPSAtWarnLevelKey "AtWarnLevel" #define kIOPMPSAtCriticalLevelKey "AtCriticalLevel" #define kIOPMPSCurrentCapacityKey "CurrentCapacity" #define kIOPMPSMaxCapacityKey "MaxCapacity" #define kIOPMPSDesignCapacityKey "DesignCapacity" #define kIOPMPSTimeRemainingKey "TimeRemaining" #define kIOPMPSAmperageKey "Amperage" #define kIOPMPSVoltageKey "Voltage" #define kIOPMPSCycleCountKey "CycleCount" #define kIOPMPSMaxErrKey "MaxErr" #define kIOPMPSAdapterInfoKey "AdapterInfo" #define kIOPMPSLocationKey "Location" #define kIOPMPSErrorConditionKey "ErrorCondition" #define kIOPMPSManufacturerKey "Manufacturer" #define kIOPMPSManufactureDateKey "ManufactureDate" #define kIOPMPSModelKey "Model" #define kIOPMPSSerialKey "Serial" #define kIOPMDeviceNameKey "DeviceName" #define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo" #define kIOPMPSBatteryHealthKey "BatteryHealth" #define kIOPMPSHealthConfidenceKey "HealthConfidence" #define kIOPMPSCapacityEstimatedKey "CapacityEstimated" #define kIOPMPSBatteryChargeStatusKey "ChargeStatus" #define kIOPMPSBatteryTemperatureKey "Temperature" #define kIOPMPSAdapterDetailsKey "AdapterDetails" #define kIOPMPSChargerConfigurationKey "ChargerConfiguration" // kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have // no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it // then charge is proceeding normally. If one of these battery charge status reasons is listed, // then the charge may have been interrupted. #define kIOPMBatteryChargeStatusTooHot "HighTemperature" #define kIOPMBatteryChargeStatusTooCold "LowTemperature" #define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature" #define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient" // Definitions for battery location, in case of multiple batteries. // A location of 0 is unspecified // Location is undefined for single battery systems enum { kIOPMPSLocationLeft = 1001, kIOPMPSLocationRight = 1002 }; // Battery quality health types, specified by BatteryHealth and HealthConfidence // properties in an IOPMPowerSource battery kext. enum { kIOPMUndefinedValue = 0, kIOPMPoorValue = 1, kIOPMFairValue = 2, kIOPMGoodValue = 3 }; // Keys for kIOPMPSAdapterDetailsKey dictionary #define kIOPMPSAdapterDetailsIDKey "AdapterID" #define kIOPMPSAdapterDetailsWattsKey "Watts" #define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision" #define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber" #define kIOPMPSAdapterDetailsFamilyKey "FamilyCode" #define kIOPMPSAdapterDetailsAmperageKey "Current" #define kIOPMPSAdapterDetailsDescriptionKey "Description" #define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration" #define kIOPMPSAdapterDetailsVoltage "Voltage" #define kIOPMPSAdapterDetailsSourceIDKey "Source" #define kIOPMPSAdapterDetailsErrorFlagsKey "ErrorFlags" #define kIOPMPSAdapterDetailsSharedSourceKey "SharedSource" #define kIOPMPSAdapterDetailsCloakedKey "CloakedSource" // values for kIOPSPowerAdapterFamilyKey enum { kIOPSFamilyCodeDisconnected = 0, kIOPSFamilyCodeUnsupported = kIOReturnUnsupported, kIOPSFamilyCodeFirewire = iokit_family_err(sub_iokit_firewire, 0), kIOPSFamilyCodeUSBHost = iokit_family_err(sub_iokit_usb, 0), kIOPSFamilyCodeUSBHostSuspended = iokit_family_err(sub_iokit_usb, 1), kIOPSFamilyCodeUSBDevice = iokit_family_err(sub_iokit_usb, 2), kIOPSFamilyCodeUSBAdapter = iokit_family_err(sub_iokit_usb, 3), kIOPSFamilyCodeUSBChargingPortDedicated = iokit_family_err(sub_iokit_usb, 4), kIOPSFamilyCodeUSBChargingPortDownstream = iokit_family_err(sub_iokit_usb, 5), kIOPSFamilyCodeUSBChargingPort = iokit_family_err(sub_iokit_usb, 6), kIOPSFamilyCodeUSBUnknown = iokit_family_err(sub_iokit_usb, 7), kIOPSFamilyCodeUSBCBrick = iokit_family_err(sub_iokit_usb, 8), kIOPSFamilyCodeUSBCTypeC = iokit_family_err(sub_iokit_usb, 9), kIOPSFamilyCodeUSBCPD = iokit_family_err(sub_iokit_usb, 10), kIOPSFamilyCodeAC = iokit_family_err(sub_iokit_pmu, 0), kIOPSFamilyCodeExternal = iokit_family_err(sub_iokit_pmu, 1), kIOPSFamilyCodeExternal2 = iokit_family_err(sub_iokit_pmu, 2), kIOPSFamilyCodeExternal3 = iokit_family_err(sub_iokit_pmu, 3), kIOPSFamilyCodeExternal4 = iokit_family_err(sub_iokit_pmu, 4), kIOPSFamilyCodeExternal5 = iokit_family_err(sub_iokit_pmu, 5), kIOPSFamilyCodeExternal6 = iokit_family_err(sub_iokit_pmu, 6), kIOPSFamilyCodeExternal7 = iokit_family_err(sub_iokit_pmu, 7), }; // values for kIOPMPSAdapterDetailsErrorFlagsKey enum { kIOPSAdapterErrorFlagNoErrors = 0, kIOPSAdapterErrorFlagInsufficientAvailablePower = (1 << 1), kIOPSAdapterErrorFlagForeignObjectDetected = (1 << 2), kIOPSAdapterErrorFlagDeviceNeedsToBeRepositioned = (1 << 3), }; // Battery's time remaining estimate is invalid this long (seconds) after a wake #define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds" // Battery must wait this long (seconds) after being completely charged before // the battery is settled. #define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds" // Battery must wait this long (seconds) after being completely discharged // before the battery is settled. #define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds" /* CPU Power Management status keys * Pass as arguments to IOPMrootDomain::systemPowerEventOccurred * Or as arguments to IOPMSystemPowerEventOccurred() * Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus() * These keys reflect restrictions placed on the CPU by the system * to bring the CPU's power consumption within allowable thermal and * power constraints. */ /* kIOPMGraphicsPowerLimitsKey * The key representing the dictionary of graphics power limits. * The dictionary contains the other kIOPMCPUPower keys & their associated * values (e.g. Speed limit, Processor Count, and Schedule limits). */ #define kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits" /* kIOPMGraphicsPowerLimitPerformanceKey * The key representing the percent of overall performance made available * by the graphics chip as a percentage (integer 0 - 100). */ #define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance" /* kIOPMCPUPowerLimitsKey * The key representing the dictionary of CPU Power Limits. * The dictionary contains the other kIOPMCPUPower keys & their associated * values (e.g. Speed limit, Processor Count, and Schedule limits). */ #define kIOPMCPUPowerLimitsKey "CPU_Power_Limits" /* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed * on the CPU. * Represented as a percentage (0-100) of maximum CPU speed. */ #define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit" /* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been * taken offline. Represented as an integer number of CPUs (0 - Max CPUs). */ #define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs" /* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time * available. 100% at normal operation. The OS may limit this time for a percentage * less than 100%. */ #define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit" /* Thermal Level Warning Key * Indicates the thermal constraints placed on the system. This value may * cause clients to action to consume fewer system resources. * The value associated with this warning is defined by the platform. */ #define kIOPMThermalLevelWarningKey "Thermal_Level_Warning" /* Thermal Warning Level values * kIOPMThermalLevelNormal - under normal operating conditions * kIOPMThermalLevelDanger - thermal pressure may cause system slowdown * kIOPMThermalLevelCritical - thermal conditions may cause imminent shutdown * * The platform may define additional thermal levels if necessary. * Platform specific values are defined from 100 and above */ enum { kIOPMThermalLevelNormal = 0, kIOPMThermalLevelDanger = 5, kIOPMThermalLevelCritical = 10, kIOPMThermalLevelWarning = 100, kIOPMThermalLevelTrap = 110, kIOPMThermalLevelUnknown = 255, }; #define kIOPMThermalWarningLevelNormal kIOPMThermalLevelNormal #define kIOPMThermalWarningLevelDanger kIOPMThermalLevelWarning #define kIOPMThermalWarningLevelCrisis kIOPMThermalLevelCritical // PM Settings Controller setting types // Settings types used primarily with: // IOPMrootDomain::registerPMSettingController // The values are identical to the similarly named keys for use in user space // PM settings work. Those keys are defined in IOPMLibPrivate.h. #define kIOPMSettingWakeOnRingKey "Wake On Modem Ring" #define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss" #define kIOPMSettingWakeOnACChangeKey "Wake On AC Change" #define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button" #define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open" #define kIOPMSettingReduceBrightnessKey "ReduceBrightness" #define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim" #define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds" #define kIOPMSettingMobileMotionModuleKey "MobileMotionModule" #define kIOPMSettingGraphicsSwitchKey "GPUSwitch" #define kIOPMSettingProModeControl "ProModeControl" #define kIOPMSettingProModeDefer "ProModeDefer" // Setting controlling drivers can register to receive scheduled wake data // Either in "CF seconds" type, or structured calendar data in a formatted // IOPMCalendarStruct defined below. #define kIOPMSettingAutoWakeSecondsKey "wake" #define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate" #define kIOPMSettingAutoPowerSecondsKey "poweron" #define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate" // Debug seconds auto wake // Used by sleep cycling debug tools #define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep" #define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown" // Maintenance wake calendar. #define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate" struct IOPMCalendarStruct { UInt32 year; UInt8 month; UInt8 day; UInt8 hour; UInt8 minute; UInt8 second; UInt8 selector; }; typedef struct IOPMCalendarStruct IOPMCalendarStruct; // SetAggressiveness types enum { kPMGeneralAggressiveness = 0, kPMMinutesToDim, kPMMinutesToSpinDown, kPMMinutesToSleep, kPMEthernetWakeOnLANSettings, kPMSetProcessorSpeed, kPMPowerSource, kPMMotionSensor, kPMLastAggressivenessType }; #define kMaxType (kPMLastAggressivenessType-1) // SetAggressiveness values for the kPMPowerSource aggressiveness type enum { kIOPMInternalPower = 1, kIOPMExternalPower }; #define kIOREMSleepEnabledKey "REMSleepEnabled" // Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo #define kIOBatteryInfoKey "IOBatteryInfo" #define kIOBatteryCurrentChargeKey "Current" #define kIOBatteryCapacityKey "Capacity" #define kIOBatteryFlagsKey "Flags" #define kIOBatteryVoltageKey "Voltage" #define kIOBatteryAmperageKey "Amperage" #define kIOBatteryCycleCountKey "Cycle Count" enum { kIOBatteryInstalled = (1 << 2), kIOBatteryCharge = (1 << 1), kIOBatteryChargerConnect = (1 << 0) }; // Private power management message indicating battery data has changed // Indicates new data resides in the IORegistry #define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100) // Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU // through newer user space IOPMSchedulePowerEvent API #define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200) #define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210) // For use with IOPMPowerSource bFlags #define IOPM_POWER_SOURCE_REV 2 enum { kIOPMACInstalled = kIOBatteryChargerConnect, kIOPMBatteryCharging = kIOBatteryCharge, kIOPMBatteryInstalled = kIOBatteryInstalled, kIOPMUPSInstalled = (1 << 3), kIOPMBatteryAtWarn = (1 << 4), kIOPMBatteryDepleted = (1 << 5), kIOPMACnoChargeCapability = (1 << 6), // AC adapter cannot charge battery kIOPMRawLowBattery = (1 << 7), // used only by Platform Expert kIOPMForceLowSpeed = (1 << 8), // set by Platfm Expert, chk'd by Pwr Plugin kIOPMClosedClamshell = (1 << 9), // set by PMU - reflects state of the clamshell kIOPMClamshellStateOnWake = (1 << 10) // used only by Platform Expert }; // ********************************************** // Internal power management data structures // ********************************************** #if KERNEL && __cplusplus class IOService; enum { kIOPowerEmergencyLevel = 1000 }; enum { kIOPMSubclassPolicy, kIOPMSuperclassPolicy1 }; struct stateChangeNote { IOPMPowerFlags stateFlags; unsigned long stateNum; void * powerRef; }; typedef struct stateChangeNote stateChangeNote; #endif /* KERNEL && __cplusplus */ struct IOPowerStateChangeNotification { void * powerRef; unsigned long returnValue; unsigned long stateNumber; IOPMPowerFlags stateFlags; }; typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification; typedef IOPowerStateChangeNotification sleepWakeNote; /*! @struct IOPMSystemCapabilityChangeParameters * @abstract A structure describing a system capability change. * @discussion A system capability change is a system level transition from a set * of system capabilities to a new set of system capabilities. Power management * sends a <code>kIOMessageSystemCapabilityChange</code> message and provides * this structure as the message data (by reference) to * <code>gIOPriorityPowerStateInterest</code> clients when system capability * changes. * @field notifyRef An identifier for this message notification. Clients with pending * I/O can signal completion by calling <code>allowPowerChange()</code> with this * value as the argument. Clients that are able to process the notification * synchronously should ignore this field. * @field maxWaitForReply A return value to the caller indicating the maximum time in * microseconds to wait for the <code>allowPowerChange()</code> call. The default * value is zero, which indicates the client processing has finished, and power * management should not wait for an <code>allowPowerChange()</code> call. * @field changeFlags Flags will be set to indicate whether the notification precedes * the capability change (<code>kIOPMSystemCapabilityWillChange</code>), or after * the capability change has occurred (<code>kIOPMSystemCapabilityDidChange</code>). * @field __reserved1 Set to zero. * @field fromCapabilities The system capabilities at the start of the transition. * @field toCapabilities The system capabilities at the end of the transition. * @field __reserved2 Set to zero. */ struct IOPMSystemCapabilityChangeParameters { uint32_t notifyRef; uint32_t maxWaitForReply; uint32_t changeFlags; uint32_t __reserved1; uint32_t fromCapabilities; uint32_t toCapabilities; uint32_t __reserved2[4]; }; /*! @enum IOPMSystemCapabilityChangeFlags * @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change. * @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed. */ enum { kIOPMSystemCapabilityWillChange = 0x01, kIOPMSystemCapabilityDidChange = 0x02 }; enum { kIOPMSystemCapabilityCPU = 0x01, kIOPMSystemCapabilityGraphics = 0x02, kIOPMSystemCapabilityAudio = 0x04, kIOPMSystemCapabilityNetwork = 0x08 }; #endif /* ! _IOKIT_IOPM_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPMPowerSource.h
/* * Copyright (c) 1998-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _IOPMPowerSource_h_ #define _IOPMPowerSource_h_ #include <libkern/c++/OSObject.h> #include <IOKit/pwr_mgt/IOPM.h> #include <IOKit/IOTypes.h> #include <IOKit/IOReturn.h> #include <IOKit/IOService.h> enum { kSecondsPerHour = 3600, kTenMinutesInSeconds = 600 }; /*! @class IOPMPowerSource * * See IOKit/pwr_mgt/IOPM.h for power source keys relevant to this class. These * report-type keys are required for calls to IOPMPowerSource::setReportables(), * and they define the IORegistry interface through which data is passed back * up to the rest of the system. * * A subclassing driver that doesn't want to do anything fancy should: * 1. Subclass IOPMPowerSource * 2. Install its own battery change notifications or polling routine that can * converse with actual battery hardware. * 3. When battery state changes, change the relevant member variables * through setCurrentCapacity() style accessors. * 4. Call updateStatus() on itself when all such settings have been updated. * * The subclass driver should also initially populate its settings and call * updateStatus() on launch. * * * Settings: * * <pre> * ExternalConnected * Type: bool * IORegistry Key: kIOPMPSExternalConnectedKey * True if computer is drawing external power * * ExternalChargeCapable * Type: bool * IORegistry Key: kIOPMPSExternalChargeCapableKey * True if external power is capable of charging internal battery * * BatteryInstalled * Type: bool * IORegistry Key: kIOPMPSBatteryInstalledKey * True if a battery is present; false if removed * * IsCharging * Type: bool * IORegistry Key: kIOPMPSIsChargingKey * True if battery is charging itself from external power * * AtWarnLevel * Type: bool * IORegistry Key: kIOPMPSAtWarnLevelKey * True if draining battery capacity and past warn level * * AtCriticalLevel * Type: bool * IORegistry Key: kIOPMPSAtCriticalLevelKey * True if draining battery capacity and past critical level * * CurrentCapacity * MaxCapacity * Type: unsigned int * IORegistry Key: kIOPMPSCurrentCapacityKey, kIOPMPSMaxCapacityKey * Capacity measured in mAh * * TimeRemaining * Type: int * IORegistry Key: kIOPMPSTimeRemainingKey * Time remaining measured in minutes * * Amperage * Type: int * IORegistry Key: kIOPMPSAmperageKey * Current is measured in mA * * Voltage * Type: unsigned int * IORegistry Key: kIOPMPSVoltageKey * Voltage measured in mV * * CycleCount * Type: unsigned int * IORegistry Key: kIOPMPSCycleCountKey * Number of charge/discharge cycles * * AdapterInfo * Type: int * IORegistry Key: kIOPMPSAdapterInfoKey * Power adapter information * * Location * Type: int * IORegistry Key: kIOPMPSLocationKey * Clue about battery's location in machine - Left vs. Right * * ErrorCondition * Type: OSSymbol * IORegistry Key: kIOPMPSErrorConditionKey * String describing error state of battery * * Manufacturer * Type: OSSymbol * IORegistry Key: kIOPMPSManufacturerKey * String describing battery manufacturer * * Manufactured Date * Type: unsigned 16-bit bitfield * IORegistry Key: kIOPMPSManufactureDateKey * Date is published in a bitfield per the Smart Battery Data spec rev 1.1 * in section 5.1.26 * Bits 0...4 => day (value 1-31; 5 bits) * Bits 5...8 => month (value 1-12; 4 bits) * Bits 9...15 => years since 1980 (value 0-127; 7 bits) * * Model * Type: OSSymbol * IORegistry Key: kIOPMPSModelKey * String describing model number * * Serial * Type: OSSymbol * IORegistry Key: kIOPMPSSerialKey * String describing serial number or unique info * The serial number published hear bears no correspondence to the Apple serial * number printed on each battery. This is a manufacturer serial number with * no correlation to the printed serial number. * * LegacyIOBatteryInfo * Type: OSDictionary * IORegistry Key: kIOPMPSLegacyBatteryInfoKey * Dictionary conforming to the OS X 10.0-10.4 * </pre> */ class IOPMPowerSource : public IOService { OSDeclareDefaultStructors(IOPMPowerSource); friend class IOPMPowerSourceList; protected: /*! @var settingsChangedSinceLastUpdate * Used by subclasses to determine if any settings have been modified via the * accessors below since last call to update(). true is settings have changed; * false otherwise. */ bool settingsChangedSinceUpdate; /*! @var properties * Stores power source state */ OSDictionary *properties; const OSSymbol *externalConnectedKey; const OSSymbol *externalChargeCapableKey; const OSSymbol *batteryInstalledKey; const OSSymbol *chargingKey; const OSSymbol *warnLevelKey; const OSSymbol *criticalLevelKey; const OSSymbol *currentCapacityKey; const OSSymbol *maxCapacityKey; const OSSymbol *timeRemainingKey; const OSSymbol *amperageKey; const OSSymbol *voltageKey; const OSSymbol *cycleCountKey; const OSSymbol *adapterInfoKey; const OSSymbol *locationKey; const OSSymbol *errorConditionKey; const OSSymbol *manufacturerKey; const OSSymbol *modelKey; const OSSymbol *serialKey; const OSSymbol *batteryInfoKey; // Tracking for IOPMPowerSourceList IOPMPowerSource *nextInList; public: /*! @function powerSource * @abstract Creates a new IOPMPowerSource nub. Must be attached to IORegistry, * and registered by provider. */ static IOPMPowerSource *powerSource(void); virtual bool init(void) APPLE_KEXT_OVERRIDE; virtual void free(void) APPLE_KEXT_OVERRIDE; /*! @function updateStatus * @abstract Must be called by physical battery controller when battery state * has changed significantly. * @discussion The system will not poll this object for battery updates. Rather \ * the battery's controller must call updateStatus() every time state changes \ * and the settings will be relayed to higher levels of power management. \ * The subclassing driver should override this only if the driver needs to add \ * new settings to the base class. */ virtual void updateStatus(void); /* Public accessors for battery state */ bool externalConnected(void); bool externalChargeCapable(void); bool batteryInstalled(void); bool isCharging(void); bool atWarnLevel(void); bool atCriticalLevel(void); unsigned int currentCapacity(void); unsigned int maxCapacity(void); unsigned int capacityPercentRemaining(void); int timeRemaining(void); int amperage(void); unsigned int voltage(void); unsigned int cycleCount(void); int adapterInfo(void); int location(void); OSSymbol *errorCondition(void); OSSymbol *manufacturer(void); OSSymbol *model(void); OSSymbol *serial(void); OSDictionary *legacyIOBatteryInfo(void); OSObject *getPSProperty(const OSSymbol *); protected: /* Protected "setter" methods for subclasses * Subclasses should use these setters to modify all battery properties. * * Subclasses must follow all property changes with a call to updateStatus() * to flush settings changes to upper level battery API clients. * */ void setExternalConnected(bool); void setExternalChargeCapable(bool); void setBatteryInstalled(bool); void setIsCharging(bool); void setAtWarnLevel(bool); void setAtCriticalLevel(bool); void setCurrentCapacity(unsigned int); void setMaxCapacity(unsigned int); void setTimeRemaining(int); void setAmperage(int); void setVoltage(unsigned int); void setCycleCount(unsigned int); void setAdapterInfo(int); void setLocation(int); void setErrorCondition(OSSymbol *); void setManufacturer(OSSymbol *); void setModel(OSSymbol *); void setSerial(OSSymbol *); void setLegacyIOBatteryInfo(OSDictionary *); /*! All of these methods funnel through the generic accessor method * setPSProperty. Caller can pass in any arbitrary OSSymbol key, and * that value will be stored in the PM settings dictionary, and relayed * onto the IORegistry at update time. */ void setPSProperty(const OSSymbol *, OSObject *); }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPowerConnection.h
/* * Copyright (c) 1998-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. * * HISTORY * */ #ifndef _IOKIT_IOPOWERCONNECTION_H #define _IOKIT_IOPOWERCONNECTION_H #include <IOKit/IOService.h> #include <IOKit/pwr_mgt/IOPM.h> /*! @class IOPowerConnection * Do not use IOPowerConnection. This class is an implementation detail defined * for IOPM's management of the IORegistry IOPower plane. * * Only Kernel IOKit power management should reference the IOPowerConnection class. */ class IOPowerConnection : public IOService { OSDeclareDefaultStructors(IOPowerConnection); protected: /*! @field parentKnowsState true: parent knows state of its domain * used by child */ bool stateKnown; /*! @field currentPowerFlags power flags which describe the current state of the power domain * used by child */ IOPMPowerFlags currentPowerFlags; /*! @field desiredDomainState state number which corresponds to the child's desire * used by parent */ unsigned long desiredDomainState; /*! @field requestFlag set to true when desiredDomainState is set */ bool requestFlag; /*! @field preventIdleSleepFlag true if child has this bit set in its desired state * used by parent */ unsigned long preventIdleSleepFlag; /*! @field preventSystemSleepFlag true if child has this bit set in its desired state * used by parent */ unsigned long preventSystemSleepFlag; /*! @field awaitingAck true if child has not yet acked our notification * used by parent */ bool awaitingAck; /*! @field readyFlag true if the child has been added as a power child * used by parent */ bool readyFlag; public: /*! @function setParentKnowsState * @abstract Sets the stateKnown variable. * @discussion Called by the parent when the object is created and called by the child when it discovers that the parent now knows its state. */ void setParentKnowsState(bool ); /*! @function setParentCurrentPowerFlags * @abstract Sets the currentPowerFlags variable. * @discussion Called by the parent when the object is created and called by the child when it discovers that the parent state is changing. */ void setParentCurrentPowerFlags(IOPMPowerFlags ); /*! @function parentKnowsState * @abstract Returns the stateKnown variable. */ bool parentKnowsState(void ); /*! @function parentCurrentPowerFlags * @abstract Returns the currentPowerFlags variable. */ IOPMPowerFlags parentCurrentPowerFlags(void ); /*! @function setDesiredDomainState * @abstract Sets the desiredDomainState variable. * @discussion Called by the parent. */ void setDesiredDomainState(unsigned long ); /*! @function getDesiredDomainState * @abstract Returns the desiredDomainState variable. * @discussion Called by the parent. */ unsigned long getDesiredDomainState( void ); /*! @function setChildHasRequestedPower * @abstract Set the flag that says that the child has called requestPowerDomainState. * @discussion Called by the parent. */ void setChildHasRequestedPower( void ); /*! @function childHasRequestedPower * @abstract Return the flag that says whether the child has called requestPowerDomainState. * @discussion Called by the PCI Aux Power Supply Driver to see if a device driver * is power managed. */ bool childHasRequestedPower( void ); /*! @function setPreventIdleSleepFlag * @abstract Sets the preventIdleSleepFlag variable. * @discussion Called by the parent. */ void setPreventIdleSleepFlag(unsigned long ); /*! @function getPreventIdleSleepFlag * @abstract Returns the preventIdleSleepFlag variable. * @discussion Called by the parent. */ bool getPreventIdleSleepFlag( void ); /*! @function setPreventSystemSleepFlag * @abstract Sets the preventSystemSleepFlag variable. * @discussion Called by the parent. */ void setPreventSystemSleepFlag(unsigned long ); /*! @function getPreventSystemSleepFlag * @abstract Returns the preventSystemSleepFlag variable. * @discussion Called by the parent. */ bool getPreventSystemSleepFlag( void ); /*! @function setAwaitingAck * @abstract Sets the awaitingAck variable. * @discussion Called by the parent. */ void setAwaitingAck( bool ); /*! @function getAwaitingAck * @abstract Returns the awaitingAck variable. * @discussion Called by the parent. */ bool getAwaitingAck( void ); /*! @function setReadyFlag * @abstract Sets the readyFlag variable. * @discussion Called by the parent. */ void setReadyFlag( bool flag ); /*! @function getReadyFlag * @abstract Returns the readyFlag variable. * @discussion Called by the parent. */ bool getReadyFlag( void ) const; }; #endif /* ! _IOKIT_IOPOWERCONNECTION_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/RootDomain.h
/* * Copyright (c) 1998-2020 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_ROOTDOMAIN_H #define _IOKIT_ROOTDOMAIN_H #include <libkern/c++/OSPtr.h> #include <IOKit/IOService.h> #include <IOKit/pwr_mgt/IOPM.h> #include <IOKit/IOBufferMemoryDescriptor.h> #include <sys/vnode.h> /*! * Types for PM Assertions * For creating, releasing, and getting PM assertion levels. */ /*! IOPMDriverAssertionType * A bitfield describing a set of assertions. May be used to specify which assertions * to set with <link>IOPMrootDomain::createPMAssertion</link>; or to query which * assertions are set with <link>IOPMrootDomain::releasePMAssertion</link>. */ typedef uint64_t IOPMDriverAssertionType; /* IOPMDriverAssertionID * Drivers may create PM assertions to request system behavior (keep the system awake, * or keep the display awake). When a driver creates an assertion via * <link>IOPMrootDomain::createPMAssertion</link>, PM returns a handle to * the assertion of type IOPMDriverAssertionID. */ typedef uint64_t IOPMDriverAssertionID; #define kIOPMUndefinedDriverAssertionID 0 /* IOPMDriverAssertionLevel * Possible values for IOPMDriverAssertionLevel are <link>kIOPMDriverAssertionLevelOff</link> * and <link>kIOPMDriverAssertionLevelOn</link> */ typedef uint32_t IOPMDriverAssertionLevel; #define kIOPMDriverAssertionLevelOff 0 #define kIOPMDriverAssertionLevelOn 255 /* * Flags for get/setSleepSupported() */ enum { kRootDomainSleepNotSupported = 0x00000000, kRootDomainSleepSupported = 0x00000001, kFrameBufferDeepSleepSupported = 0x00000002, kPCICantSleep = 0x00000004 }; /* * IOPMrootDomain registry property keys */ #define kRootDomainSupportedFeatures "Supported Features" #define kRootDomainSleepReasonKey "Last Sleep Reason" #define kRootDomainSleepOptionsKey "Last Sleep Options" #define kIOPMRootDomainWakeReasonKey "Wake Reason" #define kIOPMRootDomainWakeTypeKey "Wake Type" #define kIOPMRootDomainPowerStatusKey "Power Status" /* * Possible sleep reasons found under kRootDomainSleepReasonsKey */ #define kIOPMClamshellSleepKey "Clamshell Sleep" #define kIOPMPowerButtonSleepKey "Power Button Sleep" #define kIOPMSoftwareSleepKey "Software Sleep" #define kIOPMOSSwitchHibernationKey "OS Switch Sleep" #define kIOPMIdleSleepKey "Idle Sleep" #define kIOPMLowPowerSleepKey "Low Power Sleep" #define kIOPMThermalEmergencySleepKey "Thermal Emergency Sleep" #define kIOPMMaintenanceSleepKey "Maintenance Sleep" /* * String constants for communication with PM CPU */ #define kIOPMRootDomainLidCloseCString "LidClose" #define kIOPMRootDomainBatPowerCString "BatPower" /* * Supported Feature bitfields for IOPMrootDomain::publishFeature() */ enum { kIOPMSupportedOnAC = (1 << 0), kIOPMSupportedOnBatt = (1 << 1), kIOPMSupportedOnUPS = (1 << 2) }; typedef IOReturn (*IOPMSettingControllerCallback) (OSObject *target, const OSSymbol *type, OSObject *val, uintptr_t refcon); __BEGIN_DECLS IONotifier * registerSleepWakeInterest( IOServiceInterestHandler, void *, void * = NULL); IONotifier * registerPrioritySleepWakeInterest( IOServiceInterestHandler handler, void * self, void * ref = NULL); IOReturn acknowledgeSleepWakeNotification(void * ); IOReturn vetoSleepWakeNotification(void * PMrefcon); __END_DECLS #define IOPM_ROOTDOMAIN_REV 2 class IOPMrootDomain : public IOService { OSDeclareFinalStructors(IOPMrootDomain); public: static IOPMrootDomain * construct( void ); virtual bool start( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual IOReturn setAggressiveness( unsigned long, unsigned long ) APPLE_KEXT_OVERRIDE; virtual IOReturn getAggressiveness( unsigned long, unsigned long * ) APPLE_KEXT_OVERRIDE; virtual IOReturn sleepSystem( void ); IOReturn sleepSystemOptions( OSDictionary *options ); virtual IOReturn setProperties( OSObject * ) APPLE_KEXT_OVERRIDE; virtual bool serializeProperties( OSSerialize * s ) const APPLE_KEXT_OVERRIDE; virtual OSPtr<OSObject> copyProperty( const char * aKey ) const APPLE_KEXT_OVERRIDE; /*! @function systemPowerEventOccurred * @abstract Other drivers may inform IOPMrootDomain of system PM events * @discussion systemPowerEventOccurred is a richer alternative to receivePowerNotification() * Only Apple-owned kexts should have reason to call systemPowerEventOccurred. * @param event An OSSymbol describing the type of power event. * @param intValue A 32-bit integer value associated with the event. * @result kIOReturnSuccess on success */ IOReturn systemPowerEventOccurred( const OSSymbol *event, uint32_t intValue ); IOReturn systemPowerEventOccurred( const OSSymbol *event, OSObject *value ); void claimSystemWakeEvent( IOService *device, IOOptionBits flags, const char *reason, OSObject *details = NULL ); void claimSystemBootEvent( IOService *device, IOOptionBits flags, const char *reason, OSObject *details = NULL ); void claimSystemShutdownEvent( IOService *device, IOOptionBits flags, const char *reason, OSObject *details = NULL ); virtual IOReturn receivePowerNotification( UInt32 msg ); virtual void setSleepSupported( IOOptionBits flags ); virtual IOOptionBits getSleepSupported( void ); void wakeFromDoze( void ); void requestUserActive(IOService *driver, const char *reason); // KEXT driver announces support of power management feature void publishFeature( const char *feature ); // KEXT driver announces support of power management feature // And specifies power sources with kIOPMSupportedOn{AC/Batt/UPS} bitfield. // Returns a unique uint32_t identifier for later removing support for this // feature. // NULL is acceptable for uniqueFeatureID for kexts without plans to unload. void publishFeature( const char *feature, uint32_t supportedWhere, uint32_t *uniqueFeatureID); // KEXT driver announces removal of a previously published power management // feature. Pass 'uniqueFeatureID' returned from publishFeature() IOReturn removePublishedFeature( uint32_t removeFeatureID ); /*! @function copyPMSetting * @abstract Copy the current value for a PM setting. Returns an OSNumber or * OSData depending on the setting. * @param whichSetting Name of the desired setting. * @result OSObject value if valid, NULL otherwise. */ OSPtr<OSObject> copyPMSetting( OSSymbol *whichSetting ); /*! @function registerPMSettingController * @abstract Register for callbacks on changes to certain PM settings. * @param settings NULL terminated array of C strings, each string for a PM * setting that the caller is interested in and wants to get callbacks for. * @param callout C function ptr or member function cast as such. * @param target The target of the callback, usually 'this' * @param refcon Will be passed to caller in callback; for caller's use. * @param handle Caller should keep the OSObject * returned here. If non-NULL, * handle will have a retain count of 1 on return. To deregister, pass to * unregisterPMSettingController() * @result kIOReturnSuccess on success. */ IOReturn registerPMSettingController( const OSSymbol *settings[], IOPMSettingControllerCallback callout, OSObject *target, uintptr_t refcon, OSObject **handle); // out param /*! @function registerPMSettingController * @abstract Register for callbacks on changes to certain PM settings. * @param settings NULL terminated array of C strings, each string for a PM * setting that the caller is interested in and wants to get callbacks for. * @param supportedPowerSources bitfield indicating which power sources these * settings are supported for (kIOPMSupportedOnAC, etc.) * @param callout C function ptr or member function cast as such. * @param target The target of the callback, usually 'this' * @param refcon Will be passed to caller in callback; for caller's use. * @param handle Caller should keep the OSObject * returned here. If non-NULL, * handle will have a retain count of 1 on return. To deregister, pass to * unregisterPMSettingController() * @result kIOReturnSuccess on success. */ IOReturn registerPMSettingController( const OSSymbol *settings[], uint32_t supportedPowerSources, IOPMSettingControllerCallback callout, OSObject *target, uintptr_t refcon, OSObject **handle); // out param virtual OSPtr<IONotifier> registerInterest( const OSSymbol * typeOfInterest, IOServiceInterestHandler handler, void * target, void * ref = NULL ) APPLE_KEXT_OVERRIDE; virtual IOReturn callPlatformFunction( const OSSymbol *functionName, bool waitForFunction, void *param1, void *param2, void *param3, void *param4 ) APPLE_KEXT_OVERRIDE; /*! @function createPMAssertion * @abstract Creates an assertion to influence system power behavior. * @param whichAssertionsBits A bitfield specify the assertion that the caller requests. * @param assertionLevel An integer detailing the initial assertion level, kIOPMDriverAssertionLevelOn * or kIOPMDriverAssertionLevelOff. * @param ownerService A pointer to the caller's IOService class, for tracking. * @param ownerDescription A reverse-DNS string describing the caller's identity and reason. * @result On success, returns a new assertion of type IOPMDriverAssertionID */ IOPMDriverAssertionID createPMAssertion( IOPMDriverAssertionType whichAssertionsBits, IOPMDriverAssertionLevel assertionLevel, IOService *ownerService, const char *ownerDescription); /* @function setPMAssertionLevel * @abstract Modify the level of a pre-existing assertion. * @discussion Change the value of a PM assertion to influence system behavior, * without undergoing the work required to create or destroy an assertion. Suggested * for clients who will assert and de-assert needs for PM behavior several times over * their lifespan. * @param assertionID An assertion ID previously returned by <link>createPMAssertion</link> * @param assertionLevel The new assertion level. * @result kIOReturnSuccess if it worked; kIOReturnNotFound or other IOReturn error on failure. */ IOReturn setPMAssertionLevel(IOPMDriverAssertionID assertionID, IOPMDriverAssertionLevel assertionLevel); /*! @function getPMAssertionLevel * @absract Returns the active level of the specified assertion(s). * @discussion Returns <link>kIOPMDriverAssertionLevelOff</link> or * <link>kIOPMDriverAssertionLevelOn</link>. If multiple assertions are specified * in the bitfield, only returns <link>kIOPMDriverAssertionLevelOn</link> * if all assertions are active. * @param whichAssertionBits Bits defining the assertion or assertions the caller is interested in * the level of. If in doubt, pass <link>kIOPMDriverAssertionCPUBit</link> as the argument. * @result Returns <link>kIOPMDriverAssertionLevelOff</link> or * <link>kIOPMDriverAssertionLevelOn</link> indicating the specified assertion's levels, if available. * If the assertions aren't supported on this machine, or aren't recognized by the OS, the * result is undefined. */ IOPMDriverAssertionLevel getPMAssertionLevel(IOPMDriverAssertionType whichAssertionBits); /*! @function releasePMAssertion * @abstract Removes an assertion to influence system power behavior. * @result On success, returns a new assertion of type IOPMDriverAssertionID * */ IOReturn releasePMAssertion(IOPMDriverAssertionID releaseAssertion); /*! @function restartWithStackshot * @abstract Take a stackshot of the system and restart the system. * @result Return kIOReturnSuccess if it work, kIOReturnError if the service is not available. */ IOReturn restartWithStackshot(); IOReturn setWakeTime(uint64_t wakeContinuousTime); private: unsigned long getRUN_STATE(void); virtual IOReturn changePowerStateTo( unsigned long ordinal ) APPLE_KEXT_COMPATIBILITY_OVERRIDE; virtual IOReturn changePowerStateToPriv( unsigned long ordinal ); virtual IOReturn requestPowerDomainState( IOPMPowerFlags, IOPowerConnection *, unsigned long ) APPLE_KEXT_OVERRIDE; virtual void powerChangeDone( unsigned long ) APPLE_KEXT_OVERRIDE; virtual bool tellChangeDown( unsigned long ) APPLE_KEXT_OVERRIDE; virtual bool askChangeDown( unsigned long ) APPLE_KEXT_OVERRIDE; virtual void tellChangeUp( unsigned long ) APPLE_KEXT_OVERRIDE; virtual void tellNoChangeDown( unsigned long ) APPLE_KEXT_OVERRIDE; virtual IOReturn configureReport(IOReportChannelList *channels, IOReportConfigureAction action, void *result, void *destination) APPLE_KEXT_OVERRIDE; virtual IOReturn updateReport(IOReportChannelList *channels, IOReportUpdateAction action, void *result, void *destination) APPLE_KEXT_OVERRIDE; void configureReportGated(uint64_t channel_id, uint64_t action, void *result); IOReturn updateReportGated(uint64_t ch_id, void *result, IOBufferMemoryDescriptor *dest); }; #endif /* _IOKIT_ROOTDOMAIN_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPMLibDefs.h
/* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #define kPMSetAggressiveness 0 #define kPMGetAggressiveness 1 #define kPMSleepSystem 2 #define kPMAllowPowerChange 3 #define kPMCancelPowerChange 4 #define kPMShutdownSystem 5 #define kPMRestartSystem 6 #define kPMSleepSystemOptions 7 #define kPMSetMaintenanceWakeCalendar 8 #define kPMSetUserAssertionLevels 9 #define kPMActivityTickle 10 #define kPMGetSystemSleepType 11 #define kPMSetClamshellSleepState 12 #define kPMSleepWakeWatchdogEnable 13 #define kPMSleepWakeDebugTrig 14 #define kPMSetDisplayPowerOn 15 #define kPMSetDisplayState 16 #define kNumPMMethods 17
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPMpowerState.h
/* * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IOPMPOWERSTATE_H #define _IOKIT_IOPMPOWERSTATE_H #include <IOKit/pwr_mgt/IOPM.h> /*! @header IOPMpowerState.h * @abstract Defines the struct IOPMPowerState that power managed drivers should use to describe their power states. */ /*! @struct IOPMPowerState * @abstract Describes a device's power state. * @discussion To take part in system power management, drivers should define an array of 2 or more power states and pass it to kernel power management through IOService::registerPowerDriver. * @field version Defines version number of this struct. Just use the value "1" when defining an IOPMPowerState. * @field capabilityFlags Describes the capability of the device in this state. * @field outputPowerCharacter Describes the power provided in this state. * @field inputPowerRequirement Describes the input power required in this state. * @field staticPower Describes average consumption in milliwatts. Unused; drivers may specify 0. * @field stateOrder Valid in version kIOPMPowerStateVersion2 or greater of this structure. Defines ordering of power states independently of the power state ordinal. * @field powerToAttain Describes dditional power to attain this state from next lower state (in milliWatts). Unused; drivers may specify 0. * @field timeToAttain Describes time required to enter this state from next lower state (in microseconds). Unused; drivers may specify 0. * @field settleUpTime Describes settle time required after entering this state from next lower state (microseconds). Unused; drivers may specify 0. * @field timeToLower Describes time required to enter next lower state from this one (microseconds). Unused; drivers may specify 0. * @field settleDownTime Settle time required after entering next lower state from this state (microseconds). Unused; drivers may specify 0. * @field powerDomainBudget Describes power in milliWatts a domain in this state can deliver to its children. Unused; drivers may specify 0. * } */ struct IOPMPowerState { unsigned long version; IOPMPowerFlags capabilityFlags; IOPMPowerFlags outputPowerCharacter; IOPMPowerFlags inputPowerRequirement; unsigned long staticPower; unsigned long stateOrder; unsigned long powerToAttain; unsigned long timeToAttain; unsigned long settleUpTime; unsigned long timeToLower; unsigned long settleDownTime; unsigned long powerDomainBudget; }; typedef struct IOPMPowerState IOPMPowerState; enum { kIOPMPowerStateVersion1 = 1, kIOPMPowerStateVersion2 = 2 }; #endif /* _IOKIT_IOPMPOWERSTATE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/pwr_mgt/IOPMPowerSourceList.h
/* * Copyright (c) 1998-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #include <libkern/c++/OSObject.h> #include <IOKit/IOReturn.h> class IOPMPowerSource; class IOPMPowerSourceList : public OSObject { OSDeclareDefaultStructors(IOPMPowerSourceList); private: // pointer to first power source in list IOPMPowerSource *firstItem; // how many power sources are in the list unsigned long length; public: void initialize(void); void free(void) APPLE_KEXT_OVERRIDE; unsigned long numberOfItems(void); IOReturn addToList(IOPMPowerSource *newPowerSource); IOReturn removeFromList(IOPMPowerSource *theItem); LIBKERN_RETURNS_NOT_RETAINED IOPMPowerSource *firstInList(void); LIBKERN_RETURNS_NOT_RETAINED IOPMPowerSource *nextInList(IOPMPowerSource *currentItem); };
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/i2c/IOI2CInterface.h
/* * Copyright (c) 1998-2000 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@ */ #ifndef _IOKIT_IOI2CINTERFACE_H #define _IOKIT_IOI2CINTERFACE_H #include <IOKit/IOTypes.h> /* IOOptionBits */ #include <stdint.h> /* uint32_t */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ typedef struct IOI2CRequest IOI2CRequest; typedef struct IOI2CBuffer IOI2CBuffer; typedef void (*IOI2CRequestCompletion) (IOI2CRequest * request); // IOI2CRequest.sendTransactionType, IOI2CRequest.replyTransactionType enum { kIOI2CNoTransactionType = 0, kIOI2CSimpleTransactionType = 1, kIOI2CDDCciReplyTransactionType = 2, kIOI2CCombinedTransactionType = 3, kIOI2CDisplayPortNativeTransactionType = 4 }; // IOI2CRequest.commFlags enum { kIOI2CUseSubAddressCommFlag = 0x00000002 }; /*! * @struct IOI2CRequest * @abstract A structure defining an I2C bus transaction. * @discussion This structure is used to request an I2C transaction consisting of a send (write) to and reply (read) from a device, either of which is optional, to be carried out atomically on an I2C bus. * @field __reservedA Set to zero. * @field result The result of the transaction. Common errors are kIOReturnNoDevice if there is no device responding at the given address, kIOReturnUnsupportedMode if the type of transaction is unsupported on the requested bus. * @field completion A completion routine to be executed when the request completes. If NULL is passed, the request is synchronous, otherwise it may execute asynchronously. * @field commFlags Flags that modify the I2C transaction type. The following flags are defined:<br> * kIOI2CUseSubAddressCommFlag Transaction includes a subaddress.<br> * @field minReplyDelay Minimum delay as absolute time between send and reply transactions. * @field sendAddress I2C address to write. * @field sendSubAddress I2C subaddress to write. * @field __reservedB Set to zero. * @field sendTransactionType The following types of transaction are defined for the send part of the request:<br> * kIOI2CNoTransactionType No send transaction to perform. <br> * kIOI2CSimpleTransactionType Simple I2C message. <br> * kIOI2CCombinedTransactionType Combined format I2C R/~W transaction. <br> * @field sendBuffer Pointer to the send buffer. * @field sendBytes Number of bytes to send. Set to actual bytes sent on completion of the request. * @field replyAddress I2C Address from which to read. * @field replySubAddress I2C Address from which to read. * @field __reservedC Set to zero. * @field replyTransactionType The following types of transaction are defined for the reply part of the request:<br> * kIOI2CNoTransactionType No reply transaction to perform. <br> * kIOI2CSimpleTransactionType Simple I2C message. <br> * kIOI2CDDCciReplyTransactionType DDC/ci message (with embedded length). See VESA DDC/ci specification. <br> * kIOI2CCombinedTransactionType Combined format I2C R/~W transaction. <br> * @field replyBuffer Pointer to the reply buffer. * @field replyBytes Max bytes to reply (size of replyBuffer). Set to actual bytes received on completion of the request. * @field __reservedD Set to zero. */ #pragma pack(push, 4) struct IOI2CRequest { IOOptionBits sendTransactionType; IOOptionBits replyTransactionType; uint32_t sendAddress; uint32_t replyAddress; uint8_t sendSubAddress; uint8_t replySubAddress; uint8_t __reservedA[2]; uint64_t minReplyDelay; IOReturn result; IOOptionBits commFlags; #if defined(__LP64__) uint32_t __padA; #else vm_address_t sendBuffer; #endif uint32_t sendBytes; uint32_t __reservedB[2]; #if defined(__LP64__) uint32_t __padB; #else vm_address_t replyBuffer; #endif uint32_t replyBytes; IOI2CRequestCompletion completion; #if !defined(__LP64__) uint32_t __padC[5]; #else vm_address_t sendBuffer; vm_address_t replyBuffer; #endif uint32_t __reservedC[10]; }; #pragma pack(pop) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define kIOI2CInterfaceClassName "IOI2CInterface" #define kIOI2CInterfaceIDKey "IOI2CInterfaceID" #define kIOI2CBusTypeKey "IOI2CBusType" #define kIOI2CTransactionTypesKey "IOI2CTransactionTypes" #define kIOI2CSupportedCommFlagsKey "IOI2CSupportedCommFlags" #define kIOFBI2CInterfaceInfoKey "IOFBI2CInterfaceInfo" #define kIOFBI2CInterfaceIDsKey "IOFBI2CInterfaceIDs" // kIOI2CBusTypeKey values enum { kIOI2CBusTypeI2C = 1, kIOI2CBusTypeDisplayPort = 2 }; /*! * @struct IOI2CBusTiming * @abstract A structure defining low level timing for an I2C bus. * @discussion This structure is used to specify timeouts and pulse widths for an I2C bus implementation. * @field bitTimeout Maximum time a slave can delay (by pulling the clock line low) a single bit response. * @field byteTimeout Maximum time a slave can delay (by pulling the clock line low) the first bit of a byte response. * @field acknowledgeTimeout Maximum time to wait for a slave to respond with an ACK after writing a byte. * @field startTimeout Maximum time to wait for a slave to respond after a start signal. * @field riseFallTime Time to wait after any change in output signal. * @field __reservedA Set to zero. */ struct IOI2CBusTiming { AbsoluteTime bitTimeout; AbsoluteTime byteTimeout; AbsoluteTime acknowledgeTimeout; AbsoluteTime startTimeout; AbsoluteTime holdTime; AbsoluteTime riseFallTime; UInt32 __reservedA[8]; }; typedef struct IOI2CBusTiming IOI2CBusTiming; #ifndef KERNEL /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // options for IOFBCopyI2CInterfaceForBus() enum { kIOI2CBusNumberMask = 0x000000ff }; /*! @function IOFBGetI2CInterfaceCount @abstract Returns a count of I2C interfaces available associated with an IOFramebuffer instance. @discussion Returns a count of I2C interfaces available associated with an IOFramebuffer instance. @param framebuffer The io_service_t of an IOFramebuffer instance. CoreGraphics will provide this for a CGDisplay with the CGDisplayIOServicePort() call. @param count Interface count is returned. @result An IOReturn code. */ IOReturn IOFBGetI2CInterfaceCount( io_service_t framebuffer, IOItemCount * count ); /*! @function IOFBCopyI2CInterfaceForBus @abstract Returns an instance of an I2C bus interface, associated with an IOFramebuffer instance / bus index pair. @discussion Some graphics devices will allow access to an I2C bus routed through a display connector in order to control external devices on that bus. This function returns an instance of an I2C bus interface, associated with an IOFramebuffer instance / bus index pair. The number of I2C buses is available from the IOFBGetI2CInterfaceCount() call. The interface may be used with the IOI2CInterfaceOpen/Close/SendRequest() calls to carry out I2C transactions on that bus. Not all graphics devices support this functionality. @param bus The zero based index of the bus on the requested framebuffer. @param interface The interface instance is returned. The caller should release this instance with IOObjectRelease(). @result An IOReturn code. */ IOReturn IOFBCopyI2CInterfaceForBus( io_service_t framebuffer, IOOptionBits bus, io_service_t * interface ); typedef struct IOI2CConnect * IOI2CConnectRef; /* struct IOI2CConnect is opaque */ IOReturn IOI2CCopyInterfaceForID( CFTypeRef identifier, io_service_t * interface ); /*! @function IOI2CInterfaceOpen @abstract Opens an instance of an I2C bus interface, allowing I2C requests to be made. @discussion An instance of an I2C bus interface, obtained by IOFBCopyI2CInterfaceForBus, is opened with this function allowing I2C requests to be made. @param interface An I2C bus interface (see IOFBCopyI2CInterfaceForBus). The interface may be released after this call is made. @param options Pass kNilOptions. @param connect The opaque IOI2CConnectRef is returned, for use with IOI2CSendRequest() and IOI2CInterfaceClose(). @result An IOReturn code. */ IOReturn IOI2CInterfaceOpen( io_service_t interface, IOOptionBits options, IOI2CConnectRef * connect ); /*! @function IOI2CInterfaceClose @abstract Closes an IOI2CConnectRef. @discussion Frees the resources associated with an IOI2CConnectRef. @param connect The opaque IOI2CConnectRef returned by IOI2CInterfaceOpen(). @param options Pass kNilOptions. @result An IOReturn code. */ IOReturn IOI2CInterfaceClose( IOI2CConnectRef connect, IOOptionBits options ); /*! @function IOI2CSendRequest @abstract Carries out the I2C transaction specified by an IOI2CRequest structure. @discussion Frees the resources associated with an IOI2CConnectRef. @param connect The opaque IOI2CConnectRef returned by IOI2CInterfaceOpen(). @param options Pass kNilOptions. @param request Pass a pointer to a IOI2CRequest structure describing the request. If an asynchronous request (with a non-NULL completion routine) the request structure must be valid for the life of the request. @result An IOReturn code reflecting only the result of starting the transaction. If the result of IOI2CSendRequest() is kIOReturnSuccess, the I2C transaction result is returned in the result field of the request structure. */ IOReturn IOI2CSendRequest( IOI2CConnectRef connect, IOOptionBits options, IOI2CRequest * request ); #else /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*! @class IOI2CInterface @abstract The base class for an I2C bus interface. @discussion The IOI2CInterface base class defines an I2C bus interface. Not useful for developers. */ class IOI2CInterface : public IOService { OSDeclareDefaultStructors(IOI2CInterface) protected: UInt64 fID; public: IOReturn newUserClient( task_t owningTask, void * security_id, UInt32 type, IOUserClient ** handler ) APPLE_KEXT_OVERRIDE; bool registerI2C( UInt64 id ); virtual IOReturn startIO( IOI2CRequest * request ) = 0; }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #endif /* KERNEL */ #endif /* ! _IOKIT_IOI2CINTERFACE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIPeripheralDeviceNub.h
/* * Copyright (c) 1998-2010 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_NUB_H_ #define _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_NUB_H_ //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- // Probe score values enum { kPeripheralDeviceTypeNoMatch = 0, kDefaultProbeRanking = 5000, kFirstOrderRanking = 10000, kSecondOrderRanking = 15000, kThirdOrderRanking = 20000 }; #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // General IOKit headers #include <IOKit/IOLib.h> #include <IOKit/IOService.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIProtocolServices.h> // Build includes #include <TargetConditionals.h> // Forward definitions for internal use only classes. class SCSIPrimaryCommands; //----------------------------------------------------------------------------- // Class Declarations //----------------------------------------------------------------------------- class __exported IOSCSIPeripheralDeviceNub : public IOSCSIProtocolServices { OSDeclareDefaultStructors ( IOSCSIPeripheralDeviceNub ) private: static bool sCompareIOProperty ( IOService * object, OSDictionary * table, char * propertyKeyName, bool * matches ); static void TaskCallback ( SCSITaskIdentifier completedTask ); void TaskCompletion ( SCSITaskIdentifier completedTask ); static IOReturn sWaitForTask ( void * object, SCSITask * request ); IOReturn GatedWaitForTask ( SCSITask * request ); protected: SCSIServiceResponse SendTask ( SCSITask * request ); bool InterrogateDevice ( void ); // Reserve space for future expansion. struct IOSCSIPeripheralDeviceNubExpansionData { }; IOSCSIPeripheralDeviceNubExpansionData * fIOSCSIPeripheralDeviceNubReserved; IOSCSIProtocolInterface * fProvider; UInt8 fDefaultInquiryCount; virtual bool SendSCSICommand ( SCSITaskIdentifier request, SCSIServiceResponse * serviceResponse, SCSITaskStatus * taskStatus ) APPLE_KEXT_OVERRIDE; virtual SCSIServiceResponse AbortSCSICommand ( SCSITaskIdentifier request ) APPLE_KEXT_OVERRIDE; // The IsProtocolServiceSupported will return true if the specified // feature is supported by the protocol layer. If the service has a value that must be // returned, it will be returned in the serviceValue output parameter. virtual bool IsProtocolServiceSupported ( SCSIProtocolFeature feature, void * serviceValue ) APPLE_KEXT_OVERRIDE; virtual bool HandleProtocolServiceFeature ( SCSIProtocolFeature feature, void * serviceValue ) APPLE_KEXT_OVERRIDE; public: bool init ( OSDictionary * propTable ) APPLE_KEXT_OVERRIDE; virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void free ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn message ( UInt32 type, IOService * nub, void * arg ) APPLE_KEXT_OVERRIDE; virtual bool matchPropertyTable ( OSDictionary * table, SInt32 * score ) APPLE_KEXT_OVERRIDE; // The ExecuteCommand method will take a SCSITask object and transport // it across the physical wires to the device virtual void ExecuteCommand ( SCSITaskIdentifier request ) APPLE_KEXT_OVERRIDE; // The Task Management function to allow the SCSI Application Layer client to request // that a specific task be aborted. virtual SCSIServiceResponse AbortTask ( UInt8 theLogicalUnit, SCSITaggedTaskIdentifier theTag ) APPLE_KEXT_OVERRIDE; // The Task Management function to allow the SCSI Application Layer client to request // that a all tasks curerntly in the task set be aborted. virtual SCSIServiceResponse AbortTaskSet ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; virtual SCSIServiceResponse ClearACA ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; virtual SCSIServiceResponse ClearTaskSet ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; virtual SCSIServiceResponse LogicalUnitReset ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; virtual SCSIServiceResponse TargetReset ( void ) APPLE_KEXT_OVERRIDE; // ************* Obsoleted Member Routine **************** // The AbortCommand method is replaced by the AbortTask Management function and // should no longer be called. virtual SCSIServiceResponse AbortCommand ( SCSITaskIdentifier abortTask ) APPLE_KEXT_OVERRIDE; private: #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 1 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 2 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 3 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 8 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 16 ); #endif /* !TARGET_OS_IPHONE */ }; class __exported IOSCSILogicalUnitNub : public IOSCSIPeripheralDeviceNub { OSDeclareDefaultStructors ( IOSCSILogicalUnitNub ) private: UInt8 fLogicalUnitNumber; protected: // Reserve space for future expansion. struct IOSCSILogicalUnitNubExpansionData { }; IOSCSILogicalUnitNubExpansionData * fIOSCSILogicalUnitNubReserved; public: virtual void SetLogicalUnitNumber ( UInt8 newLUN ); UInt8 GetLogicalUnitNumber ( void ); // The ExecuteCommand method will take a SCSITask object and transport // it across the physical wires to the device virtual void ExecuteCommand ( SCSITaskIdentifier request ) APPLE_KEXT_OVERRIDE; private: #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 1 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 2 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 3 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 8 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 16 ); #endif /* !TARGET_OS_IPHONE */ }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_NUB_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSICmds_INQUIRY_Definitions.h
/* * Copyright (c) 1998-2018 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_CMDS_INQUIRY_H_ #define _IOKIT_SCSI_CMDS_INQUIRY_H_ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif /*! @header SCSI Inquiry Definitions @discussion This file contains all definitions for the data returned from the INQUIRY (0x12) command. */ /*! * @enum Payload sizes * @discussion * Definitions for sizes related to the INQUIRY data. * @constant kINQUIRY_StandardDataHeaderSize * INQUIRY data header size. * @constant kINQUIRY_MaximumDataSize * Maximum size for INQUIRY data. */ enum { kINQUIRY_StandardDataHeaderSize = 5, kINQUIRY_MaximumDataSize = 255 }; /*! @enum INQUIRY field sizes @discussion Sizes for some of the inquiry data fields. @constant kINQUIRY_VENDOR_IDENTIFICATION_Length Size of VENDOR_IDENTIFICATION field. @constant kINQUIRY_PRODUCT_IDENTIFICATION_Length Size of PRODUCT_IDENTIFICATION field. @constant kINQUIRY_PRODUCT_REVISION_LEVEL_Length Size of PRODUCT_REVISION_LEVEL field. */ enum { kINQUIRY_VENDOR_IDENTIFICATION_Length = 8, kINQUIRY_PRODUCT_IDENTIFICATION_Length = 16, kINQUIRY_PRODUCT_REVISION_LEVEL_Length = 4 }; /*! @struct SCSICmd_INQUIRY_StandardData @discussion This structure defines the format of the required standard data that is returned for the INQUIRY command. This is the data that is required to be returned from all devices. */ typedef struct SCSICmd_INQUIRY_StandardData { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 RMB; // 7 = removable UInt8 VERSION; // 7/6 = ISO/IEC, 5-3 = ECMA, 2-0 = ANSI. UInt8 RESPONSE_DATA_FORMAT; // 7 = AERC, 6 = Obsolete, 5 = NormACA, 4 = HiSup 3-0 = Response data format. (SPC-3 obsoletes AERC) // If ANSI Version = 0, this is ATAPI and bits 7-4 = ATAPI version. UInt8 ADDITIONAL_LENGTH; // Number of additional bytes available in inquiry data UInt8 SCCSReserved; // SCC-2 device flag and reserved fields (SPC-3 adds PROTECT 3PC TPGS, and ACC) UInt8 flags1; // First byte of support flags (See SPC-3 section 6.4.2) UInt8 flags2; // Second byte of support flags (Byte 7) (See SPC-3 section 6.4.2) char VENDOR_IDENTIFICATION[kINQUIRY_VENDOR_IDENTIFICATION_Length]; char PRODUCT_IDENTIFICATION[kINQUIRY_PRODUCT_IDENTIFICATION_Length]; char PRODUCT_REVISION_LEVEL[kINQUIRY_PRODUCT_REVISION_LEVEL_Length]; } SCSICmd_INQUIRY_StandardData; typedef SCSICmd_INQUIRY_StandardData * SCSICmd_INQUIRY_StandardDataPtr; /*! @struct SCSICmd_INQUIRY_StandardDataAll @discussion This structure defines the all of the fields that can be returned in repsonse to the INQUIRy request for the standard data. There is no requirement as to how much of the additional data must be returned by a device. */ typedef struct SCSICmd_INQUIRY_StandardDataAll { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 RMB; // 7 = removable UInt8 VERSION; // 7/6 = ISO/IEC, 5-3 = ECMA, 2-0 = ANSI. UInt8 RESPONSE_DATA_FORMAT; // 7 = AERC, 6 = Obsolete, 5 = NormACA, 4 = HiSup 3-0 = Response data format. // If ANSI Version = 0, this is ATAPI and bits 7-4 = ATAPI version. UInt8 ADDITIONAL_LENGTH; // Number of additional bytes available in inquiry data UInt8 SCCSReserved; // SCC-2 device flag and reserved fields UInt8 flags1; // First byte of support flags (Byte 6) UInt8 flags2; // Second byte of support flags (Byte 7) char VENDOR_IDENTIFICATION[kINQUIRY_VENDOR_IDENTIFICATION_Length]; char PRODUCT_IDENTIFICATION[kINQUIRY_PRODUCT_IDENTIFICATION_Length]; char PRODUCT_REVISION_LEVEL[kINQUIRY_PRODUCT_REVISION_LEVEL_Length]; // Following is the optional data that may be returned by a device. UInt8 VendorSpecific1[20]; UInt8 flags3; // Third byte of support flags, mainly SPI-3 (Byte 56) UInt8 Reserved1; UInt16 VERSION_DESCRIPTOR[8]; UInt8 Reserved2[22]; UInt8 VendorSpecific2[160]; } SCSICmd_INQUIRY_StandardDataAll; /*! @enum Peripheral Qualifier @discussion Inquiry Peripheral Qualifier definitions @constant kINQUIRY_PERIPHERAL_QUALIFIER_Connected Peripheral Device is connected. @constant kINQUIRY_PERIPHERAL_QUALIFIER_SupportedButNotConnected Peripheral Device is supported, but not connected. @constant kINQUIRY_PERIPHERAL_QUALIFIER_NotSupported Peripheral Device is not supported. @constant kINQUIRY_PERIPHERAL_QUALIFIER_Mask Mask to use for PERIPHERAL_DEVICE_TYPE field. */ enum { kINQUIRY_PERIPHERAL_QUALIFIER_Connected = 0x00, kINQUIRY_PERIPHERAL_QUALIFIER_SupportedButNotConnected = 0x20, kINQUIRY_PERIPHERAL_QUALIFIER_NotSupported = 0x60, kINQUIRY_PERIPHERAL_QUALIFIER_Mask = 0xE0 }; /*! @enum Peripheral Device types @discussion Inquiry Peripheral Device type definitions @constant kINQUIRY_PERIPHERAL_TYPE_DirectAccessSBCDevice SBC Device. @constant kINQUIRY_PERIPHERAL_TYPE_SequentialAccessSSCDevice Sequential Access (Tape) SSC Device. @constant kINQUIRY_PERIPHERAL_TYPE_PrinterSSCDevice SSC Device. @constant kINQUIRY_PERIPHERAL_TYPE_ProcessorSPCDevice SPC Device. @constant kINQUIRY_PERIPHERAL_TYPE_WriteOnceSBCDevice SBC Device. @constant kINQUIRY_PERIPHERAL_TYPE_CDROM_MMCDevice MMC Device. @constant kINQUIRY_PERIPHERAL_TYPE_ScannerSCSI2Device SCSI2 Device. @constant kINQUIRY_PERIPHERAL_TYPE_OpticalMemorySBCDevice SBC Device. @constant kINQUIRY_PERIPHERAL_TYPE_MediumChangerSMCDevice SMC Device. @constant kINQUIRY_PERIPHERAL_TYPE_CommunicationsSSCDevice Comms SSC Device. @constant kINQUIRY_PERIPHERAL_TYPE_StorageArrayControllerSCC2Device SCC2 Device. @constant kINQUIRY_PERIPHERAL_TYPE_EnclosureServicesSESDevice SES Device. @constant kINQUIRY_PERIPHERAL_TYPE_SimplifiedDirectAccessRBCDevice RBC Device. @constant kINQUIRY_PERIPHERAL_TYPE_OpticalCardReaderOCRWDevice OCRW Device. @constant kINQUIRY_PERIPHERAL_TYPE_ObjectBasedStorageDevice OSD device. @constant kINQUIRY_PERIPHERAL_TYPE_AutomationDriveInterface Automation Drive Interface device. @constant kINQUIRY_PERIPHERAL_TYPE_WellKnownLogicalUnit Well known logical unit. @constant kINQUIRY_PERIPHERAL_TYPE_UnknownOrNoDeviceType Unknown or no device. @constant kINQUIRY_PERIPHERAL_TYPE_Mask Mask to use for PERIPHERAL_DEVICE_TYPE field. */ enum { kINQUIRY_PERIPHERAL_TYPE_DirectAccessSBCDevice = 0x00, kINQUIRY_PERIPHERAL_TYPE_SequentialAccessSSCDevice = 0x01, kINQUIRY_PERIPHERAL_TYPE_PrinterSSCDevice = 0x02, kINQUIRY_PERIPHERAL_TYPE_ProcessorSPCDevice = 0x03, kINQUIRY_PERIPHERAL_TYPE_WriteOnceSBCDevice = 0x04, kINQUIRY_PERIPHERAL_TYPE_CDROM_MMCDevice = 0x05, kINQUIRY_PERIPHERAL_TYPE_ScannerSCSI2Device = 0x06, kINQUIRY_PERIPHERAL_TYPE_OpticalMemorySBCDevice = 0x07, kINQUIRY_PERIPHERAL_TYPE_MediumChangerSMCDevice = 0x08, kINQUIRY_PERIPHERAL_TYPE_CommunicationsSSCDevice = 0x09, /* 0x0A - 0x0B ASC IT8 Graphic Arts Prepress Devices */ kINQUIRY_PERIPHERAL_TYPE_StorageArrayControllerSCC2Device = 0x0C, kINQUIRY_PERIPHERAL_TYPE_EnclosureServicesSESDevice = 0x0D, kINQUIRY_PERIPHERAL_TYPE_SimplifiedDirectAccessRBCDevice = 0x0E, kINQUIRY_PERIPHERAL_TYPE_OpticalCardReaderOCRWDevice = 0x0F, /* 0x10 - 0x1E Reserved Device Types */ kINQUIRY_PERIPHERAL_TYPE_ObjectBasedStorageDevice = 0x11, kINQUIRY_PERIPHERAL_TYPE_AutomationDriveInterface = 0x12, kINQUIRY_PERIPHERAL_TYPE_WellKnownLogicalUnit = 0x1E, kINQUIRY_PERIPHERAL_TYPE_UnknownOrNoDeviceType = 0x1F, kINQUIRY_PERIPHERAL_TYPE_Mask = 0x1F }; /*! @enum Removable Bit field definitions @discussion Inquiry Removable Bit field definitions @constant kINQUIRY_PERIPHERAL_RMB_MediumFixed Medium type is fixed disk. @constant kINQUIRY_PERIPHERAL_RMB_MediumRemovable Medium type is removable disk. @constant kINQUIRY_PERIPHERAL_RMB_BitMask Mask to use for RMB field. */ enum { kINQUIRY_PERIPHERAL_RMB_MediumFixed = 0x00, kINQUIRY_PERIPHERAL_RMB_MediumRemovable = 0x80, kINQUIRY_PERIPHERAL_RMB_BitMask = 0x80 }; /*! @enum Version field definitions @discussion Definitions for bits/masks in the INQUIRY Version field. @constant kINQUIRY_ISO_IEC_VERSION_Mask Mask for valid bits for ISO/IEC Version. @constant kINQUIRY_ECMA_VERSION_Mask Mask for valid bits for ECMA Version. @constant kINQUIRY_ANSI_VERSION_NoClaimedConformance No ANSI conformance claimed by the device server. @constant kINQUIRY_ANSI_VERSION_SCSI_1_Compliant SCSI-1 conformance claimed by the device server. @constant kINQUIRY_ANSI_VERSION_SCSI_2_Compliant SCSI-2 conformance claimed by the device server. @constant kINQUIRY_ANSI_VERSION_SCSI_SPC_Compliant SPC conformance claimed by the device server. @constant kINQUIRY_ANSI_VERSION_SCSI_SPC_2_Compliant SPC-2 conformance claimed by the device server. @constant kINQUIRY_ANSI_VERSION_SCSI_SPC_3_Compliant SPC-3 conformance claimed by the device server. @constant kINQUIRY_ANSI_VERSION_Mask Mask for valid bits for ANSI Version. */ enum { kINQUIRY_ISO_IEC_VERSION_Mask = 0xC0, kINQUIRY_ECMA_VERSION_Mask = 0x38, kINQUIRY_ANSI_VERSION_NoClaimedConformance = 0x00, kINQUIRY_ANSI_VERSION_SCSI_1_Compliant = 0x01, kINQUIRY_ANSI_VERSION_SCSI_2_Compliant = 0x02, kINQUIRY_ANSI_VERSION_SCSI_SPC_Compliant = 0x03, kINQUIRY_ANSI_VERSION_SCSI_SPC_2_Compliant = 0x04, kINQUIRY_ANSI_VERSION_SCSI_SPC_3_Compliant = 0x05, kINQUIRY_ANSI_VERSION_Mask = 0x07 }; /*! @enum Response Data Format field definitions @discussion Definitions for bits/masks in the INQUIRY RESPONSE_DATA_FORMAT field. @constant kINQUIRY_Byte3_HISUP_Bit HISUP bit definition. @constant kINQUIRY_Byte3_NORMACA_Bit NORMACA bit definition. @constant kINQUIRY_Byte3_AERC_Bit AERC bit definition. @constant kINQUIRY_RESPONSE_DATA_FORMAT_Mask Mask for valid bits for RESPONSE_DATA_FORMAT. @constant kINQUIRY_Byte3_HISUP_Mask Mask to use to test the HISUP bit. @constant kINQUIRY_Byte3_NORMACA_Mask Mask to use to test the NORMACA bit. @constant kINQUIRY_Byte3_AERC_Mask Mask to use to test the AERC bit. */ enum { // Bit definitions // Bits 0-3: RESPONSE DATA FORMAT kINQUIRY_Byte3_HISUP_Bit = 4, kINQUIRY_Byte3_NORMACA_Bit = 5, // Bit 6 is Obsolete kINQUIRY_Byte3_AERC_Bit = 7, // Masks kINQUIRY_RESPONSE_DATA_FORMAT_Mask = 0x0F, // Bits 0-3 kINQUIRY_Byte3_HISUP_Mask = (1 << kINQUIRY_Byte3_HISUP_Bit), kINQUIRY_Byte3_NORMACA_Mask = (1 << kINQUIRY_Byte3_NORMACA_Bit), // Bit 6 is Obsolete kINQUIRY_Byte3_AERC_Mask = (1 << kINQUIRY_Byte3_AERC_Bit) }; /*! @enum SCCS field definitions @discussion Definitions for bits/masks in the INQUIRY SCCSReserved field. @constant kINQUIRY_Byte5_SCCS_Bit SCCS bit definition. @constant kINQUIRY_Byte5_ACC_Bit ACC bit definition. @constant kINQUIRY_Byte5_ExplicitTPGS_Bit Explicit TPGS bit definition. @constant kINQUIRY_Byte5_ImplicitTPGS_Bit Implicit TPGS bit definition. @constant kINQUIRY_Byte5_3PC_Bit 3PC bit definition. @constant kINQUIRY_Byte5_PROTECT_Bit PROTECT bit definition. @constant kINQUIRY_Byte5_SCCS_Mask Mask to use to test the SCCS bit. @constant kINQUIRY_Byte5_ACC_Mask Mask to use to test the ACC bit. @constant kINQUIRY_Byte5_ExplicitTPGS_Mask Mask to use for the Explicit TPGS bits. @constant kINQUIRY_Byte5_ImplicitTPGS_Mask Mask to use for the Implicit TPGS bits. @constant kINQUIRY_Byte5_3PC_Mask Mask to use to test the 3PC bit. @constant kINQUIRY_Byte5_PROTECT_Mask Mask to use to test the PROTECT bit. */ enum { // Bit definitions kINQUIRY_Byte5_SCCS_Bit = 7, kINQUIRY_Byte5_ACC_Bit = 6, kINQUIRY_Byte5_ExplicitTPGS_Bit = 5, kINQUIRY_Byte5_ImplicitTPGS_Bit = 4, kINQUIRY_Byte5_3PC_Bit = 3, // Bits 1-2: Reserved kINQUIRY_Byte5_PROTECT_Bit = 0, // Masks kINQUIRY_Byte5_SCCS_Mask = (1 << kINQUIRY_Byte5_SCCS_Bit), kINQUIRY_Byte5_ACC_Mask = (1 << kINQUIRY_Byte5_ACC_Bit), kINQUIRY_Byte5_ExplicitTPGS_Mask = (1 << kINQUIRY_Byte5_ExplicitTPGS_Bit), kINQUIRY_Byte5_ImplicitTPGS_Mask = (1 << kINQUIRY_Byte5_ImplicitTPGS_Bit), kINQUIRY_Byte5_3PC_Mask = (1 << kINQUIRY_Byte5_3PC_Bit), // Bits 1-2: Reserved kINQUIRY_Byte5_PROTECT_Mask = (1 << kINQUIRY_Byte5_PROTECT_Bit) }; /*! @enum flags1 field definitions @discussion Definitions for bits/masks in the INQUIRY flags1 field. @constant kINQUIRY_Byte6_ADDR16_Bit ADDR16 bit definition. @constant kINQUIRY_Byte6_MCHNGR_Bit MCHNGR bit definition. @constant kINQUIRY_Byte6_MULTIP_Bit MULTIP bit definition. @constant kINQUIRY_Byte6_VS_Bit VS bit definition. @constant kINQUIRY_Byte6_ENCSERV_Bit ENCSERV bit definition. @constant kINQUIRY_Byte6_BQUE_Bit BQUE bit definition. @constant kINQUIRY_Byte6_ADDR16_Mask Mask to use to test the ADDR16 bit. @constant kINQUIRY_Byte6_MCHNGR_Mask Mask to use to test the MCHNGR bit. @constant kINQUIRY_Byte6_MULTIP_Mask Mask to use to test the MULTIP bit. @constant kINQUIRY_Byte6_VS_Mask Mask to use to test the VS bit. @constant kINQUIRY_Byte6_ENCSERV_Mask Mask to use to test the ENCSERV bit. @constant kINQUIRY_Byte6_BQUE_Mask Mask to use to test the BQUE bit. */ enum { // Byte offset kINQUIRY_Byte6_Offset = 6, // Bit definitions kINQUIRY_Byte6_ADDR16_Bit = 0, // SPI Specific // Bit 1 is Obsolete // Bit 2 is Obsolete kINQUIRY_Byte6_MCHNGR_Bit = 3, kINQUIRY_Byte6_MULTIP_Bit = 4, kINQUIRY_Byte6_VS_Bit = 5, kINQUIRY_Byte6_ENCSERV_Bit = 6, kINQUIRY_Byte6_BQUE_Bit = 7, // Masks kINQUIRY_Byte6_ADDR16_Mask = (1 << kINQUIRY_Byte6_ADDR16_Bit), // SPI Specific // Bit 1 is Obsolete // Bit 2 is Obsolete kINQUIRY_Byte6_MCHNGR_Mask = (1 << kINQUIRY_Byte6_MCHNGR_Bit), kINQUIRY_Byte6_MULTIP_Mask = (1 << kINQUIRY_Byte6_MULTIP_Bit), kINQUIRY_Byte6_VS_Mask = (1 << kINQUIRY_Byte6_VS_Bit), kINQUIRY_Byte6_ENCSERV_Mask = (1 << kINQUIRY_Byte6_ENCSERV_Bit), kINQUIRY_Byte6_BQUE_Mask = (1 << kINQUIRY_Byte6_BQUE_Bit) }; /*! @enum flags2 field definitions @discussion Definitions for bits/masks in the INQUIRY flags2 field. @constant kINQUIRY_Byte7_VS_Bit VS bit definition. @constant kINQUIRY_Byte7_CMDQUE_Bit CMDQUE bit definition. @constant kINQUIRY_Byte7_TRANDIS_Bit TRANDIS bit definition. @constant kINQUIRY_Byte7_LINKED_Bit LINKED bit definition. @constant kINQUIRY_Byte7_SYNC_Bit SYNC bit definition. @constant kINQUIRY_Byte7_WBUS16_Bit WBUS16 bit definition. @constant kINQUIRY_Byte7_RELADR_Bit RELADR bit definition. @constant kINQUIRY_Byte7_VS_Mask Mask to use to test the VS bit. @constant kINQUIRY_Byte7_CMDQUE_Mask Mask to use to test the CMDQUE bit. @constant kINQUIRY_Byte7_TRANDIS_Mask Mask to use to test the TRANDIS bit. @constant kINQUIRY_Byte7_LINKED_Mask Mask to use to test the LINKED bit. @constant kINQUIRY_Byte7_SYNC_Mask Mask to use to test the SYNC bit. @constant kINQUIRY_Byte7_WBUS16_Mask Mask to use to test the WBUS16 bit. @constant kINQUIRY_Byte7_RELADR_Mask Mask to use to test the RELADR bit. */ enum { // Byte offset kINQUIRY_Byte7_Offset = 7, // Bit definitions kINQUIRY_Byte7_VS_Bit = 0, kINQUIRY_Byte7_CMDQUE_Bit = 1, kINQUIRY_Byte7_TRANDIS_Bit = 2, // SPI Specific kINQUIRY_Byte7_LINKED_Bit = 3, kINQUIRY_Byte7_SYNC_Bit = 4, // SPI Specific kINQUIRY_Byte7_WBUS16_Bit = 5, // SPI Specific // Bit 6 is Obsolete kINQUIRY_Byte7_RELADR_Bit = 7, // Masks kINQUIRY_Byte7_VS_Mask = (1 << kINQUIRY_Byte7_VS_Bit), kINQUIRY_Byte7_CMDQUE_Mask = (1 << kINQUIRY_Byte7_CMDQUE_Bit), kINQUIRY_Byte7_TRANDIS_Mask = (1 << kINQUIRY_Byte7_TRANDIS_Bit),// SPI Specific kINQUIRY_Byte7_LINKED_Mask = (1 << kINQUIRY_Byte7_LINKED_Bit), kINQUIRY_Byte7_SYNC_Mask = (1 << kINQUIRY_Byte7_SYNC_Bit), // SPI Specific kINQUIRY_Byte7_WBUS16_Mask = (1 << kINQUIRY_Byte7_WBUS16_Bit), // SPI Specific // Bit 6 is Obsolete kINQUIRY_Byte7_RELADR_Mask = (1 << kINQUIRY_Byte7_RELADR_Bit) }; /*! @enum Byte 56 features field definitions @discussion Definitions for bits/masks in the INQUIRY Byte 56 field. Inquiry Byte 56 features (for devices that report an ANSI VERSION of kINQUIRY_ANSI_VERSION_SCSI_SPC_Compliant or later). These are SPI-3 Specific. @constant kINQUIRY_Byte56_IUS_Bit IUS bit definition. @constant kINQUIRY_Byte56_QAS_Bit QAS bit definition. @constant kINQUIRY_Byte56_IUS_Mask Mask to use to test the IUS bit. @constant kINQUIRY_Byte56_QAS_Mask Mask to use to test the QAS bit. @constant kINQUIRY_Byte56_CLOCKING_Mask Mask to use to test CLOCKING bits. @constant kINQUIRY_Byte56_CLOCKING_ONLY_ST Single-transition clocking only. @constant kINQUIRY_Byte56_CLOCKING_ONLY_DT Double-transition clocking only. @constant kINQUIRY_Byte56_CLOCKING_ST_AND_DT Single-transition and double-transition clocking. */ enum { // Byte offset kINQUIRY_Byte56_Offset = 56, // Bit definitions kINQUIRY_Byte56_IUS_Bit = 0, kINQUIRY_Byte56_QAS_Bit = 1, // Bits 2 and 3 are the CLOCKING bits // All other bits are reserved kINQUIRY_Byte56_IUS_Mask = (1 << kINQUIRY_Byte56_IUS_Bit), kINQUIRY_Byte56_QAS_Mask = (1 << kINQUIRY_Byte56_QAS_Bit), kINQUIRY_Byte56_CLOCKING_Mask = 0x0C, // Definitions for the CLOCKING bits kINQUIRY_Byte56_CLOCKING_ONLY_ST = 0x00, kINQUIRY_Byte56_CLOCKING_ONLY_DT = 0x04, // kINQUIRY_Byte56_CLOCKING_RESERVED = 0x08, kINQUIRY_Byte56_CLOCKING_ST_AND_DT = 0x0C }; /*! @define kINQUIRY_VERSION_DESCRIPTOR_MaxCount Maximum number of INQUIRY version descriptors supported. */ #define kINQUIRY_VERSION_DESCRIPTOR_MaxCount 8 /*! @enum kINQUIRY_VERSION_DESCRIPTOR_SAT SAT specification version descriptor. */ enum { kINQUIRY_VERSION_DESCRIPTOR_SAT = 0x1EA0 }; /*! @enum kINQUIRY_VERSION_DESCRIPTOR_NVME NVMe specification version descriptor. */ enum { kINQUIRY_VERSION_DESCRIPTOR_NVME = 0x8080 }; /* IORegistry property names for information derived from the Inquiry data. The Peripheral Device Type is the only property that the generic Logical Unit Drivers will use to match. These properties are listed in order of matching priority. First is the Peripheral Device Type. Second is the Vendor Identification. Third is the Product Identification. Last is the Product Revision Level. To match a particular product, you would specify the Peripheral Device Type, Vendor Identification, and Product Identification. To restrict the match to a particular firmware revision, you would add the Product Revision Level. To not match on a particular product, but on a particular vendor's products, you would only include the Peripheral Device Type and the Vendor Identification. */ /*! @define kIOPropertySCSIPeripheralDeviceType SCSI Peripheral Device Type as reported in the INQUIRY data. */ #define kIOPropertySCSIPeripheralDeviceType "Peripheral Device Type" /*! @define kIOPropertySCSIPeripheralDeviceTypeSize Size of the kIOPropertySCSIPeripheralDeviceType key. */ #define kIOPropertySCSIPeripheralDeviceTypeSize 8 /*! @define kIOPropertyTPGSInfo TPGS Info as reported in the INQUIRY data. */ #define kIOPropertyTPGSInfo "TPGS Information" /*! @define kIOPropertyHiSup Hierarchical LUN Support as reported in the INQUIRY data. */ #define kIOPropertyHiSup "Hierarchical LUN Support" /*! @define kIOPropertyTPGSInfoSize Size of the kIOPropertyTPGSInfo key. */ #define kIOPropertyTPGSInfoSize 8 /* These properties are listed in order of matching priority */ /*! @define kIOPropertySCSIVendorIdentification Vendor ID as reported in the INQUIRY data. Additional space characters (0x20) are truncated. */ #define kIOPropertySCSIVendorIdentification "Vendor Identification" /*! @define kIOPropertySCSIProductIdentification Product ID as reported in the INQUIRY data. Additional space characters (0x20) are truncated. */ #define kIOPropertySCSIProductIdentification "Product Identification" /*! @define kIOPropertySCSIProductRevisionLevel Product Revision Level as reported in the INQUIRY data. */ #define kIOPropertySCSIProductRevisionLevel "Product Revision Level" #ifndef __OPEN_SOURCE__ /*! @enum INQUIRY Page Codes @discussion INQUIRY Page Codes to be used when EVPD is set in the INQUIRY command. @constant kINQUIRY_Page00_PageCode Page Code 00h. @constant kINQUIRY_Page80_PageCode Page Code 80h. @constant kINQUIRY_Page83_PageCode Page Code 83h. @constant kINQUIRY_Page89_PageCode Page Code 89h. @constant kINQUIRY_PageB0_PageCode Page Code B0h. @constant kINQUIRY_PageB1_PageCode Page Code B1h. @constant kINQUIRY_PageB2_PageCode Page Code B2h. @constant kINQUIRY_PageC0_PageCode Page Code C0h. @constant kINQUIRY_PageC1_PageCode Page Code C1h. */ enum { kINQUIRY_Page00_PageCode = 0x00, kINQUIRY_Page80_PageCode = 0x80, kINQUIRY_Page83_PageCode = 0x83, kINQUIRY_Page89_PageCode = 0x89, kINQUIRY_PageB0_PageCode = 0xB0, kINQUIRY_PageB1_PageCode = 0xB1, kINQUIRY_PageB2_PageCode = 0xB2, kINQUIRY_PageC0_PageCode = 0xC0, kINQUIRY_PageC1_PageCode = 0xC1 }; #else /*! @enum INQUIRY Page Codes @discussion INQUIRY Page Codes to be used when EVPD is set in the INQUIRY command. @constant kINQUIRY_Page00_PageCode Page Code 00h. @constant kINQUIRY_Page80_PageCode Page Code 80h. @constant kINQUIRY_Page83_PageCode Page Code 83h. @constant kINQUIRY_Page89_PageCode Page Code 89h. @constant kINQUIRY_PageB0_PageCode Page Code B0h. @constant kINQUIRY_PageB1_PageCode Page Code B1h. @constant kINQUIRY_PageB2_PageCode Page Code B2h. */ enum { kINQUIRY_Page00_PageCode = 0x00, kINQUIRY_Page80_PageCode = 0x80, kINQUIRY_Page83_PageCode = 0x83, kINQUIRY_Page89_PageCode = 0x89, kINQUIRY_PageB0_PageCode = 0xB0, kINQUIRY_PageB1_PageCode = 0xB1, kINQUIRY_PageB2_PageCode = 0xB2, }; #endif /* __OPEN_SOURCE__ */ /*! @struct SCSICmd_INQUIRY_Page00_Header @discussion INQUIRY Page 00h Header. */ typedef struct SCSICmd_INQUIRY_Page00_Header { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to 00h UInt8 RESERVED; // reserved field UInt8 PAGE_LENGTH; // n-3 bytes } SCSICmd_INQUIRY_Page00_Header; /*! @struct SCSICmd_INQUIRY_Page00_Header_SPC_16 @discussion INQUIRY Page 00h Header. */ typedef struct SCSICmd_INQUIRY_Page00_Header_SPC_16 { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to 00h UInt16 PAGE_LENGTH; // n-3 bytes } SCSICmd_INQUIRY_Page00_Header_SPC_16; /*! @struct SCSICmd_INQUIRY_Page80_Header @discussion INQUIRY Page 80h Header. */ typedef struct SCSICmd_INQUIRY_Page80_Header { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to 80h UInt8 RESERVED; // reserved field UInt8 PAGE_LENGTH; // n-3 bytes UInt8 PRODUCT_SERIAL_NUMBER; // 4-n } SCSICmd_INQUIRY_Page80_Header; /*! @struct SCSICmd_INQUIRY_Page80_Header_SPC_16 @discussion INQUIRY Page 80h Header with 16 bytes INQUIRY Command. */ typedef struct SCSICmd_INQUIRY_Page80_Header_SPC_16 { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to 80h UInt16 PAGE_LENGTH; // n-3 bytes UInt8 PRODUCT_SERIAL_NUMBER; // 4-n } SCSICmd_INQUIRY_Page80_Header_SPC_16; /*! @define kIOPropertySCSIINQUIRYUnitSerialNumber Key that describes the INQUIRY Unit Serial Number in the IORegistry. */ #define kIOPropertySCSIINQUIRYUnitSerialNumber "INQUIRY Unit Serial Number" /*! @struct SCSICmd_INQUIRY_Page83_Header @discussion INQUIRY Page 83h Header. */ typedef struct SCSICmd_INQUIRY_Page83_Header { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to 83h UInt8 RESERVED; // reserved field UInt8 PAGE_LENGTH; // n-3 bytes } SCSICmd_INQUIRY_Page83_Header; /*! @struct SCSICmd_INQUIRY_Page83_Header_SPC_16 @discussion INQUIRY Page 83h Header used with the 16 byte INQUIRY command. */ typedef struct SCSICmd_INQUIRY_Page83_Header_SPC_16 { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to 83h UInt16 PAGE_LENGTH; // n-3 bytes } SCSICmd_INQUIRY_Page83_Header_SPC_16; /*! @struct SCSICmd_INQUIRY_Page83_Identification_Descriptor @discussion INQUIRY Page 83h Identification Descriptor. */ typedef struct SCSICmd_INQUIRY_Page83_Identification_Descriptor { UInt8 CODE_SET; // 7-4 = Protocol Identifier. 3-0 = Code Set UInt8 IDENTIFIER_TYPE; // 7 = PIV 5-4 = ASSOCIATION 3-0 = Identifier UInt8 RESERVED; UInt8 IDENTIFIER_LENGTH; UInt8 IDENTIFIER; } SCSICmd_INQUIRY_Page83_Identification_Descriptor; /*! @enum INQUIRY Page 83h Code Set @discussion Definitions for the Code Set field. @constant kINQUIRY_Page83_CodeSetBinaryData The identifier contains binary data. @constant kINQUIRY_Page83_CodeSetASCIIData The identifier contains ASCII data. @constant kINQUIRY_Page83_CodeSetUTF8Data The identifier contains UTF-8 data. */ enum { kINQUIRY_Page83_CodeSetReserved = 0x0, kINQUIRY_Page83_CodeSetBinaryData = 0x1, kINQUIRY_Page83_CodeSetASCIIData = 0x2, kINQUIRY_Page83_CodeSetUTF8Data = 0x3, // 0x4 - 0xF reserved kINQUIRY_Page83_CodeSetMask = 0xF }; /*! @enum INQUIRY Page 83h Association @discussion Definitions for the Association field. @constant kINQUIRY_Page83_AssociationLogicalUnit Association of the identifier is with the logical unit. @constant kINQUIRY_Page83_AssociationDevice Association of the identifier is with the device (same as logical unit in SPC-2). @constant kINQUIRY_Page83_AssociationTargetPort Association of the identifier is with the target port. @constant kINQUIRY_Page83_AssociationTargetDevice Association of the identifier is with the target device (i.e. all ports). @constant kINQUIRY_Page83_AssociationMask Mask to use to determine association. */ enum { // SPC-3 - Association is changed to be specific to // Logical Units kINQUIRY_Page83_AssociationLogicalUnit = 0x00, // Backwards compatibility for SPC-2 kINQUIRY_Page83_AssociationDevice = kINQUIRY_Page83_AssociationLogicalUnit, // Association is related to a Target Port kINQUIRY_Page83_AssociationTargetPort = 0x10, // SPC-3 - Added as specific association to // a Target device. kINQUIRY_Page83_AssociationTargetDevice = 0x20, kINQUIRY_Page83_AssociationMask = 0x30, kINQUIRY_Page83_AssociationShift = 4 }; /*! @enum INQUIRY Page 83h Identifier Type @discussion Definitions for the Identifier Type field. @constant kINQUIRY_Page83_IdentifierTypeVendorSpecific Vendor Specific Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeVendorID Vendor Specific Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeIEEE_EUI64 EUI-64 Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeNAAIdentifier NAA Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeRelativePortIdentifier Relative Target Port Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeTargetPortGroup Target Port Group Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeLogicalUnitGroup Logical Unit Group Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeMD5LogicalUnitIdentifier MD5 Logical Unit Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeSCSINameString SCSI Name String Identifier Type. @constant kINQUIRY_Page83_IdentifierTypeMask Mask to use to determine association. @constant kINQUIRY_Page83_ProtocolIdentifierValidBit PIV Bit definition. @constant kINQUIRY_Page83_ProtocolIdentifierValidMask Mask to use to determine if PIV is set. */ enum { kINQUIRY_Page83_IdentifierTypeVendorSpecific = 0, kINQUIRY_Page83_IdentifierTypeVendorID = 1, kINQUIRY_Page83_IdentifierTypeIEEE_EUI64 = 2, kINQUIRY_Page83_IdentifierTypeNAAIdentifier = 3, kINQUIRY_Page83_IdentifierTypeRelativePortIdentifier = 4, kINQUIRY_Page83_IdentifierTypeTargetPortGroup = 5, kINQUIRY_Page83_IdentifierTypeLogicalUnitGroup = 6, kINQUIRY_Page83_IdentifierTypeMD5LogicalUnitIdentifier = 7, kINQUIRY_Page83_IdentifierTypeSCSINameString = 8, // 0x9 - 0xF Reserved kINQUIRY_Page83_IdentifierTypeMask = 0xF, kINQUIRY_Page83_ProtocolIdentifierValidBit = 7, kINQUIRY_Page83_ProtocolIdentifierValidMask = (1 << kINQUIRY_Page83_ProtocolIdentifierValidBit) }; // Backwards compatibility #define kINQUIRY_Page83_IdentifierTypeFCNameIdentifier kINQUIRY_Page83_IdentifierTypeNAAIdentifier #define kINQUIRY_Page83_IdentifierTypeUndefined kINQUIRY_Page83_IdentifierTypeVendorSpecific /*! @enum Protocol Identifier values @discussion Definitions for the protocol identifier values. @constant kSCSIProtocolIdentifier_FibreChannel FibreChannel Protocol Identifier. @constant kSCSIProtocolIdentifier_ParallelSCSI Parallel SCSI Protocol Identifier. @constant kSCSIProtocolIdentifier_SSA SSA Protocol Identifier. @constant kSCSIProtocolIdentifier_FireWire FireWire (IEEE-1394) Protocol Identifier. @constant kSCSIProtocolIdentifier_RDMA RDMA Protocol Identifier. @constant kSCSIProtocolIdentifier_iSCSI iSCSI Protocol Identifier. @constant kSCSIProtocolIdentifier_SAS SAS Protocol Identifier. @constant kSCSIProtocolIdentifier_ADT ADT Protocol Identifier. @constant kSCSIProtocolIdentifier_ATAPI ATAPI Protocol Identifier. @constant kSCSIProtocolIdentifier_None No Protocol Identifier. */ enum { kSCSIProtocolIdentifier_FibreChannel = 0, kSCSIProtocolIdentifier_ParallelSCSI = 1, kSCSIProtocolIdentifier_SSA = 2, kSCSIProtocolIdentifier_FireWire = 3, kSCSIProtocolIdentifier_RDMA = 4, kSCSIProtocolIdentifier_iSCSI = 5, kSCSIProtocolIdentifier_SAS = 6, kSCSIProtocolIdentifier_ADT = 7, kSCSIProtocolIdentifier_ATAPI = 8, // 0x9-0xE Reserved kSCSIProtocolIdentifier_None = 0xF }; /*! @define kIOPropertySCSIINQUIRYDeviceIdentification Device Identification key. */ #define kIOPropertySCSIINQUIRYDeviceIdentification "INQUIRY Device Identification" /*! @define kIOPropertySCSIINQUIRYDeviceIdCodeSet Code Set type key. */ #define kIOPropertySCSIINQUIRYDeviceIdCodeSet "Code Set" /*! @define kIOPropertySCSIINQUIRYDeviceIdType Identifier Type key. */ #define kIOPropertySCSIINQUIRYDeviceIdType "Identifier Type" /*! @define kIOPropertySCSIINQUIRYDeviceIdAssociation Association key. */ #define kIOPropertySCSIINQUIRYDeviceIdAssociation "Association" /*! @define kIOPropertySCSIINQUIRYDeviceIdentifier Identifier key (data or string). */ #define kIOPropertySCSIINQUIRYDeviceIdentifier "Identifier" /*! @struct SCSICmd_INQUIRY_Page83_RelativeTargetPort_Identifier @discussion INQUIRY Page 83h Relative Target Port Identifier. */ typedef struct SCSICmd_INQUIRY_Page83_RelativeTargetPort_Identifier { UInt16 OBSOLETE; UInt16 RELATIVE_TARGET_PORT_IDENTIFIER; } SCSICmd_INQUIRY_Page83_RelativeTargetPort_Identifier; /*! @struct SCSICmd_INQUIRY_Page83_TargetPortGroup_Identifier @discussion INQUIRY Page 83h Target Port Group Identifier. */ typedef struct SCSICmd_INQUIRY_Page83_TargetPortGroup_Identifier { UInt16 RESERVED; UInt16 TARGET_PORT_GROUP; } SCSICmd_INQUIRY_Page83_TargetPortGroup_Identifier; /*! @struct SCSICmd_INQUIRY_Page83_LogicalUnitGroup_Identifier @discussion INQUIRY Page 83h Logical Unit Group Identifier. */ typedef struct SCSICmd_INQUIRY_Page83_LogicalUnitGroup_Identifier { UInt16 RESERVED; UInt16 LOGICAL_UNIT_GROUP; } SCSICmd_INQUIRY_Page83_LogicalUnitGroup_Identifier; /*! @struct SCSICmd_INQUIRY_Page89_Data @discussion INQUIRY Page 89h data as defined in the SAT 1.0 specification. This section contains all structures and definitions used by the INQUIRY command in response to a request for page 89h - ATA information VPD Page. */ typedef struct SCSICmd_INQUIRY_Page89_Data { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to 89h UInt16 PAGE_LENGTH; // Must be equal to 238h UInt32 Reserved; UInt8 SAT_VENDOR_IDENTIFICATION[kINQUIRY_VENDOR_IDENTIFICATION_Length]; UInt8 SAT_PRODUCT_IDENTIFICATION[kINQUIRY_PRODUCT_IDENTIFICATION_Length]; UInt8 SAT_PRODUCT_REVISION_LEVEL[kINQUIRY_PRODUCT_REVISION_LEVEL_Length]; UInt8 ATA_DEVICE_SIGNATURE[20]; UInt8 COMMAND_CODE; UInt8 Reserved2[3]; UInt8 IDENTIFY_DATA[512]; } SCSICmd_INQUIRY_Page89_Data; #pragma pack(push, 1) /*! @struct SCSICmd_INQUIRY_PageB0_Data @discussion INQUIRY Page B0h data as defined in the SBC specification. This section contains all structures and definitions used by the INQUIRY command in response to a request for page B0h - Block Limits VPD Page. */ typedef struct SCSICmd_INQUIRY_PageB0_Data { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to B0h UInt16 PAGE_LENGTH; // Must be equal to 3Ch UInt8 WSNZ; // 0 = WSNZ, 7-1 = Reserved. UInt8 MAXIMUM_COMPARE_AND_WRITE_LENGTH; UInt16 OPTIMAL_TRANSFER_LENGTH_GRANULARITY; UInt32 MAXIMUM_TRANSFER_LENGTH; UInt32 OPTIMAL_TRANSFER_LENGTH; UInt32 MAXIMUM_PREFETCH_LENGTH; UInt32 MAXIMUM_UNMAP_LBA_COUNT; UInt32 MAXIMUM_UNMAP_BLOCK_DESCRIPTOR_COUNT; UInt32 OPTIMAL_UNMAP_GRANULARITY; UInt32 UNMAP_GRANULARITY_ALIGNMENT; UInt64 MAXIMUM_WRITE_SAME_LENGTH; UInt32 MAXIMUM_ATOMIC_TRANSFER_LENGTH; UInt32 ATOMIC_ALIGNMENT; UInt32 ATOMIC_TRANSFER_LENGTH_GRANULARITY; UInt32 MAXIMUM_ATOMIC_TRANSFER_LENGTH_WITH_ATOMIC_BOUNDARY; UInt32 MAXIMUM_ATOMIC_BOUNDARY_SIZE; } SCSICmd_INQUIRY_PageB0_Data; #pragma pack(pop) /*! @struct SCSICmd_INQUIRY_PageB1_Data @discussion INQUIRY Page B1h data as defined in the SBC specification. This section contains all structures and definitions used by the INQUIRY command in response to a request for page B1h - Block Device Characteristics VPD Page. */ typedef struct SCSICmd_INQUIRY_PageB1_Data { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to B1h UInt8 Reserved; UInt8 PAGE_LENGTH; // Must be equal to 3Ch UInt16 MEDIUM_ROTATION_RATE; UInt8 Reserved2[58]; } SCSICmd_INQUIRY_PageB1_Data; enum { kINQUIRY_PageB1_Page_Length = 0x3C }; #pragma pack(push, 1) /*! @struct SCSICmd_INQUIRY_PageB2_Data @discussion INQUIRY Page B2h data as defined in the SBC specification. This section contains all structures and definitions used by the INQUIRY command in response to a request for page B2h - Logical Block Provisioning VPD Page. */ typedef struct SCSICmd_INQUIRY_PageB2_Data { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to B2h. UInt16 PAGE_LENGTH; // Must be n-3. UInt8 THRESHOLD_EXPONENT; UInt8 LBP_FLAGS; // 7 = LBPU, 6 = LBPWS, 5 = LBPWS10, // 4-2 = LBPRZ, 1 = ANC_SUP, 0 = DP. UInt8 MINIMUM_PERCENTAGE; // 7-3 = MINIMUM PERCENTAGE, // 2-0 = PROVISIONING TYPE. UInt8 THRESHOLD_PERCENTAGE; } SCSICmd_INQUIRY_PageB2_Data; typedef struct SCSICmd_INQUIRY_PageB2_Provisioning_Group_Descriptor { UInt8 DESIGNATION_DESCRIPTOR[20]; UInt8 RESERVED[18]; } SCSICmd_INQUIRY_PageB2_Provisioning_Group_Descriptor; #pragma pack(pop) #ifndef __OPEN_SOURCE__ #pragma pack(push, 1) enum { kC0DataMaxStringLen = 32 }; enum { kINQUIRY_PageC0_Features_HasSEP_LUN = ( 1 << 3 ) }; typedef struct SCSICmd_INQUIRY_PageCx_Header { UInt8 PERIPHERAL_DEVICE_TYPE; // 7-5 = Qualifier. 4-0 = Device type. UInt8 PAGE_CODE; // Must be equal to C0h or C1h UInt8 RESERVED; UInt8 PAGE_LENGTH; } SCSICmd_INQUIRY_PAGECx_Header; /*! @struct SCSICmd_INQUIRY_PageC0_Data @discussion INQUIRY Page C0h data as defined in Apple Target Disk Mode specification. This is a vendor specific data structure. This section contains all structures and definitions used by the INQUIRY command in response to a request for page C0h. */ typedef struct SCSICmd_INQUIRY_PageC0_Data { SCSICmd_INQUIRY_PAGECx_Header fHeader; UInt8 fTdmPageVersion; UInt8 fTdmProtocolVersion; UInt8 fReserved1; UInt8 fReserved2; UInt8 fMacModelId[kC0DataMaxStringLen]; UInt8 fSerialNumber[kC0DataMaxStringLen]; UInt32 fMaxReadSize; UInt32 fMaxWriteSize; UInt32 fNativeBlockSize; UInt32 fPreferredIOSize; UInt64 fFeatures; UInt64 fWorkArounds; UInt16 fEncryptionType; UInt8 fReserved3[2]; UInt64 fInstalledRAMSize; } SCSICmd_INQUIRY_PageC0_Data; /*! @struct SCSICmd_INQUIRY_PageC1_Data @discussion INQUIRY Page C1h data as defined in Apple Target Disk Mode specification. This is a vendor specific data structure. This section contains all structures and definitions used by the INQUIRY command in response to a request for page C1h. */ typedef struct SCSICmd_INQUIRY_PageC1_Data { SCSICmd_INQUIRY_PAGECx_Header fHeader; UInt8 fTdmPowerRequirementsPageVersion; UInt8 fReserved1; UInt16 fReserved2; UInt32 fPowerRequired; } SCSICmd_INQUIRY_PageC1_Data; #pragma pack(pop) #endif /* __OPEN_SOURCE__ */ /*! @define kIOPropertySATVendorIdentification Vendor Identification of the SATL. */ #define kIOPropertySATVendorIdentification "SAT Vendor Identification" /*! @define kIOPropertySATProductIdentification Product Identification of the SATL. */ #define kIOPropertySATProductIdentification "SAT Product Identification" /*! @define kIOPropertySATProductRevisonLevel Product Revision Level of the SATL. */ #define kIOPropertySATProductRevisonLevel "SAT Product Revision Level" #endif /* _IOKIT_SCSI_CMDS_INQUIRY_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSIPort.h
/* * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_PORTS_H_ #define _IOKIT_SCSI_PORTS_H_ /*! @header SCSIPort @discussion This file contains all the definitions for SCSIPort notifications and status. */ /*! @enum kSCSIPort_NotificationStatusChange @discussion Message definition to be used with the messageClients call to inform of a change in port status. */ enum { kSCSIPort_NotificationStatusChange = 0x68000001 }; /*! @typedef SCSIPortStatus @abstract 32-bit number to represent a SCSIPortStatus. @discussion Type for SCSIPortStatus. */ typedef UInt32 SCSIPortStatus; /*! @enum SCSI Port Status Values @discussion Definitions for the possible port status values */ enum { /*! @constant kSCSIPort_StatusOnline The port is online. */ kSCSIPort_StatusOnline = 0, /*! @constant kSCSIPort_StatusOffline The port is offline (e.g. unplugged cable). */ kSCSIPort_StatusOffline = 1, /*! @constant kSCSIPort_StatusFailure Driver has detected unrecoverable port failure (e.g. hardware port failure) */ kSCSIPort_StatusFailure = 2 }; #endif /* _IOKIT_SCSI_PORTS_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOReducedBlockServices.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_REDUCED_BLOCK_SERVICES_H_ #define _IOKIT_IO_REDUCED_BLOCK_SERVICES_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // Generic IOKit related headers #include <IOKit/IOTypes.h> // Generic IOKit storage related headers #include <IOKit/storage/IOBlockStorageDevice.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIPeripheralDeviceType0E.h> //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOReducedBlockServices : public IOBlockStorageDevice { OSDeclareDefaultStructors ( IOReducedBlockServices ) protected: // Reserve space for future expansion. struct IOReducedBlockServicesExpansionData { }; IOReducedBlockServicesExpansionData * fIOReducedBlockServicesReserved; IOSCSIPeripheralDeviceType0E * fProvider; virtual bool attach ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void detach ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void free ( void ) APPLE_KEXT_OVERRIDE; public: virtual IOReturn message ( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; static void AsyncReadWriteComplete ( void * clientData, IOReturn status, UInt64 actualByteCount ); // Deprecated virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageAttributes * attributes, IOStorageCompletion * completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn doEjectMedia ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn doFormatMedia ( UInt64 byteCapacity ) APPLE_KEXT_OVERRIDE; virtual UInt32 doGetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const APPLE_KEXT_OVERRIDE; virtual IOReturn doSynchronizeCache ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn getWriteCacheState ( bool * enabled ) APPLE_KEXT_OVERRIDE; virtual IOReturn setWriteCacheState ( bool enabled ) APPLE_KEXT_OVERRIDE; virtual char * getVendorString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getProductString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getRevisionString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getAdditionalDeviceInfoString ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportBlockSize ( UInt64 * blockSize ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportEjectability ( bool * isEjectable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMediaState ( bool * mediaPresent, bool * changed ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMaxValidBlock ( UInt64 * maxBlock ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportRemovability ( bool * isRemovable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportWriteProtection ( bool * isWriteProtected ) APPLE_KEXT_OVERRIDE; private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 1 ); OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 2 ); OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 3 ); OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 4 ); OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 5 ); OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 6 ); OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 7 ); OSMetaClassDeclareReservedUnused ( IOReducedBlockServices, 8 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_REDUCED_BLOCK_SERVICES_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOCompactDiscServices.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_COMPACT_DISC_SERVICES_H_ #define _IOKIT_IO_COMPACT_DISC_SERVICES_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // IOKit includes #include <IOKit/IOTypes.h> // Generic IOKit storage related headers #include <IOKit/storage/IOCDTypes.h> #include <IOKit/storage/IOCDBlockStorageDevice.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIPeripheralDeviceType05.h> class IOMemoryDescriptor; // Use this switch to turn off the data cache. #define _USE_DATA_CACHING_ 1 //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOCompactDiscServices : public IOCDBlockStorageDevice { OSDeclareDefaultStructors ( IOCompactDiscServices ) #if (_USE_DATA_CACHING_) // Data Cache members bool fUseDataCache; // Indicates if cache should be used. This // will be set to false if all the necessary support // for the data cache could not be allocated or // initialized. UInt8 * fDataCacheStorage; // Storage space for the cache UInt32 fDataCacheStartBlock; // Starting block of the data in the cache. UInt32 fDataCacheBlockCount; // Number of contiguous blocks in the cache // starting with fDataCacheStartBlock. A value of // zero in this member indicates that all data // in the cache is invalid. IOSimpleLock * fDataCacheLock; // This is the lock for preventing multiple access // while manipulating the data cache. #endif protected: OSSet * fClients; IOSCSIPeripheralDeviceType05 * fProvider; virtual void free ( void ) APPLE_KEXT_OVERRIDE; // Reserve space for future expansion. struct IOCompactDiscServicesExpansionData { }; IOCompactDiscServicesExpansionData * fIOCompactDiscServicesReserved; public: static void AsyncReadWriteComplete ( void * clientData, IOReturn status, UInt64 actualByteCount ); // Deprecated virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageAttributes * attributes, IOStorageCompletion * completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn doEjectMedia ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn doFormatMedia ( UInt64 byteCapacity ) APPLE_KEXT_OVERRIDE; virtual UInt32 doGetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const APPLE_KEXT_OVERRIDE; virtual IOReturn doSynchronizeCache ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn getWriteCacheState ( bool * enabled ) APPLE_KEXT_OVERRIDE; virtual IOReturn setWriteCacheState ( bool enabled ) APPLE_KEXT_OVERRIDE; virtual char * getVendorString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getProductString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getRevisionString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getAdditionalDeviceInfoString ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportBlockSize ( UInt64 * blockSize ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportEjectability ( bool * isEjectable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMediaState ( bool * mediaPresent, bool * changed ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMaxValidBlock ( UInt64 * maxBlock ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportRemovability ( bool * isRemovable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportWriteProtection ( bool * isWriteProtected ) APPLE_KEXT_OVERRIDE; /* CD Specific */ virtual IOReturn doAsyncReadCD ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, CDSectorArea sectorArea, CDSectorType sectorType, IOStorageCompletion completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn readISRC ( UInt8 track, CDISRC isrc ) APPLE_KEXT_OVERRIDE; virtual IOReturn readMCN ( CDMCN mcn) APPLE_KEXT_OVERRIDE; virtual IOReturn readTOC ( IOMemoryDescriptor * buffer ) APPLE_KEXT_OVERRIDE; virtual IOReturn audioPause ( bool pause ); virtual IOReturn audioPlay ( CDMSF timeStart, CDMSF timeStop ); virtual IOReturn audioScan ( CDMSF timeStart, bool reverse ); virtual IOReturn audioStop ( void ); virtual IOReturn getAudioStatus ( CDAudioStatus * status ); virtual IOReturn getAudioVolume ( UInt8 * leftVolume, UInt8 * rightVolume ); virtual IOReturn setAudioVolume ( UInt8 leftVolume, UInt8 rightVolume ); virtual UInt32 getMediaType ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn getSpeed ( UInt16 * kilobytesPerSecond ) APPLE_KEXT_OVERRIDE; virtual IOReturn setSpeed ( UInt16 kilobytesPerSecond ) APPLE_KEXT_OVERRIDE; /* System Specific */ virtual IOReturn message ( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; virtual IOReturn setProperties ( OSObject * properties ) APPLE_KEXT_OVERRIDE; /* User Client Specific */ virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual bool open ( IOService * client, IOOptionBits options, IOStorageAccess access ); virtual bool handleOpen ( IOService * client, IOOptionBits options, void * access ) APPLE_KEXT_OVERRIDE; virtual void handleClose ( IOService * client, IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual bool handleIsOpen ( const IOService * client ) const APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readTOC ( IOMemoryDescriptor * buffer, CDTOCFormat format, UInt8 msf, UInt8 trackSessionNumber, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readDiscInfo ( IOMemoryDescriptor * buffer, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readTrackInfo ( IOMemoryDescriptor * buffer, UInt32 address, CDTrackInfoAddressType addressType, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 1 ); OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 2 ); OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 3 ); OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 4 ); OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 5 ); OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 6 ); OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 7 ); OSMetaClassDeclareReservedUnused ( IOCompactDiscServices, 8 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_COMPACT_DISC_SERVICES_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIMultimediaCommandsDevice.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_ #define _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_ #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif #include <IOKit/storage/IOStorageDeviceCharacteristics.h> // Build includes #include <TargetConditionals.h> //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- // Message constants #define kIOMessageTrayStateChange 0x69000035 #define kIOMessageTrayStateHasChanged kIOMessageTrayStateChange // DEPRECATED, use kIOMessageTrayStateChange instead // Message values for kIOMessageTrayStateChange enum { kMessageTrayStateChangeRequestAccepted = 0, kMessageTrayStateChangeRequestRejected = 1 }; #define kIOMessageMediaAccessChange 0x69000036 // Message values for kIOMessageMediaAccessChange enum { kMessageDeterminingMediaPresence = 0, kMessageFoundMedia = 1, kMessageMediaTypeDetermined = 2 }; // IOKit property keys and constants #define kIOPropertySupportedCDFeatures kIOPropertySupportedCDFeaturesKey #define kIOPropertySupportedDVDFeatures kIOPropertySupportedDVDFeaturesKey #define kIOPropertySupportedBDFeatures kIOPropertySupportedBDFeaturesKey #define kIOPropertyLowPowerPolling "Low Power Polling" typedef UInt32 CDFeatures; enum { kCDFeaturesAnalogAudioBit = 0, // Analog Audio playback kCDFeaturesReadStructuresBit = 1, // CD-ROM kCDFeaturesWriteOnceBit = 2, // CD-R kCDFeaturesReWriteableBit = 3, // CD-R/W kCDFeaturesCDDAStreamAccurateBit = 4, // CD-DA stream accurate kCDFeaturesPacketWriteBit = 5, // Packet Writing kCDFeaturesTAOWriteBit = 6, // CD Track At Once kCDFeaturesSAOWriteBit = 7, // CD Mastering - Session At Once kCDFeaturesRawWriteBit = 8, // CD Mastering - Raw kCDFeaturesTestWriteBit = 9, // CD Mastering/TAO - Test Write kCDFeaturesBUFWriteBit = 10 // CD Mastering/TAO - Buffer Underrun Free }; enum { kCDFeaturesAnalogAudioMask = (1 << kCDFeaturesAnalogAudioBit), kCDFeaturesReadStructuresMask = (1 << kCDFeaturesReadStructuresBit), kCDFeaturesWriteOnceMask = (1 << kCDFeaturesWriteOnceBit), kCDFeaturesReWriteableMask = (1 << kCDFeaturesReWriteableBit), kCDFeaturesCDDAStreamAccurateMask = (1 << kCDFeaturesCDDAStreamAccurateBit), kCDFeaturesPacketWriteMask = (1 << kCDFeaturesPacketWriteBit), kCDFeaturesTAOWriteMask = (1 << kCDFeaturesTAOWriteBit), kCDFeaturesSAOWriteMask = (1 << kCDFeaturesSAOWriteBit), kCDFeaturesRawWriteMask = (1 << kCDFeaturesRawWriteBit), kCDFeaturesTestWriteMask = (1 << kCDFeaturesTestWriteBit), kCDFeaturesBUFWriteMask = (1 << kCDFeaturesBUFWriteBit) }; typedef UInt32 DVDFeatures; enum { kDVDFeaturesCSSBit = 0, // DVD-CSS kDVDFeaturesReadStructuresBit = 1, // DVD-ROM kDVDFeaturesWriteOnceBit = 2, // DVD-R kDVDFeaturesRandomWriteableBit = 3, // DVD-RAM kDVDFeaturesReWriteableBit = 4, // DVD-RW kDVDFeaturesTestWriteBit = 5, // DVD-R Write - Test Write kDVDFeaturesBUFWriteBit = 6, // DVD-R Write - Buffer Underrun Free kDVDFeaturesPlusRBit = 7, // DVD+R kDVDFeaturesPlusRWBit = 8, // DVD+RW (implies backgound format support) kDVDFeaturesHDReadBit = 9, // HD DVD-ROM kDVDFeaturesHDRBit = 10, // HD DVD-R kDVDFeaturesHDRAMBit = 11, // HD DVD-RAM kDVDFeaturesHDRWBit = 12 // HD DVD-RW }; enum { kDVDFeaturesCSSMask = (1 << kDVDFeaturesCSSBit), kDVDFeaturesReadStructuresMask = (1 << kDVDFeaturesReadStructuresBit), kDVDFeaturesWriteOnceMask = (1 << kDVDFeaturesWriteOnceBit), kDVDFeaturesRandomWriteableMask = (1 << kDVDFeaturesRandomWriteableBit), kDVDFeaturesReWriteableMask = (1 << kDVDFeaturesReWriteableBit), kDVDFeaturesTestWriteMask = (1 << kDVDFeaturesTestWriteBit), kDVDFeaturesBUFWriteMask = (1 << kDVDFeaturesBUFWriteBit), kDVDFeaturesPlusRMask = (1 << kDVDFeaturesPlusRBit), kDVDFeaturesPlusRWMask = (1 << kDVDFeaturesPlusRWBit), kDVDFeaturesHDReadMask = (1 << kDVDFeaturesHDReadBit), kDVDFeaturesHDRMask = (1 << kDVDFeaturesHDRBit), kDVDFeaturesHDRAMMask = (1 << kDVDFeaturesHDRAMBit), kDVDFeaturesHDRWMask = (1 << kDVDFeaturesHDRWBit) }; typedef UInt32 BDFeatures; enum { kBDFeaturesReadBit = 0, // BD-ROM kBDFeaturesWriteBit = 1 // BD-R / BD-RE }; enum { kBDFeaturesReadMask = (1 << kBDFeaturesReadBit), kBDFeaturesWriteMask = (1 << kBDFeaturesWriteBit) }; enum { kDiscStatusEmpty = 0, kDiscStatusIncomplete = 1, kDiscStatusComplete = 2, kDiscStatusOther = 3, kDiscStatusMask = 0x03, kDiscStatusErasableMask = 0x10 }; #if defined(KERNEL) && defined(__cplusplus) // MMC power states as defined in T10:1228D SCSI Multimedia Commands - 2 (MMC-2) // Revision 11a, August 30, 1999, page 312 (Annex F). enum { kMMCPowerStateSystemSleep = 0, kMMCPowerStateSleep = 1, kMMCPowerStateStandby = 2, kMMCPowerStateIdle = 3, kMMCPowerStateActive = 4, kMMCNumPowerStates = 5 }; enum { kMediaStateUnlocked = 0, kMediaStateLocked = 1 }; //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // General IOKit headers #include <IOKit/IOLib.h> #include <IOKit/IOMemoryDescriptor.h> // Generic IOKit storage related headers #include <IOKit/storage/IOStorage.h> #include <IOKit/storage/IOCDTypes.h> #include <IOKit/storage/IODVDTypes.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIPrimaryCommandsDevice.h> // Forward definitions for internal use only classes class SCSIMultimediaCommands; class SCSIBlockCommands; //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOSCSIMultimediaCommandsDevice : public IOSCSIPrimaryCommandsDevice { OSDeclareAbstractStructors ( IOSCSIMultimediaCommandsDevice ) private: static void AsyncReadWriteComplete ( SCSITaskIdentifier completedTask ); protected: // Reserve space for future expansion. struct IOSCSIMultimediaCommandsDeviceExpansionData { IONotifier * fPowerDownNotifier; bool fDeviceSupportsPowerOff; BDFeatures fSupportedBDFeatures; bool fDeviceSupportsAsyncNotification; bool fDeviceSupportsFastSpindown; UInt8 fCDLoadingMechanism; bool fDoNotLockMedia; }; IOSCSIMultimediaCommandsDeviceExpansionData * fIOSCSIMultimediaCommandsDeviceReserved; #define fPowerDownNotifier fIOSCSIMultimediaCommandsDeviceReserved->fPowerDownNotifier #define fDeviceSupportsPowerOff fIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsPowerOff #define fSupportedBDFeatures fIOSCSIMultimediaCommandsDeviceReserved->fSupportedBDFeatures #define fDeviceSupportsAsyncNotification fIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsAsyncNotification #define fDeviceSupportsFastSpindown fIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsFastSpindown #define fCDLoadingMechanism fIOSCSIMultimediaCommandsDeviceReserved->fCDLoadingMechanism #define fDoNotLockMedia fIOSCSIMultimediaCommandsDeviceReserved->fDoNotLockMedia CDFeatures fSupportedCDFeatures; DVDFeatures fSupportedDVDFeatures; UInt16 fCurrentDiscSpeed; bool fMediaChanged; bool fMediaPresent; // The byte count of each physical block on the media. UInt32 fMediaBlockSize; // The total number of blocks of fMediaBlockSize on the media. UInt32 fMediaBlockCount; // Flags used to indicate device feature bool fMediaIsRemovable; bool fMediaIsWriteProtected; UInt32 fMediaType; thread_call_t fPollingThread; bool fDeviceSupportsLowPowerPolling; bool fLowPowerPollingEnabled; UInt32 fPollingMode; enum { kPollingMode_Suspended = 0, kPollingMode_NewMedia = 1, kPollingMode_MediaRemoval = 2 }; virtual IOReturn setProperties ( OSObject * properties ) APPLE_KEXT_OVERRIDE; virtual void CreateStorageServiceNub ( void ); virtual bool DetermineDeviceCharacteristics ( void ); virtual IOReturn DetermineIfMediaIsRemovable ( void ); virtual IOReturn DetermineDeviceFeatures ( void ); virtual void DetermineMediaType ( void ); virtual bool CheckForDVDMediaType ( void ); virtual bool CheckForCDMediaType ( void ); virtual void PollForMedia ( void ); virtual void EnablePolling ( void ); virtual void DisablePolling ( void ); virtual void CheckWriteProtection ( void ); virtual bool ClearNotReadyStatus ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn GetDeviceConfiguration ( void ); virtual IOReturn GetDeviceConfigurationSize ( UInt32 * size ); virtual IOReturn ParseFeatureList ( UInt32 numProfiles, UInt8 * firstFeaturePtr ); virtual IOReturn GetMechanicalCapabilities ( void ); virtual IOReturn GetMechanicalCapabilitiesSize ( UInt32 * size ); virtual IOReturn ParseMechanicalCapabilities ( UInt8 * mechanicalCapabilitiesPtr ); virtual IOReturn CheckForLowPowerPollingSupport ( void ); virtual IOReturn GetCurrentPowerStateOfDrive ( UInt32 * powerState ); virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount ); virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer, void * clientData, UInt64 startBlock, UInt64 blockCount ); virtual IOReturn IssueWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount ); virtual IOReturn IssueWrite ( IOMemoryDescriptor * buffer, void * clientData, UInt64 startBlock, UInt64 blockCount ); virtual void SetMediaCharacteristics ( UInt32 blockSize, UInt32 blockCount ); virtual void ResetMediaCharacteristics ( void ); UInt8 ConvertBCDToHex ( UInt8 binaryCodedDigit ); // ------ User Client Support ------ virtual IOReturn HandleSetUserClientExclusivityState ( IOService * userClient, bool state ) APPLE_KEXT_OVERRIDE; // ----- Power Management Support ------ // We override this method to set our power states and register ourselves // as a power policy maker. virtual void InitializePowerManagement ( IOService * provider ) APPLE_KEXT_OVERRIDE; // We override this method so that when we register for power management, // we go to our active power state (which the drive is definitely in // at startup time). virtual UInt32 GetInitialPowerState ( void ) APPLE_KEXT_OVERRIDE; // We override this method in order to provide the number of transitions // from Fully active to Sleep state so that the idle timer can be adjusted // to the appropriate time period based on the disk spindown time set in // the Energy Saver prefs panel. virtual UInt32 GetNumberOfPowerStateTransitions ( void ) APPLE_KEXT_OVERRIDE; // The TicklePowerManager method is called to tell the power manager that the // device needs to be in a certain power state to handle requests. virtual void TicklePowerManager ( void ) APPLE_KEXT_OVERRIDE; // The HandlePowerChange method is the state machine for power management. // It is guaranteed to be on its own thread of execution (different from // the power manager thread AND the workloop thread. This routine can // send sync or async calls to the drive without worrying about threading // issues. virtual void HandlePowerChange ( void ) APPLE_KEXT_OVERRIDE; // The HandleCheckPowerState (void) method is on the serialized side of the command // gate and can change member variables safely without multi-threading issues. // It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) // with the max power state the class registered with. virtual void HandleCheckPowerState ( void ) APPLE_KEXT_OVERRIDE; // The CheckMediaPresence method is called to see if the media which we // anticipated being there is still there. virtual bool CheckMediaPresence ( void ); virtual bool InitializeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; virtual void StartDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; virtual void SuspendDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; virtual void ResumeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; virtual void StopDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; virtual void TerminateDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; virtual void free ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn VerifyDeviceState ( void ) APPLE_KEXT_OVERRIDE; public: virtual IOReturn setAggressiveness ( unsigned long type, unsigned long minutes ) APPLE_KEXT_OVERRIDE; virtual IOReturn SyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount ); virtual IOReturn AsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, void * clientData ); virtual IOReturn EjectTheMedia ( void ); virtual IOReturn GetTrayState ( UInt8 * trayState ); virtual IOReturn SetTrayState ( UInt8 trayState ); virtual IOReturn FormatMedia ( UInt64 byteCapacity ); virtual UInt32 GetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const; virtual IOReturn LockUnlockMedia ( bool doLock ); virtual IOReturn SynchronizeCache ( void ); virtual IOReturn ReportBlockSize ( UInt64 * blockSize ); virtual IOReturn ReportEjectability ( bool * isEjectable ); virtual IOReturn ReportLockability ( bool * isLockable ); virtual IOReturn ReportPollRequirements ( bool * pollIsRequired, bool * pollIsExpensive ); virtual IOReturn ReportMaxReadTransfer ( UInt64 blockSize, UInt64 * max ); virtual IOReturn ReportMaxValidBlock ( UInt64 * maxBlock ); virtual IOReturn ReportMaxWriteTransfer ( UInt64 blockSize, UInt64 * max ); virtual IOReturn ReportMediaState ( bool * mediaPresent, bool * changed ); virtual IOReturn ReportRemovability ( bool * isRemovable ); virtual IOReturn ReportWriteProtection ( bool * isWriteProtected ); static void sPollForMedia ( void * pdtDriver, void * refCon ); /* CD Specific */ virtual IOReturn SetMediaAccessSpeed ( UInt16 kilobytesPerSecond ); virtual IOReturn GetMediaAccessSpeed ( UInt16 * kilobytesPerSecond ); virtual IOReturn AsyncReadCD ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, CDSectorArea sectorArea, CDSectorType sectorType, void * clientData ); virtual IOReturn ReadISRC ( UInt8 track, CDISRC isrc ); virtual IOReturn ReadMCN ( CDMCN mcn); virtual IOReturn ReadTOC ( IOMemoryDescriptor * buffer ); /* DVD Specific */ virtual UInt32 GetMediaType ( void ); virtual IOReturn ReportKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt32 lba, const UInt8 agid, const DVDKeyFormat keyFormat ) __attribute__ ((deprecated)); virtual IOReturn SendKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt8 agid, const DVDKeyFormat keyFormat ); virtual IOReturn ReadDVDStructure ( IOMemoryDescriptor * buffer, const UInt32 length, const UInt8 structureFormat, const UInt32 logicalBlockAddress, const UInt8 layer, const UInt8 agid ); // The block size decoding for Read CD and Read CD MSF as defined in table 255 bool GetBlockSize ( UInt32 * requestedByteCount, SCSICmdField3Bit EXPECTED_SECTOR_TYPE, SCSICmdField1Bit SYNC, SCSICmdField2Bit HEADER_CODES, SCSICmdField1Bit USER_DATA, SCSICmdField1Bit EDC_ECC, SCSICmdField2Bit ERROR_FIELD, SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS ); SCSICmdField4Byte ConvertMSFToLBA ( SCSICmdField3Byte MSF ); // The GET CONFIGURATION command as defined in section 6.1.4 virtual bool GET_CONFIGURATION ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField2Bit RT, SCSICmdField2Byte STARTING_FEATURE_NUMBER, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); // The GET EVENT/STATUS NOTIFICATION command as defined in section 6.1.5 virtual bool GET_EVENT_STATUS_NOTIFICATION ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit IMMED, SCSICmdField1Byte NOTIFICATION_CLASS_REQUEST, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); // The GET PERFORMANCE command as defined in section 6.1.6 virtual bool GET_PERFORMANCE ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField2Bit TOLERANCE, SCSICmdField1Bit WRITE, SCSICmdField2Bit EXCEPT, SCSICmdField4Byte STARTING_LBA, SCSICmdField2Byte MAXIMUM_NUMBER_OF_DESCRIPTORS, SCSICmdField1Byte CONTROL ); // The LOAD/UNLOAD MEDIUM command as defined in section 6.1.7 virtual bool LOAD_UNLOAD_MEDIUM ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField1Bit LO_UNLO, SCSICmdField1Bit START, SCSICmdField1Byte SLOT, SCSICmdField1Byte CONTROL ); // The MECHANISM STATUS command as defined in section 6.1.8 virtual bool MECHANISM_STATUS ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool READ_10 ( SCSITaskIdentifier request, IOMemoryDescriptor *dataBuffer, UInt32 blockSize, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); // The READ CD command as defined in section 6.1.15 virtual bool READ_CD ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField3Bit EXPECTED_SECTOR_TYPE, SCSICmdField1Bit RELADR, SCSICmdField4Byte STARTING_LOGICAL_BLOCK_ADDRESS, SCSICmdField3Byte TRANSFER_LENGTH, SCSICmdField1Bit SYNC, SCSICmdField2Bit HEADER_CODES, SCSICmdField1Bit USER_DATA, SCSICmdField1Bit EDC_ECC, SCSICmdField2Bit ERROR_FIELD, SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS, SCSICmdField1Byte CONTROL ); // The READ CD MSF command as defined in section 6.1.16 virtual bool READ_CD_MSF ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField3Bit EXPECTED_SECTOR_TYPE, SCSICmdField3Byte STARTING_MSF, SCSICmdField3Byte ENDING_MSF, SCSICmdField1Bit SYNC, SCSICmdField2Bit HEADER_CODES, SCSICmdField1Bit USER_DATA, SCSICmdField1Bit EDC_ECC, SCSICmdField2Bit ERROR_FIELD, SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS, SCSICmdField1Byte CONTROL ); // The READ CAPACITY command as defined in section 6.1.17 virtual bool READ_CAPACITY ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField1Bit PMI, SCSICmdField1Byte CONTROL ); // The READ DISC INFORMATION command as defined in section 6.1.18 virtual bool READ_DISC_INFORMATION ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); // The READ DVD STRUCTURE command as defined in section 6.1.19 virtual bool READ_DVD_STRUCTURE ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Byte ADDRESS, SCSICmdField1Byte LAYER_NUMBER, SCSICmdField1Byte FORMAT, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField2Bit AGID, SCSICmdField1Byte CONTROL ); // The READ FORMAT CAPACITIES command as defined in section 6.1.20 virtual bool READ_FORMAT_CAPACITIES ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); // The READ SUB-CHANNEL command as defined in section 6.1.23 virtual bool READ_SUB_CHANNEL ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit MSF, SCSICmdField1Bit SUBQ, SCSICmdField1Byte SUB_CHANNEL_PARAMETER_LIST, SCSICmdField1Byte TRACK_NUMBER, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); // The READ TOC/PMA/ATIP command as defined in section 6.1.24/25 virtual bool READ_TOC_PMA_ATIP ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit MSF, SCSICmdField4Bit FORMAT, SCSICmdField1Byte TRACK_SESSION_NUMBER, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); // The READ TRACK INFORMATION command as defined in section 6.1.26 virtual bool READ_TRACK_INFORMATION ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField2Bit ADDRESS_NUMBER_TYPE, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS_TRACK_SESSION_NUMBER, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); /*********************** LEGACY COMMAND SUPPORT ***********************/ // The SET CD SPEED command as defined in section 6.1.36 virtual bool SET_CD_SPEED ( SCSITaskIdentifier request, SCSICmdField2Byte LOGICAL_UNIT_READ_SPEED, SCSICmdField2Byte LOGICAL_UNIT_WRITE_SPEED, SCSICmdField1Byte CONTROL ); /*********************** END LEGACY COMMAND SUPPORT ***********************/ // The SET READ AHEAD command as defined in section 6.1.37 virtual bool SET_READ_AHEAD ( SCSITaskIdentifier request, SCSICmdField4Byte TRIGGER_LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte READ_AHEAD_LOGICAL_BLOCK_ADDRESS, SCSICmdField1Byte CONTROL ); // The SET STREAMING command as defined in section 6.1.38 virtual bool SET_STREAMING ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool START_STOP_UNIT ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField4Bit POWER_CONDITIONS, SCSICmdField1Bit LOEJ, SCSICmdField1Bit START, SCSICmdField1Byte CONTROL ); // The SYNCHRONIZE CACHE command as defined in section 6.1.40 virtual bool SYNCHRONIZE_CACHE ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte NUMBER_OF_BLOCKS, SCSICmdField1Byte CONTROL ); // The WRITE (10) command as defined in section 6.1.41 virtual bool WRITE_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); // The WRITE AND VERIFY (10) command as defined in section 6.1.42 virtual bool WRITE_AND_VERIFY_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField1Bit DPO, SCSICmdField1Bit BYT_CHK, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); /* Added with 10.1.3 */ OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 1 ); virtual IOReturn ReadTOC ( IOMemoryDescriptor * buffer, CDTOCFormat format, UInt8 msf, UInt32 trackSessionNumber, UInt16 * actualByteCount ); /* Added with 10.1.3 */ OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 2 ); virtual IOReturn ReadDiscInfo ( IOMemoryDescriptor * buffer, UInt16 * actualByteCount ); /* Added with 10.1.3 */ OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 3 ); virtual IOReturn ReadTrackInfo ( IOMemoryDescriptor * buffer, UInt32 address, CDTrackInfoAddressType addressType, UInt16 * actualByteCount ); /* Added with 10.2 */ OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 4 ); virtual IOReturn PowerDownHandler ( void * refCon, UInt32 messageType, IOService * provider, void * messageArgument, vm_size_t argSize ); /* Added with 10.3.3 */ OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 5 ); protected: virtual void AsyncReadWriteCompletion ( SCSITaskIdentifier completedTask ); public: /* Added with 10.5 */ OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 6 ); virtual IOReturn ReadDiscStructure ( IOMemoryDescriptor * buffer, const UInt32 length, const UInt8 structureFormat, const UInt32 logicalBlockAddress, const UInt8 layer, const UInt8 agid, const UInt8 mediaType ); bool CheckForBDMediaType ( void ); bool READ_DISC_STRUCTURE ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Bit MEDIA_TYPE, SCSICmdField4Byte ADDRESS, SCSICmdField1Byte LAYER_NUMBER, SCSICmdField1Byte FORMAT, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField2Bit AGID, SCSICmdField1Byte CONTROL ); OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 7 ); virtual IOReturn ReserveTrack ( UInt8 reservationType, UInt8 reservationFormat, UInt64 ReservationParameter ); bool RESERVE_TRACK_V2 ( SCSITaskIdentifier request, SCSICmdField1Bit RMZ, SCSICmdField1Bit ARSV, SCSICmdField7Byte RESERVATION_PARAMETER, SCSICmdField1Byte CONTROL ); bool REPORT_KEY_V2 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField1Byte KEY_CLASS, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField2Bit AGID, SCSICmdField6Bit KEY_FORMAT, SCSICmdField1Byte CONTROL ) __attribute__ ((deprecated)); bool REPORT_KEY_V3 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField1Byte KEY_CLASS, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte BLOCK_COUNT, SCSICmdField2Bit AGID, SCSICmdField6Bit KEY_FORMAT, SCSICmdField1Byte CONTROL ); bool SEND_KEY_V2 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Byte KEY_CLASS, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField2Bit AGID, SCSICmdField6Bit KEY_FORMAT, SCSICmdField1Byte CONTROL ); protected: void SetPollingMode ( UInt32 newPollingMode ); public: /* 10.6.0 */ IOReturn RequestIdle ( void ); /* 10.12.0 */ virtual IOReturn ReportKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt32 lba, const UInt8 blockCount, const UInt8 agid, const DVDKeyFormat keyFormat ); private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 16 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIPeripheralDeviceType05.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_05_H_ #define _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_05_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIMultimediaCommandsDevice.h> //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOSCSIPeripheralDeviceType05 : public IOSCSIMultimediaCommandsDevice { OSDeclareDefaultStructors ( IOSCSIPeripheralDeviceType05 ) protected: // Reserve space for future expansion. struct IOSCSIPeripheralDeviceType05ExpansionData { }; IOSCSIPeripheralDeviceType05ExpansionData * fIOSCSIPeripheralDeviceType05Reserved; public: bool init ( OSDictionary * propTable ) APPLE_KEXT_OVERRIDE; virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void stop ( IOService * provider ) APPLE_KEXT_OVERRIDE; private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 1 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 2 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 3 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType05, 8 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_05_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIBlockCommandsDevice.h
/* * Copyright (c) 1998-2011 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_BLOCK_COMMANDS_DEVICE_H_ #define _IOKIT_IO_SCSI_BLOCK_COMMANDS_DEVICE_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- // SBC power states as defined in T10:996D SCSI Block Commands - 3 (SBC-3) // Revision 8c, November 13, 1997, pages 10-11. enum { kSBCPowerStateSystemSleep = 0, kSBCPowerStateSleep = 1, kSBCPowerStateStandby = 2, kSBCPowerStateIdle = 3, kSBCPowerStateActive = 4, kSBCNumPowerStates = 5 }; enum { kMediaStateUnlocked = 0, kMediaStateLocked = 1 }; //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // General IOKit headers #include <IOKit/IOLib.h> #include <IOKit/IOMemoryDescriptor.h> #include <IOKit/IOService.h> #include <IOKit/IOUserClient.h> // Generic IOKit storage related headers #include <IOKit/storage/IOStorage.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIPrimaryCommandsDevice.h> #include <IOKit/storage/IOBlockStorageDevice.h> // Build includes #include <TargetConditionals.h> // Forward declaration for the SCSIBlockCommands that is used internally by the // IOSCSIBlockCommandsDevice class. class SCSIBlockCommands; //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- /*! @class IOSCSIBlockCommandsDevice @superclass IOSCSIPrimaryCommandsDevice @discussion Implementation of the T10 device Block Commands device. */ class __exported IOSCSIBlockCommandsDevice : public IOSCSIPrimaryCommandsDevice { OSDeclareAbstractStructors ( IOSCSIBlockCommandsDevice ) private: IOReturn GetWriteCacheState ( IOMemoryDescriptor * buffer, UInt8 modePageControlValue ); static void AsyncReadWriteComplete ( SCSITaskIdentifier completedTask ); protected: // Reserve space for future expansion. struct IOSCSIBlockCommandsDeviceExpansionData { IONotifier * fPowerDownNotifier; bool fWriteCacheEnabled; bool fDeviceIsShared; UInt64 fMediumBlockCount64; #if !TARGET_OS_IPHONE bool fDeviceHasSATTranslation; bool fDeviceHasNVMETranslation; #endif /* !TARGET_OS_IPHONE */ bool fProtocolSpecificPowerControl; bool fRequiresEjectWithStartStopUnit; UInt32 fMaximumUnmapLBACount; UInt32 fMaximumUnmapBlockDescriptorCount; UInt64 fMaximumWriteSameLength; UInt8 fLBPRZ; bool fUnmapAllowed; bool fUseWriteSame; }; IOSCSIBlockCommandsDeviceExpansionData * fIOSCSIBlockCommandsDeviceReserved; #define fPowerDownNotifier fIOSCSIBlockCommandsDeviceReserved->fPowerDownNotifier #define fWriteCacheEnabled fIOSCSIBlockCommandsDeviceReserved->fWriteCacheEnabled #define fMaximumUnmapLBACount fIOSCSIBlockCommandsDeviceReserved->fMaximumUnmapLBACount #define fMaximumUnmapBlockDescriptorCount fIOSCSIBlockCommandsDeviceReserved->fMaximumUnmapBlockDescriptorCount #define fMaximumWriteSameLength fIOSCSIBlockCommandsDeviceReserved->fMaximumWriteSameLength #define fLBPRZ fIOSCSIBlockCommandsDeviceReserved->fLBPRZ #define fUnmapAllowed fIOSCSIBlockCommandsDeviceReserved->fUnmapAllowed #define fUseWriteSame fIOSCSIBlockCommandsDeviceReserved->fUseWriteSame // The fDeviceIsShared is used to indicate whether this device exists on a Physical // Interconnect that allows multiple initiators to access it. This is used mainly // by the power management code to not send power state related START_STOP_UNIT // commands to the device. // The fDeviceIsShared value is also used to prevent power state commands from being // sent to manual eject device since these devices behave better when allowed to // manage their own power. #define fDeviceIsShared fIOSCSIBlockCommandsDeviceReserved->fDeviceIsShared // The fMediumBlockCount64 provides support for 64 bit LBAs and // replaces fMediumBlockCount which only supports 32 bits. // This value should not be directly accessed and instead the member routine // ReportMediumTotalBlockCount() should be used to retrieve it and the member routine // SetMediumCharacteristics() should be used to set it. #define fMediumBlockCount64 fIOSCSIBlockCommandsDeviceReserved->fMediumBlockCount64 #if !TARGET_OS_IPHONE #define fDeviceHasSATTranslation fIOSCSIBlockCommandsDeviceReserved->fDeviceHasSATTranslation #endif /* !TARGET_OS_IPHONE */ #if !TARGET_OS_IPHONE #define fDeviceHasNVMETranslation fIOSCSIBlockCommandsDeviceReserved->fDeviceHasNVMETranslation #endif /* !TARGET_OS_IPHONE */ // Device support protocol specific power off #define fProtocolSpecificPowerControl fIOSCSIBlockCommandsDeviceReserved->fProtocolSpecificPowerControl // Device requires START_STOP_UNIT for ejects, regardless if PREVENT_ALLOW_MEIDUMREMOVAL // failed. #define fRequiresEjectWithStartStopUnit fIOSCSIBlockCommandsDeviceReserved->fRequiresEjectWithStartStopUnit private: /* OBSOLETE. Use IOSCSIPrimaryCommandsDevice::Get/SetANSIVersion */ UInt8 fANSIVersion; protected: // ---- Device Characteristics ---- bool fMediaIsRemovable; // ---- Medium Characteristics ---- bool fMediumPresent; private: // The byte count of each physical block on the medium. // This value should not be directly accessed and instead the member routine // ReportMediumBlockSize() should be used to retrieve it and the member routine // SetMediumCharacteristics() should be used to set it. UInt32 fMediumBlockSize; // The total number of blocks of fMediumBlockSize on the medium. // OBSOLETE. Use fMediumBlockCount64 instead which allows for support of // devices that have 33 through 64 bit LBA values. UInt32 fMediumBlockCount; protected: // Whether the installed medium is protected from writes bool fMediumIsWriteProtected; // Whether user removal of medium has been prevented bool fMediumRemovalPrevented; // Indicates whether this is a known manual eject device bool fKnownManualEject; // Polling thread variables thread_call_t fPollingThread; UInt32 fPollingMode; enum { kPollingMode_Suspended = 0, kPollingMode_NewMedia = 1, kPollingMode_MediaRemoval = 2 }; // ---- Methods for controlling the current state of device support ---- /*! @function InitializeDeviceSupport @abstract Called in super class's start() to initialize device support. @discussion Called in super class's start() to initialize device support. The underlying infrastructure for supporting a device must be implemented here. @result <code>true</code> if device could be successfully configured <code>false</code> if not. */ virtual bool InitializeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function StartDeviceSupport @abstract Called in super class's start() to start device support. @discussion Called in super class's start() to start device support. Support for starting devices and making them usable must be implemented here. */ virtual void StartDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function SuspendDeviceSupport @abstract Called to temporarily suspend device support. @discussion Called to temporarily suspend device support. Support for suspending devices must be implemented here. */ virtual void SuspendDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function ResumeDeviceSupport @abstract Called to temporarily resume device support. @discussion Called to temporarily resume device support. Support for resuming devices must be implemented here. */ virtual void ResumeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function StopDeviceSupport @abstract Called to stop device support. @discussion Called to stop device support. Support for stopping devices must be implemented here. */ virtual void StopDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function TerminateDeviceSupport @abstract Called to terminate device support. @discussion Called to terminate device support. The underlying infrastructure for support a device should be cleaned up here. */ virtual void TerminateDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function free @abstract Called to release all resources held by the object. @discussion Release all resources held by the object, then call super::free(). */ virtual void free ( void ) APPLE_KEXT_OVERRIDE; /*! @function ClearNotReadyStatus @abstract Clears any NOT_READY status for the device. @discussion Polls device with TEST_UNIT_READY until the device returns <code>kSCSITaskStatus_GOOD</code> status. Exits if device has become disconnected. @result <code>true</code> if device is now active (isInactive == false) and <code>false</code> otherwise. */ virtual bool ClearNotReadyStatus ( void ) APPLE_KEXT_OVERRIDE; /*! @function CreateStorageServiceNub @abstract Creates a nub which links the IOSCSIReducedBlockCommandsDevice to the IOStorageFamily. @discussion Creates a nub which links the IOSCSIReducedBlockCommandsDevice to the IOStorageFamily. */ virtual void CreateStorageServiceNub ( void ); /*! @function DetermineDeviceCharacteristics @abstract Determine the characteristics of the device. @discussion Determine the characteristics, ANSI version, removability, etc., of the device via its INQUIRY data. @result <code>true</code> on success and <code>false</code> on failure. */ virtual bool DetermineDeviceCharacteristics ( void ); /*! @function GetMediumRotationRate @abstract Get the rotation rate of the device. @discussion Get the rotation rate of the device via its INQUIRY data. Sets the result as a property on the device's registry entry. */ void GetMediumRotationRate ( void ); /*! @function LogicalBlockProvisioningUnmapSupport @abstract Check if the device supports Logical Block Provisioning Unmap. @discussion Check if the device supports Logical Block Provisioning Unmap via its INQUIRY data. @return <code>true</code> if unmap is supported and <code>false</code> otherwise. */ bool LogicalBlockProvisioningUnmapSupport ( void ); /*! @function GetDeviceUnmapCharacteristics @abstract Get the unmap characteristics of the device. @discussion Get the unmap characteristics of the device. */ void GetDeviceUnmapCharacteristics ( ); // ---- Methods used for controlling the polling thread ---- /*! @function ProcessPoll @abstract Process a poll for media. @discussion Process a poll for media based on the current polling mode of the driver. */ virtual void ProcessPoll ( void ); /*! @function EnablePolling @abstract Enables media polling. @discussion Schedules a thread to poll the device for media at the prescribed interval. */ virtual void EnablePolling ( void ); /*! @function DisablePolling @abstract Disables media polling. @discussion Cancels ( if running ) the media polling thread. */ virtual void DisablePolling ( void ); // Main and support methods for polling for new Media /*! @function PollForNewMedia @abstract Polls for new media insertion. @discussion Polls for new media insertion. If new media is inserted, it is initialized and clients are notified via the <code>kIOMessageMediaStateHasChanged</code> message. */ virtual void PollForNewMedia ( void ); /*! @function DetermineMediaPresence @abstract Check if media has been inserted. @discussion Check if media has been inserted by sending TEST_UNIT_READY and checking the SENSE data. @return <code>true</code> if medium was found and <code>false</code> otherwise. */ virtual bool DetermineMediaPresence ( void ); /*! @function PreventMediumRemoval @abstract Prevent Medium Removal. @discussion Prevents medium removal by sending the PREVENT_ALLOW_MEDIUM_REMOVAL command with the PREVENT field set to "Medium removal shall be prohibited". @return <code>true</code> if medium was successfully locked and <code>false</code> otherwise. */ virtual bool PreventMediumRemoval ( void ); /*! @function DetermineMediumCapacity @abstract Determines capacity of the medium. @discussion Determines capacity of the medium via the READ_CAPACITY or READ_CAPACITY_16 commands. @param blockSize used to return the block size of the medium. @param blockCount used to return the block count of the medium. @return <code>true</code> if medium capacity was successfully queried and <code>false</code> otherwise. */ virtual bool DetermineMediumCapacity ( UInt64 * blockSize, UInt64 * blockCount ); /*! @function DetermineMediumWriteProtectState @abstract Determine medium write protect state of the medium. @discussion Determine medium write protect state of the medium via MODE_SENSE_10, MODE_SENSE_6, or manual READ_10 commands. @return <code>true</code> if medium is in write protect state and <code>false</code> otherwise. */ virtual bool DetermineMediumWriteProtectState ( void ); // Main and support methods for polling for Media removal /*! @function PollForMediaRemoval @abstract Check if media has been removed. @discussion Check if media has been removed by sending TEST_UNIT_READY and checking the SENSE data. If so, message clients and resets the driver's medium characteristics. */ virtual void PollForMediaRemoval ( void ); // ---- Methods used for handling medium characteristics ---- /*! @function SetMediumCharacteristics @abstract Sets the block size and block count for the current media. OBSOLETE - Use the version compatible with 64 bit LBAs instead. @discussion Sets the block size and block count for the current media. OBSOLETE - Use the version compatible with 64 bit LBAs instead. @param blockSize The media's block size in bytes. @param blockCount The count of the media's blocks. */ virtual void SetMediumCharacteristics ( UInt32 blockSize, UInt32 blockCount ); /*! @function SetMediumCharacteristics @abstract Sets the block size and block count for the current media. @discussion Sets the block size and block count for the current media. @param blockSize The media's block size in bytes. @param blockCount The count of the media's blocks. */ void SetMediumCharacteristics ( UInt64 blockSize, UInt64 blockCount ); /*! @function ResetMediumCharacteristics @abstract Resets the block size and block count. @discussion Resets the block size and block count. */ virtual void ResetMediumCharacteristics ( void ); /*! @function IssueRead @abstract DEPRECATED. Please do not use this method. @discussion DEPRECATED. Please do not use this method. @param buffer DEPRECATED. Please do not use this method. @param startBlock DEPRECATED. Please do not use this method. @param blockCount DEPRECATED. Please do not use this method. @result DEPRECATED. Please do not use this method. */ virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount ); /*! @function IssueRead @abstract Issues an asynchronous read command. @discussion Issues an asynchronous read command. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied to. @param startBlock Starting logical block address for the read operation. @param blockCount The number of blocks to be read. @param clientData A valid pointer to the client data to be used for callback completion. @result A valid IOReturn value. */ virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, void * clientData ); /*! @function IssueWrite @abstract DEPRECATED. Please do not use this method. @discussion DEPRECATED. Please do not use this method. @param buffer DEPRECATED. Please do not use this method. @param startBlock DEPRECATED. Please do not use this method. @param blockCount DEPRECATED. Please do not use this method. @result DEPRECATED. Please do not use this method. */ virtual IOReturn IssueWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount ); /*! @function IssueWrite @abstract Issues an asynchronous write command. @discussion Issues an asynchronous write command. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied from. @param startBlock Starting logical block address for the write operation. @param blockCount The number of blocks to be written. @param clientData A valid pointer to the client data to be used for callback completion. @result A valid IOReturn value. */ virtual IOReturn IssueWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, void * clientData ); /*! @function IssueUnmap @abstract Issue a synchronous unmap command. @discussion Issue a synchronous unmap command. @param extentsList a list of extents to unmap. @param blockDescriptorCount the count of extents in extentsList. @return A valid IOReturn value. */ IOReturn IssueUnmap ( IOBlockStorageDeviceExtent * extentsList, UInt32 blockDescriptorCount ); // ----- Power Management Support ------ /*! @function InitializePowerManagement @abstract Called to initialize power management. @discussion Called by InitializeDeviceSupport() to initialize power management by, joining the power management tree, registering power states, and setting the lowest idle power state. @param provider A valid pointer to this object's provider. */ virtual void InitializePowerManagement ( IOService * provider ) APPLE_KEXT_OVERRIDE; /*! @function GetInitialPowerState @abstract Called by power management to determine initial power state. @discussion We override this method so that when we register for power management, we go to our active power state (which the drive is definitely in at startup time). @result Returns the initial power state desired when power management is initialized. */ virtual UInt32 GetInitialPowerState ( void ) APPLE_KEXT_OVERRIDE; /*! @function GetNumberOfPowerStateTransitions @abstract Called by power management to determine this class's total number of power state transitions. @discussion We override this method in order to provide the number of transitions from Fully active to Sleep state so that the idle timer can be adjusted to the appropriate time period based on the disk spin down time set in the Energy Saver prefs panel. @result Returns the number of power state transitions for this class. */ virtual UInt32 GetNumberOfPowerStateTransitions ( void ) APPLE_KEXT_OVERRIDE; /*! @function TicklePowerManager @abstract The TicklePowerManager method is called to tell the power manager that the device needs to be in a certain power state to handle requests. @discussion The TicklePowerManager() is called by CheckPowerState() and sends an activity tickle ( via activityTickle() ) to the power manager so that the idle timer is reset. Subclasses must override this method. Third party subclasses shouldn't need to override this method but can to alter the default behavior. */ virtual void TicklePowerManager ( void ) APPLE_KEXT_OVERRIDE; /*! @function HandlePowerChange @abstract Handles the state machine for power management state changes. @discussion The HandlePowerChange method is the state machine for power management. It is guaranteed to be on its own thread of execution (different from the power manager thread AND the workloop thread. This routine can send sync or async calls to the drive without worrying about threading issues. */ virtual void HandlePowerChange ( void ) APPLE_KEXT_OVERRIDE; /*! @function HandleCheckPowerState(void) @abstract The HandleCheckPowerState (void) method is on the serialized side of the command gate and can change member variables safely without multi-threading issues. It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state the class registered with. @discussion The HandleCheckPowerState (void) method is on the serialized side of the command gate and can change member variables safely without multi-threading issues. It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state the class registered with. Subclasses must override this method. Third party subclasses shouldn't need to override this method but can to alter the default behavior. The default behavior is to block until the object transitions to its maximum power state. */ virtual void HandleCheckPowerState ( void ) APPLE_KEXT_OVERRIDE; /*! @function VerifyMediumPresence @abstract Called to ascertain the current presence of media. @discussion The VerifyMediumPresence method is called to see if the medium which we anticipated being there is still there. @result <code>true</code> if media is present and <code>false</code> if media is not present. */ virtual bool VerifyMediumPresence ( void ); /*! @function CheckMediumCapacityData @abstract Called to ascertain if the medium has changed capacity data. If so, it messages the upper layers. @discussion The CheckMediumCapacityData is called to see if the medium has indeed changed capacity data. If it has, it messages the upper layers. */ void CheckMediumCapacityData ( void ); public: /*! @function sProcessPoll @abstract Static method called to poll for media. @discussion Static method called to poll for media. Called from polling thread. Will reschedule itself via EnablePolling if polling is not suspended. @param pdtDriver a pointer to a valid IOSCSIBlockCommandsDevice ( or subclass ) which is to be polled. @param refCon a pointer to an additional object which can be determined by the implementer. */ static void sProcessPoll ( void * pdtDriver, void * refCon ); // ---- Methods for controlling the device ---- /*! @function SyncReadWrite @abstract DEPRECATED. Please do not use this method. @discussion DEPRECATED. Please do not use this method. @param buffer DEPRECATED. Please do not use this method. @param startBlock DEPRECATED. Please do not use this method. @param blockCount DEPRECATED. Please do not use this method. @param blockSize DEPRECATED. Please do not use this method. @result DEPRECATED. Please do not use this method. */ virtual IOReturn SyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, UInt64 blockSize ); /*! @function AsyncReadWrite @abstract Translates an asynchronous I/O request into a read or a write. @discussion Translates an asynchronous I/O request into a read or a write. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied to or from. @param startBlock Starting logical block address for the write operation. @param blockCount The number of blocks to read or write. @param blockSize used to specify the block size to be used for the read or write. @param clientData A valid pointer to the client data to be used for callback completion. @result A valid IOReturn value. */ virtual IOReturn AsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, UInt64 blockSize, void * clientData ); /*! @function GetWriteCacheState @abstract Get the write cache state. @discussion Get the write cache state. @param enabled used to return the current write cache state. @return A valid IOReturn value. */ IOReturn GetWriteCacheState ( bool * enabled ); /*! @function SetWriteCacheState @abstract Sets the write cache state. @discussion Sets the write cache state. @param enabled the state of the write cache. @return A valid IOReturn value. */ IOReturn SetWriteCacheState ( bool enabled ); /*! @function DetermineMediumGeometry @abstract Determines geometry of the medium. @discussion Determines geometry of the medium via mode sense data and places the results in the Device Characteristics Dictionary */ void DetermineMediumGeometry ( void ); // ---- Methods for controlling medium state ---- /*! @function EjectTheMedium @abstract Called to eject the inserted media from the drive. @discussion Called by IOBlockStorageDevice subclasses to eject the inserted media from the drive. @result A valid IOReturn value. */ virtual IOReturn EjectTheMedium ( void ); /*! @function LockUnlockMedium @abstract Called to lock or unlock the inserted media. @discussion Called by IOBlockStorageDevice subclasses to lock or unlock the inserted media. @param doLock if true the media will be locked, if false the media will be unlocked. @result A valid IOReturn value. */ virtual IOReturn LockUnlockMedium ( bool doLock ); /*! @function SynchronizeCache @abstract Called to synchronize the devices cache and thereby force its contents to be written out to the media. @discussion Called by IOBlockStorageDevice subclasses to synchronize the devices cache and thereby force the cache's contents to be written out to the media. @result A valid IOReturn value. */ virtual IOReturn SynchronizeCache ( void ); // ---- Methods for controlling media format ---- /*! @function FormatMedium @abstract Called to perform a low level format of the inserted media. @discussion Called IOBlockStorageDevice subclasses to perform a low level of the inserted media. Default implementation simply returns kIOReturnUnsupported if not overridden. @param blockCount The number of blocks to be formatted. @param blockSize used to specify the block size to be used for the format. @result A valid IOReturn value. */ virtual IOReturn FormatMedium ( UInt64 blockCount, UInt64 blockSize ); /*! @function GetFormatCapacities @abstract Called to determine the formatted capacity of the inserted media. @discussion Called IOBlockStorageDevice subclasses to determine the formatted capacity of the inserted media. Presently unsupported by default implementation. Returns 0 unless overridden. @param capacities a pointer to a valid UInt64 array. @param capacitiesMaxCount the number of elements addressable within capacities. @result The number of elements assigned in capacities ( count is 1 based ). */ virtual UInt32 GetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const; // ---- Query methods to report device characteristics ---- /*! @function ReportDeviceMaxBlocksReadTransfer @abstract Reports maximum read transfer blocks. @discussion Reports the maximum number of blocks that the device can handle per read. A value of 0 (zero) indicates there is no limit aside from the size of the method's return parameter. @return the maximum read transfer blocks. */ virtual UInt64 ReportDeviceMaxBlocksReadTransfer ( void ); /*! @function ReportDeviceMaxBlocksWriteTransfer @abstract Reports maximum write transfer blocks. @discussion Reports the maximum number of blocks that the device can handle per write. A value of 0 (zero) indicates there is no limit aside from the size of the method's return parameter. @return the maximum write transfer blocks. */ virtual UInt64 ReportDeviceMaxBlocksWriteTransfer ( void ); /*! @function ReportDeviceMediaRemovability @abstract Reports whether the device supports removal of the media. @discussion Reports whether the device supports removal of the media. @return <code>true</code> if media is removable and <code>false</code> otherwise. */ virtual bool ReportDeviceMediaRemovability ( void ); // ---- Query methods to report installed medium characteristics ---- /*! @function ReportMediumBlockSize @abstract Reports the logical block size of the medium. @discussion Reports the logical block size of the medium. @return the logical block size. */ virtual UInt64 ReportMediumBlockSize ( void ); /*! @function ReportMediumTotalBlockCount @abstract Reports the total logical block count of the medium. @discussion Reports the total logical block count of the medium. @return the total logical block count. */ virtual UInt64 ReportMediumTotalBlockCount ( void ); /*! @function ReportMediumWriteProtection @abstract Reports whether or not the medium is write protected. @discussion Reports whether or not the media is write protected. @return <code>true</code> if media is write protected and <code>false</code> otherwise. */ virtual bool ReportMediumWriteProtection ( void ); // ---- Query method to report the device provision initialization pattern ---- /*! @function ReportProvisioningInitializationPattern @abstract Reports the device provision initialization pattern. @discussion Reports the device provision initialization pattern. @param buffer the buffer into which the results will be copied. @result A valid IOReturn value. */ IOReturn ReportProvisioningInitializationPattern ( IOMemoryDescriptor * buffer ); /*! @function message @abstract Receives messages delivered from an attached provider. @discussion Handles the <code>kIOMessageMediaParametersHaveChanged</code> message by CheckMediumCapacityData on a separate thread. @param type A type defined in <code>IOMessage.h</code>. @param nub The provider from which the message originates. @param arg An argument defined by the message type. @result An IOReturn code defined by the message type. */ virtual IOReturn message ( UInt32 type, IOService * nub, void * arg ) APPLE_KEXT_OVERRIDE; // ---- Called prior to restarting or shutting down ---- /*! @function systemWillShutdown @abstract Handles system shutdown and restart notifications. @discussion Overrides <code>IOService::systemWillShutdown</code> in order to execute any special handling as specified in the device characteristics dictionary. As a result, drivers can expect their <code>disable</code> method to be called before system shutdown or restart. This implementation is synchronous and can block before calling <code>IOService::systemWillShutdown</code> and return. @param specifier <code>kIOMessageSystemWillPowerOff</code> or <code>kIOMessageSystemWillRestart</code>. @see //apple_ref/cpp/instm/IOService/systemWillShutdown/void/(IOOptionBits) IOService::systemWillShutdown */ virtual void systemWillShutdown ( IOOptionBits specifier ) APPLE_KEXT_OVERRIDE; // ---- Unmap related methods ---- // Check to see if we can coalesce the current and the next extent /*! @function UnmapTryExtentCoalesce @abstract Helper function to check and coalesce two extents. @discussion Helper function to check and coalesce two extents. In order to be successfully merged, the extents must be sequential. @param mergedExtent a pointer where the new merged extent will be placed. @param currentExtent the first extent to merge. @param nextExtent the second extent to merge. @return <code>true</code> if the extents were merged and <code>false</code> otherwise. */ bool UnmapTryExtentCoalesce ( IOBlockStorageDeviceExtent * mergedExtent, IOBlockStorageDeviceExtent * currentExtent, IOBlockStorageDeviceExtent * nextExtent ); /*! @function UnmapTruncateAndAccumulate @abstract Helper function to truncate an extent if required. @discussion Adds an extent to the end of the extent unmap dispatch list. If there are not enough unmap LBAs to fit the whole extent, it is split and the remaining, truncated extent is returned. @param extentDispatchList the extent dispatch list to add the extent. @param blockDescriptorCount the current count of block descriptors in the dispatch list. @param unmapLBACount the current count of queued LBAs for the next unmap operation. @param mergedExtent a pointer to the extent to be added. The truncated extent is returned using this pointer as well. @return <code>true</code> if adding the extent used all remaining unmap LBAs and <code>false</code> otherwise. */ bool UnmapTruncateAndAccumulate ( IOBlockStorageDeviceExtent * extentDispatchList, UInt32 blockDescriptorCount, UInt32 * unmapLBACount, IOBlockStorageDeviceExtent * mergedExtent ); // Use the write same command to do unmaps on the given extents. /*! @function WriteSameUnmap @abstract Uses the write same command to unmap the given extents. @discussion Uses the write same command to unmap the given extents. @param extents the array of extents to unmap. @param extentsCount the count of extents in the provided array. @param requestBlockSize used to specify the block size to be used for the write. @return A valid IOReturn value. */ IOReturn WriteSameUnmap ( IOBlockStorageDeviceExtent * extents, UInt32 extentsCount, UInt32 requestBlockSize ); /*! @function UpdateLBAProvisionStatus @abstract Get the block provision status. @discussion Update the extents with the provision status that we got from the device. @param extentsCount the count of extents in <code>extents</code>. @param extents a list of extents to unmap. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the received status data is to be stored. @param transferLength used to specify the maximum requested amount of status data. @return A valid IOReturn value. */ IOReturn UpdateLBAProvisionStatus ( UInt32 * extentsCount, IOBlockStorageProvisionDeviceExtent * extents, IOMemoryDescriptor * dataBuffer, UInt32 transferLength ); /*! @function IsUnmapAllowed @abstract Return whether unmap is allowed. @discussion Return whether unmap is allowed. @return <code>true</code> if unmap is allowed and <code>false</code> otherwise. */ bool IsUnmapAllowed ( ); /*! @function IsUseWriteSame @abstract Return whether WRITE_SAME should be used for UNMAP commands. @discussion Return whether WRITE_SAME should be used for UNMAP commands. @return <code>true</code> if the device supports unmap operations with write same command and <code>false</code> otherwise. */ bool IsUseWriteSame ( ); protected: /*! @function GET_LBA_STATUS @abstract Builds a GET_LBA_STATUS command. @discussion Builds a GET_LBA_STATUS command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the received status data is to be stored. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the get status is to be initiated. @param ALLOCATION_LENGTH used to specify the maximum requested amount of status data. @param CONTROL the CONTROL byte to use for the command. @result <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool GET_LBA_STATUS ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); /*! @function READ_10 @abstract Builds a READ (10) command. @discussion Builds a READ (10) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the read data is to be stored. @param blockSize used to specify the block size to be used for the read. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param RELADR the value of the relative address bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @param CONTROL the CONTROL byte to use for the command. @result <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ virtual bool READ_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); // Defined in SBC-2 section 5.10 /*! @function READ_10 @abstract Builds a READ (10) command. @discussion Builds a READ (10) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the read data is to be stored. @param blockSize used to specify the block size to be used for the read. @param RDPROTECT the value of the read protect field to set in the command. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param FUA_NV the value of the force unit access bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read is to be initiated. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param TRANSFER_LENGTH the desired transfer length in blocks. @param CONTROL the CONTROL byte to use for the command. @result <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool READ_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField3Bit RDPROTECT, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit FUA_NV, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField2Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); /*! @function READ_12 @abstract Builds a READ (12) command. @discussion Builds a READ (12) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the read data is to be stored. @param blockSize used to specify the block size to be used for the read. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param RELADR the value of the relative address bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ virtual bool READ_12 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); // Defined in SBC-2 section 5.11 /*! @function READ_12 @abstract Builds a READ (12) command. @discussion Builds a READ (12) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the read data is to be stored. @param blockSize used to specify the block size to be used for the read. @param RDPROTECT the value of the read protect field to set in the command. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param FUA_NV the value of the force unit access bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool READ_12 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField3Bit RDPROTECT, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit FUA_NV, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte TRANSFER_LENGTH, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField1Byte CONTROL ); /*! @function READ_16 @abstract Builds a READ (16) command. @discussion Builds a READ (16) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the read data is to be stored. @param blockSize used to specify the block size to be used for the read. @param RDPROTECT the value of the read protect field to set in the command. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param FUA_NV the value of the force unit access bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool READ_16 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField3Bit RDPROTECT, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit FUA_NV, SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte TRANSFER_LENGTH, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField1Byte CONTROL ); /*! @function READ_CAPACITY @abstract Builds a READ CAPACITY command. @discussion Builds a READ CAPACITY command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the read capacity data is to be stored. @param RELADR the value of the relative address bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read capacity is to be initiated. @param PMI the value of the partial medium indicator bit to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ virtual bool READ_CAPACITY ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField1Bit PMI, SCSICmdField1Byte CONTROL ); /*! @function READ_CAPACITY_16 @abstract Builds a READ CAPACITY (16) command. @discussion Builds a READ CAPACITY (16) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the read capacity data is to be stored. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read capacity is to be initiated. @param ALLOCATION_LENGTH used to specify the maximum requested amount of read data. @param PMI the value of the partial medium indicator bit to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool READ_CAPACITY_16 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte ALLOCATION_LENGTH, SCSICmdField1Bit PMI, SCSICmdField1Byte CONTROL ); /*! @function REPORT_PROVISIONING_INITIALIZATION_PATTERN @abstract Builds a REPORT_PROVISIONING_INITIALIZATION_PATTERN command. @discussion Builds a REPORT_PROVISIONING_INITIALIZATION_PATTERN command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the provisioning initialization pattern data is to be stored. @param ALLOCATION_LENGTH used to specify the maximum requested amount of provisioning data. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool REPORT_PROVISIONING_INITIALIZATION_PATTERN ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); /*! @function START_STOP_UNIT @abstract Builds a START STOP UNIT command. @discussion Builds a START STOP UNIT command. @param request a SCSITaskIdentifier in which the built command will be stored. @param IMMED the value of the immediate bit to set in the command. @param POWER_CONDITIONS used to specify the desired POWER CONDITIONS code. @param LOEJ used to specify whether or not the LOAD/EJECT ( LEOJ ) bit for the command needs to be set. @param START the value of the START bit to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ virtual bool START_STOP_UNIT ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField4Bit POWER_CONDITIONS, SCSICmdField1Bit LOEJ, SCSICmdField1Bit START, SCSICmdField1Byte CONTROL ); /*! @function SYNCHRONIZE_CACHE @abstract Builds a SYNCHRONIZE CACHE command. @discussion Builds a SYNCHRONIZE CACHE command. @param request a SCSITaskIdentifier in which the built command will be stored. @param IMMED the value of the immediate bit to set in the command. @param RELADR the value of the relative address bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the synchronize cache is to be initiated. @param NUMBER_OF_BLOCKS the number of blocks to synchronize. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ virtual bool SYNCHRONIZE_CACHE ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte NUMBER_OF_BLOCKS, SCSICmdField1Byte CONTROL ); // Defined in SBC-2 section 5.22 /*! @function SYNCHRONIZE_CACHE @abstract Builds a SYNCHRONIZE CACHE command. @discussion Builds a SYNCHRONIZE CACHE command. @param request a SCSITaskIdentifier in which the built command will be stored. @param IMMED the value of the immediate bit to set in the command. @param SYNC_NV used to specify whether or not the synchronize non-volatile bit for the command needs to be set. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the synchronize cache is to be initiated. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param NUMBER_OF_BLOCKS the number of blocks to synchronize. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool SYNCHRONIZE_CACHE ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField1Bit SYNC_NV, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField2Byte NUMBER_OF_BLOCKS, SCSICmdField1Byte CONTROL ); /*! @function SYNCRONIZE_CACHE_16 @abstract Builds a SYNCHRONIZE CACHE (16) command. @discussion Builds a SYNCHRONIZE CACHE (16) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param SYNC_NV used to specify whether or not the synchronize non-volatile bit for the command needs to be set. @param IMMED the value of the immediate bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the synchronize cache is to be initiated. @param NUMBER_OF_BLOCKS the number of blocks to synchronize. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool SYNCRONIZE_CACHE_16 ( SCSITaskIdentifier request, SCSICmdField1Bit SYNC_NV, SCSICmdField1Bit IMMED, SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte NUMBER_OF_BLOCKS, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField1Byte CONTROL ); /*! @function UNMAP @abstract Builds a UNMAP command. @discussion Builds a UNMAP command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the parameter list data is supplied. @param ANCHOR the value of the anchor bit to set in the command. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param PARAMETER_LIST_LENGTH the length of the supplied parameter list data buffer in bytes. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool UNMAP ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit ANCHOR, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); /*! @function WRITE_10 @abstract Builds a WRITE (10) command. @discussion Builds a WRITE (10) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param blockSize used to specify the block size to be used for the write. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param EBP the value of the erase by pass bit to set in the command. @param RELADR the value of the relative address bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the write is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ virtual bool WRITE_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit EBP, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); // Defined in SBC-2 section 5.29 /*! @function WRITE_10 @abstract Builds a WRITE (10) command. @discussion Builds a WRITE (10) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param blockSize used to specify the block size to be used for the write. @param WRPROTECT the value of the write protect field to set in the command. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param FUA_NV the value of the force unit access bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the write is to be initiated. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param TRANSFER_LENGTH the desired transfer length in blocks. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool WRITE_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField3Bit WRPROTECT, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit FUA_NV, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField2Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); /*! @function WRITE_12 @abstract Builds a WRITE (12) command. @discussion Builds a WRITE (12) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param blockSize used to specify the block size to be used for the write. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param EBP the value of the erase by pass bit to set in the command. @param RELADR the value of the relative address bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the write is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ virtual bool WRITE_12 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit EBP, SCSICmdField1Bit RELADR, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); // Defined in SBC-2 section 5.30 /*! @function WRITE_12 @abstract Builds a WRITE (12) command. @discussion Builds a WRITE (12) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param blockSize used to specify the block size to be used for the write. @param WRPROTECT the value of the write protect field to set in the command. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param FUA_NV the value of the force unit access bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the write is to be initiated. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param TRANSFER_LENGTH the desired transfer length in blocks. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool WRITE_12 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField3Bit WRPROTECT, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit FUA_NV, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField4Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); /*! @function WRITE_16 @abstract Builds a WRITE (16) command. @discussion Builds a WRITE (16) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param blockSize used to specify the block size to be used for the write. @param WRPROTECT the value of the write protect field to set in the command. @param DPO the value of the disable page out bit to set in the command. @param FUA the value of the force unit access bit to set in the command. @param FUA_NV the value of the force unit access bit to set in the command. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the write is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool WRITE_16 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField3Bit WRPROTECT, SCSICmdField1Bit DPO, SCSICmdField1Bit FUA, SCSICmdField1Bit FUA_NV, SCSICmdField8Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField4Byte TRANSFER_LENGTH, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField1Byte CONTROL ); /*! @function WRITE_SAME_10 @abstract Builds a WRITE SAME (10) command. @discussion Builds a WRITE SAME (10) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param buffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param requestBlockSize used to specify the block size to be used for the write. @param WRPROTECT the value of the write protect field to set in the command. @param ANCHOR the value of the anchor bit to set in the command. @param UNMAP the value of the unmap bit to set in the command. @param startBlock Starting logical block address for the write or unmap operation. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param blockCount The number of blocks to write or unmap. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool WRITE_SAME_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * buffer, UInt32 requestBlockSize, SCSICmdField3Bit WRPROTECT, SCSICmdField1Bit ANCHOR, SCSICmdField1Bit UNMAP, SCSICmdField4Byte startBlock, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField2Byte blockCount, SCSICmdField1Byte CONTROL ); /*! @function WRITE_SAME_16 @abstract Builds a WRITE SAME (16) command. @discussion Builds a WRITE SAME (16) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param buffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param requestBlockSize used to specify the block size to be used for the write. @param WRPROTECT the value of the write protect field to set in the command. @param ANCHOR the value of the anchor bit to set in the command. @param UNMAP the value of the unmap bit to set in the command. @param NDOB used to specify whether or not the no data-out buffer bit for the command needs to be set. @param startBlock Starting logical block address for the write or unmap operation. @param blockCount The number of blocks to write or unmap. @param GROUP_NUMBER the value of the grouping function group number to set in the command. @param CONTROL the CONTROL byte to use for the command. @return <code>true</code> if the command was successfully built and <code>false</code> otherwise. */ bool WRITE_SAME_16 ( SCSITaskIdentifier request, IOMemoryDescriptor * buffer, UInt32 requestBlockSize, SCSICmdField3Bit WRPROTECT, SCSICmdField1Bit ANCHOR, SCSICmdField1Bit UNMAP, SCSICmdField1Bit NDOB, SCSICmdField8Byte startBlock, SCSICmdField4Byte blockCount, SCSICmdField6Bit GROUP_NUMBER, SCSICmdField1Byte CONTROL ); /* Added with 10.2 */ OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 1 ); public: /*! @function PowerDownHandler @abstract Method called at sleep, restart, or shutdown time. @discussion Notification handler registered with registerPrioritySleepWakeInterest(). @param refCon a pointer to an object which can be determined by the implementer when registerPrioritySleepWakeInterest() is called. @param messageType a constant defined in IOMessage.h ( kIOMessageSystemWillPowerOff, kIOMessageSystemWillRestart, etc. ). @param provider a pointer to the provider of the notification. @param messageArgument a pointer to the notification's argument. @param argSize the size of the argument. @result A valid IOReturn value. */ virtual IOReturn PowerDownHandler ( void * refCon, UInt32 messageType, IOService * provider, void * messageArgument, vm_size_t argSize ); /* Added with 10.2 */ OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 2 ); protected: /*! @function SetMediumIcon @abstract Sets graphical icon for device's medium objects. @discussion Provides an opportunity for the driver to select a more fitting icon then default icon. */ virtual void SetMediumIcon ( void ); /* Added with 10.3.3 */ OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 3 ); protected: /*! @function AsyncReadWriteCompletion @abstract Completion routine for asynchronous read and write requests. @discussion Completion routine for asynchronous read and write requests. @param completedTask the task from which to extract the client data to inspect. */ virtual void AsyncReadWriteCompletion ( SCSITaskIdentifier completedTask ); /* Added with 10.6.0 */ OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 4 ); public: /*! @function AsyncReadWrite @abstract Translates an asynchronous I/O request into a read or a write. @discussion Translates an asynchronous I/O request into a read or a write. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied to or from. @param startBlock Starting logical block address for the write operation. @param blockCount The number of block to be write. @param blockSize used to specify the block size to be used for the read or write. @param attributes used to set the attributes of the read or write. Currently only used to set kIOStorageOptionForceUnitAccess. @param clientData A valid pointer to the client data to be used for callback completion. @result A valid IOReturn value. */ virtual IOReturn AsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, UInt64 blockSize, IOStorageAttributes * attributes, void * clientData ); OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 5 ); /*! @function Unmap @abstract Unmap the given extents. @discussion Unmap the given extents. @param extents a list of extents to unmap. @param ExtentsCount the count of extents in <code>extents</code>. @result A valid IOReturn value. */ virtual IOReturn Unmap ( IOBlockStorageDeviceExtent * extents, UInt32 ExtentsCount ); OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 6 ); /*! @function WriteSame @abstract Write or unmap the given extent. @discussion Write or unmap the given extent. @param buffer a pointer to a valid IOMemoryDescriptor in which the data to be written is stored. @param startBlock Starting logical block address for the write or unmap operation. @param blockCount The number of blocks to write or unmap. @param writeSameOptions the command options to pass to WRITE_SAME. @param requestBlockSize used to specify the block size to be used for the write. @result A valid IOReturn value. */ virtual IOReturn WriteSame ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, UInt8 writeSameOptions, UInt32 requestBlockSize ); OSMetaClassDeclareReservedUsed ( IOSCSIBlockCommandsDevice, 7 ); /*! @function GetProvisionStatus @abstract Get the block provision status. @discussion Get the block provision status. @param block Starting logical block address for the status operation. @param nblks The number of blocks. @param extentsCount the count of extents in <code>extents</code>. @param extents a list of extents to unmap. @result A valid IOReturn value. */ virtual IOReturn GetProvisionStatus ( UInt64 block, UInt64 nblks, UInt32 * extentsCount, IOBlockStorageProvisionDeviceExtent * extents ); private: #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 8 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIBlockCommandsDevice, 16 ); #endif /* !TARGET_OS_IPHONE */ }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_BLOCK_COMMANDS_DEVICE_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSICmds_REPORT_LUNS_Definitions.h
/* * Copyright (c) 2004-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_CMDS_REPORT_LUNS_DEFINITIONS_H_ #define _IOKIT_SCSI_CMDS_REPORT_LUNS_DEFINITIONS_H_ #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif /*! @header SCSI Request Sense Definitions @discussion This file contains all definitions for the data returned from the REPORT_LUNS (0xA0) command. */ /*! @struct SCSICmd_REPORT_LUNS_LUN_ENTRY @discussion This structure represents a single LUN entry in a LUN list returned via the REPORT_LUNS command. */ typedef struct SCSICmd_REPORT_LUNS_LUN_ENTRY { UInt16 FIRST_LEVEL_ADDRESSING; UInt16 SECOND_LEVEL_ADDRESSING; UInt16 THIRD_LEVEL_ADDRESSING; UInt16 FOURTH_LEVEL_ADDRESSING; } SCSICmd_REPORT_LUNS_LUN_ENTRY; /*! @constant kREPORT_LUNS_HeaderSize @discussion Size of the REPORT_LUNS header as defined in the SPC-3 specification. */ #define kREPORT_LUNS_HeaderSize 8 /*! @enum REPORT_LUNS addressing methods. @discussion REPORT_LUNS addressing methods described in SAM-2 documents. @constant kREPORT_LUNS_ADDRESS_METHOD_PERIPHERAL_DEVICE Peripheral Device Addressing Method. @constant kREPORT_LUNS_ADDRESS_DEVICE_TYPE_SPECIFIC Device Type Specific Addressing Method. @constant kREPORT_LUNS_ADDRESS_METHOD_LOGICAL_UNIT Logical Unit Specific Addressing Method. @constant kREPORT_LUNS_ADDRESS_METHOD_OFFSET Offset to the address method data. */ enum { kREPORT_LUNS_ADDRESS_METHOD_PERIPHERAL_DEVICE = 0, kREPORT_LUNS_ADDRESS_METHOD_FLAT_SPACE = 1, kREPORT_LUNS_ADDRESS_DEVICE_TYPE_SPECIFIC = kREPORT_LUNS_ADDRESS_METHOD_FLAT_SPACE, kREPORT_LUNS_ADDRESS_METHOD_LOGICAL_UNIT = 2, // Reserved [3] kREPORT_LUNS_ADDRESS_METHOD_OFFSET = 14 }; /*! @struct REPORT_LUNS_LOGICAL_UNIT_ADDRESSING @discussion This structure represents a LUN Addressing scheme. */ typedef struct REPORT_LUNS_LOGICAL_UNIT_ADDRESSING { #ifdef __LITTLE_ENDIAN__ UInt16 LUN : 5; UInt16 BUS_NUMBER : 3; UInt16 TARGET : 6; UInt16 reserved2 : 1; UInt16 reserved : 1; #else /* !__LITTLE_ENDIAN__ */ UInt16 reserved : 1; UInt16 reserved2 : 1; UInt16 TARGET : 6; UInt16 BUS_NUMBER : 3; UInt16 LUN : 5; #endif /* !__LITTLE_ENDIAN__ */ } REPORT_LUNS_LOGICAL_UNIT_ADDRESSING; /*! @struct REPORT_LUNS_PERIPHERAL_DEVICE_ADDRESSING @discussion This structure represents a Peripheral Device Addressing scheme. */ typedef struct REPORT_LUNS_PERIPHERAL_DEVICE_ADDRESSING { #ifdef __LITTLE_ENDIAN__ UInt16 TARGET_LUN : 8; UInt16 BUS_IDENTIFIER : 6; UInt16 reserved2 : 1; UInt16 reserved : 1; #else /* !__LITTLE_ENDIAN__ */ UInt16 reserved : 1; UInt16 reserved2 : 1; UInt16 BUS_IDENTIFIER : 6; UInt16 TARGET_LUN : 8; #endif /* !__LITTLE_ENDIAN__ */ } REPORT_LUNS_PERIPHERAL_DEVICE_ADDRESSING; /*! @struct SCSICmd_REPORT_LUNS_Header @discussion This structure defines the format of the data that is returned for the REPORT_LUNS command. */ typedef struct SCSICmd_REPORT_LUNS_Header { UInt32 LUN_LIST_LENGTH; // LUN list length in bytes. UInt32 RESERVED; SCSICmd_REPORT_LUNS_LUN_ENTRY LUN[1]; // Variable length list. Must have at least LUN 0 if } SCSICmd_REPORT_LUNS_Header; // Target supports REPORT_LUNS command. #endif /* _IOKIT_SCSI_CMDS_REPORT_LUNS_DEFINITIONS_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSITask.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_TASK_H_ #define _IOKIT_SCSI_TASK_H_ #include <TargetConditionals.h> #if TARGET_OS_DRIVERKIT typedef uint8_t UInt8; typedef uint64_t UInt64; #else #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif #endif /*! @header SCSITask SCSITask typedefs and constants used inside the kernel and user space. Note that the SCSITaskIdentifier is an opaque object and that directly casting the SCSITaskIdentifier to any other type is discouraged. The SCSITask implementation changes when necessary to accomodate architectural changes, performance improvements, and bug fixes. Device and protocol layer drivers that need to access information contained in a SCSITask should use the appropriate accessor methods in IOSCSIPrimaryCommandsDevice.h or IOSCSIProtocolServices.h */ /*! @typedef SCSIDeviceIdentifier @abstract 64-bit number to represent a SCSI Device. @discussion If the identifier can either be that of an initiator or a target, SCSIDeviceIdentifier should be used. */ typedef UInt64 SCSIDeviceIdentifier; /*! @typedef SCSITargetIdentifier @abstract 64-bit number to represent a SCSI Target Device. @discussion If the identifier is for a target only and not an initiator, then SCSITargetIdentifier should be used. */ typedef SCSIDeviceIdentifier SCSITargetIdentifier; /*! @typedef SCSIInitiatorIdentifier @abstract 64-bit number to represent a SCSI Initiator Device. @discussion If the identifier is for an initiator only and not a target, then SCSIInitiatorIdentifier should be used. */ typedef SCSIDeviceIdentifier SCSIInitiatorIdentifier; /*! @typedef SCSILogicalUnitBytes[8] @abstract 8-Byte array to represent LUN information @discussion The SCSI Primary Commands specification treats the 64-bits of LUN information as 4 2-byte structures. Use of the 64-bit SCSILogicalUnitNumber is now deprecated. Since it was not defined on Mac OS X how the 64-bits were encoded for hierarchical units and all usage was simply as a 64-bit number, changing the encoding scheme now would result in non-binary compatible code. New APIs have been added to retrieve the LUN bytes from the SCSITask and set them in the SCSITask. */ typedef UInt8 SCSILogicalUnitBytes[8]; typedef UInt64 SCSILogicalUnitNumber; // DEPRECATED /*! @typedef SCSITaggedTaskIdentifier @abstract 64-bit number to represent a unique task identifier. @discussion The Tagged Task Identifier is used when a Task has a Task Attribute other than SIMPLE. The SCSI Application Layer client that controls the Logical Unit for which a Task is intended is required to guarantee that the Task Tag Identifier is unique. Zero cannot be used a a Tag value as this is used to when a Tagged Task Identifier value is needed for a Task with a SIMPLE attribute. */ typedef UInt64 SCSITaggedTaskIdentifier; /*! @enum Untagged Task Identifier @discussion The Untagged Task Identifier is used to indicate no unique tag is associated with the Task. @constant kSCSIUntaggedTaskIdentifier This value means the task is untagged. */ enum { kSCSIUntaggedTaskIdentifier = 0 }; /*! @typedef SCSITaskAttribute @abstract Attributes for task delivery. @discussion The Task Attribute defines how this task should be managed when determing order for queueing and submission to the appropriate device server. The Task Attribute is set by the SCSI Application Layer and cannot be modified by the SCSI Protocol Layer. @constant kSCSITask_SIMPLE The task has a simple attribute. @constant kSCSITask_ORDERED The task has an ordered attribute. @constant kSCSITask_HEAD_OF_QUEUE The task has a head-of-queue attribute. @constant kSCSITask_ACA The task has an auto-contingent-allegiance attribute. */ typedef enum SCSITaskAttribute { kSCSITask_SIMPLE = 0, kSCSITask_ORDERED = 1, kSCSITask_HEAD_OF_QUEUE = 2, kSCSITask_ACA = 3 } SCSITaskAttribute; /*! @typedef SCSITaskState @abstract Attributes for task state. @discussion The Task State represents the current state of the task. The state is set to NEW_TASK when the task is created. The SCSI Protocol Layer will then adjust the state as the task is queued and during execution. The SCSI Application Layer can examine the state to monitor the progress of a task. The Task State can only be modified by the SCSI Protocol Layer. The SCSI Application Layer can only read the state. @constant kSCSITaskState_NEW_TASK The task state is new task. @constant kSCSITaskState_ENABLED The task is enabled and queued. @constant kSCSITaskState_BLOCKED The task is blocked. @constant kSCSITaskState_DORMANT The task is dormant. @constant kSCSITaskState_ENDED The task is complete. */ typedef enum SCSITaskState { kSCSITaskState_NEW_TASK = 0, kSCSITaskState_ENABLED = 1, kSCSITaskState_BLOCKED = 2, kSCSITaskState_DORMANT = 3, kSCSITaskState_ENDED = 4 } SCSITaskState; /*! @typedef SCSIServiceResponse @abstract Attributes for task service response. @discussion The Service Response represents the execution status of a service request made to a Protocol Services Driver. The Service Response can only be modified by the SCSI Protocol Layer. The SCSI Application Layer can only read the state. */ typedef enum SCSIServiceResponse { /*! @constant kSCSIServiceResponse_Request_In_Process Not defined in SAM specification, but is a service response used for asynchronous commands that are not yet completed. */ kSCSIServiceResponse_Request_In_Process = 0, /*! @constant kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE The service request failed because of a delivery or target failure. */ kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE = 1, /*! @constant kSCSIServiceResponse_TASK_COMPLETE The task completed. */ kSCSIServiceResponse_TASK_COMPLETE = 2, /*! @constant kSCSIServiceResponse_LINK_COMMAND_COMPLETE The linked command completed. */ kSCSIServiceResponse_LINK_COMMAND_COMPLETE = 3, /*! @constant kSCSIServiceResponse_FUNCTION_COMPLETE The task management function completed. */ kSCSIServiceResponse_FUNCTION_COMPLETE = 4, /*! @constant kSCSIServiceResponse_FUNCTION_REJECTED The task management function was rejected. */ kSCSIServiceResponse_FUNCTION_REJECTED = 5 } SCSIServiceResponse; /*! @typedef SCSITaskStatus @abstract Attributes for task status. @discussion The Task Status represents the completion status of the task which provides the SCSI Application Layer with additional information about how to procede in handling a completed task. The SCSI Architecture Model specification only defines task status values for when a task completes with a service response of either TASK_COMPLETED or LINK_COMMAND_COMPLETE. Since additional information will aid in error recovery when a task fails to be completed by a device due to a service response of kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE, additional values have been defined that can be returned by the SCSI Protocol Layer to inform the SCSI Application Layer of the cause of the delivery failure. The Task Status can only be modified by the SCSI Protocol Layer. The SCSI Application Layer can only read the status */ typedef enum SCSITaskStatus { /*! @constant kSCSITaskStatus_GOOD The task completed with a status of GOOD. */ kSCSITaskStatus_GOOD = 0x00, /*! @constant kSCSITaskStatus_CHECK_CONDITION The task completed with a status of CHECK_CONDITION. Additional information about the condition should be available in the sense data. */ kSCSITaskStatus_CHECK_CONDITION = 0x02, /*! @constant kSCSITaskStatus_CONDITION_MET The task completed with a status of CONDITION_MET. */ kSCSITaskStatus_CONDITION_MET = 0x04, /*! @constant kSCSITaskStatus_BUSY The task completed with a status of BUSY. The device server might need time to process a request and a delay may be required. */ kSCSITaskStatus_BUSY = 0x08, /*! @constant kSCSITaskStatus_INTERMEDIATE The task completed with a status of INTERMEDIATE. */ kSCSITaskStatus_INTERMEDIATE = 0x10, /*! @constant kSCSITaskStatus_INTERMEDIATE_CONDITION_MET The task completed with a status of INTERMEDIATE_CONDITION_MET. */ kSCSITaskStatus_INTERMEDIATE_CONDITION_MET = 0x14, /*! @constant kSCSITaskStatus_RESERVATION_CONFLICT The task completed with a status of RESERVATION_CONFLICT. */ kSCSITaskStatus_RESERVATION_CONFLICT = 0x18, /*! @constant kSCSITaskStatus_TASK_SET_FULL The task completed with a status of TASK_SET_FULL. The device server may need to complete a task before the initiator sends another. */ kSCSITaskStatus_TASK_SET_FULL = 0x28, /*! @constant kSCSITaskStatus_ACA_ACTIVE The task completed with a status of ACA_ACTIVE. The device server may need the initiator to clear the Auto-Contingent Allegiance condition before it will respond to new commands. */ kSCSITaskStatus_ACA_ACTIVE = 0x30, /*! @constant kSCSITaskStatus_TaskTimeoutOccurred If a task is aborted by the SCSI Protocol Layer due to it exceeding the timeout value specified by the task, the task status shall be set to kSCSITaskStatus_TaskTimeoutOccurred. */ kSCSITaskStatus_TaskTimeoutOccurred = 0x01, /*! @constant kSCSITaskStatus_ProtocolTimeoutOccurred If a task is aborted by the SCSI Protocol Layer due to it exceeding a timeout value specified by the support for the protocol or a related specification, the task status shall be set to kSCSITaskStatus_ProtocolTimeoutOccurred. */ kSCSITaskStatus_ProtocolTimeoutOccurred = 0x02, /*! @constant kSCSITaskStatus_DeviceNotResponding If a task is unable to be delivered due to a failure of the device not accepting the task or the device acknowledging the attempt to send it the device the task status shall be set to kSCSITaskStatus_DeviceNotResponding. This will allow the SCSI Application driver to perform the necessary steps to try to recover the device. This shall only be reported after the SCSI Protocol Layer driver has attempted all protocol specific attempts to recover the device. */ kSCSITaskStatus_DeviceNotResponding = 0x03, /*! @constant kSCSITaskStatus_DeviceNotPresent If the task is unable to be delivered because the device has been detached, the task status shall be set to kSCSITaskStatus_DeviceNotPresent. This will allow the SCSI Application Layer to halt the sending of tasks to the device and, if supported, perform any device failover or system cleanup. */ kSCSITaskStatus_DeviceNotPresent = 0x04, /*! @constant kSCSITaskStatus_DeliveryFailure If the task is unable to be delivered to the device due to a failure in the SCSI Protocol Layer, such as a bus reset or communications error, but the device is is known to be functioning properly, the task status shall be set to kSCSITaskStatus_DeliveryFailure. This can also be reported if the task could not be delivered due to a protocol error that has since been corrected. */ kSCSITaskStatus_DeliveryFailure = 0x05, /*! @constant kSCSITaskStatus_No_Status This status is not defined by the SCSI specifications, but is here to provide a status that can be returned in cases where there is not status available from the device or protocol, for example, when the service response is neither TASK_COMPLETED nor LINK_COMMAND_COMPLETE or when the service response is SERVICE_DELIVERY_OR_TARGET_FAILURE and the reason for failure could not be determined. */ kSCSITaskStatus_No_Status = 0xFF } SCSITaskStatus; /*! @enum Command Descriptor Block Size @discussion Command Descriptor Block Size constants. */ enum { /*! @constant kSCSICDBSize_Maximum This is the largest size a Command Descriptor Block can be as specified in SPC-2. */ kSCSICDBSize_Maximum = 16, /*! @constant kSCSICDBSize_6Byte Use this for a 6-byte CDB. */ kSCSICDBSize_6Byte = 6, /*! @constant kSCSICDBSize_10Byte Use this for a 10-byte CDB. */ kSCSICDBSize_10Byte = 10, /*! @constant kSCSICDBSize_12Byte Use this for a 12-byte CDB. */ kSCSICDBSize_12Byte = 12, /*! @constant kSCSICDBSize_16Byte Use this for a 16-byte CDB. */ kSCSICDBSize_16Byte = 16 }; typedef UInt8 SCSICommandDescriptorBlock[kSCSICDBSize_Maximum]; /*! @enum Data Transfer Direction @discussion DataTransferDirection constants. */ enum { /*! @constant kSCSIDataTransfer_NoDataTransfer Use this for tasks that transfer no data. */ kSCSIDataTransfer_NoDataTransfer = 0x00, /*! @constant kSCSIDataTransfer_FromInitiatorToTarget Use this for tasks that transfer data from the initiator to the target. */ kSCSIDataTransfer_FromInitiatorToTarget = 0x01, /*! @constant kSCSIDataTransfer_FromTargetToInitiator Use this for tasks that transfer data from the target to the initiator. */ kSCSIDataTransfer_FromTargetToInitiator = 0x02 }; /* Libkern includes */ #if defined(KERNEL) && defined(__cplusplus) #if TARGET_OS_DRIVERKIT #include <DriverKit/OSObject.h> #else #include <libkern/c++/OSObject.h> #endif /*! @enum SCSITaskMode @discussion The SCSI Task mode is used by the SCSI Protocol Layer to indicate what mode the task is executing. */ typedef enum SCSITaskMode { kSCSITaskMode_CommandExecution = 1, kSCSITaskMode_Autosense = 2 } SCSITaskMode; /*! @typedef SCSITaskIdentifier @discussion This is an opaque object that represents a task. This is used so that drivers for both the SCSI Protocol Layer and the SCSI Application Layer cannot modify the SCSITask object directly but must instead use the inherited methods to do so. This allows the implementation of SCSITask to change without directly impacting device and protocol layer drivers. In addition, it prevents changing of properties that are not allowed to be changed by a given layer. */ typedef OSObject * SCSITaskIdentifier; /*! @typedef SCSITaskCompletion @discussion This is the typedef for completion routines that work with SCSITaskIdentifiers. */ typedef void ( *SCSITaskCompletion )( SCSITaskIdentifier completedTask ); #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_SCSI_TASK_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIPrimaryCommandsDevice.h
/* * Copyright (c) 1998-2015 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PRIMARY_COMMANDS_DEVICE_H_ #define _IOKIT_IO_SCSI_PRIMARY_COMMANDS_DEVICE_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // General IOKit headers #include <IOKit/IOLib.h> #include <IOKit/IOService.h> #include <IOKit/IOReturn.h> #include <IOKit/IOMemoryDescriptor.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/SCSICommandDefinitions.h> #include <IOKit/scsi/SCSICmds_INQUIRY_Definitions.h> #include <IOKit/scsi/SCSICmds_REQUEST_SENSE_Defs.h> #include <IOKit/scsi/IOSCSIProtocolInterface.h> // Build includes #include <TargetConditionals.h> //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- // Notification messages enum { kSCSIServicesNotification_Suspend = 0x69000080, kSCSIServicesNotification_Resume = 0x69000090 }; // Timeout values enum { kOneSecondTimeoutInMS = 1000, kTenSecondTimeoutInMS = 10 * kOneSecondTimeoutInMS, kTwentyFiveSecondTimeoutInMS = 25 * kOneSecondTimeoutInMS, kThirtySecondTimeoutInMS = 30 * kOneSecondTimeoutInMS, kFortyFiveSecondTimeoutInMS = 45 * kOneSecondTimeoutInMS }; // Mode page values for page control field enum { kModePageControlCurrentValues = 0x00, kModePageControlChangeableValues = 0x01, kModePageControlDefaultValues = 0x02, kModePageControlSavedValues = 0x03 }; // The command should be tried 5 times. The original attempt // plus 4 retries. #define kDefaultRetryCount 4 // Forward declarations for internal use only classes class SCSIPrimaryCommands; //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOSCSIPrimaryCommandsDevice : public IOSCSIProtocolInterface { OSDeclareAbstractStructors ( IOSCSIPrimaryCommandsDevice ) friend class SCSITaskUserClient; private: IOSCSIProtocolInterface * fProtocolDriver; // The fProtocolAccessEnabled member variable indicates whether // requests coming from the client can be sent to the device. // This will be set to true after the Protocol Service driver is successfully // opened and before the call to InitializeDeviceSupport and set to false before // TerminateDeviceSupport is called. bool fProtocolAccessEnabled; // The fDeviceAccessEnabled member variable indicates whether // requests coming from the client can be sent to the device. // This will be set to true after InitializeDeviceSupport is called and // set to false before StopDeviceSupport is called. bool fDeviceAccessEnabled; bool fDeviceAccessSuspended; static bool ServerKeyswitchCallback ( void * target, void * refCon, IOService * newService ); static void TaskCallback ( SCSITaskIdentifier completedTask ); void TaskCompletion ( SCSITaskIdentifier completedTask ); static IOReturn sWaitForTask ( void * object, SCSITaskIdentifier request ); IOReturn GatedWaitForTask ( SCSITaskIdentifier request ); protected: // Reserve space for future expansion. struct IOSCSIPrimaryCommandsDeviceExpansionData { IONotifier * fKeySwitchNotifier; UInt8 fANSIVersion; UInt32 fReadTimeoutDuration; UInt32 fWriteTimeoutDuration; bool fCMDQUE; SCSITaggedTaskIdentifier fTaskID; IOSimpleLock * fTaskIDLock; UInt32 fRetryCount; UInt32 fNumCommandsExecuting; int fMaxPollRetries; int fPollDebounceRetriesLeft; }; IOSCSIPrimaryCommandsDeviceExpansionData * fIOSCSIPrimaryCommandsDeviceReserved; #define fReadTimeoutDuration fIOSCSIPrimaryCommandsDeviceReserved->fReadTimeoutDuration #define fWriteTimeoutDuration fIOSCSIPrimaryCommandsDeviceReserved->fWriteTimeoutDuration #define fRetryCount fIOSCSIPrimaryCommandsDeviceReserved->fRetryCount #define fNumCommandsExecuting fIOSCSIPrimaryCommandsDeviceReserved->fNumCommandsExecuting #define fMaxPollRetries fIOSCSIPrimaryCommandsDeviceReserved->fMaxPollRetries #define fPollDebounceRetriesLeft fIOSCSIPrimaryCommandsDeviceReserved->fPollDebounceRetriesLeft UInt8 fDefaultInquiryCount; OSDictionary * fDeviceCharacteristicsDictionary; UInt32 fNumCommandsOutstanding; virtual void free ( void ) APPLE_KEXT_OVERRIDE; void SetANSIVersion ( UInt8 ); void SetCMDQUE ( bool value ); IOReturn GetModeSense ( IOMemoryDescriptor * dataBuffer, SCSICmdField6Bit PAGE_CODE, SCSICmdField2Byte ALLOCATION_LENGTH, bool * use10ByteModeSense ); bool RetrieveINQUIRYData ( UInt8 EVPD, UInt8 inquiryPage, UInt8 * inquiryBuffer, UInt16 * dataSize ); // This flag is set if the device responds to a MODE_SENSE_10 command // with the page code set to 0x1A (Power Conditions Mode Page) bool fDeviceSupportsPowerConditions; // This method is called by the start method to obtain information from // the device with regards to whether it supports the power conditions mode page. virtual void CheckPowerConditionsModePage ( void ); // This will return back the Protocol driver that is used to // send service requests to the device. virtual IOSCSIProtocolInterface * GetProtocolDriver ( void ); // This will get a new SCSITask for the caller virtual SCSITaskIdentifier GetSCSITask ( void ); // This will release a SCSITask (eventually return it to a pool) virtual void ReleaseSCSITask ( SCSITaskIdentifier request ); // This will return a unique value for the tagged task identifier SCSITaggedTaskIdentifier GetUniqueTagID ( void ); // Call for executing the command synchronously SCSIServiceResponse SendCommand ( SCSITaskIdentifier request, UInt32 timeoutDuration ); // Call for executing the command asycnchronously void SendCommand ( SCSITaskIdentifier request, UInt32 timeoutDuration, SCSITaskCompletion taskCompletion ); virtual bool InitializeDeviceSupport ( void ) = 0; virtual void StartDeviceSupport ( void ) = 0; virtual void SuspendDeviceSupport ( void ) = 0; virtual void ResumeDeviceSupport ( void ) = 0; virtual void StopDeviceSupport ( void ) = 0; virtual void TerminateDeviceSupport ( void ) = 0; virtual UInt32 GetNumberOfPowerStateTransitions ( void ) = 0; virtual IOReturn VerifyDeviceState ( void ); // Called to clear any power-on/reset status in the drive virtual bool ClearPowerOnReset ( void ); virtual bool ClearNotReadyStatus ( void ) = 0; bool IsProtocolAccessEnabled ( void ); bool IsDeviceAccessEnabled ( void ); bool IsDeviceAccessSuspended ( void ); // Accessors for saving and retrieving data from an SCSITask object. bool ResetForNewTask( SCSITaskIdentifier request ); bool SetTaskAttribute ( SCSITaskIdentifier request, SCSITaskAttribute newAttribute ); SCSITaskAttribute GetTaskAttribute ( SCSITaskIdentifier request ); bool SetTaggedTaskIdentifier ( SCSITaskIdentifier request, SCSITaggedTaskIdentifier taggedTaskIdentifier ); SCSITaggedTaskIdentifier GetTaggedTaskIdentifier ( SCSITaskIdentifier request ); bool SetTaskState ( SCSITaskIdentifier request, SCSITaskState newTaskState ); SCSITaskState GetTaskState ( SCSITaskIdentifier request ); bool SetTaskStatus ( SCSITaskIdentifier request, SCSITaskStatus newStatus ); SCSITaskStatus GetTaskStatus ( SCSITaskIdentifier request ); bool SetCommandDescriptorBlock ( SCSITaskIdentifier request, UInt8 cdbByte0, UInt8 cdbByte1, UInt8 cdbByte2, UInt8 cdbByte3, UInt8 cdbByte4, UInt8 cdbByte5 ); // Populate the 10 Byte Command Descriptor Block bool SetCommandDescriptorBlock ( SCSITaskIdentifier request, UInt8 cdbByte0, UInt8 cdbByte1, UInt8 cdbByte2, UInt8 cdbByte3, UInt8 cdbByte4, UInt8 cdbByte5, UInt8 cdbByte6, UInt8 cdbByte7, UInt8 cdbByte8, UInt8 cdbByte9 ); // Populate the 12 Byte Command Descriptor Block bool SetCommandDescriptorBlock ( SCSITaskIdentifier request, UInt8 cdbByte0, UInt8 cdbByte1, UInt8 cdbByte2, UInt8 cdbByte3, UInt8 cdbByte4, UInt8 cdbByte5, UInt8 cdbByte6, UInt8 cdbByte7, UInt8 cdbByte8, UInt8 cdbByte9, UInt8 cdbByte10, UInt8 cdbByte11 ); // Populate the 16 Byte Command Descriptor Block bool SetCommandDescriptorBlock ( SCSITaskIdentifier request, UInt8 cdbByte0, UInt8 cdbByte1, UInt8 cdbByte2, UInt8 cdbByte3, UInt8 cdbByte4, UInt8 cdbByte5, UInt8 cdbByte6, UInt8 cdbByte7, UInt8 cdbByte8, UInt8 cdbByte9, UInt8 cdbByte10, UInt8 cdbByte11, UInt8 cdbByte12, UInt8 cdbByte13, UInt8 cdbByte14, UInt8 cdbByte15 ); bool SetDataTransferDirection ( SCSITaskIdentifier request, UInt8 newDirection ); UInt8 GetDataTransferDirection ( SCSITaskIdentifier request ); bool SetRequestedDataTransferCount ( SCSITaskIdentifier request, UInt64 newRequestedCount ); UInt64 GetRequestedDataTransferCount ( SCSITaskIdentifier request ); bool SetRealizedDataTransferCount ( SCSITaskIdentifier request, UInt64 newRealizedDataCount ); UInt64 GetRealizedDataTransferCount ( SCSITaskIdentifier request ); bool SetDataBuffer ( SCSITaskIdentifier request, IOMemoryDescriptor * newBuffer ); IOMemoryDescriptor * GetDataBuffer ( SCSITaskIdentifier request ); bool SetTimeoutDuration ( SCSITaskIdentifier request, UInt32 newTimeout ); UInt32 GetTimeoutDuration ( SCSITaskIdentifier request ); bool SetTaskCompletionCallback ( SCSITaskIdentifier request, SCSITaskCompletion newCallback ); void TaskCompletedNotification ( SCSITaskIdentifier request ); bool SetServiceResponse ( SCSITaskIdentifier request, SCSIServiceResponse serviceResponse ); SCSIServiceResponse GetServiceResponse ( SCSITaskIdentifier request ); bool SetAutosenseCommand ( SCSITaskIdentifier request, UInt8 cdbByte0, UInt8 cdbByte1, UInt8 cdbByte2, UInt8 cdbByte3, UInt8 cdbByte4, UInt8 cdbByte5 ); bool GetAutoSenseData ( SCSITaskIdentifier request, SCSI_Sense_Data * senseData ); // DEPRECATED, use below function instead bool GetAutoSenseData ( SCSITaskIdentifier request, SCSI_Sense_Data * senseData, UInt8 senseDataSize ); UInt8 GetAutoSenseDataSize ( SCSITaskIdentifier request ); bool SetApplicationLayerReference ( SCSITaskIdentifier request, void * newReferenceValue ); void * GetApplicationLayerReference ( SCSITaskIdentifier request ); void IncrementOutstandingCommandsCount ( void ); static void sIncrementOutstandingCommandsCount ( IOSCSIPrimaryCommandsDevice * self ); virtual void HandleIncrementOutstandingCommandsCount ( void ); // This static member routine provides a mechanism for retrieving a pointer to // the object that is claimed as the owner of the specified SCSITask. static OSObject * sGetOwnerForTask ( SCSITaskIdentifier request ); public: bool init ( OSDictionary * propTable ) APPLE_KEXT_OVERRIDE; virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void stop ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual IOReturn message ( UInt32 type, IOService * nub, void * arg ) APPLE_KEXT_OVERRIDE; // The setAgressiveness method is called by the power manager // to notify us of certain power management settings. We override // this method in order to catch the kPMMinutesToSpinDown message // in order to set our idle timer. virtual IOReturn setAggressiveness ( unsigned long type, unsigned long minutes ) APPLE_KEXT_OVERRIDE; // Methods for getting device information strings virtual char * GetVendorString ( void ); virtual char * GetProductString ( void ); virtual char * GetRevisionString ( void ); OSDictionary * GetProtocolCharacteristicsDictionary ( void ); OSDictionary * GetDeviceCharacteristicsDictionary ( void ); UInt8 GetANSIVersion ( void ); bool GetCMDQUE ( void ); #if !TARGET_OS_IPHONE OSString * MapINQUIRYDataToIconFile ( void ); #endif /* !TARGET_OS_IPHONE */ UInt32 GetRetryCount ( void ); // -- SCSI Protocol Interface Methods -- // The ExecuteCommand method will take a SCSI Task and transport // it across the physical wire(s) to the device virtual void ExecuteCommand ( SCSITaskIdentifier request ) APPLE_KEXT_OVERRIDE; // The Task Management function to allow the SCSI Application Layer client to request // that a specific task be aborted. SCSIServiceResponse AbortTask ( UInt8 theLogicalUnit, SCSITaggedTaskIdentifier theTag ) APPLE_KEXT_OVERRIDE; // The Task Management function to allow the SCSI Application Layer client to request // that a all tasks curerntly in the task set be aborted. SCSIServiceResponse AbortTaskSet ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; SCSIServiceResponse ClearACA ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; SCSIServiceResponse ClearTaskSet ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; SCSIServiceResponse LogicalUnitReset ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; SCSIServiceResponse TargetReset ( void ) APPLE_KEXT_OVERRIDE; // The AbortCommand method will abort the indicated SCSI Task, // if it is possible and the task has not already completed. virtual SCSIServiceResponse AbortCommand ( SCSITaskIdentifier request ) APPLE_KEXT_OVERRIDE; // The IsProtocolServiceSupported will return true if the specified // feature is supported by the protocol layer. If the service has a value that must be // returned, it will be returned in the serviceValue output parameter. virtual bool IsProtocolServiceSupported ( SCSIProtocolFeature feature, void * serviceValue ) APPLE_KEXT_OVERRIDE; // The HandleProtocolServiceFeature will return true if the specified feature could // be handled properly by the protocol layer. virtual bool HandleProtocolServiceFeature ( SCSIProtocolFeature feature, void * serviceValue ) APPLE_KEXT_OVERRIDE; // Utility methods for use by all peripheral device objects. // isParameterValid are used to validate that the parameter passed into // the command methods are of the correct value. // Validate Parameter used for 1 bit to 1 byte paramaters bool IsParameterValid ( SCSICmdField1Byte param, SCSICmdField1Byte mask ); // Validate Parameter used for 9 bit to 2 byte paramaters bool IsParameterValid ( SCSICmdField2Byte param, SCSICmdField2Byte mask ); // Validate Parameter used for 17 bit to 4 byte paramaters bool IsParameterValid ( SCSICmdField4Byte param, SCSICmdField4Byte mask ); // Validate Parameter used for 33 bit to 8 byte paramaters bool IsParameterValid ( SCSICmdField8Byte param, SCSICmdField8Byte mask ); bool IsMemoryDescriptorValid ( IOMemoryDescriptor * dataBuffer ); bool IsMemoryDescriptorValid ( IOMemoryDescriptor * dataBuffer, UInt64 requiredSize ); virtual bool INQUIRY ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit CMDDT, SCSICmdField1Bit EVPD, SCSICmdField1Byte PAGE_OR_OPERATION_CODE, SCSICmdField1Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); #if !TARGET_OS_IPHONE virtual bool LOG_SELECT ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit PCR, SCSICmdField1Bit SP, SCSICmdField2Bit PC, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool LOG_SENSE ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit PPC, SCSICmdField1Bit SP, SCSICmdField2Bit PC, SCSICmdField6Bit PAGE_CODE, SCSICmdField2Byte PARAMETER_POINTER, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); #endif /* !TARGET_OS_IPHONE */ virtual bool MODE_SELECT_6 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit PF, SCSICmdField1Bit SP, SCSICmdField1Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool MODE_SELECT_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit PF, SCSICmdField1Bit SP, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool MODE_SENSE_6 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit DBD, SCSICmdField2Bit PC, SCSICmdField6Bit PAGE_CODE, SCSICmdField1Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool MODE_SENSE_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit LLBAA, SCSICmdField1Bit DBD, SCSICmdField2Bit PC, SCSICmdField6Bit PAGE_CODE, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); #if !TARGET_OS_IPHONE virtual bool PERSISTENT_RESERVE_IN ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField5Bit SERVICE_ACTION, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool PERSISTENT_RESERVE_OUT ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField5Bit SERVICE_ACTION, SCSICmdField4Bit SCOPE, SCSICmdField4Bit TYPE, SCSICmdField1Byte CONTROL ); #endif /* !TARGET_OS_IPHONE */ virtual bool PREVENT_ALLOW_MEDIUM_REMOVAL ( SCSITaskIdentifier request, SCSICmdField2Bit PREVENT, SCSICmdField1Byte CONTROL ); #if !TARGET_OS_IPHONE virtual bool READ_BUFFER ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Bit MODE, SCSICmdField1Byte BUFFER_ID, SCSICmdField3Byte BUFFER_OFFSET, SCSICmdField3Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool RECEIVE ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField3Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool RECEIVE_DIAGNOSTICS_RESULTS ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit PCV, SCSICmdField1Byte PAGE_CODE, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool RELEASE_6 ( SCSITaskIdentifier request, SCSICmdField1Byte CONTROL ); virtual bool RELEASE_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit THRDPTY, SCSICmdField1Bit LONGID, SCSICmdField1Byte THIRD_PARTY_DEVICE_ID, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); #endif /* !TARGET_OS_IPHONE */ virtual bool REPORT_DEVICE_IDENTIFIER ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool REPORT_LUNS ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool REQUEST_SENSE ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); #if !TARGET_OS_IPHONE virtual bool RESERVE_6 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Byte CONTROL ); virtual bool RESERVE_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit THRDPTY, SCSICmdField1Bit LONGID, SCSICmdField1Byte THIRD_PARTY_DEVICE_ID, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool SEND ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit AER, SCSICmdField3Byte TRANSFER_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool SEND_DIAGNOSTICS ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField3Bit SELF_TEST_CODE, SCSICmdField1Bit PF, SCSICmdField1Bit SELF_TEST, SCSICmdField1Bit DEVOFFL, SCSICmdField1Bit UNITOFFL, SCSICmdField2Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); virtual bool SET_DEVICE_IDENTIFIER ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField5Bit SERVICE_ACTION, SCSICmdField4Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); #endif /* !TARGET_OS_IPHONE */ virtual bool TEST_UNIT_READY ( SCSITaskIdentifier request, SCSICmdField1Byte CONTROL ); #if !TARGET_OS_IPHONE virtual bool WRITE_BUFFER ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Bit MODE, SCSICmdField1Byte BUFFER_ID, SCSICmdField3Byte BUFFER_OFFSET, SCSICmdField3Byte PARAMETER_LIST_LENGTH, SCSICmdField1Byte CONTROL ); #endif /* !TARGET_OS_IPHONE */ // The SPC-3 INQUIRY command as defined in section 6.4.1 of SPC-3. bool INQUIRY ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit EVPD, SCSICmdField1Byte PAGE_CODE, SCSICmdField2Byte ALLOCATION_LENGTH, SCSICmdField1Byte CONTROL ); OSMetaClassDeclareReservedUsed ( IOSCSIPrimaryCommandsDevice, 1 ); // ClampPowerState() will check if it is currently running behind the // workloop lock, if not, it will call itself again to run behind the // workloop gate. When subclassing ClampPowerState() make sure to take // workloop synchronization in consideration. virtual void ClampPowerState ( void ); OSMetaClassDeclareReservedUsed ( IOSCSIPrimaryCommandsDevice, 2 ); virtual void ReleasePowerStateClamp ( void ); private: #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 3 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 8 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIPrimaryCommandsDevice, 16 ); #endif /* !TARGET_OS_IPHONE */ }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PRIMARY_COMMANDS_DEVICE_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSICommandDefinitions.h
/* * Copyright (c) 2001-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_COMMAND_DEFINITIONS_H_ #define _IOKIT_SCSI_COMMAND_DEFINITIONS_H_ #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif /*! @header SCSICommandDefinitions @discussion This file contains all the definitions for types and constants that are used by the command set classes for building CDBs. The field type definitions are used for the parameters passed to a method that builds and sends any SCSI defined command to clearly identify the type of value expected for a parameter. The command methods will then use the appropriate mask to verify that the value passed into a parameter is of the specified type. Currently only types and masks are defined for 8 bytes and smaller fields. If a command is defined that uses a larger field, these should be expanded to include those sizes. */ #pragma mark Field Type Definitions /* These are the type definitions used for the parameters of methods that * build and send Command Descriptor Blocks. */ /* 1 Byte or smaller fields. */ /*! @typedef SCSICmdField1Bit */ typedef UInt8 SCSICmdField1Bit; /*! @typedef SCSICmdField2Bit */ typedef UInt8 SCSICmdField2Bit; /*! @typedef SCSICmdField3Bit */ typedef UInt8 SCSICmdField3Bit; /*! @typedef SCSICmdField4Bit */ typedef UInt8 SCSICmdField4Bit; /*! @typedef SCSICmdField5Bit */ typedef UInt8 SCSICmdField5Bit; /*! @typedef SCSICmdField6Bit */ typedef UInt8 SCSICmdField6Bit; /*! @typedef SCSICmdField7Bit */ typedef UInt8 SCSICmdField7Bit; /*! @typedef SCSICmdField1Byte */ typedef UInt8 SCSICmdField1Byte; /* 2 Bytes or smaller fields. */ /*! @typedef SCSICmdField9Bit */ typedef UInt16 SCSICmdField9Bit; /*! @typedef SCSICmdField10Bit */ typedef UInt16 SCSICmdField10Bit; /*! @typedef SCSICmdField11Bit */ typedef UInt16 SCSICmdField11Bit; /*! @typedef SCSICmdField12Bit */ typedef UInt16 SCSICmdField12Bit; /*! @typedef SCSICmdField13Bit */ typedef UInt16 SCSICmdField13Bit; /*! @typedef SCSICmdField14Bit */ typedef UInt16 SCSICmdField14Bit; /*! @typedef SCSICmdField15Bit */ typedef UInt16 SCSICmdField15Bit; /*! @typedef SCSICmdField2Byte */ typedef UInt16 SCSICmdField2Byte; /* 3 Bytes or smaller fields. */ /*! @typedef SCSICmdField17Bit */ typedef UInt32 SCSICmdField17Bit; /*! @typedef SCSICmdField18Bit */ typedef UInt32 SCSICmdField18Bit; /*! @typedef SCSICmdField19Bit */ typedef UInt32 SCSICmdField19Bit; /*! @typedef SCSICmdField20Bit */ typedef UInt32 SCSICmdField20Bit; /*! @typedef SCSICmdField21Bit */ typedef UInt32 SCSICmdField21Bit; /*! @typedef SCSICmdField22Bit */ typedef UInt32 SCSICmdField22Bit; /*! @typedef SCSICmdField23Bit */ typedef UInt32 SCSICmdField23Bit; /*! @typedef SCSICmdField3Byte */ typedef UInt32 SCSICmdField3Byte; /* 4 Bytes or smaller fields. */ /*! @typedef SCSICmdField25Bit */ typedef UInt32 SCSICmdField25Bit; /*! @typedef SCSICmdField26Bit */ typedef UInt32 SCSICmdField26Bit; /*! @typedef SCSICmdField27Bit */ typedef UInt32 SCSICmdField27Bit; /*! @typedef SCSICmdField28Bit */ typedef UInt32 SCSICmdField28Bit; /*! @typedef SCSICmdField29Bit */ typedef UInt32 SCSICmdField29Bit; /*! @typedef SCSICmdField30Bit */ typedef UInt32 SCSICmdField30Bit; /*! @typedef SCSICmdField31Bit */ typedef UInt32 SCSICmdField31Bit; /*! @typedef SCSICmdField4Byte */ typedef UInt32 SCSICmdField4Byte; /* 5 Bytes or smaller fields. */ /*! @typedef SCSICmdField33Bit */ typedef UInt64 SCSICmdField33Bit; /*! @typedef SCSICmdField34Bit */ typedef UInt64 SCSICmdField34Bit; /*! @typedef SCSICmdField35Bit */ typedef UInt64 SCSICmdField35Bit; /*! @typedef SCSICmdField36Bit */ typedef UInt64 SCSICmdField36Bit; /*! @typedef SCSICmdField37Bit */ typedef UInt64 SCSICmdField37Bit; /*! @typedef SCSICmdField38Bit */ typedef UInt64 SCSICmdField38Bit; /*! @typedef SCSICmdField39Bit */ typedef UInt64 SCSICmdField39Bit; /*! @typedef SCSICmdField5Byte */ typedef UInt64 SCSICmdField5Byte; /* 6 Bytes or smaller fields. */ /*! @typedef SCSICmdField41Bit */ typedef UInt64 SCSICmdField41Bit; /*! @typedef SCSICmdField42Bit */ typedef UInt64 SCSICmdField42Bit; /*! @typedef SCSICmdField43Bit */ typedef UInt64 SCSICmdField43Bit; /*! @typedef SCSICmdField44Bit */ typedef UInt64 SCSICmdField44Bit; /*! @typedef SCSICmdField45Bit */ typedef UInt64 SCSICmdField45Bit; /*! @typedef SCSICmdField46Bit */ typedef UInt64 SCSICmdField46Bit; /*! @typedef SCSICmdField47Bit */ typedef UInt64 SCSICmdField47Bit; /*! @typedef SCSICmdField6Byte */ typedef UInt64 SCSICmdField6Byte; /* 7 Bytes or smaller fields. */ /*! @typedef SCSICmdField49Bit */ typedef UInt64 SCSICmdField49Bit; /*! @typedef SCSICmdField50Bit */ typedef UInt64 SCSICmdField50Bit; /*! @typedef SCSICmdField51Bit */ typedef UInt64 SCSICmdField51Bit; /*! @typedef SCSICmdField52Bit */ typedef UInt64 SCSICmdField52Bit; /*! @typedef SCSICmdField53Bit */ typedef UInt64 SCSICmdField53Bit; /*! @typedef SCSICmdField54Bit */ typedef UInt64 SCSICmdField54Bit; /*! @typedef SCSICmdField55Bit */ typedef UInt64 SCSICmdField55Bit; /*! @typedef SCSICmdField7Byte */ typedef UInt64 SCSICmdField7Byte; /* 8 Bytes or smaller fields. */ /*! @typedef SCSICmdField57Bit */ typedef UInt64 SCSICmdField57Bit; /*! @typedef SCSICmdField58Bit */ typedef UInt64 SCSICmdField58Bit; /*! @typedef SCSICmdField59Bit */ typedef UInt64 SCSICmdField59Bit; /*! @typedef SCSICmdField60Bit */ typedef UInt64 SCSICmdField60Bit; /*! @typedef SCSICmdField61Bit */ typedef UInt64 SCSICmdField61Bit; /*! @typedef SCSICmdField62Bit */ typedef UInt64 SCSICmdField62Bit; /*! @typedef SCSICmdField63Bit */ typedef UInt64 SCSICmdField63Bit; /*! @typedef SCSICmdField8Byte */ typedef UInt64 SCSICmdField8Byte; #pragma mark Field Mask Definitions /* These are masks that are used to verify that the values passed into the * parameters for the fields are not larger than the field size. * * NB: These have changed from enums to #define since enums greater than * 32 bits in size are not well-defined in C99. */ /* 1 Byte or smaller fields. */ /*! @constant kSCSICmdFieldMask1Bit */ #define kSCSICmdFieldMask1Bit 0x01 /*! @constant kSCSICmdFieldMask2Bit */ #define kSCSICmdFieldMask2Bit 0x03 /*! @constant kSCSICmdFieldMask3Bit */ #define kSCSICmdFieldMask3Bit 0x07 /*! @constant kSCSICmdFieldMask4Bit */ #define kSCSICmdFieldMask4Bit 0x0F /*! @constant kSCSICmdFieldMask5Bit */ #define kSCSICmdFieldMask5Bit 0x1F /*! @constant kSCSICmdFieldMask6Bit */ #define kSCSICmdFieldMask6Bit 0x3F /*! @constant kSCSICmdFieldMask7Bit */ #define kSCSICmdFieldMask7Bit 0x7F #define kSCSICmdFieldMask1Byte 0xFF /* 2 Bytes or smaller fields. */ /*! @constant kSCSICmdFieldMask9Bit */ #define kSCSICmdFieldMask9Bit 0x01FF /*! @constant kSCSICmdFieldMask10Bit */ #define kSCSICmdFieldMask10Bit 0x03FF /*! @constant kSCSICmdFieldMask11Bit */ #define kSCSICmdFieldMask11Bit 0x07FF /*! @constant kSCSICmdFieldMask12Bit */ #define kSCSICmdFieldMask12Bit 0x0FFF /*! @constant kSCSICmdFieldMask13Bit */ #define kSCSICmdFieldMask13Bit 0x1FFF /*! @constant kSCSICmdFieldMask14Bit */ #define kSCSICmdFieldMask14Bit 0x3FFF /*! @constant kSCSICmdFieldMask15Bit */ #define kSCSICmdFieldMask15Bit 0x7FFF /*! @constant kSCSICmdFieldMask2Byte */ #define kSCSICmdFieldMask2Byte 0xFFFF /* 3 Bytes or smaller fields. */ /*! @constant kSCSICmdFieldMask17Bit */ #define kSCSICmdFieldMask17Bit 0x01FFFF /*! @constant kSCSICmdFieldMask18Bit */ #define kSCSICmdFieldMask18Bit 0x03FFFF /*! @constant kSCSICmdFieldMask19Bit */ #define kSCSICmdFieldMask19Bit 0x07FFFF /*! @constant kSCSICmdFieldMask20Bit */ #define kSCSICmdFieldMask20Bit 0x0FFFFF /*! @constant kSCSICmdFieldMask21Bit */ #define kSCSICmdFieldMask21Bit 0x1FFFFF /*! @constant kSCSICmdFieldMask22Bit */ #define kSCSICmdFieldMask22Bit 0x3FFFFF /*! @constant kSCSICmdFieldMask23Bit */ #define kSCSICmdFieldMask23Bit 0x7FFFFF /*! @constant kSCSICmdFieldMask3Byte */ #define kSCSICmdFieldMask3Byte 0xFFFFFF /* 4 Bytes or smaller fields. */ /*! @constant kSCSICmdFieldMask25Bit */ #define kSCSICmdFieldMask25Bit 0x01FFFFFFUL /*! @constant kSCSICmdFieldMask26Bit */ #define kSCSICmdFieldMask26Bit 0x03FFFFFFUL /*! @constant kSCSICmdFieldMask27Bit */ #define kSCSICmdFieldMask27Bit 0x07FFFFFFUL /*! @constant kSCSICmdFieldMask28Bit */ #define kSCSICmdFieldMask28Bit 0x0FFFFFFFUL /*! @constant kSCSICmdFieldMask29Bit */ #define kSCSICmdFieldMask29Bit 0x1FFFFFFFUL /*! @constant kSCSICmdFieldMask30Bit */ #define kSCSICmdFieldMask30Bit 0x3FFFFFFFUL /*! @constant kSCSICmdFieldMask31Bit */ #define kSCSICmdFieldMask31Bit 0x7FFFFFFFUL /*! @constant kSCSICmdFieldMask4Byte */ #define kSCSICmdFieldMask4Byte 0xFFFFFFFFUL /* 5 Bytes or smaller fields. */ /*! @constant kSCSICmdFieldMask33Bit */ #define kSCSICmdFieldMask33Bit 0x01FFFFFFFFULL /*! @constant kSCSICmdFieldMask34Bit */ #define kSCSICmdFieldMask34Bit 0x03FFFFFFFFULL /*! @constant kSCSICmdFieldMask35Bit */ #define kSCSICmdFieldMask35Bit 0x07FFFFFFFFULL /*! @constant kSCSICmdFieldMask36Bit */ #define kSCSICmdFieldMask36Bit 0x0FFFFFFFFFULL /*! @constant kSCSICmdFieldMask37Bit */ #define kSCSICmdFieldMask37Bit 0x1FFFFFFFFFULL /*! @constant kSCSICmdFieldMask38Bit */ #define kSCSICmdFieldMask38Bit 0x3FFFFFFFFFULL /*! @constant kSCSICmdFieldMask39Bit */ #define kSCSICmdFieldMask39Bit 0x7FFFFFFFFFULL /*! @constant kSCSICmdFieldMask5Byte */ #define kSCSICmdFieldMask5Byte 0xFFFFFFFFFFULL /* 6 Bytes or smaller fields. */ /*! @constant kSCSICmdFieldMask41Bit */ #define kSCSICmdFieldMask41Bit 0x01FFFFFFFFFFULL /*! @constant kSCSICmdFieldMask42Bit */ #define kSCSICmdFieldMask42Bit 0x03FFFFFFFFFFULL /*! @constant kSCSICmdFieldMask43Bit */ #define kSCSICmdFieldMask43Bit 0x07FFFFFFFFFFULL /*! @constant kSCSICmdFieldMask44Bit */ #define kSCSICmdFieldMask44Bit 0x0FFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask45Bit */ #define kSCSICmdFieldMask45Bit 0x1FFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask46Bit */ #define kSCSICmdFieldMask46Bit 0x3FFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask47Bit */ #define kSCSICmdFieldMask47Bit 0x7FFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask6Byte */ #define kSCSICmdFieldMask6Byte 0xFFFFFFFFFFFFULL /* 7 Bytes or smaller fields. */ /*! @constant kSCSICmdFieldMask49Bit */ #define kSCSICmdFieldMask49Bit 0x01FFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask50Bit */ #define kSCSICmdFieldMask50Bit 0x03FFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask51Bit */ #define kSCSICmdFieldMask51Bit 0x07FFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask52Bit */ #define kSCSICmdFieldMask52Bit 0x0FFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask53Bit */ #define kSCSICmdFieldMask53Bit 0x1FFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask54Bit */ #define kSCSICmdFieldMask54Bit 0x3FFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask55Bit */ #define kSCSICmdFieldMask55Bit 0x7FFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask7Byte */ #define kSCSICmdFieldMask7Byte 0xFFFFFFFFFFFFFFULL /* 8 Bytes or smaller fields. */ /*! @constant kSCSICmdFieldMask57Bit */ #define kSCSICmdFieldMask57Bit 0x01FFFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask58Bit */ #define kSCSICmdFieldMask58Bit 0x03FFFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask59Bit */ #define kSCSICmdFieldMask59Bit 0x07FFFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask60Bit */ #define kSCSICmdFieldMask60Bit 0x0FFFFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask61Bit */ #define kSCSICmdFieldMask61Bit 0x1FFFFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask62Bit */ #define kSCSICmdFieldMask62Bit 0x3FFFFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask63Bit */ #define kSCSICmdFieldMask63Bit 0x7FFFFFFFFFFFFFFFULL /*! @constant kSCSICmdFieldMask8Byte */ #define kSCSICmdFieldMask8Byte 0xFFFFFFFFFFFFFFFFULL #endif /* _IOKIT_SCSI_COMMAND_DEFINITIONS_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIPeripheralDeviceType00.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_OO_H_ #define _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_OO_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIBlockCommandsDevice.h> //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOSCSIPeripheralDeviceType00 : public IOSCSIBlockCommandsDevice { OSDeclareDefaultStructors ( IOSCSIPeripheralDeviceType00 ) protected: // Reserve space for future expansion. struct IOSCSIPeripheralDeviceType00ExpansionData { OSSet * fClients; }; IOSCSIPeripheralDeviceType00ExpansionData * fIOSCSIPeripheralDeviceType00Reserved; public: bool init ( OSDictionary * propTable ) APPLE_KEXT_OVERRIDE; virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void free ( void ) APPLE_KEXT_OVERRIDE; virtual bool handleOpen ( IOService * client, IOOptionBits options, void * access ) APPLE_KEXT_OVERRIDE; virtual void handleClose ( IOService * client, IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual bool handleIsOpen ( const IOService * client ) const APPLE_KEXT_OVERRIDE; virtual IOReturn newUserClient ( task_t owningTask, void * securityID, UInt32 type, OSDictionary * properties, IOUserClient ** handler ) APPLE_KEXT_OVERRIDE; virtual void CreateStorageServiceNub ( void ) APPLE_KEXT_OVERRIDE; virtual char * GetVendorString ( void ) APPLE_KEXT_OVERRIDE; virtual char * GetProductString ( void ) APPLE_KEXT_OVERRIDE; virtual char * GetRevisionString ( void ) APPLE_KEXT_OVERRIDE; private: #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 1 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 2 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 3 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType00, 8 ); #endif /* !TARGET_OS_IPHONE */ }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_OO_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOBDServices.h
/* * Copyright (c) 2006-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_BD_SERVICES_H_ #define _IOKIT_IO_BD_SERVICES_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // IOKit includes #include <IOKit/IOTypes.h> // Generic IOKit storage related headers #include <IOKit/storage/IOBDTypes.h> #include <IOKit/storage/IOBDBlockStorageDevice.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIPeripheralDeviceType05.h> class IOMemoryDescriptor; //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOBDServices : public IOBDBlockStorageDevice { OSDeclareDefaultStructors ( IOBDServices ) protected: OSSet * fClients; IOSCSIPeripheralDeviceType05 * fProvider; virtual void free ( void ) APPLE_KEXT_OVERRIDE; // Reserve space for future expansion. struct IOBDServicesExpansionData { }; IOBDServicesExpansionData * fIOBDServicesReserved; public: static void AsyncReadWriteComplete ( void * clientData, IOReturn status, UInt64 actualByteCount ); // Deprecated virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageAttributes * attributes, IOStorageCompletion * completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn doEjectMedia ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn doFormatMedia ( UInt64 byteCapacity ) APPLE_KEXT_OVERRIDE; virtual UInt32 doGetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const APPLE_KEXT_OVERRIDE; virtual IOReturn doSynchronizeCache ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn getWriteCacheState ( bool * enabled ) APPLE_KEXT_OVERRIDE; virtual IOReturn setWriteCacheState ( bool enabled ) APPLE_KEXT_OVERRIDE; virtual char * getVendorString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getProductString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getRevisionString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getAdditionalDeviceInfoString ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportBlockSize ( UInt64 * blockSize ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportEjectability ( bool * isEjectable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMediaState ( bool * mediaPresent, bool * changed ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMaxValidBlock ( UInt64 * maxBlock ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportRemovability ( bool * isRemovable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportWriteProtection ( bool * isWriteProtected ) APPLE_KEXT_OVERRIDE; /* CD Specific */ virtual IOReturn doAsyncReadCD ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, CDSectorArea sectorArea, CDSectorType sectorType, IOStorageCompletion completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn readISRC ( UInt8 track, CDISRC isrc ) APPLE_KEXT_OVERRIDE; virtual IOReturn readMCN ( CDMCN mcn) APPLE_KEXT_OVERRIDE; virtual IOReturn readTOC ( IOMemoryDescriptor * buffer ) APPLE_KEXT_OVERRIDE; virtual IOReturn audioPause ( bool pause ); virtual IOReturn audioPlay ( CDMSF timeStart, CDMSF timeStop ); virtual IOReturn audioScan ( CDMSF timeStart, bool reverse ); virtual IOReturn audioStop ( void ); virtual IOReturn getAudioStatus ( CDAudioStatus * status ); virtual IOReturn getAudioVolume ( UInt8 * leftVolume, UInt8 * rightVolume ); virtual IOReturn setAudioVolume ( UInt8 leftVolume, UInt8 rightVolume ); virtual IOReturn getSpeed ( UInt16 * kilobytesPerSecond ) APPLE_KEXT_OVERRIDE; virtual IOReturn setSpeed ( UInt16 kilobytesPerSecond ) APPLE_KEXT_OVERRIDE; /* DVD Specific */ virtual UInt32 getMediaType ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt32 lba, const UInt8 agid, const DVDKeyFormat keyFormat ) APPLE_KEXT_OVERRIDE __attribute__ ((deprecated)); virtual IOReturn reportKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt32 lba, const UInt8 blockCount, const UInt8 agid, const DVDKeyFormat keyFormat ) APPLE_KEXT_OVERRIDE; virtual IOReturn sendKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt8 agid, const DVDKeyFormat keyFormat ) APPLE_KEXT_OVERRIDE; virtual IOReturn readDVDStructure ( IOMemoryDescriptor * buffer, const UInt8 structureFormat, const UInt32 logicalBlockAddress, const UInt8 layer, const UInt8 agid ) APPLE_KEXT_OVERRIDE; /* BD Specific */ virtual IOReturn readDiscStructure ( IOMemoryDescriptor * buffer, UInt8 structureFormat, UInt32 logicalBlockAddress, UInt8 layer, UInt8 agid, UInt8 mediaType ) APPLE_KEXT_OVERRIDE; /* 10.6.0 */ virtual IOReturn requestIdle ( void ) APPLE_KEXT_OVERRIDE; /* System Specific */ virtual IOReturn message ( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; virtual IOReturn setProperties ( OSObject * properties ) APPLE_KEXT_OVERRIDE; /* User Client Specific */ virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual bool open ( IOService * client, IOOptionBits options, IOStorageAccess access ); virtual bool handleOpen ( IOService * client, IOOptionBits options, void * access ) APPLE_KEXT_OVERRIDE; virtual void handleClose ( IOService * client, IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual bool handleIsOpen ( const IOService * client ) const APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readTOC ( IOMemoryDescriptor * buffer, CDTOCFormat format, UInt8 msf, UInt8 trackSessionNumber, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readDiscInfo ( IOMemoryDescriptor * buffer, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readTrackInfo ( IOMemoryDescriptor * buffer, UInt32 address, CDTrackInfoAddressType addressType, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; /* Added with 10.5 */ virtual IOReturn splitTrack ( UInt32 address ) APPLE_KEXT_OVERRIDE; private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOBDServices, 1 ); OSMetaClassDeclareReservedUnused ( IOBDServices, 2 ); OSMetaClassDeclareReservedUnused ( IOBDServices, 3 ); OSMetaClassDeclareReservedUnused ( IOBDServices, 4 ); OSMetaClassDeclareReservedUnused ( IOBDServices, 5 ); OSMetaClassDeclareReservedUnused ( IOBDServices, 6 ); OSMetaClassDeclareReservedUnused ( IOBDServices, 7 ); OSMetaClassDeclareReservedUnused ( IOBDServices, 8 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_BD_SERVICES_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IODVDServices.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_DVD_SERVICES_H_ #define _IOKIT_IO_DVD_SERVICES_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // IOKit includes #include <IOKit/IOTypes.h> // Generic IOKit storage related headers #include <IOKit/storage/IODVDTypes.h> #include <IOKit/storage/IODVDBlockStorageDevice.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIPeripheralDeviceType05.h> class IOMemoryDescriptor; // Use this switch to turn off the data cache. #define _DVD_USE_DATA_CACHING_ 1 //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IODVDServices : public IODVDBlockStorageDevice { OSDeclareDefaultStructors ( IODVDServices ) #if (_DVD_USE_DATA_CACHING_) // Data Cache members bool fUseDataCache; // Indicates if cache should be used. This // will be set to false if all the necessary support // for the data cache could not be allocated or // initialized. UInt8 * fDataCacheStorage; // Storage space for the cache UInt32 fDataCacheStartBlock; // Starting block of the data in the cache. UInt32 fDataCacheBlockCount; // Number of contiguous blocks in the cache // starting with fDataCacheStartBlock. A value of // zero in this member indicates that all data // in the cache is invalid. IOSimpleLock * fDataCacheLock; // This is the lock for preventing multiple access // while manipulating the data cache. #endif protected: OSSet * fClients; IOSCSIPeripheralDeviceType05 * fProvider; virtual void free ( void ) APPLE_KEXT_OVERRIDE; // Reserve space for future expansion. struct IODVDServicesExpansionData { }; IODVDServicesExpansionData * fIODVDServicesReserved; public: static void AsyncReadWriteComplete ( void * clientData, IOReturn status, UInt64 actualByteCount ); // Deprecated virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageAttributes * attributes, IOStorageCompletion * completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn doEjectMedia ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn doFormatMedia ( UInt64 byteCapacity ) APPLE_KEXT_OVERRIDE; virtual UInt32 doGetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const APPLE_KEXT_OVERRIDE; virtual IOReturn doSynchronizeCache ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn getWriteCacheState ( bool * enabled ) APPLE_KEXT_OVERRIDE; virtual IOReturn setWriteCacheState ( bool enabled ) APPLE_KEXT_OVERRIDE; virtual char * getVendorString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getProductString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getRevisionString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getAdditionalDeviceInfoString ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportBlockSize ( UInt64 * blockSize ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportEjectability ( bool * isEjectable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMediaState ( bool * mediaPresent, bool * changed ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMaxValidBlock ( UInt64 * maxBlock ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportRemovability ( bool * isRemovable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportWriteProtection ( bool * isWriteProtected ) APPLE_KEXT_OVERRIDE; /* CD Specific */ virtual IOReturn doAsyncReadCD ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, CDSectorArea sectorArea, CDSectorType sectorType, IOStorageCompletion completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn readISRC ( UInt8 track, CDISRC isrc ) APPLE_KEXT_OVERRIDE; virtual IOReturn readMCN ( CDMCN mcn) APPLE_KEXT_OVERRIDE; virtual IOReturn readTOC ( IOMemoryDescriptor * buffer ) APPLE_KEXT_OVERRIDE; virtual IOReturn audioPause ( bool pause ); virtual IOReturn audioPlay ( CDMSF timeStart, CDMSF timeStop ); virtual IOReturn audioScan ( CDMSF timeStart, bool reverse ); virtual IOReturn audioStop ( void ); virtual IOReturn getAudioStatus ( CDAudioStatus * status ); virtual IOReturn getAudioVolume ( UInt8 * leftVolume, UInt8 * rightVolume ); virtual IOReturn setAudioVolume ( UInt8 leftVolume, UInt8 rightVolume ); virtual IOReturn getSpeed ( UInt16 * kilobytesPerSecond ) APPLE_KEXT_OVERRIDE; virtual IOReturn setSpeed ( UInt16 kilobytesPerSecond ) APPLE_KEXT_OVERRIDE; /* DVD Specific */ virtual UInt32 getMediaType ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt32 lba, const UInt8 agid, const DVDKeyFormat keyFormat ) APPLE_KEXT_OVERRIDE __attribute__ ((deprecated)); virtual IOReturn reportKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt32 lba, const UInt8 blockCount, const UInt8 agid, const DVDKeyFormat keyFormat ) APPLE_KEXT_OVERRIDE; virtual IOReturn sendKey ( IOMemoryDescriptor * buffer, const DVDKeyClass keyClass, const UInt8 agid, const DVDKeyFormat keyFormat ) APPLE_KEXT_OVERRIDE; virtual IOReturn readDVDStructure ( IOMemoryDescriptor * buffer, const UInt8 structureFormat, const UInt32 logicalBlockAddress, const UInt8 layer, const UInt8 agid ) APPLE_KEXT_OVERRIDE; /* 10.6.0 */ virtual IOReturn requestIdle ( void ) APPLE_KEXT_OVERRIDE; /* System Specific */ virtual IOReturn message ( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; virtual IOReturn setProperties ( OSObject * properties ) APPLE_KEXT_OVERRIDE; /* User Client Specific */ virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual bool open ( IOService * client, IOOptionBits options, IOStorageAccess access ); virtual bool handleOpen ( IOService * client, IOOptionBits options, void * access ) APPLE_KEXT_OVERRIDE; virtual void handleClose ( IOService * client, IOOptionBits options ) APPLE_KEXT_OVERRIDE; virtual bool handleIsOpen ( const IOService * client ) const APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readTOC ( IOMemoryDescriptor * buffer, CDTOCFormat format, UInt8 msf, UInt8 trackSessionNumber, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readDiscInfo ( IOMemoryDescriptor * buffer, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; /* Added with 10.1.3 */ virtual IOReturn readTrackInfo ( IOMemoryDescriptor * buffer, UInt32 address, CDTrackInfoAddressType addressType, UInt16 * actualByteCount ) APPLE_KEXT_OVERRIDE; private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IODVDServices, 1 ); OSMetaClassDeclareReservedUnused ( IODVDServices, 2 ); OSMetaClassDeclareReservedUnused ( IODVDServices, 3 ); OSMetaClassDeclareReservedUnused ( IODVDServices, 4 ); OSMetaClassDeclareReservedUnused ( IODVDServices, 5 ); OSMetaClassDeclareReservedUnused ( IODVDServices, 6 ); OSMetaClassDeclareReservedUnused ( IODVDServices, 7 ); OSMetaClassDeclareReservedUnused ( IODVDServices, 8 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_DVD_SERVICES_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOBlockStorageServices.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_BLOCK_STORAGE_SERVICES_H_ #define _IOKIT_IO_BLOCK_STORAGE_SERVICES_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // IOKit includes #include <IOKit/IOTypes.h> // Generic IOKit storage related headers #include <IOKit/storage/IOBlockStorageDevice.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIBlockCommandsDevice.h> //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOBlockStorageServices : public IOBlockStorageDevice { OSDeclareDefaultStructors ( IOBlockStorageServices ) private: bool fMediaChanged; /* DEPRECATED */ bool fMediaPresent; protected: IOSCSIBlockCommandsDevice * fProvider; UInt64 fMaxReadBlocks; UInt64 fMaxWriteBlocks; virtual bool attach ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void detach ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void free ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn newUserClient ( task_t owningTask, void * securityID, UInt32 type, OSDictionary * properties, IOUserClient ** handler ) APPLE_KEXT_OVERRIDE; // Reserve space for future expansion. struct IOBlockStorageServicesExpansionData { }; IOBlockStorageServicesExpansionData * fIOBlockStorageServicesReserved; public: virtual IOReturn message ( UInt32 type, IOService * provider, void * argument ) APPLE_KEXT_OVERRIDE; static void AsyncReadWriteComplete ( void * clientData, IOReturn status, UInt64 actualByteCount ); // Deprecated virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt32 block, UInt32 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageCompletion completion ); virtual IOReturn doAsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, IOStorageAttributes * attributes, IOStorageCompletion * completion ) APPLE_KEXT_OVERRIDE; virtual IOReturn doEjectMedia ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn doFormatMedia ( UInt64 byteCapacity ) APPLE_KEXT_OVERRIDE; virtual UInt32 doGetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const APPLE_KEXT_OVERRIDE; virtual IOReturn doSynchronizeCache ( void ) APPLE_KEXT_OVERRIDE; virtual char * getVendorString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getProductString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getRevisionString ( void ) APPLE_KEXT_OVERRIDE; virtual char * getAdditionalDeviceInfoString ( void ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportBlockSize ( UInt64 * blockSize ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportEjectability ( bool * isEjectable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMediaState ( bool * mediaPresent, bool * changed ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportMaxValidBlock ( UInt64 * maxBlock ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportRemovability ( bool * isRemovable ) APPLE_KEXT_OVERRIDE; virtual IOReturn reportWriteProtection ( bool * isWriteProtected ) APPLE_KEXT_OVERRIDE; virtual IOReturn getWriteCacheState ( bool * enabled ) APPLE_KEXT_OVERRIDE; virtual IOReturn setWriteCacheState ( bool enabled ) APPLE_KEXT_OVERRIDE; virtual IOReturn doUnmap ( IOBlockStorageDeviceExtent * extents, UInt32 extentsCount, IOStorageUnmapOptions options = 0 ) APPLE_KEXT_OVERRIDE; virtual IOReturn doGetProvisionStatus ( UInt64 block, UInt64 nblks, UInt32 * extentsCount, IOBlockStorageProvisionDeviceExtent * extents, IOStorageGetProvisionStatusOptions options = 0) APPLE_KEXT_OVERRIDE; #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 1 ); OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 2 ); OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 3 ); OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 4 ); OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 5 ); OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 6 ); OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 7 ); OSMetaClassDeclareReservedUnused ( IOBlockStorageServices, 8 ); #endif /* !TARGET_OS_IPHONE */ }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_BLOCK_STORAGE_SERVICES_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSICmds_REQUEST_SENSE_Defs.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_ #define _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_ #include <TargetConditionals.h> #if TARGET_OS_DRIVERKIT typedef uint8_t UInt8; #else #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif #endif /*! @header SCSI Request Sense Definitions @discussion This file contains all definitions for the data returned from the REQUEST SENSE (0x03) command and from auto sense on protocols that support it. */ /*! @enum kSenseDefaultSize @discussion The default size for SCSI Request Sense data. */ enum { kSenseDefaultSize = 18 }; /*! @struct SCSI_Sense_Data @discussion The basic SCSI Request Sense data structure. */ typedef struct SCSI_Sense_Data { UInt8 VALID_RESPONSE_CODE; // 7 = Valid. 6-0 = Response Code. UInt8 SEGMENT_NUMBER; // Segment number UInt8 SENSE_KEY; // 7 = FILEMARK, 6 = EOM, 5 = ILI, 3-0 = SENSE KEY. UInt8 INFORMATION_1; // INFORMATION. UInt8 INFORMATION_2; // INFORMATION. UInt8 INFORMATION_3; // INFORMATION. UInt8 INFORMATION_4; // INFORMATION. UInt8 ADDITIONAL_SENSE_LENGTH; // Number of additional bytes available in sense data UInt8 COMMAND_SPECIFIC_INFORMATION_1; // Command Specific Information UInt8 COMMAND_SPECIFIC_INFORMATION_2; // Command Specific Information UInt8 COMMAND_SPECIFIC_INFORMATION_3; // Command Specific Information UInt8 COMMAND_SPECIFIC_INFORMATION_4; // Command Specific Information UInt8 ADDITIONAL_SENSE_CODE; // Additional Sense Code UInt8 ADDITIONAL_SENSE_CODE_QUALIFIER; // Additional Sense Code Qualifier UInt8 FIELD_REPLACEABLE_UNIT_CODE; // Field Replaceable Unit Code UInt8 SKSV_SENSE_KEY_SPECIFIC_MSB; // 7 = Sense Key Specific Valid bit, 6-0 Sense Key Specific MSB UInt8 SENSE_KEY_SPECIFIC_MID; // Sense Key Specific Middle UInt8 SENSE_KEY_SPECIFIC_LSB; // Sense Key Specific LSB } SCSI_Sense_Data; /*! @enum Sense Valid @discussion Masks to use to determine if sense data is valid or not. @constant kSENSE_DATA_VALID Sense data is valid. @constant kSENSE_NOT_DATA_VALID Sense data is not valid. @constant kSENSE_DATA_VALID_Mask Validity mask to use when checking the VALID_RESPONSE_CODE field. */ enum { kSENSE_DATA_VALID = 0x80, kSENSE_NOT_DATA_VALID = 0x00, kSENSE_DATA_VALID_Mask = 0x80 }; /*! @enum Sense Response Codes @discussion Masks and values to determine the Response Code. @constant kSENSE_RESPONSE_CODE_Current_Errors Response code indicating current errors are reported. @constant kSENSE_RESPONSE_CODE_Deferred_Errors Response code indicating deferred errors are reported. @constant kSENSE_RESPONSE_CODE_Mask Mask to use when checking the VALID_RESPONSE_CODE field. */ enum { kSENSE_RESPONSE_CODE_Current_Errors = 0x70, kSENSE_RESPONSE_CODE_Deferred_Errors = 0x71, kSENSE_RESPONSE_CODE_Mask = 0x7F }; /*! @enum FILEMARK bit field definitions @discussion Masks and values to determine the FileMark bit field. @constant kSENSE_FILEMARK_Set Filemark bit is set. @constant kSENSE_FILEMARK_Not_Set Filemark bit is not set. @constant kSENSE_FILEMARK_Mask Mask to use when checking the SENSE_KEY field for the FILEMARK bit. */ enum { kSENSE_FILEMARK_Set = 0x80, kSENSE_FILEMARK_Not_Set = 0x00, kSENSE_FILEMARK_Mask = 0x80 }; /*! @enum EOM bit field definitions @discussion Masks and values to determine the End Of Medium bit field. @constant kSENSE_EOM_Set End Of Medium bit is set. @constant kSENSE_EOM_Not_Set End Of Medium bit is not set. @constant kSENSE_EOM_Mask Mask to use when checking the SENSE_KEY field for the EOM bit. */ enum { kSENSE_EOM_Set = 0x40, kSENSE_EOM_Not_Set = 0x00, kSENSE_EOM_Mask = 0x40 }; /*! @enum ILI bit field definitions @discussion Masks and values to determine the Incorrect Length Indicator bit field. @constant kSENSE_ILI_Set Incorrect Length Indicator bit is set. @constant kSENSE_ILI_Not_Set Incorrect Length Indicator bit is not set. @constant kSENSE_ILI_Mask Mask to use when checking the SENSE_KEY field for the ILI bit. */ enum { kSENSE_ILI_Set = 0x20, kSENSE_ILI_Not_Set = 0x00, kSENSE_ILI_Mask = 0x20 }; /*! @enum Sense Key definitions @discussion Masks and values to determine the SENSE_KEY. @constant kSENSE_KEY_NO_SENSE No sense data is present. @constant kSENSE_KEY_RECOVERED_ERROR A recovered error has occurred. @constant kSENSE_KEY_NOT_READY Device server is not ready. @constant kSENSE_KEY_MEDIUM_ERROR Device server detected a medium error. @constant kSENSE_KEY_HARDWARE_ERROR Device server detected a hardware error. @constant kSENSE_KEY_ILLEGAL_REQUEST Device server detected an illegal request. @constant kSENSE_KEY_UNIT_ATTENTION Device server indicates a unit attention condition. @constant kSENSE_KEY_DATA_PROTECT Device server indicates a data protect condition. @constant kSENSE_KEY_BLANK_CHECK Device server indicates a blank check condition. @constant kSENSE_KEY_VENDOR_SPECIFIC Device server indicates a vendor specific condition. @constant kSENSE_KEY_COPY_ABORTED Device server indicates a copy aborted condition. @constant kSENSE_KEY_ABORTED_COMMAND Device server indicates an aborted command condition. @constant kSENSE_KEY_VOLUME_OVERFLOW Device server indicates a volume overflow condition. @constant kSENSE_KEY_MISCOMPARE Device server indicates a miscompare condition. @constant kSENSE_KEY_Mask Mask to use when checking the SENSE_KEY field for the SENSE_KEY value. */ enum { kSENSE_KEY_NO_SENSE = 0x00, kSENSE_KEY_RECOVERED_ERROR = 0x01, kSENSE_KEY_NOT_READY = 0x02, kSENSE_KEY_MEDIUM_ERROR = 0x03, kSENSE_KEY_HARDWARE_ERROR = 0x04, kSENSE_KEY_ILLEGAL_REQUEST = 0x05, kSENSE_KEY_UNIT_ATTENTION = 0x06, kSENSE_KEY_DATA_PROTECT = 0x07, kSENSE_KEY_BLANK_CHECK = 0x08, kSENSE_KEY_VENDOR_SPECIFIC = 0x09, kSENSE_KEY_COPY_ABORTED = 0x0A, kSENSE_KEY_ABORTED_COMMAND = 0x0B, /* SENSE KEY 0x0C is obsoleted */ kSENSE_KEY_VOLUME_OVERFLOW = 0x0D, kSENSE_KEY_MISCOMPARE = 0x0E, /* SENSE KEY 0x0F is reserved */ kSENSE_KEY_Mask = 0x0F }; #endif /* _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIProtocolInterface.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PROTOCOL_INTERFACE_H_ #define _IOKIT_IO_SCSI_PROTOCOL_INTERFACE_H_ /*! @header SCSI Protocol Interface @discussion This file contains definitions for the IOSCSIProtocolInterface class, SCSI Protocol Features used by this interface, and additional constants used by this interface. */ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #include <IOKit/storage/IOStorageDeviceCharacteristics.h> #include <TargetConditionals.h> //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- /* SCSI Device Characteristics - Defined between SCSI Application Layer and SCSI Protocol Layer only. */ /*! @constant kIOPropertySCSIDeviceCharacteristicsKey @discussion This key is used to define SCSI Device Characteristics for a particular device. It is the key for the dictionary containing the keys of characteristics. These keys are only defined between the SCSI Protocol Layer and the SCSI Applicaiton Layer. Some properties may be copied from this dictionary to the more generic Device Characteristics or Protocol Characteristics dictionaries. */ #define kIOPropertySCSIDeviceCharacteristicsKey "SCSI Device Characteristics" /*! @constant kIOPropertySCSIInquiryLengthKey @discussion This key is used to define a default INQUIRY length to issue to the device. The value is a UInt32 corresponding to the number of bytes to request in the INQUIRY command. */ #define kIOPropertySCSIInquiryLengthKey "Inquiry Length" /*! @constant kIOPropertySCSIManualEjectKey @discussion This key is used to indicate that the device is known to be a manual ejectable media device. This property overrides all of the driver checks for determining this capability. This property is a string, although if it exists it should always be true. */ #define kIOPropertySCSIManualEjectKey "Manual Eject" /*! @constant kIOPropertyReadTimeOutDurationKey @discussion This key is used to define the Read Time Out for a particular device. This property overrides all of the protocol defaults. This property is a value, in milliseconds. */ #define kIOPropertyReadTimeOutDurationKey "Read Time Out Duration" /*! @constant kIOPropertyWriteTimeOutDurationKey @discussion This key is used to define the Write Time Out for a particular device. This property overrides all of the protocol defaults. This property is a value, in milliseconds. */ #define kIOPropertyWriteTimeOutDurationKey "Write Time Out Duration" /*! @constant kIOPropertyRetryCountKey @discussion This key is used to define the number of Read/Write retries for a particular device. This property overrides all of the protocol defaults. The value is a UInt32 corresponding to the number of retries. */ #define kIOPropertyRetryCountKey "Retry Count" /*! @constant kIOPropertyAutonomousSpinDownKey @discussion This key is used to indicate that the device is known to have its own internal logic for idle disk spin down. This key is used to mark device which respond poorly to our efforts to manually spin down or spin up the device when it is already in the desired state. */ #define kIOPropertyAutonomousSpinDownKey "Autonomous Spin Down" /*! @constant kIOPropertyDoNotPreventMediumRemovalKey @discussion This key is used to indicate that the device either does not require or respond well to PREVENT_ALLOW_MEDIUM_REMOVAL. This property indicates that the PREVENT_ALLOW_MEDIUM_REMOVAL should not be used with the specified device. */ #define kIOPropertyDoNotPreventMediumRemovalKey "Do Not Prevent Medium Removal" /*! @constant kIOPropertyEjectRequireStartStopUnitKey @discussion This key is used to indicate that while the device may have failed PREVENT_ALLOW_MEDIUM REMOVAL it still requires a START_STOP_UNIT to eject/unload media. */ #define kIOPropertyEjectRequireStartStopUnitKey "Eject Requires START_STOP_UNIT" /*! @constant kIOPropertyRequiresRestartEjectKey @discussion This key is used to indicate that the device requires a START_STOP_UNIT to eject the device's media prior to restarting to ensuring proper function at next boot cycle. */ #define kIOPropertyRequiresRestartEjectKey "Require Restart Eject" /*! @constant kIOPropertyNoSenseDebounceRetries @discussion This key is used to indicate how many retries a device may require when it reports NO_SENSE/NO_ADITIONAL_SENSE_INFORMATION as a response to a REQUEST_SENSE. */ #define kIOPropertyNoSenseDebounceRetries "NO_SENSE Debounce Retries" #if defined(KERNEL) && defined(__cplusplus) /*! @constant kCFBundleIdentifierKey @discussion Property key for CFBundleIdentifier. */ #define kCFBundleIdentifierKey "CFBundleIdentifier" /*! @constant kIOSCSIArchitectureBundleIdentifierKey @discussion IOSCSIArchitectureModelFamily's CFBundle identifier. */ #define kIOSCSIArchitectureBundleIdentifierKey "com.apple.iokit.IOSCSIArchitectureModelFamily" // General kernel headers #include <kern/thread.h> // General IOKit headers #include <IOKit/IOLib.h> #include <IOKit/IOService.h> #include <IOKit/IOCommandGate.h> #include <IOKit/IOWorkLoop.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/SCSITask.h> /*! @enum SCSI Protocol Interface Device Notification values @discussion Message values for SCSI Protocol Interface Device Notifications. @constant kSCSIProtocolNotification_DeviceRemoved Private message sent between a SCSI protocol service provider and SCSI application layer driver to indicate device removal. @constant kSCSIProtocolNotification_VerifyDeviceState Private message sent between a SCSI protocol service provider and SCSI application layer driver to indicate device state may have changed and the device state should be re-verified by the SCSI Application Layer driver. An example would be a bus reset which clears the tray locking state of an ATAPI device. @constant kSCSIServicesNotification_ExclusivityChanged Message sent when a change in exclusivity state occurs. Usually in response to acquiring/releasing exclusive access to a device via a user client. @constant kSCSIProtocolNotification_ForcePowerDown Message sent between a SCSI protocol service provider and SCSI application layer driver to initiate transition to the lowest power state. @constant kSCSIProtocolNotification_ForcePowerUp Message sent between a SCSI protocol service provider and SCSI application layer driver to initiate transition to the highest power state. */ enum { kSCSIProtocolNotification_DeviceRemoved = 0x69000010, kSCSIProtocolNotification_VerifyDeviceState = 0x69000020, kSCSIServicesNotification_ExclusivityChanged = 0x69000030, kSCSIProtocolNotification_ForcePowerDown = 0x69000040, kSCSIProtocolNotification_ForcePowerUp = 0x69000050 }; /*! @typedef SCSIProtocolFeature @discussion Typedef for SCSIProtocolFeature, a 32-bit quantity. */ typedef UInt32 SCSIProtocolFeature; /*! @enum SCSI Protocol Features @discussion The list of SCSI Protocol Features currently supported. */ enum { /*! @constant kSCSIProtocolFeature_ACA Not yet used. */ kSCSIProtocolFeature_ACA = 1, /*! @constant kSCSIProtocolFeature_CPUInDiskMode Used to determine if the SCSI Protocol Services Driver supports a CPU which is in target disk mode. */ kSCSIProtocolFeature_CPUInDiskMode = 2, /*! @constant kSCSIProtocolFeature_ProtocolSpecificPolling Used to determine if the SCSI Protocol Services Driver supports protocol specific polling for media. This is used for low-power polling specifically for ATAPI devices on ATA buses */ kSCSIProtocolFeature_ProtocolSpecificPolling = 3, /*! @constant kSCSIProtocolFeature_ProtocolSpecificSleepCommand Used to determine if the SCSI Protocol Services Driver supports protocol specific sleep commands to a drive. This is used for sleeping drives specifically ATAPI devices on ATA buses. */ kSCSIProtocolFeature_ProtocolSpecificSleepCommand = 4, /*! @constant kSCSIProtocolFeature_GetMaximumLogicalUnitNumber If the SCSI Protocol Services Driver supports logical units, it will report the maximum addressable ID that it supports in the UInt32 pointer that is passed in as the serviceValue. If only one unit is supported, the driver should return false for this query. */ kSCSIProtocolFeature_GetMaximumLogicalUnitNumber = 5, /*! @constant kSCSIProtocolFeature_MaximumReadBlockTransferCount If the SCSI Protocol Services Driver has a maximum number of blocks that can be transfered in a read request, it will return true to this query and return the block count in the UInt32 pointer that is passed in as the serviceValue. */ kSCSIProtocolFeature_MaximumReadBlockTransferCount = 6, /*! @constant kSCSIProtocolFeature_MaximumWriteBlockTransferCount If the SCSI Protocol Services Driver has a maximum number of blocks that can be transferred in a write request, it will return true to this query and return the block count in the UInt32 pointer that is passed in as the serviceValue. */ kSCSIProtocolFeature_MaximumWriteBlockTransferCount = 7, /*! @constant kSCSIProtocolFeature_MaximumReadTransferByteCount If the SCSI Protocol Services Driver has a maximum byte count that can be transferred in a read request, it will return true to this query and return the byte count in the UInt64 pointer that is passed in as the serviceValue. */ kSCSIProtocolFeature_MaximumReadTransferByteCount = 8, /*! @constant kSCSIProtocolFeature_MaximumWriteTransferByteCount If the SCSI Protocol Services Driver has a maximum byte count that can be transferred in a write request, it will return true to this query and return the byte count in the UInt64 pointer that is passed in as the serviceValue. */ kSCSIProtocolFeature_MaximumWriteTransferByteCount = 9, /*! @constant kSCSIProtocolFeature_SubmitDefaultInquiryData If the SCSI Protocol Services Driver needs any extra information to make any negotiation settings from the standard INQUIRY data, this will be called to set that appropriately. The serviceValue will point to a SCSICmd_INQUIRY_StandardData buffer. The size of the buffer depends on the SCSI Device Characteristics dictionary for the device or bus. If there is no kIOPropertySCSIInquiryLengthKey value set in the dictionary or if it doesn't exist, then the size of the data will be the size of the full amount of Inquiry retrieved from the device. */ kSCSIProtocolFeature_SubmitDefaultInquiryData = 10, /*! @constant kSCSIProtocolFeature_ProtocolAlwaysReportsAutosenseData If the SCSI Protocol Services Driver always reports available autosense data when a kSCSITaskStatus_CHECK_CONDITION is set, then the protocol layer should return true. E.g. FireWire transport drivers should respond true to this. */ kSCSIProtocolFeature_ProtocolAlwaysReportsAutosenseData = 11, /*! @constant kSCSIProtocolFeature_ProtocolSpecificPowerOff If the SCSI Protocol Services Driver supports removing the power to the drive, then the protocol layer should return true. This is used for aggressive power management, specifically for ATAPI devices on ATA buses. */ kSCSIProtocolFeature_ProtocolSpecificPowerOff = 12, /*! @constant kSCSIProtocolFeature_ProtocolSpecificPowerControl Used to determine if the SCSI Protocol Services Driver supports switching the power to the drive on and off. This is used for aggressive power management, specifically for SATAPI devices on AHCI buses. */ kSCSIProtocolFeature_ProtocolSpecificPowerControl = 13, /*! @constant kSCSIProtocolFeature_ProtocolSpecificAsyncNotification Used to determine if the SCSI Protocol Services Driver supports asynchronous notifications from the drive. This is used to prevent polling for media, specifically for SATAPI devices on AHCI buses. */ kSCSIProtocolFeature_ProtocolSpecificAsyncNotification = 14, /*! kSCSIProtocolFeature_HierarchicalLogicalUnits: If the SCSI Protocol Services layer supports hierarchical logical units, then the protocol services layer should report true and use IOSCSIProtocolServices::GetLogicalUnitBytes() to retrieve the full 8 bytes of LUN information. */ kSCSIProtocolFeature_HierarchicalLogicalUnits = 15, /*! kSCSIProtocolFeature_MultiPathing: If the SCSI Protocol Services layer supports multi-pathing, then the protocol services layer should report true. This is used to support multiple paths to a logical unit by creating a IOSCSIMultipathedLogicalUnit object. */ kSCSIProtocolFeature_MultiPathing = 16, /*! kSCSIProtocolFeature_ProtocolSpecificLinkRetrain: If the SCSI Protocol Services layer supports link retrain, then the protocol services layer should report true. */ kSCSIProtocolFeature_ProtocolSpecificLinkRetrain = 17 }; /*! @typedef SCSIProtocolPowerState @discussion Typedef for SCSIProtocolPowerState, a 32-bit quantity. */ typedef UInt32 SCSIProtocolPowerState; /*! @enum SCSI Protocol Power States @discussion The list of SCSI Protocol Power States. */ enum { /*! @constant kSCSIProtocolPowerStateOff Off power state. */ kSCSIProtocolPowerStateOff = 0, /*! @constant kSCSIProtocolPowerStateOn On power state. */ kSCSIProtocolPowerStateOn = 1 }; //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- /*! @class IOSCSIProtocolInterface @superclass IOService @discussion This class defines the public SCSI Protocol Layer API for any class that provides Protocol services or needs to provide the Protocol Service API for passing service requests to a Protocol Service driver. */ class __exported IOSCSIProtocolInterface : public IOService { OSDeclareAbstractStructors ( IOSCSIProtocolInterface ) public: /*! @function init @abstract Initializes generic IOService data structures (expansion data, etc). */ virtual bool init( OSDictionary * dictionary = 0 ) APPLE_KEXT_OVERRIDE; /*! @function start @abstract During an IOService object's instantiation, starts the IOService object that has been selected to run on the provider. @discussion See IOService.h for details. @result <code>true</code> if the start was successful; <code>false</code> otherwise (which will cause the instance to be detached and usually freed). */ virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; /*! @function free @abstract Called to release all resources held by the object. @discussion Release all resources held by the object, then call super::free(). */ virtual void free ( void ) APPLE_KEXT_OVERRIDE; /*! @function willTerminate @abstract Passes a termination up the stack. @discussion Notification that a provider has been terminated, sent before recursing up the stack, in root-to-leaf order. @param provider The terminated provider of this object. @param options Options originally passed to terminate(). @result <code>true</code>. */ virtual bool willTerminate ( IOService * provider, IOOptionBits options ) APPLE_KEXT_OVERRIDE; /*! @function GetUserClientExclusivityState @abstract Gets the current exclusivity state of the user client. @discussion The GetUserClientExclusivityState() method is called by the SCSITaskUserClient to determine if any user client is holding exclusive access at the current time. This is simply a preflight check and a return value of <code>false</code> does not guarantee that a subsequent call to SetUserClientExclusivityState() will return successfully. @result <code>true</code> if a user client is in exclusive control of the device, <code>false</code> otherwise. */ virtual bool GetUserClientExclusivityState ( void ); /*! @function SetUserClientExclusivityState @abstract Sets the current exclusivity state of the user client. @discussion The SetUserClientExclusivityState() method is called by the SCSITaskUserClient to set the exclusive access mode. @param userClient The instance of SCSITaskUserClient for which to change exclusivity state. @param state Exclusivity state. <code>true</code> means exclusive access is desired, <code>false</code> means exclusive access is being released. @result A valid IOReturn code indicating success or the type of failure. */ virtual IOReturn SetUserClientExclusivityState ( IOService * userClient, bool state ); /*! @function initialPowerStateForDomainState @abstract Determines which power state a device is in, given the current power domain state. @discussion Power management calls this method once, when the driver is initializing power management. Subclasses should not need to override this method. @param flags Flags that describe the character of "domain power"; they represent the <code>outputPowerCharacter</code> field of a state in the power domain's power state array. @result A state number. */ virtual unsigned long initialPowerStateForDomainState ( IOPMPowerFlags flags ) APPLE_KEXT_OVERRIDE; /*! @function setPowerState @abstract Requests a power managed driver to change the power state of its device. @discussion Requests a power managed driver to change the power state of its device. Most subclasses of IOSCSIProtocolInterface have class-specific mechanisms and should not override this routine. See IOSCSIProtocolServices.h, IOSCSIBlockCommandsDevice.h, IOSCSIReducedBlockCommandsDevice.h, and IOSCSIMultimediaCommandsDevice.h for more information about power management changes. Subclasses should not need to override this method. @param powerStateOrdinal The number in the power state array to which the drive is being instructed to change. @param whichDevice A pointer to the power management object which registered to manage power for this device. The whichDevice field is not pertinent to us since the driver is both the "policy maker" for the device, and the "policy implementor" for the device. @result See IOService.h for details. */ virtual IOReturn setPowerState ( unsigned long powerStateOrdinal, IOService * whichDevice ) APPLE_KEXT_OVERRIDE; /*! @function IsPowerManagementIntialized @abstract Called to determine if power management is initialized. @discussion Called to determine if power management is initialized. Subclasses should not need to override this method. @result <code>true</code> if power management has been initialized, <code>false</code> otherwise. */ virtual bool IsPowerManagementIntialized ( void ); /*! @function CheckPowerState @abstract Called by clients to ensure device is in correct power state before issuing I/O. @discussion Called by clients to ensure device is in correct power state before issuing I/O. If the device is not ready to handle such requests, it gives the driver a chance to block the thread until the device is ready. Subclasses should not need to override this method. */ virtual void CheckPowerState ( void ); /*! @function ExecuteCommand @abstract Called to send a SCSITask and transport it across the physical wire(s) to the device. @discussion Called to send a SCSITask and transport it across the physical wire(s) to the device. Subclasses internal to IOSCSIArchitectureModelFamily will need to override this method. Third party subclasses should not need to override this method. @param request A valid SCSITaskIdentifier representing the task to transport across the wire(s). */ virtual void ExecuteCommand ( SCSITaskIdentifier request ) = 0; /*! @function AbortCommand @abstract Obsolete. Do not use this method. @discussion Obsolete. Do not use this method. */ virtual SCSIServiceResponse AbortCommand ( SCSITaskIdentifier request ) = 0; /*! @function IsProtocolServiceSupported @abstract This method is called to query for support of a protocol specific service feature. @discussion This method is called to query for support of a protocol specific service feature. Subclasses of IOSCSIProtocolServices should override this method. @param feature A valid SCSIProtocolFeature. See enums for SCSIProtocolFeature. @param serviceValue A pointer to a structure/value that is used in conjunction with the feature requested. See enums for SCSIProtocolFeature. NB: This parameter may be NULL for certain feature requests. @result <code>true</code> if the feature is supported, <code>false</code> otherwise. */ virtual bool IsProtocolServiceSupported ( SCSIProtocolFeature feature, void * serviceValue ) = 0; /*! @function HandleProtocolServiceFeature @abstract This method is called to enact support of a protocol specific service feature. @discussion This method is called to enact support of a protocol specific service feature. Subclasses of IOSCSIProtocolServices should override this method. @param feature A valid SCSIProtocolFeature. See enums for SCSIProtocolFeature. @param serviceValue A pointer to a structure/value that is used in conjunction with the feature requested. See enums for SCSIProtocolFeature. NB: This parameter may be NULL for certain feature requests. @result <code>true</code> if the service feature request succeeded, <code>false</code> otherwise. */ virtual bool HandleProtocolServiceFeature ( SCSIProtocolFeature feature, void * serviceValue ) = 0; protected: // Reserve space for future expansion. struct IOSCSIProtocolInterfaceExpansionData { IOWorkLoop * fWorkLoop; UInt64 fPowerStateChangeStartTime; UInt64 fLastCommandTime; }; IOSCSIProtocolInterfaceExpansionData * fIOSCSIProtocolInterfaceReserved; // ------ Power Management Support ------ thread_call_t fPowerManagementThread; IOCommandGate * fCommandGate; UInt32 fCurrentPowerState; UInt32 fProposedPowerState; bool fPowerTransitionInProgress; bool fPowerAckInProgress; bool fPowerManagementInitialized; /*! @function GetCommandGate @abstract Accessor method to obtain the IOCommandGate. @discussion Accessor method to obtain the IOCommandGate. @result The IOCommandGate for this instance. May return NULL. */ IOCommandGate * GetCommandGate ( void ); /*! @function InitializePowerManagement @abstract This method is called to initialize power management. @discussion This method is called to initialize power management. It will call PMinit(), joinPMTree(), and makeUsable(). This method does not call registerPowerDriver(). Subclasses may override this method to change the behavior (such as the number of power states). @param provider The power management provider (i.e. the provider to attach to in the PowerManagement tree). This may be a device that is not in the PM Tree itself, in which case, the IOService plane is traversed towards the root node in an effort to find a node in the PM Tree. */ virtual void InitializePowerManagement ( IOService * provider ); /*! @function GetInitialPowerState @abstract This method is called to obtain the initial power state of the device (usually the highest). @discussion This method is called to obtain the initial power state of the device (usually the highest). Subclasses must override this method. @result A power state ordinal. */ virtual UInt32 GetInitialPowerState ( void ) = 0; /*! @function finalize @abstract Finalizes the destruction of an IOService object. @discussion See IOService.h Subclasses may override this method, but should call super::finalize(). @result <code>true</code>. */ virtual bool finalize ( IOOptionBits options ) APPLE_KEXT_OVERRIDE; /*! @function sHandleSetPowerState @abstract The sHandleSetPowerState method is a static function used as C->C++ glue for going behind the command gate. @discussion The sHandleSetPowerState method is a static function used as C->C++ glue for going behind the command gate. @param self The 'this' pointer for the class. @param powerStateOrdinal The power state to which device shall be changed. @result A valid IOReturn code indicating success or failure. */ static IOReturn sHandleSetPowerState ( IOSCSIProtocolInterface * self, UInt32 powerStateOrdinal ); /*! @function sGetPowerTransistionInProgress @abstract The sGetPowerTransistionInProgress method is a static function used as C->C++ glue for going behind the command gate. @discussion The sGetPowerTransistionInProgress method is a static function used as C->C++ glue for going behind the command gate. @param self The 'this' pointer for the class. @result <code>true</code> if a power state is in progress, otherwise <code>false</code>. */ static bool sGetPowerTransistionInProgress ( IOSCSIProtocolInterface * self ); /*! @function HandleSetPowerState @abstract The HandleSetPowerState method is called by the glue code and is on the serialized side of the command gate. @discussion The HandleSetPowerState method is called by the glue code and is on the serialized side of the command gate. This allows us to touch any member variables as necessary without any multi-threading issues. Subclasses may override this method to change behavior. Third party subclasses should not need to override this method, but may. @param powerStateOrdinal The power state to which device shall be changed. */ virtual void HandleSetPowerState ( UInt32 powerStateOrdinal ); /*! @function sPowerManagement @abstract The sPowerManagement method is a static C-function which is called using mach's thread_call API. It guarantees us a thread of execution which is different than the power management thread and the workloop thread on which we can issue commands to the device synchronously or asynchronously without worrying about deadlocks. It calls through to HandlePowerChange, which is a state machine used to direct power management. @discussion The sPowerManagement method is a static C-function which is called using mach's thread_call API. It guarantees us a thread of execution which is different than the power management thread and the workloop thread on which we can issue commands to the device synchronously or asynchronously without worrying about deadlocks. It calls through to HandlePowerChange, which is a state machine used to direct power management. @param whichDevice The 'this' pointer. */ static void sPowerManagement ( thread_call_param_t whichDevice ); /*! @function HandlePowerChange @abstract The HandlePowerChange method is pure virtual and is left to each protocol or application layer driver to implement. It is guaranteed to be called on its own thread of execution and can make synchronous or asynchronous calls. @discussion The HandlePowerChange method is pure virtual and is left to each protocol or application layer driver to implement. It is guaranteed to be called on its own thread of execution and can make synchronous or asynchronous calls. Subclasses must override this method. Third party subclasses shouldn't need to override this method but can to alter the default behavior. */ virtual void HandlePowerChange ( void ) = 0; /*! @function sHandleCheckPowerState @abstract The sHandleCheckPowerState method is a static function used as C->C++ glue for going behind the command gate. @discussion The sHandleCheckPowerState method is a static function used as C->C++ glue for going behind the command gate. @param self The 'this' pointer for the class. */ static void sHandleCheckPowerState ( IOSCSIProtocolInterface * self ); /*! @function HandleCheckPowerState(void) @abstract The HandleCheckPowerState (void) method is on the serialized side of the command gate and can change member variables safely without multi-threading issues. It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state the class registered with. @discussion The HandleCheckPowerState (void) method is on the serialized side of the command gate and can change member variables safely without multi-threading issues. It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state the class registered with. Subclasses must override this method. Third party subclasses shouldn't need to override this method but can to alter the default behavior. */ virtual void HandleCheckPowerState ( void ) = 0; /*! @function HandleCheckPowerState(UInt32 maxPowerState) @abstract The HandleCheckPowerState(UInt32 maxPowerState) method is called by the subclasses and is passed the maxPowerState number given to the power manager at initialization time. This guarantees the threads block until that power state has been achieved. @discussion The HandleCheckPowerState(UInt32 maxPowerState) method is called by the subclasses and is passed the maxPowerState number given to the power manager at initialization time. This guarantees the threads block until that power state has been achieved. @param maxPowerState The maximum power state in the power state array. */ void HandleCheckPowerState ( UInt32 maxPowerState ); /*! @function TicklePowerManager(void) @abstract The TicklePowerManager(void) method is called by CheckPowerState and sends an activity tickle to the power manager so that the idle timer is reset. @discussion The TicklePowerManager(void) method is called by CheckPowerState and sends an activity tickle to the power manager so that the idle timer is reset. Subclasses must override this method. Third party subclasses shouldn't need to override this method but can to alter the default behavior. */ virtual void TicklePowerManager ( void ) = 0; /*! @function TicklePowerManager(UInt32 maxPowerState) @abstract The TicklePowerManager(UInt32 maxPowerState) method is a convenience function which can be called by subclasses in TicklePowerManager (void) in order to tell the power manager to reset idle timer or bring the device into the requested state. It returns whatever is returned by activityTickle (true if device is in the requested state, false if it is not). @discussion The TicklePowerManager(UInt32 maxPowerState) method is a convenience function which can be called by subclasses in TicklePowerManager(void) in order to tell the power manager to reset idle timer or bring the device into the requested state. It returns whatever is returned by activityTickle (true if device is in the requested state, false if it is not). @param maxPowerState The maximum power state in the power state array. @result The result of the call to activityTickle(). See IOService.h for details. */ bool TicklePowerManager ( UInt32 maxPowerState ); // ------ User Client Support ------ bool fUserClientExclusiveControlled; IOService * fUserClient; /*! @function sGetUserClientExclusivityState @abstract The sGetUserClientExclusivityState method is a static function used as C->C++ glue for going behind the command gate. @discussion The sGetUserClientExclusivityState method is a static function used as C->C++ glue for going behind the command gate. @param self The 'this' pointer for the class. @param state A pointer to a bool in which the state should be set. */ static void sGetUserClientExclusivityState ( IOSCSIProtocolInterface * self, bool * state ); /*! @function sSetUserClientExclusivityState @abstract The sSetUserClientExclusivityState method is a static function used as C->C++ glue for going behind the command gate. @discussion The sSetUserClientExclusivityState method is a static function used as C->C++ glue for going behind the command gate. @param self The 'this' pointer for the class. @param result A pointer to an IOReturn for the resulting status. @param userClient The instance of SCSITaskUserClient for which to change exclusivity state. @param state A bool indicating the desired state to set. */ static void sSetUserClientExclusivityState ( IOSCSIProtocolInterface * self, IOReturn * result, IOService * userClient, bool state ); /*! @function HandleGetUserClientExclusivityState @abstract Gets the current exclusivity state of the user client. @discussion The HandleGetUserClientExclusivityState() method is called on the serialized side of the command gate to determine if any user client is holding exclusive access at the current time. See discussion for GetUserClientExclusivityState(). Subclasses may override this method to alter default behavior. Third party subclasses should not need to override this method. @result <code>true</code> if a user client is in exclusive control of the device, <code>false</code> otherwise. */ virtual bool HandleGetUserClientExclusivityState ( void ); /*! @function HandleSetUserClientExclusivityState @abstract Sets the current exclusivity state of the user client. @discussion The HandleSetUserClientExclusivityState() method is called on the serialized side of the command gate to set the exclusive access mode. @param userClient The instance of SCSITaskUserClient for which to change exclusivity state. @param state Exclusivity state. <code>true</code> means exclusive access is desired, <code>false</code> means exclusive access is being released. @result A valid IOReturn code indicating success or the type of failure. */ virtual IOReturn HandleSetUserClientExclusivityState ( IOService * userClient, bool state ); /*! @function ResetPowerStateChangeTimer @abstract Resets the power state change timer counter. @discussion The ResetPowerStateChangeTimer() method is called every time a new power state transition begins. */ void ResetPowerStateChangeTimer ( void ); /*! @function CheckForSufficientTimeForPMCommand @abstract Checks if there's time remaining before sending a command. @discussion The CheckForSufficientTimeForPMCommand() method is called whenever a command with a timeout is about to be sent. It checks if the time remaining in what was requested to the PM subsystem, whether it can accommodate the command's maximum round trip time i.e., the timeout specified. @param timeoutDuration The timeout specified for the command. @result <code>true</code> if the command's timeout can be accommodated before the PM request times out. */ bool CheckForSufficientTimeForPMCommand ( UInt32 timeoutDuration ); public: // ------- SCSI Architecture Model Task Management Functions ------ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolInterface, 1 ); /*! @function AbortTask @abstract Aborts a task based on the Logical Unit and tagged task identifier. @discussion Aborts a task based on the Logical Unit and tagged task identifier. Subclasses must override this method. Third party subclasses should not need to override this method. @param theLogicalUnit This value should be zero unless the device driver is more complex and managing multiple Logical Units. @param theTag A valid SCSITaggedTaskIdentifier representing an outstanding SCSITask. @result A valid SCSIServiceResponse code. */ virtual SCSIServiceResponse AbortTask ( UInt8 theLogicalUnit, SCSITaggedTaskIdentifier theTag ) = 0; OSMetaClassDeclareReservedUsed ( IOSCSIProtocolInterface, 2 ); /*! @function AbortTaskSet @abstract Aborts a task set based on the Logical Unit. @discussion Aborts a task set based on the Logical Unit. Subclasses must override this method. Third party subclasses should not need to override this method. @param theLogicalUnit This value should be zero unless the device driver is more complex and managing multiple Logical Units. @result A valid SCSIServiceResponse code. */ virtual SCSIServiceResponse AbortTaskSet ( UInt8 theLogicalUnit ) = 0; OSMetaClassDeclareReservedUsed ( IOSCSIProtocolInterface, 3 ); /*! @function ClearACA @abstract Clears an Auto-Contingent Allegiance (ACA) for the specified Logical Unit. @discussion Clears an Auto-Contingent Allegiance (ACA) for the specified Logical Unit. Subclasses must override this method. Third party subclasses should not need to override this method. @param theLogicalUnit This value should be zero unless the device driver is more complex and managing multiple Logical Units. @result A valid SCSIServiceResponse code. */ virtual SCSIServiceResponse ClearACA ( UInt8 theLogicalUnit ) = 0; OSMetaClassDeclareReservedUsed ( IOSCSIProtocolInterface, 4 ); /*! @function ClearTaskSet @abstract Clears a task set for the specified Logical Unit. @discussion Clears a task set for the specified Logical Unit. Subclasses must override this method. Third party subclasses should not need to override this method. @param theLogicalUnit This value should be zero unless the device driver is more complex and managing multiple Logical Units. @result A valid SCSIServiceResponse code. */ virtual SCSIServiceResponse ClearTaskSet ( UInt8 theLogicalUnit ) = 0; OSMetaClassDeclareReservedUsed ( IOSCSIProtocolInterface, 5 ); /*! @function LogicalUnitReset @abstract Resets the specified Logical Unit. @discussion Resets the specified Logical Unit. Subclasses must override this method. Third party subclasses should not need to override this method. @param theLogicalUnit This value should be zero unless the device driver is more complex and managing multiple Logical Units. @result A valid SCSIServiceResponse code. */ virtual SCSIServiceResponse LogicalUnitReset ( UInt8 theLogicalUnit ) = 0; OSMetaClassDeclareReservedUsed ( IOSCSIProtocolInterface, 6 ); /*! @function TargetReset @abstract Resets the target device. @discussion Resets the target device. Subclasses must override this method. Third party subclasses should not need to override this method. @result A valid SCSIServiceResponse code. */ virtual SCSIServiceResponse TargetReset ( void ) = 0; private: // Method to show that the disk spinning up in spindump stacks void __DISK_IS_ASLEEP__ ( void ) __attribute__((noinline)); #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 8 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolInterface, 16 ); #endif /* !TARGET_OS_IPHONE */ }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PROTOCOL_INTERFACE_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSICommandOperationCodes.h
/* * Copyright (c) 2001-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _SCSI_COMMAND_OPERATION_CODES_H_ #define _SCSI_COMMAND_OPERATION_CODES_H_ #pragma mark About this file /* This file contains the operation code definitions for all commands defined * by the SCSI specifications. The commands are listed in three formats: * 1) All commands are listed in alphabetical order. This list is the live * enumeration for all of the command constants. * 2) The commands are listed in ascending numerical order. * 3) The commands are grouped by Peripheral Device Type. * * In the command listings by Peripheral Device Type, there will be a comment * following each command. This comment indentifies the section of the related * specification where the commands is defined and the requirement type of the * command, Mandatory or Optional. * If a specification redefines an optional command from SPC as mandatory, * the command will be relisted in the Peripheral Device Type command list with * the mandatory tag next to it. * All commands that are listed in SPC as Device Type Specifc will be relisted * as a comment in all specifications lists that support that command with the * appropriate Mandatory or Optional tag for that specification. * * The section number and the requirement type of the command are based on the * version of the specification listed in the header comment for the Peripheral * Device Type. This data is provided for informational purposes only. The * specification document and version that the device adheres to as indicated * by the data returned in response to the INQUIRY command should be used as * the authorative source for supported and required behavior of the device. * * The SPC set is listed before all other Peripheral Device Type commands as * this is the base document from which all of the other documents are derived. * * The Peripheral Device Types and associated command sets as defined by SPC-2, * section 7.4.1 are as follows: * Peripheral Device Type Associated Command Specification * ------------------------------------ ----------------------------------- * 0x00 Direct Access Device SBC - SCSI-3 Block Commands * 0x01 Sequential Access Device SSC - SCSI-3 Stream Commands * 0x02 Printer Device SSC - SCSI-3 Stream Commands * 0x03 Processor Device SPC - SCSI Primary Commands-2 * 0x04 Write Once Device SBC - SCSI-3 Block Commands * 0x05 CD-ROM Device MMC - SCSI Multimedia Commands-2 * 0x06 Scanner Device SGC - SCSI-3 Graphics Commands * 0x07 Optical Memory Device SBC - SCSI-3 Block Commands * 0x08 Medium Changer Device SMC - SCSI-3 Medium Changer Cmds * 0x09 Communications Device SSC - SCSI-3 Stream Commands * 0x0A - 0x0B Graphic Arts Prepress Dev ASC IT8 * 0x0C Storage Array Controller Device SCC-2 - SCSI Controller Commands-2 * 0x0D Enclosure Services SES - SCSI-3 Enclosure Services * 0x0E Simplified Direct Access Device RBC - SCSI Reduced Block Commands * 0x0F Optical Card Reader/Writer Device OCRW - SCSI Specification for * Optical Card Reader/Writer * 0x10 Reserved No command specification * 0x11 Object-Based Storage Device OSD - SCSI Object Based Storage * Device Commands * 0x12 - 0x14 Reserved No command specification * 0x15 Multimedia Media Access Engine RMC - Reduced Multimedia Commands * 0x16 - 0x1E Reserved No command specification * 0x1F Unknown or No Device No command specification */ #pragma mark - #pragma mark Command Definitions by Name /* All SCSI Commands listed in alphabetical order. These are the live * definitions of the commands. All other command lists are informative. */ enum { kSCSICmd_ACCESS_CONTROL_IN = 0x86, kSCSICmd_ACCESS_CONTROL_OUT = 0x87, kSCSICmd_BLANK = 0xA1, kSCSICmd_CHANGE_DEFINITION = 0x40, kSCSICmd_CLOSE_TRACK_SESSION = 0x5B, kSCSICmd_COMPARE = 0x39, kSCSICmd_COPY = 0x18, kSCSICmd_COPY_AND_VERIFY = 0x3A, kSCSICmd_ERASE_10 = 0x2C, kSCSICmd_ERASE_12 = 0xAC, kSCSICmd_EXTENDED_COPY = 0x83, kSCSICmd_FORMAT_UNIT = 0x04, kSCSICmd_GET_CONFIGURATION = 0x46, kSCSICmd_GET_EVENT_STATUS_NOTIFICATION = 0x4A, kSCSICmd_GET_PERFORMANCE = 0xAC, kSCSICmd_INQUIRY = 0x12, kSCSICmd_LOAD_UNLOAD_MEDIUM = 0xA6, kSCSICmd_LOCK_UNLOCK_CACHE = 0x36, kSCSICmd_LOCK_UNLOCK_CACHE_16 = 0x92, kSCSICmd_LOG_SELECT = 0x4C, kSCSICmd_LOG_SENSE = 0x4D, kSCSICmd_MAINTENANCE_IN = 0xA3, kSCSICmd_MAINTENANCE_OUT = 0xA4, kSCSICmd_MECHANISM_STATUS = 0xBD, kSCSICmd_MEDIUM_SCAN = 0x38, kSCSICmd_MODE_SELECT_6 = 0x15, kSCSICmd_MODE_SELECT_10 = 0x55, kSCSICmd_MODE_SENSE_6 = 0x1A, kSCSICmd_MODE_SENSE_10 = 0x5A, kSCSICmd_MOVE_MEDIUM_ATTACHED = 0xA7, kSCSICmd_PAUSE_RESUME = 0x4B, kSCSICmd_PERSISTENT_RESERVE_IN = 0x5E, kSCSICmd_PERSISTENT_RESERVE_OUT = 0x5F, kSCSICmd_PLAY_AUDIO_10 = 0x45, kSCSICmd_PLAY_AUDIO_12 = 0xA5, kSCSICmd_PLAY_AUDIO_MSF = 0x47, kSCSICmd_PLAY_AUDIO_TRACK_INDEX = 0x48, kSCSICmd_PLAY_CD = 0xBC, kSCSICmd_PLAY_RELATIVE_10 = 0x49, kSCSICmd_PLAY_RELATIVE_12 = 0xA9, kSCSICmd_PREFETCH = 0x34, kSCSICmd_PREFETCH_16 = 0x90, kSCSICmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, kSCSICmd_READ_6 = 0x08, kSCSICmd_READ_10 = 0x28, kSCSICmd_READ_12 = 0xA8, kSCSICmd_READ_16 = 0x88, kSCSICmd_READ_ATTRIBUTE = 0x8C, kSCSICmd_READ_BUFFER = 0x3C, kSCSICmd_READ_BUFFER_CAPACITY = 0x5C, kSCSICmd_READ_CAPACITY = 0x25, kSCSICmd_READ_CD = 0xBE, kSCSICmd_READ_CD_MSF = 0xB9, kSCSICmd_READ_DEFECT_DATA_10 = 0x37, kSCSICmd_READ_DEFECT_DATA_12 = 0xB7, kSCSICmd_READ_DISC_INFORMATION = 0x51, kSCSICmd_READ_DVD_STRUCTURE = 0xAD, kSCSICmd_READ_DISC_STRUCTURE = 0xAD, kSCSICmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4, kSCSICmd_READ_FORMAT_CAPACITIES = 0x23, kSCSICmd_READ_GENERATION = 0x29, kSCSICmd_READ_HEADER = 0x44, kSCSICmd_READ_LONG = 0x3E, kSCSICmd_READ_MASTER_CUE = 0x59, kSCSICmd_READ_SUB_CHANNEL = 0x42, kSCSICmd_READ_TOC_PMA_ATIP = 0x43, kSCSICmd_READ_TRACK_INFORMATION = 0x52, kSCSICmd_READ_UPDATED_BLOCK_10 = 0x2D, kSCSICmd_REASSIGN_BLOCKS = 0x07, kSCSICmd_REBUILD = 0x81, kSCSICmd_RECEIVE = 0x08, kSCSICmd_RECEIVE_COPY_RESULTS = 0x84, kSCSICmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, kSCSICmd_REDUNDANCY_GROUP_IN = 0xBA, kSCSICmd_REDUNDANCY_GROUP_OUT = 0xBB, kSCSICmd_REGENERATE = 0x82, kSCSICmd_RELEASE_6 = 0x17, kSCSICmd_RELEASE_10 = 0x57, kSCSICmd_REPAIR_TRACK = 0x58, kSCSICmd_REPORT_DEVICE_IDENTIFIER = 0xA3, kSCSICmd_REPORT_KEY = 0xA4, kSCSICmd_REPORT_LUNS = 0xA0, kSCSICmd_REQUEST_SENSE = 0x03, kSCSICmd_RESERVE_6 = 0x16, kSCSICmd_RESERVE_10 = 0x56, kSCSICmd_RESERVE_TRACK = 0x53, kSCSICmd_REZERO_UNIT = 0x01, kSCSICmd_SCAN_MMC = 0xBA, kSCSICmd_SEARCH_DATA_EQUAL_10 = 0x31, kSCSICmd_SEARCH_DATA_EQUAL_12 = 0xB1, kSCSICmd_SEARCH_DATA_HIGH_10 = 0x30, kSCSICmd_SEARCH_DATA_HIGH_12 = 0xB0, kSCSICmd_SEARCH_DATA_LOW_10 = 0x32, kSCSICmd_SEARCH_DATA_LOW_12 = 0xB2, kSCSICmd_SEEK_6 = 0x0B, kSCSICmd_SEEK_10 = 0x2B, kSCSICmd_SEND = 0x0A, kSCSICmd_SEND_CUE_SHEET = 0x5D, kSCSICmd_SEND_DIAGNOSTICS = 0x1D, kSCSICmd_SEND_DVD_STRUCTURE = 0xBF, kSCSICmd_SEND_EVENT = 0xA2, kSCSICmd_SEND_KEY = 0xA3, kSCSICmd_SEND_OPC_INFORMATION = 0x54, kSCSICmd_SERVICE_ACTION_IN = 0x9E, kSCSICmd_SERVICE_ACTION_OUT = 0x9F, kSCSICmd_SET_CD_SPEED = 0xBB, kSCSICmd_SET_DEVICE_IDENTIFIER = 0xA4, kSCSICmd_SET_LIMITS_10 = 0x33, kSCSICmd_SET_LIMITS_12 = 0xB3, kSCSICmd_SET_READ_AHEAD = 0xA7, kSCSICmd_SET_STREAMING = 0xB6, kSCSICmd_SPARE_IN = 0xBC, kSCSICmd_SPARE_OUT = 0xBD, kSCSICmd_START_STOP_UNIT = 0x1B, kSCSICmd_STOP_PLAY_SCAN = 0x4E, kSCSICmd_SYNCHRONIZE_CACHE = 0x35, kSCSICmd_SYNCHRONIZE_CACHE_16 = 0x91, kSCSICmd_TEST_UNIT_READY = 0x00, kSCSICmd_UPDATE_BLOCK = 0x3D, kSCSICmd_UNMAP = 0x42, kSCSICmd_VERIFY_10 = 0x2F, kSCSICmd_VERIFY_12 = 0xAF, kSCSICmd_VERIFY_16 = 0x8F, kSCSICmd_VOLUME_SET_IN = 0xBE, kSCSICmd_VOLUME_SET_OUT = 0xBF, kSCSICmd_WRITE_6 = 0x0A, kSCSICmd_WRITE_10 = 0x2A, kSCSICmd_WRITE_12 = 0xAA, kSCSICmd_WRITE_16 = 0x8A, kSCSICmd_WRITE_AND_VERIFY_10 = 0x2E, kSCSICmd_WRITE_AND_VERIFY_12 = 0xAE, kSCSICmd_WRITE_AND_VERIFY_16 = 0x8E, kSCSICmd_WRITE_ATTRIBUTE = 0x8D, kSCSICmd_WRITE_BUFFER = 0x3B, kSCSICmd_WRITE_LONG = 0x3F, kSCSICmd_WRITE_SAME = 0x41, kSCSICmd_WRITE_SAME_16 = 0x93, kSCSICmd_XDREAD = 0x52, kSCSICmd_XDWRITE = 0x50, kSCSICmd_XDWRITE_EXTENDED = 0x80, kSCSICmd_XDWRITEREAD_10 = 0x53, kSCSICmd_XPWRITE = 0x51, kSCSICmdVariableLengthCDB = 0x7F }; /* Service Action Definitions for the Variable Length CDB (7Fh) command */ enum { kSCSIServiceAction_READ_32 = 0x0009, kSCSIServiceAction_VERIFY_32 = 0x000A, kSCSIServiceAction_WRITE_32 = 0x000B, kSCSIServiceAction_WRITE_AND_VERIFY_32 = 0x000C, kSCSIServiceAction_WRITE_SAME_32 = 0x000D, kSCSIServiceAction_XDREAD_32 = 0x0003, kSCSIServiceAction_XDWRITE_32 = 0x0004, kSCSIServiceAction_XDWRITEREAD_32 = 0x0007, kSCSIServiceAction_XPWRITE_32 = 0x0006 }; /* Service Action Definitions for the MAINTENANCE IN (A3h) command */ enum { kSCSIServiceAction_REPORT_ALIASES = 0x0B, kSCSIServiceAction_REPORT_DEVICE_IDENTIFIER = 0x05, kSCSIServiceAction_REPORT_PRIORITY = 0x0E, kSCSIServiceAction_REPORT_PROVISIONING_INITIALIZATION_PATTERN = 0x1D, kSCSIServiceAction_REPORT_SUPPORTED_OPERATION_CODES = 0x0C, kSCSIServiceAction_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS = 0x0D, kSCSIServiceAction_REPORT_TARGET_PORT_GROUPS = 0x0A }; /* Service Action Definitions for the MAINTENANCE OUT (A4h) command */ enum { kSCSIServiceAction_CHANGE_ALIASES = 0x0B, kSCSIServiceAction_SET_DEVICE_IDENTIFIER = 0x06, kSCSIServiceAction_SET_PRIORITY = 0x0E, kSCSIServiceAction_SET_TARGET_PORT_GROUPS = 0x0A }; /* Service Action Definitions for the SERVICE ACTION IN (9Eh) command */ enum { kSCSIServiceAction_GET_LBA_STATUS = 0x12, kSCSIServiceAction_READ_CAPACITY_16 = 0x10, kSCSIServiceAction_READ_LONG_16 = 0x11, }; /* Service Action Definitions for the SERVICE ACTION OUT (9Fh) command */ enum { kSCSIServiceAction_WRITE_LONG_16 = 0x11 }; #pragma mark - #pragma mark Command Definitions by Number #if 0 enum { }; #endif #pragma mark - #pragma mark All Types SPC Commands /* Commands defined by the T10:1236-D SCSI Primary Commands-2 (SPC-2) * command specification. The definitions and section numbers are based on * section 7 of the revision 18, 21 May 2000 version of the specification. * * These commands are defined for all devices. */ enum { kSPCCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */ kSPCCmd_COMPARE = 0x39, /* Sec. 7.2: Optional */ kSPCCmd_COPY = 0x18, /* Sec. 7.3: Optional */ kSPCCmd_COPY_AND_VERIFY = 0x3A, /* Sec. 7.4: Optional */ kSPCCmd_EXTENDED_COPY = 0x83, /* Sec. 7.5: Optional */ kSPCCmd_INQUIRY = 0x12, /* Sec. 7.6: Mandatory */ kSPCCmd_LOG_SELECT = 0x4C, /* Sec. 7.7: Optional */ kSPCCmd_LOG_SENSE = 0x4D, /* Sec. 7.8: Optional */ kSPCCmd_MODE_SELECT_6 = 0x15, /* Sec. 7.9: Device Type * Specific */ kSPCCmd_MODE_SELECT_10 = 0x55, /* Sec. 7.10: Device Type * Specific */ kSPCCmd_MODE_SENSE_6 = 0x1A, /* Sec. 7.11: Device Type * Specific */ kSPCCmd_MODE_SENSE_10 = 0x5A, /* Sec. 7.12: Device Type * Specific */ kSPCCmd_MOVE_MEDIUM_ATTACHED = 0xA7, /* Defined in SMC */ kSPCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Sec. 7.13: Device Type * Specific */ kSPCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Sec. 7.14: Device Type * Specific */ kSPCCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* Sec. 7.15: Device Type * Specific */ kSPCCmd_READ_BUFFER = 0x3C, /* Sec. 7.16: Optional */ kSPCCmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4, /* Defined in SMC */ kSPCCmd_RECEIVE_COPY_RESULTS = 0x84, /* Sec. 7.17: Optional */ kSPCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* Sec. 7.18: Optional */ kSPCCmd_RELEASE_10 = 0x57, /* Sec. 7.19: Device Type * Specific */ kSPCCmd_RELEASE_6 = 0x17, /* Sec. 7.20: Device Type * Specific */ kSPCCmd_REPORT_DEVICE_IDENTIFIER = 0xA3, /* Sec. 7.21: Optional */ kSPCCmd_REPORT_LUNS = 0xA0, /* Sec. 7.22: Mandatory for * LUN Supporting devices*/ kSPCCmd_REQUEST_SENSE = 0x03, /* Sec. 7.23: Device Type * Specific */ kSPCCmd_RESERVE_10 = 0x56, /* Sec. 7.24: Device Type * Specific */ kSPCCmd_RESERVE_6 = 0x16, /* Sec. 7.25: Device Type * Specific */ kSPCCmd_SEND_DIAGNOSTICS = 0x1D, /* Sec. 7.26: Optional */ kSPCCmd_SET_DEVICE_IDENTIFIER = 0xA4, /* Sec. 7.27: Optional */ kSPCCmd_TEST_UNIT_READY = 0x00, /* Sec. 7.28: Mandatory */ kSPCCmd_WRITE_BUFFER = 0x3B /* Sec. 7.29: Optional */ }; #pragma mark - #pragma mark 0x00 SBC Direct Access Commands /* Commands defined by the T10:990-D SCSI-3 Block Commands (SBC) command * specification. The definitions and section numbers are based on section 6.1 * of the revision 8c, 13 November 1997 version of the specification. */ enum { kSBCCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */ kSBCCmd_COMPARE = 0x39, /* SPC: Optional */ kSBCCmd_COPY = 0x18, /* SPC: Optional */ kSBCCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional*/ kSBCCmd_FORMAT_UNIT = 0x04, /* Sec. 6.1.1: Mandatory */ kSBCCmd_INQUIRY = 0x12, /* SPC: Mandatory */ kSBCCmd_LOCK_UNLOCK_CACHE = 0x36, /* Sec. 6.1.2: Optional */ kSBCCmd_LOG_SELECT = 0x4C, /* SPC: Optional */ kSBCCmd_LOG_SENSE = 0x4D, /* SPC: Optional */ kSBCCmd_MODE_SELECT_6 = 0x15, /* SPC: Optional */ kSBCCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */ kSBCCmd_MODE_SENSE_6 = 0x1A, /* SPC: Optional */ kSBCCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */ kSBCCmd_MOVE_MEDIUM_ATTACHED = 0xA7, /* SMC: Optional */ kSBCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */ kSBCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */ kSBCCmd_PREFETCH = 0x34, /* Sec. 6.1.3: Optional */ kSBCCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* SPC: Optional */ kSBCCmd_READ_6 = 0x08, /* Sec. 6.1.4: Mandatory */ kSBCCmd_READ_10 = 0x28, /* Sec. 6.1.5: Mandatory */ kSBCCmd_READ_12 = 0xA8, /* Sec. 6.2.4: Optional */ kSBCCmd_READ_BUFFER = 0x3C, /* SPC: Optional */ kSBCCmd_READ_CAPACITY = 0x25, /* Sec. 6.1.6: Mandatory */ kSBCCmd_READ_DEFECT_DATA_10 = 0x37, /* Sec. 6.1.7: Optional */ kSBCCmd_READ_DEFECT_DATA_12 = 0xB7, /* Sec. 6.2.5: Optional */ kSBCCmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4, /* SMC: Optional */ kSBCCmd_READ_GENERATION = 0x29, /* Sec. 6.2.6: Optional */ kSBCCmd_READ_LONG = 0x3E, /* Sec. 6.1.8: Optional */ kSBCCmd_READ_UPDATED_BLOCK_10 = 0x2D, /* Sec. 6.2.7: Optional */ kSBCCmd_REASSIGN_BLOCKS = 0x07, /* Sec. 6.1.9: Optional */ kSBCCmd_REBUILD = 0x81, /* Sec. 6.1.10: Optional */ kSBCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */ kSBCCmd_REGENERATE = 0x82, /* Sec. 6.1.11: Optional */ kSBCCmd_RELEASE_6 = 0x17, /* SPC: Optional */ kSBCCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */ kSBCCmd_REPORT_LUNS = 0xA0, /* SPC: Optional */ kSBCCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */ kSBCCmd_RESERVE_6 = 0x16, /* SPC: Optional */ kSBCCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */ kSBCCmd_REZERO_UNIT = 0x01, /* Obsolete */ kSBCCmd_SEARCH_DATA_EQUAL_10 = 0x31, /* Obsolete */ kSBCCmd_SEARCH_DATA_HIGH_10 = 0x30, /* Obsolete */ kSBCCmd_SEARCH_DATA_LOW_10 = 0x32, /* Obsolete */ kSBCCmd_SEEK_6 = 0x0B, /* Obsolete */ kSBCCmd_SEEK_10 = 0x2B, /* Sec. 6.1.12: Optional */ kSBCCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */ kSBCCmd_SET_LIMITS_10 = 0x33, /* Sec. 6.1.13: Optional */ kSBCCmd_SET_LIMITS_12 = 0xB3, /* Sec. 6.2.8: Optional */ kSBCCmd_START_STOP_UNIT = 0x1B, /* Sec. 6.1.14: Optional */ kSBCCmd_SYNCHRONIZE_CACHE = 0x35, /* Sec. 6.1.15: Optional */ kSBCCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */ kSBCCmd_UPDATE_BLOCK = 0x3D, /* Sec. 6.2.9: Optional */ kSBCCmd_VERIFY_10 = 0x2F, /* Sec. 6.1.16: Optional */ kSBCCmd_WRITE_6 = 0x0A, /* Sec. 6.1.17: Optional */ kSBCCmd_WRITE_10 = 0x2A, /* Sec. 6.1.18: Optional */ kSBCCmd_WRITE_12 = 0xAA, /* Sec. 6.2.13: Optional */ kSBCCmd_WRITE_AND_VERIFY_10 = 0x2E, /* Sec. 6.1.19: Optional */ kSBCCmd_WRITE_AND_VERIFY_12 = 0xAE, /* Sec. 6.2.15: Optional */ kSBCCmd_WRITE_BUFFER = 0x3B, /* SPC: Optional */ kSBCCmd_WRITE_LONG = 0x3F, /* Sec. 6.1.20: Optional */ kSBCCmd_WRITE_SAME = 0x41, /* Sec. 6.1.21: Optional */ kSBCCmd_XDREAD = 0x52, /* Sec. 6.1.22: Optional */ kSBCCmd_XDWRITE = 0x50, /* Sec. 6.1.23: Optional */ kSBCCmd_XDWRITE_EXTENDED = 0x80, /* Sec. 6.1.24: Optional */ kSBCCmd_XPWRITE = 0x51 /* Sec. 6.1.25: Optional */ }; #pragma mark - #pragma mark 0x01 SSC Sequential Access Commands /* Commands defined by the T10:997-D SCSI-3 Stream Commands (SSC) command * specification. The definitions and section numbers are based on section 5 * of the revision 22, January 1, 2000 version of the specification. */ enum { kSSCSeqCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */ kSSCSeqCmd_COMPARE = 0x39, /* SPC: Optional */ kSSCSeqCmd_COPY = 0x18, /* SPC: Optional */ kSSCSeqCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */ kSSCSeqCmd_ERASE = 0x19, /* Sec. 5.3.1: Mandatory */ kSSCSeqCmd_FORMAT_MEDIUM = 0x04, /* Sec. 5.3.2: Optional */ kSSCSeqCmd_INQUIRY = 0x12, /* SPC: Mandatory */ kSSCSeqCmd_LOAD_UNLOAD = 0x1B, /* Sec. 5.3.3: Optional */ kSSCSeqCmd_LOCATE = 0x2B, /* Sec. 5.3.4: Optional */ kSSCSeqCmd_LOG_SELECT = 0x4C, /* SPC: Optional */ kSSCSeqCmd_LOG_SENSE = 0x4D, /* SPC: Optional */ kSSCSeqCmd_MODE_SELECT_6 = 0x15, /* SPC: Mandatory */ kSSCSeqCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */ kSSCSeqCmd_MODE_SENSE_6 = 0x1A, /* SPC: Mandatory */ kSSCSeqCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */ kSSCSeqCmd_MOVE_MEDIUM = 0xA5, /* SMC: Optional */ kSSCSeqCmd_MOVE_MEDIUM_ATTACHED = 0xA7, /* SMC: Optional */ kSSCSeqCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */ kSSCSeqCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */ kSSCSeqCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* SPC: Optional */ kSSCSeqCmd_READ_6 = 0x08, /* Sec. 5.3.5: Mandatory */ kSSCSeqCmd_READ_BLOCK_LIMITS = 0x05, /* Sec. 5.3.6: Mandatory */ kSSCSeqCmd_READ_BUFFER = 0x3C, /* SPC: Optional */ kSSCSeqCmd_READ_ELEMENT_STATUS = 0xB8, /* SMC: Optional */ kSSCSeqCmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4, /* SMC: Optional */ kSSCSeqCmd_READ_POSITION = 0x34, /* Sec. 5.3.7: Mandatory */ kSSCSeqCmd_READ_REVERSE = 0x0F, /* Sec. 5.3.8: Optional */ kSSCSeqCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */ kSSCSeqCmd_RECOVER_BUFFERED_DATA = 0x14, /* Sec. 5.3.9: Optional */ kSSCSeqCmd_RELEASE_6 = 0x17, /* SPC: Mandatory */ kSSCSeqCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */ kSSCSeqCmd_REPORT_DENSITY_SUPPORT = 0x44, /* Sec. 5.3.10: Mandatory*/ kSSCSeqCmd_REPORT_LUNS = 0xA0, /* SPC: Mandatory */ kSSCSeqCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */ kSSCSeqCmd_RESERVE_6 = 0x16, /* SPC: Mandatory */ kSSCSeqCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */ kSSCSeqCmd_REWIND = 0x01, /* Sec. 5.3.11: Mandatory*/ kSSCSeqCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */ kSSCSeqCmd_SPACE = 0x11, /* Sec. 5.3.12: Mandatory*/ kSSCSeqCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */ kSSCSeqCmd_VERIFY_6 = 0x13, /* Sec. 5.3.13: Optional */ kSSCSeqCmd_WRITE_6 = 0x0A, /* Sec. 5.3.14: Mandatory*/ kSSCSeqCmd_WRITE_BUFFER = 0x3B, /* SPC: Optional */ kSSCSeqCmd_WRITE_FILEMARKS = 0x10 /* Sec. 5.3.15: Mandatory*/ }; #pragma mark - #pragma mark 0x02 SSC Printer Commands /* Commands defined by the T10:997-D SCSI-3 Stream Commands (SSC) command * specification. The definitions and section numbers are based on section 6 * of the revision 22, January 1, 2000 version of the specification. */ enum { kSSCPrinterCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */ kSSCPrinterCmd_COMPARE = 0x39, /* SPC: Optional */ kSSCPrinterCmd_COPY = 0x18, /* SPC: Optional */ kSSCPrinterCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */ kSSCPrinterCmd_FORMAT = 0x04, /* Sec. 6.2.1: Optional */ kSSCPrinterCmd_INQUIRY = 0x12, /* SPC: Mandatory */ kSSCPrinterCmd_LOG_SELECT = 0x4C, /* SPC: Optional */ kSSCPrinterCmd_LOG_SENSE = 0x4D, /* SPC: Optional */ kSSCPrinterCmd_MODE_SELECT_6 = 0x15, /* SPC: Mandatory */ kSSCPrinterCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */ kSSCPrinterCmd_MODE_SENSE_6 = 0x1A, /* SPC: Mandatory */ kSSCPrinterCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */ kSSCPrinterCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */ kSSCPrinterCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */ kSSCPrinterCmd_PRINT = 0x0A, /* Sec. 6.2.2: Mandatory */ kSSCPrinterCmd_READ_BUFFER = 0x3C, /* SPC: Optional */ kSSCPrinterCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */ kSSCPrinterCmd_RECOVER_BUFFERED_DATA = 0x14, /* Sec. 6.2.3: Optional */ kSSCPrinterCmd_RELEASE_6 = 0x17, /* SPC: Mandatory */ kSSCPrinterCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */ kSSCPrinterCmd_REPORT_LUNS = 0xA0, /* SPC: Mandatory */ kSSCPrinterCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */ kSSCPrinterCmd_RESERVE_6 = 0x16, /* SPC: Mandatory */ kSSCPrinterCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */ kSSCPrinterCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */ kSSCPrinterCmd_SLEW_AND_PRINT = 0x0B, /* Sec. 6.2.4: Optional */ kSSCPrinterCmd_STOP_PRINT = 0x1B, /* Sec. 6.2.5: Optional */ kSSCPrinterCmd_SYNCHRONIZE_BUFFER = 0x10, /* Sec. 6.2.6: Optional */ kSSCPrinterCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */ kSSCPrinterCmd_WRITE_BUFFER = 0x3B /* SPC: Optional */ }; #pragma mark - #pragma mark 0x03 SPC Processor Commands /* Commands defined by the T10:1236-D SCSI Primary Commands-2 (SPC-2) * command specification. The definitions and section numbers are based on * section 9 of the revision 18, 21 May 2000 version of the specification. */ enum { kSPCProcCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */ kSPCProcCmd_COMPARE = 0x39, /* Sec. 7.2: Optional */ kSPCProcCmd_COPY = 0x18, /* Sec. 7.3: Optional */ kSPCProcCmd_COPY_AND_VERIFY = 0x3A, /* Sec. 7.4: Optional */ kSPCProcCmd_EXTENDED_COPY = 0x83, /* Sec. 7.5: Optional */ kSPCProcCmd_INQUIRY = 0x12, /* Sec. 7.6: Mandatory */ kSPCProcCmd_LOG_SELECT = 0x4C, /* Sec. 7.7: Optional */ kSPCProcCmd_LOG_SENSE = 0x4D, /* Sec. 7.8: Optional */ kSPCProcCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Sec. 7.13: Optional */ kSPCProcCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Sec. 7.14: Optional */ kSPCProcCmd_READ_BUFFER = 0x3C, /* Sec. 7.16: Optional */ kSPCProcCmd_RECEIVE = 0x08, /* Sec. 9.2: Optional */ kSPCProcCmd_RECEIVE_COPY_RESULTS = 0x84, /* Sec. 7.17: Optional */ kSPCProcCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* Sec. 7.18: Optional */ kSPCProcCmd_RELEASE_10 = 0x57, /* Sec. 7.19: Optional */ kSPCProcCmd_RELEASE_6 = 0x17, /* Sec. 7.20: Optional */ kSPCProcCmd_REPORT_LUNS = 0xA0, /* Sec. 7.22: Optional */ kSPCProcCmd_REQUEST_SENSE = 0x03, /* Sec. 7.23: Mandatory */ kSPCProcCmd_RESERVE_10 = 0x56, /* Sec. 7.24: Optional */ kSPCProcCmd_RESERVE_6 = 0x16, /* Sec. 7.25: Optional */ kSPCProcCmd_SEND = 0x0A, /* Sec. 9.3: Optional */ kSPCProcCmd_SEND_DIAGNOSTICS = 0x1D, /* Sec. 7.26: Mandatory */ kSPCProcCmd_TEST_UNIT_READY = 0x00, /* Sec. 7.27: Mandatory */ kSPCProcCmd_WRITE_BUFFER = 0x3B /* Sec. 7.29: Optional */ }; #pragma mark - #pragma mark 0x04 SBC Write Once Commands /* Commands defined by the T10:990-D SCSI-3 Block Commands (SBC) command * specification. The definitions and section numbers are based on section 6.3 * of the revision 8c, 13 November 1997 version of the specification. */ enum { kSBCWOCmd_CHANGE_DEFINITION = 0x40, /* SPC: Optional */ kSBCWOCmd_COMPARE = 0x39, /* SPC: Optional */ kSBCWOCmd_COPY = 0x18, /* SPC: Optional */ kSBCWOCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional*/ kSBCWOCmd_INQUIRY = 0x12, /* SPC: Mandatory */ kSBCWOCmd_LOCK_UNLOCK_CACHE = 0x36, /* Sec. 6.1.2: Optional */ kSBCWOCmd_LOG_SELECT = 0x4C, /* SPC: Optional */ kSBCWOCmd_LOG_SENSE = 0x4D, /* SPC: Optional */ kSBCWOCmd_MEDIUM_SCAN = 0x38, /* Sec. 6.2.3: Optional */ kSBCWOCmd_MODE_SELECT_6 = 0x15, /* SPC: Optional */ kSBCWOCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */ kSBCWOCmd_MODE_SENSE_6 = 0x1A, /* SPC: Optional */ kSBCWOCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */ kSBCWOCmd_MOVE_MEDIUM = 0xA5, /* SMC: Optional */ kSBCWOCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */ kSBCWOCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */ kSBCWOCmd_PREFETCH = 0x34, /* Sec. 6.1.3: Optional */ kSBCWOCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* SPC: Optional */ kSBCWOCmd_READ_6 = 0x08, /* Sec. 6.1.4: Optional */ kSBCWOCmd_READ_10 = 0x28, /* Sec. 6.1.5: Mandatory */ kSBCWOCmd_READ_12 = 0xA8, /* Sec. 6.2.4: Optional */ kSBCWOCmd_READ_BUFFER = 0x3C, /* SPC: Optional */ kSBCWOCmd_READ_CAPACITY = 0x25, /* Sec. 6.1.6: Mandatory */ kSBCWOCmd_READ_ELEMENT_STATUS = 0xB8, /* SMC: Optional */ kSBCWOCmd_READ_LONG = 0x3E, /* Sec. 6.1.8: Optional */ kSBCWOCmd_REASSIGN_BLOCKS = 0x07, /* Sec. 6.1.9: Optional */ kSBCWOCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */ kSBCWOCmd_RELEASE_6 = 0x17, /* SPC: Optional */ kSBCWOCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */ kSBCWOCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */ kSBCWOCmd_RESERVE_6 = 0x16, /* SPC: Optional */ kSBCWOCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */ kSBCWOCmd_REZERO_UNIT = 0x01, /* Obsolete */ kSBCWOCmd_SEARCH_DATA_EQUAL_10 = 0x31, /* Obsolete */ kSBCWOCmd_SEARCH_DATA_EQUAL_12 = 0xB1, /* Obsolete */ kSBCWOCmd_SEARCH_DATA_HIGH_10 = 0x30, /* Obsolete */ kSBCWOCmd_SEARCH_DATA_HIGH_12 = 0xB0, /* Obsolete */ kSBCWOCmd_SEARCH_DATA_LOW_10 = 0x32, /* Obsolete */ kSBCWOCmd_SEARCH_DATA_LOW_12 = 0xB2, /* Obsolete */ kSBCWOCmd_SEEK_6 = 0x0B, /* Obsolete */ kSBCWOCmd_SEEK_10 = 0x2B, /* Sec. 6.1.12: Optional */ kSBCWOCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */ kSBCWOCmd_SET_LIMITS_10 = 0x33, /* Sec. 6.1.13: Optional */ kSBCWOCmd_SET_LIMITS_12 = 0xB3, /* Sec. 6.2.8: Optional */ kSBCWOCmd_START_STOP_UNIT = 0x1B, /* Sec. 6.1.14: Optional */ kSBCWOCmd_SYNCHRONIZE_CACHE = 0x35, /* Sec. 6.1.15: Optional */ kSBCWOCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */ kSBCWOCmd_VERIFY_10 = 0x2F, /* Sec. 6.2.10: Optional */ kSBCWOCmd_VERIFY_12 = 0xAF, /* Sec. 6.2.11: Optional */ kSBCWOCmd_WRITE_6 = 0x0A, /* Sec. 6.1.17: Optional */ kSBCWOCmd_WRITE_10 = 0x2A, /* Sec. 6.2.10: Mandatory*/ kSBCWOCmd_WRITE_12 = 0xAA, /* Sec. 6.2.13: Optional */ kSBCWOCmd_WRITE_AND_VERIFY_10 = 0x2E, /* Sec. 6.2.14: Optional */ kSBCWOCmd_WRITE_AND_VERIFY_12 = 0xAE, /* Sec. 6.2.15: Optional */ kSBCWOCmd_WRITE_BUFFER = 0x3B, /* SPC: Optional */ kSBCWOCmd_WRITE_LONG = 0x3F /* Sec. 6.1.20: Optional */ }; #pragma mark - #pragma mark 0x05 MMC CD-ROM Commands /* Commands defined by the T10:1363-D SCSI Multimedia Commands-3 (MMC-3) * specification. The definitions and section numbers are based on section 6.1 * of the revision 01, March 03, 2000 version of the specification. * * NOTE: The comments following each command may not be accurate. These are * not from the MMC-3 specification, but have been derived from the SCSI-2 and * original MMC specifications. Unlike the other SCSI command specifications, * MMC-2 and MMC-3 do not provide a command requirement type and therefore does * not relist the SPC commands with these requirements as they apply to MMC * devices. The MMC-2 and MMC-3 specifications also refer back to the SBC * specification which seems invalid since MMC devices do not represent a * Peripheral Device Type defined by SBC. It is assumed that the SBC * references refer to the Peripheral Device Type 0x00 - Direct Access Commands * definitions from that specification. */ enum { kMMCCmd_BLANK = 0xA1, /* Sec. 6.1.1: */ kMMCCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */ kMMCCmd_CLOSE_TRACK_SESSION = 0x5B, /* Sec. 6.1.2: */ kMMCCmd_COMPARE = 0x39, /* SPC: Optional */ kMMCCmd_COPY = 0x18, /* SPC: Optional */ kMMCCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */ kMMCCmd_ERASE = 0x2C, /* SBC: */ kMMCCmd_FORMAT_UNIT = 0x04, /* Sec. 6.1.3: */ kMMCCmd_GET_CONFIGURATION = 0x46, /* Sec. 6.1.4: */ kMMCCmd_GET_EVENT_STATUS_NOTIFICATION = 0x4A, /* Sec. 6.1.5: */ kMMCCmd_GET_PERFORMANCE = 0xAC, /* Sec. 6.1.6: */ kMMCCmd_INQUIRY = 0x12, /* SPC: Mandatory */ kMMCCmd_LOAD_UNLOAD_MEDIUM = 0xA6, /* Sec. 6.1.7: */ kMMCCmd_LOG_SELECT = 0x4C, /* SPC: Optional */ kMMCCmd_LOG_SENSE = 0x4D, /* SPC: Optional */ kMMCCmd_MECHANISM_STATUS = 0xBD, /* Sec. 6.1.8: */ kMMCCmd_MODE_SELECT_6 = 0x15, /* SPC: Mandatory */ kMMCCmd_MODE_SELECT_10 = 0x55, /* SPC: Mandatory */ kMMCCmd_MODE_SENSE_6 = 0x1A, /* SPC: Mandatory */ kMMCCmd_MODE_SENSE_10 = 0x5A, /* SPC: Mandatory */ kMMCCmd_PAUSE_RESUME = 0x4B, /* Sec. 6.1.9: */ kMMCCmd_PLAY_AUDIO_10 = 0x45, /* Sec. 6.1.10: */ kMMCCmd_PLAY_AUDIO_12 = 0xA5, /* Sec. 6.1.11: */ kMMCCmd_PLAY_AUDIO_MSF = 0x47, /* Sec. 6.1.12: */ kMMCCmd_PLAY_AUDIO_TRACK_INDEX = 0x48, /* Obsolete */ kMMCCmd_PLAY_CD = 0xBC, /* Sec. 6.1.13: */ kMMCCmd_PLAY_RELATIVE_10 = 0x49, /* Obsolete */ kMMCCmd_PLAY_RELATIVE_12 = 0xA9, /* Obsolete */ kMMCCmd_PREFETCH = 0x34, /* Optional */ kMMCCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* Optional */ kMMCCmd_READ_6 = 0x08, /* Optional */ kMMCCmd_READ_10 = 0x28, /* Mandatory */ kMMCCmd_READ_12 = 0xA8, /* Optional */ kMMCCmd_READ_BUFFER = 0x3C, /* Optional */ kMMCCmd_READ_BUFFER_CAPACITY = 0x5C, /* Sec. 6.1.15: */ kMMCCmd_READ_CD = 0xBE, /* Sec. 6.1.16: */ kMMCCmd_READ_CD_MSF = 0xB9, /* Sec. 6.1.17: */ kMMCCmd_READ_CAPACITY = 0x25, /* Sec. 6.1.18: */ kMMCCmd_READ_DISC_INFORMATION = 0x51, /* Sec. 6.1.19: */ kMMCCmd_READ_DVD_STRUCTURE = 0xAD, /* Sec. 6.1.20: */ kMMCCmd_READ_DISC_STRUCTURE = 0xAD, /* Sec. 6.1.20: */ kMMCCmd_READ_FORMAT_CAPACITIES = 0x23, /* Sec. 6.1.21: */ kMMCCmd_READ_HEADER = 0x44, /* Sec. 6.1.22: */ kMMCCmd_READ_LONG = 0x3E, /* Optional */ kMMCCmd_READ_MASTER_CUE = 0x59, /* Sec. 6.1.23: */ kMMCCmd_READ_SUB_CHANNEL = 0x42, /* Sec. 6.1.24: */ kMMCCmd_READ_TOC_PMA_ATIP = 0x43, /* Sec. 6.1.25: */ kMMCCmd_READ_TRACK_INFORMATION = 0x52, /* Sec. 6.1.27: */ kMMCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* Optional */ kMMCCmd_RELEASE_6 = 0x17, /* Mandatory */ kMMCCmd_RELEASE_10 = 0x57, /* Optional */ kMMCCmd_REPAIR_TRACK = 0x58, /* Sec. 6.1.28: */ kMMCCmd_REPORT_KEY = 0xA4, /* Sec. 6.1.29: */ kMMCCmd_REQUEST_SENSE = 0x03, /* Mandatory */ kMMCCmd_RESERVE_6 = 0x16, /* Mandatory */ kMMCCmd_RESERVE_10 = 0x56, /* Optional */ kMMCCmd_RESERVE_TRACK = 0x53, /* Sec. 6.1.30: */ kMMCCmd_SCAN_MMC = 0xBA, /* Sec. 6.1.31: */ kMMCCmd_SEARCH_DATA_EQUAL_10 = 0x31, /* Obsolete */ kMMCCmd_SEARCH_DATA_EQUAL_12 = 0xB1, /* Obsolete */ kMMCCmd_SEARCH_DATA_HIGH_10 = 0x30, /* Obsolete */ kMMCCmd_SEARCH_DATA_HIGH_12 = 0xB0, /* Obsolete */ kMMCCmd_SEARCH_DATA_LOW_10 = 0x32, /* Obsolete */ kMMCCmd_SEARCH_DATA_LOW_12 = 0xB2, /* Obsolete */ kMMCCmd_SEEK_6 = 0x0B, /* Obsolete */ kMMCCmd_SEEK_10 = 0x2B, /* SBC: */ kMMCCmd_SEND_CUE_SHEET = 0x5D, /* Sec. 6.1.32: */ kMMCCmd_SEND_DIAGNOSTICS = 0x1D, /* Mandatory */ kMMCCmd_SEND_DVD_STRUCTURE = 0xBF, /* Sec. 6.1.33: */ kMMCCmd_SEND_EVENT = 0xA2, /* Sec. 6.1.34: */ kMMCCmd_SEND_KEY = 0xA3, /* Sec. 6.1.35: */ kMMCCmd_SEND_OPC_INFORMATION = 0x54, /* Sec. 6.1.36: */ kMMCCmd_SET_CD_SPEED = 0xBB, /* Sec. 6.1.37: */ kMMCCmd_SET_LIMITS_10 = 0x33, /* Optional */ kMMCCmd_SET_LIMITS_12 = 0xB3, /* Optional */ kMMCCmd_SET_READ_AHEAD = 0xA7, /* Sec. 6.1.38: */ kMMCCmd_SET_STREAMING = 0xB6, /* Sec. 6.1.39: */ kMMCCmd_START_STOP_UNIT = 0x1B, /* Optional */ kMMCCmd_STOP_PLAY_SCAN = 0x4E, /* Sec. 6.1.40: */ kMMCCmd_SYNCHRONIZE_CACHE = 0x35, /* Sec. 6.1.41: */ kMMCCmd_TEST_UNIT_READY = 0x00, /* Mandatory */ kMMCCmd_VERIFY_10 = 0x2F, /* Optional */ kMMCCmd_VERIFY_12 = 0xAF, /* Optional */ kMMCCmd_WRITE_10 = 0x2A, /* Sec. 6.1.42: */ kMMCCmd_WRITE_12 = 0xAA, /* Sec. 6.1.43: */ kMMCCmd_WRITE_AND_VERIFY_10 = 0x2E, /* Sec. 6.1.44: */ kMMCCmd_WRITE_BUFFER = 0x3B /* Optional */ }; #pragma mark - #pragma mark 0x06 SGC Scanner Commands /* Commands defined by the T10:998-D SCSI-3 Graphics Commands (SGC) * specification. The definitions and section numbers are based on section 6 * of the revision 0, April 1995 version of the specification. */ enum { kSGCCmd_CHANGE_DEFINITION = 0x40, /* SPC: Optional */ kSGCCmd_COMPARE = 0x39, /* SPC: Optional */ kSGCCmd_COPY = 0x18, /* SPC: Optional */ kSGCCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */ kSGCCmd_GET_DATA_BUFFER_STATUS = 0x34, /* Sec. 6.1.1: Optional */ kSGCCmd_GET_WINDOW = 0x25, /* Sec. 6.1.2: Optional */ kSGCCmd_INQUIRY = 0x12, /* SPC: Mandatory */ kSGCCmd_LOG_SELECT = 0x4C, /* SPC: Optional */ kSGCCmd_LOG_SENSE = 0x4D, /* SPC: Optional */ kSGCCmd_MODE_SELECT_6 = 0x15, /* SPC: Optional */ kSGCCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */ kSGCCmd_MODE_SENSE_6 = 0x1A, /* SPC: Optional */ kSGCCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */ kSGCCmd_OBJECT_POSITION = 0x31, /* Sec. 6.1.3: Optional */ kSGCCmd_PORT_STATUS = 0x11, /* SPC (??): Mandatory * for dual port devices */ kSGCCmd_READ = 0x28, /* Sec. 6.1.4: Mandatory */ kSGCCmd_READ_BUFFER = 0x3C, /* SPC: Optional */ kSGCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */ kSGCCmd_RELEASE_6 = 0x17, /* SPC: Mandatory */ kSGCCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */ kSGCCmd_RESERVE_6 = 0x16, /* SPC: Mandatory */ kSGCCmd_SCAN = 0x1B, /* Sec. 6.1.5: Optional */ kSGCCmd_SEND = 0x1B, /* Sec. 6.1.6: Optional */ kSGCCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */ kSGCCmd_SET_WINDOW = 0x24, /* Sec. 6.1.7: Mandatory */ kSGCCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */ kSGCCmd_WRITE_BUFFER = 0x3B /* SPC: Optional */ }; #pragma mark - #pragma mark 0x07 SBC Optical Media Commands /* Commands defined by the T10:990-D SCSI-3 Block Commands (SBC) * (revision 8c, 13 November 1998) command specification. */ #pragma mark - #pragma mark 0x08 SMC Medium Changer Commands /* Commands defined by the T10:1228-D SCSI-3 Medium Changer Commands-2 (SMC-2) * (revision 0, March 16, 2000) command specification. */ enum { /* Commands For Independent Medium Changers */ kSMCCmd_EXCHANGE_MEDIUM = 0xA6, /* Optional */ kSMCCmd_INITIALIZE_ELEMENT_STATUS = 0x07, /* Optional */ kSMCCmd_MODE_SELECT_6 = 0x15, /* Optional */ kSMCCmd_MODE_SELECT_10 = 0x55, /* Optional */ kSMCCmd_MODE_SENSE_6 = 0x1A, /* Optional */ kSMCCmd_MODE_SENSE_10 = 0x5A, /* Optional */ kSMCCmd_MOVE_MEDIUM = 0xA5, /* Mandatory */ kSMCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Optional */ kSMCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Optional */ kSMCCmd_POSITION_TO_ELEMENT = 0x2B, /* Optional */ kSMCCmd_READ_ELEMENT_STATUS = 0xB8, /* Mandatory */ kSMCCmd_RELEASE_ELEMENT_6 = 0x16, /* Optional */ kSMCCmd_RELEASE_ELEMENT_10 = 0x56, /* Optional */ kSMCCmd_REQUEST_VOLUME_ELEMENT_ADDRESS = 0xB5, /* Optional */ kSMCCmd_REQUEST_SENSE = 0x03, /* Mandatory */ kSMCCmd_RESERVE_ELEMENT_6 = 0x16, /* Optional */ kSMCCmd_RESERVE_ELEMENT_10 = 0x56 /* Optional */ }; #pragma mark - #pragma mark 0x09 SSC Communications Commands /* Commands defined by the T10:997-D SCSI-3 Stream Commands (SSC) * (revision 22, January 1, 2000) command specification. */ #pragma mark - #pragma mark 0x0A ASC IT8 Prepress Commands #pragma mark 0x0B ASC IT8 Prepress Commands /* Commands defined by the ASC IT8 <title goes here> specification * (revision xx, month day, year) command specification. */ #if 0 enum { }; #endif #pragma mark - #pragma mark 0x0C SCC Array Controller Commands /* Commands defined by the ANSI NCITS.318-199x SCSI Controller * Commands (SCC-2) ratified command specification. */ enum { kSCCCmd_MAINTENANCE_IN = 0xA3, /* Mandatory */ kSCCCmd_MAINTENANCE_OUT = 0xA4, /* Optional */ kSCCCmd_MODE_SELECT_6 = 0x15, /* Optional */ kSCCCmd_MODE_SELECT_10 = 0x55, /* Optional */ kSCCCmd_MODE_SENSE_6 = 0x1A, /* Optional */ kSCCCmd_MODE_SENSE_10 = 0x5A, /* Optional */ kSCCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Optional */ kSCCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Optional */ kSCCCmd_PORT_STATUS = 0x1F, /* Optional */ kSCCCmd_REDUNDANCY_GROUP_IN = 0xBA, /* Mandatory */ kSCCCmd_REDUNDANCY_GROUP_OUT = 0xBB, /* Optional */ kSCCCmd_RELEASE_6 = 0x17, /* Optional */ kSCCCmd_RELEASE_10 = 0x57, /* Optional */ kSCCCmd_REPORT_LUNS = 0xA0, /* Mandatory */ kSCCCmd_REQUEST_SENSE = 0x03, /* Mandatory */ kSCCCmd_RESERVE_6 = 0x16, /* Optional */ kSCCCmd_RESERVE_10 = 0x56, /* Optional*/ kSCCCmd_SEND_DIAGNOSTICS = 0x1D, /* Optional */ kSCCCmd_SPARE_IN = 0xBC, /* Mandatory */ kSCCCmd_SPARE_OUT = 0xBD /* Optional */ }; #pragma mark - #pragma mark 0x0D SES Enclosure Services Commands /* Commands defined by the T10:1212-D SCSI-3 Enclosure Services (SES) * (revision 8b, February 11, 1998) command specification. */ enum { kSESCmd_MODE_SELECT_6 = 0x15, /* Optional */ kSESCmd_MODE_SELECT_10 = 0x55, /* Optional */ kSESCmd_MODE_SENSE_6 = 0x1A, /* Optional */ kSESCmd_MODE_SENSE_10 = 0x5A, /* Optional */ kSESCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Optional */ kSESCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Optional */ kSESCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x17, /* Mandatory */ kSESCmd_RELEASE_6 = 0x17, /* Optional */ kSESCmd_RELEASE_10 = 0x57, /* Optional */ kSESCmd_REQUEST_SENSE = 0x03, /* Mandatory */ kSESCmd_RESERVE_6 = 0x16, /* Optional */ kSESCmd_RESERVE_10 = 0x56, /* Optional */ kSESCmd_SEND_DIAGNOSTICS = 0x1D /* Mandatory */ }; #pragma mark - #pragma mark 0x0E RBC Reduced Block Commands /* Commands defined by the T10:1240-D Reduced Block Commands (RBC) * (revision 10a, August 18, 1999) command specification. */ enum { kRBCCmd_FORMAT_UNIT = 0x04, /* Optional */ kRBCCmd_READ_10 = 0x28, /* Mandatory */ kRBCCmd_READ_CAPACITY = 0x25, /* Mandatory */ kRBCCmd_START_STOP_UNIT = 0x1B, /* Mandatory */ kRBCCmd_SYNCHRONIZE_CACHE = 0x35, /* Optional */ kRBCCmd_VERIFY_10 = 0x2F, /* Mandatory */ kRBCCmd_WRITE_10 = 0x2A, /* Mandatory */ kRBCCmd_WRITE_BUFFER = 0x3B /* Mandatory for fixed media * Optional for removable */ }; #pragma mark - #pragma mark 0x0F OCRW Optical Card Commands /* Commands defined by the ISO/IEC 14776-381 SCSI Specification for * Optical Card Reader/Writer (OCRW) ratified command specification. */ #if 0 enum { }; #endif #pragma mark - #pragma mark 0x11 OSD Object-based Storage Commands /* Commands defined by the T10:1355-D Object-based Storage Commands (OSD) * (revision 1, 18 May 2000) command specification. */ #if 0 enum { }; #endif #pragma mark - #pragma mark 0x15 RMC Simplified Multimedia Commands /* Commands defined by the T10:1364-D Reduced Multimedia Commands (RMC) * (revision 1, November 11, 1999) command specification. */ #if 0 enum { }; #endif #endif /* _SCSI_COMMAND_OPERATION_CODES_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIPeripheralDeviceType07.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_07_H_ #define _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_07_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIBlockCommandsDevice.h> //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOSCSIPeripheralDeviceType07 : public IOSCSIBlockCommandsDevice { OSDeclareDefaultStructors ( IOSCSIPeripheralDeviceType07 ) protected: // Reserve space for future expansion. struct IOSCSIPeripheralDeviceType07ExpansionData { }; IOSCSIPeripheralDeviceType07ExpansionData * fIOSCSIPeripheralDeviceType07Reserved; public: bool init ( OSDictionary * propTable ) APPLE_KEXT_OVERRIDE; virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void stop ( IOService * provider ) APPLE_KEXT_OVERRIDE; private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 1 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 2 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 3 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType07, 8 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_07_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSICmds_READ_CAPACITY_Definitions.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_CMDS_READ_CAPACITY_H_ #define _IOKIT_SCSI_CMDS_READ_CAPACITY_H_ #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif /*! @header SCSI Request Sense Definitions @discussion This file contains all definitions for the data returned from the READ CAPACITY 10 (0x25) and READ CAPACITY 16 (0x9E) commands. */ /*! @enum READ CAPACITY Payload Sizes @discussion Sizes of the payload for the READ CAPACITY 10 and READ CAPACITY 16 commands. @constant kREPORT_CAPACITY_DataSize Data size for a READ_CAPACITY command. @constant kREPORT_CAPACITY_16_DataSize Data size for a READ_CAPACITY_16 command. */ enum { kREPORT_CAPACITY_DataSize = 8, kREPORT_CAPACITY_16_DataSize = 32 }; /*! @constant kREPORT_CAPACITY_MaximumLBA @discussion Maximum LBA supported via READ CAPACITY 10 command. */ #define kREPORT_CAPACITY_MaximumLBA 0xFFFFFFFFUL /*! @constant kREPORT_CAPACITY_16_MaximumLBA @discussion Maximum LBA supported via READ CAPACITY 16 command. */ #define kREPORT_CAPACITY_16_MaximumLBA 0xFFFFFFFFFFFFFFFFULL /*! @struct SCSI_Capacity_Data @discussion Capacity return structure for READ CAPACITY 10 command. */ typedef struct SCSI_Capacity_Data { UInt32 RETURNED_LOGICAL_BLOCK_ADDRESS; UInt32 BLOCK_LENGTH_IN_BYTES; } SCSI_Capacity_Data; /*! @struct SCSI_Capacity_Data_Long @discussion Capacity return structure for READ CAPACITY 16 command. */ typedef struct SCSI_Capacity_Data_Long { UInt64 RETURNED_LOGICAL_BLOCK_ADDRESS; UInt32 BLOCK_LENGTH_IN_BYTES; UInt8 RTO_EN_PROT_EN; UInt8 Reserved[19]; } SCSI_Capacity_Data_Long; /*! @enum RTO_EN definitions @discussion Values for the REFERENCE TAG OWN (RTO_EN) bit in the READ CAPACITY Long Data structure. @constant kREAD_CAPACITY_RTO_Enabled Reference Tag Own enabled. @constant kREAD_CAPACITY_RTO_Disabled Reference Tag Own disabled. @constant kREAD_CAPACITY_RTO_Mask Mask to use when checking the RTO_EN_PROT_EN field. */ enum { kREAD_CAPACITY_RTO_Enabled = 0x02, kREAD_CAPACITY_RTO_Disabled = 0x00, kREAD_CAPACITY_RTO_Mask = 0x02 }; /*! @enum PROTECTION INFORMATION definitions @discussion Values for the PROTECTION INFORMATION (PROT_EN) bit in the READ CAPACITY Long Data structure. @constant kREAD_CAPACITY_PROT_Enabled Protection Information enabled. @constant kREAD_CAPACITY_PROT_Disabled Protection Information disabled. @constant kREAD_CAPACITY_PROT_Mask Mask to use when checking the RTO_EN_PROT_EN field. */ enum { kREAD_CAPACITY_PROT_Enabled = 0x01, kREAD_CAPACITY_PROT_Disabled = 0x00, kREAD_CAPACITY_PROT_Mask = 0x01 }; #endif /* _IOKIT_SCSI_CMDS_READ_CAPACITY_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIPeripheralDeviceType0E.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_0E_H_ #define _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_0E_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // General IOKit headers #include <IOKit/IOLib.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIReducedBlockCommandsDevice.h> //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- class __exported IOSCSIPeripheralDeviceType0E : public IOSCSIReducedBlockCommandsDevice { OSDeclareDefaultStructors ( IOSCSIPeripheralDeviceType0E ) protected: // Reserve space for future expansion. struct IOSCSIPeripheralDeviceType0EExpansionData { }; IOSCSIPeripheralDeviceType0EExpansionData * fIOSCSIPeripheralDeviceType0EReserved; public: bool init ( OSDictionary * propTable ) APPLE_KEXT_OVERRIDE; virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; virtual void stop ( IOService * provider ) APPLE_KEXT_OVERRIDE; private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 1 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 2 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 3 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceType0E, 8 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_TYPE_0E_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIReducedBlockCommandsDevice.h
/* * Copyright (c) 1998-2014 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_REDUCED_BLOCK_COMMANDS_DEVICE_H_ #define _IOKIT_IO_SCSI_REDUCED_BLOCK_COMMANDS_DEVICE_H_ #if defined(KERNEL) && defined(__cplusplus) /*! @header SCSI Reduced Block Commands Device @discussion This file contains definitions for the IOSCSIReducedBlockCommandsDevice class, commands required for RBC devices, power management, and additional constants used by this class. */ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // General IOKit headers #include <IOKit/IOLib.h> #include <IOKit/IOMemoryDescriptor.h> // Generic IOKit storage related headers #include <IOKit/storage/IOStorage.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/IOSCSIPrimaryCommandsDevice.h> // Build includes #include <TargetConditionals.h> //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- // RBC power states as defined in T10:1240D SCSI Reduced Block Commands (RBC) // Revision 10a, August 18, 1999, page 13. enum { kRBCPowerStateSystemSleep = 0, kRBCPowerStateSleep = 1, kRBCPowerStateStandby = 2, kRBCPowerStateIdle = 3, kRBCPowerStateActive = 4, kRBCNumPowerStates = 5 }; /*! @enum Media lock state values @discussion Values used to set media lock state. @constant kMediaStateUnlocked Value to be passed in order to unlock media and make it availabe for writing. @constant kMediaStateLocked Value to be passed when the media is to be locked and made read-only. */ enum { kMediaStateUnlocked = 0, kMediaStateLocked = 1 }; #define kCapacityDataBufferSize 8 // Forward declaration for the SCSIReducedBlockCommands that is used internally by the // IOSCSIReducedBlockCommandsDevice class. class SCSIReducedBlockCommands; //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- /*! @class IOSCSIReducedBlockCommandsDevice @superclass IOSCSIPrimaryCommandsDevice @discussion Implementation of the T10 device Reduced Block Commands device. This is the base driver for all subclasses implementing peripheral device type 0xE. */ class __exported IOSCSIReducedBlockCommandsDevice : public IOSCSIPrimaryCommandsDevice { OSDeclareAbstractStructors ( IOSCSIReducedBlockCommandsDevice ); private: static void AsyncReadWriteComplete ( SCSITaskIdentifier completedTask ); protected: // Reserve space for future expansion. struct IOSCSIReducedBlockCommandsDeviceExpansionData { IONotifier * fPowerDownNotifier; bool fMediumRemovalPrevented; bool fKnownManualEject; UInt32 fPollingMode; bool fProtocolSpecificPowerControl; }; IOSCSIReducedBlockCommandsDeviceExpansionData * fIOSCSIReducedBlockCommandsDeviceReserved; #define fPowerDownNotifier fIOSCSIReducedBlockCommandsDeviceReserved->fPowerDownNotifier #define fMediumRemovalPrevented fIOSCSIReducedBlockCommandsDeviceReserved->fMediumRemovalPrevented #define fKnownManualEject fIOSCSIReducedBlockCommandsDeviceReserved->fKnownManualEject #define fPollingMode fIOSCSIReducedBlockCommandsDeviceReserved->fPollingMode #define fProtocolSpecificPowerControl fIOSCSIReducedBlockCommandsDeviceReserved->fProtocolSpecificPowerControl bool fMediaChanged; bool fMediaPresent; // The byte count of each physical block on the media. UInt32 fMediaBlockSize; // The total number of blocks of mediaBlockSize on the media. UInt32 fMediaBlockCount; // Flags used to indicate device features. bool fMediaIsRemovable; bool fMediaIsWriteProtected; thread_call_t fPollingThread; enum { kPollingMode_Suspended = 0, kPollingMode_NewMedia = 1, kPollingMode_MediaRemoval = 2 }; /*! @function CreateStorageServiceNub @abstract Creates a nub which links the IOSCSIReducedBlockCommandsDevice to the IOStorageFamily. @discussion Creates a nub which links the IOSCSIReducedBlockCommandsDevice to the IOStorageFamily. */ virtual void CreateStorageServiceNub ( void ); /*! @function DetermineDeviceCharacteristics @abstract Determine the characteristics of the device. @discussion Determine the characteristics, ANSI version, removability, etc., of the device via its INQUIRY data. @result <code>true</code> on success and <code>false</code> on failure. */ virtual bool DetermineDeviceCharacteristics ( void ); /*! @function PollForMedia @abstract Poll device for media insertion or removal depending on selected polling mode. @discussion Polls device for media insertion or removal depending on selected polling mode. If a change in media state is detected the correct media inserted or removed API is called from within PollForMedia. */ virtual void PollForMedia ( void ); /*! @function EnablePolling @abstract Enables media polling. @discussion Schedules a thread to poll the device for media at the prescribed interval. */ virtual void EnablePolling ( void ); /*! @function DisablePolling @abstract Disables media polling. @discussion Cancels ( if running ) the media polling thread. */ virtual void DisablePolling ( void ); /*! @function CheckWriteProtection @abstract Ascertains whether or not media is locked. @discussion Determines the current write protection state of the media. Result stored in fMediaIsWriteProtected. */ virtual void CheckWriteProtection ( void ); /*! @function SetMediaCharacteristics @abstract Sets the block size and block count for the current media. @discussion Sets the block size and block count for the current media. @param blockSize The media's block size in bytes. @param blockCount The count of the media's blocks. */ virtual void SetMediaCharacteristics ( UInt32 blockSize, UInt32 blockCount ); /*! @function ResetMediaCharacteristics @abstract Resets the block size and block count. @discussion Resets the block size and block count. */ virtual void ResetMediaCharacteristics ( void ); /*! @function ClearNotReadyStatus @abstract Clears any NOT_READY status for the device. @discussion Polls device with TEST_UNIT_READY until the device returns <code>kSCSITaskStatus_GOOD</code> status. Exits if device has become disconnected. @result <code>true</code> if device is now active (isInactive == false) and <code>false</code> otherwise. */ virtual bool ClearNotReadyStatus ( void ) APPLE_KEXT_OVERRIDE; /*! @function IssueRead @abstract DEPRECATED. Please do not use this method. @discussion DEPRECATED. Please do not use this method. @param buffer DEPRECATED. Please do not use this method. @param startBlock DEPRECATED. Please do not use this method. @param blockCount DEPRECATED. Please do not use this method. @result DEPRECATED. Please do not use this method. */ virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount ); /*! @function IssueWrite @abstract DEPRECATED. Please do not use this method. @discussion DEPRECATED. Please do not use this method. @param buffer DEPRECATED. Please do not use this method. @param startBlock DEPRECATED. Please do not use this method. @param blockCount DEPRECATED. Please do not use this method. @result DEPRECATED. Please do not use this method. */ virtual IOReturn IssueWrite ( IOMemoryDescriptor* buffer, UInt64 startBlock, UInt64 blockCount ); /*! @function IssueRead @abstract Issues an asynchronous read command. @discussion Issues an asynchronous read command. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied to. @param startBlock Starting logical block address for the read operation. @param blockCount The number of blocks to be read. @param clientData A valid pointer to the client data to be used for callback completion. @result A valid IOReturn value. */ virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, void * clientData ); /*! @function IssueWrite @abstract Issues an asynchronous write command. @discussion Issues an asynchronous write command. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied from. @param startBlock Starting logical block address for the write operation. @param blockCount The number of blocks to be written. @param clientData A valid pointer to the client data to be used for callback completion. @result A valid IOReturn value. */ virtual IOReturn IssueWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount, void * clientData ); // ----- Power Management Support ------ /*! @function InitializePowerManagement @abstract Called to initialize power management. @discussion Called by InitializeDeviceSupport() to initialize power management by, joining the power management tree, registering power states, and setting the lowest idle power state. @param A valid pointer to this object's provider. */ // We override this method to set our power states and register ourselves // as a power policy maker. virtual void InitializePowerManagement ( IOService * provider ) APPLE_KEXT_OVERRIDE; /*! @function GetInitialPowerState @abstract Called by power management to determine initial power state. @discussion Called by power management to determine which power state is desired when power management is initialized. @result Returns the initial power state desired when power management is initialized. */ // We override this method so that when we register for power management, // we go to our active power state (which the drive is definitely in // at startup time). virtual UInt32 GetInitialPowerState ( void ) APPLE_KEXT_OVERRIDE; /*! @function GetNumberOfPowerStateTransitions @abstract Called by power management to determine this class's total number of power state transitions. @discussion Called by power management to determine this class's total number of power state transitions. @result Returns the number of power state transitions for this class. */ // We override this method in order to provide the number of transitions // from Fully active to Sleep state so that the idle timer can be adjusted // to the appropriate time period based on the disk spin down time set in // the Energy Saver prefs panel. virtual UInt32 GetNumberOfPowerStateTransitions ( void ) APPLE_KEXT_OVERRIDE; /*! @function TicklePowerManager @abstract The TicklePowerManager() is called by CheckPowerState() and sends an activity tickle ( via activityTickle() ) to the power manager so that the idle timer is reset. @discussion The TicklePowerManager() is called by CheckPowerState() and sends an activity tickle ( via activityTickle() ) to the power manager so that the idle timer is reset. Subclasses must override this method. Third party subclasses shouldn't need to override this method but can to alter the default behavior. */ // The TicklePowerManager method is called to tell the power manager that the // device needs to be in a certain power state to handle requests. virtual void TicklePowerManager ( void ) APPLE_KEXT_OVERRIDE; /*! @function HandlePowerChange @abstract Handles the state machine for power management state changes. @discussion Handles the state machine for power management state changes. */ // The HandlePowerChange method is the state machine for power management. // It is guaranteed to be on its own thread of execution (different from // the power manager thread AND the workloop thread. This routine can // send sync or async calls to the drive without worrying about threading // issues. virtual void HandlePowerChange ( void ) APPLE_KEXT_OVERRIDE; /*! @function HandleCheckPowerState(void) @abstract The HandleCheckPowerState (void) method is on the serialized side of the command gate and can change member variables safely without multi-threading issues. It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state the class registered with. @discussion The HandleCheckPowerState (void) method is on the serialized side of the command gate and can change member variables safely without multi-threading issues. It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state the class registered with. Subclasses must override this method. Third party subclasses shouldn't need to override this method but can to alter the default behavior. The default behavior is to block until the object transistions to its maximum power state. */ virtual void HandleCheckPowerState ( void ) APPLE_KEXT_OVERRIDE; /*! @function CheckMediaPresence @abstract Called to ascertain the current presence of media. @discussion Called to ascertain the current presence of media. @result <code>true</code> if media is present and <code>false</code> if media is not present. */ // The CheckMediaPresence method is called to see if the media which we // anticipated being there is still there. virtual bool CheckMediaPresence ( void ); /*! @function InitializeDeviceSupport @abstract Called in super class's start() to initialize device support. @discussion Called in super class's start() to initialize device support. The underlying infrastructure for supporting a device must be implemented here. @result <code>true</code> if device could be successfully configured <code>false</code> if not. */ virtual bool InitializeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function StartDeviceSupport @abstract Called in super class's start() to start device support. @discussion Called in super class's start() to start device support. Support for starting devices and making them usable must be implemented here. */ virtual void StartDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function SuspendDeviceSupport @abstract Called to temporarily suspend device support. @discussion Called to temporarily suspend device support. Support for suspending devices must be implemented here. */ virtual void SuspendDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function ResumeDeviceSupport @abstract Called to temporarily resume device support. @discussion Called to temporarily resume device support. Support for resuming devices must be implemented here. */ virtual void ResumeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function StopDeviceSupport @abstract Called to stop device support. @discussion Called to stop device support. Support for stopping devices must be implemented here. */ virtual void StopDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function TerminateDeviceSupport @abstract Called to terminate device support. @discussion Called to terminate device support. The underlying infrastructure for support a device should be cleaned up here. */ virtual void TerminateDeviceSupport ( void ) APPLE_KEXT_OVERRIDE; /*! @function free @abstract Called to release all resources held by the object. @discussion Release all resources held by the object, then call super::free(). */ virtual void free ( void ) APPLE_KEXT_OVERRIDE; public: /*! @function SyncReadWrite @abstract Translates a synchronous I/O request into a read or a write. @discussion Translates a synchronous I/O request into a read or a write. Default implementation always returns kIOReturnUnsupported. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied to or from. @param startBlock Starting logical block address for the write operation. @param blockCount The number of block to be write. @result A valid IOReturn value. */ virtual IOReturn SyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 startBlock, UInt64 blockCount ); /*! @function AsyncReadWrite @abstract Translates an asynchronous I/O request into a read or a write. @discussion Translates an asynchronous I/O request into a read or a write. @param buffer A pointer to a valid IOMemoryDescriptor to which the data can be copied to or from. @param startBlock Starting logical block address for the write operation. @param blockCount The number of block to be write. @result A valid IOReturn value. */ virtual IOReturn AsyncReadWrite ( IOMemoryDescriptor * buffer, UInt64 block, UInt64 nblks, void * clientData ); /*! @function EjectTheMedia @abstract Called to eject the inserted media from the drive. @discussion Called by IOBlockStorageDevice subclasses to eject the inserted media from the drive. @result A valid IOReturn value. */ virtual IOReturn EjectTheMedia ( void ); /*! @function FormatMedia @abstract Called to perform a low level format of the inserted media. @discussion Called IOBlockStorageDevice subclasses to perform a low level of the inserted media. Default implementation simply returns kIOReturnUnsupported if not overridden. @param byteCapacity @result A valid IOReturn value. */ virtual IOReturn FormatMedia ( UInt64 byteCapacity ); /*! @function GetFormatCapacities @abstract Called to determine the formatted capacity of the inserted media. @discussion Called IOBlockStorageDevice subclasses to determine the formatted capacity of the inserted media. Presently unsupported by default implementation. Returns 0 unless overridden. @param capacities a pointer to a valid UInt64 array. @param capacitiesMaxCount the number of elements addressable within capacities. @result The number of elements assigned in capacities ( count is 1 based ). */ virtual UInt32 GetFormatCapacities ( UInt64 * capacities, UInt32 capacitiesMaxCount ) const; /*! @function LockUnlockMedia @abstract Called to lock or unlock the inserted media. @discussion Called by IOBlockStorageDevice subclasses to lock or unlock the inserted media. @param doLock if true the media will be locked, if false the media will be unlocked. @result A valid IOReturn value. */ virtual IOReturn LockUnlockMedia ( bool doLock ); /*! @function SynchronizeCache @abstract Called to synchronize the devices cache and thereby force its contents to be written out to the media. @discussion Called by IOBlockStorageDevice subclasses to synchronize the devices cache and thereby force the cache's contents to be written out to the media. @result A valid IOReturn value. */ virtual IOReturn SynchronizeCache ( void ); /*! @function ReportBlockSize @abstract Reports the logical block size of the media. @discussion Called by IOBlockStorageDevice subclasses to get the logical block size of the media. @param blockSize a valid pointer to a UInt64 in which the logical block size is to be stored. @result A valid IOReturn value. */ virtual IOReturn ReportBlockSize ( UInt64 * blockSize ); /*! @function ReportEjectability @abstract Reports whether or not the media is ejectable. @discussion Called by IOBlockStorageDevice subclasses to determine whether or not the media is ejectable. @param isEjectable a valid pointer to a bool in which the ejectability of the media is to be stored. @result A valid IOReturn value. */ virtual IOReturn ReportEjectability ( bool * isEjectable ); /*! @function ReportLockability @abstract Reports whether or not the media is lockable ( can be write protected ). @discussion Called by IOBlockStorageDevice subclasses to determine whether or not the media is lockable ( can be write protected ). @param isLockable a valid pointer to a bool in which the lockability of the media is to be stored. @result A valid IOReturn value. */ virtual IOReturn ReportLockability ( bool * isLockable ); /*! @function ReportPollRequirements @abstract Reports polling requirements to caller. @discussion Called by IOBlockStorageDevice subclasses to determine polling requirements. Used to determine if polling for media is required and if polling is expensive. @param pollIsRequired a pointer to a bool in which to store whether or not polling is required. @param pollIsExpensive a pointer to a bool in which to store whether or not polling is expensive. @result A valid IOReturn value. */ virtual IOReturn ReportPollRequirements ( bool * pollIsRequired, bool * pollIsExpensive ); /*! @function ReportMaxReadTransfer @abstract Reports maximum read transfer size to caller. @discussion Called by IOBlockStorageDevice subclasses to determine the maximum size of a read transfer in bytes. @param blockSize used to pass in the block size to be used for a follow up transfer. @param max a pointer to a UInt64 in which to store the maximum transfer size in bytes. @result A valid IOReturn value. */ virtual IOReturn ReportMaxReadTransfer ( UInt64 blockSize, UInt64 * max ); /*! @function ReportMaxValidBlock @abstract Reports the maximum valid block on the media. @discussion Called by IOBlockStorageDevice subclasses to determine the maximum valid block of the media. @param maxBlock a pointer to a UInt64 in which the maximum valid block is to be stored. @result A valid IOReturn value. */ virtual IOReturn ReportMaxValidBlock ( UInt64 * maxBlock ); /*! @function ReportMaxWriteTransfer @abstract Reports maximum write transfer size to caller. @discussion Called by IOBlockStorageDevice subclasses to determine the maximum size of a write transfer in bytes. @param blockSize used to pass in the block size of the media. @param max a pointer to a UInt64 in which to store the maximum transfer size in bytes. @result A valid IOReturn value. */ virtual IOReturn ReportMaxWriteTransfer ( UInt64 blockSize, UInt64 * max ); /*! @function ReportMediaState @abstract Reports the state of media in the device. @discussion Called by IOBlockStorageDevice subclasses to determine whether or not media is present and if that media has changed. @param mediaPresent a pointer to a bool in which media presence will be stored. @param changed a pointer to a bool in which whether or not the media has changed will be stored. @result A valid IOReturn value. */ virtual IOReturn ReportMediaState ( bool * mediaPresent, bool * changed ); /*! @function ReportRemovability @abstract Reports whether or not the media may be removed. @discussion Called by IOBlockStorageDevice subclasses to determine whether or not the media may be removed. @param isRemovable a pointer to a bool in which whether or not the media can be me removed will be stored. @result A valid IOReturn value. */ virtual IOReturn ReportRemovability ( bool * isRemovable ); /*! @function ReportWriteProtection @abstract Reports whether or not the media is write protected. @discussion Called by IOBlockStorageDevice subclasses to determine whether or not the media is write protected. @param isWriteProtected a pointer to a bool in which whether or not the media is write protected will be stored. @result A valid IOReturn value. */ virtual IOReturn ReportWriteProtection ( bool * isWriteProtected ); /*! @function sPollForMedia @abstract Static method called to poll for media. @discussion Static method called to poll for media. @param pdtDriver a pointer to a valid IOSCSIReducedBlockCommandsDevice ( or subclass ) which is to be polled. @param refCon a pointer to an additional object which can be determined by the implementer. */ static void sPollForMedia ( void * pdtDriver, void * refCon ); protected: /*! @function FORMAT_UNIT @abstract Builds a FORMAT UNIT command. @discussion Builds a FORMAT UNIT command. @param request a SCSITaskIdentifier in which the built command will be stored. @param IMMED used to specify whether or not the immediate bit for the command needs to be set. @param PROGRESS used to specify whether or not the progress bit for the commands needs to be set. @param PERCENT_TIME used to specify whether or not the percent time bit for the command needs to be set. @param INCREMENT used to specify whether or not the increment bit for the command needs to be set. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The FORMAT_UNIT command as defined in section 5.1 virtual bool FORMAT_UNIT ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField1Bit PROGRESS, SCSICmdField1Bit PERCENT_TIME, SCSICmdField1Bit INCREMENT ); /*! @function INQUIRY @abstract Builds a INQUIRY command. @discussion Builds a INQUIRY command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the received INQUIRY data is to be stored. @param CMDDT used to specify whether or not the command support data ( CmdDT ) bit for the commands needs to be set. @param EVPD used to specify whether or not the vital product data ( EVPD ) bit for the command needs to be set. @param PAGE_OR_OPERATION_CODE used to specify which INQUIRY data page is being requested of the device. @param ALLOCATION_LENGTH used to specify the maximum requested amount of INQUIRY data. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The INQUIRY command as defined in SPC-2 w/o CONTROL byte virtual bool INQUIRY ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit CMDDT, SCSICmdField1Bit EVPD, SCSICmdField1Byte PAGE_OR_OPERATION_CODE, SCSICmdField1Byte ALLOCATION_LENGTH ); /*! @function MODE_SELECT_6 @abstract Builds a MODE SELECT(6) command. @discussion Builds a MODE SELECT(6) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the MODE SELECT data is stored. @param PF used to specify whether or not the page format ( PF ) bit for the commands needs to be set. @param SP used to specify whether or not the saves pages ( SP ) bit for the command needs to be set. @param PARAMETER_LIST_LENGTH used to specify the length of the supplied data. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The MODE_SELECT(6) command as defined in SPC-2 w/o CONTROL byte virtual bool MODE_SELECT_6 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit PF, SCSICmdField1Bit SP, SCSICmdField1Byte PARAMETER_LIST_LENGTH ); /*! @function MODE_SENSE_6 @abstract Builds a MODE SENSE(6) command. @discussion Builds a MODE SENSE(6) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the MODE SENSE data is to be stored. @param DBD used to specify whether or not the disable block descriptors ( DBD ) bit for the commands needs to be set. @param PC used to specify the desired page control ( PC ) value. @param PAGE_CODE used to specify the desired page code. @param ALLOCATION_LENGTH used to specify the maximum requested amount of MODE_SENSE data. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The MODE_SENSE(6) command as defined in SPC-2 w/o CONTROL byte virtual bool MODE_SENSE_6 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Bit DBD, SCSICmdField2Bit PC, SCSICmdField6Bit PAGE_CODE, SCSICmdField1Byte ALLOCATION_LENGTH ); /*! @function PERSISTENT_RESERVE_IN @abstract Builds a PERSISTENT RESERVE IN command. @discussion Builds a PERSISTENT RESERVE IN command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the reservation data is to be stored. @param SERVICE_ACTION used to specify the SERVICE ACTION code. @param ALLOCATION_LENGTH used to specify the number of parameter data bytes available to be returned. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The PERSISTENT_RESERVE_IN command as defined in SPC-2 w/o CONTROL byte virtual bool PERSISTENT_RESERVE_IN ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField5Bit SERVICE_ACTION, SCSICmdField2Byte ALLOCATION_LENGTH ); /*! @function PERSISTENT_RESERVE_OUT @abstract Builds a PERSISTENT RESERVE OUT command. @discussion Builds a PERSISTENT RESERVE OUT command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the reservation data is stored. @param SERVICE_ACTION used to specify the SERVICE ACTION code. @param SCOPE used to specify the desired scope. @param TYPE used to specify the desired type. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The PERSISTENT_RESERVE_OUT command as defined in SPC-2 w/o CONTROL byte virtual bool PERSISTENT_RESERVE_OUT ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField5Bit SERVICE_ACTION, SCSICmdField4Bit SCOPE, SCSICmdField4Bit TYPE ); /*! @function PREVENT_ALLOW_MEDIUM_REMOVAL @abstract Builds a PREVENT ALLOW MEDIUM REMOVAL command. @discussion Builds a PREVENT ALLOW MEDIUM REMOVAL command. @param request a SCSITaskIdentifier in which the built command will be stored. @param PREVENT used to specify whether or not media removal shall be prevented or allowed. The caller uses kMediaStateUnlocked or kMediaStateLocked constant to set the state. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The PREVENT_ALLOW_MEDIUM_REMOVAL command as defined in SPC-2 w/o CONTROL byte virtual bool PREVENT_ALLOW_MEDIUM_REMOVAL ( SCSITaskIdentifier request, SCSICmdField2Bit PREVENT ); /*! @function READ_10 @abstract Builds a READ(10) command. @discussion Builds a READ(10) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the read data is to be stored. @param blockSize used to specify the block size to be used for the read. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the read is to be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The READ_10 command as defined in section 5.2 virtual bool READ_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte TRANSFER_LENGTH ); /*! @function READ_CAPACITY @abstract Builds a READ CAPACITY command. @discussion Builds a READ CAPACITY command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the read capacity data is to be stored. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The READ_CAPACITY command as defined in section 5.3 virtual bool READ_CAPACITY ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer ); /*! @function RELEASE_6 @abstract Builds a RELEASE(6) command. @discussion Builds a RELEASE(6) command. @param request a SCSITaskIdentifier in which the built command will be stored. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The RELEASE(6) command as defined in SPC-2 w/o CONTROL byte virtual bool RELEASE_6 ( SCSITaskIdentifier request ); /*! @function REQUEST_SENSE @abstract Builds a REQUEST SENSE command. @discussion Builds a REQUEST SENSE command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the sense data is to be stored. @param ALLOCATION_LENGTH the maximum size of sense data to be supplied. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The REQUEST_SENSE command as defined in SPC-2 w/o CONTROL byte virtual bool REQUEST_SENSE ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField1Byte ALLOCATION_LENGTH ); /*! @function RESERVE_6 @abstract Builds a RESERVE(6) command. @discussion Builds a RESERVE(6) command. @param request a SCSITaskIdentifier in which the built command will be stored. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The RESERVE(6) command as defined in SPC-2 w/o CONTROL byte virtual bool RESERVE_6 ( SCSITaskIdentifier request ); /*! @function START_STOP_UNIT @abstract Builds a START STOP UNIT command. @discussion Builds a START STOP UNIT command. @param request a SCSITaskIdentifier in which the built command will be stored. @param IMMED used to specify whether or not the immediate bit for the command needs to be set. @param POWER_CONDITIONS used to specify the desired POWER CONDITIONS code. @param LEOJ used to specify whether or not the LOAD/EJECT ( LEOJ ) bit for the command needs to be set. @param START used to specify whether or not the START bit for the command needs to be set. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The START_STOP_UNIT command as defined in section 5.4 virtual bool START_STOP_UNIT ( SCSITaskIdentifier request, SCSICmdField1Bit IMMED, SCSICmdField4Bit POWER_CONDITIONS, SCSICmdField1Bit LEOJ, SCSICmdField1Bit START ); /*! @function SYNCHRONIZE_CACHE @abstract Builds a SYNCHRONIZE CACHE command. @discussion Builds a SYNCHRONIZE CACHE command. @param request a SCSITaskIdentifier in which the built command will be stored. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The SYNCRONIZE_CACHE command as defined in section 5.5 virtual bool SYNCHRONIZE_CACHE ( SCSITaskIdentifier request ); /*! @function TEST_UNIT_READY @abstract Builds a TEST UNIT READY command. @discussion Builds a TEST UNIT READY command. @param request a SCSITaskIdentifier in which the built command will be stored. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The TEST_UNIT_READY command as defined in SPC-2 w/o CONTROL byte virtual bool TEST_UNIT_READY ( SCSITaskIdentifier request ); /*! @function VERIFY @abstract Builds a VERIFY command. @discussion Builds a VERIFY command. @param request a SCSITaskIdentifier in which the built command will be stored. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the verify should be initiated. @param VERIFICATION_LENGTH the desired length in blocks. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The VERIFY command as defined in section 5.7 virtual bool VERIFY ( SCSITaskIdentifier request, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte VERIFICATION_LENGTH ); /*! @function WRITE_10 @abstract Builds a WRITE(10) command. @discussion Builds a WRITE(10) command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the data to be written is stored. @param blockSize used to specify the block size to be used for the write. @param FUA used specify whether or not the force unit access ( FUA ) bit should be set. @param LOGICAL_BLOCK_ADDRESS used to specify the logical block address from which the write should be initiated. @param TRANSFER_LENGTH the desired transfer length in blocks. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The WRITE_10 command as defined in section 5.6 virtual bool WRITE_10 ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, UInt32 blockSize, SCSICmdField1Bit FUA, SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS, SCSICmdField2Byte TRANSFER_LENGTH ); /*! @function WRITE_BUFFER @abstract Builds a WRITE BUFFER command. @discussion Builds a WRITE BUFFER command. @param request a SCSITaskIdentifier in which the built command will be stored. @param dataBuffer a point to a valid IOMemoryDescriptor in which the data to be written is stored. @param MODE used to specify which WRITE BUFFER mode is to be used. @param BUFFER_ID used to be specificy the desired buffer ID. @param BUFFER_OFFSET used to specify the desired buffer offset. @param PARAMETER_LIST_LENGTH the length of the buffer to be transferred. @result <code>true</code> if the command was successfully built and <code>false</code> if not. */ // The WRITE_BUFFER command as defined in SPC-2 w/o CONTROL byte virtual bool WRITE_BUFFER ( SCSITaskIdentifier request, IOMemoryDescriptor * dataBuffer, SCSICmdField4Bit MODE, SCSICmdField1Byte BUFFER_ID, SCSICmdField3Byte BUFFER_OFFSET, SCSICmdField3Byte PARAMETER_LIST_LENGTH ); /* Added with 10.2 */ OSMetaClassDeclareReservedUsed ( IOSCSIReducedBlockCommandsDevice, 1 ); public: /*! @function PowerDownHandler @abstract Method called at sleep, restart, or shutdown time. @discussion Notification handler registered with registerPrioritySleepWakeInterest(). @param refCon a pointer to an object which can be determined by the implementer when registerPrioritySleepWakeInterest() is called. @param messageType a constant defined in IOMessage.h ( kIOMessageSystemWillPowerOff, kIOMessageSystemWillRestart, etc. ). @param provider a pointer to the provider of the notification. @param messageArgument a pointer to the notification's argument. @param argSize the size of the argument. @result A valid IOReturn value. */ virtual IOReturn PowerDownHandler ( void * refCon, UInt32 messageType, IOService * provider, void * messageArgument, vm_size_t argSize ); /* Added with 10.2 */ OSMetaClassDeclareReservedUsed ( IOSCSIReducedBlockCommandsDevice, 2 ); protected: /*! @function SetMediaIcon @abstract Sets graphical icon for device's media objects. @discussion Provides an opportunity for the driver to select a more fitting icon then default icon. */ virtual void SetMediaIcon ( void ); /* Added with 10.3.3 */ OSMetaClassDeclareReservedUsed ( IOSCSIReducedBlockCommandsDevice, 3 ); protected: /*! @function AsyncReadWriteCompletion @abstract Completion routine for asynchronous read and write requests. @discussion Completion routine for asynchronous read and write requests. */ virtual void AsyncReadWriteCompletion ( SCSITaskIdentifier completedTask ); private: // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 8 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIReducedBlockCommandsDevice, 16 ); }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_REDUCED_BLOCK_COMMANDS_DEVICE_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/SCSICmds_MODE_Definitions.h
/* * Copyright (c) 1998-2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_ #define _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #if KERNEL #include <IOKit/IOTypes.h> #else #include <CoreFoundation/CoreFoundation.h> #endif /*! @header SCSI Request Sense Definitions @discussion This file contains all definitions for the data returned from the MODE_SENSE_6 and MODE_SENSE_10 commands. */ #pragma pack(1) /*! @struct SPCModeParameterHeader6 @discussion Mode Parameter Header for the MODE_SENSE_6 command. */ typedef struct SPCModeParameterHeader6 { UInt8 MODE_DATA_LENGTH; UInt8 MEDIUM_TYPE; UInt8 DEVICE_SPECIFIC_PARAMETER; UInt8 BLOCK_DESCRIPTOR_LENGTH; } SPCModeParameterHeader6; /*! @struct SPCModeParameterHeader10 @discussion Mode Parameter Header for the MODE_SENSE_10 command. */ typedef struct SPCModeParameterHeader10 { UInt16 MODE_DATA_LENGTH; UInt8 MEDIUM_TYPE; UInt8 DEVICE_SPECIFIC_PARAMETER; UInt8 LONGLBA; UInt8 RESERVED; UInt16 BLOCK_DESCRIPTOR_LENGTH; } SPCModeParameterHeader10; /*! @enum Long LBA Bitfield definitions @discussion Long LBA Bitfield definitions for Mode Parameter Header for MODE_SENSE_10 command. @constant kModeSenseParameterHeader10_LongLBABit Bit to indicate Long LBA block descriptors follow. @constant kModeSenseParameterHeader10_LongLBAMask Mask to test for kModeSenseParameterHeader10_LongLBABit. */ enum { kModeSenseParameterHeader10_LongLBABit = 0, kModeSenseParameterHeader10_LongLBAMask = (1 << kModeSenseParameterHeader10_LongLBABit), }; /*! @enum Device Specific Parameter Bitfield definitions @discussion SBC definitions for Device Specific Parameter in the Mode Sense Header Block. @constant kModeSenseSBCDeviceSpecific_DPOFUABit Bit to indicate DPO and FUA bits are accepted by the device server. @constant kModeSenseSBCDeviceSpecific_WriteProtectBit Bit to indicate medium is write protected. @constant kModeSenseSBCDeviceSpecific_DPOFUAMask Mask to test for kModeSenseSBCDeviceSpecific_DPOFUABit. @constant kModeSenseSBCDeviceSpecific_WriteProtectMask Mask to test for kModeSenseSBCDeviceSpecific_WriteProtectBit. */ enum { kModeSenseSBCDeviceSpecific_DPOFUABit = 4, kModeSenseSBCDeviceSpecific_WriteProtectBit = 7, kModeSenseSBCDeviceSpecific_DPOFUAMask = (1 << kModeSenseSBCDeviceSpecific_DPOFUABit), kModeSenseSBCDeviceSpecific_WriteProtectMask = (1 << kModeSenseSBCDeviceSpecific_WriteProtectBit) }; /*! @struct ModeParameterBlockDescriptor @discussion General mode parameter block descriptor. */ typedef struct ModeParameterBlockDescriptor { UInt8 DENSITY_CODE; UInt8 NUMBER_OF_BLOCKS[3]; UInt8 RESERVED; UInt8 BLOCK_LENGTH[3]; } ModeParameterBlockDescriptor; /*! @struct DASDModeParameterBlockDescriptor @discussion Direct Access Storage Device mode parameter block descriptor. */ typedef struct DASDModeParameterBlockDescriptor { UInt32 NUMBER_OF_BLOCKS; UInt8 DENSITY_CODE; UInt8 BLOCK_LENGTH[3]; } DASDModeParameterBlockDescriptor; /*! @struct LongLBAModeParameterBlockDescriptor @discussion Long LBA mode parameter block descriptor. */ typedef struct LongLBAModeParameterBlockDescriptor { UInt64 NUMBER_OF_BLOCKS; UInt8 DENSITY_CODE; UInt8 RESERVED[3]; UInt32 BLOCK_LENGTH; } LongLBAModeParameterBlockDescriptor; /*! @struct ModePageFormatHeader @discussion Mode Page format header. */ typedef struct ModePageFormatHeader { UInt8 PS_PAGE_CODE; UInt8 PAGE_LENGTH; } ModePageFormatHeader; /*! @enum Mode Page Format bit definitions @discussion Mode Page Format bit definitions. @constant kModePageFormat_PS_Bit Bit to indicate Parameters Saveable. @constant kModePageFormat_PAGE_CODE_Mask Mask to obtain the PAGE_CODE from the PS_PAGE_CODE field. @constant kModePageFormat_PS_Mask Mask to test for kModePageFormat_PS_Bit. */ enum { kModePageFormat_PS_Bit = 7, kModePageFormat_PAGE_CODE_Mask = 0x3F, kModePageFormat_PS_Mask = (1 << kModePageFormat_PS_Bit) }; #if 0 #pragma mark - #pragma mark SPC Mode Pages #pragma mark - #endif /*! @enum SPC Mode Pages @discussion SPC Mode Page definitions. @constant kSPCModePagePowerConditionCode Power Conditions Mode Page value. @constant kSPCModePageAllPagesCode All Mode Pages value. */ enum { kSPCModePagePowerConditionCode = 0x1A, kSPCModePageAllPagesCode = 0x3F }; /*! @struct SPCModePagePowerCondition @discussion Power Conditions Mode Page (PAGE CODE 0x1A) format. */ typedef struct SPCModePagePowerCondition { ModePageFormatHeader header; UInt8 RESERVED; UInt8 IDLE_STANDBY; UInt32 IDLE_CONDITION_TIMER; UInt32 STANDBY_CONDITION_TIMER; } SPCModePagePowerCondition; #if 0 #pragma mark - #pragma mark 0x00 SBC Direct Access Mode Pages #pragma mark - #endif /*! @enum SBC Mode Pages @discussion SBC Mode Page definitions. @constant kSBCModePageFormatDeviceCode Format Device Mode Page value. @constant kSBCModePageRigidDiskGeometryCode Rigid Disk Geometry Page value. @constant kSBCModePageFlexibleDiskCode Flexible Disk Page value. @constant kSBCModePageCachingCode Caching Page value. */ enum { kSBCModePageFormatDeviceCode = 0x03, kSBCModePageRigidDiskGeometryCode = 0x04, kSBCModePageFlexibleDiskCode = 0x05, kSBCModePageCachingCode = 0x08 }; /*! @struct SBCModePageFormatDevice @discussion Format Device Mode Page (PAGE CODE 0x03) format. */ typedef struct SBCModePageFormatDevice { ModePageFormatHeader header; UInt16 TRACKS_PER_ZONE; UInt16 ALTERNATE_SECTORS_PER_ZONE; UInt16 ALTERNATE_TRACKS_PER_ZONE; UInt16 ALTERNATE_TRACKS_PER_LOGICAL_UNIT; UInt16 SECTORS_PER_TRACK; UInt16 DATA_BYTES_PER_PHYSICAL_SECTOR; UInt16 INTERLEAVE; UInt16 TRACK_SKEW_FACTOR; UInt16 CYLINDER_SKEW_FACTOR; UInt8 SSEC_HSEC_RMB_SURF; UInt8 RESERVED[3]; } SBCModePageFormatDevice; /*! @struct SBCModePageRigidDiskGeometry @discussion Rigid Disk Geometry Mode Page (PAGE CODE 0x04) format. */ typedef struct SBCModePageRigidDiskGeometry { ModePageFormatHeader header; UInt8 NUMBER_OF_CYLINDERS[3]; UInt8 NUMBER_OF_HEADS; UInt8 STARTING_CYLINDER_WRITE_PRECOMPENSATION[3]; UInt8 STARTING_CYLINDER_REDUCED_WRITE_CURRENT[3]; UInt16 DEVICE_STEP_RATE; UInt8 LANDING_ZONE_CYLINDER[3]; UInt8 RPL; UInt8 ROTATIONAL_OFFSET; UInt8 RESERVED; UInt16 MEDIUM_ROTATION_RATE; UInt8 RESERVED1[2]; } SBCModePageRigidDiskGeometry; /*! @enum Rigid Disk Geometry bitfields @discussion Bit field masks for Rigid Disk Geometry structure fields. @constant kSBCModePageRigidDiskGeometry_RPL_Mask Mask for use with the RPL field. */ enum { kSBCModePageRigidDiskGeometry_RPL_Mask = 0x03 }; /*! @struct SBCModePageFlexibleDisk @discussion Flexible Disk Mode Page (PAGE CODE 0x05) format. */ typedef struct SBCModePageFlexibleDisk { ModePageFormatHeader header; UInt16 TRANSFER_RATE; UInt8 NUMBER_OF_HEADS; UInt8 SECTORS_PER_TRACK; UInt16 DATA_BYTES_PER_SECTOR; UInt16 NUMBER_OF_CYLINDERS; UInt16 STARTING_CYLINDER_WRITE_PRECOMPENSATION; UInt16 STARTING_CYLINDER_REDUCED_WRITE_CURRENT; UInt16 DEVICE_STEP_RATE; UInt8 DEVICE_STEP_PULSE_WIDTH; UInt16 HEAD_SETTLE_DELAY; UInt8 MOTOR_ON_DELAY; UInt8 MOTOR_OFF_DELAY; UInt8 TRDY_SSN_MO; UInt8 SPC; UInt8 WRITE_COMPENSATION; UInt8 HEAD_LOAD_DELAY; UInt8 HEAD_UNLOAD_DELAY; UInt8 PIN_34_PIN_2; UInt8 PIN_4_PIN_1; UInt16 MEDIUM_ROTATION_RATE; UInt8 RESERVED[2]; } SBCModePageFlexibleDisk; /*! @enum TRDY_SSN_MO bitfields @discussion Bit field definitions and masks for Flexible Disk TRDY_SSN_MO field. @constant kSBCModePageFlexibleDisk_MO_Bit MO Bit definition. @constant kSBCModePageFlexibleDisk_SSN_Bit SSN Bit definition. @constant kSBCModePageFlexibleDisk_TRDY_Bit TRDY Bit definition. @constant kSBCModePageFlexibleDisk_MO_Mask Mask for use with TRDY_SSN_MO field. @constant kSBCModePageFlexibleDisk_SSN_Mask Mask for use with TRDY_SSN_MO field. @constant kSBCModePageFlexibleDisk_TRDY_Mask Mask for use with TRDY_SSN_MO field. */ enum { // Bits 0:4 Reserved kSBCModePageFlexibleDisk_MO_Bit = 5, kSBCModePageFlexibleDisk_SSN_Bit = 6, kSBCModePageFlexibleDisk_TRDY_Bit = 7, kSBCModePageFlexibleDisk_MO_Mask = (1 << kSBCModePageFlexibleDisk_MO_Bit), kSBCModePageFlexibleDisk_SSN_Mask = (1 << kSBCModePageFlexibleDisk_SSN_Bit), kSBCModePageFlexibleDisk_TRDY_Mask = (1 << kSBCModePageFlexibleDisk_TRDY_Bit) }; /*! @enum SPC bitfields @discussion Bit field definitions and masks for Flexible Disk SPC field. @constant kSBCModePageFlexibleDisk_SPC_Mask Mask for use with SPC field. */ enum { kSBCModePageFlexibleDisk_SPC_Mask = 0x0F }; /*! @enum PIN_34_PIN_2 bitfields @discussion Bit field definitions and masks for Flexible Disk PIN_34_PIN_2 field. @constant kSBCModePageFlexibleDisk_PIN_2_Mask Mask for use with PIN_34_PIN_2 field. @constant kSBCModePageFlexibleDisk_PIN_34_Mask Mask for use with PIN_34_PIN_2 field. */ enum { kSBCModePageFlexibleDisk_PIN_2_Mask = 0x0F, kSBCModePageFlexibleDisk_PIN_34_Mask = 0xF0 }; /*! @enum PIN_4_PIN_1 bitfields @discussion Bit field definitions and masks for Flexible Disk PIN_4_PIN_1 field. @constant kSBCModePageFlexibleDisk_PIN_1_Mask Mask for use with PIN_4_PIN_1 field. @constant kSBCModePageFlexibleDisk_PIN_4_Mask Mask for use with PIN_4_PIN_1 field. */ enum { kSBCModePageFlexibleDisk_PIN_1_Mask = 0x0F, kSBCModePageFlexibleDisk_PIN_4_Mask = 0xF0 }; /*! @struct SBCModePageCaching @discussion Caching Mode Page (PAGE CODE 0x08) format. */ typedef struct SBCModePageCaching { ModePageFormatHeader header; UInt8 flags; UInt8 DEMAND_READ_WRITE_RETENTION_PRIORITY; UInt16 DISABLE_PREFETCH_TRANSFER_LENGTH; UInt16 MINIMUM_PREFETCH; UInt16 MAXIMUM_PREFETCH; UInt16 MAXIMUM_PREFETCH_CEILING; UInt8 flags2; UInt8 NUMBER_OF_CACHE_SEGMENTS; UInt16 CACHE_SEGMENT_SIZE; UInt8 RESERVED; UInt8 NON_CACHE_SEGMENT_SIZE[3]; } SBCModePageCaching; /*! @enum Caching flags bitfields @discussion Bit field definitions and masks for Caching flags field. @constant kSBCModePageCaching_RCD_Bit RCD Bit definition. @constant kSBCModePageCaching_MF_Bit MF Bit definition. @constant kSBCModePageCaching_WCE_Bit WCE Bit definition. @constant kSBCModePageCaching_SIZE_Bit SIZE Bit definition. @constant kSBCModePageCaching_DISC_Bit DISC Bit definition. @constant kSBCModePageCaching_CAP_Bit CAP Bit definition. @constant kSBCModePageCaching_ABPF_Bit ABPF Bit definition. @constant kSBCModePageCaching_IC_Bit IC Bit definition. @constant kSBCModePageCaching_RCD_Mask Mask for use with flags field. @constant kSBCModePageCaching_MF_Mask Mask for use with flags field. @constant kSBCModePageCaching_WCE_Mask Mask for use with flags field. @constant kSBCModePageCaching_SIZE_Mask Mask for use with flags field. @constant kSBCModePageCaching_DISC_Mask Mask for use with flags field. @constant kSBCModePageCaching_CAP_Mask Mask for use with flags field. @constant kSBCModePageCaching_ABPF_Mask Mask for use with flags field. @constant kSBCModePageCaching_IC_Mask Mask for use with flags field. */ enum { kSBCModePageCaching_RCD_Bit = 0, kSBCModePageCaching_MF_Bit = 1, kSBCModePageCaching_WCE_Bit = 2, kSBCModePageCaching_SIZE_Bit = 3, kSBCModePageCaching_DISC_Bit = 4, kSBCModePageCaching_CAP_Bit = 5, kSBCModePageCaching_ABPF_Bit = 6, kSBCModePageCaching_IC_Bit = 7, kSBCModePageCaching_RCD_Mask = (1 << kSBCModePageCaching_RCD_Bit), kSBCModePageCaching_MF_Mask = (1 << kSBCModePageCaching_MF_Bit), kSBCModePageCaching_WCE_Mask = (1 << kSBCModePageCaching_WCE_Bit), kSBCModePageCaching_SIZE_Mask = (1 << kSBCModePageCaching_SIZE_Bit), kSBCModePageCaching_DISC_Mask = (1 << kSBCModePageCaching_DISC_Bit), kSBCModePageCaching_CAP_Mask = (1 << kSBCModePageCaching_CAP_Bit), kSBCModePageCaching_ABPF_Mask = (1 << kSBCModePageCaching_ABPF_Bit), kSBCModePageCaching_IC_Mask = (1 << kSBCModePageCaching_IC_Bit) }; /*! @enum Demand Read/Write Retention masks @discussion Demand Read/Write Retention masks. @constant kSBCModePageCaching_DEMAND_WRITE_Mask Mask for the DEMAND_READ_WRITE_RETENTION_PRIORITY field. @constant kSBCModePageCaching_DEMAND_READ_Mask Mask for the DEMAND_READ_WRITE_RETENTION_PRIORITY field. */ enum { kSBCModePageCaching_DEMAND_WRITE_Mask = 0x00FF, kSBCModePageCaching_DEMAND_READ_Mask = 0xFF00 }; /*! @enum Caching flags2 bitfields @discussion Bit field definitions and masks for Caching flags2 field. @constant kSBCModePageCaching_VS1_Bit VS1 Bit definition. @constant kSBCModePageCaching_VS2_Bit VS2 Bit definition. @constant kSBCModePageCaching_DRA_Bit DRA Bit definition. @constant kSBCModePageCaching_LBCSS_Bit LBCSS Bit definition. @constant kSBCModePageCaching_FSW_Bit FSW Bit definition. @constant kSBCModePageCaching_VS1_Mask Mask for use with flags2 field. @constant kSBCModePageCaching_VS2_Mask Mask for use with flags2 field. @constant kSBCModePageCaching_DRA_Mask Mask for use with flags2 field. @constant kSBCModePageCaching_LBCSS_Mask Mask for use with flags2 field. @constant kSBCModePageCaching_FSW_Mask Mask for use with flags2 field. */ enum { // Bits 0:2 Reserved kSBCModePageCaching_VS1_Bit = 3, kSBCModePageCaching_VS2_Bit = 4, kSBCModePageCaching_DRA_Bit = 5, kSBCModePageCaching_LBCSS_Bit = 6, kSBCModePageCaching_FSW_Bit = 7, kSBCModePageCaching_VS1_Mask = (1 << kSBCModePageCaching_VS1_Bit), kSBCModePageCaching_VS2_Mask = (1 << kSBCModePageCaching_VS2_Bit), kSBCModePageCaching_DRA_Mask = (1 << kSBCModePageCaching_DRA_Bit), kSBCModePageCaching_LBCSS_Mask = (1 << kSBCModePageCaching_LBCSS_Bit), kSBCModePageCaching_FSW_Mask = (1 << kSBCModePageCaching_FSW_Bit) }; #pragma options align=reset #endif /* _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/IOSCSIProtocolServices.h
/* * Copyright (c) 1998-2011 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IOKIT_IO_SCSI_PROTOCOL_SERVICES_H_ #define _IOKIT_IO_SCSI_PROTOCOL_SERVICES_H_ #if defined(KERNEL) && defined(__cplusplus) //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // Mach includes #include <kern/queue.h> // General IOKit headers #include <IOKit/IOLib.h> #include <IOKit/IOCommandGate.h> // SCSI Architecture Model Family includes #include <IOKit/scsi/SCSITask.h> #include <IOKit/scsi/IOSCSIProtocolInterface.h> #include <IOKit/scsi/SCSICmds_REQUEST_SENSE_Defs.h> // Build includes #include <TargetConditionals.h> //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- // Power Management values enum { kSCSIProtocolLayerPowerStateOff = 0, kSCSIProtocolLayerPowerStateOn = 1, kSCSIProtocolLayerNumDefaultStates = 2 }; // Forward definitions of internal use only classes class SCSITask; //----------------------------------------------------------------------------- // Class Declaration //----------------------------------------------------------------------------- /*! @class IOSCSIProtocolServices @superclass IOSCSIProtocolInterface @discussion This class defines the public SCSI Protocol Services Layer API for any class that implements SCSI protocol services. A protocol services layer driver is responsible for taking incoming SCSITaskIdentifier objects and translating them to the native command type for the native protocol interface (e.g. SBP-2 ORB on FireWire). */ class __exported IOSCSIProtocolServices : public IOSCSIProtocolInterface { OSDeclareAbstractStructors ( IOSCSIProtocolServices ) private: // The head pointer for the queue of waiting SCSI Tasks. SCSITask * fSCSITaskQueueHead; /* OBSOLETE */ // This is the lock for preventing multiple access while // manipulating the SCSI Task queue. IOSimpleLock * fQueueLock; // The internal flag to indicate whether service requests should be // executed or immediately errored, such as when a device is removed. bool fAllowServiceRequests; protected: // Reserve space for future expansion. struct IOSCSIProtocolServicesExpansionData { // For internal use only. Do not use. UInt32 fSemaphore; bool fRequiresAutosenseDescriptor; SCSITaskCompletion fCompletionRoutine; queue_head_t fTaskQueueHead; queue_head_t fAutoSenseQueueHead; }; IOSCSIProtocolServicesExpansionData * fIOSCSIProtocolServicesReserved; /*! @function SendSCSICommand @abstract Pure virtual method subclasses must implement in order to send SCSITasks on the wire. @discussion Send a SCSI Command to the device. If the command was sent to the device and is pending completion, the subclass should return true and return back the kSCSIServiceResponse_Request_In_Process response. If the command completes immediately with an error, the subclass will return true and return back the appropriate status. If the subclass is currently processing all the commands it can, the subclass will return false and the command will be resent next time CommandCompleted is called. @param request A valid SCSITaskIdentifier representing the command to send on the wire. @param serviceResponse Pointer to a SCSIServiceResponse value returned to the caller. @param taskStatus Pointer to a SCSITaskStatus value returned to the caller. @result False if no more commands can be processed at this time, otherwise true. */ virtual bool SendSCSICommand ( SCSITaskIdentifier request, SCSIServiceResponse * serviceResponse, SCSITaskStatus * taskStatus ) = 0; /*! @function AbortSCSICommand @abstract Pure virtual method subclasses must implement so that SCSITasks may be aborted. @discussion Provides the capability for a caller to request that a particular SCSITask be aborted. @param request A valid SCSITaskIdentifier representing the command to be aborted. @result A valid SCSIServiceResponse. */ virtual SCSIServiceResponse AbortSCSICommand ( SCSITaskIdentifier request ) = 0; /*! @function CommandCompleted @abstract Method subclass calls to complete a SCSITask. @discussion Subclasses will call this inherited method when the command executed by SendSCSICommand has completed. @param request A valid SCSITaskIdentifier indicating the request to complete. @param serviceResponse A valid SCSIServiceResponse value. @param taskStatus A valid SCSITaskStatus value. */ void CommandCompleted ( SCSITaskIdentifier request, SCSIServiceResponse serviceResponse, SCSITaskStatus taskStatus ); /*! @function GetTaskAttribute @abstract Accessor method to retrieve the SCSITaskAttribute associated with the specified request. @discussion Accessor method to retrieve the SCSITaskAttribute associated with the specified request. @param request A valid SCSITaskIdentifier. @result A valid SCSITaskAttribute value. */ SCSITaskAttribute GetTaskAttribute ( SCSITaskIdentifier request ); /*! @function SetTaskState @abstract Accessor method to set the SCSITaskState associated with the specified request. @discussion Accessor method to set the SCSITaskState associated with the specified request. @param request A valid SCSITaskIdentifier. @param newTaskState A valid SCSITaskState value. @result True on success, otherwise false. */ bool SetTaskState ( SCSITaskIdentifier request, SCSITaskState newTaskState ); /*! @function GetTaskState @abstract Accessor method to retrieve the SCSITaskState associated with the specified request. @discussion Accessor method to retrieve the SCSITaskState associated with the specified request. @param request A valid SCSITaskIdentifier. @result A valid SCSITaskState value. */ SCSITaskState GetTaskState ( SCSITaskIdentifier request ); /*! @function GetLogicalUnitNumber @abstract Accessor method to retrieve the logical unit number associated with the specified request. @discussion Accessor method to retrieve the logical unit number associated with the specified request. NOTE: This method is deprecated in favor of GetLogicalUnitBytes(). @param request A valid SCSITaskIdentifier. @result A valid single-byte LUN value. */ UInt8 GetLogicalUnitNumber ( SCSITaskIdentifier request ); /*! @function GetLogicalUnitBytes @abstract Accessor method to retrieve the logical unit bytes associated with the specified request. @discussion Accessor method to retrieve the logical unit bytes associated with the specified request. @param request A valid SCSITaskIdentifier. @param lunBytes A pointer to SCSILogicalUnitBytes to be filled in by this method. */ void GetLogicalUnitBytes ( SCSITaskIdentifier request, SCSILogicalUnitBytes * lunBytes ); /*! @function GetCommandDescriptorBlockSize @abstract Accessor method to retrieve the Command Descriptor Block size associated with the specified request. @discussion Accessor method to retrieve the Command Descriptor Block size associated with the specified request. @param request A valid SCSITaskIdentifier. @result A valid CDB size (e.g. 6, 10, 12, or 16 bytes). */ UInt8 GetCommandDescriptorBlockSize ( SCSITaskIdentifier request ); /*! @function GetCommandDescriptorBlock @abstract Accessor method to retrieve the Command Descriptor Block associated with the specified request. @discussion Accessor method to retrieve the Command Descriptor Block associated with the specified request. @param request A valid SCSITaskIdentifier. @param cdbData A pointer to SCSICommandDescriptorBlock to be filled in by this method. NOTE: This routine will always fill in 16 bytes, so if the protocol layer driver supports less than this amount it will have to create a local SCSICommandDescriptorBlock variable to get the CDB data. @result True on success, otherwise false. */ bool GetCommandDescriptorBlock ( SCSITaskIdentifier request, SCSICommandDescriptorBlock * cdbData ); /*! @function GetDataTransferDirection @abstract Accessor method to retrieve the data transfer direction associated with the specified request. @discussion Accessor method to retrieve the data transfer direction associated with the specified request. @param request A valid SCSITaskIdentifier. @result The data transfer direction (e.g. kSCSIDataTransfer_NoDataTransfer). */ UInt8 GetDataTransferDirection ( SCSITaskIdentifier request ); /*! @function GetRequestedDataTransferCount @abstract Accessor method to retrieve the requested data transfer count associated with the specified request. @discussion Accessor method to retrieve the requested data transfer count associated with the specified request. @param request A valid SCSITaskIdentifier. @result The requested data transfer count. */ UInt64 GetRequestedDataTransferCount ( SCSITaskIdentifier request ); /*! @function SetRealizedDataTransferCount @abstract Accessor method to set the realized (actual) data transfer count associated with the specified request. @discussion Accessor method to set the realized (actual) data transfer count associated with the specified request. @param request A valid SCSITaskIdentifier. @param newRealizedDataCount The realized (actual) data count transferred. @result True on success, otherwise false. */ bool SetRealizedDataTransferCount ( SCSITaskIdentifier request, UInt64 newRealizedDataCount ); /*! @function GetRealizedDataTransferCount @abstract Accessor method to retrieve the realized data transfer count associated with the specified request. @discussion Accessor method to retrieve the realized data transfer count associated with the specified request. @param request A valid SCSITaskIdentifier. @result The realized data transfer count. */ UInt64 GetRealizedDataTransferCount ( SCSITaskIdentifier request ); /*! @function GetDataBuffer @abstract Accessor method to retrieve the data buffer associated with the specified request. @discussion Accessor method to retrieve the data buffer associated with the specified request. @param request A valid SCSITaskIdentifier. @result An IOMemoryDescriptor associated with the request. May be NULL if data transfer direction is kSCSIDataTransfer_NoDataTransfer. */ IOMemoryDescriptor * GetDataBuffer ( SCSITaskIdentifier request ); /*! @function GetDataBufferOffset @abstract Accessor method to retrieve the data buffer offset associated with the specified request. @discussion Accessor method to retrieve the data buffer offset associated with the specified request. @param request A valid SCSITaskIdentifier. @result Offset into the data buffer at which to start the transfer of data. */ UInt64 GetDataBufferOffset ( SCSITaskIdentifier request ); /*! @function GetTimeoutDuration @abstract Accessor method to retrieve the timeout duration in milliseconds associated with the specified request. @discussion Accessor method to retrieve the timeout duration in milliseconds associated with the specified request. @param request A valid SCSITaskIdentifier. @result Timeout duration in milliseconds. */ UInt32 GetTimeoutDuration ( SCSITaskIdentifier request ); /*! @function GetAutosenseRequestedDataTransferCount @abstract Accessor method to retrieve the requested data transfer count for autosense data associated with the specified request. @discussion Accessor method to retrieve the requested data transfer count for autosense data associated with the specified request. @param request A valid SCSITaskIdentifier. @result The requested autosense data transfer count. */ UInt64 GetAutosenseRequestedDataTransferCount ( SCSITaskIdentifier request ); /*! @function SetAutoSenseData @abstract Accessor method to set the autosense data. NOTE: This method is deprecated. @discussion Accessor method to set the autosense data. NOTE: This method is deprecated. @param request A valid SCSITaskIdentifier. @param senseData A pointer to a SCSI_Sense_Data structure to be copied. Only sizeof(struct SCSI_Sense_Data) bytes will be copied. @result True if sense data was successfully copied, otherwise false. */ bool SetAutoSenseData ( SCSITaskIdentifier request, SCSI_Sense_Data * senseData ) __attribute__ ((deprecated)); /*! @function SetAutoSenseData @abstract Accessor method to set the autosense data. @discussion Accessor method to set the autosense data. @param request A valid SCSITaskIdentifier. @param senseData A pointer to sense data to be copied. @param senseDataSize Number of bytes to copy. @result True if sense data was successfully copied, otherwise false. */ bool SetAutoSenseData ( SCSITaskIdentifier request, SCSI_Sense_Data * senseData, UInt8 senseDataSize ); /*! @function EnsureAutosenseDescriptorExists @abstract Internal method, not to be called by subclasses. @discussion Internal method, not to be called by subclasses. @param request A valid SCSITaskIdentifier. */ void EnsureAutosenseDescriptorExists ( SCSITaskIdentifier request ); /*! @function SetProtocolLayerReference @abstract Accessor method to set the protocol layer reference. @discussion Accessor method to set the protocol layer reference. @param request A valid SCSITaskIdentifier. @param newReferenceValue Pointer to reference data. @result True on success, otherwise false. */ bool SetProtocolLayerReference ( SCSITaskIdentifier request, void * newReferenceValue ); /*! @function GetProtocolLayerReference @abstract Accessor method to retrieve the protocol layer reference. @discussion Accessor method to retrieve the protocol layer reference. @param request A valid SCSITaskIdentifier. @result The protocol layer reference value. May be NULL. */ void * GetProtocolLayerReference ( SCSITaskIdentifier request ); /*! @function SetTaskExecutionMode @abstract Internal method used to set the task execution mode. @discussion Internal method used to set the task execution mode. @param request A valid SCSITaskIdentifier. @param newTaskMode A valid SCSITaskMode value. @result True on success, otherwise false. */ bool SetTaskExecutionMode ( SCSITaskIdentifier request, SCSITaskMode newTaskMode ); /*! @function GetTaskExecutionMode @abstract Internal method used to retrieve the task execution mode. @discussion Internal method used to retrieve the task execution mode. @param request A valid SCSITaskIdentifier. @result A valid SCSITaskMode value. */ SCSITaskMode GetTaskExecutionMode ( SCSITaskIdentifier request ); /*! @function SendNotification_DeviceRemoved @abstract Method called by subclasses when a device is physically removed from the bus. @discussion Method called by subclasses when a device is physically removed from the bus. */ void SendNotification_DeviceRemoved ( void ); /*! @function SendNotification_VerifyDeviceState @abstract Method called by subclasses when a device state needs to be re-verified due to some bus condition which may have changed the device state. @discussion Method called by subclasses when a device state needs to be re-verified due to some bus condition which may have changed the device state. */ void SendNotification_VerifyDeviceState ( void ); // -- SCSI Task Queue Management Methods -- // Following are the commands used to manipulate the queue of pending SCSI Tasks. /*! @function AddSCSITaskToQueue @abstract Internal method called to add a SCSITask to the processing queue. @discussion Internal method called to add a SCSITask to the processing queue. @param request A valid SCSITaskIdentifier. */ void AddSCSITaskToQueue ( SCSITaskIdentifier request ); /*! @function AddSCSITaskToHeadOfQueue @abstract Internal method called to add a SCSITask to the head of the processing queue. @discussion Internal method called to add a SCSITask to the head of the processing queue. @param request A valid SCSITask pointer. */ void AddSCSITaskToHeadOfQueue ( SCSITask * request ); /*! @function RetrieveNextSCSITaskFromQueue @abstract Internal method called to retrieve the next SCSITask to process. @discussion Internal method called to retrieve the next SCSITask to process. @result A valid SCSITask pointer or NULL if there are no tasks to process. */ SCSITask * RetrieveNextSCSITaskFromQueue ( void ); /*! @function AbortSCSITaskFromQueue @abstract Deprecated internal method. @discussion Deprecated internal method. */ bool AbortSCSITaskFromQueue ( SCSITask * request ); /*! @function SendSCSITasksFromQueue @abstract Internal method called to start processing SCSITasks. @discussion Internal method called to start processing SCSITasks. Only one client or workloop thread may process SCSITasks at any point in time. This method coordinates to ensure only one thread does so. */ void SendSCSITasksFromQueue ( void ); /*! @function RejectSCSITasksCurrentlyQueued @abstract Internal method called to reject currently enqueued SCSITasks. @discussion Internal method called to reject currently enqueued SCSITasks. This method is typically called in response to device termination. */ void RejectSCSITasksCurrentlyQueued ( void ); /*! @function ProcessCompletedTask @abstract Internal method called to process completed SCSITasks. @discussion Internal method called to process completed SCSITasks. This method determines if a CHECK_CONDITION has occurred and if sense data was requested and autosense data is not present. If so, it will change the execution mode of the SCSITask and request sense data on behalf of the caller. @param request A valid SCSITaskIdentifier. @param serviceResponse A valid SCSIServiceResponse value. @param taskStatus A valid SCSITaskStatus value. */ void ProcessCompletedTask ( SCSITaskIdentifier request, SCSIServiceResponse serviceResponse, SCSITaskStatus taskStatus ); /*! @function RejectTask @abstract Internal method called to reject a particular SCSITask. @discussion Internal method called to reject a particular SCSITask. @param request A valid SCSITaskIdentifier. */ void RejectTask ( SCSITaskIdentifier request ); // ------ Power Management Support ------ /*! @function InitializePowerManagement @abstract Subclasses call this method to initialize power management. @discussion Subclasses call this method to initialize power management. In the protocol services layer, this method calls the protocol interface layer to initialize power management state variables and then registers the protocol layer driver with the power manager with two(2) states, ON and OFF. Subclasses may override this behavior. @param provider The provider to be joined to in the power management tree. */ virtual void InitializePowerManagement ( IOService * provider ) APPLE_KEXT_OVERRIDE; /*! @function GetInitialPowerState @abstract This method is called once, right after InitializePowerManagement() in order to determine what state the device is initially in at startup time (usually the highest power mode). @discussion This method is called once, right after InitializePowerManagement() in order to determine what state the device is initially in at startup time (usually the highest power mode). @result The power state the device is currently in. */ virtual UInt32 GetInitialPowerState ( void ) APPLE_KEXT_OVERRIDE; /*! @function HandlePowerChange @abstract This method is called to handle a power change. @discussion This method is called to handle a power change. It is called from a clean thread context (i.e. new thread, no locks held) and can make synchronous or asynchronous calls. */ virtual void HandlePowerChange ( void ) APPLE_KEXT_OVERRIDE; /*! @function HandleCheckPowerState @abstract Method called to check if the device is in the correct power state for an I/O. @discussion The HandleCheckPowerState (void) method is on the serialized side of the command gate and can change member variables safely without multi-threading issues. Its main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState ) with the max power state with which the class registered. */ virtual void HandleCheckPowerState ( void ) APPLE_KEXT_OVERRIDE; /*! @function TicklePowerManager @abstract Internal method. Do not use. @discussion Internal method. Do not use. */ virtual void TicklePowerManager ( void ) APPLE_KEXT_OVERRIDE; /*! @function HandlePowerOff @abstract Convenience method for a protocol service driver to handle a power off call (called on the way to sleep). @discussion Convenience method for a protocol service driver to handle a power off call (called on the way to sleep). This method is guaranteed to be called after application layer drivers have been put to sleep. @result A valid IOReturn code. */ virtual IOReturn HandlePowerOff ( void ); /*! @function HandlePowerOn @abstract Convenience method for a protocol service driver to handle a power on call (called on the way back up from sleep). @discussion Convenience method for a protocol service driver to handle a power on call (called on the way back up from sleep). Driver should perform any bus specific activity necessary to recover from power-on/wake from sleep (e.g. bus reset on ATAPI). This method is guaranteed to be called before application layer drivers have been awakened. @result A valid IOReturn code. */ virtual IOReturn HandlePowerOn ( void ); public: /*! @function init @abstract Standard init method for all IORegistryEntry subclasses. @discussion A registry entry must be initialized with this method before it can be used. A property dictionary may passed and will be retained by this method for use as the registry entry's property table, or an empty one will be created. @param A dictionary that will become the registry entry's property table (retaining it), or zero which will cause an empty property table to be created. @result true on success, or false on a resource failure. */ virtual bool init ( OSDictionary * propTable = 0 ) APPLE_KEXT_OVERRIDE; /*! @function start @abstract During an IOService object's instantiation, starts the IOService object that has been selected to run on the provider. @discussion The <code>start</code> method of an IOService instance is called by its provider when it has been selected (due to its probe score and match category) as the winning client. The client is already attached to the provider when <code>start</code> is called.<br>Implementations of <code>start</code> must call <code>start</code> on their superclass at an appropriate point. If an implementation of <code>start</code> has already called <code>super::start</code> but subsequently determines that it will fail, it must call <code>super::stop</code> to balance the prior call to <code>super::start</code> and prevent reference leaks. @result <code>true</code> if the start was successful; <code>false</code> otherwise (which will cause the instance to be detached and usually freed). */ virtual bool start ( IOService * provider ) APPLE_KEXT_OVERRIDE; /*! @function free @abstract Frees data structures that were allocated during start(). @discussion Frees data structures that were allocated during start(). */ virtual void free ( void ) APPLE_KEXT_OVERRIDE; /*! @function RegisterSCSITaskCompletionRoutine @abstract Used by IOSCSITargetDevice to register a completion routine. @discussion Used by IOSCSITargetDevice to register a completion routine. Internal use only. @param completion A SCSITaskCompletion routine. */ void RegisterSCSITaskCompletionRoutine ( SCSITaskCompletion completion ); // ------- SCSI Architecture Model Task Management Functions ------ /*! @function ExecuteCommand @abstract ExecuteCommand method will take a SCSI Task and transport it across the physical wire(s) to the device. @discussion ExecuteCommand method will take a SCSI Task and transport it across the physical wire(s) to the device. @param request A valid SCSITaskIdentifier. */ void ExecuteCommand ( SCSITaskIdentifier request ) APPLE_KEXT_OVERRIDE; /*! @function AbortTask @abstract The Task Management function to allow the SCSI Application Layer client to request that a specific task be aborted. @discussion The Task Management function to allow the SCSI Application Layer client to request that a specific task be aborted. @param theLogicalUnit A logical unit for which to abort a task. @param theTag A valid SCSITaggedTaskIdentifier used to identify which task to abort. @result A valid SCSIServiceResponse. */ SCSIServiceResponse AbortTask ( UInt8 theLogicalUnit, SCSITaggedTaskIdentifier theTag ) APPLE_KEXT_OVERRIDE; /*! @function AbortTaskSet @abstract The Task Management function to allow the SCSI Application Layer client to request that a complete task set be aborted. @discussion The Task Management function to allow the SCSI Application Layer client to request that a complete task set be aborted. @param theLogicalUnit A logical unit for which to abort the task set. @result A valid SCSIServiceResponse. */ SCSIServiceResponse AbortTaskSet ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; /*! @function ClearACA @abstract The Task Management function to clear an Auto-Contingent Allegiance condition. @discussion The Task Management function to clear an Auto-Contingent Allegiance condition. @param theLogicalUnit A logical unit for which to clear the ACA. @result A valid SCSIServiceResponse. */ SCSIServiceResponse ClearACA ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; /*! @function ClearTaskSet @abstract The Task Management function to clear a task set. @discussion The Task Management function to clear a task set. @param theLogicalUnit A logical unit for which to clear a task set. @result A valid SCSIServiceResponse. */ SCSIServiceResponse ClearTaskSet ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; /*! @function LogicalUnitReset @abstract The Task Management function to reset a logical unit. @discussion The Task Management function to reset a logical unit. @param theLogicalUnit A logical unit for which to clear a task set. @result A valid SCSIServiceResponse. */ SCSIServiceResponse LogicalUnitReset ( UInt8 theLogicalUnit ) APPLE_KEXT_OVERRIDE; /*! @function TargetReset @abstract The Task Management function to reset a target device. @discussion The Task Management function to reset a target device. @result A valid SCSIServiceResponse. */ SCSIServiceResponse TargetReset ( void ) APPLE_KEXT_OVERRIDE; // ************* Obsoleted Member Routine **************** /*! @function AbortCommand @abstract Deprecated. Do not use. @discussion Deprecated. Do not use. */ virtual SCSIServiceResponse AbortCommand ( SCSITaskIdentifier request ) APPLE_KEXT_OVERRIDE __attribute__ ((deprecated)); // ---- Method used for determining protocol or physical interconnect characteristics. ---- /*! @function IsProtocolServiceSupported @abstract IsProtocolServiceSupported will return true if the specified feature is supported by the protocol layer. @discussion IsProtocolServiceSupported will return true if the specified feature is supported by the protocol layer. @param feature A valid SCSIProtocolFeature. @param serviceValue A pointer to a value for the protocol feature. @result True if the requested service is supported, otherwise false. */ virtual bool IsProtocolServiceSupported ( SCSIProtocolFeature feature, void * serviceValue ) APPLE_KEXT_OVERRIDE = 0; /*! @function HandleProtocolServiceFeature @abstract HandleProtocolServiceFeature instructs the Protocol Services driver to perform the necessary tasks for the indicated feature. @discussion HandleProtocolServiceFeature instructs the Protocol Services driver to perform the necessary tasks for the indicated feature. @param feature A valid SCSIProtocolFeature. @param serviceValue A pointer to a value for the protocol feature. @result True if successful, otherwise false. */ virtual bool HandleProtocolServiceFeature ( SCSIProtocolFeature feature, void * serviceValue ) APPLE_KEXT_OVERRIDE = 0; protected: // ----- Protocol Services Driver request handlers for Task Management functions ----- /*! @function HandleAbortTask @abstract HandleAbortTask instructs the Protocol Services driver to abort the task. @discussion HandleAbortTask instructs the Protocol Services driver to abort the task. @param theLogicalUnit A valid logical unit number. @param theTag The tag of the command to abort. @result A valid SCSIServiceResponse. */ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolServices, 1 ); virtual SCSIServiceResponse HandleAbortTask ( UInt8 theLogicalUnit, SCSITaggedTaskIdentifier theTag ); /*! @function HandleAbortTaskSet @abstract HandleAbortTaskSet instructs the Protocol Services driver to abort the task set. @discussion HandleAbortTaskSet instructs the Protocol Services driver to abort the task set. @param theLogicalUnit A valid logical unit number. @result A valid SCSIServiceResponse. */ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolServices, 2 ); virtual SCSIServiceResponse HandleAbortTaskSet ( UInt8 theLogicalUnit ); /*! @function HandleClearACA @abstract HandleClearACA instructs the Protocol Services driver to clear an auto-contingent allegiance. @discussion HandleClearACA instructs the Protocol Services driver to clear an auto-contingent allegiance. @param theLogicalUnit A valid logical unit number. @result A valid SCSIServiceResponse. */ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolServices, 3 ); virtual SCSIServiceResponse HandleClearACA ( UInt8 theLogicalUnit ); /*! @function HandleClearTaskSet @abstract HandleClearTaskSet instructs the Protocol Services driver to clear the task set. @discussion HandleClearTaskSet instructs the Protocol Services driver to clear the task set. @param theLogicalUnit A valid logical unit number. @result A valid SCSIServiceResponse. */ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolServices, 4 ); virtual SCSIServiceResponse HandleClearTaskSet ( UInt8 theLogicalUnit ); /*! @function HandleLogicalUnitReset @abstract HandleLogicalUnitReset instructs the Protocol Services driver to reset the logical unit. @discussion HandleLogicalUnitReset instructs the Protocol Services driver to reset the logical unit. @param theLogicalUnit A valid logical unit number. @result A valid SCSIServiceResponse. */ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolServices, 5 ); virtual SCSIServiceResponse HandleLogicalUnitReset ( UInt8 theLogicalUnit ); /*! @function HandleTargetReset @abstract HandleTargetReset instructs the Protocol Services driver to reset the target. @discussion HandleTargetReset instructs the Protocol Services driver to reset the target. @result A valid SCSIServiceResponse. */ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolServices, 6 ); virtual SCSIServiceResponse HandleTargetReset ( void ); /*! @function CreateSCSITargetDevice @abstract Used to create a SCSITargetDevice which will manage logical units. @discussion The CreateSCSITargetDevice member routine will create the appropriate object to represent the Target portion of a SCSI Device. This object is responsible for managing the Target functions of the SCSI Device including the Task Manager and Logical Units. @result True if successful, otherwise false. */ OSMetaClassDeclareReservedUsed ( IOSCSIProtocolServices, 7 ); virtual bool CreateSCSITargetDevice ( void ); private: #if !TARGET_OS_IPHONE // Space reserved for future expansion. OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 8 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 9 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 10 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 11 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 12 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIProtocolServices, 16 ); #endif /* !TARGET_OS_IPHONE */ }; #endif /* defined(KERNEL) && defined(__cplusplus) */ #endif /* _IOKIT_IO_SCSI_PROTOCOL_SERVICES_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/spi/IOSCSIParallelInterfaceController.h
/* * Copyright (c) 2002-2008 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef __IOKIT_IO_SCSI_PARALLEL_INTERFACE_CONTROLLER_H__ #define __IOKIT_IO_SCSI_PARALLEL_INTERFACE_CONTROLLER_H__ /*! @header IOSCSIParallelInterfaceController The IOSCSIParallelInterfaceController class and the associated HBA child class is responsible for the management of all related hardware. This includes the onboard HBA controller chip and the physical state of the bus. These classes are not responsible for any of the management of the SCSI Devices on the bus with the exception of maintaining the queue that holds the objects representing those SCSI Devices. */ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- // General IOKit includes #include <IOKit/IOService.h> #include <IOKit/IOWorkLoop.h> #include <IOKit/IOCommandGate.h> #include <IOKit/IODMACommand.h> #include <IOKit/IOInterruptEventSource.h> #include <IOKit/IOFilterInterruptEventSource.h> #include <IOKit/IOTimerEventSource.h> #include <IOKit/IOCommandPool.h> // IOKit SCSI ArchitectureModel Family includes #include <IOKit/scsi/SCSITask.h> #include <IOKit/scsi/SCSICmds_REQUEST_SENSE_Defs.h> #include <IOKit/scsi/SCSIPort.h> // SCSI Parallel Interface includes #include "IOSCSIParallelControllerCharacteristics.h" // System includes #include <sys/cdefs.h> //----------------------------------------------------------------------------- // Constants //----------------------------------------------------------------------------- #define kIOPropertySCSIDeviceFeaturesKey "SCSI Device Features" #define kIOPropertySCSI_I_T_NexusFeaturesKey "SCSI I_T Nexus Features" // The SCSI Message Codes used for MESSAGE IN and MESSAGE OUT phases. enum SCSIParallelMessages { // Link Control Messages kSCSIParallelMessage_TASK_COMPLETE = 0x00, kSCSIParallelMessage_EXTENDED_MESSAGE = 0x01, kSCSIParallelMessage_SAVE_DATA_POINTER = 0x02, kSCSIParallelMessage_RESTORE_POINTERS = 0x03, kSCSIParallelMessage_DISCONNECT = 0x04, kSCSIParallelMessage_INITIATOR_DETECTED_ERROR = 0x05, kSCSIParallelMessage_MESSAGE_REJECT = 0x07, kSCSIParallelMessage_NO_OPERATION = 0x08, kSCSIParallelMessage_MESSAGE_PARITY_ERROR = 0x09, kSCSIParallelMessage_IGNORE_WIDE_RESIDUE = 0x23, kSCSIParallelMessage_QAS_REQUEST = 0x55, kSCSIParallelMessage_IDENTIFY = 0x80, // The Message Codes used in the EXTENDED_MESSAGE message. kSCSIParallelMessage_MODIFY_DATA_POINTER = 0x00, kSCSIParallelMessage_SYNCHONOUS_DATA_TRANSFER_REQUEST = 0x01, // Reserved = 0x02 kSCSIParallelMessage_WIDE_DATA_TRANSFER_REQUEST = 0x03, kSCSIParallelMessage_PARALLEL_PROTOCOL_REQUEST = 0x04, // Reserved = 0x05 through 0xFF // Task Attribute Message Codes kSCSIParallelMessage_ACA = 0x24, kSCSIParallelMessage_HEAD_OF_QUEUE = 0x21, kSCSIParallelMessage_LINKED_COMMAND_COMPLETE = 0x0A, kSCSIParallelMessage_ORDERED = 0x22, kSCSIParallelMessage_SIMPLE = 0x20, // Task Management Message Codes kSCSIParallelMessage_ABORT_TASK = 0x0D, kSCSIParallelMessage_ABORT_TASK_SET = 0x06, kSCSIParallelMessage_CLEAR_ACA = 0x16, kSCSIParallelMessage_CLEAR_TASK_SET = 0x0E, kSCSIParallelMessage_LOGICAL_UNIT_RESET = 0x17, kSCSIParallelMessage_TARGET_RESET = 0x0C }; enum { kSCSIParallelTaskControllerIDQueueHead = 0 }; // Notifications enum { kSCSIControllerNotificationBusReset = 0x68000000 }; // Forward declaration for the internally used Parallel Device object. class IOSCSIParallelInterfaceDevice; // This is the identifier that is used to specify a given parallel Task. typedef OSObject * SCSIParallelTaskIdentifier; //----------------------------------------------------------------------------- // Class Declarations //----------------------------------------------------------------------------- __exported_push; /*! @class IOSCSIParallelInterfaceController @abstract Class that represents a SCSI Host Bus Adapter. @discussion Class that represents a SCSI Host Bus Adapter. */ class __kpi_deprecated("Use IOUserSCSIParallelInterfaceController with DriverKit, instead") IOSCSIParallelInterfaceController : public IOService { OSDeclareAbstractStructors ( IOSCSIParallelInterfaceController ) #if 0 #pragma mark - #pragma mark Client API #endif public: /*! @function GetSCSIParallelTask @abstract Method to allow the client to get a SCSIParallelTask @discussion Get a SCSIParallelTask from the controller so that a request can be issued to the HBA driver. @param blockForCommand If the blockForCommand parameter is set to false and there are no free SCSIParallelTasks, this method will return NULL, otherwise it will wait for one to become available before returning. @result If there is a SCSI Parallel Task available, a reference to it will be returned. */ SCSIParallelTaskIdentifier GetSCSIParallelTask ( bool blockForCommand ); /*! @function FreeSCSIParallelTask @abstract Method to allow the client to release a SCSIParallelTask @discussion The FreeSCSIParallelTask method is called by the client when a SCSIParallelTask has been completed and the associated returnTask needs to be returned to the pool. @param returnTask is a reference to the SCSIParallelTaskIdentifier to be returned. */ void FreeSCSIParallelTask ( SCSIParallelTaskIdentifier returnTask ); /*! @function FindTaskForAddress @abstract Find a task for a given Task Address, if one exists. @discussion If a valid Tagged Task Identifier is specified, this method will return the task specified by the Tagged Task Address if one is found, or else NULL will be returned. If zero is used as the Tagged Task Identifier, then this routine will search for an outstanding task based on the Untagged Task Address and return the task or else, if one is not found, return NULL. @param theT is the Target component of the I_T_L or I_T_L_Q nexus. @param theL is the Logical Unit component of the I_T_L or I_T_L_Q nexus. @param theQ is the Queue Tag component of the I_T_L_Q nexus. If this is an I_T_L nexus, then the kSCSIUntaggedTaskIdentifier constant should be used for theQ. @result returns a valid SCSIParallelTaskIdentifier or NULL if none found. */ SCSIParallelTaskIdentifier FindTaskForAddress ( SCSIDeviceIdentifier theT, SCSILogicalUnitNumber theL, SCSITaggedTaskIdentifier theQ ); /*! @function FindTaskForControllerIdentifier @abstract Find a task for a given Target and Controller Task Identifier @discussion Allows the controller child class to find an outstanding task for a specified target and controller task identifier @param theTarget is the Target that the task . @param theIdentifier is the controller task identifier set using the SCSI Parallel Task's SetControllerTaskIdentifier() method. @result returns a valid SCSIParallelTaskIdentifier or NULL if none found. */ SCSIParallelTaskIdentifier FindTaskForControllerIdentifier ( SCSIDeviceIdentifier theTarget, UInt64 theIdentifier ); /*! @function ExecuteParallelTask @abstract Submit a SCSIParallelTask for execution. @discussion The ExecuteParallelTask call is made by the client to submit a SCSIParallelTask for execution. @param parallelRequest is a reference to the SCSIParallelTaskIdentifier to be executed. @result is an appropriate SCSIServiceResponse which are defined in the file <IOKit/scsi/SCSITask.h>. */ SCSIServiceResponse ExecuteParallelTask ( SCSIParallelTaskIdentifier parallelRequest ); // --- Public API methods provided by HBA child classes ---- /*! @function ReportHBAHighestLogicalUnitNumber @abstract Gets the Highest Logical Unit Number. @discussion This method is used to query the HBA child class to determine what the highest Logical Unit Number that the controller can address. @result returns a valid 64-bit logical unit number. */ virtual SCSILogicalUnitNumber ReportHBAHighestLogicalUnitNumber ( void ) = 0; /*! @function DoesHBASupportSCSIParallelFeature @abstract Queries the HBA child class to determine if it supports a specific SPI feature. @discussion Queries the HBA child class to determine if it supports the specified feature as defined by the SCSI Parallel Interconnect specifications. @result Returns true if requested feature is supported. */ virtual bool DoesHBASupportSCSIParallelFeature ( SCSIParallelFeature theFeature ) = 0; /*! @function InitializeTargetForID @abstract Called to initialize a target device. @discussion This method will be called to initialize a target device in a single-threaded manner. The HBA can use this method to probe the target or do anything else necessary before the device object is registered with IOKit for matching. @result Returns true if the target was successfully initialized. */ virtual bool InitializeTargetForID ( SCSITargetIdentifier targetID ) = 0; // The SCSI Task Management Functions as defined in the SCSI Architecture // Model - 2 (SAM-2) specification. These are used by the client to request // the specified function. The controller can complete these immmediately // by returning the appropriate SCSIServiceResponse, or these can be completed // asyncronously by the controller returning a SCSIServiceResponse of // kSCSIServiceResponse_Request_In_Process and then calling the appropriate // function complete member routine listed in the child class API section. virtual SCSIServiceResponse AbortTaskRequest ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL, SCSITaggedTaskIdentifier theQ ) = 0; virtual SCSIServiceResponse AbortTaskSetRequest ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL ) = 0; virtual SCSIServiceResponse ClearACARequest ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL ) = 0; virtual SCSIServiceResponse ClearTaskSetRequest ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL ) = 0; virtual SCSIServiceResponse LogicalUnitResetRequest ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL ) = 0; virtual SCSIServiceResponse TargetResetRequest ( SCSITargetIdentifier theT ) = 0; /*! @function DoesHBAPerformAutoSense @abstract Queries the HBA child class to determine if it automatically performs AutoSense and provides AutoSense data for each I/O. If the HBA allocates space for AutoSense in its HBA specific data region on a per task basis, the HBA should respond true. @discussion Queries the HBA child class to determine if it automatically performs AutoSense and provides AutoSense data for each I/O. If the HBA allocates space for AutoSense in its HBA specific data region on a per task basis, the HBA should respond true. @result Return true if HBA performs AutoSense into its own private data buffer. */ OSMetaClassDeclareReservedUsed ( IOSCSIParallelInterfaceController, 1 ); virtual bool DoesHBAPerformAutoSense ( void ); /*! @function ReportHBAConstraints @abstract Called to report the I/O constraints for this controller. A list of valid keys includes: kIOMaximumSegmentCountReadKey, (required) kIOMaximumSegmentCountWriteKey, (required) kIOMaximumSegmentByteCountReadKey, (required) kIOMaximumSegmentByteCountWriteKey, (required) kIOMinimumSegmentAlignmentByteCountKey, (required) kIOMaximumSegmentAddressableBitCountKey, (required) kIOMinimumHBADataAlignmentMaskKey (required) kIOHierarchicalLogicalUnitSupportKey (optional). NB: These keys and their values are described in this header and <IOKit/IOKitKeys.h> @param constraints. An OSDictionary object used to aggregate the key/value pairs. Subclasses must set the required keys if they override this method. If a subclass does not provide the required keys, the system will panic. */ OSMetaClassDeclareReservedUsed ( IOSCSIParallelInterfaceController, 2 ); virtual void ReportHBAConstraints ( OSDictionary * constraints ); /*! @function DoesHBASupportMultiPathing @abstract Queries the HBA child class to determine if it supports Multi-Pathing. @discussion Queries the HBA child class to determine if it supports Multi-Pathing. @result Returns true if requested feature is supported. */ OSMetaClassDeclareReservedUsed ( IOSCSIParallelInterfaceController, 3 ); virtual bool DoesHBASupportMultiPathing ( void ); // Padding for the Client API OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 4 ); OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 5 ); OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 6 ); OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 7 ); OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 8 ); #if 0 #pragma mark - #pragma mark Child Class API #endif protected: // ---- Target Creation and Destruction methods --- /*! @function CreateTargetForID @abstract Method to perform device creation. @discussion For HBA child classes that report true to the DoesHBAPerformDeviceManagement() method, the child class will be responsible for all device management by using these methods; otherwise, the superclass will be responsible for all device management. This method must be used to perform SCSI Parallel Device creation and cannot be overridden. @param targetID SCSIDeviceIdentifier of desired targetID. @result returns true if successful. */ bool CreateTargetForID ( SCSIDeviceIdentifier targetID ); /*! @function CreateTargetForID @abstract Method to perform device creation. @discussion For HBA child classes that report true to the DoesHBAPerformDeviceManagement() method, the child class will be responsible for all device management by using these methods; otherwise, the superclass will be responsible for all device management. This method must be used to perform SCSI Parallel Device creation and cannot be overridden. @param targetID SCSIDeviceIdentifier of desired targetID. @param properties A dictionary of properties to associate with the device upon creation. The list of valid property keys is as follows: kIOPropertySASAddressKey, kIOPropertyFibreChannelNodeWorldWideNameKey, kIOPropertyFibreChannelPortWorldWideNameKey, kIOPropertyFibreChannelAddressIdentifierKey, kIOPropertyFibreChannelALPAKey, and kIOPropertyRetryCountKey These keys are defined in <IOKit/storage/IOStorageProtocolCharacteristics.h> and the values associated with these keys must be of the proper type/size, or the target creation will not succeed. @result returns true if successful. */ bool CreateTargetForID ( SCSIDeviceIdentifier targetID, OSDictionary * properties ); /*! @function DestroyTargetForID @abstract Method to perform device destruction. @discussion For HBA child classes that report true to the DoesHBAPerformDeviceManagement() method, the child class will be responsible for all device management by using these methods; otherwise, the superclass will be responsible for all device management. This method must be used to perform SCSI Parallel Device destruction and cannot be overridden. @param targetID SCSIDeviceIdentifier of desired targetID. */ void DestroyTargetForID ( SCSIDeviceIdentifier targetID ); /*! @function GetTargetForID @abstract Accessor for getting pointer to IOSCSIParallelInterfaceDevice. @param targetID SCSIDeviceIdentifier of desired targetID. @result returns pointer to IOSCSIParallelInterfaceDevice or NULL if not found. */ IOSCSIParallelInterfaceDevice * GetTargetForID ( SCSIDeviceIdentifier targetID ); /*! @function SetTargetProperty @abstract Accessor for setting a property for a specific target. @param device A pointer to a valid IOSCSIParallelInterfaceDevice. @param key A pointer to a valid OSString object which represents the key. A list of valid keys includes: kIOPropertySASAddressKey, kIOPropertyFibreChannelNodeWorldWideNameKey, kIOPropertyFibreChannelPortWorldWideNameKey, kIOPropertyFibreChannelAddressIdentifierKey, and kIOPropertyFibreChannelALPAKey. NB: These keys and their values are described in <IOKit/storage/IOStorageProtocolCharacteristics.h> @param value Pointer to an OSObject (one of type OSData, OSString, etc.) which represents the value for the property. The value must be of the proper type and size for the specified key. @result returns true if identifier was properly set, otherwise false. */ bool SetTargetProperty ( SCSIDeviceIdentifier targetID, const char * key, OSObject * value ); /*! @function RemoveTargetProperty @abstract Accessor for removing a property from a specific target. @param device A pointer to a valid IOSCSIParallelInterfaceDevice. @param key A pointer to a valid OSString object which represents the key. */ void RemoveTargetProperty ( SCSIDeviceIdentifier targetID, const char * key ); // ---- Methods for HBA specifics. ---- /*! @function SetHBAProperty @abstract Accessor for setting a property for this object. @param key A pointer to a valid OSString object which represents the key. A list of valid keys includes: kIOPropertyVendorNameKey, kIOPropertyProductNameKey, kIOPropertyProductRevisionLevelKey, kIOPropertyPortDescriptionKey, kIOPropertyPortSpeedKey, kIOPropertyPortTopologyKey, kIOPropertySCSIParallelSignalingTypeKey, kIOPropertyFibreChannelCableDescriptionKey, kIOPropertyFibreChannelNodeWorldWideNameKey, kIOPropertyFibreChannelPortWorldWideNameKey, kIOPropertyFibreChannelAddressIdentifierKey, kIOPropertyFibreChannelALPAKey, and kIOPropertySASAddressKey. NB: These keys and their values are described in <IOKit/storage/IOStorageDeviceCharacteristics.h> and <IOKit/storage/IOStorageProtocolCharacteristics.h> @param value Pointer to an OSObject (one of type OSData, OSString, etc.) which represents the value for the property. The value must be of the proper type, and/or size for the specified key. @result returns true if identifier was properly set, otherwise false. */ bool SetHBAProperty ( const char * key, OSObject * value ); /*! @function RemoveHBAProperty @abstract Accessor for removing a property for this object. @param key A pointer to a valid OSString object which represents the key. See the SetHBAProperty() method for a list of valid keys. */ void RemoveHBAProperty ( const char * key ); // These methods will not be called before the InitializeController() call, // and will not be called after the TerminateController() call. But in the // interval between those calls, they shall report the correct requested // information. They are implemented as seperate pure virtual methods // instead of a selector driven method because the HBA child class is // required to report this information. /*! @function ReportInitiatorIdentifier @abstract Get the SCSI Device Identifier for the HBA. @discussion This method will be called to determine the SCSI Device Identifier that the Initiator has assigned for this HBA. @result returns SCSIInitiatorIdentifier. */ virtual SCSIInitiatorIdentifier ReportInitiatorIdentifier ( void ) = 0; /*! @function ReportHighestSupportedDeviceID @abstract Get the highest supported SCSI Device Identifier. @discussion This method will be called to determine the value of the highest SCSI Device Identifier supported by the HBA. This value will be used to determine the last ID to process. @result returns highest SCSIDeviceIdentifier */ virtual SCSIDeviceIdentifier ReportHighestSupportedDeviceID ( void ) = 0; /*! @function ReportMaximumTaskCount @abstract Report Maximum Task Count @discussion This method will be called to retrieve the maximum number of outstanding tasks the HBA can process. This number must be greater than zero or the controller driver will fail to match and load. @result returns maximum (non-zero) task count. */ virtual UInt32 ReportMaximumTaskCount ( void ) = 0; /*! @function ReportHBASpecificTaskDataSize @abstract Determine memory needed for HBA Task specific use. @discussion This method is used to retrieve the amount of memory that will be allocated in the SCSI Parallel Task for HBA specific use. @result returns memory required in bytes */ virtual UInt32 ReportHBASpecificTaskDataSize ( void ) = 0; /*! @function ReportHBASpecificDeviceDataSize @abstract Determine memory needed for HBA Device specific use. @discussion This method is used to retrieve the amount of memory that will be allocated in the SCSI Parallel Device for HBA specific use. @result returns memory required in bytes */ virtual UInt32 ReportHBASpecificDeviceDataSize ( void ) = 0; /*! @function DoesHBAPerformDeviceManagement @abstract Determine if HBA will manage devices. @discussion This method is used to determine if the HBA will manage target device creation and destruction. @result return true means objects for target devices will only be created when the child class calls the CreateTargetForID method. */ virtual bool DoesHBAPerformDeviceManagement ( void ) = 0; // ---- Initialize and Terminate methods for the subclass to implement ----- // The subclass shall not override the IOKit init and terminate methods, // but shall instead rely on these methods for initialization and // termination. // This is done to allow for this superclass to manage all IOKit specifics // and to require only a Family specific API to be implemented by the // subclass drivers. /*! @function InitializeController @abstract Called to initialize the controller @discussion It is guaranteed that the InitializeController() will only be called once per instantiation. The InitializeController() methods allows the subclass driver to do all the necessary initialization required by the hardware before it is able to accept requests to execute. All necessary allocation of resources should be made during this method call. This is the first method that will be called in the subclass. @result return true means that initialization was successful. */ virtual bool InitializeController ( void ) = 0; /*! @function TerminateController @abstract Called to terminate the controller @discussion It is guaranteed that the TerminateController() will only be called once and only after the InitializeController() method and only if true was returned in response to the InitializeController() method. The TerminateController() method allows the subclass to release all resources that were acquired for operation of the hardware and shutdown all hardware services. This is the last method of the subclass that will be called before the class is destroyed. */ virtual void TerminateController ( void ) = 0; // ---- Start and Stop methods for the subclass ---- /*! @function StartController @abstract Called to start the controller @discussion The StartController will always be called before any requests are sent to the driver for execution. This method is called after an initialize to start the services provided by the specific HBA driver or called after a StopController call to restart those services. After this call completes, all services provided by the HBA driver are available to the client. @result return true means that start was successful. */ virtual bool StartController ( void ) = 0; /*! @function StopController @abstract Called to stop the controller @discussion The StopController method will be called any time that the system wants the card to stop accepting requests. ( See StartController discussion ). The subclass should disable the hardware interrupt for the particular controller (if possible) in this method. */ virtual void StopController ( void ) = 0; // ---- Suspend and Resume Methods for the subclass ---- /*! @function SuspendServices @abstract Called to suspend controller services @discussion Method will be called when the system wants to suspend the services that are provided by the HBA driver. This call is not a reset and the driver shall retain all state data between this so that if a ResumeServices call is received, the driver can continue providing services without a visible difference to the client. The driver may receive multiple SuspendServices calls without receiving a ResumeServices call and should ignore any after the first until a ResumeServices call is received. */ virtual void SuspendServices ( void ); /*! @function ResumeServices @abstract Called to resume controller services @discussion Method that will be called to resume services provided by the driver. ( See SuspendServices discussion ) */ virtual void ResumeServices ( void ); /*! @function HandleInterruptRequest @abstract Handle Interrupt Request @discussion The HandleInterruptRequest is used to notify an HBA specific subclass that an interrupt request needs to be serviced. It is called on the workloop (it holds the gate) at secondary interrupt level. */ virtual void HandleInterruptRequest ( void ) = 0; /*! @function EnableInterrupt @abstract Enable Interrupt @discussion Method that the HBA child class can call to enable the associated IOInterruptEventSource. */ void EnableInterrupt ( void ); /*! @function DisableInterrupt @abstract Disable Interrupt @discussion Method that the HBA child class can call to disable the associated IOInterruptEventSource. */ void DisableInterrupt ( void ); /*! @function SignalInterrupt @abstract Signals that an interrupt has occurred. @discussion Subclasses of IOSCSIParallelInterfaceController should call this method in order to get the secondary interrupt thread scheduled if and only if they will be returning false from their overriden FilterInterruptRequest() method. See the discussion for the FilterInterruptRequest() method for more details. NOTE: This method should only be called from within the FilterInterruptRequest() method and at no other time. Available in 10.3.3 or later. */ void SignalInterrupt ( void ); /*! @function ProcessParallelTask @abstract Called by client to process a parallel task. @discussion This method is called to process a parallel task (i.e. put the command on the bus). The HBA specific sublcass must implement this method. @param parallelRequest A valid SCSIParallelTaskIdentifier. @result serviceResponse (see <IOKit/scsi/SCSITask.h>) */ virtual SCSIServiceResponse ProcessParallelTask ( SCSIParallelTaskIdentifier parallelRequest ) = 0; /*! @function CompleteParallelTask @abstract Parallel Task Completion @discussion The HBA specific sublcass inherits the CompleteParallelTask() method which shall be called when the HBA has completed the processing of a parallel task. @param parallelTask A valid SCSIParallelTaskIdentifier. @param completionStatus The status of the SCSI bus. @param serviceResponse (see <IOKit/scsi/SCSITask.h>) */ void CompleteParallelTask ( SCSIParallelTaskIdentifier parallelRequest, SCSITaskStatus completionStatus, SCSIServiceResponse serviceResponse ); // Completion routines for the SCSI Task Management functions as described // in the SCSI ArchitectureModel - 2 (SAM-2) specification. Each of these // correspond to a client request for the specific Task Management functions. // If the Controller Child Class completed the request by returning a // SCSIServiceResponse of anything other than kSCSIServiceResponse_Request_In_Process, // then the controller class does not need to call the completion member routine. // If the controller did not complete the request immediately, then it will // need to call the appropriate completion member routine listed here. void CompleteAbortTask ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL, SCSITaggedTaskIdentifier theQ, SCSIServiceResponse serviceResponse ); void CompleteAbortTaskSet ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL, SCSIServiceResponse serviceResponse ); void CompleteClearACA ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL, SCSIServiceResponse serviceResponse ); void CompleteClearTaskSet ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL, SCSIServiceResponse serviceResponse ); void CompleteLogicalUnitReset ( SCSITargetIdentifier theT, SCSILogicalUnitNumber theL, SCSIServiceResponse serviceResponse ); void CompleteTargetReset ( SCSITargetIdentifier theT, SCSIServiceResponse serviceResponse ); /*! @function NotifyClientsOfBusReset @abstract Method called to notify clients that a bus reset has occurred. @discussion This method is used by the HBA child class to inform the parent class and any clients that a bus reset has occurred. */ void NotifyClientsOfBusReset ( void ); /*! @function NotifyClientsOfPortStatusChange @abstract Method called to notify clients of port status change events. @discussion This method is used by the HBA child class to inform the parent class and any clients that a port has changed status. */ void NotifyClientsOfPortStatusChange ( SCSIPortStatus newStatus ); /*! @function GetSCSIDomainIdentifier @abstract Accessor method to get the SCSI Domain Identifier. @discussion Accessor method to get the SCSI Domain Identifier. @result returns SCSI Domain Identifier. */ SInt32 GetSCSIDomainIdentifier ( void ); /*! @function GetProvider @abstract Accessor method to get the IOService which is the controller's provider. @discussion Accessor method to get the IOService which is the controller's provider. @result returns pointer to IOService. */ IOService * GetProvider ( void ); /*! @function GetWorkLoop @abstract Accessor method to get the IOWorkLoop associated with this HBA. @discussion Accessor method to get the IOWorkLoop associated with this HBA. @result returns pointer to IOWorkLoop. */ IOWorkLoop * GetWorkLoop ( void ) const; /*! @function GetCommandGate @abstract Accessor to get an IOCommandGate associated with the workloop. @discussion Accessor to get an IOCommandGate associated with the workloop. @result returns pointer to IOCommandGate. */ IOCommandGate * GetCommandGate ( void ); // ---- SCSI Parallel Task Object Accessors ---- /*! @function GetSCSITaskIdentifier @abstract Method to retrieve a SCSITaskIdentifier from a valid SCSIParallelTaskIdentifier. @discussion Method to retrieve a SCSITaskIdentifier from a valid SCSIParallelTaskIdentifier. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns SCSITaskIdentifier that represents the original request from the SCSI Application Layer client. */ SCSITaskIdentifier GetSCSITaskIdentifier ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetTargetIdentifier @abstract Method to get the SCSITargetIdentifier associated with a request. @discussion Method to get the SCSITargetIdentifier associated with a request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns SCSITargetIdentifier */ SCSITargetIdentifier GetTargetIdentifier ( SCSIParallelTaskIdentifier parallelTask ); // ---- Methods for Accessing data in the client's SCSI Task Object ---- // Method to retrieve the LUN that identifies the Logical Unit whose Task // Set to which this task is to be added. /*! @function GetLogicalUnitNumber @abstract Method to get the logical unit number associated with a request. @discussion Method to get the logical unit number associated with a request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns a valid 64-bit logical unit number. */ SCSILogicalUnitNumber GetLogicalUnitNumber ( SCSIParallelTaskIdentifier parallelTask ); // DEPRECATED, use GetLogicalUnitBytes instead. /*! @function GetLogicalUnitBytes @abstract Method to get the logical unit bytes associated with a request. @discussion Method to get the logical unit bytes associated with a request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns a valid 8-byte logical unit address. */ void GetLogicalUnitBytes ( SCSIParallelTaskIdentifier parallelTask, SCSILogicalUnitBytes * logicalUnitBytes ); /*! @function GetTaggedTaskIdentifier @abstract Method to retrieve the SCSI Tagged Task Identifier of the task. If the returned value is equal to kSCSIUntaggedTaskIdentifier, then this task is untagged. @param parallelTask A valid SCSIParallelTaskIdentifier. @result an SCSITaskAttribute value. */ SCSITaggedTaskIdentifier GetTaggedTaskIdentifier ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetTaskAttribute @abstract Method to retrieve the SCSI Task Attribute of the task @param parallelTask A valid SCSIParallelTaskIdentifier. @result an SCSITaskAttribute value. */ SCSITaskAttribute GetTaskAttribute ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetCommandDescriptorBlockSize @abstract Method to retrieve the size of the SCSI Command Descriptor Block (CDB). @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns the size of the SCSI Command Descriptor Block in bytes. */ UInt8 GetCommandDescriptorBlockSize ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetCommandDescriptorBlock @abstract Method to retrieve the SCSI Command Descriptor Block (CDB). @discussion This will always return a 16 Byte CDB. If the Protocol Layer driver does not support 16 Byte CDBs, it will have to create a local SCSICommandDescriptorBlock variable to get the CDB data and then transfer the needed bytes from there. @param parallelTask A valid SCSIParallelTaskIdentifier. @param cdbData is a SCSICommandDescriptorBlock pointer to 16 byte CDB @result returns true if data was copied to cdbData pointer */ bool GetCommandDescriptorBlock ( SCSIParallelTaskIdentifier parallelTask, SCSICommandDescriptorBlock * cdbData ); /*! @function GetDataTransferDirection @abstract Retrieves the data transfer direction for any data associated with the request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result One of the valid data transfer directions described in <IOKit/scsi/SCSITask.h> */ UInt8 GetDataTransferDirection ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetRequestedDataTransferCount @abstract Retrieves the requested data transfer count for any data associated with the request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result The requested data transfer count in bytes. */ UInt64 GetRequestedDataTransferCount ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetRealizedDataTransferCount @abstract Retrieves the realized data transfer count for any data associated with the request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result The realized data transfer count in bytes. */ UInt64 GetRealizedDataTransferCount ( SCSIParallelTaskIdentifier parallelTask ); /*! @function SetRealizedDataTransferCount @abstract Sets the realized data transfer count in bytes. @param parallelTask A valid SCSIParallelTaskIdentifier. @param realizedTransferCountInBytes is the number of bytes actually transferred. @result true means the data transfer count was successfully set. */ bool SetRealizedDataTransferCount ( SCSIParallelTaskIdentifier parallelTask, UInt64 realizedTransferCountInBytes ); /*! @function IncrementRealizedDataTransferCount @abstract Increments the realized data transfer count. This method is helpful for when the HBA has to do multiple passes of DMA because there are more scatter-gather elements than it can process in one pass. @param parallelTask A valid SCSIParallelTaskIdentifier. @param realizedTransferCountInBytes is the number of bytes to add to the realized data count for the task. */ void IncrementRealizedDataTransferCount ( SCSIParallelTaskIdentifier parallelTask, UInt64 realizedTransferCountInBytes ); /*! @function GetDataBuffer @abstract Method to retrieve client buffer from the request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns pointer to an IOMemoryDescriptor which represents the buffer. */ IOMemoryDescriptor * GetDataBuffer ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetDataBufferOffset @abstract Method to retrieve offset into client buffer at which to start processing. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns offset in bytes */ UInt64 GetDataBufferOffset ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetDMACommand @abstract Method to retrieve a pointer to an IODMACommand from the request. @discussion For devices utilizing DMA, the IODMACommand object should be obtained via GetDMACommand(). The subclass is responsible for calling prepare() on the IODMACommand object using the proper offset obtained via GetDataBufferOffset() and correct size obtained via GetRequestedDataTransferCount(). The subclass is further responsible for calling complete() on the IODMACommand object once all DMA operations have finished. NB: Subclasses should not call IODMACommand::setMemoryDescriptor(). @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns pointer to an IODMACommand which is used in conjunction with the task. */ IODMACommand * GetDMACommand ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetTimeoutDuration @abstract Method to retrieve the timeout duration in milliseconds for a request. @discussion Method to retrieve the timeout duration in milliseconds for a request. A value of zero represents an infinite timeout, or on hardware where infinite timeouts are not possible, substitute the longest timeout possible. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns timeout duration in milliseconds */ UInt32 GetTimeoutDuration ( SCSIParallelTaskIdentifier parallelTask ); /*! @function SetAutoSenseData @abstract Method to set the auto sense data buffer associated with a request. @param parallelTask A valid SCSIParallelTaskIdentifier. @param newSensedata pointer to auto sense data buffer @result returns true if data in newSenseData was succesfully into the task object */ bool SetAutoSenseData ( SCSIParallelTaskIdentifier parallelTask, SCSI_Sense_Data * newSenseData, UInt8 senseDataSize ); /*! @function GetAutoSenseData @abstract Method to retrieve auto sense data buffer associated with a request. @param parallelTask A valid SCSIParallelTaskIdentifier. @param receivingBuffer pointer to auto sense data buffer @result returns true if successfully copied data into receivingBuffer */ bool GetAutoSenseData ( SCSIParallelTaskIdentifier parallelTask, SCSI_Sense_Data * receivingBuffer, UInt8 senseDataSize ); /*! @function GetAutoSenseDataSize @abstract Method to retrieve auto sense data buffer size associated with a request. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns Size of auto sense data buffer. */ UInt8 GetAutoSenseDataSize ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetSCSIParallelFeatureNegotiation @abstract Method to retrieve the requested value for negotiation of the. @discussion Query as to whether the SCSI Parallel Device object has negotiated wide data transfers. @param parallelTask A valid SCSIParallelTaskIdentifier. @result A valid SCSIParallelFeatureControl. */ SCSIParallelFeatureRequest GetSCSIParallelFeatureNegotiation ( SCSIParallelTaskIdentifier parallelTask, SCSIParallelFeature requestedFeature ); /*! @function GetSCSIParallelFeatureNegotiationCount @abstract Method to retrieve the number of requested negotiations. @discussion Query as to the number of SCSI Parallel Features that are requested to either be negotitated or cleared. These are all features that are set to either kSCSIParallelFeature_AttemptNegotiation or kSCSIParallelFeature_ClearNegotiation. If the return value is zero, then all features are set to kSCSIParallelFeature_NoNegotiation and all feature negotiations are to remain as they currently exist. @param parallelTask A valid SCSIParallelTaskIdentifier. @result an unsigned integer up to 64 bits in size. */ UInt64 GetSCSIParallelFeatureNegotiationCount ( SCSIParallelTaskIdentifier parallelTask); /*! @function SetSCSIParallelFeatureNegotiationResult @abstract Method to set the wide data transfer negotiation result. @discussion Method to set the wide data transfer negotiation result. @param parallelTask A valid SCSIParallelTaskIdentifier. @param requestedFeature The SCSIParallelFeature that the has been set to newResult. @param newResult A valid SCSIParallelFeatureResult value. */ void SetSCSIParallelFeatureNegotiationResult ( SCSIParallelTaskIdentifier parallelTask, SCSIParallelFeature requestedFeature, SCSIParallelFeatureResult newResult ); /*! @function GetSCSIParallelFeatureNegotiationResult @abstract Method to retrieve the result of any wide transfer negotiations. @discussion Query as to whether the SCSI Parallel Controller object has negotiated wide data transfers. @param parallelTask A valid SCSIParallelTaskIdentifier. @result A valid SCSIParallelFeatureResult. */ SCSIParallelFeatureResult GetSCSIParallelFeatureNegotiationResult ( SCSIParallelTaskIdentifier parallelTask, SCSIParallelFeature requestedFeature ); /*! @function GetSCSIParallelFeatureNegotiationResultCount @abstract Method to retrieve the number of changed negotiations. @discussion Query as to the number of SCSI Parallel Features that have been changed to either negotitated or cleared. These are all features that are set to either kSCSIParallelFeature_NegotitiationCleared or kSCSIParallelFeature_NegotitiationSuccess. If the return value is zero, then all features are set to kSCSIParallelFeature_NegotitiationUnchanged. @param parallelTask A valid SCSIParallelTaskIdentifier. @result an unsigned integer up to 64 bits in size. */ UInt64 GetSCSIParallelFeatureNegotiationResultCount ( SCSIParallelTaskIdentifier parallelTask); // Controller Task Identifier related member routines /*! @function SetControllerTaskIdentifier @abstract Method to set the Controller Task Identifier. @discussion This method allows the Controller Child Class driver to set a unique identifier to associate with the specified SCSI Parallel Task. This identifier is designed to be used by controllers that do not have access to the LUN and Tag information when notified by the HBA that a request has completed. If the kSCSIParallelTaskControllerIDQueueHead is used, this member routine will return the first Task on the queue. @param parallelTask A valid SCSIParallelTaskIdentifier. @param newIdentifier unsigned 64 bit integer token. @result none */ void SetControllerTaskIdentifier ( SCSIParallelTaskIdentifier parallelTask, UInt64 newIdentifier ); UInt64 GetControllerTaskIdentifier ( SCSIParallelTaskIdentifier parallelTask); // The HBA Data related fields /*! @function GetHBADataSize @abstract Method to retrieve the HBA Data Size in bytes. @discussion Method to retrieve the HBA Data Size in bytes. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns HBA Data size in bytes. */ UInt32 GetHBADataSize ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetHBADataPointer @abstract Method to retrieve the HBA Data pointer. @discussion Method to retrieve the HBA Data pointer. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns pointer to buffer for HBA specific data, NULL if none found or GetHBADataSize() returns zero. */ void * GetHBADataPointer ( SCSIParallelTaskIdentifier parallelTask ); /*! @function GetHBADataDescriptor @abstract Method to retrieve the IOMemoryDescriptor associated with the HBA Data. @discussion Method to retrieve the IOMemoryDescriptor associated with the HBA Data. @param parallelTask A valid SCSIParallelTaskIdentifier. @result returns pointer to an IOMemoryDescriptor that wraps the HBA specific data buffer, NULL if none found or GetHBADataSize() returns zero. */ IOMemoryDescriptor * GetHBADataDescriptor ( SCSIParallelTaskIdentifier parallelTask ); // ---- SCSI Parallel Device Object Accessors ---- // The HBA Data related fields /*! @function GetHBATargetDataSize @abstract Method to retrieve the HBA Data Size in bytes. @discussion Method to retrieve the HBA Data Size in bytes. @param targetDevice A valid SCSITargetIdentifier. @result returns HBA Data size in bytes. */ UInt32 GetHBATargetDataSize ( SCSITargetIdentifier targetID ); /*! @function GetHBATargetDataPointer @abstract Method to retrieve the HBA Data pointer. @discussion Method to retrieve the HBA Data pointer. @param targetDevice A valid SCSITargetIdentifier. @result returns pointer to buffer for HBA specific data, NULL if none found or GetHBADataSize is zero. */ void * GetHBATargetDataPointer ( SCSITargetIdentifier targetID ); #if 0 #pragma mark - #pragma mark Additional Child Class APIs #endif // ---- Timeout Related Methods ---- /*! @function SetTimeoutForTask @abstract Method to set the timeout duration in milliseconds for a request. @discussion Method to set the timeout duration in milliseconds for a request. @param parallelTask A valid SCSIParallelTaskIdentifier. @param timeoutOverride A timeout value in milliseconds in case the HBA driver wishes to override the default value provided in the parallelTask. */ void SetTimeoutForTask ( SCSIParallelTaskIdentifier parallelTask, UInt32 timeoutOverride = 0 ); /*! @function HandleTimeout @abstract Method to handle command timeouts. @discussion Method to handle command timeouts. This should be overridden by the child class in order to clean up HBA specific structures after a timeout has occurred. This method is called on the workloop (it holds the gate). @param parallelRequest A valid SCSIParallelTaskIdentifier. */ OSMetaClassDeclareReservedUsed ( IOSCSIParallelInterfaceController, 9 ); virtual void HandleTimeout ( SCSIParallelTaskIdentifier parallelRequest ); // ---- Filter Interrupt ---- /*! @function FilterInterruptRequest @abstract Filter method called at primary interrupt time. @discussion Filter method called at primary interrupt time. This should only be overridden by the child class in order to determine if an interrupt occurred for this controller instance. Since all work occurs at primary interrupt time, this routine should be quick and efficient and defer as much processing as possible to the HandleInterruptRequest() method. NOTE: Unlike the HandleInterruptRequest() and HandleTimeout() methods, FilterInterruptRequest() is NOT called with the workloop lock held. If the value returned by FilterInterruptRequest() is true, the secondary interrupt thread will be scheduled and the hardware interrupt line will be disabled. If the controller instance shares that interrupt line with other devices, it can cause large interrupt latencies. If the controller instance can disable the interrupt in the chip itself, the following can be done to reduce interrupt latencies: - Interrupt occurs - FilterInterruptRequest() method is called. - If the interrupt is not for this controller, return false immediately. - If the interrupt is for this controller, and the controller can disable interrupts for this chip, the controller should disable the interrupts for this chip, call SignalInterrupt(), and return false. This causes the secondary interrupt thread to get scheduled, yet does not disable the interrupt line for all devices tied to that interrupt. This effectively allows other devices to process their interrrupts, thus reducing interrupt latency for those devices. - HandleInterruptRequest() method is called. - Controller processes interrupt and completes I/O requests. - Controller re-enables interrupts for the device. NOTE: If you use this approach, the interrupting condition MUST be cleared from the hardware, otherwise an infinite process interrupt loop will occur. If the controller cannot disable interrupts on the chip, it should simply return true if an interrupt has occurred for its device. @result True if the hardware interrupt line should be disabled, otherwise false. */ OSMetaClassDeclareReservedUsed ( IOSCSIParallelInterfaceController, 10 ); virtual bool FilterInterruptRequest ( void ); /*! @function InitializeDMASpecification @abstract Called to initialize an IODMACommand with a DMA specification. @param command A pointer to a valid IODMACommand object. Subclasses should override this method and call IODMACommand::initWithSpecification() supplying the proper arguments to that method based on the DMA strategy. @result boolean value indicating success or failure. */ OSMetaClassDeclareReservedUsed ( IOSCSIParallelInterfaceController, 11 ); virtual bool InitializeDMASpecification ( IODMACommand * command ); /*! @function CreateDeviceInterrupt @abstract Called to create an IOInterruptEventSource for the device. Subclasses may wish to use a different interrupt index than 0 (e.g. for using PCI Message Signaled Interrupts) or might not need an interrupt at all (virtual HBA). @param action A pointer to the action routine that should be passed to either IOInterruptEventSource::interruptEventSource() or IOFilterInterruptEventSource::filterInterruptEventSource as the method to call when an interrupt occurs for the device (sometimes called the "deferred procedure call" or the "secondary context method". By passing this routine along, it will properly wire up the HandleInterruptRequest() method you should override to handle interrupts. @param filter A pointer to the filter routine that should be passed to IOFilterInterruptEventSource::filterInterruptEventSource as the method to call at primary interrupt time when an interrupt occurs for the device. By passing this routine along, it will properly wire up the FilterInterruptRequest() method you may override to handle primary interrupts. @result IOInterruptEventSource. May return NULL if and only if there is no hardware interrupt associated with this device. */ OSMetaClassDeclareReservedUsed ( IOSCSIParallelInterfaceController, 12 ); virtual IOInterruptEventSource * CreateDeviceInterrupt ( IOInterruptEventSource::Action action, IOFilterInterruptEventSource::Filter filter, IOService * provider ); // Padding for the Child Class API OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 13 ); OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 14 ); OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 15 ); OSMetaClassDeclareReservedUnused ( IOSCSIParallelInterfaceController, 16 ); #if 0 #pragma mark - #pragma mark Internal Use Only #endif private: // binary compatibility instance variable expansion struct ExpansionData { }; ExpansionData * fIOSCSIParallelInterfaceControllerExpansionData; IOService * fProvider; OSSet * fClients; static SInt32 fSCSIParallelDomainCount; SInt32 fSCSIDomainIdentifier; // The HBA attributes SCSIInitiatorIdentifier fInitiatorIdentifier; // The maximum SCSI Device Identifier support by the HBA // This is retreived from the child class via the SCSIDeviceIdentifier fHighestSupportedDeviceID; // The total number of tasks that the HBA can proccess at a time. // This is retrieved from the child class via ReportMaximumTaskCount UInt32 fSupportedTaskCount; // The Number of requests that are currently outstanding for the current // instantiation. UInt16 fOutstandingRequests; // The member variable to indicate if the current instantiation has been // succesfully intialized. bool fHBAHasBeenInitialized; // The member variable to indicate if the current instantiation is running. // A true means that the last or only Start call made was successful. A // false value means that either a successful Start has not been made or a // Stop call has been made. bool fHBACanAcceptClientRequests; // The pool for the available SCSI Parallel Task objects IOCommandPool * fParallelTaskPool; // WorkLoop variables IOWorkLoop * fWorkLoop; IOTimerEventSource * fTimerEvent; IOInterruptEventSource * fDispatchEvent; IOCommandGate * fControllerGate; bool AllocateSCSIParallelTasks ( void ); void DeallocateSCSIParallelTasks ( void ); IOWorkLoop * getWorkLoop ( void ) const; bool CreateWorkLoop ( IOService * provider ); void ReleaseWorkLoop ( void ); // SCSI Parallel Device List // The SCSI Parallel Device List will consist of 16 elements to represent // identifiers that end in 0h through Fh. Each array element will point // to a device object that represents the beginning of a linked list of // device objects. By using an array of linked lists, the traversal time // to find an object on a bus that supports a large number of devices, such // as Fibre Channel, will be significantly lower than having to walk a list // that is comprised of all devices on the bus. For parallel wide and // narrow busses, which support 16 and 8 devices respectively, this will act // like a simple array of device objects. enum { kSCSIParallelDeviceListArrayCount = 16, kSCSIParallelDeviceListIndexMask = 0x0F }; IOSimpleLock * fDeviceLock; IOSCSIParallelInterfaceDevice * fParallelDeviceList[kSCSIParallelDeviceListArrayCount]; void InitializeDeviceList ( void ); void AddDeviceToTargetList ( IOSCSIParallelInterfaceDevice * newDevice ); void RemoveDeviceFromTargetList ( IOSCSIParallelInterfaceDevice * victimDevice ); void CompleteOutstandingTasksForTargetID ( SCSIDeviceIdentifier targetID ); void CompleteOutstandingTasksForTarget ( IOSCSIParallelInterfaceDevice * device ); // The Interrupt Service Routine for the controller. static void ServiceInterrupt ( OSObject * theObject, IOInterruptEventSource * theSource, int count ); static void TimeoutOccurred ( OSObject * owner, IOTimerEventSource * sender ); static bool FilterInterrupt ( OSObject * theObject, IOFilterInterruptEventSource * theSource ); // IOService support methods // These shall not be overridden by the HBA child classes. bool start ( IOService * provider ); void stop ( IOService * provider ); protected: // These may be overriden by the HBA child classes if necessary, but should // call the superclass implementation. virtual bool handleOpen ( IOService * client, IOOptionBits options, void * arg ); virtual void handleClose ( IOService * client, IOOptionBits options ); virtual bool handleIsOpen ( const IOService * client ) const; virtual bool willTerminate ( IOService * provider, IOOptionBits options ); virtual bool didTerminate ( IOService * provider, IOOptionBits options, bool * defer ); virtual void free ( void ); }; __exported_pop; #endif /* __IOKIT_IO_SCSI_PARALLEL_INTERFACE_CONTROLLER_H__ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/scsi/spi/IOSCSIParallelControllerCharacteristics.h
/* * Copyright (c) 2020 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _IO_SCSI_PARALLEL_CONTROLLER_CHARACTERISTICS_H_ #define _IO_SCSI_PARALLEL_CONTROLLER_CHARACTERISTICS_H_ /*! @header IOSCSIParallelControllerCharacteristics SCSI controller specific typedefs and constants used inside DriverKit environment. */ // The Feature Selectors used to identify features of the SCSI Parallel // Interface. These are used by the DoesHBASupportSCSIParallelFeature // to report whether the HBA supports a given SCSI Parallel Interface // feature and are used for requesting negotiation and reporting negotiation // results between the controller and the device. // When the DoesHBASupportSCSIParallelFeature() member routine of the controller // child class is called, it will return true if the HBA that it controls // supports the specified SCSIParallelFeature or false if it does not. typedef enum SCSIParallelFeature { // The selector for support of Wide Data Transfers. Only Wide16 is supported // as Wide32 has been obsoleted by the SPI-3 specification. kSCSIParallelFeature_WideDataTransfer = 0, // The selector for support of Synchronous Data Transfers. kSCSIParallelFeature_SynchronousDataTransfer = 1, // The selector for support of Quick Arbitration and Selection (QAS). kSCSIParallelFeature_QuickArbitrationAndSelection = 2, // The selector for support of Double Transition (DT) data transfers. kSCSIParallelFeature_DoubleTransitionDataTransfers = 3, // The selector for SPI Information Unit (IU) transfers. kSCSIParallelFeature_InformationUnitTransfers = 4, // Since the Feature selectors are zero base, this will always have the // correct total. kSCSIParallelFeature_TotalFeatureCount } SCSIParallelFeature; typedef enum SCSIParallelFeatureRequest { // This selector indicates that current negotiation // should be used. kSCSIParallelFeature_NoNegotiation = 0, // This selector indicates that the controller // should attempt negotiation for the feature kSCSIParallelFeature_AttemptNegotiation = 1, // This selector indicates that the controller // should clear any negotiation for the feature kSCSIParallelFeature_ClearNegotiation = 2 } SCSIParallelFeatureRequest; typedef enum SCSIParallelFeatureResult { kSCSIParallelFeature_NegotitiationUnchanged = 0, kSCSIParallelFeature_NegotitiationCleared = 1, kSCSIParallelFeature_NegotitiationSuccess = 2 } SCSIParallelFeatureResult; // Set this key with a value of true in UserReportHBAConstraints() to indicate support // for full 8-byte LUN addressing #define kIOHierarchicalLogicalUnitSupportKey "SCSI Hierarchical Logical Unit Support" // This is the alignment mask used when allocating per-task HBA data. It allows // the HBA to declare whether or not it supports 64-bit addressability and what the // minimum byte alignment is for the data. E.g. By specifying 0x0000FFFFFFFFFFFEULL, // the controller would be indicating that it supports 48-bits of addressability, but // at a minimum of being 2-byte aligned. #define kIOMinimumHBADataAlignmentMaskKey "HBA Data Alignment" #endif /* _IO_SCSI_PARALLEL_CONTROLLER_CHARACTERISTICS_H_ */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostControllerInterfaceDefinitions.h
// // IOUSBHostControllerInterfaceDefinitions.h // IOUSBHostFamily // // Copyright © 2020 Apple. All rights reserved. // #ifndef IOUSBHostControllerInterfaceDefinitions_h #define IOUSBHostControllerInterfaceDefinitions_h #include <IOKit/usb/AppleUSBDefinitions.h> #include <IOKit/usb/IOUSBHostFamilyDefinitions.h> #pragma pack(push, 1) #pragma mark enumerations typedef enum { IOUSBHostCIUserClientVersion100 = 0 } IOUSBHostCIUserClientVersion; /*! * @enum IOUSBHostCIExceptionType * @brief Exception specifier included as message argument to <code>kUSBHostMessageControllerException</code> * @discussion The kernel driver sends a <code>kUSBHostMessageControllerException</code> message to its clients when a fatal problem has occurred, with a refCon of the IOUSBHostController instance and a <code>IOUSBHostCIExceptionType</code> in the message arguments. * When any <code>kUSBHostMessageControllerException</code> message is received, the specified IOUSBHostControllerInterface must be destroyed. */ typedef enum { IOUSBHostCIExceptionTypeUnknown = 0, // Unknown failure IOUSBHostCIExceptionTypeCapabilitiesInvalid, // Client provided an invalid IOUSBHostCIMessageTypeControllerCapabilities or IOUSBHostCIMessageTypePortCapabilities structure IOUSBHostCIExceptionTypeTerminated, // Kernel service is terminating IOUSBHostCIExceptionTypeCommandReadCollision, // Client has issued too many concurrent asynchronous command reads IOUSBHostCIExceptionTypeCommandWriteFailed, // Kernel was unable to send a command message to the client IOUSBHostCIExceptionTypeCommandTimeout, // Command did not complete in the command timeout threshold specified in IOUSBHostCIMessageTypeControllerCapabilities IOUSBHostCIExceptionTypeCommandFailure, // Critical command failed IOUSBHostCIExceptionTypeInterruptInvalid, // Client sent an invalid interrupt message IOUSBHostCIExceptionTypeInterruptOverflow, // Kernel was unable to keep up with interrupt messages sent by the client IOUSBHostCIExceptionTypeDoorbellReadCollision, // Client has issued too many concurrent asynchronous doorbell reads IOUSBHostCIExceptionTypeDoorbellOverflow, // Client was unable to keep up with doorbell messages sent by the kernel IOUSBHostCIExceptionTypeProtocolError, // Client sent an invalid message in response to a command or transfer IOUSBHostCIExceptionTypeFrameUpdateError, // Client sent a IOUSBHostCIMessageTypeFrameNumberUpdate and IOUSBHostCIMessageTypeFrameTimestampUpdate pair with invalid contents or an out-of-spec frame duration } IOUSBHostCIExceptionType; /*! * @enum IOUSBHostCIMessageType * @brief Values to be populated in IOUSBHostCIMessageControlType of an IOUSBHostCIMessage structure */ typedef enum { IOUSBHostCIMessageTypeControllerCapabilities = 0x0, IOUSBHostCIMessageTypePortCapabilities, IOUSBHostCIMessageTypePortEvent = 0x8, IOUSBHostCIMessageTypeFrameNumberUpdate, IOUSBHostCIMessageTypeFrameTimestampUpdate, IOUSBHostCIMessageTypeCommandMin = 0x10, IOUSBHostCIMessageTypeControllerPowerOn = 0x10, IOUSBHostCIMessageTypeControllerPowerOff, IOUSBHostCIMessageTypeControllerStart, IOUSBHostCIMessageTypeControllerPause, IOUSBHostCIMessageTypeControllerFrameNumber, IOUSBHostCIMessageTypePortPowerOn = 0x18, IOUSBHostCIMessageTypePortPowerOff, IOUSBHostCIMessageTypePortResume, IOUSBHostCIMessageTypePortSuspend, IOUSBHostCIMessageTypePortReset, IOUSBHostCIMessageTypePortDisable, IOUSBHostCIMessageTypePortStatus, IOUSBHostCIMessageTypeDeviceCreate = 0x20, IOUSBHostCIMessageTypeDeviceDestroy, IOUSBHostCIMessageTypeDeviceStart, IOUSBHostCIMessageTypeDevicePause, IOUSBHostCIMessageTypeDeviceUpdate, IOUSBHostCIMessageTypeEndpointCreate = 0x28, IOUSBHostCIMessageTypeEndpointDestroy, IOUSBHostCIMessageTypeEndpoint_reserved_, IOUSBHostCIMessageTypeEndpointPause, IOUSBHostCIMessageTypeEndpointUpdate, IOUSBHostCIMessageTypeEndpointReset, IOUSBHostCIMessageTypeEndpointSetNextTransfer, IOUSBHostCIMessageTypeCommandMax = 0x37, IOUSBHostCIMessageTypeSetupTransfer = 0x38, IOUSBHostCIMessageTypeNormalTransfer, IOUSBHostCIMessageTypeStatusTransfer, IOUSBHostCIMessageTypeIsochronousTransfer, IOUSBHostCIMessageTypeLink, IOUSBHostCIMessageTypeTransferComplete, } IOUSBHostCIMessageType; /*! * @enum IOUSBHostCIMessageStatus * @brief Values to be populated in IOUSBHostCIMessageControlStatus of an IOUSBHostCIMessage structure */ typedef enum { IOUSBHostCIMessageStatusReserved = 0, // Reserved, do not use this value IOUSBHostCIMessageStatusSuccess, // The operation was successful IOUSBHostCIMessageStatusOffline, // The target is unreachable IOUSBHostCIMessageStatusNotPermitted, // The request cannot be performed in the current state IOUSBHostCIMessageStatusBadArgument, // The request did not pass validation checks IOUSBHostCIMessageStatusTimeout, // The request did not complete in the time expected IOUSBHostCIMessageStatusNoResources, // The request cannot be completed due to resource limitations IOUSBHostCIMessageStatusEndpointStopped, // The transfer generated an event due to an IOUSBHostCIMessageTypeEndpointPause command, not due to a completed transfer IOUSBHostCIMessageStatusProtocolError, // The transfer completed due to a protocol error IOUSBHostCIMessageStatusTransactionError, // The transfer completed due to a USB transaction error IOUSBHostCIMessageStatusOverrunError, // The transfer completed due to a USB babble (overrun) error IOUSBHostCIMessageStatusStallError, // The transfer completed due to a STALL handshake from the device IOUSBHostCIMessageStatusMissedServiceError, // The isochronous transfer was not able to be serviced in the specified frame number IOUSBHostCIMessageStatusError // Unspecified error } IOUSBHostCIMessageStatus; /*! * @enum IOUSBHostCIDeviceSpeed * @brief Values to represent a connected device speed, to be used in IOUSBHostCIMessages and IOUSBHostsCIPortStatus */ typedef enum { IOUSBHostCIDeviceSpeedNone = kIOUSBHostConnectionSpeedNone, IOUSBHostCIDeviceSpeedFull = kIOUSBHostConnectionSpeedFull, IOUSBHostCIDeviceSpeedLow = kIOUSBHostConnectionSpeedLow, IOUSBHostCIDeviceSpeedHigh = kIOUSBHostConnectionSpeedHigh, IOUSBHostCIDeviceSpeedSuper = kIOUSBHostConnectionSpeedSuper, IOUSBHostCIDeviceSpeedSuperPlus = kIOUSBHostConnectionSpeedSuperPlus, IOUSBHostCIDeviceSpeedSuperPlusBy2 = kIOUSBHostConnectionSpeedSuperPlusBy2 } IOUSBHostCIDeviceSpeed; /*! * @enum IOUSBHostCILinkState * @brief Values to represent a port's link state, to be used in IOUSBHostCIMessages and IOUSBHostCIPortStatus */ typedef enum { IOUSBHostCILinkStateU0 = 0, IOUSBHostCILinkStateU1 = 1, IOUSBHostCILinkStateU2 = 2, IOUSBHostCILinkStateU3 = 3, IOUSBHostCILinkStateDisabled = 4, IOUSBHostCILinkStateRxDetect = 5, IOUSBHostCILinkStateInactive = 6, IOUSBHostCILinkStatePolling = 7, IOUSBHostCILinkStateRecovery = 8, IOUSBHostCILinkStateReset = 9, IOUSBHostCILinkStateCompliance = 10, IOUSBHostCILinkStateTest = 11, IOUSBHostCILinkStateResume = 15, } IOUSBHostCILinkState; #pragma mark port status typedef uint32_t IOUSBHostCIPortStatus; /*! * @enum * @brief Fields in IOUSBHostCIPortStatus * @discussion IOUSBHostCIPortStatusPowered is set if the port is currently powered * IOUSBHostCIPortStatusOvercurrent is set if the port is currently observing an overcurrent condition * IOUSBHostCIPortStatusConnected is set if the port is currently observing a connected device * IOUSBHostCIPortStatusLinkState is populated with a IOUSBHostCILinkState value * IOUSBHostCIPortStatusSpeed is populated with a IOUSBHostCIDeviceSpeed value * IOUSBHostCIPortStatusOvercurrentChange is set if a change to IOUSBHostCIPortStatusOvercurrent has been observed * IOUSBHostCIPortStatusConnectChange is set if a change to IOUSBHostCIPortStatusConnected has been observed * IOUSBHostCIPortStatusLinkStateChange is set if the link has independently transitioned from an enabled to disabled state. See IOUSBHostCILinkStateEnabled(...) to determine if a particular link state is considered to be enabled or disabled. * IOUSBHostCIPortStatusChangeMask is a mask combining all change bits */ enum { IOUSBHostCIPortStatusPowered = IOUSBBit(0), IOUSBHostCIPortStatusOvercurrent = IOUSBBit(1), IOUSBHostCIPortStatusConnected = IOUSBBit(2), IOUSBHostCIPortStatusLinkState = IOUSBBitRange64(4, 7), IOUSBHostCIPortStatusLinkStatePhase = IOUSBBitRangePhase(4, 7), IOUSBHostCIPortStatusSpeed = IOUSBBitRange64(8, 10), IOUSBHostCIPortStatusSpeedPhase = IOUSBBitRangePhase(8, 10), IOUSBHostCIPortStatusOvercurrentChange = IOUSBBit(17), IOUSBHostCIPortStatusConnectChange = IOUSBBit(18), IOUSBHostCIPortStatusLinkStateChange = IOUSBBit(20), IOUSBHostCIPortStatusChangeMask = IOUSBHostCIPortStatusLinkStateChange | IOUSBHostCIPortStatusConnectChange | IOUSBHostCIPortStatusOvercurrentChange, }; #pragma mark doorbell messges /*! * @typedef IOUSBHostCIDoorbell * @brief Structured message used to notify the client that the specified endpoint or stream has updated IOUSBHostCIMessage messages to process * @discussion The kernel driver uses IOUSBHostCIDoorbell messages to transition an endpoint to the IOUSBHostCIEndpointStateActive state (if eligible), or to notify the client that additional valid IOUSBHostCIMessage structures have been appended to an already active queue. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIEndpointStateMachine associated with the endpoint selector in IOUSBHostCIDoorbellDeviceAddress and IOUSBHostCIDoorbellEndpointAddress of the command * 2. Utilize the IOUSBHostCIEndpointStateMachine processDoorbell interface to determine if the doorbell can be processed * 3. If successful and the endpoint is not already processing transfer messages, use the IOUSBHostCIEndpointStateMachine's currentTransferMessage property to begin processing transfer messages */ typedef uint32_t IOUSBHostCIDoorbell; /*! * @enum * @brief Fields in IOUSBHostCIDoorbell * @discussion IOUSBHostCIDoorbellDeviceAddress is populated with the device address targeted by the IOUSBHostCIDoorbell * IOUSBHostCIDoorbellEndpointAddress is populated with the endpoint address targeted by the IOUSBHostCIDoorbell * IOUSBHostCIDoorbellStreamID is populated with the stream ID targeted by the IOUSBHostCIDoorbell */ enum { IOUSBHostCIDoorbellDeviceAddress = IOUSBBitRange(0, 7), IOUSBHostCIDoorbellDeviceAddressPhase = IOUSBBitRangePhase(0, 7), IOUSBHostCIDoorbellEndpointAddress = IOUSBBitRange(8, 15), IOUSBHostCIDoorbellEndpointAddressPhase = IOUSBBitRangePhase(8, 15), IOUSBHostCIDoorbellStreamID = IOUSBBitRange(16, 31), IOUSBHostCIDoorbellStreamIDPhase = IOUSBBitRangePhase(16, 31) }; #pragma mark IOUSBHostCIMessage structures /*! * @typedef IOUSBHostCIMessage * @brief Foundational IOUSBHostControllerInterface message structure used for commands, transfers, and interrupts * @discussion IOUSBHostCIMessage structures are control structures passed between the IOUSBHostControllerInterface client and the kernel driver. They are used to represent capabilities during initialization, commands and transfers sent from the kernel, and interrupt events sent to the kernel. */ typedef struct IOUSBHostCIMessage { uint32_t control; uint32_t data0; uint64_t data1; } IOUSBHostCIMessage; /*! * @enum * @brief Fields used in all IOUSBHostCIMessage structures * @discussion IOUSBHostCIMessageControlType is populated in the control field with IOUSBHostCIMessageType. * IOUSBHostCIMessageControlStatus is populated in the control field with IOUSBHostCIMessageStatus. * IOUSBHostCIMessageControlNoResponse is set in the control field to incidate the recipient should not send a reply message. * IOUSBHostCIMessageControlValid is set in the control field to indicate the message is fully initialized and ready for consumption by the recipient. */ enum { IOUSBHostCIMessageControlType = IOUSBBitRange(0, 5), IOUSBHostCIMessageControlTypePhase = IOUSBBitRangePhase(0, 5), IOUSBHostCIMessageControlStatus = IOUSBBitRange(8, 11), IOUSBHostCIMessageControlStatusPhase = IOUSBBitRangePhase(8, 11), IOUSBHostCIMessageControlNoResponse = IOUSBBit(14), IOUSBHostCIMessageControlValid = IOUSBBit(15), }; #pragma mark capability IOUSBHostCIMessages /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeControllerCapabilities * @discussion IOUSBHostCICapabilitiesMessageControlPortCount is populated in the control field with the number of ports supported by this controller. * IOUSBHostCICapabilitiesMessageData0CommandTimeoutThreshold is populated in the data0 field to indicate a timeout threshold for commands from the kernel. Format is 2^n seconds. A command timeout is a fatal error and will generate a IOUSBHostCIExceptionTypeCommandTimeout exception. * IOUSBHostCICapabilitiesMessageData0ConnectionLatency is populated in the data0 field to indicate the time needed to pass a transfer structure and its associated data payload between the IOUSBHostControllerInterface and its target. Format is 2^n milliseconds. */ enum { IOUSBHostCICapabilitiesMessageControlPortCount = IOUSBBitRange(16, 19), IOUSBHostCICapabilitiesMessageControlPortCountPhase = IOUSBBitRangePhase(16, 19), IOUSBHostCICapabilitiesMessageData0CommandTimeoutThreshold = IOUSBBitRange(0, 1), IOUSBHostCICapabilitiesMessageData0CommandTimeoutThresholdPhase = IOUSBBitRangePhase(0, 1), IOUSBHostCICapabilitiesMessageData0ConnectionLatency = IOUSBBitRange(4, 7), IOUSBHostCICapabilitiesMessageData0ConnectionLatencyPhase = IOUSBBitRangePhase(4, 7) }; /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypePortCapabilities * @discussion IOUSBHostCIPortCapabilitiesMessageControlPortNumber is populated in the control field with the nonzero port number described by the structure. * IOUSBHostCIPortCapabilitiesMessageControlInternalConnector is set in the control field to indicate the port is not user-accessible, such as for a captive device. * IOUSBHostCIPortCapabilitiesMessageControlConnectorType is populated in the control field with the ACPI Connector Type * IOUSBHostCIPortCapabilitiesMessageData0MaxPower is populated in the data0 field with the maximum power consumption allowed by the port, in 8mA @ 5V units. */ enum { IOUSBHostCIPortCapabilitiesMessageControlPortNumber = IOUSBBitRange(16, 19), IOUSBHostCIPortCapabilitiesMessageControlPortNumberPhase = IOUSBBitRangePhase(16, 19), IOUSBHostCIPortCapabilitiesMessageControlInternalConnector = IOUSBBit(23), IOUSBHostCIPortCapabilitiesMessageControlConnectorType = IOUSBBitRange(24, 31), IOUSBHostCIPortCapabilitiesMessageControlConnectorTypePhase = IOUSBBitRangePhase(24, 31), IOUSBHostCIPortCapabilitiesMessageData0MaxPower = IOUSBBitRange(0, 7), IOUSBHostCIPortCapabilitiesMessageData0MaxPowerPhase = IOUSBBitRangePhase(0, 7), }; #pragma mark command IOUSBHostCIMessages /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType value in the range of IOUSBHostCIMessageTypeCommandMin to IOUSBHostCIMessageTypeCommandMax * @discussion IOUSBHostCICommandMessageControlStatus is populated in command response messages, see IOUSBHostCIMessageControlStatus * IOUSBHostCICommandMessageData0RootPort is populated in the data0 field with the nonzero port number if the command targets a port * IOUSBHostCICommandMessageData0DeviceAddress is populated in the data0 field with the device address if the command targets a device, endpoint, or stream * IOUSBHostCICommandMessageData0EndpointAddress is populated in the data0 field with the endpoint address if the command targets an endpoint or stream * IOUSBHostCICommandMessageData0StreamID is populated in the data0 field with the stream ID if the command targets a stream */ enum { IOUSBHostCICommandMessageControlStatus = IOUSBHostCIMessageControlStatus, IOUSBHostCICommandMessageControlStatusPhase = IOUSBHostCIMessageControlStatusPhase, IOUSBHostCICommandMessageData0RootPort = IOUSBBitRange(0, 3), IOUSBHostCICommandMessageData0RootPortPhase = IOUSBBitRangePhase(0, 3), IOUSBHostCICommandMessageData0DeviceAddress = IOUSBBitRange(0, 7), IOUSBHostCICommandMessageData0DeviceAddressPhase = IOUSBBitRangePhase(0, 7), IOUSBHostCICommandMessageData0EndpointAddress = IOUSBBitRange(8, 15), IOUSBHostCICommandMessageData0EndpointAddressPhase = IOUSBBitRangePhase(8, 15), IOUSBHostCICommandMessageData0StreamID = IOUSBBitRange(16, 31), IOUSBHostCICommandMessageData0StreamIDPhase = IOUSBBitRangePhase(16, 31) }; #pragma mark controller states and IOUSBHostCIMessages /*! * @enum IOUSBHostCIControllerState * @brief Host controller state managed by IOUSBHostCIControllerStateMachine * @discussion IOUSBHostCIControllerStateOff is the initial state of a newly created IOUSBHostCIControllerStateMachine instance, and represents a completely quiesced controller. All root ports must be in the IOUSBHostCIPortStateOff state. * IOUSBHostCIControllerStatePaused represents a controller that is idle. In this state the controller is not processing IO requests, but can detect port changes such as connect events or remote wakes. Root ports must not be in the IOUSBHostCIPortStateActive state. * IOUSBHostCIControllerStateActive represents a controller that is fully functional and able to service IO requests. Root ports may be in the IOUSBHostCIPortStateActive state. */ typedef enum { IOUSBHostCIControllerStateOff = 0, IOUSBHostCIControllerStatePaused, IOUSBHostCIControllerStateActive } IOUSBHostCIControllerState; /*! * @brief IOUSBHostCIMessageTypeControllerPowerOn command handling expectations * @discussion An IOUSBHostCIMessageTypeControllerPowerOn command is valid for an IOUSBHostCIControllerStateMachine in the IOUSBHostCIControllerStateOff state. * When received, client should perform the following actions: * 1. Utilize the IOUSBHostCIControllerStateMachine inspectCommand interface to determine if the command should be handled * 2. If successful, initialize the USB controller target and enable detection of port events * 3. Utilize the IOUSBHostCIControllerStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeControllerPowerOff command handling exepctations * @discussion An IOUSBHostCIMessageTypeControllerPowerOff command is valid for an IOUSBHostCIControllerStateMachine in the IOUSBHostCIControllerStatePaused or IOUSBHostCIControllerStateActive states. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostCIControllerStateMachine inspectCommand interface to determine if the command should be handled * 2. If successful, confirm that all downstream IOUSBHostCIPortStateMachine instances are in the IOUSBHostCIPortStateOff state * 3. If port state machine requirements are satisfied, disable detection of port events and power down the USB controller target * 4. Utilize the IOUSBHostCIControllerStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeControllerStart command handling expectations * @discussion An IOUSBHostCIMessageTypeControllerStart command is valid for an IOUSBHostCIControllerStateMachine in the IOUSBHostCIControllerStatePaused state. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostCIControllerStateMachine inspectCommand interface to determine if the command should be handled * 2. If successful, enable IO transfers on the USB controller target * 3. Utilize the IOUSBHostCIControllerStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeControllerPause command handling expectations * @discussion An IOUSBHostCIMessageTypeControllerPause command is valid for an IOUSBHostCIControllerStateMachine in the IOUSBHostCIMessageTypeControllerActive state. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostCIControllerStateMachine inspectCommand interface to determine if the command should be handled * 2. If successful, disable IO transfers on the USB controller target * 3. Utilize the IOUSBHostCIControllerStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeControllerFrameNumber command handling expectations * @discussion An IOUSBHostCIMessageTypeControllerFrameNumber command is valid for an IOUSBHostCIControllerStateMachine in the IOUSBHostCIControllerStateActive state. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostCIControllerStateMachine inspectCommand interface to determine if the command should be handled * 2. If successful, utilize the IOUSBHostCIControllerStateMachine enqueueUpdatedFrame interface to post frame update messages to the kernel driver * 3. Utilize the IOUSBHostCIControllerStateMachine respondToCommand interface to submit a command response to the kernel driver */ #pragma mark port states and IOUSBHostCIMessages /*! * @enum IOUSBHostCIPortState * @brief Port state managed by IOUSBHostCIPortStateMachine * @discussion IOUSBHostCIPortStateOff is the initial state of a newly created IOUSBHostCIPortStateMachine and represents an unpowered port which is unable to detect events such as connections. Downstream devices, if any, must be in the IOUSBHostCIDeviceStateDestroyed state. * IOUSBHostCIPortStatePowered represents a powered port which is able to detect events such as connections. Downstream devices, if any, must be in the IOUSBHostCIDeviceStateDestroyed state. * IOUSBHostCIPortStateSuspended represents a port with a downstream device that is in a low-power state such as U3 or L2. The port is able to detect events such as remote wakes, and is not actively transmitting data. Downstream devices must be in the IOUSBHostCIDeviceStatePaused state. * IOUSBHostCIPortStateActive represents a port with a downstream device that is able to immediately transfer data. The downstream device may be in the IOUSBHostCIDeviceStateActive state. */ typedef enum { IOUSBHostCIPortStateOff = 0, IOUSBHostCIPortStatePowered, IOUSBHostCIPortStateSuspended, IOUSBHostCIPortStateActive } IOUSBHostCIPortState; /*! * @brief IOUSBHostCIMessageTypePortEvent message expectations * @discussion An IOUSBHostCIMessageTypePortEvent message is sent by the client to the kernel driver to notify it that a change has occurred on the specified port. * The kernel driver will respond with port commands to interrogate the port for its current state and handle any new conditions. */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypePortEvent * @discussion IOUSBHostCIPortEventMessageData0PortNumber is populated in the data0 field with the nonzero port number of the port that needs to process events. */ enum { IOUSBHostCIPortEventMessageData0PortNumber = IOUSBBitRange(0, 3), IOUSBHostCIPortEventMessageData0PortNumberPhase = IOUSBBitRangePhase(0, 3) }; /*! * @enum * @brief Fields used in some IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType in the range of IOUSBHostCIMessageTypePortPowerOn to IOUSBHostCIMessageTypePortStatus * @discussion IOUSBHostCIPortStatusCommandData1Powered is set in the data1 field of command responses if the port is currently powered * IOUSBHostCIPortStatusCommandData1Overcurrent is set in the data1 field of command responses if the port is currently observing an overcurrent condition * IOUSBHostCIPortStatusCommandData1Connected is set in the data1 field of command responses if the port is currently observing a connected device * IOUSBHostCIPortStatusCommandData1LinkState is populated in the data1 field of command responses with the currently observed IOUSBHostCILinkState * IOUSBHostCIPortStatusCommandData1Speed is populated in the data1 field of command responses with the currently observed IOUSBHostCIDeviceSpeed * IOUSBHostCIPortStatusCommandData1OvercurrentChange is set in the data1 field of commands if the bit should be cleared on subsequent command responses. It is set in the data1 field of command responses if IOUSBHostCIPortStatusCommandData1Overcurrent has changed. * IOUSBHostCIPortStatusCommandData1ConnectChange is set in the data1 field of commands if the bit should be cleared on subsequent command responses. It is set in the data1 field of command responses if IOUSBHostCIPortStatusCommandData1Connected has changed. * IOUSBHostCIPortStatusCommandData1LinkStateChange is set in the data1 field of commands if the bit should be cleared on subsequent command responses. It is set in the data1 field of command responses if the link has independently transitioned from an enabled to disabled state. See IOUSBHostCILinkStateEnabled(...) to determine if a particular link state is considered to be enabled or disabled. * IOUSBHostCIPortStatusCommandData1ChangeMask is a mask combining all change bits from the data1 field. */ enum { IOUSBHostCIPortStatusCommandData1Powered = IOUSBHostCIPortStatusPowered, IOUSBHostCIPortStatusCommandData1Overcurrent = IOUSBHostCIPortStatusOvercurrent, IOUSBHostCIPortStatusCommandData1Connected = IOUSBHostCIPortStatusConnected, IOUSBHostCIPortStatusCommandData1LinkState = IOUSBHostCIPortStatusLinkState, IOUSBHostCIPortStatusCommandData1LinkStatePhase = IOUSBHostCIPortStatusLinkStatePhase, IOUSBHostCIPortStatusCommandData1Speed = IOUSBHostCIPortStatusSpeed, IOUSBHostCIPortStatusCommandData1SpeedPhase = IOUSBHostCIPortStatusSpeedPhase, IOUSBHostCIPortStatusCommandData1OvercurrentChange = IOUSBHostCIPortStatusOvercurrentChange, IOUSBHostCIPortStatusCommandData1ConnectChange = IOUSBHostCIPortStatusConnectChange, IOUSBHostCIPortStatusCommandData1LinkStateChange = IOUSBHostCIPortStatusLinkStateChange, IOUSBHostCIPortStatusCommandData1ChangeMask = IOUSBHostCIPortStatusChangeMask, }; /*! * @brief IOUSBHostCIMessageTypePortPowerOn command handling expectations * @discussion An IOUSBHostCIMessageTypePortPowerOn command is valid for an IOUSBHostCIPortStateMachine in the IOUSBHostCIPortStateOff state. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostControllerInterface getPortStateMachineForCommand interface to locate an IOUSBHostCIPortStateMachine instance for the command * 2. Utilize the IOUSBHostCIPortStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, power on the specified port hardware and enable it to accept connections * 4. Utilize the IOUSBHostCIPortStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypePortPowerOff command handling expectations * @discussion An IOUSBHostCIMessageTypePortPowerOff command is valid for an IOUSBHostCIPortStateMachine in any state except IOUSBHostCIPortStateOff. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostControllerInterface getPortStateMachineForCommand interface to locate an IOUSBHostCIPortStateMachine instance for the command * 2. Utilize the IOUSBHostCIPortStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, confirm that all downstream IOUSBHostCIDeviceStateMachine instances are in the IOUSBHostCIDeviceStateDestroyed state * 4. If device state machine requirements are satisfied, power off the specified port hardware and disable connection detection for that port * 5. Utilize the IOUSBHostCIPortStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypePortResume command handling expectations * @discussion An IOUSBHostCIMessageTypePortResume command is valid for an IOUSBHostCIPortStateMachine in the IOUSBHostCIPortStateSuspended state. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostControllerInterface getPortStateMachineForCommand interface to locate an IOUSBHostCIPortStateMachine instance for the command * 2. Utilize the IOUSBHostCIPortStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, reenable traffic to the downstream device (e.g. U0 or L0) and call IOUSBHostCIPortStateMachine updateLinkState interface to report current link conditions * 5. Utilize the IOUSBHostCIPortStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypePortSuspend command handling expectations * @discussion An IOUSBHostCIMessageTypePortSuspend command is valid for an IOUSBHostCIPortStateMachine in the IOUSBHostCIPortStateActive state. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostControllerInterface getPortStateMachineForCommand interface to locate an IOUSBHostCIPortStateMachine instance for the command * 2. Utilize the IOUSBHostCIPortStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, put the link into a low-power state (e.g. U3 or L2) and call IOUSBHostCIPortStateMachine updateLinkState interface to report current link conditions * 4. Utilize the IOUSBHostCIPortStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypePortReset command handling expectations * @discussion An IOUSBHostCIMessageTypePortReset command is valid for an IOUSBHostCIPortStateMachine in any state except IOUSBHostCIPortStateOff. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostControllerInterface getPortStateMachineForCommand interface to locate an IOUSBHostCIPortStateMachine instance for the command * 2. Utilize the IOUSBHostCIPortStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, issue a bus-level reset on the port and call IOUSBHostCIPortStateMachine updateLinkState interface to report current link conditions * 4. Utilize the IOUSBHostCIPortStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypePortDisable command handling expectations * @discussion An IOUSBHostCIMessageTypePortDisable command is valid for an IOUSBHostCIPortStateMachine in any state except IOUSBHostCIPortStateOff. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostControllerInterface getPortStateMachineForCommand interface to locate an IOUSBHostCIPortStateMachine instance for the command * 2. Utilize the IOUSBHostCIPortStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, disable traffic propogation to downstream devices and call IOUSBHostCIPortStateMachine updateLinkState interface to report current link conditions * 4. Utilize the IOUSBHostCIPortStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypePortStatus command handling expectations * @discussion An IOUSBHostCIMessageTypePortStatus command is valid for an IOUSBHostCIPortStateMachine in any state. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostControllerInterface getPortStateMachineForCommand interface to locate an IOUSBHostCIPortStateMachine instance for the command * 2. Utilize the IOUSBHostCIPortStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, ensure current link conditions have been captured by callin IOUSBHostCIPortStateMachine updateLinkState * 4. Utilize the IOUSBHostCIPortStateMachine respondToCommand interface to submit a command response to the kernel driver */ #pragma mark device states and IOUSBHostCIMessages /*! * @enum IOUSBHostCIDeviceState * @brief Device state managed by IOUSBHostCIDeviceStateMachine * @discussion IOUSBHostCIDeviceStateDestroyed represents a device that is no longer usable, and whose resources will be destroyed and freed * IOUSBHostCIDeviceStatePaused represents a device that may have IO requests enqueued, but they are not active on the bus. The state is closely correlated to IOUSBHostCIPortStateSuspended, and endpoints associated with this device may not be in the IOUSBHostCIEndpointStateActive state. * IOUSBHostCIDeviceStateActive is the initial sate of a newly created IOUSBHsotCIDeviceStateMachine, and represents a device that can be processing IO requests. Endpoints associated with this device may be in the IOUSBHostCIEndpointStateActive state. */ typedef enum { IOUSBHostCIDeviceStateDestroyed = 0, IOUSBHostCIDeviceStatePaused, IOUSBHostCIDeviceStateActive } IOUSBHostCIDeviceState; /*! * @brief IOUSBHostCIMessageTypeDeviceCreate command handling expectations * @discussion An IOUSBHostCIMessageTypeDeviceCreate command is used to prompt creation of an IOUSBHostCIDeviceStateMachine instance, to be tracked by the client. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostCIDeviceStateMachine initWithInterface interface, using the command as a parameter * 2. If successful, the client must attempt to allocate and assign a USB device address to the device at the specified route * 3. Utilize the IOUSBHostCIDeviceStateMachine respondToCommand interface to submit a command response to the kernel driver, or the IOUSBHostControllerInterface enqueueInterrupt interface if the IOUSBHostCIDeviceStateMachine was not created */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeDeviceCreate * @discussion IOUSBHostCIDeviceCreateCommandData0RootPort is populated in the data0 field of the command with the nonzero root port number for which to create a device * IOUSBHostCIDeviceCreateCommandData0Route is populated in the data0 field of the command with the USB route string (see USB 3.2 § 8.9) * IOUSBHostCIDeviceCreateCommandData1DeviceAddress is populated in the data1 field of the command response with the USB address assigned to the newly created device */ enum { IOUSBHostCIDeviceCreateCommandData0RootPort = IOUSBBitRange(0, 3), IOUSBHostCIDeviceCreateCommandData0RootPortPhase = IOUSBBitRangePhase(0, 3), IOUSBHostCIDeviceCreateCommandData0Route = IOUSBBitRange(4, 23), IOUSBHostCIDeviceCreateCommandData0RoutePhase = IOUSBBitRangePhase(4, 23), IOUSBHostCIDeviceCreateCommandData1DeviceAddress = IOUSBBitRange64(0, 7), IOUSBHostCIDeviceCreateCommandData1DeviceAddressPhase = IOUSBBitRangePhase(0, 7) }; /*! * @brief IOUSBHostCIMessageTypeDeviceDestroy command handling expectations * @discussion An IOUSBHostCIMessageTypeDeviceDestroy command is valid for an IOUSBHostCIDeviceStateMachine in any state except IOUSBHostCIDeviceStateDestroyed. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIDeviceStateMachine associated with the device address selector in IOUSBHostCICommandMessageData0DeviceAddress of the command * 2. Utilize the IOUSBHostCIDeviceStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, confirm all endpoints encapsulated by the device are in the IOUSBHostCIEndpointStateDestroyed state. * 4. If endpoint state requirements have been met, release resources associated with the device instance * 5. Utilize the IOUSBHostCIDeviceStateMachine respondToCommand interface to submit a command response to the kernel driver * 6. Destroy the IOUSBHostCIDeviceStateMachine instance */ /*! * @brief IOUSBHostCIMessageTypeDeviceStart command handling expectations * @discussion An IOUSBHostCIMessageTypeDeviceStart command is valid for an IOUSBHostCIDeviceStateMachine in the IOUSBHostCIDeviceStatePaused state. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIDeviceStateMachine associated with the device address selector in IOUSBHostCICommandMessageData0DeviceAddress of the command * 2. Utilize the IOUSBHostCIDeviceStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, adjust necessary internal state to permit IO transfers to the device * 4. Utilize the IOUSBHostCIDeviceStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeDevicePause command handling expectations * @discussion An IOUSBHostCIMessageTypeDevicePause command is valid for an IOUSBHostCIDeviceStateMachine in the IOUSBHostCIDeviceStateActive state. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIDeviceStateMachine associated with the device address selector in IOUSBHostCICommandMessageData0DeviceAddress of the command * 2. Utilize the IOUSBHostCIDeviceStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, adjust necessary internal state to quiesce IO transfers to the device * 4. Utilize the IOUSBHostCIDeviceStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeDeviceUpdate command handling expectations * @discussion An IOUSBHostCIMessageTypeDeviceUpdate command is valid for an IOUSBHostCIDeviceStateMachine in any state except IOUSBHostCIDeviceStateDestroyed. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIDeviceStateMachine associated with the device address selector in IOUSBHostCICommandMessageData0DeviceAddress of the command * 2. Utilize the IOUSBHostCIDeviceStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, inspect the USB descriptor at the address provided in IOUSBHostCIDeviceUpdateCommandData1DescriptorAddress and make appropriate adjustments to the controller configuration * 4. Utilize the IOUSBHostCIDeviceStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeDeviceUpdate * @discussion IOUSBHostCIDeviceUpdateCommandData1DescriptorAddress is populated in the data1 field of the command with the virtual address of a USB descriptor (see USB 3.2 § 9.5) applicable to the device. */ enum { IOUSBHostCIDeviceUpdateCommandData1DescriptorAddress = IOUSBBitRange(0, 63), IOUSBHostCIDeviceUpdateCommandData1DescriptorAddressPhase = IOUSBBitRangePhase(0, 63) }; #pragma mark endpoint states and IOUSBHostCIMessages /*! * @enum IOUSBHostCIEndpointState * @brief Endpoint state managed by IOUSBHostCIEndpointStateMachine * @discussion IOUSBHostCIEndpointStateDestroyed represents an endpoint that is no longer usable, and whose resources will be destroyed and freed. * IOUSBHostCIEndpointStateHalted represents an endpoint that has encountered an IO error. The client must not access or modify transfer structures or IO buffers for an endpoint in this state. * IOUSBHostCIEndpointStatePaused is the initial state of a newly created IOUSBHostCIEndpointStateMachine, and represents an endpoint that is not currently servicing IO requests. The client must not access or modify transfer structures or IO buffers for an endpoint in this state. * IOUSBHostCIEndpointStateActive represents an endpoint that is currently servicing an IO request, or is idle after successfully servicing its queue of IO requests. In this state the client may access transfer structures and IO buffers. */ typedef enum { IOUSBHostCIEndpointStateDestroyed = 0, IOUSBHostCIEndpointStateHalted, IOUSBHostCIEndpointStatePaused, IOUSBHostCIEndpointStateActive, } IOUSBHostCIEndpointState; /*! * @brief IOUSBHostCIMessageTypeEndpointCreate command handling expectations * @discussion An IOUSBHostCIMessageTypeEndpointCreate command is used to prompt creation of an IOUSBHostCIEndpointStateMachine instance, to be tracked by the client. * When received, the client should perform the following actions: * 1. Utilize the IOUSBHostCIEndpointStateMachine initWithInterface interface, using the command as a parameter * 2. If successful, inspect the USB descriptor at the address provided in IOUSBHostCIEndpointCreateCommandData1Descriptor and allocate appropriate resources for the specified endpoint * 3. Utilize the IOUSBHostCIEndpointStateMachine respondToCommand interface to submit a command response to the kernel driver, or the IOUSBHostControllerInterface enqueueInterrupt interface if the IOUSBHostCIEndpointStateMachine was not created */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeEndpointCreate * @discussion IOUSBHostCIEndpointCreateCommandData1Descriptor is populated in the data1 field of the command with the virtual address of the USB endpoint descriptor(s) (see USB 3.2 § 9.5) describing the endpoint. */ enum { IOUSBHostCIEndpointCreateCommandData1Descriptor = IOUSBBitRange64(0, 63), IOUSBHostCIEndpointCreateCommandData1DescriptorPhase = IOUSBBitRangePhase(0, 63) }; /*! * @brief IOUSBHostCIMessageTypeEndpointDestroy command handling expectations * @discussion An IOUSBHostCIMessageTypeEndpointDestroy command is valid for an IOUSBHostCIEndpointStateMachine in any state except IOUSBHostCIEndpointStateDestroyed. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIEndpointStateMachine associated with the endpoint selector in IOUSBHostCICommandMessageData0DeviceAddress and IOUSBHostCICommandMessageData0EndpointAddress of the command * 2. Utilize the IOUSBHostCIEndpointStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, quiesce activity on the specified endpoint and abort any remaining transfers (including submitting transfer completion messages to the kernel driver) * 4. Utilize the IOUSBHostCIEndpointStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeEndpointPause command handling expectations * @discussion An IOUSBHostCIMessageTypeEndpointPause command is valid for an IOUSBHostCIEndpointStateMachine in the IOUSBHostCIEndpointStateActive state. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIEndpointStateMachine associated with the endpoint selector in IOUSBHostCICommandMessageData0DeviceAddress and IOUSBHostCICommandMessageData0EndpointAddress of the command * 2. Utilize the IOUSBHostCIEndpointStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, quiesce activity on the specified endpoint, submit any generated transfer completion messages to the kernel driver, and stop accessing transfer structures or data buffers for the endpoint * 4. Utilize the IOUSBHostCIEndpointStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @brief IOUSBHostCIMessageTypeEndpointUpdate command handling expectations * @discussion An IOUSBHostCIMessageTypeEndpointUpdate command is valid for an IOUSBHostCIEndpointStateMachine in the IOUSBHostCIEndpointStatePaused state. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIEndpointStateMachine associated with the endpoint selector in IOUSBHostCICommandMessageData0DeviceAddress and IOUSBHostCICommandMessageData0EndpointAddress of the command * 2. Utilize the IOUSBHostCIEndpointStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, inspect the USB descriptor at the address provided in IOUSBHostCIEndpointUpdateCommandData1Descriptor and make appropriate adjustments to the endpoint configuration * 4. Utilize the IOUSBHostCIEndpoointStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeEndpointUpdate * @discussion IOUSBHostCIEndpointUpdateCommandData1Descriptor is populated in the data1 field of the command with the virtual address of the USB endpoint descriptors (see USB 3.2 § 9.5) describing updated endpoint capabilities. */ enum { IOUSBHostCIEndpointUpdateCommandData1Descriptor = IOUSBBitRange64(0, 63), IOUSBHostCIEndpointUpdateCommandData1DescriptorPhase = IOUSBBitRangePhase(0, 63) }; /*! * @brief IOUSBHostCIMessageTypeEndpointReset command handling expectations * @discussion An IOUSBHostCIMessageTypeEndpointReset command is valid for an IOUSBHostCIEndpointStateMachine in the IOUSBHostCIEndpointStateHalted state. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIEndpointStateMachine associated with the endpoint selector in IOUSBHostCICommandMessageData0DeviceAddress and IOUSBHostCICommandMessageData0EndpointAddress of the command * 2. Utilize the IOUSBHostCIEndpointStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, perform necessary actions to clear a Halted condition on the endpoint and return it to the IOUSBHostCIEndpointStatePaused state * 4. Utilize the IOUSBHostCIEndpointStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeEndpointReset * @discussion IOUSBHostCIEndpointResetCommandData1ClearState is set in the data1 field of the command to indicate the endpoint state (e.g. data toggle) should be reset as part of processing the command. */ enum { IOUSBHostCIEndpointResetCommandData1ClearState = IOUSBBit(0) }; /*! * @brief IOUSBHostCIMessageTypeEndpointSetNextTransfer command handling expectations * @discussion An IOUSBHostCIMessageTypeEndpointSetNextTransfer command is valid for an IOUSBHostCIEndpointStateMachine in the IOUSBHostCIEndpointStatePaused state. * When received, the client should perform the following actions: * 1. Locate the iOUSBHostCIEndpointStateMachine associated with the endpoint selector in IOUSBHostCICommandMessageData0DeviceAddress and IOUSBHostCICommandMessageData0EndpointAddress of the command * 2. Utilize the IOUSBHostCIEndpointStateMachine inspectCommand interface to determine if the command should be processed * 3. If successful, update internal state as needed to force a refresh of the transfer structure pointer on the next doorbell for the endpoint * 4. Utilize the IOUSBHostCIEndpointStateMachine respondToCommand interface to submit a command response to the kernel driver */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeEndpointSetNextTransfer * @discussion IOUSBHostCIEndpointSetNextTransferCommandData1Address is populated in the data1 field of the command with the virtual address of the next IOUSBHostCIMessage transfer message to process. */ enum { IOUSBHostCIEndpointSetNextTransferCommandData1Address = IOUSBBitRange64(0, 63), IOUSBHostCIEndpointSetNextTransferCommandData1AddressPhase = IOUSBBitRangePhase(0, 63) }; #pragma mark transfer IOUSBHostCIMessages /*! * @brief Transfer IOUSBHostCIMessage expectations * @discussion Data movement is accomplished via arrays of IOUSBHostCIMessage structures with a IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeSetupTransfer, IOUSBHostCIMessageTypeNormalTransfer, * IOUSBHostCIMessageTypeStatusTransfer, IOUSBHostCIMessageTypeIsochronousTransfer, and IOUSBHostCIMessageTypeLink. Control endpoints support IOUSBHostCIMessageTypeSetupTransfer and * IOUSBHostCIMessageTypeStatusTransfer messages, and use IOUSBHostCIMessageTypeNormalTransfer to represent the data phase of transfers. Isochronous endpoints use * IOUSBHostCIMessageTypeIsochronousTransfer messages. Bulk and interrupt endpoints use IOUSBHostCIMessageTypeNormalTransfer messages. * * The last message in an array has the type IOUSBHostCIMessageTypeLink, which when valid points to the first entry in the next array of messages. IOUSBHostCIEndpointStateMachine aids in parsing these structures * and following valid links. * * When a doorbell message arrives for the endpoint, clients should use the IOUSBHostCIEndpoointStateMachine processDoorbell interface and currentTransferMessage property to check for valid transfer messages to * process. While parsing transfer messages, those with the IOUSBHostCIMessageControlNoResponse bit cleared should use the IOUSBHostCIEndpointStateMachine enqueueTransferCompletionForMessage * interface to deliver a IOUSBHostCIMessageTypeTransferComplete message to the kernel driver. If a control, bulk, or interrupt endpoint transfer message is being completed with an unsuccessful status, the endpoint * will transition to the IOUSBHostCIEndpointStateHalted state, and the client must first ensure it has quiesced activity on the endpoint and is no longer accessing transfer structures or data buffers for that endpoint. */ /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeSetupTransfer * @discussion See USB 3.2 § 9.3 for a description of the control request fields. * IOUSBHostCISetupTransferData1bmRequestType is populated in the data1 field with the control request's bmRequestType * IOUSBHostCISetupTransferData1bRequest is populated in the data1 field with the control request's bRequest * IOUSBHostCISetupTransferData1wValue is populated in the data1 field with the control request's wValue * IOUSBHostCISetupTransferData1wIndex is populated in the data1 field with the control request's wIndex * IOUSBHostCISetupTransferData1wLength is populated in the data1 field with the control request's wLength */ enum { IOUSBHostCISetupTransferData1bmRequestType = IOUSBBitRange64(0, 7), IOUSBHostCISetupTransferData1bmRequestTypePhase = IOUSBBitRangePhase(0, 7), IOUSBHostCISetupTransferData1bRequest = IOUSBBitRange64(8, 15), IOUSBHostCISetupTransferData1bRequestPhase = IOUSBBitRangePhase(8, 15), IOUSBHostCISetupTransferData1wValue = IOUSBBitRange64(16, 31), IOUSBHostCISetupTransferData1wValuePhase = IOUSBBitRangePhase(16, 31), IOUSBHostCISetupTransferData1wIndex = IOUSBBitRange64(32, 47), IOUSBHostCISetupTransferData1wIndexPhase = IOUSBBitRangePhase(32, 47), IOUSBHostCISetupTransferData1wLength = IOUSBBitRange64(48, 63), IOUSBHostCISetupTransferData1wLengthPhase = IOUSBBitRangePhase(48, 63) }; /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeNormalTransfer * @discussion IOUSBHostCINormalTransferData0Length is populated in the data0 field with the length of the transfer, in bytes * IOUSBHostCINormalTransferData1Buffer is populated in the data1 field with the virtual address of the buffer to use for the transfer */ enum { IOUSBHostCINormalTransferData0Length = IOUSBBitRange(0, 27), IOUSBHostCINormalTransferData0LengthPhase = IOUSBBitRangePhase(0, 27), IOUSBHostCINormalTransferData1Buffer = IOUSBBitRange(0, 63), IOUSBHostCINormalTransferData1BufferPhase = IOUSBBitRangePhase(0, 63) }; /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeIsochronousTransfer * @discussion IOUSBHostCIIsochronousTransferControlFrameNumber is populated in the control field with the least significant bits of the frame number for this transfer * IOUSBHostCIIsochronousTransferControlASAP is set in the control field to indicate IOUSBHostCIIsochronousTransferControlFrameNumber should be ignored and the transfer should be sent at the endpoint's next service opportunity * IOUSBHostCIIsochronousTransferData0Length is populated in the data0 field with the length of the transfer, in bytes * IOUSBHostCIIsochronousTransferData1BufferPhase is populated in the data1 field with the virtual address of the buffer to use for the transfer */ enum { IOUSBHostCIIsochronousTransferControlFrameNumber = IOUSBBitRange(16, 23), IOUSBHostCIIsochronousTransferControlFrameNumberPhase = IOUSBBitRangePhase(16, 23), IOUSBHostCIIsochronousTransferControlASAP = IOUSBBit(24), IOUSBHostCIIsochronousTransferData0Length = IOUSBHostCINormalTransferData0Length, IOUSBHostCIIsochronousTransferData0LengthPhase = IOUSBHostCINormalTransferData0LengthPhase, IOUSBHostCIIsochronousTransferData1Buffer = IOUSBHostCINormalTransferData1Buffer, IOUSBHostCIIsochronousTransferData1BufferPhase = IOUSBHostCINormalTransferData1BufferPhase }; /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeLink * @discussion IOUSBHostCILinkData1TransferStructureAddress is populated with the virtual address of the next IOUSBHostCIMessage structure to consume. */ enum { IOUSBHostCILinkData1TransferStructureAddress = IOUSBBitRange(0, 63), IOUSBHostCILinkData1TransferStructureAddressPhase = IOUSBBitRangePhase(0, 63) }; /*! * @enum * @brief Fields used in IOUSBHostCIMessage structures with an IOUSBHostCIMessageControlType of IOUSBHostCIMessageTypeTransferComplete * @discussion IOUSBHostCITransferCompletionMessageControlStatus is populated in the control field with a IOUSBHostCIMessageStatus describing the result of the transfer * IOUSBHostCITransferCompletionMessageControlDeviceAddress is populated in the control field with the device address associated with the transfer * IOUSBHostCITransferCompletionMessageControlEndpointAddress is populated in the control field with the endpoint address associated with the transfer * IOUSBHostCITransferCompletionMessageData0TransferLength is populated in the data0 field with the actual number of bytes transferred for the transfer * IOUSBHostCITransferCompletionMessageData1TransferStructure is populated in the data1 field with the virtual address of the IOUSBHostCIMessage transfer structure that generated this event */ enum { IOUSBHostCITransferCompletionMessageControlStatus = IOUSBHostCIMessageControlStatus, IOUSBHostCITransferCompletionMessageControlStatusPhase = IOUSBHostCIMessageControlStatusPhase, IOUSBHostCITransferCompletionMessageControlDeviceAddress = IOUSBBitRange(16, 23), IOUSBHostCITransferCompletionMessageControlDeviceAddressPhase = IOUSBBitRangePhase(16, 23), IOUSBHostCITransferCompletionMessageControlEndpointAddress = IOUSBBitRange(24, 31), IOUSBHostCITransferCompletionMessageControlEndpointAddressPhase = IOUSBBitRangePhase(24, 31), IOUSBHostCITransferCompletionMessageData0TransferLength = IOUSBBitRange(0, 27), IOUSBHostCITransferCompletionMessageData0TransferLengthPhase = IOUSBBitRangePhase(0, 27), IOUSBHostCITransferCompletionMessageData1TransferStructure = IOUSBBitRange64(0, 63), IOUSBHostCITransferCompletionMessageData1TransferStructurePhase = IOUSBBitRangePhase(0, 63) }; #pragma pack(pop) #endif /* IOUSBHostControllerInterfaceDefinitions_h */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/StandardUSB.h
/* * Copyright (c) 1998-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header StandardUSB.h @brief StandardUSB defines structures and constants to reflect the USB specification */ #ifndef IOUSBHostFamily_StandardUSB_h #define IOUSBHostFamily_StandardUSB_h #include <IOKit/IOTypes.h> #include <IOKit/IOReturn.h> #include <libkern/OSByteOrder.h> #include <IOKit/usb/AppleUSBDefinitions.h> #define StandardUSBBit(bit) IOUSBBit(bit) #define StandardUSBBitRange(start, end) IOUSBBitRange(start, end) #define StandardUSBBitRange64(start, end) IOUSBBitRange64(start, end) #define StandardUSBBitRangePhase(start, end) IOUSBBitRangePhase(start, end) #define kUSB30Bitrate5Gbps kIOUSB30Bitrate5Gbps #define kUSB30Bitrate10Gbps kIOUSB30Bitrate10Gbps #define kUSB32Bitrate20Gbps kIOUSB32Bitrate20Gbps #ifdef __cplusplus #pragma mark StandardUSB namespace namespace StandardUSB { #endif // __cplusplus #pragma mark Descriptor definitions /*! * @enum tDescriptorType * @namespace StandardUSB * @brief Descriptor types defined by USB 2.0 Table 9-5 and USB 3.0 Table 9-6 */ enum tDescriptorType { kDescriptorTypeDevice = kIOUSBDescriptorTypeDevice, kDescriptorTypeConfiguration = kIOUSBDescriptorTypeConfiguration, kDescriptorTypeString = kIOUSBDescriptorTypeString, kDescriptorTypeInterface = kIOUSBDescriptorTypeInterface, kDescriptorTypeEndpoint = kIOUSBDescriptorTypeEndpoint, kDescriptorTypeDeviceQualifier = kIOUSBDescriptorTypeDeviceQualifier, kDescriptorTypeOtherSpeedConfiguration = kIOUSBDescriptorTypeOtherSpeedConfiguration, kDescriptorTypeInterfacePower = kIOUSBDescriptorTypeInterfacePower, kDescriptorTypeOTG = kIOUSBDescriptorTypeOTG, kDescriptorTypeDebug = kIOUSBDescriptorTypeDebug, kDescriptorTypeInterfaceAssociation = kIOUSBDescriptorTypeInterfaceAssociation, kDescriptorTypeBOS = kIOUSBDescriptorTypeBOS, kDescriptorTypeDeviceCapability = kIOUSBDescriptorTypeDeviceCapability, kDescriptorTypeHub = kIOUSBDescriptorTypeHub, kDescriptorTypeSuperSpeedHub = kIOUSBDescriptorTypeSuperSpeedHub, kDescriptorTypeSuperSpeedUSBEndpointCompanion = kIOUSBDescriptorTypeSuperSpeedUSBEndpointCompanion, kDescriptorTypeSuperSpeedPlusIsochronousEndpointCompanion = kIOUSBDescriptorTypeSuperSpeedPlusIsochronousEndpointCompanion }; typedef enum tDescriptorType tDescriptorType; /*! * @enum tDescriptorSize * @namespace StandardUSB * @brief Size in bytes for descriptor structures */ enum tDescriptorSize { kDescriptorSize = kIOUSBDescriptorHeaderSize, kDescriptorSizeDevice = kIOUSBDescriptorSizeDevice, kDescriptorSizeConfiguration = kIOUSBDescriptorSizeConfiguration, kDescriptorSizeInterface = kIOUSBDescriptorSizeInterface, kDescriptorSizeEndpoint = kIOUSBDescriptorSizeEndpoint, kDescriptorSizeStringMinimum = kDescriptorSize, kDescriptorSizeStringMaximum = kIOUSBDescriptorSizeStringMaximum, kDescriptorSizeDeviceQualifier = kIOUSBDescriptorSizeDeviceQualifier, kDescriptorSizeInterfaceAssociation = kIOUSBDescriptorSizeInterfaceAssociation, kDescriptorSizeBOS = kIOUSBDescriptorSizeBOS, kDescriptorSizeDeviceCapability = kIOUSBDescriptorSizeDeviceCapability, kDescriptorSizeUSB20ExtensionCapability = kIOUSBDescriptorSizeUSB20ExtensionCapability, kDescriptorSizeSuperSpeedUSBDeviceCapability = kIOUSBDescriptorSizeSuperSpeedUSBDeviceCapability, kDescriptorSizeContainerIDCapability = kIOUSBDescriptorSizeContainerIDCapability, kDescriptorSizeHubMinimum = kIOUSBDescriptorSizeHubMinimum, kDescriptorSizeHubMaximum = kIOUSBDescriptorSizeHubMaximum, kDescriptorSizeSuperSpeedHub = kIOUSBDescriptorSizeSuperSpeedHub, kDescriptorSizeSuperSpeedUSBEndpointCompanion = kIOUSBDescriptorSizeSuperSpeedUSBEndpointCompanion, kDescriptorSizeSuperSpeedPlusIsochronousEndpointCompanion = kIOUSBDescriptorSizeSuperSpeedPlusIsochronousEndpointCompanion, kDescriptorSizeBillboardDeviceMinimum = kIOUSBDescriptorSizeBillboardDeviceMinimum, kDescriptorSizeBillboardDeviceMaximum = kIOUSBDescriptorSizeBillboardDeviceMaximum, kDescriptorSizePlatformECIDCapability = kIOUSBDescriptorSizePlatformECIDCapability, kDescriptorSizePlatformCapability = kIOUSBDescriptorSizePlatformCapability }; typedef enum tDescriptorSize tDescriptorSize; /*! * @struct Descriptor * @namespace StandardUSB * @brief Base descriptor defined by USB 2.0 9.5 * @discussion StandardUSB.h declares structs to represent a variety of USB standard descriptors. Each of thes structs is derived from the Descriptor base struct, and can therefore be passed to methods accepting a Descriptor pointer without explicit casting. For the C language, each struct is defined independently to include the bLength and bDescriptorType fields expected for all USB descriptors. */ struct Descriptor { uint8_t bLength; uint8_t bDescriptorType; } __attribute__((packed)); typedef struct Descriptor Descriptor; #ifdef __cplusplus // USB 2.0 9.6.1: Device struct DeviceDescriptor : public Descriptor { #else struct DeviceDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint16_t bcdUSB; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; uint8_t bMaxPacketSize0; uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; uint8_t iManufacturer; uint8_t iProduct; uint8_t iSerialNumber; uint8_t bNumConfigurations; } __attribute__((packed)); typedef struct DeviceDescriptor DeviceDescriptor; #ifdef __cplusplus // USB 2.0 9.6.2: Device Qualifier struct DeviceQualifierDescriptor : public Descriptor { #else struct DeviceQualifierDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint16_t bcdUSB; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; uint8_t bMaxPacketSize0; uint8_t bNumConfigurations; uint8_t bReserved; } __attribute__((packed)); typedef struct DeviceQualifierDescriptor DeviceQualifierDescriptor; #ifdef __cplusplus // USB 2.0 9.6.3: Configuration struct ConfigurationDescriptor : public Descriptor { #else struct ConfigurationDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint16_t wTotalLength; uint8_t bNumInterfaces; uint8_t bConfigurationValue; uint8_t iConfiguration; uint8_t bmAttributes; uint8_t bMaxPower; } __attribute__((packed)); typedef struct ConfigurationDescriptor ConfigurationDescriptor; enum { kConfigurationDescriptorAttributeRemoteWakeCapable = kIOUSBConfigurationDescriptorAttributeRemoteWakeCapable, kConfigurationDescriptorAttributeSelfPowered = kIOUSBConfigurationDescriptorAttributeSelfPowered }; #ifdef __cplusplus // USB 2.0 9.6.5: Interface struct InterfaceDescriptor : public Descriptor { #else struct InterfaceDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bInterfaceNumber; uint8_t bAlternateSetting; uint8_t bNumEndpoints; uint8_t bInterfaceClass; uint8_t bInterfaceSubClass; uint8_t bInterfaceProtocol; uint8_t iInterface; } __attribute__((packed)); typedef struct InterfaceDescriptor InterfaceDescriptor; #ifdef __cplusplus // USB 2.0 9.6.6: Endpoint struct EndpointDescriptor : public Descriptor { #else struct EndpointDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bEndpointAddress; uint8_t bmAttributes; uint16_t wMaxPacketSize; uint8_t bInterval; } __attribute__((packed)); typedef struct EndpointDescriptor EndpointDescriptor; enum { kEndpointDescriptorNumber = kIOUSBEndpointDescriptorNumber, kEndpointDescriptorEndpointAddressReserved = kIOUSBEndpointDescriptorEndpointAddressReserved, kEndpointDescriptorDirection = kIOUSBEndpointDescriptorDirection, kEndpointDescriptorDirectionPhase = kIOUSBEndpointDescriptorDirectionPhase, kEndpointDescriptorDirectionOut = kIOUSBEndpointDescriptorDirectionOut, kEndpointDescriptorDirectionIn = kIOUSBEndpointDescriptorDirectionIn, kEndpointDescriptorTransferType = kIOUSBEndpointDescriptorTransferType, kEndpointDescriptorTransferTypePhase = kIOUSBEndpointDescriptorTransferTypePhase, kEndpointDescriptorTransferTypeControl = kIOUSBEndpointDescriptorTransferTypeControl, kEndpointDescriptorTransferTypeIsochronous = kIOUSBEndpointDescriptorTransferTypeIsochronous, kEndpointDescriptorTransferTypeBulk = kIOUSBEndpointDescriptorTransferTypeBulk, kEndpointDescriptorTransferTypeInterrupt = kIOUSBEndpointDescriptorTransferTypeInterrupt, kEndpointDescriptorSynchronizationType = kIOUSBEndpointDescriptorSynchronizationType, kEndpointDescriptorSynchronizationTypePhase = kIOUSBEndpointDescriptorSynchronizationTypePhase, kEndpointDescriptorSynchronizationTypeNone = kIOUSBEndpointDescriptorSynchronizationTypeNone, kEndpointDescriptorSynchronizationTypeAsynchronous = kIOUSBEndpointDescriptorSynchronizationTypeAsynchronous, kEndpointDescriptorSynchronizationTypeAdaptive = kIOUSBEndpointDescriptorSynchronizationTypeAdaptive, kEndpointDescriptorSynchronizationTypeSynchronous = kIOUSBEndpointDescriptorSynchronizationTypeSynchronous, kEndpointDescriptorUsageType = kIOUSBEndpointDescriptorUsageType, kEndpointDescriptorUsageTypePhase = kIOUSBEndpointDescriptorUsageTypePhase, kEndpointDescriptorUsageTypeInterruptPeriodic = kIOUSBEndpointDescriptorUsageTypeInterruptPeriodic, kEndpointDescriptorUsageTypeInterruptNotification = kIOUSBEndpointDescriptorUsageTypeInterruptNotification, kEndpointDescriptorUsageTypeInterruptReserved1 = kIOUSBEndpointDescriptorUsageTypeInterruptReserved1, kEndpointDescriptorUsageTypeInterruptReserved2 = kIOUSBEndpointDescriptorUsageTypeInterruptReserved2, kEndpointDescriptorUsageTypeIsocData = kIOUSBEndpointDescriptorUsageTypeIsocData, kEndpointDescriptorUsageTypeIsocFeedback = kIOUSBEndpointDescriptorUsageTypeIsocFeedback, kEndpointDescriptorUsageTypeIsocImplicit = kIOUSBEndpointDescriptorUsageTypeIsocImplicit, kEndpointDescriptorUsageTypeIsocReserved = kIOUSBEndpointDescriptorUsageTypeIsocReserved, kEndpointDescriptorPacketSize = kIOUSBEndpointDescriptorPacketSize, kEndpointDescriptorPacketSizePhase = kIOUSBEndpointDescriptorPacketSizePhase, kEndpointDescriptorPacketSizeMult = kIOUSBEndpointDescriptorPacketSizeMult, kEndpointDescriptorPacketSizeMultPhase = kIOUSBEndpointDescriptorPacketSizeMultPhase, kEndpointDescriptorReserved = kIOUSBEndpointDescriptorReserved, kEndpointDescriptorReservedPhase = kIOUSBEndpointDescriptorReservedPhase }; // USB Language Identifiers 1.0 enum tLanguageID { kLanguageIDEnglishUS = kIOUSBLanguageIDEnglishUS }; typedef enum tLanguageID tLanguageID; #ifdef __cplusplus // USB 2.0 9.6.7: String struct StringDescriptor : public Descriptor { #else struct StringDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bString[1]; } __attribute__((packed)); typedef struct StringDescriptor StringDescriptor; enum tDeviceCapabilityType { // USB 3.0 Table 9-13 kDeviceCapabilityTypeWireless = kIOUSBDeviceCapabilityTypeWireless, kDeviceCapabilityTypeUSB20Extension = kIOUSBDeviceCapabilityTypeUSB20Extension, kDeviceCapabilityTypeSuperSpeed = kIOUSBDeviceCapabilityTypeSuperSpeed, kDeviceCapabilityTypeContainerID = kIOUSBDeviceCapabilityTypeContainerID, // USB 3.1 Table 9-14 kDeviceCapabilityTypePlatform = kIOUSBDeviceCapabilityTypePlatform, kDeviceCapabilityTypePowerDelivery = kIOUSBDeviceCapabilityTypePowerDelivery, kDeviceCapabilityTypeBatteryInfo = kIOUSBDeviceCapabilityTypeBatteryInfo, kDeviceCapabilityTypePdConsumerPort = kIOUSBDeviceCapabilityTypePdConsumerPort, kDeviceCapabilityTypePdProviderPort = kIOUSBDeviceCapabilityTypePdProviderPort, kDeviceCapabilityTypeSuperSpeedPlus = kIOUSBDeviceCapabilityTypeSuperSpeedPlus, kDeviceCapabilityTypePrecisionMeasurement = kIOUSBDeviceCapabilityTypePrecisionMeasurement, kDeviceCapabilityTypeWirelessExt = kIOUSBDeviceCapabilityTypeWirelessExt, kDeviceCapabilityTypeBillboard = kIOUSBDeviceCapabilityTypeBillboard, kDeviceCapabilityTypeBillboardAltMode = kIOUSBDeviceCapabilityTypeBillboardAltMode }; typedef enum tDeviceCapabilityType tDeviceCapabilityType; #ifdef __cplusplus // USB 3.0 9.6.2: Binary Device Object Store (BOS) struct BOSDescriptor : public Descriptor { #else struct BOSDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint16_t wTotalLength; uint8_t bNumDeviceCaps; } __attribute__((packed)); typedef struct BOSDescriptor BOSDescriptor; #ifdef __cplusplus // USB 3.0 9.6.2: Binary Device Object Store (BOS) struct DeviceCapabilityDescriptor : public Descriptor { #else struct DeviceCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bDevCapabilityType; } __attribute__((packed)); typedef struct DeviceCapabilityDescriptor DeviceCapabilityDescriptor; #ifdef __cplusplus // USB 3.0 9.6.2.1: USB 2.0 Extension struct USB20ExtensionCapabilityDescriptor : public DeviceCapabilityDescriptor { #else struct USB20ExtensionCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; #endif uint32_t bmAttributes; } __attribute__((packed)); typedef struct USB20ExtensionCapabilityDescriptor USB20ExtensionCapabilityDescriptor; enum { kUSB20ExtensionCapabilityLPM = kIOUSBUSB20ExtensionCapabilityLPM, // From USB 2.0 ECN Errata for Link Power Management. kUSB20ExtensionCapabilityBESLSupport = kIOUSBUSB20ExtensionCapabilityBESLSupport, kUSB20ExtensionCapabilityBESLValid = kIOUSBUSB20ExtensionCapabilityBESLValid, kUSB20ExtensionCapabilityBESLDValid = kIOUSBUSB20ExtensionCapabilityBESLDValid, kUSB20ExtensionCapabilityBESL = kIOUSBUSB20ExtensionCapabilityBESL, kUSB20ExtensionCapabilityBESLPhase = kIOUSBUSB20ExtensionCapabilityBESLPhase, kUSB20ExtensionCapabilityBESLD = kIOUSBUSB20ExtensionCapabilityBESLD, kUSB20ExtensionCapabilityBESLDPhase = kIOUSBUSB20ExtensionCapabilityBESLDPhase }; #ifdef __cplusplus // USB 3.0 9.6.2.2: SuperSpeed USB Device Capability struct SuperSpeedUSBDeviceCapabilityDescriptor : public DeviceCapabilityDescriptor { #else struct SuperSpeedUSBDeviceCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; #endif uint8_t bmAttributes; uint16_t wSpeedsSupported; uint8_t bFunctionalitySupport; uint8_t bU1DevExitLat; uint16_t bU2DevExitLat; } __attribute__((packed)); typedef struct SuperSpeedUSBDeviceCapabilityDescriptor SuperSpeedUSBDeviceCapabilityDescriptor; enum { kSuperSpeedDeviceCapabilityLTM = kIOUSBSuperSpeedDeviceCapabilityLTM, kSuperSpeedDeviceCapabilityLowSpeed = kIOUSBSuperSpeedDeviceCapabilityLowSpeed, kSuperSpeedDeviceCapabilityFullSpeed = kIOUSBSuperSpeedDeviceCapabilityFullSpeed, kSuperSpeedDeviceCapabilityHighSpeed = kIOUSBSuperSpeedDeviceCapabilityHighSpeed, kSuperSpeedDeviceCapability5Gb = kIOUSBSuperSpeedDeviceCapability5Gb, kSuperSpeedDeviceCapabilitySupportLowSpeed = kIOUSBSuperSpeedDeviceCapabilitySupportLowSpeed, kSuperSpeedDeviceCapabilitySupportFullSpeed = kIOUSBSuperSpeedDeviceCapabilitySupportFullSpeed, kSuperSpeedDeviceCapabilitySupportHighSpeed = kIOUSBSuperSpeedDeviceCapabilitySupportHighSpeed, kSuperSpeedDeviceCapabilitySupport5Gb = kIOUSBSuperSpeedDeviceCapabilitySupport5Gb, kSuperSpeedDeviceCapabilityU1DevExitLatMax = kIOUSBSuperSpeedDeviceCapabilityU1DevExitLatMax, kSuperSpeedDeviceCapabilityU2DevExitLatMax = kIOUSBSuperSpeedDeviceCapabilityU2DevExitLatMax }; #ifdef __cplusplus // USB 3.1 9.6.2.5: SuperSpeedPlus USB Device Capability struct SuperSpeedPlusUSBDeviceCapabilityDescriptor : public DeviceCapabilityDescriptor { #else struct SuperSpeedPlusUSBDeviceCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; #endif uint8_t bReserved; uint32_t bmAttributes; uint16_t wFunctionalitySupport; uint16_t wReserved; uint32_t bmSublinkSpeedAttr[]; } __attribute__((packed)); typedef struct SuperSpeedPlusUSBDeviceCapabilityDescriptor SuperSpeedPlusUSBDeviceCapabilityDescriptor; enum { //bmAttributes kSuperSpeedPlusDeviceCapabilitySublinkSpeedAttrCount = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedAttrCount, kSuperSpeedPlusDeviceCapabilitySublinkSpeedAttrCountPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedAttrCountPhase, kSuperSpeedPlusDeviceCapabilitySublinkSpeedIdCount = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedIdCount, kSuperSpeedPlusDeviceCapabilitySublinkSpeedIdCountPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedIdCountPhase, //wFunctionalitySupport kSuperSpeedPlusDeviceCapabilitySublinkMinSpeedId = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkMinSpeedId, kSuperSpeedPlusDeviceCapabilitySublinkMinSpeedIdPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkMinSpeedIdPhase, kSuperSpeedPlusDeviceCapabilityReserved = kIOUSBSuperSpeedPlusDeviceCapabilityReserved, kSuperSpeedPlusDeviceCapabilityReservedPhase = kIOUSBSuperSpeedPlusDeviceCapabilityReservedPhase, kSuperSpeedPlusDeviceCapabilityMinRxLaneCount = kIOUSBSuperSpeedPlusDeviceCapabilityMinRxLaneCount, kSuperSpeedPlusDeviceCapabilityMinRxLaneCountPhase = kIOUSBSuperSpeedPlusDeviceCapabilityMinRxLaneCountPhase, kSuperSpeedPlusDeviceCapabilityMinTxLaneCount = kIOUSBSuperSpeedPlusDeviceCapabilityMinTxLaneCount, kSuperSpeedPlusDeviceCapabilityMinTxLaneCountPhase = kIOUSBSuperSpeedPlusDeviceCapabilityMinTxLaneCountPhase, //bmSublinkSpeedAttr kSuperSpeedPlusDeviceCapabilitySublinkSpeedId = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedId, kSuperSpeedPlusDeviceCapabilitySublinkSpeedIdPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedIdPhase, kSuperSpeedPlusDeviceCapabilitySublinkLSE = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSE, kSuperSpeedPlusDeviceCapabilitySublinkLSEPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEPhase, kSuperSpeedPlusDeviceCapabilitySublinkLSEBits = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEBits, kSuperSpeedPlusDeviceCapabilitySublinkLSEKbits = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEKbits, kSuperSpeedPlusDeviceCapabilitySublinkLSEMbits = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEMbits, kSuperSpeedPlusDeviceCapabilitySublinkLSEGbits = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEGbits, kSuperSpeedPlusDeviceCapabilitySublinkType = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkType, kSuperSpeedPlusDeviceCapabilitySublinkTypePhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkTypePhase, kSuperSpeedPlusDeviceCapabilitySublinkSymmetry = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetry, kSuperSpeedPlusDeviceCapabilitySublinkSymmetryPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetryPhase, kSuperSpeedPlusDeviceCapabilitySublinkSymmetric = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetric, kSuperSpeedPlusDeviceCapabilitySublinkAsymmetric = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkAsymmetric, kSuperSpeedPlusDeviceCapabilitySublinkDirection = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirection, kSuperSpeedPlusDeviceCapabilitySublinkDirectionPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionPhase, kSuperSpeedPlusDeviceCapabilitySublinkDirectionRx = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionRx, kSuperSpeedPlusDeviceCapabilitySublinkDirectionTx = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionTx, kSuperSpeedPlusDeviceCapabilitySublinkReserved = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkReserved, kSuperSpeedPlusDeviceCapabilitySublinkReservedPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkReservedPhase, kSuperSpeedPlusDeviceCapabilitySublinkProtocol = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkProtocol, kSuperSpeedPlusDeviceCapabilitySublinkProtocolPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkProtocolPhase, kSuperSpeedPlusDeviceCapabilitySublinkSpeedMantissa = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedMantissa, kSuperSpeedPlusDeviceCapabilitySublinkSpeedMantissaPhase = kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedMantissaPhase, }; #ifdef __cplusplus // USB 3.0 9.6.2.3: Container ID struct ContainerIDCapabilityDescriptor : public DeviceCapabilityDescriptor { #else struct ContainerIDCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; #endif uint8_t bReserved; uint32_t containerID[4]; } __attribute__((packed)); typedef struct ContainerIDCapabilityDescriptor ContainerIDCapabilityDescriptor; #ifdef __cplusplus // USB 3.1 9.6.2.4: Platform Descriptor struct PlatformCapabilityDescriptor : public DeviceCapabilityDescriptor { #else struct PlatformCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; #endif uint8_t bReserved; uuid_t uuidPlatformCapability; }__attribute__((packed)); typedef struct PlatformCapabilityDescriptor PlatformCapabilityDescriptor; // USB Billboard 3.1.6.2: Billboard Capability Descriptor V1.2 struct BillboardAltModeCapabilityCompatibility { uint16_t wSVID; uint32_t dwAlternateMode; uint8_t iAlternateModeString; }__attribute__((packed)); typedef struct BillboardAltModeCapabilityCompatibility BillboardAltModeCapabilityCompatibility; // USB Billboard 3.1.6.2: Billboard Capability Descriptor V1.1 and 1.21+ struct BillboardAltModeCapability { uint16_t wSVID; uint8_t bAlternateMode; uint8_t iAlternateModeString; }__attribute__((packed)); typedef struct BillboardAltModeCapability BillboardAltModeCapability; #ifdef __cplusplus // USB Billboard 3.1.6.2: Billboard Capability Descriptor struct BillboardCapabilityDescriptor : public DeviceCapabilityDescriptor { #else struct BillboardCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; #endif uint8_t iAddtionalInfoURL; uint8_t bNumberOfAlternateModes; uint8_t bPreferredAlternateMode; uint16_t VCONNPower; uint8_t bmConfigured[32]; uint16_t bcdVersion; uint8_t bAdditonalFailureInfo; uint8_t bReserved; uint8_t altModeCapabilities[]; }__attribute__((packed)); typedef struct BillboardCapabilityDescriptor BillboardCapabilityDescriptor; #ifdef __cplusplus // USB Billboard 3.1.6.3: Billboard Capability Descriptor V1.21 struct BillboardAltModeCapabilityDescriptor : public DeviceCapabilityDescriptor { #else struct BillboardAltModeCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; #endif uint8_t bIndex; uint16_t dwAlternateModeVdo; }__attribute__((packed)); typedef struct BillboardAltModeCapabilityDescriptor BillboardAltModeCapabilityDescriptor; #ifdef __cplusplus // USB 3.0 9.6.4: Interface Association struct InterfaceAssociationDescriptor: public Descriptor { #else struct InterfaceAssociationDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bFirstInterface; uint8_t bInterfaceCount; uint8_t bFunctionClass; uint8_t bFunctionSubClass; uint8_t bFunctionProtocol; uint8_t iFunction; } __attribute__((packed)); typedef struct InterfaceAssociationDescriptor InterfaceAssociationDescriptor; #ifdef __cplusplus // USB 3.1 9.6.7: SuperSpeed Endpoint Companion struct SuperSpeedEndpointCompanionDescriptor : public Descriptor { #else struct SuperSpeedEndpointCompanionDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bMaxBurst; uint8_t bmAttributes; uint16_t wBytesPerInterval; } __attribute__((packed)); typedef struct SuperSpeedEndpointCompanionDescriptor SuperSpeedEndpointCompanionDescriptor; enum { kSuperSpeedEndpointCompanionDescriptorMaxBurst = kIOUSBSuperSpeedEndpointCompanionDescriptorMaxBurst, kSuperSpeedEndpointCompanionDescriptorMaxBurstPhase = kIOUSBSuperSpeedEndpointCompanionDescriptorMaxBurstPhase, kSuperSpeedEndpointCompanionDescriptorBulkMaxStreams = kIOUSBSuperSpeedEndpointCompanionDescriptorBulkMaxStreams, kSuperSpeedEndpointCompanionDescriptorBulkMaxStreamsPhase = kIOUSBSuperSpeedEndpointCompanionDescriptorBulkMaxStreamsPhase, kSuperSpeedEndpointCompanionDescriptorBulkReserved = kIOUSBSuperSpeedEndpointCompanionDescriptorBulkReserved, kSuperSpeedEndpointCompanionDescriptorBulkReservedPhase = kIOUSBSuperSpeedEndpointCompanionDescriptorBulkReservedPhase, kSuperSpeedEndpointCompanionDescriptorIsocMult = kIOUSBSuperSpeedEndpointCompanionDescriptorIsocMult, kSuperSpeedEndpointCompanionDescriptorIsocMultPhase = kIOUSBSuperSpeedEndpointCompanionDescriptorIsocMultPhase, kSuperSpeedEndpointCompanionDescriptorIsocReserved = kIOUSBSuperSpeedEndpointCompanionDescriptorIsocReserved, kSuperSpeedEndpointCompanionDescriptorIsocReservedPhase = kIOUSBSuperSpeedEndpointCompanionDescriptorIsocReservedPhase, kSuperSpeedEndpointCompanionDescriptorSSPIsocCompanion = kIOUSBSuperSpeedEndpointCompanionDescriptorSSPIsocCompanion }; #ifdef __cplusplus // USB 3.1 9.6.8: SuperSpeedPlus Isochronous Endpoint Companion struct SuperSpeedPlusIsochronousEndpointCompanionDescriptor : public Descriptor { #else struct SuperSpeedPlusIsochronousEndpointCompanionDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint16_t wReserved; uint32_t dwBytesPerInterval; } __attribute__((packed)); typedef struct SuperSpeedPlusIsochronousEndpointCompanionDescriptor SuperSpeedPlusIsochronousEndpointCompanionDescriptor; #ifdef __cplusplus // USB 2.0 11.23.2.1: Hub Descriptor struct HubDescriptor : public Descriptor { #else struct HubDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bNumberPorts; uint16_t wHubCharacteristics; uint8_t bPowerOnToPowerGood; uint8_t bHubControllerCurrent; uint8_t deviceRemovable[2]; // Technically variable size uint8_t reserved[2]; // Unused } __attribute__((packed)); typedef struct HubDescriptor HubDescriptor; #ifdef __cplusplus // USB 3.0 10.13.2.1: SuperSpeed Hub Descriptor struct SuperSpeedHubDescriptor : public Descriptor { #else struct SuperSpeedHubDescriptor { uint8_t bLength; uint8_t bDescriptorType; #endif uint8_t bNumberPorts; uint16_t wHubCharacteristics; uint8_t bPowerOnToPowerGood; uint8_t bHubControllerCurrent; uint8_t bHubDecodeLatency; uint16_t wHubDelay; uint16_t deviceRemovable; } __attribute__((packed)); typedef struct SuperSpeedHubDescriptor SuperSpeedHubDescriptor; enum { kSuperSpeedHubCharacteristicsPowerSwitchingMask = kIOUSBSuperSpeedHubCharacteristicsPowerSwitchingMask, kSuperSpeedHubCharacteristicsPowerSwitchingGanged = kIOUSBSuperSpeedHubCharacteristicsPowerSwitchingGanged, kSuperSpeedHubCharacteristicsPowerSwitchingIndividual = kIOUSBSuperSpeedHubCharacteristicsPowerSwitchingIndividual, kSuperSpeedHubCharacteristicsCompoundDevice = kIOUSBSuperSpeedHubCharacteristicsCompoundDevice, kSuperSpeedHubCharacteristicsOverCurrentMask = kIOUSBSuperSpeedHubCharacteristicsOverCurrentMask, kSuperSpeedHubCharacteristicsOverCurrentGlobal = kIOUSBSuperSpeedHubCharacteristicsOverCurrentGlobal, kSuperSpeedHubCharacteristicsOverCurrentIndividual = kIOUSBSuperSpeedHubCharacteristicsOverCurrentIndividual, kSuperSpeedHubCharacteristicsReserved = kIOUSBSuperSpeedHubCharacteristicsReserved, kSuperSpeedHubDecodeLatencyMax = kIOUSBSuperSpeedHubDecodeLatencyMax, kSuperSpeedHubDelayMax = kIOUSBSuperSpeedHubDelayMax }; #if defined(__cplusplus) && KERNEL #pragma mark Descriptor list parsing /*! * @brief Get the next descriptor in a configuration descriptor * @discussion This method will advance currentDescriptor by its bLength, and validate that the new descriptor fits withing the bounds of configurationDescriptor. Using NULL for currentDescriptor will return the first descriptor after the configuration descriptor. * @param configurationDescriptor Configuration descriptor that contains the descriptors to iterate through * @param currentDescriptor A descriptor pointer within the bounds of configurationDescriptor, or NULL * @return Descriptor pointer, or NULL if no descriptor can be returned */ const Descriptor* getNextDescriptor(const ConfigurationDescriptor* configurationDescriptor, const Descriptor* currentDescriptor); /*! * @brief Find the next descriptor matching a given type within a configuration descriptor * @discussion This method uses getNextDescriptor, and further validates that the returned descriptor's bDescriptorType field matches the type parameter. * @param configurationDescriptor Configuration descriptor that contains the descriptors to iterate through * @param currentDescriptor A descriptor pointer within the bounds of configurationDescriptor, or NULL * @param type tDescriptorType representing the descriptor type to find * @return Descriptor pointer, or NULL if no matching descriptor can be found */ const Descriptor* getNextDescriptorWithType(const ConfigurationDescriptor* configurationDescriptor, const Descriptor* currentDescriptor, const uint8_t type); /*! * @brief Get the next descriptor in a configuration descriptor that belongs to another container descriptor * @discussion This method uses getNextDescriptor, but will return NULL if another descriptor is found whose bDescriptorType field matches the value used for parentDescriptor's bDescriptorType. Using NULL for currentDescriptor will return the first descriptor after parentDescriptor. * @param configurationDescriptor Configuration descriptor that contains the descriptors to iterate through * @param parentDescriptor A descriptor pointer within the bounds of configurationDescriptor * @param currentDescriptor A descriptor pointer within the bounds of configurationDescriptor, or NULL * @return Descriptor pointer, or NULL if no descriptor can be returned */ const Descriptor* getNextAssociatedDescriptor(const ConfigurationDescriptor* configurationDescriptor, const Descriptor* parentDescriptor, const Descriptor* currentDescriptor); /*! * @brief Find the next descriptor matching a given type within a configuration descriptor that belongs to another container descriptor * @discussion This method uses getNextAssociatedDescriptor, and further validates that the returned descriptor's bDescriptorType field matches the type passed parameter. * @param configurationDescriptor Configuration descriptor that contains the descriptors to iterate through * @param parentDescriptor A descriptor pointer within the bounds of configurationDescriptor * @param currentDescriptor A descriptor pointer within the bounds of configurationDescriptor, or NULL * @param type tDescriptorType representing the descriptor type to find * @return Descriptor pointer, or NULL if no matching descriptor can be found */ const Descriptor* getNextAssociatedDescriptorWithType(const ConfigurationDescriptor* configurationDescriptor, const Descriptor* parentDescriptor, const Descriptor* currentDescriptor, const uint8_t type); /*! * @brief Find the next interface association descriptor in a configuration descriptor * @discussion This method uses getNextDescriptorWithType to fetch the next interface association descriptor * @param configurationDescriptor Configuration descriptor that contains the descriptors to iterate through * @param currentDescriptor A descriptor pointer within the bounds of configurationDescriptor, or NULL * @return InterfaceAssociationDescriptor pointer, or NULL if no matching descriptor can be found */ const InterfaceAssociationDescriptor* getNextInterfaceAssociationDescriptor(const ConfigurationDescriptor* configurationDescriptor, const Descriptor* currentDescriptor); /*! * @brief Find the next interface descriptor in a configuration descriptor * @discussion This method uses getNextDescriptorWithType to fetch the next interface descriptor * @param configurationDescriptor Configuration descriptor that contains the descriptors to iterate through * @param currentDescriptor A descriptor pointer within the bounds of configurationDescriptor, or NULL * @return InterfaceDescriptor pointer, or NULL if no matching descriptor can be found */ const InterfaceDescriptor* getNextInterfaceDescriptor(const ConfigurationDescriptor* configurationDescriptor, const Descriptor* currentDescriptor); /*! * @brief Find the next endpoint descriptor associated with an interface descriptor * @discussion This method uses getNextAssociatedDescriptorWithType to fetch the next endpoint descriptor associated with a specific interface descriptor * @param configurationDescriptor Configuration descriptor that contains the descriptors to iterate through * @param interfaceDescriptor An interface descriptor within the bounds of configurationDescriptor * @param currentDescriptor A descriptor pointer within the bounds of configurationDescriptor, or NULL * @return EndpointDescriptor pointer, or NULL if no matching descriptor can be found */ const EndpointDescriptor* getNextEndpointDescriptor(const ConfigurationDescriptor* configurationDescriptor, const InterfaceDescriptor* interfaceDescriptor, const Descriptor* currentDescriptor); /*! * @brief Get the next device capability descriptor in a BOS descriptor * @discussion This method will advance currentDescriptor by its bLength, and validate that the new descriptor fits withing the bounds of bosDescriptor. Using NULL for currentDescriptor will return the first descriptor after the BOS descriptor. * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @param currentDescriptor A descriptor pointer within the bounds of bosDescriptor, or NULL * @return DeviceCapabilityDescriptor pointer, or NULL if no descriptor can be returned */ const DeviceCapabilityDescriptor* getNextCapabilityDescriptor(const BOSDescriptor* bosDescriptor, const DeviceCapabilityDescriptor* currentDescriptor); /*! * @brief Find the next descriptor matching a given type within a BOS descriptor * @discussion This method uses getNextCapabilityDescriptor, and further validates that the returned descriptor's bDevCapabilityType field matches the type parameter. * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @param currentDescriptor A descriptor pointer within the bounds of bosDescriptor, or NULL * @param type tDeviceCapabilityType representing the descriptor type to find * @return DeviceCapabilityDescriptor pointer, or NULL if no matching descriptor can be found */ const DeviceCapabilityDescriptor* getNextCapabilityDescriptorWithType(const BOSDescriptor* bosDescriptor, const DeviceCapabilityDescriptor* currentDescriptor, const uint8_t type); /*! * @brief Find the first USB20ExtensionCapabilityDescriptor in a BOS descriptor * @discussion This method uses getNextCapabilityDescriptorWithType to fetch the first USB20ExtensionCapabilityDescriptor * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @return USB20ExtensionCapabilityDescriptor pointer, or NULL if no matching descriptor can be found */ const USB20ExtensionCapabilityDescriptor* getUSB20ExtensionDeviceCapabilityDescriptor(const BOSDescriptor* bosDescriptor); /*! * @brief Find the first SuperSpeedUSBDeviceCapabilityDescriptor in a BOS descriptor * @discussion This method uses getNextCapabilityDescriptorWithType to fetch the first SuperSpeedUSBDeviceCapabilityDescriptor * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @return SuperSpeedUSBDeviceCapabilityDescriptor pointer, or NULL if no matching descriptor can be found */ const SuperSpeedUSBDeviceCapabilityDescriptor* getSuperSpeedDeviceCapabilityDescriptor(const BOSDescriptor* bosDescriptor); /*! * @brief Find the first SuperSpeedPlusUSBDeviceCapabilityDescriptor in a BOS descriptor * @discussion This method uses getNextCapabilityDescriptorWithType to fetch the first SuperSpeedPlusUSBDeviceCapabilityDescriptor * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @return SuperSpeedPlusUSBDeviceCapabilityDescriptor pointer, or NULL if no matching descriptor can be found */ const SuperSpeedPlusUSBDeviceCapabilityDescriptor* getSuperSpeedPlusDeviceCapabilityDescriptor(const BOSDescriptor* bosDescriptor); /*! * @brief Find the first ContainerIDCapabilityDescriptor in a BOS descriptor * @discussion This method uses getNextCapabilityDescriptorWithType to fetch the first ContainerIDCapabilityDescriptor * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @return ContainerIDCapabilityDescriptor pointer, or NULL if no matching descriptor can be found */ const ContainerIDCapabilityDescriptor* getContainerIDDescriptor(const BOSDescriptor* bosDescriptor); /*! * @brief Find the first PlatformCapabilityDescriptor in a BOS descriptor * @discussion This method uses getNextCapabilityDescriptorWithType to fetch the first PlatformCapabilityDescriptor * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @return PlatformCapabilityDescriptor pointer, or NULL if no matching descriptor can be found */ const PlatformCapabilityDescriptor* getPlatformCapabilityDescriptor(const BOSDescriptor* bosDescriptor); /*! * @brief Find the first BillboardCapabilityDescriptor in a BOS descriptor * @discussion This method uses getNextCapabilityDescriptorWithType to fetch the first BillboardCapabilityDescriptor * @param bosDescriptor BOS descriptor that contains the descriptors to iterate through * @return BillboardCapabilityDescriptor pointer, or NULL if no matching descriptor can be found */ const BillboardCapabilityDescriptor* getBillboardDescriptor(const BOSDescriptor* bosDescriptor); #pragma mark Device descriptor parsing /*! * @brief Validate the contents of a device descriptor * @discussion This method parses a device descriptor and validates its contents. If repairable validation errors are encountered, the descriptor passed in may be modified. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The descriptor to validate * @return bool true if the descriptor passed validation, false if it did not */ bool validateDeviceDescriptor(uint32_t usbDeviceSpeed, const DeviceDescriptor* descriptor); #pragma mark Endpoint descriptor parsing /*! * @brief Extract the direction of an endpoint from an endpoint descriptor * @discussion This method parses an endpoint descriptor to determine its transfer direction * @param descriptor The descriptor to parse * @return tEndpointDirection indicating the direction found. Control endpoints return tEndpointDirection. */ uint8_t getEndpointDirection(const EndpointDescriptor* descriptor); /*! * @brief Extract the direction and number of an endpoint from an endpoint descriptor * @discussion This method parses an endpoint descriptor to determine its address * @param descriptor The descriptor to parse * @return uint8_t representing direction and endpoint number */ uint8_t getEndpointAddress(const EndpointDescriptor* descriptor); /*! * @brief Extract the number of an endpoint from an endpoint descriptor * @discussion This method parses an endpoint descriptor to determine its number, excluding direction * @param descriptor The descriptor to parse * @return uint8_t representing endpoint number */ uint8_t getEndpointNumber(const EndpointDescriptor* descriptor); /*! * @brief Extract the type of an endpoint from an endpoint descriptor * @discussion This method parses an endpoint descriptor to determine its type * @param descriptor The descriptor to parse * @return tEndpointType indicating the type found. */ uint8_t getEndpointType(const EndpointDescriptor* descriptor); /*! * @brief Validate the max packet size of an endpoint descriptor * @discussion This method parses an endpoint descriptor and validates the max packet size. If repairable validation errors are encountered, the descriptor passed in may be modified. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The descriptor to validate * @return bool true if the descriptor passed validation, false if it did not */ bool validateEndpointMaxPacketSize(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor); /*! * @brief Extract the max packet size from an endpoint descriptor * @discussion This method parses an endpoint descriptor to determine its max packet size, which does not take into account mult or burst factors. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The descriptor to parse * @return uint16_t The max packet size in bytes */ uint16_t getEndpointMaxPacketSize(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor); /*! * @brief Validate the burst size of endpoint descriptors * @discussion This method parses endpoint descriptors and validates the burst size. If repairable validation errors are encountered, the descriptors passed in may be modified. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to validate * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to validate, or NULL * @return bool true if the descriptor passed validation, false if it did not */ bool validateEndpointBurstSize(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor); /*! * @brief Validate the burst size of endpoint descriptors * @discussion This method parses endpoint descriptors and validates the burst size. If repairable validation errors are encountered, the descriptors passed in may be modified. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to validate * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to validate, or NULL * @param sspCompanionDescriptor The SuperSpeedPlusIsochronousEndpointCompanionDescriptor to validate, or NULL * @return bool true if the descriptor passed validation, false if it did not */ bool validateEndpointBurstSize(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor, const SuperSpeedPlusIsochronousEndpointCompanionDescriptor* sspCompanionDescriptor); /*! * @brief Extract the burst size from endpoint descriptors * @discussion This method parses endpoint descriptors to determine burst size, which includes mult and burst factors as applicable. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to parse, or NULL * @return uint16_t The burst size in bytes */ uint16_t getEndpointBurstSize(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor); /*! * @brief Extract the burst size from endpoint descriptors * @discussion This method parses endpoint descriptors to determine burst size, which includes mult and burst factors as applicable. SuperSpeed Plus isochronous endpoints will return the dwBytesPerInterval field from the SuperSpeedPlusIsochronousEndpointCompanionDescriptor parameter. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to parse, or NULL * @param sspCompanionDescriptor The SuperSpeedPlusIsochronousEndpointCompanionDescriptor to parse, or NULL * @return uint32_t The burst size in bytes */ uint32_t getEndpointBurstSize32(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor = NULL, const SuperSpeedPlusIsochronousEndpointCompanionDescriptor* sspCompanionDescriptor = NULL); /*! * @brief Extract the mult count from endpoint descriptors * @discussion This method parses endpoint descriptors to determine mult * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to parse, or NULL * @param sspCompanionDescriptor The SuperSpeedPlusIsochronousEndpointCompanionDescriptor to parse, or NULL * @return uint8_t The mult count */ uint8_t getEndpointMult(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor = NULL, const SuperSpeedPlusIsochronousEndpointCompanionDescriptor* sspCompanionDescriptor = NULL); /*! * @brief Validate the interval of an endpoint descriptor * @discussion This method parses an endpoint descriptor and validates the interval. If repairable validation errors are encountered, the descriptor passed in may be modified. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to validate * @return bool true if the descriptor passed validation, false if it did not */ bool validateEndpointInterval(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor); /*! * @brief Extract the interval of an endpoint descriptor * @discussion This method parses an endpoint descriptor and returns the service interval as n in (2^(n-1)) microframes * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @return uint32_t Encoded endpoint interval */ uint32_t getEndpointIntervalEncodedMicroframes(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor); /*! * @brief Extract the interval of an endpoint descriptor * @discussion This method parses an endpoint descriptor and returns the service interval in microframes * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @return uint32_t Endpoint interval in microframes */ uint32_t getEndpointIntervalMicroframes(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor); /*! * @brief Extract the interval of an endpoint descriptor * @discussion This method parses an endpoint descriptor and returns the service interval in frames * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @return uint32_t Endpoint interval in frames */ uint32_t getEndpointIntervalFrames(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor); /*! * @brief Extract the number of streams supported by an endpoint * @discussion This method parses endpoint descriptors and returns the number of streams supported as n in (2^n) * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to parse * @return uint32_t Encoded number of streams */ uint32_t getEndpointMaxStreamsEncoded(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor); /*! * @brief Extract the number of streams supported by an endpoint * @discussion This method parses endpoint descriptors and returns the number of streams supported * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to parse * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to parse * @return uint32_t Number of streams */ uint32_t getEndpointMaxStreams(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor); /*! * @brief Extract the maximum bus current required by a configuration descriptor * @discussion This method parses a configuration descriptor and returns the number of milliamps required to power the device * @param usbDeviceSpeed The operational speed of the device * @param descriptor The ConfigurationDescriptor to parse * @return uint32_t milliamps required */ uint32_t getConfigurationMaxPowerMilliAmps(uint32_t usbDeviceSpeed, const ConfigurationDescriptor* descriptor); /*! * @brief Validate the contents of an endpoint descriptor * @discussion This method parses an endpoint descriptor and validates its contents. If repairable validation errors are encountered, the descriptor passed in may be modified. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to validate * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to validate, or NULL * @return bool true if the descriptor passed validation, false if it did not */ bool validateEndpointDescriptor(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor); /*! * @brief Validate the contents of an endpoint descriptor * @discussion This method parses an endpoint descriptor and validates its contents. If repairable validation errors are encountered, the descriptor passed in may be modified. * @param usbDeviceSpeed The operational speed of the device * @param descriptor The EndpointDescriptor to validate * @param companionDescriptor The SuperSpeedEndpointCompanionDescriptor to validate, or NULL * @param sspCompanionDescriptor The SuperSpeedPlusIsochronousEndpointCompanionDescriptor to validate, or NULL * @return bool true if the descriptor passed validation, false if it did not */ bool validateEndpointDescriptor(uint32_t usbDeviceSpeed, const EndpointDescriptor* descriptor, const SuperSpeedEndpointCompanionDescriptor* companionDescriptor, const SuperSpeedPlusIsochronousEndpointCompanionDescriptor* sspCompanionDescriptor); #pragma mark String descriptor parsing /*! * @brief Convert a USB string descriptor to a UTF8 character string * @discussion This method uses utf8_encodestr with appropriate options to convert a USB string descriptor to a UTF8 string. * @param stringDescriptor Descriptor to convert * @param stringBuffer Buffer to write the UTF8 string to * @param length Reference to size_t. As input it is the size stringBuffer. As output it is the number of character written to stringBuffer. * @return IOReturn result code. kIOReturnSuccess if any portion of the string could be converted and placed in stringBuffer. kIOReturnError if the string descriptor cannot be converted to UTF8. */ IOReturn stringDescriptorToUTF8(const StringDescriptor* stringDescriptor, char* stringBuffer, size_t& length); #pragma mark Capability descriptor parsing /*! * @brief Validate the contents of a BOS descriptor * @discussion This method parses a BOS descriptor and validates its contents, as well as the contents of its associated device capability descriptors. If repairable validation errors are encountered, the descriptor passed in may be modified. * @param bosDescriptor The BOSDescriptor to validate * @return bool true if the descriptor passed validation, false if it did not */ bool validateDeviceCapabilityDescriptors(const BOSDescriptor* bosDescriptor); #endif // __cplusplus #pragma mark Device requests // USB 2.0 9.3: USB Device Requests struct DeviceRequest { uint8_t bmRequestType; uint8_t bRequest; uint16_t wValue; uint16_t wIndex; uint16_t wLength; } __attribute__((packed)); typedef struct DeviceRequest DeviceRequest; // USB 3.0 9.4.12: Set SEL Standard Device Request struct DeviceRequestSetSELData { uint8_t u1Sel; // Time in μs for U1 System Exit Latency uint8_t u1Pel; // Time in μs for U1 Device to Host Exit Latency uint16_t u2Sel; // Time in μs for U2 System Exit Latency uint16_t u2Pel; // Time in μs for U2 Device to Host Exit Latency } __attribute__((packed)); typedef struct DeviceRequestSetSELData DeviceRequestSetSELData; enum { kDeviceRequestSize = kIOUSBDeviceRequestSize, kDeviceRequestDirectionMask = kIOUSBDeviceRequestDirectionMask, kDeviceRequestDirectionPhase = kIOUSBDeviceRequestDirectionPhase, kDeviceRequestDirectionOut = kIOUSBDeviceRequestDirectionOut, kDeviceRequestDirectionIn = kIOUSBDeviceRequestDirectionIn, kDeviceRequestTypeMask = kIOUSBDeviceRequestTypeMask, kDeviceRequestTypePhase = kIOUSBDeviceRequestTypePhase, kDeviceRequestTypeStandard = kIOUSBDeviceRequestTypeStandard, kDeviceRequestTypeClass = kIOUSBDeviceRequestTypeClass, kDeviceRequestTypeVendor = kIOUSBDeviceRequestTypeVendor, kDeviceRequestRecipientMask = kIOUSBDeviceRequestRecipientMask, kDeviceRequestRecipientPhase = kIOUSBDeviceRequestRecipientPhase, kDeviceRequestRecipientDevice = kIOUSBDeviceRequestRecipientDevice, kDeviceRequestRecipientInterface= kIOUSBDeviceRequestRecipientInterface, kDeviceRequestRecipientEndpoint = kIOUSBDeviceRequestRecipientEndpoint, kDeviceRequestRecipientOther = kIOUSBDeviceRequestRecipientOther, }; // USB 2.0 9.4: Standard Device Requests // USB 3.0 9.4: Standard Device Requests enum { kDeviceRequestGetStatus = kIOUSBDeviceRequestGetStatus, kDeviceRequestClearFeature = kIOUSBDeviceRequestClearFeature, kDeviceRequestGetState = kIOUSBDeviceRequestGetState, kDeviceRequestSetFeature = kIOUSBDeviceRequestSetFeature, kDeviceRequestSetAddress = kIOUSBDeviceRequestSetAddress, kDeviceRequestGetDescriptor = kIOUSBDeviceRequestGetDescriptor, kDeviceRequestSetDescriptor = kIOUSBDeviceRequestSetDescriptor, kDeviceRequestGetConfiguration = kIOUSBDeviceRequestGetConfiguration, kDeviceRequestSetConfiguration = kIOUSBDeviceRequestSetConfiguration, kDeviceRequestGetInterface = kIOUSBDeviceRequestGetInterface, kDeviceRequestSetInterface = kIOUSBDeviceRequestSetInterface, kDeviceRequestSynchFrame = kIOUSBDeviceRequestSynchFrame, kDeviceRequestSetSel = kIOUSBDeviceRequestSetSel, kDeviceRequestSetIsochronousDelay = kIOUSBDeviceRequestSetIsochronousDelay }; // USB 2.0 9.4.5: Get Status // USB 3.0 9.4.5: Get Status enum { kDeviceStatusSelfPowered = kIOUSBDeviceStatusSelfPowered, kDeviceStatusRemoteWakeEnable = kIOUSBDeviceStatusRemoteWakeEnable, kDeviceStatusU1Enable = kIOUSBDeviceStatusU1Enable, kDeviceStatusU2Enable = kIOUSBDeviceStatusU2Enable, kDeviceStatusLTMEnable = kIOUSBDeviceStatusLTMEnable, kInterfaceStatusRemoteWakeCapable = kIOUSBInterfaceStatusRemoteWakeCapable, kInterfaceStatusRemoteWakeEnable = kIOUSBInterfaceStatusRemoteWakeEnable, kEndpointStatusHalt = IOUSBEndpointStatusHalt }; // USB 2.0 Table 9-6: Standard Feature Selectors // USB 3.0 Table 9-7: Standard Feature Selectors enum { kDeviceFeatureSelectorRemoteWakeup = kIOUSBDeviceFeatureSelectorRemoteWakeup, kDeviceFeatureSelectorTestMode = kIOUSBDeviceFeatureSelectorTestMode, kDeviceFeatureSelectorU1Enable = kIOUSBDeviceFeatureSelectorU1Enable, kDeviceFeatureSelectorU2Enable = kIOUSBDeviceFeatureSelectorU2Enable, kDeviceFeatureSelectorLTMEnable = kIOUSBDeviceFeatureSelectorLTMEnable, kInterfaceFeatureSelectorSuspend = kIOUSBInterfaceFeatureSelectorSuspend, kEndpointFeatureSelectorStall = IOUSBEndpointFeatureSelectorStall, }; // USB 3.0 Table 9-8: Suspend Options enum { kInterfaceSuspendLowPower = kIOUSBInterfaceSuspendLowPower, kInterfaceSuspendRemoteWakeEnable = kIOUSBInterfaceSuspendRemoteWakeEnable }; // USB 3.0 Table 10-16: Hub Parameters enum { kHubPort2PortExitLatencyNs = kIOUSBHubPort2PortExitLatencyNs, kHubDelayNs = kIOUSBHubDelayNs }; // USB 3.0 Table 8-33: Timing Parameters enum { kPingResponseTimeNs = kIOUSBPingResponseTimeNs }; enum tBusVoltage { kBusVoltageDefault = kIOUSBBusVoltageDefault }; #ifdef __cplusplus } namespace StandardUSB20 { #pragma mark BESL & HIRD Encodings /*! * @brief BESL Encodings from Table X-X1 in USB 2.0 ECN Errata for Link Power Management * @discussion This method converts the Best Effort Service Latency Index value used in the USB 2.0 Extension descriptor to Nanoseconds. * @param beslIndex The BESL Index value used in the USB 2.0 Extension descriptor * @param beslNs Reference to uint32_t. As output, it is the converted BESL value in Nanoseconds * @return result code. kIOReturnSuccess if the conversion was successful. kIOReturnBadArgument if the input beslIndex is invalid. */ IOReturn convertBESLIndexToNs(uint32_t beslIndex, uint32_t& beslNs); /*! * @brief BESL Encodings from Table X-X1 in USB 2.0 ECN Errata for Link Power Management * @discussion This method does the opposite of convertBESLIndexToUs. It converts the BESL value in Nanoseconds to Index. * @param beslNs The converted BESL value in Nanoseconds * @param beslIndex Reference to uint32_t. As output, it is the BESL Index value converted from Nanoseconds. * @return result code. kIOReturnSuccess if the conversion was successful. kIOReturnBadArgument if the input beslNs is invalid. */ IOReturn convertBESLNsToIndex(uint32_t beslNs, uint32_t &beslIndex); enum tBusCurrent { kBusCurrentMinimum = kIOUSB20BusCurrentMinimum, kBusCurrentDefault = kIOUSB20BusCurrentDefault, kBusCurrentMaxPowerUnits = kIOUSB20BusCurrentMaxPowerUnits }; } namespace StandardUSB30 { enum tBusCurrent { kBusCurrentMinimum = kIOUSB30BusCurrentMinimum, kBusCurrentDefault = kIOUSB30BusCurrentDefault, kBusCurrentMaxPowerUnits = kIOUSB30BusCurrentMaxPowerUnits }; // USB 3.0 Table 6-21 enum tResetTimeout { kResetMinimumTimeout = kIOUSB30ResetMinimumTimeout, kResetTypicalTimeout = kIOUSB30ResetTypicalTimeout, kResetMaximumTimeout = kIOUSB30ResetMaximumTimeout, kResetMaximumWithMarginTimeout = kIOUSB30ResetMaximumWithMarginTimeout }; // USB 3.0 Table 7-12 enum tLinkStateTimeout { kLinkStateSSInactiveQuietTimeout = kIOUSB30LinkStateSSInactiveQuietTimeout, kLinkStateRxDetectQuietTimeout = kIOUSB30LinkStateRxDetectQuietTimeout, kLinkStatePollingLFPSTimeout = kIOUSB30LinkStatePollingLFPSTimeout, kLinkStatePollingActiveTimeout = kIOUSB30LinkStatePollingActiveTimeout, kLinkStatePollingConfigurationTimeout = kIOUSB30LinkStatePollingConfigurationTimeout, kLinkStatePollingIdleTimeout = kIOUSB30LinkStatePollingIdleTimeout, kLinkStateU0RecoveryTimeout = kIOUSB30LinkStateU0RecoveryTimeout, kLinkStateU0LTimeout = kIOUSB30LinkStateU0LTimeout, // 10 microseconds kLinkStateU1NoLFPSResponseTimeout = kIOUSB30LinkStateU1NoLFPSResponseTimeout, kLinkStateU1PingTimeout = kIOUSB30LinkStateU1PingTimeout, kLinkStateU2NoLFPSResponseTimeout = kIOUSB30LinkStateU2NoLFPSResponseTimeout, kLinKStateU2RxDetectDelay = kIOUSB30LinKStateU2RxDetectDelay, kLinkStateU3NoLFPSResponseTimeout = kIOUSB30LinkStateU3NoLFPSResponseTimeout, kLinkStateU3WakeupRetryDelay = kIOUSB30LinkStateU3WakeupRetryDelay, kLinkStateU3RxDetectDelay = kIOUSB30LinkStateU3RxDetectDelay, kLinkStateRecoveryActiveTimeout = kIOUSB30LinkStateRecoveryActiveTimeout, kLinkStateRecoveryConfigurationTimeout = kIOUSB30LinkStateRecoveryConfigurationTimeout, kLinkStateRecoveryIdleTimeout = kIOUSB30LinkStateRecoveryIdleTimeout, kLinkStateLoopbackExitTimeout = kIOUSB30LinkStateLoopbackExitTimeout, kLinkStateHotResetActiveTimeout = kIOUSB30LinkStateHotResetActiveTimeout, kLinkStateHotResetExitTimeout = kIOUSB30LinkStateHotResetExitTimeout, // USB 3.0 7.5.4 kLinkStatePollingDeadline = kIOUSB30LinkStatePollingDeadline, // USB 3.0 7.5.9 and 7.5.10 kLinkStateSSResumeDeadline = kIOUSB30LinkStateSSResumeDeadline, }; // USB 3.1 Table 8-18 enum tDeviceNotificationType { kDeviceNotificationTypeFunctionWake = kIOUSB30DeviceNotificationTypeFunctionWake, kDeviceNotificationTypeLatencyTolerance = kIOUSB30DeviceNotificationTypeLatencyTolerance, kDeviceNotificationTypeBusIntervalAdjustment = kIOUSB30DeviceNotificationTypeBusIntervalAdjustment, kDeviceNotificationTypeHostRoleRequest = kIOUSB30DeviceNotificationTypeHostRoleRequest, kDeviceNotificationTypeSublinkSpeed = kIOUSB30DeviceNotificationTypeSublinkSpeed }; // USB 3.1 Table 8-36 enum tTimingParameters { kTimingParameterBELTDefaultNs = kIOUSB30TimingParameterBELTDefaultNs, kTimingParameterBELTMinNs = kIOUSB30TimingParameterBELTMinNs }; // USB 3.1 Table 10-12 Port Status Type Codes enum tHubPortStatusCode { tHubPortStatusCodeStandard = kIOUSB30HubPortStatusCodeStandard, tHubPortStatusCodePD = kIOUSB30HubPortStatusCodePD, tHubPortStatusCodeExt = kIOUSB30HubPortStatusCodeExt, tHubPortStatusCodeCount = kIOUSB30HubPortStatusCodeCount }; // USB 3.1 10.16.2.6 Get Port Status struct tHubPortStatusExt { uint16_t wPortStatus; uint16_t wPortChange; uint32_t dwExtPortStatus; } __attribute__((packed)); // USB 3.1 Table 10-11. Note, offsets are specific to dwExtPortStatus enum tHubExtStatus { kHubExtStatusRxSublinkSpeedID = kIOUSB30HubExtStatusRxSublinkSpeedID, kHubExtStatusRxSublinkSpeedIDPhase = kIOUSB30HubExtStatusRxSublinkSpeedIDPhase, kHubExtStatusTxSublinkSpeedID = kIOUSB30HubExtStatusTxSublinkSpeedID, kHubExtStatusTxSublinkSpeedIDPhase = kIOUSB30HubExtStatusTxSublinkSpeedIDPhase, kHubExtStatusRxLaneCount = kIOUSB30HubExtStatusRxLaneCount, kHubExtStatusRxLaneCountPhase = kIOUSB30HubExtStatusRxLaneCountPhase, kHubExtStatusTxLaneCount = kIOUSB30HubExtStatusTxLaneCount, kHubExtStatusTxLaneCountPhase = kIOUSB30HubExtStatusTxLaneCountPhase }; } #endif // __cplusplus #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostIOSource.h
/* * Copyright (c) 1998-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header IOUSBHostIOSource.h @brief IOUSBHostIOSource is the base class for objects that perform USB IO. */ #ifndef IOUSBHostFamily_IOUSBHostIOSource_h #define IOUSBHostFamily_IOUSBHostIOSource_h #include <sys/queue.h> #include <libkern/c++/OSObject.h> #include <IOKit/IOCommandGate.h> #include <IOKit/IOTimerEventSource.h> #include <IOKit/IOMemoryDescriptor.h> #include <IOKit/usb/IOUSBHostFamily.h> #define kUSBHostTransferLimit (1024) class AppleUSBHostController; class IOUSBHostDevice; class AppleUSBRequestPool; typedef void (*IOUSBHostCompletionAction)(void* owner, void* parameter, IOReturn status, uint32_t bytesTransferred); /*! * @struct IOUSBHostCompletion * @discussion Struture describing the completion callback for an asynchronous bulk, control, or interrupt IO operation * @field owner Pointer to an object that owns the transfer. May be used as <code>this</code> for an action passed via OSMemberFunctionCast. * @field action IOUSBHostCompletionAction to run when the IO request completes. * @field parameter Pointer to be used as context within the completion action. */ struct IOUSBHostCompletion { void* owner; IOUSBHostCompletionAction action; void* parameter; }; typedef void (*IOUSBHostBundledCompletionAction)(void *owner, uint32_t ioCompletionCount, IOMemoryDescriptor** dataBufferArray, void** parameter, IOReturn* statusArray, uint32_t* actualByteCountArray); /*! * @struct IOUSBHostBundledCompletion * @discussion Struture describing the completion callback for an asynchronous bulk, control, or interrupt IO operation * @field owner Pointer to an object that owns the transfer. May be used as <code>this</code> for an action passed via OSMemberFunctionCast. * @field action IOUSBHostBundledCompletion to run when the IO request completes. * @field parameter Pointer to be used as context within the completion action. */ struct IOUSBHostBundledCompletion { void* owner; IOUSBHostBundledCompletionAction action; void* parameter; }; /*! * @struct IOUSBHostIsochronousFrame * @discussion Structure representing a single frame in an isochronous transfer. Use of this structure is discouraged, use @link IOUSBHostIsochronousTransaction @/link instead. * @field status Completion status for this individual frame. IOUSBHostFamily will initialize this to kIOReturnInvalid and will update the field with a valid status code upon completion of the frame. * @field requestCount The number of bytes requested to transfer for this frame. This field must be initialized by the caller before this structure is submitted to IOUSBHostFamily. * @field completeCount The number of bytes actually transferred for this frame. IOUSBHostFamily will update this field upon completion of the frame. * @field reserved Reserved for future use. * @field timeStamp The observed AbsoluteTime for this frame's completion. Note that interrupt latency and system load may result in more than one frame completing with the same timestamp. */ struct IOUSBHostIsochronousFrame { IOReturn status; uint32_t requestCount; uint32_t completeCount; uint32_t reserved; AbsoluteTime timeStamp; } __attribute__((packed)); /*! * @struct IOUSBHostIsochronousTransaction * @discussion Structure representing a single frame or microframe in an isochronous transfer. * @field status Completion status for this individual transaction. IOUSBHostFamily will initialize this to kIOReturnInvalid and will update the field with a valid status code upon completion of the transaction. * @field requestCount The number of bytes requested to transfer for this transaction. This field must be initialized by the caller before this structure is submitted to IOUSBHostFamily. * @field offset The number of bytes between the start of the memory descriptor in which this transaction resides and the start of the transaction. The offset cannot exceed 4GB. * @field completeCount The number of bytes actually transferred for this transaction. IOUSBHostFamily will update this field upon completion of the transaction. * @field timeStamp The observed AbsoluteTime for this transaction's completion. Note that interrupt latency and system load may result in more than one transaction completing with the same timestamp. * @field options Flags that specify additional transaction behavior. See @link tIsochronousTransactionOptions @/link for more details. */ struct IOUSBHostIsochronousTransaction { IOReturn status; uint32_t requestCount; uint32_t offset; uint32_t completeCount; AbsoluteTime timeStamp; IOOptionBits options; } __attribute__((packed)); typedef void (*IOUSBHostIsochronousCompletionAction)(void* owner, void* parameter, IOReturn status, IOUSBHostIsochronousFrame* frameList); /*! * @struct IOUSBHostIsochronousCompletion * @discussion Struture describing the completion callback for an asynchronous isochronous operation * @field owner Pointer to an object that owns the transfer. May be used as <code>this</code> for an action passed via OSMemberFunctionCast. * @field action IOUSBHostIsochronousCompletionAction to run when the IO request completes. * @field parameter Pointer to be used as context within the completion action. */ struct IOUSBHostIsochronousCompletion { void* owner; IOUSBHostIsochronousCompletionAction action; void* parameter; }; typedef void (*IOUSBHostIsochronousTransactionCompletionAction)(void* owner, void* parameter, IOReturn status, IOUSBHostIsochronousTransaction* transactionList); /*! * @struct IOUSBHostIsochronousTransactionCompletion * @discussion Structure describing the completion callback for an asynchronous isochronous operation * @field owner Pointer to an object that owns the transfer. May be used as <code>this</code> for an action passed via OSMemberFunctionCast. * @field action IOUSBHostIsochronousTransactionCompletionAction to run when the IO request completes. * @field parameter Pointer to be used as context within the completion action. */ struct IOUSBHostIsochronousTransactionCompletion { void* owner; IOUSBHostIsochronousTransactionCompletionAction action; void* parameter; }; /*! * @enum tIsochronousTransferOptions * @brief Options for controlling isochronous transfer behavior * @constant kIsochronousTransferOptionsNone No options are selected for this transfer */ enum tIsochronousTransferOptions { kIsochronousTransferOptionsNone = 0, }; /*! * @enum tIsochronousTransactionOptions * @brief Options for <code>IOUSBHostIsochronousTransaction</code> * @constant kIsochronousTransactionOptionsNone No options are selected for this transaction * @constant kIsochronousTransactionOptionsWrap This transaction's data reaches the end of the memory descriptor and continues at the descriptor's start. If this option is selected, the transaction's offset + requestCount should exceed the memory descriptor's length. This option is not supported on UHCI or UserHCI controllers. */ enum tIsochronousTransactionOptions { kIsochronousTransactionOptionsNone = 0, kIsochronousTransactionOptionsWrap = (1 << 0), }; typedef LIST_HEAD (IOUSBHostIOSourceClientRecordList, IOUSBHostIOSourceClientRecord) IOUSBHostIOSourceClientRecordList; typedef LIST_ENTRY (IOUSBHostIOSourceClientRecord) IOUSBHostIOSourceClientRecordLink; struct IOUSBHostIOSourceClientRecord { IOService* forClient; UInt32 outstandingIO; IOUSBHostIOSourceClientRecordLink link; }; /*! * @struct tPacketFilterMetadata * @discussion Struture providing information about the IOUSBHostIOSource's parents * @field deviceAddress Address of the parent IOUSBHostDevice. * @field interfaceClass If enpointAddress is non-zero, the class of the parent IOUSBHostInteface. * @field interfaceSubClass If enpointAddress is non-zero, the sub-class of the parent IOUSBHostInteface. * @field interfaceProtocol If enpointAddress is non-zero, the protocol of the parent IOUSBHostInteface. * @field interfaceAltSetting Current alternate setting of the parent IOUSBHostInterface. * @field endpointAddress The address of the endpoint including the direction. * @field endpointType See tEndpointType in IOUSBHostFamily.h. * @field speed See tUSBHostConnectionSpeed in IOUSBHostFamily.h. * @field vid Vendor ID of the parent IOUSBHostDevice. * @field pid Product ID of the parent IOUSBHostDevice. * @field locationID USB locationID of the parent IOUSBHostDevice. */ struct tPacketFilterMetadata { uint8_t deviceAddress; uint8_t interfaceClass; uint8_t interfaceSubclass; uint8_t interfaceProtocol; uint8_t interfaceAltSetting; uint8_t endpointAddress; uint8_t endpointType; uint8_t speed; uint16_t vid; uint16_t pid; uint32_t locationID; } __attribute__((packed)); /*! * @class IOUSBHostIOSource * @brief The base class for objects that perform USB IO. * @discussion This class provides functionality to transfer data across USB. Function drivers should not subclass IOUSBHostIOSource. */ class __IOUSBHOSTFAMILY_DEPRECATED IOUSBHostIOSource : public OSObject { friend class AppleUSBIORequest; friend class IOUSBHostInterface; OSDeclareAbstractStructors(IOUSBHostIOSource) protected: virtual void free(); virtual bool initWithOwners(AppleUSBHostController* controller, IOUSBHostDevice* device); OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 0); virtual IOReturn open(); OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 1); virtual IOReturn openGated(); OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 2); virtual IOReturn destroy(); OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 3); virtual IOReturn destroyGated(); // Pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 4); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 5); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 6); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 7); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 8); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 9); public: /*! * @enum tState * @namespace IOUSBHostIOSource * @brief Return value for <code>getState()</code> * @constant kStateReady The I/O source is idle and fully-functional. * @constant kStateRunningCompletions The I/O source is currently running completions. * @constant kStateAborting The I/O source is currently aborting all requests. * @constant kStateInactive The I/O source has been closed. */ enum tState { kStateReady, kStateRunningCompletions, kStateAborting, kStateInactive, kStateDestroyed }; /*! * @brief Returns the current state of the I/O source. * @return @link tState @/link */ virtual tState getState(); /*! * @enum tAbortOptions * @brief Options for <code>abort()</code> * @constant kAbortAsynchronous abort() should return immediately without waiting for the aborted IO to complete * @constant kAbortSynchronous abort() should not return until the aborted IO has completed */ enum tAbortOptions { kAbortAsynchronous = 0x0, kAbortSynchronous = 0x1 }; /*! * @brief Abort pending I/O requests. * @discussion This method will abort all pending I/O requests. If <code>options</code> includes <code>kAbortSynchronous</code>, this method will block any new IO requests unless they are submitted from an aborted IO's completion routine. * @param options tAbortOptions * @param withError IOReturn error value to return with the requests. The default value of kIOReturnAborted should be used. * @param forClient Service for which to abort requests. If NULL, all requests will be aborted. Only control endpoints can specify a non-NULL value. * @return IOReturn result code */ virtual IOReturn abort(IOOptionBits options = kAbortAsynchronous, IOReturn withError = kIOReturnAborted, IOService* forClient = NULL); /*! * @brief Retrieve a pointer to the IOUSBHostDevice that encapsulates this endpoint or stream * @return IOUSBHostDevice pointer */ OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 10); virtual IOUSBHostDevice* getDevice() const; // Public pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 11); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 12); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 13); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 14); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 15); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 16); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 17); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 18); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 19); protected: // Protected pad slots for future expansion OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 20); virtual UInt32 getOutstandingIO(IOService* forClient); OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 21); virtual UInt32 adjustOutstandingIO(IOService* forClient, SInt32 increment); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 22); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 23); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 24); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 25); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 26); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 27); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 28); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 29); protected: struct tSynchronousParameter { uint32_t bytesTransferred; IOReturn status; }; virtual void synchronousCompletion(void* parameter, IOReturn status, uint32_t bytesTransferred); virtual void synchronousIsochronousCompletion(void* parameter, IOReturn status, IOUSBHostIsochronousFrame* pFrames); virtual IOReturn getStateGated(tState& state); virtual IOReturn close(); virtual IOReturn closeGated(); virtual IOReturn abortGated(IOOptionBits options, IOReturn withError, IOService* forClient); virtual void timerCompletion(IOTimerEventSource* timer); AppleUSBHostController* _controller; IOUSBHostDevice* _device; IOWorkLoop* _workloop; IOCommandGate* _commandGate; IOTimerEventSource* _timer; AppleUSBRequestPool* _requestPool; tState _state; UInt32 _outstandingIO; UInt32 _completionRunning; #pragma mark IO public: /*! * @brief Enqueue an IO request on the source * @discussion This method is used to issue an asynchronous I/O request on a bulk or interrupt pipe. See IOUSBHostPipe::io and IOUSBHostStream::io for object-specific interface notes. * @param dataBuffer IOMemoryDescriptor pointer containing the buffer to use for the transfer * @param dataBufferLength Length of the request. Must be <= <code>dataBuffer->getLength()</code> * @param completion Pointer to a IOUSBHostCompletion structure. This will be copied and can therefore be stack-allocated. * @param completionTimeoutMs Timeout of the request in milliseconds. If 0, the request will never timeout. Must be 0 for interrupt pipes and streams. * @return kIOReuturnSuccess if the completion will be called in the future, otherwise error */ virtual IOReturn io(IOMemoryDescriptor* dataBuffer, uint32_t dataBufferLength, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs = 0); /*! * @brief Perform an IO request on the source * @discussion This method will send a synchronous request on the IO source, and will not return until the request is complete. This method will acquire the service's workloop lock, and will call commandSleep to send the request. See IOUSBHostPipe::io and IOUSBHostStream::io for object-specific interface notes. * @param dataBuffer IOMemoryDescriptor pointer containing the buffer to use for the transfer * @param dataBufferLength Length of the request. Must be <= <code>dataBuffer->getLength()</code> * @param bytesTransferred uint32_t reference which will be updated with the bytes transferred during the request * @param completionTimeoutMs Timeout of the request in milliseconds. If 0, the request will never timeout. Must be 0 for interrupt pipes and streams. * @return IOReturn value indicating the result of the IO request */ virtual IOReturn io(IOMemoryDescriptor* dataBuffer, uint32_t dataBufferLength, uint32_t& bytesTransferred, uint32_t completionTimeoutMs = 0); OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 30); /*! * @brief Enqueue an IO request on the source * @discussion This method is used to issue an asynchronous I/O request on a bulk or interrupt pipe that will trigger a IOUSBHostBundledCompletionAction callback. * I/O requests enqueued with this method may be completed in bundles that may reduce the total number of callbacks. * The 'ioCompletionCount' callback parameter indicates the number of completed I/Os associated with this callback and the size of the * 'dataBufferArray', 'statusArray' and' actualByteCountArray. Clients must iterate over these arrays to extract the completion status/length * of each individual IOMemoryDescriptor. * See IOUSBHostPipe::io and IOUSBHostStream::io for object-specific interface notes. * @param dataBuffer IOMemoryDescriptor pointer containing the buffer to use for the transfer * @param dataBufferLength Length of the request. Must be <= <code>dataBuffer->getLength()</code> * @param completion Pointer to a IOUSBHostBundledCompletion structure. This will be copied and can therefore be stack-allocated. * @param completionTimeoutMs Timeout of the request in milliseconds. If 0, the request will never timeout. Must be 0 for interrupt pipes and streams. * @return kIOReuturnSuccess if the completion will be called in the future, otherwise error */ virtual IOReturn io(IOMemoryDescriptor* dataBuffer, uint32_t dataBufferLength, IOUSBHostBundledCompletion* completion, uint32_t completionTimeoutMs = 0); // Public pad slots for IO OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 31); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 32); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 33); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 34); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 35); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 36); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 37); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 38); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 39); protected: // Protected pad slots for IO OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 40); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 41); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 42); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 43); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 44); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 45); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 46); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 47); OSMetaClassDeclareReservedUnused(IOUSBHostIOSource, 48); protected: struct tInternalDataTransferParameters { IOMemoryDescriptor* dataBuffer; uint32_t dataBufferLength; uint32_t* bytesTransferred; IOUSBHostCompletion* completion; IOUSBHostBundledCompletion* bundledCompletion; uint32_t completionTimeoutMs; IOUSBHostIsochronousTransaction* transactionList; uint32_t transactionListCount; uint64_t firstFrameNumber; IOUSBHostIsochronousTransactionCompletion* isochronousCompletion; IOUSBHostIsochronousFrame* frameList; }; OSMetaClassDeclareReservedUsed(IOUSBHostIOSource, 49); virtual IOReturn ioBundledGated(tInternalDataTransferParameters& parameters); virtual IOReturn ioGated(tInternalDataTransferParameters& parameters); struct tExpansionData { IOUSBHostIOSourceClientRecordList _ioRecordList; tPacketFilterMetadata _metadata; void* _dkMemoryDescriptorRing; IOCommandGate* _controllerCommandGate; uint32_t _ioSourceSignature; }; tExpansionData* _expansionData; #pragma mark Debug uint32_t _debugLoggingMask; }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostDevice.h
/* * Copyright (c) 1998-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header IOUSBHostDevice.h @brief IOUSBHostDevice is an IOService representing a USB device. @discussion <h3>Session Management</h3> A driver that has successfully matched on an IOUSBHostDevice is able to take ownership of the device by calling the <code>open</code> method defined by IOService on the IOUSBHostDevice. Once <code>open</code> has completed successfully, the driver has an open session, and may use the deviceRequest interface to send control requests, and the setConfiguration interface to create or destroy child IOUSBHostInterface services. When the driver is finished with control of the IOUSBHostDevice, it must call <code>close</code> to end its session. Calling <code>close</code> will synchronously abort that session's outstanding IO on the control endpoint. If the device is terminating for any reason, such as being unplugged, the driver must call <code>close</code> on the IOUSBHostDevice, or termination will be blocked and the port will not register newly attached devices for matching. The willTerminate call into the driver is the recommended location to call <code>close</code>. Drivers that match on an IOUSBHostInterface service do not need to open a session to the IOUSBHostDevice, as the IOUSBHostInterface will open a session to the IOUSBHostDevice on the driver's behalf. <h3>deviceRequest Interface</h3> The <code>deviceRequest</code> methods are used to send control requests to the device's default endpoint. The <code>deviceRequest</code> methods may not be used for the following standard requests: <ul> <li>CLEAR_FEATURE ENDPOINT_HALT (USB 2.0 9.4.1) - Use <code>IOUSBHostPipe::clearStall</code> to send this request</li> <li>SET_ADDRESS (USB 2.0 9.4.6)</li> <li>SET_CONFIGURATION (USB 2.0 9.4.7) - Use <code>setConfiguration</code> to send this request</li> <li>SET_INTERFACE (USB 2.0 9.4.10) - Use <code>IOUSBHostInterface::selectAlternateSetting</code> to send this request</li> </ul> <h3>IOUSBDevice Migration</h3> IOUSBHostDevice serves as a replacement for IOUSBDevice. Clients that previously matched on IOUSBDevice can use the following guide to convert to IOUSBHostDevice. <code>virtual UInt16 IOUSBDevice::GetbcdUSB();</code><br> Replacement: <code>USBToHost16(getDeviceDescriptor()->bcdUSB);</code> <code>virtual UInt8 IOUSBDevice::GetDeviceClass();</code><br> Replacement: <code>getDeviceDescriptor()->bDeviceClass;</code> <code>virtual UInt8 IOUSBDevice::GetDeviceSubClass();</code><br> Replacement: <code>getDeviceDescriptor()->bDeviceSubClass</code> <code>virtual UInt8 IOUSBDevice::GetProtocol();</code><br> Replacement: <code>getDeviceDescriptor()->bDeviceProtocol</code> <code>virtual UInt8 IOUSBDevice::GetMaxPacketSize();</code><br> Replacement: <code>getDeviceDescriptor->bMaxPacketSize0</code> <code>virtual UInt16 IOUSBDevice::GetVendorID();</code><br> Replacement: <code>USBToHost16(getDeviceDescriptor()->idVendor)</code> <code>virtual UInt16 IOUSBDevice::GetProductID();</code><br> Replacement: <code>USBToHost16(getDeviceDescriptor()->idProduct)</code> <code>virtual UInt16 IOUSBDevice::GetDeviceRelease();</code><br> Replacement: <code>USBToHost16(getDeviceDescriptor()->bcdDevice)</code> <code>virtual UInt8 IOUSBDevice::GetNumConfigurations();</code><br> Replacement: <code>getDeviceDescriptor()->bNumConfigurations</code> <code>virtual UInt8 IOUSBDevice::GetManufacturerStringIndex();</code><br> Replacement: <code>getDeviceDescriptor()->iManufacturer</code> <code>virtual UInt8 IOUSBDevice::GetProductStringIndex();</code><br> Replacement: <code>getDeviceDescriptor()->iProduct</code> <code>virtual UInt8 IOUSBDevice::GetSerialNumberStringIndex();</code><br> Replacement: <code>getDeviceDescriptor()->iSerialNumber</code> <code>virtual IOReturn IOUSBDevice::FindNextInterfaceDescriptor(const IOUSBConfigurationDescriptor*, const IOUSBInterfaceDescriptor*, const IOUSBFindInterfaceRequest*, IOUSBInterfaceDescriptor**);</code><br> Replacement:<br> <pre>ConfigurationDescriptor* confDesc = getConfigurationDescriptor(); InterfaceDescriptor* intDesc = NULL; while((intDesc = StandardUSB::getNextInterfaceDescriptor(confDesc, intDesc)) != NULL) { if(intDesc->bInterfaceClass == kMyClass) { break; } }</pre> <code>virtual const IOUSBConfigurationDescriptor* IOUSBDevice::GetCachedConfigurationDescriptor(UInt8 configIndex);</code><br> <code>virtual const IOUSBConfigurationDescriptor* IOUSBDevice::GetFullConfigurationDescriptor(UInt8 configIndex);</code><br> Replacement: <code>getConfigurationDescriptor(configIndex)</code> <code>virtual IOReturn IOUSBDevice::GetConfigurationDescriptor(UInt8 configValue, void* data, UInt32 len);</code><br> Replacement: <code>getConfigurationDescriptorWithValue(configValue);</code> <code>virtual IOUSBHostInterface* IOUSBDevice::FindNextInterface(IOUSBHostInterface*, IOUSBFindInterfaceRequest* request);</code><br> <code>virtual OSIterator* IOUSBDevice::CreateInterfaceIterator(IOUSBFindInterfaceRequest* request);</code><br> Replacement:<br> <pre>OSIterator* iterator = _device->getChildIterator(gIOServicePlane); OSObject* candidate = NULL; while(iterator != NULL && (candidate = iterator->getNextObject()) != NULL) { IOUSBHostInterface* interfaceCandidate = OSDynamicCast(IOUSBHostInterface, candidate); if( interfaceCandidate != NULL && interfaceCandidate->getInterfaceDescriptor()->bInterfaceClass == kMyClass) { _interface = interfaceCandidate; break; } } OSSafeReleaseNULL(iterator);</pre> <code>virtual IOReturn IOUSBDevice::SetConfiguration(IOService*, UInt8, bool);</code><br> Replacement: <code>setConfiguration(configNumber, startMatchingInterfaces);</code> <code>virtual UInt8 IOUSBDevice::GetSpeed();</code><br> Replacement: <code>getSpeed();</code> <code>virtual IOUSBController* IOUSBDevice::GetBus();</code><br> Replacement: The controller cannot be directly accessed. Use <code>getFrameNumber(...)</code> and <code>createIOBuffer(...)</code> instead. <code>virtual UInt32 IOUSBDevice::GetBusPowerAvailable();</code><br> Replacement: <code>allocateDownstreamBusCurrent(...);</code> <code>virtual IOReturn IOUSBDevice::DeviceRequest(IOUSBDevRequest*, IOUSBCompletion*);<br> virtual IOReturn IOUSBDevice::DeviceRequest(IOUSBDevRequestDesc*, IOUSBCompletion*);<br> virtual IOReturn IOUSBDevice::DeviceRequest(IOUSBDevRequest*, UInt32, UInt32, IOUSBCompletion*);<br> virtual IOReturn IOUSBDevice::DeviceRequest(IOUSBDevRequestDesc*, UInt32, UInt32, IOUSBCompletion*);<br></code> Replacment: <code>deviceRequest(...);</code> <code>virtual IOReturn IOUSBDevice::GetConfiguration(UInt8*);</code><br> Replacment: <pre>uint8_t configNumber = 0; StandardUSB::DeviceRequest request; request.bmRequestType = makeDeviceRequestbmRequestType(kRequestDirectionIn, kRequestTypeStandard, kRequestRecipientDevice); request.bRequest = kDeviceRequestGetConfiguration; request.wValue = 0; request.wIndex = 0; request.wLength = sizeof(configNumber); uint32_t bytesTransferred = 0; deviceRequest(this, request, &configNumber, bytesTransferred, kUSBHostStandardRequestCompletionTimeout);</pre> <code>virtual IOReturn IOUSBDevice::GetDeviceStatus(USBStatus*);</code><br> Replacement: <pre>uint16_t status = 0; StandardUSB::DeviceRequest request; request.bmRequestType = makeDeviceRequestbmRequestType(kRequestDirectionIn, kRequestTypeStandard, kRequestRecipientDevice); request.bRequest = kDeviceRequestGetStatus; request.wValue = 0; request.wIndex = 0; request.wLength = sizeof(status); uint32_t bytesTransferred = 0; deviceRequest(this, request, &status, bytesTransferred, kUSBHostStandardRequestCompletionTimeout);</pre> <code>virtual IOUSBPipe* IOUSBDevice::GetPipeZero();</code><br> Replacement: The IOUSBHostPipe representing the default control endpoint is not accessible. Use <code>deviceRequest(...)</code> and <code>abortDeviceRequests(...)</code> interfaces to interact with the default control endpoint. <code>virtual IOReturn IOUSBDevice::GetStringDescriptor(UInt8, char*, int, UInt16);</code><br> Replacement: <pre>char stringBuffer[256] = { 0 }; size_t stringLength = sizeof(stringBuffer); const StringDescriptor* stringDescriptor = getStringDescriptor(index); if( stringDescriptor != NULL && stringDescriptor->bLength > StandardUSB::kDescriptorSize) { StandardUB::stringDescriptorToUTF8(stringDescriptor, stringBuffer, stringLength); }</pre> <code>virtual const IOUSBDescriptorHeader* IOUSBDevice::FindNextDescriptor(const void*, UInt8);</code><br> Replacement: <code>StandardUSB::getNextDescriptorWithType(getConfigurationDescriptor(), currentDescriptor, descriptorType);</code> <code>virtual IOReturn IOUSBDevice::SuspendDevice(bool);</code><br> Replacement: Power management should be done using the idling system described in IOUSBHostFamily.h. <code>virtual IOReturn IOUSBDevice::ReEnumerateDevice(UInt32);</code><br> Replacement: <code>reset();</code> <code>virtual IOReturn IOUSBDevice::GetDeviceInformation(UInt32*);</code><br> Replacement: <code>getPortStatus();</code> <code>virtual UInt32 IOUSBDevice::RequestExtraPower(UInt32, UInt32);<br> virtual IOReturn IOUSBDevice::ReturnExtraPower(UInt32, UInt32);</code><br> Replacement: <code>allocateDownstreamBusCurrent(...);</code> <code>virtual tUSBHostDeviceAddress IOUSBDevice::GetAddress(void);</code><br> Replacement: <code>getAddress();</code> <code>virtual IOReturn IOUSBDevice::ResetDevice();<br> virtual UInt32 IOUSBDevice::GetExtraPowerAllocated(UInt32);<br> void IOUSBDevice::SetBusPowerAvailable(UInt32);</code><br> Replacement: none */ #ifndef IOUSBHostFamily_IOUSBHostDevice_h #define IOUSBHostFamily_IOUSBHostDevice_h #include <TargetConditionals.h> #include <IOKit/usb/StandardUSB.h> #include <IOKit/usb/IOUSBHostFamily.h> #include <IOKit/usb/IOUSBHostPipe.h> #include <IOKit/IOBufferMemoryDescriptor.h> #define TARGET_OS_HAS_USBDRIVERKIT_IOUSBHOSTDEVICE __has_include(<USBDriverKit/IOUSBHostDevice.h>) #if TARGET_OS_HAS_USBDRIVERKIT_IOUSBHOSTDEVICE #include <USBDriverKit/IOUSBHostDevice.h> #endif #include <IOKit/IOWorkLoop.h> #include <IOKit/IOCommandGate.h> #include <IOKit/pwr_mgt/RootDomain.h> #include <kern/thread_call.h> #define kUSBHostDeviceForceSuspend "kUSBHostDeviceForceSuspend" class AppleUSBHostController; class IOUSBHostInterface; class AppleUSBHostDeviceIdler; class AppleUSBHostRequestCompleter; class AppleUSBHostPort; class AppleUSBDescriptorCache; class AppleUSBHostResources; #if TARGET_CPU_ARM64 || TARGET_CPU_ARM /*! * @class IOUSBDevice * @brief A compatibility base class to faciliate service discovery for legacy projects. * @discussion New software should not reference this class. */ class __IOUSBHOSTFAMILY_DEPRECATED IOUSBDevice : public IOService { typedef IOService super; OSDeclareAbstractStructors(IOUSBDevice) public: virtual bool start(IOService* provider); virtual void stop(IOService* provider); protected: static const IORegistryPlane* gIOUSBPlane; }; #endif /*! * @class IOUSBHostDevice * @brief The IOService object representing a USB device * @discussion This class provides functionality to send control requests to the default control endpoint, as well as create IOUSBHostInterface objects to represent the interfaces contained in the selected configuration. Function drivers should not subclass IOUSBHostDevice. */ #if TARGET_CPU_ARM64 || TARGET_CPU_ARM class __IOUSBHOSTFAMILY_DEPRECATED IOUSBHostDevice : public IOUSBDevice #else class __IOUSBHOSTFAMILY_DEPRECATED IOUSBHostDevice : public IOService #endif { friend class AppleUSBHostController; friend class IOUSBHostInterface; friend class IOUSBHostIOSource; friend class IOUSBHostPipe; friend class IOUSBHostStream; friend class AppleUSBIORequest; friend class AppleUSBHostDeviceIdler; #if TARGET_OS_HAS_USBDRIVERKIT_IOUSBHOSTDEVICE OSDeclareDefaultStructorsWithDispatch(IOUSBHostDevice) #else OSDeclareDefaultStructors(IOUSBHostDevice) #endif public: /*! * @namespace IOUSBHostDevice * @brief Powerstates supported by an IOUSBHostDevice * @constant kPowerStateOff The device has been powered off and will be terminated. * @constant kPowerStateSuspended The device is suspended. All I/O has been paused and the bus will be suspended once its AppleUSBHostPort power parent enters the suspend state. * @constant kPowerStateOn The device is powered on and I/O is possible. * @constant kPowerStateCount Number of possible power states. */ enum tPowerState { kPowerStateOff = 0, kPowerStateSuspended, kPowerStateOn, kPowerStateCount }; /* * @brief Factory method for creating an IOUSBHostDevice object * @discussion This method should not be called by function drivers. IOUSBHostDevice objects are created by AppleUSBHostPort services when a device is connected. * @param controller Controller to which the USB device is attached * @param speed Speed at which the device enumerated * @param address tUSBHostDeviceAddress that has been allocated by the controller * @return Pointer to an IOUSBHostDevice object if successful, otherwise NULL */ static IOUSBHostDevice* withController(AppleUSBHostController* controller, UInt8 speed, tUSBHostDeviceAddress address); protected: virtual bool initWithController(AppleUSBHostController* controller, UInt8 speed, tUSBHostDeviceAddress address); // Pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 0); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 1); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 2); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 3); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 4); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 5); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 6); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 7); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 8); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 9); #pragma mark IOService overrides public: /*! * @functiongroup IOService overrides * @discussion For a discussion of proper usage for <code>open</code> and <code>close</code>, see the discussion of "Session Management" above. */ virtual bool attach(IOService* provider); virtual bool start(IOService* provider); virtual bool terminate(IOOptionBits options = 0); virtual void stop(IOService* provider); virtual void free(void); virtual bool compareProperty(OSDictionary* matching, const char* key); virtual bool compareProperty(OSDictionary* matching, const OSString* key); virtual bool matchPropertyTable(OSDictionary* table, SInt32* score); virtual bool matchPropertyTable(OSDictionary* table); virtual IOReturn setProperties(OSObject* properties); /*! * @brief Open a session to the IOUSBHostDevice * @discussion This method opens a session to an IOUSBHostDevice. It will acquire the service's workloop lock. Child IOUSBHostInterfaces may open simultaneous sessions, but only one other service may open a session. * @param forClient The IOService that is opening a session. * @param options See IOService.h * @param arg See IOService.h * @return bool true if the session could be opened, otherwise false. */ virtual bool open(IOService* forClient, IOOptionBits options = 0, void* arg = 0); virtual bool handleOpen(IOService* forClient, IOOptionBits options, void* arg); virtual bool handleIsOpen(const IOService* forClient) const; /*! * @brief Close a session to the IOUSBHostDevice * @discussion This method closes an open session to an IOUSBHostDevice. It will acquire the service's workloop lock, abort any IO associated with the specified client, and may call commandSleep to allow processing of aborted control requests before returning. * @param forClient The IOService that is closing its session. Any IO associated with the specified client will be aborted. * @param options See IOService.h */ virtual void close(IOService* forClient, IOOptionBits options = 0); virtual void handleClose(IOService* forClient, IOOptionBits options); virtual IOReturn newUserClient(task_t owningTask, void* securityID, UInt32 type, IOUserClient** handler); virtual IOReturn message(UInt32 type, IOService* provider, void* argument = 0); virtual const char* stringFromReturn(IOReturn code); virtual bool setProperty(const OSSymbol* aKey, OSObject* anObject); virtual bool setProperty(const OSString* aKey, OSObject* anObject); virtual bool setProperty(const char* aKey, OSObject* anObject); virtual bool setProperty(const char* aKey, const char* aString); virtual bool setProperty(const char* aKey, bool aBoolean); virtual bool setProperty(const char* aKey, unsigned long long aValue, unsigned int aNumberOfBits); virtual bool setProperty(const char* aKey, void* bytes, unsigned int length); protected: virtual IOReturn terminateGated(IOOptionBits options = 0); virtual IOReturn openGated(IOService* forClient, IOOptionBits options, void* arg); virtual IOReturn closeGated(IOService* forClient, IOOptionBits options); // Protected pad slots for IOService overrides OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 10); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 11); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 12); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 13); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 14); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 15); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 16); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 17); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 18); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 19); protected: int32_t _terminationPending; AppleUSBHostResources* _resources; AppleUSBHostController* _controller; AppleUSBHostPort* _port; OSSet* _clients; IOWorkLoop* _workLoop; IOCommandGate* _commandGate; #pragma mark Power management public: /*! * @functiongroup Power management */ virtual void registerPowerService(); virtual IOReturn addPowerChild(IOService* theChild); virtual IOReturn removePowerChild(IOPowerConnection* theChild); virtual IOReturn powerStateWillChangeTo(IOPMPowerFlags capabilities, unsigned long stateNumber, IOService* whatDevice); virtual IOReturn setPowerState(unsigned long stateNumber, IOService* whatDevice); virtual IOReturn powerStateDidChangeTo(IOPMPowerFlags capabilities, unsigned long stateNumber, IOService* whatDevice); virtual unsigned long initialPowerStateForDomainState(IOPMPowerFlags domainState); virtual void PMstop(void); virtual IOReturn forcePower(tPowerState powerState, bool clamp, uint32_t timeoutMs = 0); /*! * @brief Allocate bus current that does not match the bMaxPower value specified by the device's configuration descriptor * @discussion * Devices can use this interface to request more or less bus current than what is specified in the selected configuration descriptor's bMaxPower field. The parameters passed in are abolute values of current required for operation in kPowerStateOn and kPowerStateSuspended IOUSBHostDevice power levels, and override the bMaxPower field in the configuration descriptor. For example, if bMaxPower indicates the device requires 500mA to operate, then a request for 1000mA will double the allocated power for the device. * A setConfiguration call to select a different configuration or unconfigure the device will reset the bus current allocations. * The parameters are passed by reference, and may be modified before being returned. If more bus current is being requested than is available, the values may be reduced to stay within system limits. * @param wakeUnits As input, the number of mA requested when the device is in kPowerStateOn. As output, the number of mA allocated to the device in kPowerStateOn. * @param sleepUnits As input, the number of mA requested when the device is in kPowerStateSuspended. As output, the number of mA allocated to the device in kPowerStateSuspended. * @return IOReturn kIOReturnSuccess if the device's allocation amounts were updated, otherwise an error code */ virtual IOReturn allocateDownstreamBusCurrent(uint32_t& wakeUnits, uint32_t& sleepUnits); enum tIdleAssertion { kIdleAssertionInhibit = 0, kIdleAssertionPermit }; /*! * @brief This method should be considered private and should not be called by function drivers. */ virtual IOReturn idleAssertion(IOService* forService, tIdleAssertion assertion); // Public pad slots for power management OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 20); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 21); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 22); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 23); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 24); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 25); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 26); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 27); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 28); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 29); protected: static IOPMPowerState _sPowerStates[kPowerStateCount]; static const OSSymbol* _sPowerStateSymbols[kPowerStateCount]; virtual void powerChangeDone(unsigned long stateNumber); virtual IOReturn powerStateWillChangeToGated(IOPMPowerFlags capabilities, unsigned long stateNumber, IOService* whatDevice); virtual IOReturn setPowerStateGated(unsigned long stateNumber, IOService* whatDevice); virtual IOReturn powerStateDidChangeToGated(IOPMPowerFlags capabilities, unsigned long stateNumber, IOService* whatDevice); virtual IOReturn forcePowerGated(tPowerState powerState, bool clamp, uint32_t timeoutMs); virtual void addPowerChildThreadCall(thread_call_t threadCall); virtual IOReturn addPowerChildGated(void); virtual void pmStopThreadCall(thread_call_t threadCall); virtual IOReturn allocateDownstreamBusCurrentGated(uint32_t& wakeUnits, uint32_t& sleepUnits); virtual IOReturn updateIdlePolicy(bool asynchronous = false); virtual void updateIdlePolicyAsync(thread_call_t threadCall); virtual IOReturn updateIdlePolicyGated(); // Protected pad slots for power management OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 30); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 31); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 32); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 33); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 34); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 35); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 36); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 37); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 38); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 39); protected: bool _allowUpdateIdlePolicy; bool _forcePowerInProgress; IOLock* _powerChildrenLock; OSSet* _powerChildren; OSSet* _activePowerChildren; IOPMDriverAssertionID _externalDevicePowerAssertion; tPowerState _currentPowerState; bool _powerOffPending; #pragma mark Descriptors public: /*! @functiongroup Descriptors */ /*! * @brief Store the provided descriptor in the set of cached descriptors. * @discussion This method will store a descriptor in a set of cached descriptors. If a descriptor with an identical <code>bDescriptorType</code>, <code>index</code>, and <code>languageID</code> already exists in the cache, it will be replaced. The provided descriptor is copied, and may be discarded after being stored in the cache. Future descriptor fetch calls such as getDescriptor will return the cached value. Future GET_DESCRIPTOR control requests (USB 2.0 9.4.3) will also return the cached descriptor. SET_DESCRIPTOR control requests (USB 2.0 9.4.8) will remove the cached descriptor. * @param descriptor Pointer to the descriptor to cache * @param length Length of the descriptor, or 0 the descriptor's bLength field should be used. * @param index Descriptor index value. Low byte of <code>wValue</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * @param languageID Descriptor language ID. <code>wIndex</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * @return IOReturn result code */ virtual IOReturn cacheDescriptor(const StandardUSB::Descriptor* descriptor, uint16_t length = 0, uint8_t index = 0, uint16_t languageID = 0); /*! * @brief Retrieve a descriptor from the cache or the device * @discussion * This method will search the descriptor cache for the descriptor that matches the input arguments. If the descriptor is not in the cache, a GET_DESCRIPTOR control request (USB 2.0 9.4.3) will be issued to retrieve the descriptor from the device. If the device request is successful, the retrieved descriptor will be added to the cache. * This method will acquire the service's workloop lock, and may call commandSleep to perform the GET_DESCRIPTOR control request. * @param type <code>bDescriptorType</code> of the descriptor to find. * @param length Reference to a uint16_t which will be updated with the length of the descriptor. As input, used as <code>wLength</code> when fetching variable-length configuration or BOS descriptors, or when fetching nonstandard descriptor types. * @param index Descriptor index value. Low byte of <code>wValue</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * @param languageID Descriptor language ID. <code>wIndex</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * @param requestType tDeviceRequestType to be used for a GET_DESCRIPTOR control request. * @param requestRecipient tDeviceRequestRecipient to be used for a GET_DESCRIPTOR control request. * @return Pointer to the cached descriptor if found, otherwise NULL. */ virtual const StandardUSB::Descriptor* getDescriptor(uint8_t type, uint16_t& length, uint8_t index = 0, uint16_t languageID = 0, tDeviceRequestType requestType = kRequestTypeStandard, tDeviceRequestRecipient requestRecipient = kRequestRecipientDevice); /*! * @brief Return the device descriptor * @discussion This method uses getDescriptor to retrieve the device descriptor. * @return Pointer to the device descriptor, or NULL if the service is terminating. */ virtual const StandardUSB::DeviceDescriptor* getDeviceDescriptor(); /*! * @brief Return the configuration descriptor with the specified index * @discussion This method uses getDescriptor to retrieve a configuration descriptor. * @param index Descriptor index value * @return Pointer to the configuration descriptor if found */ virtual const StandardUSB::ConfigurationDescriptor* getConfigurationDescriptor(uint8_t index); /*! * @brief Return the configuration descriptor with the specified <code>bConfigurationValue</code> * @discussion This method uses getDescriptor to search for a configuration descriptor with a specific <code>bConfigurationValue</code> field. * @param bConfigurationValue Value to match * @return Pointer to the configuration descriptor if found */ virtual const StandardUSB::ConfigurationDescriptor* getConfigurationDescriptorWithValue(uint8_t bConfigurationValue); /*! * @brief Return the currently selected configuration descriptor * @discussion This method uses getDescriptor to return the configuration descriptor currently selected after a successful setConfiguration call * @return Pointer to the configuration descriptor if found, or NULL if the device is not configured */ virtual const StandardUSB::ConfigurationDescriptor* getConfigurationDescriptor(); /*! * @brief Return the capability descriptors of the device * @discussion This method uses getDescriptor to return the device's BOS descriptors * @return Pointer to the BOS descriptor if found, otherwise NULL */ virtual const StandardUSB::BOSDescriptor* getCapabilityDescriptors(); /*! * @brief Return a string descriptor from the device * @discussion This method uses getDescriptor to return a string descriptor. * @param index Descriptor index value. Low byte of <code>wValue</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * @param languageID Descriptor language ID. <code>wIndex</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * * @return Pointer to the descriptor if found */ virtual const StandardUSB::StringDescriptor* getStringDescriptor(uint8_t index, uint16_t languageID = StandardUSB::kLanguageIDEnglishUS); // Public pad slots for descriptors OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 40); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 41); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 42); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 43); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 44); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 45); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 46); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 47); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 48); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 49); protected: virtual IOReturn cacheDescriptorGated(const StandardUSB::Descriptor* descriptor, uint16_t length, uint8_t index, uint16_t languageID); struct tDescriptorSelectors { uint8_t index; uint16_t languageID; tDeviceRequestType requestType; tDeviceRequestRecipient requestRecipient; }; virtual IOReturn getDescriptorGated(uint8_t type, uint16_t& length, tDescriptorSelectors& selectors, const StandardUSB::Descriptor*& result); // Protected pad slots for descriptors OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 50); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 51); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 52); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 53); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 54); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 55); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 56); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 57); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 58); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 59); protected: bool _getDescriptorInProgress; AppleUSBDescriptorCache* _descriptorCache; #pragma mark Configuration, interface, and pipe management public: /*! @functiongroup Configuration, interface, and pipe management */ /*! * @brief Select a new configuration for the device * @discussion * This method will select a new configuration for a device. If the device was previously configured all child interfaces will be terminated prior to setting the new configuration. This method will send the SET_CONFIGURATION control request (USB 2.0 9.4.7) to the device. * This method will acquire the service's workloop lock, and may call commandSleep to perform the SET_CONFIGURATION control request. * @param bConfigurationValue Configuration to select * @param matchInterfaces If true, any interfaces within the new configuration will be registered for matching. * @return IOReturn result code */ virtual IOReturn setConfiguration(uint8_t bConfigurationValue, bool matchInterfaces = true); /*! * @brief The following method should be considered private and should not be called by function drivers. * @discussion Drivers should use <code>IOUSBHostInterface::copyPipe</code> to retrieve handles to IOUSBHostPipe objects. */ virtual IOUSBHostPipe* createPipe(const StandardUSB::EndpointDescriptor* descriptor, const StandardUSB::SuperSpeedEndpointCompanionDescriptor* companionDescriptor, IOUSBHostInterface* interface); /*! * @brief Enqueue a request on the default control endpoint * @discussion This method will enqueue an asynchronous request on the default control endpoint. If successful, the provided completion routine will be called to report the status of the completed IO. * @param forClient The service with an open session issuing the request. * @param request Reference to a valid StandardUSB::DeviceRequest structure. The structure is copied and can therefore be stack-allocated. * @param dataBuffer A void* or IOMemoryDescriptor* defining the memory to use for the request's data phase. * @param completion Pointer to a IOUSBHostCompletion structure. This will be copied and can therefore be stack-allocated. * @param completionTimeoutMs Timeout of the request in milliseconds. If 0, the request will never timeout. * @return kIOReuturnSuccess if the completion will be called in the future, otherwise error */ virtual IOReturn deviceRequest(IOService* forClient, StandardUSB::DeviceRequest& request, void* dataBuffer, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); virtual IOReturn deviceRequest(IOService* forClient, StandardUSB::DeviceRequest& request, IOMemoryDescriptor* dataBuffer, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); /*! * @brief Send a request on the default control endpoint * @discussion This method will send a synchronous request on the default control endpoint, and will not return until the request is complete. This method will acquire the service's workloop lock, and will call commandSleep to send the control request. * @param forClient The service with an open session issuing the request. * @param request Reference to a valid StandardUSB::DeviceRequest structure. * @param dataBuffer A void* or IOMemoryDescriptor* defining the memory to use for the request's data phase. * @param bytesTransferred A uint32_t reference which will be updated with the byte count of the completed data phase. * @param completionTimeoutMs Timeout of the request in milliseconds. If 0, the request will never timeout. * @return IOReturn value indicating the result of the IO request */ virtual IOReturn deviceRequest(IOService* forClient, StandardUSB::DeviceRequest& request, void* dataBuffer, uint32_t& bytesTransferred, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); virtual IOReturn deviceRequest(IOService* forClient, StandardUSB::DeviceRequest& request, IOMemoryDescriptor* dataBuffer, uint32_t& bytesTransferred, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); /*! * @brief Abort device requests made via the @link deviceRequest @/link methods by <code>forClient</code> * @discussion This method will abort any requests associated with a specific client made via the @link deviceRequest @/link methods. It will not abort requests made by other clients. * @param forClient Client which issued the requests * @param options IOUSBHostIOSource::tAbortOptions * @param withError IOReturn error value to return with the requests. The default value of kIOReturnAborted should be used. * @return IOReturn result code */ virtual IOReturn abortDeviceRequests(IOService* forClient = NULL, IOOptionBits options = IOUSBHostIOSource::kAbortAsynchronous, IOReturn withError = kIOReturnAborted); // Public pad slots for configuration, interface, and pipe management OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 60); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 61); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 62); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 63); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 64); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 65); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 66); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 67); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 68); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 69); protected: virtual IOReturn setConfigurationGated(uint8_t bConfigurationValue, bool matchInterfaces); virtual IOReturn createPipeGated(const StandardUSB::EndpointDescriptor* descriptor, const StandardUSB::SuperSpeedEndpointCompanionDescriptor* companionDescriptor, IOUSBHostInterface* interface, IOUSBHostPipe*& result); virtual IOReturn deviceRequest(IOService* forClient, StandardUSB::DeviceRequest& request, void* rawBuffer, IOMemoryDescriptor* descriptorBuffer, uint32_t& bytesTransferred, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs); virtual IOReturn internalDeviceRequest(IOService* forClient, StandardUSB::DeviceRequest& request, void* rawBuffer, IOMemoryDescriptor* descriptorBuffer, uint32_t& bytesTransferred, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs); virtual IOReturn internalDeviceRequestGated(IOUSBHostPipe::tInternalControlRequestParameters& parameters); virtual IOReturn abortDeviceRequestsGated(IOService* forClient, IOOptionBits options, IOReturn withError); virtual IOReturn getLPMExitLatencyGated(tUSBLinkState linkState, tUSBLPMExitLatency latencyType, uint32_t& latencyNs); virtual IOReturn updateLPMPolicyGated(); // Protected pad slots for configuration, interface, and pipe management OSMetaClassDeclareReservedUsed(IOUSBHostDevice, 70); OSMetaClassDeclareReservedUsed(IOUSBHostDevice, 71); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 72); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 73); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 74); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 75); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 76); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 77); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 78); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 79); #pragma mark Miscellaneous public: /*! @functiongroup Provider and state accessors */ /*! * @brief Retrieve the device's address * @return Current address of the device */ virtual tUSBHostDeviceAddress getAddress() const; /*! * @brief Retrieve the device's operational speed * @return tInternalUSBHostConnectionSpeed */ virtual uint8_t getSpeed() const; /*! * @brief Return the current frame number of the USB controller * @description This method will return the current frame number of the USB controller, omitting microframe. This is most useful for scheduling future isochronous requests. * @param theTime If not NULL, this will be updated with the current system time * @return The current frame number */ virtual uint64_t getFrameNumber(AbsoluteTime* theTime = NULL); /*! * @brief Terminate the device and attempt to reenumerate it * @discussion This function will reset and attempt to reenumerate the USB device. The current IOUSBHostDevice object and all of its children will be terminated. A new IOUSBHostDevice object will be created and registered if the reset is successful and the previous object has finished terminating. This function may not be called from the port workloop thread. * @return IOReturn result code */ virtual IOReturn reset(); /*! * @brief Return the current port status * @discussion This method will return the current port status as described by @link tUSBHostPortStatus @/link * @return port status */ virtual uint32_t getPortStatus(); /*! * @brief Allocate a buffer to be used for I/O * @discussion This method will allocate an IOBufferMemoryDescriptor optimized for use by the underlying controller hardware. A buffer allocated by this method will not be bounced to perform DMA operations. * @param options kIODirectionOut, kIODirectionIn to set the direction of the I/O transfer. * @param capacity Size of the buffer to allocate * @return Pointer to an IOBufferMemoryDescriptor if successful, otherwise NULL */ virtual IOBufferMemoryDescriptor* createIOBuffer(IOOptionBits options, mach_vm_size_t capacity); /*! * @brief Calculate desired USB LPM Exit Latency * @discussion This method can be called to get various USB LPM Exit Latencies * @param linkState The link state we want to exit from * @param latencyType Desired type of Exit Latency to be calculated * @param latencyNs Calculated Exit Latency value in Nanoseconds * @return IOReturn result code */ virtual IOReturn getLPMExitLatency(tUSBLinkState linkState, tUSBLPMExitLatency latencyType, uint32_t& latencyNs); // Public pad slots for miscellaneous OSMetaClassDeclareReservedUsed(IOUSBHostDevice, 80); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 81); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 82); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 83); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 84); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 85); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 86); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 87); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 88); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 89); protected: // Protected pad slots for miscellaneous OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 90); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 91); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 92); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 93); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 94); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 95); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 96); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 97); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 98); OSMetaClassDeclareReservedUnused(IOUSBHostDevice, 99); #if TARGET_OS_HAS_USBDRIVERKIT_IOUSBHOSTDEVICE static void asyncDeviceRequestCompletionCallback(void *owner, void *parameter, IOReturn status, uint32_t bytesTransferred); #endif protected: enum { kClientsDefaultCapacity = 16, kPowerChildrenDefaultCapacity = 16, kSetConfigurationIORetries = 3, kSetConfigurationIORetryInterval = 100 }; AppleUSBHostRequestCompleter* _requestCompleter; AppleUSBHostDeviceIdler* _deviceIdler; tUSBHostDeviceAddress _address; IOUSBHostPipe* _pipeZero; UInt8 _speed; StandardUSB::EndpointDescriptor _endpointZero; IOBufferMemoryDescriptor** _configList; uint32_t _configListCount; uint8_t _currentConfigValue; bool _setConfigurationInProgress; uint32_t _configurationBusCurrent; // mA uint32_t _allocatedWakeBusCurrent; // mA uint32_t _allocatedSleepBusCurrent;// mA uint32_t _pendingCloseCount; uint32_t _debugLoggingMask; uint32_t _locationID; struct tExpansionData { IOTimerEventSource* _lifecycleTimer; OSDictionary* _lpmLatencyCache; tUSBDeviceLPMStatus _lpmU1Status; tUSBDeviceLPMStatus _lpmU2Status; tUSBDeviceLPMStatus _lpmL1Status; OSDictionary* _dkInterfaceIteratorDict; uintptr_t _dkInterfaceInteratorRefID; }; tExpansionData* _expansionData; private: enum { kForcePowerTimeoutMs = 1000ULL, // Milliseconds kSuspendDeviceTimeout = 1000ULL, // Milliseconds kTerminationTimeout = 5000ULL, // Milliseconds kDeviceAddressInvalid = 0xffff }; }; #endif // IOUSBHostFamily_IOUSBHostDevice_h
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/AppleUSBDefinitions.h
/* * Copyright (c) 1998-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef AppleUSBCommon_AppleUSBDefinitions_h #define AppleUSBCommon_AppleUSBDefinitions_h #include <TargetConditionals.h> #if TARGET_OS_DRIVERKIT #include <stdint.h> #include <stddef.h> #include <sys/_types/_uuid_t.h> #include <DriverKit/IOTypes.h> #include <DriverKit/IOLib.h> #else #include <IOKit/IOTypes.h> #include <libkern/OSByteOrder.h> #endif #ifndef IOUSBBit #define IOUSBBit(bit) ((uint32_t)(1) << bit) #endif #ifndef IOUSBBitRange #define IOUSBBitRange(start, end) (~(((uint32_t)(1) << start) - 1) & (((uint32_t)(1) << end) | (((uint32_t)(1) << end) - 1))) #endif #ifndef IOUSBBitRange64 #define IOUSBBitRange64(start, end) (~(((uint64_t)(1) << start) - 1) & (((uint64_t)(1) << end) | (((uint64_t)(1) << end) - 1))) #endif #ifndef IOUSBBitRangePhase #define IOUSBBitRangePhase(start, end) (start) #endif #ifndef USBToHost16 #define USBToHost16 OSSwapLittleToHostInt16 #endif #ifndef HostToUSB16 #define HostToUSB16 OSSwapHostToLittleInt16 #endif #ifndef USBToHost32 #define USBToHost32 OSSwapLittleToHostInt32 #endif #ifndef HostToUSB32 #define HostToUSB32 OSSwapHostToLittleInt32 #endif #ifndef USBToHost64 #define USBToHost64 OSSwapLittleToHostInt64 #endif #ifndef HostToUSB64 #define HostToUSB64 OSSwapHostToLittleInt64 #endif #define kIOUSB30Bitrate5Gbps ( 5 * 1000 * 1000 * 1000ULL) #define kIOUSB30Bitrate10Gbps (10 * 1000 * 1000 * 1000ULL) #define kIOUSB32Bitrate20Gbps (20 * 1000 * 1000 * 1000ULL) /*! * @enum kIOUSBAppleVendorID * @discussion Apple's vendor ID, assigned by the USB-IF */ enum { kIOUSBAppleVendorID = 0x05AC }; #pragma mark Descriptor definitions /*! * @enum tIOUSBDescriptorType * @brief Descriptor types defined by USB 2.0 Table 9-5 and USB 3.0 Table 9-6 */ enum tIOUSBDescriptorType { kIOUSBDescriptorTypeDevice = 1, kIOUSBDescriptorTypeConfiguration = 2, kIOUSBDescriptorTypeString = 3, kIOUSBDescriptorTypeInterface = 4, kIOUSBDescriptorTypeEndpoint = 5, kIOUSBDescriptorTypeDeviceQualifier = 6, kIOUSBDescriptorTypeOtherSpeedConfiguration = 7, kIOUSBDescriptorTypeInterfacePower = 8, kIOUSBDescriptorTypeOTG = 9, kIOUSBDescriptorTypeDebug = 10, kIOUSBDescriptorTypeInterfaceAssociation = 11, kIOUSBDescriptorTypeBOS = 15, kIOUSBDescriptorTypeDeviceCapability = 16, kIOUSBDecriptorTypeHID = 33, kIOUSBDecriptorTypeReport = 34, kIOUSBDescriptorTypePhysical = 35, kIOUSBDescriptorTypeHub = 41, kIOUSBDescriptorTypeSuperSpeedHub = 42, kIOUSBDescriptorTypeSuperSpeedUSBEndpointCompanion = 48, kIOUSBDescriptorTypeSuperSpeedPlusIsochronousEndpointCompanion = 49 }; typedef enum tIOUSBDescriptorType tIOUSBDescriptorType; /*! * @enum tIOUSBDescriptorSize * @brief Size in bytes for descriptor structures */ enum tIOUSBDescriptorSize { kIOUSBDescriptorHeaderSize = 2, kIOUSBDescriptorSizeDevice = 18, kIOUSBDescriptorSizeConfiguration = 9, kIOUSBDescriptorSizeInterface = 9, kIOUSBDescriptorSizeEndpoint = 7, kIOUSBDescriptorSizeStringMinimum = kIOUSBDescriptorHeaderSize, kIOUSBDescriptorSizeStringMaximum = 255, kIOUSBDescriptorSizeDeviceQualifier = 10, kIOUSBDescriptorSizeInterfaceAssociation = 8, kIOUSBDescriptorSizeBOS = 5, kIOUSBDescriptorSizeDeviceCapability = 3, kIOUSBDescriptorSizeUSB20ExtensionCapability = 7, kIOUSBDescriptorSizeSuperSpeedUSBDeviceCapability = 10, kIOUSBDescriptorSizeContainerIDCapability = 20, kIOUSBDescriptorSizeHubMinimum = 9, kIOUSBDescriptorSizeHubMaximum = 21, kIOUSBDescriptorSizeSuperSpeedHub = 12, kIOUSBDescriptorSizeSuperSpeedUSBEndpointCompanion = 6, kIOUSBDescriptorSizeSuperSpeedPlusIsochronousEndpointCompanion = 8, kIOUSBDescriptorSizeBillboardDeviceMinimum = 44, kIOUSBDescriptorSizeBillboardDeviceMaximum = 256, kIOUSBDescriptorSizePlatformECIDCapability = 28, kIOUSBDescriptorSizePlatformCapability = 20 }; typedef enum tIOUSBDescriptorSize tIOUSBDescriptorSize; /*! * @struct IOUSBDescriptorHeader * @brief Base descriptor defined by USB 2.0 9.5 * @discussion IOUSBDescriptorDefinitions declares structs to represent a variety of USB standard * descriptors. */ struct IOUSBDescriptorHeader { uint8_t bLength; uint8_t bDescriptorType; } __attribute__((packed)); typedef struct IOUSBDescriptorHeader IOUSBDescriptorHeader; /*! * @brief Base descriptor defined by USB 2.0 9.5 * @discussion Used to represent generic descriptor definitions */ typedef IOUSBDescriptorHeader IOUSBDescriptor; /*! * @typedef IOUSBDeviceDescriptor * @discussion Descriptor for a USB Device. * See the USB Specification at <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. */ struct IOUSBDeviceDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t bcdUSB; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; uint8_t bMaxPacketSize0; uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; uint8_t iManufacturer; uint8_t iProduct; uint8_t iSerialNumber; uint8_t bNumConfigurations; } __attribute__((packed)); typedef struct IOUSBDeviceDescriptor IOUSBDeviceDescriptor; /*! * @typedef IOUSBDeviceQualifierDescriptor * @discussion USB Device Qualifier Descriptor. * See the USB Specification at <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 2.0 9.6.2: Device Qualifier */ struct IOUSBDeviceQualifierDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t bcdUSB; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; uint8_t bMaxPacketSize0; uint8_t bNumConfigurations; uint8_t bReserved; } __attribute__((packed)); typedef struct IOUSBDeviceQualifierDescriptor IOUSBDeviceQualifierDescriptor; /*! * @typedef IOUSBConfigurationDescHeader * @discussion Header of a IOUSBConfigurationDescriptor. Used to get the total length of the descriptor. * USB 2.0 9.6.3: Configuration */ struct IOUSBConfigurationDescHeader { uint8_t bLength; uint8_t bDescriptorType; uint16_t wTotalLength; } __attribute__((packed)); typedef struct IOUSBConfigurationDescHeader IOUSBConfigurationDescHeader; /*! * @typedef IOUSBConfigurationDescriptor * @discussion Standard USB Configuration Descriptor. It is variable length, so this only specifies * the known fields. We use the wTotalLength field to read the whole descriptor. * See the USB Specification at <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 2.0 9.6.3: Configuration */ struct IOUSBConfigurationDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t wTotalLength; uint8_t bNumInterfaces; uint8_t bConfigurationValue; uint8_t iConfiguration; uint8_t bmAttributes; uint8_t MaxPower; } __attribute__((packed)); typedef struct IOUSBConfigurationDescriptor IOUSBConfigurationDescriptor; enum { kIOUSBConfigurationDescriptorAttributeRemoteWakeCapable = IOUSBBit(5), kIOUSBConfigurationDescriptorAttributeSelfPowered = IOUSBBit(6) }; /*! * @typedef IOUSBInterfaceDescriptor * @discussion Descriptor for a USB Interface. See the USB Specification at * <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 2.0 9.6.5: Interface */ struct IOUSBInterfaceDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bInterfaceNumber; uint8_t bAlternateSetting; uint8_t bNumEndpoints; uint8_t bInterfaceClass; uint8_t bInterfaceSubClass; uint8_t bInterfaceProtocol; uint8_t iInterface; } __attribute__((packed)); typedef struct IOUSBInterfaceDescriptor IOUSBInterfaceDescriptor; /*! * @typedef IOUSBEndpointDescriptor * @discussion Descriptor for a USB Endpoint. See the USB Specification at * <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 2.0 9.6.6: Endpoint */ struct IOUSBEndpointDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bEndpointAddress; uint8_t bmAttributes; uint16_t wMaxPacketSize; uint8_t bInterval; } __attribute__((packed)); typedef struct IOUSBEndpointDescriptor IOUSBEndpointDescriptor; enum { kIOUSBEndpointDescriptorNumber = IOUSBBitRange(0, 3), kIOUSBEndpointDescriptorNumberPhase = IOUSBBitRangePhase(0, 3), kIOUSBEndpointDescriptorEndpointAddressReserved = IOUSBBitRange(4, 6), kIOUSBEndpointDescriptorDirection = IOUSBBit(7), kIOUSBEndpointDescriptorDirectionPhase = IOUSBBitRangePhase(7, 7), kIOUSBEndpointDescriptorDirectionOut = 0, kIOUSBEndpointDescriptorDirectionIn = IOUSBBit(7), kIOUSBEndpointDescriptorTransferType = IOUSBBitRange(0, 1), kIOUSBEndpointDescriptorTransferTypePhase = IOUSBBitRangePhase(0, 1), kIOUSBEndpointDescriptorTransferTypeControl = (0 << IOUSBBitRangePhase(0, 1)), kIOUSBEndpointDescriptorTransferTypeIsochronous = (1 << IOUSBBitRangePhase(0, 1)), kIOUSBEndpointDescriptorTransferTypeBulk = (2 << IOUSBBitRangePhase(0, 1)), kIOUSBEndpointDescriptorTransferTypeInterrupt = (3 << IOUSBBitRangePhase(0, 1)), kIOUSBEndpointDescriptorSynchronizationType = IOUSBBitRange(2, 3), kIOUSBEndpointDescriptorSynchronizationTypePhase = IOUSBBitRangePhase(2, 3), kIOUSBEndpointDescriptorSynchronizationTypeNone = (0 << IOUSBBitRangePhase(2, 3)), kIOUSBEndpointDescriptorSynchronizationTypeAsynchronous = (1 << IOUSBBitRangePhase(2, 3)), kIOUSBEndpointDescriptorSynchronizationTypeAdaptive = (2 << IOUSBBitRangePhase(2, 3)), kIOUSBEndpointDescriptorSynchronizationTypeSynchronous = (3 << IOUSBBitRangePhase(2, 3)), kIOUSBEndpointDescriptorUsageType = IOUSBBitRange(4, 5), kIOUSBEndpointDescriptorUsageTypePhase = IOUSBBitRangePhase(4, 5), kIOUSBEndpointDescriptorUsageTypeInterruptPeriodic = (0 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorUsageTypeInterruptNotification = (1 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorUsageTypeInterruptReserved1 = (2 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorUsageTypeInterruptReserved2 = (3 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorUsageTypeIsocData = (0 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorUsageTypeIsocFeedback = (1 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorUsageTypeIsocImplicit = (2 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorUsageTypeIsocReserved = (3 << IOUSBBitRangePhase(4, 5)), kIOUSBEndpointDescriptorPacketSize = IOUSBBitRange(0, 10), kIOUSBEndpointDescriptorPacketSizePhase = IOUSBBitRangePhase(0, 10), kIOUSBEndpointDescriptorPacketSizeMult = IOUSBBitRange(11, 12), kIOUSBEndpointDescriptorPacketSizeMultPhase = IOUSBBitRangePhase(11, 12), kIOUSBEndpointDescriptorReserved = IOUSBBitRange(13, 15), kIOUSBEndpointDescriptorReservedPhase = IOUSBBitRangePhase(13, 15) }; /*! * @enum tIOUSBEndpointDirection * @brief IO Direction of an endpoint * @constant kIOUSBEndpointDirectionOut endpoint direction is host-to-device * @constant kIOUSBEndpointDirectionIn endpoint direction is device-to-host * @constant kIOUSBEndpointDirectionUnknown the direction is unknown */ enum tIOUSBEndpointDirection { kIOUSBEndpointDirectionOut = (kIOUSBEndpointDescriptorDirectionOut >> kIOUSBEndpointDescriptorDirectionPhase), kIOUSBEndpointDirectionIn = (kIOUSBEndpointDescriptorDirectionIn >> kIOUSBEndpointDescriptorDirectionPhase), kIOUSBEndpointDirectionUnknown = 2 }; typedef enum tIOUSBEndpointDirection tIOUSBEndpointDirection; /*! * @enum tIOUSBEndpointType * @brief Describes the type of endpoint * @constant kIOUSBEndpointTypeControl endpoint is a control endpoint * @constant kIOUSBEndpointTypeIsochronous endpoint is an isochronous endpoint * @constant kIOUSBEndpointTypeBulk is a bulk endpoint * @constant kIOUSBEndpointTypeInterrupt is an interrupt endpoint */ enum tIOUSBEndpointType { kIOUSBEndpointTypeControl = (kIOUSBEndpointDescriptorTransferTypeControl >> kIOUSBEndpointDescriptorTransferTypePhase), kIOUSBEndpointTypeIsochronous = (kIOUSBEndpointDescriptorTransferTypeIsochronous >> kIOUSBEndpointDescriptorTransferTypePhase), kIOUSBEndpointTypeBulk = (kIOUSBEndpointDescriptorTransferTypeBulk >> kIOUSBEndpointDescriptorTransferTypePhase), kIOUSBEndpointTypeInterrupt = (kIOUSBEndpointDescriptorTransferTypeInterrupt >> kIOUSBEndpointDescriptorTransferTypePhase) }; typedef enum tIOUSBEndpointType tIOUSBEndpointType; enum tIOUSBEndpointSynchronizationType { kIOUSBEndpointSynchronizationTypeNone = (kIOUSBEndpointDescriptorSynchronizationTypeNone >> kIOUSBEndpointDescriptorSynchronizationTypePhase), kIOUSBEndpointSynchronizationTypeAsynchronous = (kIOUSBEndpointDescriptorSynchronizationTypeAsynchronous >> kIOUSBEndpointDescriptorSynchronizationTypePhase), kIOUSBEndpointSynchronizationTypeAdaptive = (kIOUSBEndpointDescriptorSynchronizationTypeAdaptive >> kIOUSBEndpointDescriptorSynchronizationTypePhase), kIOUSBEndpointSynchronizationTypeSynchronous = (kIOUSBEndpointDescriptorSynchronizationTypeSynchronous >> kIOUSBEndpointDescriptorSynchronizationTypePhase) }; typedef enum tIOUSBEndpointSynchronizationType tIOUSBEndpointSynchronizationType; enum tIOUSBEndpointUsageType { kIOUSBEndpointUsageTypeIsocData = (kIOUSBEndpointDescriptorUsageTypeIsocData >> kIOUSBEndpointDescriptorUsageTypePhase), kIOUSBEndpointUsageTypeIsocFeedback = (kIOUSBEndpointDescriptorUsageTypeIsocFeedback >> kIOUSBEndpointDescriptorUsageTypePhase), kIOUSBEndpointUsageTypeIsocImplicit = (kIOUSBEndpointDescriptorUsageTypeIsocImplicit >> kIOUSBEndpointDescriptorUsageTypePhase) }; typedef enum tIOUSBEndpointUsageType tIOUSBEndpointUsageType; /*! * @enum tIOUSBLanguageID * @brief USB Language Identifiers 1.0 */ enum tIOUSBLanguageID { kIOUSBLanguageIDEnglishUS = 0x0409 }; typedef enum tIOUSBLanguageID tIOUSBLanguageID; /*! * @typedef IOUSBStringDescriptor * @discussion Descriptor for a USB Strings. See the USB Specification at * <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 2.0 9.6.7: String */ struct IOUSBStringDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bString[1]; } __attribute__((packed)); typedef struct IOUSBStringDescriptor IOUSBStringDescriptor; enum tIOUSBDeviceCapabilityType { // USB 3.0 Table 9-13 kIOUSBDeviceCapabilityTypeWireless = 1, kIOUSBDeviceCapabilityTypeUSB20Extension = 2, kIOUSBDeviceCapabilityTypeSuperSpeed = 3, kIOUSBDeviceCapabilityTypeContainerID = 4, // USB 3.1 Table 9-14 kIOUSBDeviceCapabilityTypePlatform = 5, kIOUSBDeviceCapabilityTypePowerDelivery = 6, kIOUSBDeviceCapabilityTypeBatteryInfo = 7, kIOUSBDeviceCapabilityTypePdConsumerPort = 8, kIOUSBDeviceCapabilityTypePdProviderPort = 9, kIOUSBDeviceCapabilityTypeSuperSpeedPlus = 10, kIOUSBDeviceCapabilityTypePrecisionMeasurement = 11, kIOUSBDeviceCapabilityTypeWirelessExt = 12, kIOUSBDeviceCapabilityTypeBillboard = 13, kIOUSBDeviceCapabilityTypeBillboardAltMode = 15 }; typedef enum tIOUSBDeviceCapabilityType tIOUSBDeviceCapabilityType; /*! * @typedef IOUSBBOSDescriptor * @discussion USB BOS descriptor. See the USB Specification at * <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 3.0 9.6.2: Binary Device Object Store (BOS) */ struct IOUSBBOSDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t wTotalLength; uint8_t bNumDeviceCaps; } __attribute__((packed)); typedef struct IOUSBBOSDescriptor IOUSBBOSDescriptor; /*! * @typedef IOUSBDeviceCapabilityDescriptorHeader * @discussion Device Capability descriptor. See the USB Specification at * <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 3.0 9.6.2: Binary Device Object Store (BOS) */ struct IOUSBDeviceCapabilityDescriptorHeader { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilityDescriptorHeader IOUSBDeviceCapabilityDescriptorHeader; /*! * @typedef IOUSBDeviceCapabilityUSB2Extension * @discussion Device Capability USB 2.0 Extension. * USB 3.0 9.6.2.1: USB 2.0 Extension */ struct IOUSBDeviceCapabilityUSB2Extension { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint32_t bmAttributes; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilityUSB2Extension IOUSBDeviceCapabilityUSB2Extension; enum { kIOUSBUSB20ExtensionCapabilityLPM = IOUSBBit(1), // From USB 2.0 ECN Errata for Link Power Management. kIOUSBUSB20ExtensionCapabilityBESLSupport = IOUSBBit(2), kIOUSBUSB20ExtensionCapabilityBESLValid = IOUSBBit(3), kIOUSBUSB20ExtensionCapabilityBESLDValid = IOUSBBit(4), kIOUSBUSB20ExtensionCapabilityBESL = IOUSBBitRange(8, 11), kIOUSBUSB20ExtensionCapabilityBESLPhase = IOUSBBitRangePhase(8, 11), kIOUSBUSB20ExtensionCapabilityBESLD = IOUSBBitRange(12, 15), kIOUSBUSB20ExtensionCapabilityBESLDPhase = IOUSBBitRangePhase(12, 15) }; /*! * @typedef IOUSBDeviceCapabilitySuperSpeedUSB * @discussion Device Capability SuperSpeed USB. USB 3.0 9.6.2.2: SuperSpeed USB Device Capability */ struct IOUSBDeviceCapabilitySuperSpeedUSB { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint8_t bmAttributes; uint16_t wSpeedsSupported; uint8_t bFunctionalitySupport; uint8_t bU1DevExitLat; uint16_t wU2DevExitLat; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilitySuperSpeedUSB IOUSBDeviceCapabilitySuperSpeedUSB; enum { kIOUSBSuperSpeedDeviceCapabilityLTM = IOUSBBit(1), kIOUSBSuperSpeedDeviceCapabilityLowSpeed = IOUSBBit(0), kIOUSBSuperSpeedDeviceCapabilityFullSpeed = IOUSBBit(1), kIOUSBSuperSpeedDeviceCapabilityHighSpeed = IOUSBBit(2), kIOUSBSuperSpeedDeviceCapability5Gb = IOUSBBit(3), kIOUSBSuperSpeedDeviceCapabilitySupportLowSpeed = 0, kIOUSBSuperSpeedDeviceCapabilitySupportFullSpeed = 1, kIOUSBSuperSpeedDeviceCapabilitySupportHighSpeed = 2, kIOUSBSuperSpeedDeviceCapabilitySupport5Gb = 3, kIOUSBSuperSpeedDeviceCapabilityU1DevExitLatMax = 0xa, kIOUSBSuperSpeedDeviceCapabilityU2DevExitLatMax = 0x7ff }; /*! * @typedef IOUSBDeviceCapabilitySuperSpeedPlusUSB * @discussion Device Capability SuperSpeedPlus USB. * USB 3.1 9.6.2.5: SuperSpeedPlus USB Device Capability */ struct IOUSBDeviceCapabilitySuperSpeedPlusUSB { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint8_t bReserved; uint32_t bmAttributes; uint16_t wFunctionalitySupport; uint16_t wReserved; uint32_t bmSublinkSpeedAttr[]; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilitySuperSpeedPlusUSB IOUSBDeviceCapabilitySuperSpeedPlusUSB; enum { //bmAttributes kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedAttrCount = IOUSBBitRange(0, 4), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedAttrCountPhase = IOUSBBitRangePhase(0, 4), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedIdCount = IOUSBBitRange(5, 8), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedIdCountPhase = IOUSBBitRangePhase(5, 8), //wFunctionalitySupport kIOUSBSuperSpeedPlusDeviceCapabilitySublinkMinSpeedId = IOUSBBitRange(0, 3), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkMinSpeedIdPhase = IOUSBBitRangePhase(0, 3), kIOUSBSuperSpeedPlusDeviceCapabilityReserved = IOUSBBitRange(4, 7), kIOUSBSuperSpeedPlusDeviceCapabilityReservedPhase = IOUSBBitRangePhase(4, 7), kIOUSBSuperSpeedPlusDeviceCapabilityMinRxLaneCount = IOUSBBitRange(8, 11), kIOUSBSuperSpeedPlusDeviceCapabilityMinRxLaneCountPhase = IOUSBBitRangePhase(8, 11), kIOUSBSuperSpeedPlusDeviceCapabilityMinTxLaneCount = IOUSBBitRange(12, 15), kIOUSBSuperSpeedPlusDeviceCapabilityMinTxLaneCountPhase = IOUSBBitRangePhase(12, 15), //bmSublinkSpeedAttr kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedId = IOUSBBitRange(0, 3), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedIdPhase = IOUSBBitRangePhase(0, 3), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSE = IOUSBBitRange(4, 5), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEPhase = IOUSBBitRangePhase(4, 5), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEBits = (0 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEKbits = (1 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEMbits = (2 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEGbits = (3 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkLSEPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkType = IOUSBBitRange(6, 7), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkTypePhase = IOUSBBitRangePhase(6, 7), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetry = IOUSBBit(6), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetryPhase = IOUSBBitRangePhase(6, 6), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetric = (0 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetryPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkAsymmetric = (1 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSymmetryPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirection = IOUSBBit(7), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionPhase = IOUSBBitRangePhase(7, 7), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionRx = (0 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionTx = (1 << kIOUSBSuperSpeedPlusDeviceCapabilitySublinkDirectionPhase), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkReserved = IOUSBBitRange(8, 13), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkReservedPhase = IOUSBBitRangePhase(8, 13), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkProtocol = IOUSBBitRange(14, 15), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkProtocolPhase = IOUSBBitRangePhase(14, 15), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedMantissa = IOUSBBitRange(16, 31), kIOUSBSuperSpeedPlusDeviceCapabilitySublinkSpeedMantissaPhase = IOUSBBitRangePhase(16, 31), }; /*! * @typedef IOUSBDeviceCapabilityContainerID * @discussion Device Capability Container ID. * USB 3.0 9.6.2.3: Container ID */ struct IOUSBDeviceCapabilityContainerID { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint8_t bReservedID; uint8_t containerID[16]; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilityContainerID IOUSBDeviceCapabilityContainerID; /*! * @typedef IOUSBPlatformCapabilityDescriptor * @discussion Device Capability Platform Descriptor. * USB 3.1 9.6.2.4: Platform Descriptor */ struct IOUSBPlatformCapabilityDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint8_t bReserved; uuid_t PlatformCapabilityUUID; } __attribute__((packed)); typedef struct IOUSBPlatformCapabilityDescriptor IOUSBPlatformCapabilityDescriptor; /*! * @typedef IOUSBDeviceCapabilityBillboardAltConfig * @discussion Device Capability Billboard Alternate Setting Info. * USB Billboard 3.1.6.2: Billboard Capability Descriptor V1.2 */ struct IOUSBDeviceCapabilityBillboardAltConfigCompatibility { uint16_t wSVID; uint32_t dwAlternateMode; uint8_t iAlternateModeString; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilityBillboardAltConfigCompatibility IOUSBDeviceCapabilityBillboardAltConfigCompatibility; /*! * @typedef IOUSBDeviceCapabilityBillboardAltConfig * @discussion Device Capability Billboard Alternate Setting Info. * USB Billboard 3.1.6.2: Billboard Capability Descriptor V1.1 and 1.21+ */ struct IOUSBDeviceCapabilityBillboardAltConfig { uint16_t wSVID; uint8_t bAltenateMode; uint8_t iAlternateModeString; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilityBillboardAltConfig IOUSBDeviceCapabilityBillboardAltConfig; /*! * @typedef IOUSBDeviceCapabilityBillboard * @discussion Device Capability Billboard. * USB Billboard 3.1.6.2: Billboard Capability Descriptor */ struct IOUSBDeviceCapabilityBillboard { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint8_t iAdditionalInfoURL; uint8_t bNumberOfAlternateModes; uint8_t bPreferredAlternateMode; uint16_t vCONNPower; uint8_t bmConfigured[32]; uint16_t bcdVersion; uint8_t bAdditionalFailureInfo; uint8_t bReserved; IOUSBDeviceCapabilityBillboardAltConfig pAltConfigurations[]; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilityBillboard IOUSBDeviceCapabilityBillboard; /*! * @typedef IOUSBDeviceCapabilityBillboardAltMode * @discussion Device Capability Billboard Alternate mode. * USB Billboard 3.1.6.3: Billboard Capability Descriptor V1.21 */ struct IOUSBDeviceCapabilityBillboardAltMode { uint8_t bLength; uint8_t bDescriptorType; uint8_t bDevCapabilityType; uint8_t bIndex; uint16_t dwAlternateModeVdo; } __attribute__((packed)); typedef struct IOUSBDeviceCapabilityBillboardAltMode IOUSBDeviceCapabilityBillboardAltMode; /*! * @typedef IOUSBInterfaceAssociationDescriptor * @discussion USB Inerface Association Descriptor. ECN to the USB 2.0 Spec. * See the USB Specification at <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. * USB 3.0 9.6.4: Interface Association */ struct IOUSBInterfaceAssociationDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bFirstInterface; uint8_t bInterfaceCount; uint8_t bFunctionClass; uint8_t bFunctionSubClass; uint8_t bFunctionProtocol; uint8_t iFunction; } __attribute__((packed)); typedef struct IOUSBInterfaceAssociationDescriptor IOUSBInterfaceAssociationDescriptor; /*! * @typedef IOUSBSuperSpeedEndpointCompanionDescriptor * @discussion Descriptor for a SuperSpeed USB Endpoint Companion. * See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. * USB 3.1 9.6.7: SuperSpeed Endpoint Companion */ struct IOUSBSuperSpeedEndpointCompanionDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bMaxBurst; uint8_t bmAttributes; uint16_t wBytesPerInterval; } __attribute__((packed)); typedef struct IOUSBSuperSpeedEndpointCompanionDescriptor IOUSBSuperSpeedEndpointCompanionDescriptor; enum { kIOUSBSuperSpeedEndpointCompanionDescriptorMaxBurst = IOUSBBitRange(0, 4), kIOUSBSuperSpeedEndpointCompanionDescriptorMaxBurstPhase = IOUSBBitRangePhase(0, 4), kIOUSBSuperSpeedEndpointCompanionDescriptorBulkMaxStreams = IOUSBBitRange(0, 4), kIOUSBSuperSpeedEndpointCompanionDescriptorBulkMaxStreamsPhase = IOUSBBitRangePhase(0, 4), kIOUSBSuperSpeedEndpointCompanionDescriptorBulkReserved = IOUSBBitRange(5, 7), kIOUSBSuperSpeedEndpointCompanionDescriptorBulkReservedPhase = IOUSBBitRangePhase(5, 7), kIOUSBSuperSpeedEndpointCompanionDescriptorIsocMult = IOUSBBitRange(0, 1), kIOUSBSuperSpeedEndpointCompanionDescriptorIsocMultPhase = IOUSBBitRangePhase(0, 1), kIOUSBSuperSpeedEndpointCompanionDescriptorIsocReserved = IOUSBBitRange(2, 6), kIOUSBSuperSpeedEndpointCompanionDescriptorIsocReservedPhase = IOUSBBitRangePhase(2, 6), kIOUSBSuperSpeedEndpointCompanionDescriptorSSPIsocCompanion = IOUSBBit(7) }; /*! * @typedef IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor * @discussion Descriptor for a SuperSpeedPlus Isochronout USB Endpoint Companion. * See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. * USB 3.1 9.6.8: SuperSpeedPlus Isochronous Endpoint Companion */ struct IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint16_t wReserved; uint32_t dwBytesPerInterval; } __attribute__((packed)); typedef struct IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor; /*! * @typedef IOUSB20HubDescriptor * @discussion Descriptor for a USB hub. * See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. * USB 2.0 11.23.2.1: Hub Descriptor */ struct IOUSB20HubDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bNumberPorts; uint16_t wHubCharacteristics; uint8_t bPowerOnToPowerGood; uint8_t bHubControllerCurrent; uint8_t deviceRemovable[2]; // Technically variable size uint8_t reserved[2]; // Unused } __attribute__((packed)); typedef struct IOUSB20HubDescriptor IOUSB20HubDescriptor; /*! * @typedef IOUSBSuperSpeedHubDescriptor * @discussion Descriptor for a Super Speed USB hub. * See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. * USB 3.0 10.13.2.1: SuperSpeed Hub Descriptor */ struct IOUSBSuperSpeedHubDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bNumberPorts; uint16_t wHubCharacteristics; uint8_t bPowerOnToPowerGood; uint8_t bHubControllerCurrent; uint8_t bHubDecodeLatency; uint16_t wHubDelay; uint16_t deviceRemovable; } __attribute__((packed)); typedef struct IOUSBSuperSpeedHubDescriptor IOUSBSuperSpeedHubDescriptor; enum { kIOUSBSuperSpeedHubCharacteristicsPowerSwitchingMask = IOUSBBitRange(0, 1), kIOUSBSuperSpeedHubCharacteristicsPowerSwitchingGanged = (0 << IOUSBBitRangePhase(0, 1)), kIOUSBSuperSpeedHubCharacteristicsPowerSwitchingIndividual = (1 << IOUSBBitRangePhase(0, 1)), kIOUSBSuperSpeedHubCharacteristicsCompoundDevice = IOUSBBit(2), kIOUSBSuperSpeedHubCharacteristicsOverCurrentMask = IOUSBBitRange(3, 4), kIOUSBSuperSpeedHubCharacteristicsOverCurrentGlobal = (0 << IOUSBBitRangePhase(3, 4)), kIOUSBSuperSpeedHubCharacteristicsOverCurrentIndividual = (1 << IOUSBBitRangePhase(3, 4)), kIOUSBSuperSpeedHubCharacteristicsReserved = IOUSBBitRange(5, 15), kIOUSBSuperSpeedHubDecodeLatencyMax = 10, kIOUSBSuperSpeedHubDelayMax = 400 }; /*! * @typedef UASPipeDescriptor * @discussion Structure used to specify the Mass Storage Specific UAS pipe usage descriptor */ struct UASPipeDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bPipeID; uint8_t bReserved; } __attribute__((packed)); typedef struct UASPipeDescriptor UASPipeDescriptor; /*! * @typedef IOUSBHIDDescriptor * @discussion USB HID Descriptor. See the USB HID Specification at * <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. */ struct IOUSBHIDDescriptor { uint8_t descLen; uint8_t descType; uint16_t descVersNum; uint8_t hidCountryCode; uint8_t hidNumDescriptors; uint8_t hidDescriptorType; uint8_t hidDescriptorLengthLo; uint8_t hidDescriptorLengthHi; } __attribute__((packed)); typedef struct IOUSBHIDDescriptor IOUSBHIDDescriptor; /*! * @typedef IOUSBHIDReportDesc * @discussion USB HID Report Descriptor header. See the USB HID Specification at * <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. */ struct IOUSBHIDReportDesc { uint8_t hidDescriptorType; uint8_t hidDescriptorLengthLo; uint8_t hidDescriptorLengthHi; } __attribute__((packed)); typedef struct IOUSBHIDReportDesc IOUSBHIDReportDesc; /*! * @typedef IOUSBDFUDescriptor * @discussion USB Device Firmware Update Descriptor. See the USB Device Firmware Update * Specification at <a href="http://www.usb.org" target="_blank">http://www.usb.org</a>. */ struct IOUSBDFUDescriptor { uint8_t bLength; uint8_t bDescriptorType; uint8_t bmAttributes; uint16_t wDetachTimeout; uint16_t wTransferSize; } __attribute__((packed)); typedef struct IOUSBDFUDescriptor IOUSBDFUDescriptor; #pragma mark Device requests /*! * @typedef IOUSBDeviceRequest * @discussion Standard device request. * See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. * USB 2.0 9.3: USB Device Requests */ struct IOUSBDeviceRequest { uint8_t bmRequestType; uint8_t bRequest; uint16_t wValue; uint16_t wIndex; uint16_t wLength; } __attribute__((packed)); typedef struct IOUSBDeviceRequest IOUSBDeviceRequest; /*! * @typedef IOUSBDeviceRequestSetSELData * @discussion See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. * USB 3.0 9.4.12: Set SEL Standard Device Request */ struct IOUSBDeviceRequestSetSELData { uint8_t u1Sel; // Time in μs for U1 System Exit Latency uint8_t u1Pel; // Time in μs for U1 Device to Host Exit Latency uint16_t u2Sel; // Time in μs for U2 System Exit Latency uint16_t u2Pel; // Time in μs for U2 Device to Host Exit Latency } __attribute__((packed)); typedef struct IOUSBDeviceRequestSetSELData IOUSBDeviceRequestSetSELData; /*! * @enum tIOUSBDeviceRequestDirectionValue * @brief Values of 'direction' field of a device request * @constant kIOUSBDeviceRequestDirectionValueOut the device request data phase direction is host-to-device * @constant kIOUSBDeviceRequestDirectionValueIn the device request data phase direction is device-to-host */ enum tIOUSBDeviceRequestDirectionValue { kIOUSBDeviceRequestDirectionValueOut = 0, kIOUSBDeviceRequestDirectionValueIn = 1 }; typedef enum tIOUSBDeviceRequestDirectionValue tIOUSBDeviceRequestDirectionValue; /*! * @enum tIOUSBDeviceRequestType * @brief Values of 'type' field of a device request * @constant kIOUSBDeviceRequestTypeValueStandard the device request is a standard device request * @constant kIOUSBDeviceRequestTypeValueClass the device request is a class specified device request * @constant kIOUSBDeviceRequestTypeValueVendor the device request is a vendor specified device request */ enum tIOUSBDeviceRequestTypeValue { kIOUSBDeviceRequestTypeValueStandard = 0, kIOUSBDeviceRequestTypeValueClass = 1, kIOUSBDeviceRequestTypeValueVendor = 2 }; typedef enum tIOUSBDeviceRequestTypeValue tIOUSBDeviceRequestTypeValue; /*! * @enum tIOUSBDeviceRequestRecipientValue * @brief Values of 'recipient' field of a device request * @constant kIOUSBDeviceRequestRecipientValueDevice the device request's recipient is a device * @constant kIOUSBDeviceRequestRecipientValueInterface the device request's recipient is an interface * @constant kIOUSBDeviceRequestRecipientValueEndpoint the device request's recipient is an endpoint * @constant kIOUSBDeviceRequestRecipientValueOther the device request's recipient is an other type */ enum tIOUSBDeviceRequestRecipientValue { kIOUSBDeviceRequestRecipientValueDevice = 0, kIOUSBDeviceRequestRecipientValueInterface = 1, kIOUSBDeviceRequestRecipientValueEndpoint = 2, kIOUSBDeviceRequestRecipientValueOther = 3 }; typedef enum tIOUSBDeviceRequestRecipientValue tIOUSBDeviceRequestRecipientValue; enum tIOUSBDeviceRequest { kIOUSBDeviceRequestSize = 8, kIOUSBDeviceRequestDirectionMask = IOUSBBit(7), kIOUSBDeviceRequestDirectionPhase = IOUSBBitRangePhase(7, 7), kIOUSBDeviceRequestDirectionOut = (kIOUSBDeviceRequestDirectionValueOut << kIOUSBDeviceRequestDirectionPhase), kIOUSBDeviceRequestDirectionIn = (kIOUSBDeviceRequestDirectionValueIn << kIOUSBDeviceRequestDirectionPhase), kIOUSBDeviceRequestTypeMask = IOUSBBitRange(5, 6), kIOUSBDeviceRequestTypePhase = IOUSBBitRangePhase(5, 6), kIOUSBDeviceRequestTypeStandard = (kIOUSBDeviceRequestTypeValueStandard << kIOUSBDeviceRequestTypePhase), kIOUSBDeviceRequestTypeClass = (kIOUSBDeviceRequestTypeValueClass << kIOUSBDeviceRequestTypePhase), kIOUSBDeviceRequestTypeVendor = (kIOUSBDeviceRequestTypeValueVendor << kIOUSBDeviceRequestTypePhase), kIOUSBDeviceRequestRecipientMask = IOUSBBitRange(0, 4), kIOUSBDeviceRequestRecipientPhase = IOUSBBitRangePhase(0, 4), kIOUSBDeviceRequestRecipientDevice = (kIOUSBDeviceRequestRecipientValueDevice << kIOUSBDeviceRequestRecipientPhase), kIOUSBDeviceRequestRecipientInterface = (kIOUSBDeviceRequestRecipientValueInterface << kIOUSBDeviceRequestRecipientPhase), kIOUSBDeviceRequestRecipientEndpoint = (kIOUSBDeviceRequestRecipientValueEndpoint << kIOUSBDeviceRequestRecipientPhase), kIOUSBDeviceRequestRecipientOther = (kIOUSBDeviceRequestRecipientValueOther << kIOUSBDeviceRequestRecipientPhase), }; // USB 2.0 9.4: Standard Device Requests // USB 3.0 9.4: Standard Device Requests enum { kIOUSBDeviceRequestGetStatus = 0, kIOUSBDeviceRequestClearFeature = 1, kIOUSBDeviceRequestGetState = 2, kIOUSBDeviceRequestSetFeature = 3, kIOUSBDeviceRequestSetAddress = 5, kIOUSBDeviceRequestGetDescriptor = 6, kIOUSBDeviceRequestSetDescriptor = 7, kIOUSBDeviceRequestGetConfiguration = 8, kIOUSBDeviceRequestSetConfiguration = 9, kIOUSBDeviceRequestGetInterface = 10, kIOUSBDeviceRequestSetInterface = 11, kIOUSBDeviceRequestSynchFrame = 12, kIOUSBDeviceRequestSetSel = 48, kIOUSBDeviceRequestSetIsochronousDelay = 49 }; // USB 2.0 9.4.5: Get Status // USB 3.0 9.4.5: Get Status enum { kIOUSBDeviceStatusSelfPowered = IOUSBBit(0), kIOUSBDeviceStatusRemoteWakeEnable = IOUSBBit(1), kIOUSBDeviceStatusU1Enable = IOUSBBit(2), kIOUSBDeviceStatusU2Enable = IOUSBBit(3), kIOUSBDeviceStatusLTMEnable = IOUSBBit(4), kIOUSBInterfaceStatusRemoteWakeCapable = IOUSBBit(0), kIOUSBInterfaceStatusRemoteWakeEnable = IOUSBBit(1), IOUSBEndpointStatusHalt = IOUSBBit(0) }; // USB 2.0 Table 9-6: Standard Feature Selectors // USB 3.0 Table 9-7: Standard Feature Selectors enum { kIOUSBDeviceFeatureSelectorRemoteWakeup = 1, kIOUSBDeviceFeatureSelectorTestMode = 2, kIOUSBDeviceFeatureSelectorU1Enable = 48, kIOUSBDeviceFeatureSelectorU2Enable = 49, kIOUSBDeviceFeatureSelectorLTMEnable = 50, kIOUSBInterfaceFeatureSelectorSuspend = 0, IOUSBEndpointFeatureSelectorStall = 0, }; // USB 3.0 Table 9-8: Suspend Options enum { kIOUSBInterfaceSuspendLowPower = IOUSBBit(0), kIOUSBInterfaceSuspendRemoteWakeEnable = IOUSBBit(1) }; // USB 3.0 Table 10-16: Hub Parameters enum { kIOUSBHubPort2PortExitLatencyNs = 1000, kIOUSBHubDelayNs = 400 }; // USB 3.0 Table 8-33: Timing Parameters enum { kIOUSBPingResponseTimeNs = 400 }; #pragma mark Power Constants enum tIOUSBBusVoltage { kIOUSBBusVoltageDefault = 5 }; enum tIOUSB20BusCurrent { kIOUSB20BusCurrentMinimum = 100, kIOUSB20BusCurrentDefault = 500, kIOUSB20BusCurrentMaxPowerUnits = 2 }; enum tIOUSB30BusCurrent { kIOUSB30BusCurrentMinimum = 150, kIOUSB30BusCurrentDefault = 900, kIOUSB30BusCurrentMaxPowerUnits = 8 }; #pragma mark USB 2.0 constants // USB 2.0 4.1.1 enum tIOUSBTopology { kIOUSBTopologyHost = 1, kIOUSBTopologyRootPort = 2, kIOUSBTopology1Hub = 3, kIOUSBTopology2Hub = 4, kIOUSBTopology3Hub = 5, kIOUSBTopology4Hub = 6, kIOUSBTopology5Hub = 7, kIOUSBTopologyTierLimit = kIOUSBTopology5Hub }; #pragma mark USB 3.0 constants // USB 3.0 Table 6-21 enum tIOUSB30ResetTimeout { kIOUSB30ResetMinimumTimeout = 80, kIOUSB30ResetTypicalTimeout = 100, kIOUSB30ResetMaximumTimeout = 120, kIOUSB30ResetMaximumWithMarginTimeout = 150 }; // USB 3.0 Table 7-12 enum tIOUSB30LinkStateTimeout { kIOUSB30LinkStateSSInactiveQuietTimeout = 12, kIOUSB30LinkStateRxDetectQuietTimeout = 12, kIOUSB30LinkStatePollingLFPSTimeout = 360, kIOUSB30LinkStatePollingActiveTimeout = 12, kIOUSB30LinkStatePollingConfigurationTimeout = 12, kIOUSB30LinkStatePollingIdleTimeout = 2, kIOUSB30LinkStateU0RecoveryTimeout = 1, kIOUSB30LinkStateU0LTimeout = 0, // 10 microseconds kIOUSB30LinkStateU1NoLFPSResponseTimeout = 2, kIOUSB30LinkStateU1PingTimeout = 300, kIOUSB30LinkStateU2NoLFPSResponseTimeout = 2, kIOUSB30LinKStateU2RxDetectDelay = 100, kIOUSB30LinkStateU3NoLFPSResponseTimeout = 10, kIOUSB30LinkStateU3WakeupRetryDelay = 100, kIOUSB30LinkStateU3RxDetectDelay = 100, kIOUSB30LinkStateRecoveryActiveTimeout = 12, kIOUSB30LinkStateRecoveryConfigurationTimeout = 6, kIOUSB30LinkStateRecoveryIdleTimeout = 2, kIOUSB30LinkStateLoopbackExitTimeout = 2, kIOUSB30LinkStateHotResetActiveTimeout = 12, kIOUSB30LinkStateHotResetExitTimeout = 2, // USB 3.0 7.5.4 kIOUSB30LinkStatePollingDeadline = (kIOUSB30LinkStatePollingLFPSTimeout + 1 + kIOUSB30LinkStatePollingActiveTimeout + kIOUSB30LinkStatePollingConfigurationTimeout + kIOUSB30LinkStatePollingIdleTimeout), // USB 3.0 7.5.9 and 7.5.10 kIOUSB30LinkStateSSResumeDeadline = (kIOUSB30LinkStateU3WakeupRetryDelay /* accomodation for retimer */ + kIOUSB30LinkStateU3NoLFPSResponseTimeout + kIOUSB30LinkStateRecoveryActiveTimeout + kIOUSB30LinkStateRecoveryConfigurationTimeout + kIOUSB30LinkStateRecoveryIdleTimeout), // USB 3.0 7.5.10 kIOUSB30LinkStateRecoveryDeadline = (kIOUSB30LinkStateRecoveryActiveTimeout + kIOUSB30LinkStateRecoveryConfigurationTimeout + kIOUSB30LinkStateRecoveryIdleTimeout + 1 /* margin */), // USB 3.0 7.5.12 kIOUSB30LinkStateHotResetDeadline = kIOUSB30LinkStateHotResetActiveTimeout + kIOUSB30LinkStateHotResetExitTimeout + 1 /* margin */, }; // USB 3.1 Table 8-18 enum tIOUSB30DeviceNotificationType { kIOUSB30DeviceNotificationTypeFunctionWake = 1, kIOUSB30DeviceNotificationTypeLatencyTolerance = 2, kIOUSB30DeviceNotificationTypeBusIntervalAdjustment = 3, kIOUSB30DeviceNotificationTypeHostRoleRequest = 4, kIOUSB30DeviceNotificationTypeSublinkSpeed = 5 }; // USB 3.1 Table 8-36 enum tIOUSB30TimingParameters { kIOUSB30TimingParameterBELTDefaultNs = 1 * 1000 * 1000, kIOUSB30TimingParameterBELTMinNs = 125 * 1000 }; // USB 3.1 Table 10-12 Port Status Type Codes enum tIOUSB30HubPortStatusCode { kIOUSB30HubPortStatusCodeStandard = 0, kIOUSB30HubPortStatusCodePD = 1, kIOUSB30HubPortStatusCodeExt = 2, kIOUSB30HubPortStatusCodeCount = 3 }; // USB 3.2 E.1.2 enum { kIOUSB30RetimerDepthLimit = 4 }; /*! * @typedef IOUSB30HubPortStatusExt * @discussion See the USB Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. * USB 3.1 10.16.2.6 Get Port Status */ struct IOUSB30HubPortStatusExt { uint16_t wPortStatus; uint16_t wPortChange; uint32_t dwExtPortStatus; } __attribute__((packed)); // USB 3.1 Table 10-11. Note, offsets are specific to dwExtPortStatus enum tIOUSB30HubExtStatus { kIOUSB30HubExtStatusRxSublinkSpeedID = IOUSBBitRange(0, 3), kIOUSB30HubExtStatusRxSublinkSpeedIDPhase = IOUSBBitRangePhase(0, 3), kIOUSB30HubExtStatusTxSublinkSpeedID = IOUSBBitRange(4, 7), kIOUSB30HubExtStatusTxSublinkSpeedIDPhase = IOUSBBitRangePhase(4, 7), kIOUSB30HubExtStatusRxLaneCount = IOUSBBitRange(8, 11), kIOUSB30HubExtStatusRxLaneCountPhase = IOUSBBitRangePhase(8, 11), kIOUSB30HubExtStatusTxLaneCount = IOUSBBitRange(12, 15), kIOUSB30HubExtStatusTxLaneCountPhase = IOUSBBitRangePhase(12, 15) }; #endif /* AppleUSBCommon_AppleUSBDefinitions_h */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostInterface.h
/* * Copyright (c) 1998-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header IOUSBHostInterface.h @brief IOUSBHostInterface is an IOService representing a USB interface. @discussion <h3>Session Management</h3> A driver that has successfully matched on an IOUSBHostInterface is able to take ownership of the interface by calling the <code>open</code> method defined by IOService on the IOUSBHostInterface. Once <code>open</code> has completed successfully, the driver has an open session, and may use the deviceRequest interface to send control requests, the selectAlternateSetting interface to change the endpoints and behavior of the interface. When the driver is finished with control of the IOUSBHostInterface, it must call <code>close</code> to end its session. Calling <code>close</code> will synchronously abort any IO associated with that session, including requests on the control endpoint. If the interface is terminating for any reason, such as the device being unplugged, the driver must call <code>close</code> on the IOUSBHostInterface, or termination will be blocked and the port will not register newly attached devices for matching. The willTerminate call into the driver is the recommended location to call <code>close</code>. <h3>deviceRequest Interface</h3> The <code>deviceRequest</code> methods are used to send control requests to the device's default endpoint. The <code>deviceRequest</code> methods may not be used for the following standard requests: <ul> <li>CLEAR_FEATURE ENDPOINT_HALT (USB 2.0 9.4.1) - Use <code>IOUSBHostPipe::clearStall</code> to send this request</li> <li>SET_ADDRESS (USB 2.0 9.4.6)</li> <li>SET_CONFIGURATION (USB 2.0 9.4.7) - Use <code>setConfiguration</code> to send this request</li> <li>SET_INTERFACE (USB 2.0 9.4.10) - Use <code>IOUSBHostInterface::selectAlternateSetting</code> to send this request</li> </ul> <h3>IOUSBInterface Migration</h3> IOUSBHostInterface serves as a replacement for IOUSBInterface. Clients that previously matched on IOUSBInterface can use the following guide to convert to IOUSBHostInterface. <code>virtual const IOUSBInterfaceDescriptor* IOUSBInterface::FindNextAltInterface(const IOUSBInterfaceDescriptor*, IOUSBFindInterfaceRequest*);</code><br> Replacement: <code>StandardUSB::getNextInterfaceDescriptor(...);</code> <code>virtual IOUSBPipe* IOUSBInterface::FindNextPipe(IOUSBHostPipe*, IOUSBFindEndpointRequest*);<br> virtual IOUSBPipe* IOUSBInterface::FindNextPipe(IOUSBHostPipe*, IOUSBFindEndpointRequest*, bool);</code><br> Replacement: <pre>const EndpointDescriptor* endpointCandidate = NULL; IOUSBHostPipe* foundPipe = NULL; while((endpointCandidate = StandardUSB::getNextAssociatedDescriptorWithType(getConfigurationDescriptor(), getInterfaceDescriptor(), endpointCandidate, kDescriptorTypeEndpoint)) != NULL) { if(endpointCandidate->bEndpointAddress == desiredAddress>) { foundPipe = copyPipe(StandardUSB::getEndpointAddress(endpointCandidate)); break; } }</pre> <code>virtual const IOUSBDescriptorHeader* IOUSBInterface::FindNextAssociatedDescriptor(const void*, UInt8);</code><br> Replacement: <code>StandardUSB::getNextAssociatedDescriptorWithType(getConfigurationDescriptor(), getInterfaceDescriptor(), currentDescriptor, type);</code> <code>virtual IOReturn IOUSBInterface::SetAlternateInterface(IOService*, UInt16); Replacement: <code>selectAlternateSetting(...);</code> <code>virtual IOUSBHostPipe* IOUSBInterface::GetPipeObj(UInt8);<br> virtual IOUSBHostPipe* IOUSBInterface::GetPipeObjRetain(UInt8);</code><br> Replacement: <code>copyPipe(endpointAddress);</code><br> Note that <code>copyPipe</code> behaves like <code>GetPipeObjRetain</code>, and the returned pipe must be released by the caller during termination. <code>virtual UInt8 IOUSBInterface::GetConfigValue();</code><br> Replacement: <code>getConfigurationDescriptor()->bConfigurationValue;</code> <code>virtual IOUSBHostDevice* IOUSBInterface::GetDevice();</code><br> Replacement: <pre>// Function drivers should not assume the immediate provider of an IOUSBHostInterface is an IOUSBHostDevice. IOService* deviceCandidate = getProvider(); IOUSBHostDevice* device = NULL; while(deviceCandidate != NULL) { device = OSDynamicCast(IOUSBHostDevice, deviceCandidate); if(device != NULL) { break; } deviceCandidate = deviceCandidate->getProvider(); }</pre> <code>virtual UInt8 IOUSBInterface::GetInterfaceNumber();</code><br> Replacement: <code>getInterfaceDescriptor()->bInterfaceNumber;</code> <code>virtual UInt8 IOUSBInterface::GetAlternateSetting();</code><br> Replacement: <code>getInterfaceDescriptor()->bAlternateSetting;</code> <code>virtual UInt8 IOUSBInterface::GetNumEndpoints();</code><br> Replacement: <code>getInterfaceDescriptor()->bNumEndpoints;</code> <code>virtual UInt8 IOUSBInterface::GetInterfaceClass();</code><br> Replacement: <code>getInterfaceDescriptor()->bInterfaceClass;</code> <code>virtual UInt8 IOUSBInterface::GetInterfaceSubClass();</code><br> Replacement: <code>getInterfaceDescriptor()->bInterfaceSubClass;</code> <code>virtual UInt8 IOUSBInterface::GetInterfaceProtocol();</code><br> Replacement: <code>getInterfaceDescriptor()->bInterfaceProtocol;</code> <code>virtual UInt8 IOUSBInterface::GetInterfaceStringIndex();</code><br> Replacement: <code>getInterfaceDescriptor()->iInterface;</code> <code>virtual IOReturn IOUSBInterface::DeviceRequest(IOUSBDevRequest* request, IOUSBCompletion* completion = 0);<br> virtual IOReturn IOUSBInterface::DeviceRequest(IOUSBDevRequestDesc* request, IOUSBCompletion* completion = 0);</code><br> Replacement: <code>deviceRequest(...)</code> <code>virtual IOReturn IOUSBInterface::GetEndpointProperties(UInt8 alternateSetting, UInt8 endpointNumber, UInt8 direction, UInt8* transferType, UInt16* maxPacketSize, UInt8* interval);<br> virtual IOReturn GetEndpointPropertiesV3(IOUSBEndpointProperties*);</code><br> Replacement: Use <code>StandardUSB::getEndpoint*</code> methods to retrieve endpoint properties. <code>virtual IOReturn RememberStreams();</code><br> Replacement: none <code>virtual IOReturn RecreateStreams();</code><br> Replacement: none <code>virtual void UnlinkPipes();</code><br> Replacement: none <code>virtual void ReopenPipes();</code><br> Replacement: none <code>virtual IOReturn GetInterfaceStatus(USBStatus*);</code><br> Replacement: Use <code>deviceRequest(...)</code> to manually craft the control request. <code>virtual IOReturn SetFunctionSuspendFeature(UInt8);</code><br> Replacement: It is not recommended for function drivers to send this request. <code>virtual IOReturn EnableRemoteWake(bool);</code><br> Replacement: Use <code>deviceRequest(...)</code> to manually craft the control request. <code>IOUSBHostDevice::setConfiguration</code> will automatically enable remote wake if the descriptors indicate it is supported. */ #ifndef IOUSBHostFamily_IOUSBHostInterface_h #define IOUSBHostFamily_IOUSBHostInterface_h #include <TargetConditionals.h> #include <IOKit/IOService.h> #include <libkern/c++/OSData.h> #include <IOKit/usb/IOUSBHostFamily.h> #include <IOKit/usb/IOUSBHostDevice.h> #define TARGET_OS_HAS_USBDRIVERKIT_IOUSBHOSTINTERFACE __has_include(<USBDriverKit/IOUSBHostInterface.h>) #if TARGET_OS_HAS_USBDRIVERKIT_IOUSBHOSTINTERFACE #include <USBDriverKit/IOUSBHostInterface.h> #endif #if TARGET_CPU_ARM64 || TARGET_CPU_ARM /*! * @class IOUSBInterface * @brief A compatibility base class to faciliate service discovery for legacy projects. * @discussion New software should not reference this class. */ class __IOUSBHOSTFAMILY_DEPRECATED IOUSBInterface : public IOService { typedef IOService super; OSDeclareAbstractStructors(IOUSBInterface) }; #endif /*! * @class IOUSBHostInterface * @brief The IOService object representing a USB interface * @discussion This class provides functionality to send control requests to the default control endpoint, as well as create IOUSBHostPipe objects to transfer data. Function drivers should not subclass IOUSBHostInterface. */ #if TARGET_CPU_ARM64 || TARGET_CPU_ARM class __IOUSBHOSTFAMILY_DEPRECATED IOUSBHostInterface : public IOUSBInterface #else class __IOUSBHOSTFAMILY_DEPRECATED IOUSBHostInterface : public IOService #endif { #if TARGET_OS_HAS_USBDRIVERKIT_IOUSBHOSTINTERFACE OSDeclareDefaultStructorsWithDispatch(IOUSBHostInterface) #else OSDeclareDefaultStructors(IOUSBHostInterface) #endif public: /* * @brief Factory method for creating an IOUSBHostInterface object * @discussion This method should not be called by function drivers. To create an IOUSBHostInterface, use IOUSBHostDevice::setConfiguration(...) * @param configurationDescriptor Descriptor for the configuration this interface belongs to * @param interfaceDescriptor Descriptor for this interface's default alt setting * @return Pointer to an IOUSBHostInterface object if successful, otherwise NULL */ static IOUSBHostInterface* withDescriptors(const StandardUSB::ConfigurationDescriptor* configurationDescriptor, const StandardUSB::InterfaceDescriptor* interfaceDescriptor); protected: virtual bool initWithDescriptors(const StandardUSB::ConfigurationDescriptor* configurationDescriptor, const StandardUSB::InterfaceDescriptor* interfaceDescriptor); // Pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 0); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 1); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 2); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 3); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 4); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 5); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 6); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 7); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 8); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 9); #pragma mark IOService overrides public: // The following methods, with the notable exception of <code>open</code> and <code>close</code> should be considered private and should not be called by function drivers. For a discussion of proper usage for <code>open</code> and <code>close</code>, see the discussion of "Session Management" above. virtual bool attach(IOService* provider); virtual bool start(IOService* provider); virtual bool terminate(IOOptionBits options = 0); virtual void stop(IOService* provider); virtual void free(); virtual bool compareProperty(OSDictionary* matching, const char* key); virtual bool compareProperty(OSDictionary* matching, const OSString* key); virtual bool matchPropertyTable(OSDictionary* table, SInt32* score); virtual bool matchPropertyTable(OSDictionary* table); enum { kOpenOptionsSelectAlternateInterface = kUSBHostOpenOptionSelectAlternateSetting } __attribute__((deprecated)); /*! @functiongroup IOService overrides */ /*! * @brief Open a session to the IOUSBHostInterface * @discussion This method opens a session to an IOUSBHostInterface. It will acquire the service's workloop lock. Only one service may open a session at a time. * @param forClient The IOService that is opening a session. * @param options See IOService.h, <code>kOpenOptionsSelectAlternateInterface</code> in the options mask will immediately select the alternate setting passed by value through the <code>arg</code> parameter * @param arg See IOService.h, or the value of the alt setting to use if <code>kUSBHostOpenOptionSelectAlternateSetting</code> is included in the options mask * @return bool true if the session could be opened, otherwise false. */ virtual bool open(IOService* forClient, IOOptionBits options = 0, void* arg = 0); /*! * @brief Close a session to the IOUSBHostInterface * @discussion This method closes an open session to an IOUSBHostInterface. It will acquire the service's workloop lock, abort any IO for the interface and its endpoints, and may call commandSleep to allow processing of aborted IO before returning. * @param forClient The IOService that is closing its session. * @param options See IOService.h */ virtual void close(IOService* forClient, IOOptionBits options = 0); virtual IOReturn newUserClient(task_t owningTask, void* securityID, UInt32 type, IOUserClient** handler); virtual IOReturn message(UInt32 type, IOService* provider, void* argument = 0); virtual const char* stringFromReturn(IOReturn code); protected: virtual IOReturn openGated(IOService* forClient, IOOptionBits options, void* arg); virtual IOReturn closeGated(IOService* forClient, IOOptionBits options); // Pad slots for IOService overrides OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 10); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 11); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 12); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 13); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 14); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 15); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 16); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 17); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 18); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 19); protected: IOCommandGate* _commandGate; IOWorkLoop* _workLoop; #pragma mark Power management public: /*! @functiongroup Power management */ /*! * @brief Sets the desired idle suspend timeout for the interface * @discussion Once the interface is considered idle, it will defer electrical suspend of the device for the specified duration. For a more complete discussion of idle policies, refer to "Idle suspend" in IOUSBHostFamily.h. * @param deviceIdleTimeout The amount of time, in milliseconds, after all pipes are idle to wait before suspending the device. * @return IOReturn result code */ virtual IOReturn setIdlePolicy(uint32_t deviceIdleTimeout); /*! * @brief Retrieve the current idle suspend timeout. See @link setIdlePolicy @/link * @return The amount of time, in milliseconds, after all pipes are idle to wait before suspending the device, */ virtual uint32_t getIdlePolicy(); // Public pad slots for power management OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 20); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 21); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 22); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 23); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 24); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 25); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 26); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 27); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 28); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 29); protected: // Protected pad slots for power management OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 30); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 31); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 32); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 33); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 34); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 35); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 36); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 37); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 38); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 39); protected: uint32_t _deviceIdleTimeout; #pragma mark Descriptors public: /*! @functiongroup Descriptors */ /*! * @brief Retrieve the configuration descriptor in which this interface is defined * @return ConfigurationDescriptor pointer */ virtual const StandardUSB::ConfigurationDescriptor* getConfigurationDescriptor(); /*! * @brief Retrieve the interface descriptor associated with this interface * @return InterfaceDescriptor pointer */ virtual const StandardUSB::InterfaceDescriptor* getInterfaceDescriptor(); /*! * @brief Return a string descriptor from the device * @discussion This method uses IOUSBHostDevice::getDescriptor to return a string descriptor. * @param index Descriptor index value. Low byte of <code>wValue</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * @param languageID Descriptor language ID. <code>wIndex</code> of the SET_DESCRIPTOR control request (USB 2.0 9.4.8). * * @return Pointer to the descriptor if found */ virtual const StandardUSB::StringDescriptor* getStringDescriptor(uint8_t index, uint16_t languageID = StandardUSB::kLanguageIDEnglishUS); // Public pad slots for descriptors OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 40); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 41); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 42); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 43); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 44); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 45); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 46); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 47); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 48); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 49); protected: virtual IOReturn getInterfaceDescriptorGated(const StandardUSB::InterfaceDescriptor*& result); // Protected pad slots for descriptors OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 50); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 51); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 52); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 53); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 54); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 55); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 56); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 57); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 58); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 59); #pragma mark Alternate setting and pipe management public: /*! @functiongroup Alternate setting and pipe management */ /*! * @brief Select an alternate setting for this interface * @discussion This method is used to select an alternate setting for the interface. All pending IO on the interface's pipes will be aborted, and the open pipes will be closed. The new alternate setting will be selected via SET_INTERFACE control request (USB 2.0 9.4.10). * @param bAlternateSetting Alternate interface number to activate * @return IOReturn result code */ virtual IOReturn selectAlternateSetting(uint8_t bAlternateSetting); /*! * @brief Return the pipe whose <code>bEndpointAddress</code> matches <code>address</code> * @discussion This method will return the pipe whose <code>bEndpointAddress</code> matches <code>address</code>. If the pipe doesn't exist yet, but is part of the interface, it will first be created. The caller must release the IOUSBHostPipe when finished using it. * @param address Address of the pipe * @return Pointer to a retain()ed IOUSBHostPipe object or NULL */ virtual IOUSBHostPipe* copyPipe(uint8_t address); /*! * @brief Enqueue a request on the default control endpoint * @discussion This method will enqueue an asynchronous request on the default control endpoint. If successful, the provided completion routine will be called to report the status of the completed IO. * @param request Reference to a valid StandardUSB::DeviceRequest structure. The structure is copied and can therefore be stack-allocated. * @param dataBuffer A void* or IOMemoryDescriptor* defining the memory to use for the request's data phase. * @param completion Pointer to a IOUSBHostCompletion structure. This will be copied and can therefore be stack-allocated. * @param completionTimeoutMs Timeout of the request in milliseconds. If 0, the request will never timeout. * @return kIOReuturnSuccess if the completion will be called in the future, otherwise error */ virtual IOReturn deviceRequest(StandardUSB::DeviceRequest& request, void* dataBuffer, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); virtual IOReturn deviceRequest(StandardUSB::DeviceRequest& request, IOMemoryDescriptor* dataBuffer, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); /*! * @brief Send a request on the default control endpoint * @discussion This method will send a synchronous request on the default control endpoint, and will not return until the request is complete. This method will acquire the service's workloop lock, and will call commandSleep to send the control request. * @param request Reference to a valid StandardUSB::DeviceRequest structure. * @param dataBuffer A void* or IOMemoryDescriptor* defining the memory to use for the request's data phase. * @param bytesTransferred A uint32_t reference which will be updated with the byte count of the completed data phase. * @param completionTimeoutMs Timeout of the request in milliseconds. If 0, the request will never timeout. * @return IOReturn value indicating the result of the IO request */ virtual IOReturn deviceRequest(StandardUSB::DeviceRequest& request, void* dataBuffer, uint32_t& bytesTransferred, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); virtual IOReturn deviceRequest(StandardUSB::DeviceRequest& request, IOMemoryDescriptor* dataBuffer, uint32_t& bytesTransferred, uint32_t completionTimeoutMs = kUSBHostDefaultControlCompletionTimeoutMS); /*! * @brief Abort device requests made via the @link deviceRequest @/link methods by <code>forClient</code> * @discussion This method will abort any requests associated with a specific client made via the @link deviceRequest @/link methods. It will not abort requests made by other clients. * @param options IOUSBHostIOSource::tAbortOptions * @param withError IOReturn error value to return with the requests. The default value of kIOReturnAborted should be used. * @return IOReturn result code */ IOReturn abortDeviceRequests(IOOptionBits options = IOUSBHostIOSource::kAbortAsynchronous, IOReturn withError = kIOReturnAborted); // Public pad slots for alternate setting and pipe management OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 60); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 61); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 62); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 63); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 64); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 65); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 66); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 67); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 68); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 69); protected: enum { kInitIORetries = 3, kInitIORetryInterval = 100, kDestroyPipesOptionAll = StandardUSBBit(0) }; virtual void updateMatchingProperties(); virtual IOReturn selectAlternateSettingGated(uint8_t bAlternateSetting); virtual IOReturn copyPipeGated(uint8_t address, IOUSBHostPipe*& result); virtual void closePipes(); virtual IOReturn closePipesGated(); // Must be called on the command gate virtual void pipeLockLock(); virtual void pipeLockUnlock(); OSMetaClassDeclareReservedUsed(IOUSBHostInterface, 70); virtual void destroyPipes(IOOptionBits options = 0); OSMetaClassDeclareReservedUsed(IOUSBHostInterface, 71); virtual IOReturn destroyPipesGated(IOOptionBits options); // Protected pad slots for alternate setting and pipe management OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 72); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 73); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 74); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 75); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 76); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 77); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 78); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 79); protected: IOUSBHostPipe* _pipeList[kUSBHostMaxPipes]; bool _pipeLock; const StandardUSB::ConfigurationDescriptor* _configurationDescriptor; const StandardUSB::InterfaceDescriptor* _interfaceDescriptor; IOUSBHostDevice* _device; uint32_t _debugLoggingMask; uint32_t _locationID; // TODO: Initialize this for tracepoints #pragma mark Miscellaneous public: /*! @functiongroup Provider access */ /*! * @brief Return the parent/provider IOUSBHostDevice object of this interface. * @return IOUSBHostDevice pointer */ virtual IOUSBHostDevice* getDevice() const; /*! * @brief Return the current frame number of the USB controller * @description This method will return the current frame number of the USB controller, omitting microframe. This is most useful for scheduling future isochronous requests. * @param theTime If not NULL, this will be updated with the current system time * @return The current frame number */ virtual uint64_t getFrameNumber(AbsoluteTime* theTime = NULL) const; /*! * @brief Return the current port status * @discussion Combination of tUSBHostPortStatus values * @return port status */ virtual uint32_t getPortStatus() const; /*! * @brief Allocate a buffer to be used for I/O * @discussion This method will allocate an IOBufferMemoryDescriptor optimized for use by the underlying controller hardware. A buffer allocated by this method will not be bounced to perform DMA operations. * @param options kIODirectionOut, kIODirectionIn to set the direction of the I/O transfer. * @param capacity Size of the buffer to allocate * @return Pointer to an IOBufferMemoryDescriptor if successful, otherwise NULL */ virtual IOBufferMemoryDescriptor* createIOBuffer(IOOptionBits options, mach_vm_size_t capacity); // Public pad slots for miscellaneous OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 80); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 81); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 82); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 83); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 84); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 85); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 86); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 87); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 88); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 89); protected: // Protected pad slots for miscellaneous OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 90); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 91); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 92); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 93); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 94); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 95); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 96); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 97); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 98); OSMetaClassDeclareReservedUnused(IOUSBHostInterface, 99); protected: struct tExpansionData { uint16_t _persistentOutEndpointMask; uint16_t _persistentInEndpointMask; bool _allPipesDestroyed; }; tExpansionData* _expansionData; }; #endif // IOUSBHostFamily_IOUSBHostInterface_h
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/USBHub.h
/* * Copyright � 1998-2012 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _USBHUB_H #define _USBHUB_H #if KERNEL #ifndef __IOUSBFAMILY__ #warning "Deprecated header file. See IOUSBHostFamily for USB-Host KPI." #endif #endif #include <IOKit/usb/USB.h> #include <IOKit/usb/USBSpec.h> /*! @header USBHub.h @abstract Constants and definitions used with Hub devices. @discussion */ /*! @enum Hub Descriptor Type @discussion */ enum { kUSBHubDescriptorType = 0x29, kUSB3HubDescriptorType = 0x2A }; /*! @enum HubFeatures @discussion Used with SET_FEATURE to set hub and port features */ enum { kUSBHubLocalPowerChangeFeature = 0, /* Hub features */ kUSBHubOverCurrentChangeFeature = 1, kUSBHubPortConnectionFeature = 0, /* port features */ kUSBHubPortEnableFeature = 1, kUSBHubPortSuspendFeature = 2, kUSBHubPortOverCurrentFeature = 3, kUSBHubPortResetFeature = 4, kUSBHubPortPowerFeature = 8, kUSBHubPortLowSpeedFeature = 9, kUSBHubPortConnectionChangeFeature = 16, kUSBHubPortEnableChangeFeature = 17, kUSBHubPortSuspendChangeFeature = 18, kUSBHubPortOverCurrentChangeFeature = 19, kUSBHubPortResetChangeFeature = 20, kUSBHubPortTestFeature = 21, kUSBHubPortIndicatorFeature = 22, // USB 3.0 kUSBHubPortLinkStateFeature = 5, /* port features */ kUSBHubPortU1TimeoutFeature = 23, kUSBHubPortU2TimeoutFeature = 24, kUSBHubPortLinkStateChangeFeature = 25, kUSBHubPortConfigErrorChangeFeature = 26, kUSBHubPortRemoteWakeMaskFeature = 27, kUSBHubPortBHPortResetFeature = 28, kUSBHubPortBHResetChangeFeature = 29, kUSBHubPortForceLinkPMAcceptFeature = 30, }; /*! @enum HubPortStatus @discussion Used to decode the Port Status and Change */ enum { kSSHubPortStatusConnectionBit = 0, kSSHubPortStatusEnabledBit = 1, kSSHubPortStatusOverCurrentBit = 3, kSSHubPortStatusResetBit = 4, // USB 3.0 kSSHubPortStatusLinkStateShift = 5, kSSHubPortStatusPowerBit = 9, kSSHubPortStatusSpeedShift = 10, kSSHubPortChangeBHResetBit = 5, kSSHubPortChangePortLinkStateBit = 6, kSSHubPortChangePortConfigErrBit = 7, kHubPortConnection = 0x0001, kHubPortEnabled = 0x0002, kHubPortSuspend = 0x0004, kHubPortOverCurrent = 0x0008, kHubPortBeingReset = 0x0010, kHubPortPower = 0x0100, kHubPortLowSpeed = 0x0200, kHubPortHighSpeed = 0x0400, kHubPortTestMode = 0x0800, kHubPortIndicator = 0x1000, kHubPortSuperSpeed = 0x2000, // This is a synthesized bit that is using a reserved bit from the Hub Port Status definition in USB 2.0. kHubPortBit14 = 0x4000, // That bit is used by the hub driver to encode the USB3 link state into the USB2 PortStatus (using bits 5-7 as well, that are reserved in the USB 2 spec) kHubPortDebouncing = 0x8000, // This is a synthesized bit that is using a reserved bit from the Hub Port Status definition in USB 2.0. // USB 3.0 kSSHubPortStatusConnectionMask = ( 1 << kSSHubPortStatusConnectionBit ), kSSHubPortStatusEnabledMask = ( 1 << kSSHubPortStatusEnabledBit ), kSSHubPortStatusOverCurrentMask = ( 1 << kSSHubPortStatusOverCurrentBit ), kSSHubPortStatusBeingResetMask = ( 1 << kSSHubPortStatusResetBit ), kSSHubPortStatusLinkStateMask = 0x01E0, kSSHubPortStatusPowerMask = ( 1 << kSSHubPortStatusPowerBit ), kSSHubPortStatusSpeedMask = 0x1C00, kSSHubPortChangeBHResetMask = ( 1 << kSSHubPortChangeBHResetBit ), kSSHubPortChangePortLinkStateMask = ( 1 << kSSHubPortChangePortLinkStateBit ), kSSHubPortChangePortConfigErrMask = ( 1 << kSSHubPortChangePortConfigErrBit ), // these are the bits which cause the hub port state machine to keep moving (USB 3.0) kHubPortSuperSpeedStateChangeMask = (kHubPortConnection | kHubPortEnabled | kHubPortSuspend | kHubPortOverCurrent | kHubPortBeingReset | kSSHubPortStatusBeingResetMask | kSSHubPortChangePortLinkStateMask | kSSHubPortChangePortConfigErrMask), // these are the bits which cause the hub port state machine to keep moving (USB 2.0) kHubPortStateChangeMask = (kHubPortConnection | kHubPortEnabled | kHubPortSuspend | kHubPortOverCurrent | kHubPortBeingReset) }; /*! @enum HubStatus @discussion Used to decode the Hub Status and Change */ enum { kHubLocalPowerStatus = 1, kHubOverCurrentIndicator = 2, kHubLocalPowerStatusChange = 1, kHubOverCurrentIndicatorChange = 2 }; /*! @enum HubCharacteristics @discussion */ enum { kPerPortSwitchingBit = (1 << 0), kNoPowerSwitchingBit = (1 << 1), kCompoundDeviceBit = (1 << 2), kPerPortOverCurrentBit = (1 << 3), kNoOverCurrentBit = (1 << 4), kUSBHubOvercurrentMask = 0x18, kUSBHubOvercurrentShift = 3, kHubTTThinkTimeMask = 0x60, kHubTTThinkTimeShift = 5, kHubPortIndicatorBit = 7, kHubPortIndicatorMask = 0x0080 }; /*! @enum PowerSwitching @discussion */ enum { kHubSupportsGangPower = 0, kHubSupportsIndividualPortPower = 1, kHubPortSetPowerOff = 0, kHubPortSetPowerOn = 1 }; /*! @enum PortIndicatorSelectors @discussion */ enum { kHubPortIndicatorAutomatic = 0, kHubPortIndicatorAmber, kHubPortIndicatorGreen, kHubPortIndicatorOff }; /*! @enum Root Hub specific @discussion */ enum { kPrdRootHubApple = 0x8005, // ProductID for classic speed root hubs kPrdRootHubAppleE = 0x8006, // ProductID for high speed root hubs kPrdRootHubAppleSS = 0x8007, // ProductID for super speed root hubs kUSBRootHubPollingRate = 32 // Enpoint polling rate interval for root hubs }; /*! @enum Hub Class Request @discussion Specifies values for the bRequest field of a Device Request. */ enum USBHubClassRequest { kUSBHubRqGetStatus = 0, kUSBHubRqClearFeature = 1, kUSBHubRqGetState = 2, kUSBHubRqSetFeature = 3, kUSBHubRqReserved2 = 4, kUSBHubRqSetAddress = 5, kUSBHubRqGetDescriptor = 6, kUSBHubRqSetDescriptor = 7, kUSBHubRqGetConfig = 8, kUSBHubRqSetConfig = 9, kUSBHubRqGetInterface = 10, kUSBHubRqSetInterface = 11, }; /*! @enum Hub Device Requests @discussion Encoding of the hub specific standard requests <tt> <pre><b> Request bmRequestType bRequest wValue wIndex wLength Data</b> ClearHubFeature 0010 0000B CLEAR_FEATURE Feature Zero Zero None ClearPortFeature 0010 0011B Feature Port Zero None GetBusState 1010 0011B GET_STATE Zero Port One Port Bus State GetHubDescriptor 1010 0000B GET_DESCRIPTOR Type Zero Length Descriptor GetHubStatus 1010 0000B GET_STATUS Zero Zero Four Hub Status GetPortStatus 1010 0011B Zero Port Four Port Status SetHubDescriptor 0010 0000B SET_DESCRIPTOR Type Zero Length Descriptor SetHubFeature 0010 0000B SET_FEATURE Feature Zero Zero None SetPortFeature 0010 0011B Feature Port Zero None </pre> </tt> */ enum { kClearHubFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBClass, kUSBDevice), kClearPortFeature = EncodeRequest(kUSBRqClearFeature, kUSBOut, kUSBClass, kUSBOther), kGetPortState = EncodeRequest(kUSBRqGetState, kUSBIn, kUSBClass, kUSBOther), kGetHubDescriptor = EncodeRequest(kUSBRqGetDescriptor, kUSBIn, kUSBClass, kUSBDevice), kGetHub3Descriptor= EncodeRequest(kUSBRqGetDescriptor, kUSBIn, kUSBClass, kUSBDevice), kGetHubStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBClass, kUSBDevice), kGetPortStatus = EncodeRequest(kUSBRqGetStatus, kUSBIn, kUSBClass, kUSBOther), kSetHubDescriptor = EncodeRequest(kUSBRqGetDescriptor, kUSBOut, kUSBClass, kUSBDevice), kSetHubFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBClass, kUSBDevice), kSetPortFeature = EncodeRequest(kUSBRqSetFeature, kUSBOut, kUSBClass, kUSBOther) }; /*! @typedef IOUSBHubDescriptor @discussion USB Hub Descriptor. See the USB HID Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. */ enum{ // Support a maximum of 64 ports, which will pack into 9 bytes kNumPortBytes = 9 }; struct IOUSBHubDescriptor { UInt8 length; UInt8 hubType; UInt8 numPorts; UInt16 characteristics __attribute__((packed)); UInt8 powerOnToGood; // Port settling time, in 2ms UInt8 hubCurrent; // These are received packed, will have to be unpacked UInt8 removablePortFlags[kNumPortBytes]; UInt8 pwrCtlPortFlags[kNumPortBytes]; }; typedef struct IOUSBHubDescriptor IOUSBHubDescriptor; enum { // these are sent to the controller when configuring a HS hub kUSBHSHubCommandAddHub = 1, kUSBHSHubCommandRemoveHub = 2, kUSBHSHubFlagsMultiTTMask = 0x01, kUSBHSHubFlagsMoreInfoMask = 0x02, kUSBHSHubFlagsTTThinkTimeShift = 2, kUSBHSHubFlagsTTThinkTimeMask = 0x0C, kUSBHSHubFlagsNumPortsShift = 4, kUSBHSHubFlagsNumPortsMask = 0xF0 }; // To cope with the extra fields in a USB3 hub descriptor struct IOUSB3HubDescriptor { UInt8 length; UInt8 hubType; UInt8 numPorts; UInt16 characteristics __attribute__((packed)); UInt8 powerOnToGood; // Port settling time, in 2ms UInt8 hubCurrent; UInt8 hubHdrDecLat; // Header decode latency, new 3.0 field UInt16 hubDelay __attribute__((packed)); // new in 3.0 // These are received packed, will have to be unpacked UInt8 removablePortFlags[kNumPortBytes]; UInt8 pwrCtlPortFlags[kNumPortBytes]; // This field does not exist in the 3.0 descriptor }; typedef struct IOUSB3HubDescriptor IOUSB3HubDescriptor; /*! @typedef IOUSBHubStatus @discussion Used to get the port status and change flags using GetPortStatus() */ struct IOUSBHubStatus { UInt16 statusFlags; UInt16 changeFlags; }; typedef struct IOUSBHubStatus IOUSBHubStatus; typedef IOUSBHubStatus * IOUSBHubStatusPtr; typedef struct IOUSBHubStatus IOUSBHubPortStatus; /*! @typedef IOUSBHubPortReEnumerateParam @discussion Used to specify the port that needs to be reenumerated */ typedef struct IOUSBHubPortReEnumerateParam IOUSBHubPortReEnumerateParam; struct IOUSBHubPortReEnumerateParam { UInt32 portNumber; UInt32 options; }; typedef struct IOUSBHubPortClearTTParam IOUSBHubPortClearTTParam; struct IOUSBHubPortClearTTParam { UInt32 portNumber; UInt32 options; #if 0 UInt8 deviceAddress; <<0 UInt8 endpointNum; <<8 UInt8 endpointType; <<16 // As split transaction. 00 Control, 10 Bulk UInt8 IN; <<24 // Direction, 1 = IN, 0 = OUT #endif }; #pragma mark USB 3 Additions /*! @enum USB 3 Hub Class Request @discussion Specifies values for the bRequest field of a Device Request. */ enum { kUSBHubRqSetHubDepth = 12, kUSBHubRqGetPortErrorCount = 13 }; enum { kSetHubDepth = EncodeRequest(kUSBHubRqSetHubDepth, kUSBOut, kUSBClass, kUSBDevice), kGetPortErrorCount = EncodeRequest(kUSBHubRqGetPortErrorCount, kUSBIn, kUSBClass, kUSBOther) }; /*! @enum Link State for USB 3.0 @discussion Used to decode the Port Status and Change */ enum { kSSHubPortLinkStateU0 = 0, kSSHubPortLinkStateU1 = 1, kSSHubPortLinkStateU2 = 2, kSSHubPortLinkStateU3 = 3, kSSHubPortLinkStateSSDisabled = 4, kSSHubPortLinkStateRxDetect = 5, kSSHubPortLinkStateSSInactive = 6, kSSHubPortLinkStatePolling = 7, kSSHubPortLinkStateRecovery = 8, kSSHubPortLinkStateHotReset = 9, kSSHubPortLinkStateComplianceMode = 10, kSSHubPortLinkStateLoopBack = 11, kSSHubPortSpeed5Gbps = 0 }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostControllerInterfaceHelpers.h
// // IOUSBHostControllerInterfaceHelpers.h // IOUSBHostFamily // // Copyright © 2020 Apple. All rights reserved. // #ifndef IOUSBHostControllerInterfaceHelpers_h #define IOUSBHostControllerInterfaceHelpers_h #if KERNEL #include <IOKit/usb/IOUSBHostControllerInterfaceDefinitions.h> #include <IOKit/usb/IOUSBHostFamily.h> #else #include <IOUSBHost/IOUSBHostControllerInterfaceDefinitions.h> #include <IOKit/usb/IOUSBHostFamilyDefinitions.h> #endif #define IOUSBHostCIMessageTypeFromMessage(message) ((IOUSBHostCIMessageType)(((message)->control & IOUSBHostCIMessageControlType) >> IOUSBHostCIMessageControlTypePhase)) #define IOUSBHostCIMessageStatusFromMessage(message) ((IOUSBHostCIMessageStatus)(((message)->control & IOUSBHostCIMessageControlStatus) >> IOUSBHostCIMessageControlStatusPhase)) #ifdef __cplusplus extern "C" { #endif IOReturn IOUSBHostCIMessageStatusToIOReturn(IOUSBHostCIMessageStatus status); IOUSBHostCIMessageStatus IOUSBHostCIMessageStatusFromIOReturn(IOReturn status); bool IOUSBHostCILinkStateEnabled(const IOUSBHostCILinkState linkState); const char* IOUSBHostCIMessageTypeToString(IOUSBHostCIMessageType type); const char* IOUSBHostCIMessageStatusToString(IOUSBHostCIMessageStatus status); const char* IOUSBHostCILinkStateToString(IOUSBHostCILinkState linkState); const char* IOUSBHostCIDeviceSpeedToString(IOUSBHostCIDeviceSpeed speed); const char* IOUSBHostCIExceptionTypeToString(IOUSBHostCIExceptionType exceptionType); #ifdef __cplusplus } // extern "C" #endif #endif /* IOUSBHostControllerInterfaceHelpers_h */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostFamily.h
/* * Copyright (c) 1998-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header IOUSBHostFamily.h @brief IOUSBHostFamily provides support for discovering, enumerating, and communicating with USB devices. @discussion Starting with Mac OS X El Capitan, IOUSBHostFamily serves as a replacement for IOUSBFamily. <h3>Architecture</h3> USB host controller hardware is managed by AppleUSBHostController subclasses such as AppleUSBXHCI and AppleUSBEHCI. Each AppleUSBHostController is the parent to one or more AppleUSBHostPort services, and each AppleUSBHostPort is able to enumerate a single IOUSBHostDevice service. IOUSBHostDevice is the parent to zero or more IOUSBHostInterface services, and IOUSBHostInterface provides access to zero or more IOUSBHostPipe objects. USB 3.0 and newer streaming-capable IOUSBHostPipe objects can generate one or more IOUSBHostStream objects. AppleUSBHostPort services provide a workloop that is dedicated for use by the port, its enumerated device, and any attached drivers. As such, drivers should not create or manage their own workloops. IOUSBHostDevice and IOUSBHostInterface services can be matched on and controlled by third-party drivers, and are documented in IOUSBHostDevice.h and IOUSBHostInterface.h. IOUSBHostPipe and IOUSBHostStream services share a common IOUSBHostIOSource base class, and are documented in IOUSBHostIOSource.h, IOUSBHostPipe.h, and IOUSBHostStream.h. AppleUSBHostController and AppleUSBHostPort should be considered opaque classes. <h3>Matching</h3> IOUSBHostDevice and IOUSBHostInterface matching uses the same properties as the deprecated IOUSBDevice and IOUSBInterface classes. See <a href="https://developer.apple.com/library/mac/qa/qa1076/_index.html">QA1076: Tips on USB driver matching for Mac OS X</a> for additional information. <h3>Power management</h3> IOUSBHostFamily supports more advanced power management capabilities, including pausing IO, and automatic suspend of idle devices. All of this functionality is guided by idle policies set on IOUSBHostInterface services and IOUSBHostPipe objects. The idle policy functionality allows most drivers to ignore suspend or resume events on the bus, and makes it unnecessary for them to actively participate in power management. <h4>Idle suspend</h4> By default, interfaces and pipes do not enable an idle policy, and the device will remain in the active (not suspended) state as long as the host machine is awake. To enable idle suspend, the driver controlling an IOUSBHostInterface must enable an idle policy with the <code>IOUSBHostInterface::setIdlePolicy</code> API. In the simple case of a device with only a single interface, when the interface's endpoints have no IO requests pending, the system will wait the time specified in the setIdlePolicy call, and then electrically suspend the device. A new IO request during the wait period will cancel the suspend, and a new IO request after the device has suspended will immediately resume the device and initiate the IO. In the more complex case of a device with multiple interfaces, a consensus idle policy must be calculated by finding the largest idle policy for all interfaces, excluding those which have not been opened by a driver. Selection of an idle policy depends on the individual device, and should factor in resume latency tolerance. The recommended idle policy for an interface is 50ms or larger. Idle suspend is disabled if a driver is the power child of the IOUSBHostDevice and resides in a power state with an input power requirement that does not include <code>kIOPMLowPower</code>. <h4>Pausing IO</h4> A more advanced approach to idle suspend allows the device to suspend while transfers are still pending. This is particularly useful for interfaces with interrupt IN endpoints that always have an IO pending, and otherwise would not idle suspend. To enable IO pause, endpoints that would otherwise keep the device in the active state must enable an idle policy with the <code>IOUSBHostPipe::setIdlePolicy</code> API. When an IOUSBHostPipe with an idle policy begins servicing a new IO, but does not complete it within the wait time specified in the idle policy, the IOUSBHostPipe is now considered idle and will not keep the device in the active state. Idle endpoints are still serviced on the bus, and the IOUSBHostPipe is capable of moving data even when idle. When all endpoints in the device have no pending IO requests or are idle, the idle suspend wait period begins as described above. If the idle suspend period elapses without any new IO requests that would cancel the suspend, IOUSBHostFamily will pause the transfers on the bus and suspend the device. IO requests are not aborted or returned to the driver when paused in this manner. After resuming the device due to a remote wake or a new IO request, the pending IO requests are resumed on the bus, and data movement can continue. If a large transfer is interrupted by a suspend, IOUSBHostFamily will combine the packets from before and after the suspend and return them as a single transfer result. Note that not all firmware supports a mid-transfer suspend/resume, and pausing IO should only be enabled for devices that have been tested for this use case. Control and isochronous IOUSBHostPipe objects never enable an idle policy, and pending IO on these endpoints will always prevent idle suspend. Selection of an idle policy depends on the individual endpoint, and should factor in resume latency tolerance and expected data transfer frequency. The recommended idle policy for IN-direction bulk and interrupt endpoints is 50ms or larger. Firmware must be capable of handling a mid-transfer suspend/resume, and should issue a remote wake when data is available to be read. Enabling an idle policy for OUT-direction bulk or interrupt endpoints is not generally recommended, but if enabled, firmware should have the ability to issue a remote wake when there is space in its endpoint buffer for additional data. <h4>System power state changes</h4> For devices that idle suspend, it may be necessary to perform IO as the system enters the sleep state, for example to enable wake-on-LAN for an Ethernet controller. Drivers that wish to perform this type of IO should call <code>IOService::registerInterestedDriver</code> on the PM root to be notified of system-level changes. During the <code>powerStateWillChangeTo</code> notification with a capability flag including <code>kIOPMSleepCapability</code>, the driver can initiate an IO request and resume the device. Once the driver acknowledges this <code>powerStateWillChangeTo</code> notification, the device may not be able to raise its power state until the system wakes. Attempting an IO request from other PM root <code>powerStateWillChangeTo</code> and <code>powerStateDidChangeTo</code> notifications may result in a deadlock waiting for a power state change. <h3>Comparison to IOUSBFamily</h3> Developers already familiar with IOUSBFamily can take advantage of new capabilities in IOUSBHostFamily that can simplify driver development and maintenace. <h4>Workloops</h4> IOUSBFamily provided a workloop for each controller, and all downstream devices shared that workloop. By contrast, each AppleUSBHostPort creates a workloop dedicated for its attached device, which significantly reduces lock contention and improves responsiveness for drivers attached to IOUSBHostDevice or IOUSBHostInterface services. Because the workloop is not shared across many unrelated services, driver developers are discouraged from creating an additional workloop. <h4>Synchronous IO from completion callbacks</h4> IOUSBFamily did not permit synchronous IO to be executed from a completion callback, but this restriction has been removed in IOUSBHostFamily. Driver developers can now issue a sequence of synchronous commands in a completion routine without chaining thread calls or using complex state machines. <h4>IO bookkeeping</h4> IOUSBHostFamily now tracks all outstanding IOs for an endpoint, and offers more predictable behavior when aborting transfers or terminating services. In most cases, driver developers no longer need to track the number of outstanding IOs, and can terminate their services with more determinism. <h3>Driver Recommendations</h3> <ul> <li>Do not create a separate workloop</li> <li>If joining the power plane, reside in a <code>kIOPMLowPower</code> state to enable idle suspend</li> <li>If supporting pausing IO, only enable an idle policy on bulk or interrupt IN endpoints</li> <li>If interested in system power state changes, call <code>registerInterestedDriver</code> on the PM root</li> </ul> */ #ifndef IOUSBHostFamily_IOUSBHostFamily_h #define IOUSBHostFamily_IOUSBHostFamily_h #include <IOKit/usb/StandardUSB.h> #include <IOKit/usb/IOUSBHostFamilyDefinitions.h> #define __IOUSBHOSTFAMILY_DEPRECATED __kpi_deprecated("Use USBDriverKit") #pragma mark Typedefs typedef uint16_t tUSBHostDeviceAddress; #pragma mark General enumerations #ifdef __cplusplus using namespace StandardUSB; #endif enum tEndpointDirection { kEndpointDirectionOut = (kEndpointDescriptorDirectionOut >> kEndpointDescriptorDirectionPhase), kEndpointDirectionIn = (kEndpointDescriptorDirectionIn >> kEndpointDescriptorDirectionPhase), kEndpointDirectionUnknown = 2 }; typedef enum tEndpointDirection tEndpointDirection; enum tEndpointType { kEndpointTypeControl = (kEndpointDescriptorTransferTypeControl >> kEndpointDescriptorTransferTypePhase), kEndpointTypeIsochronous = (kEndpointDescriptorTransferTypeIsochronous >> kEndpointDescriptorTransferTypePhase), kEndpointTypeBulk = (kEndpointDescriptorTransferTypeBulk >> kEndpointDescriptorTransferTypePhase), kEndpointTypeInterrupt = (kEndpointDescriptorTransferTypeInterrupt >> kEndpointDescriptorTransferTypePhase) }; typedef enum tEndpointType tEndpointType; enum tDeviceRequestDirection { kRequestDirectionOut = (kDeviceRequestDirectionOut >> kDeviceRequestDirectionPhase), kRequestDirectionIn = (kDeviceRequestDirectionIn >> kDeviceRequestDirectionPhase) }; typedef enum tDeviceRequestDirection tDeviceRequestDirection; enum tDeviceRequestType { kRequestTypeStandard = (kDeviceRequestTypeStandard >> kDeviceRequestTypePhase), kRequestTypeClass = (kDeviceRequestTypeClass >> kDeviceRequestTypePhase), kRequestTypeVendor = (kDeviceRequestTypeVendor >> kDeviceRequestTypePhase) }; typedef enum tDeviceRequestType tDeviceRequestType; enum tDeviceRequestRecipient { kRequestRecipientDevice = (kDeviceRequestRecipientDevice >> kDeviceRequestRecipientPhase), kRequestRecipientInterface = (kDeviceRequestRecipientInterface >> kDeviceRequestRecipientPhase), kRequestRecipientEndpoint = (kDeviceRequestRecipientEndpoint >> kDeviceRequestRecipientPhase), kRequestRecipientOther = (kDeviceRequestRecipientOther >> kDeviceRequestRecipientPhase) }; typedef enum tDeviceRequestRecipient tDeviceRequestRecipient; static inline uint8_t makeDeviceRequestbmRequestType(tDeviceRequestDirection direction, tDeviceRequestType type, tDeviceRequestRecipient recipient) { return ((direction << kDeviceRequestDirectionPhase) & kDeviceRequestDirectionMask) | ((type << kDeviceRequestTypePhase) & kDeviceRequestTypeMask) | ((recipient << kDeviceRequestRecipientPhase) & kDeviceRequestRecipientMask); } enum { kUSBHostVendorSpecificClass = 255, kUSBHostHubClass = 9, kUSBHostMaxDevices = 128, // The largest number of devices permitted on USB 2.0 buses kUSBHostMaxPipes = 32, // The largest number of endpoints permitted on USB devices kUSBHostMaxCountFullSpeedIsochronous = 1023, // max size (bytes) of any one Isoc frame for 1 FS endpoint kUSBHostVendorIDAppleComputer = 0x05AC }; /*! * @enum tInternalUSBHostConnectionSpeed * @brief Connection speeds used internally by IOUSBHostFamily */ enum tInternalUSBHostConnectionSpeed { kUSBHostConnectionSpeedLow = 0, kUSBHostConnectionSpeedFull = 1, kUSBHostConnectionSpeedHigh = 2, kUSBHostConnectionSpeedSuper = 3, kUSBHostConnectionSpeedSuperPlus = 4, kUSBHostConnectionSpeedSuperPlusBy2 = 5, kUSBHostConnectionSpeedCount = 6 }; /*! @definedblock IOUSBHostFamily message codes @discussion Messages passed between USB services using the <code>IOService::message</code> API. */ #define kUSBHostMessageUpdateIdlePolicy iokit_usbhost_msg(0x100) // 0xe0005100 Apple Internal use only. IOUSBHostInterface -> IOUSBHostDevice to update its idle policy. #define kUSBHostMessageRemoteWake iokit_usbhost_msg(0x101) // 0xe0005101 Apple Internal use only. AppleUSBHostController -> AppleUSBHostPort -> IOUSBHostDevice upon a remote wake event. Argument is locationID of remote wake. #define kUSBHostMessageDeviceSuspend iokit_usbhost_msg(0x102) // 0xe0005102 Apple Internal use only. IOUSBHostDevice -> clients upon a suspend event. #define kUSBHostMessageDeviceResume iokit_usbhost_msg(0x103) // 0xe0005103 Apple Internal use only. IOUSBHostDevice -> clients upon a resume event. #define kUSBHostMessagePortsCreated iokit_usbhost_msg(0x104) // 0xe0005104 Apple Internal use only. AppleUSBHostController and AppleUSBHub -> clients after all ports have been created. #define kUSBHostMessageDeviceConnected iokit_usbhost_msg(0x105) // 0xe0005105 Apple Internal use only. AppleUSBRemovablePort -> clients after a connect. #define kUSBHostMessageDeviceDisconnected iokit_usbhost_msg(0x106) // 0xe0005106 Apple Internal use only. AppleUSBRemovablePort -> clients after a disconnect. #define kUSBHostMessageControllerPoweredOn iokit_usbhost_msg(0x107) // 0xe0005107 Apple Internal use only. AppleEmbeddedUSBXHCIFL1100 -> FL1100Boot after a stable power state is reached. #define kUSBHostMessageNonInterruptIsochFrame iokit_usbhost_msg(0x108) // 0xe0005108 Apple Internal use only. #define kUSBHostMessageInterfaceAlternateSetting iokit_usbhost_msg(0x109) // 0xe0005109 Apple Internal use only. IOUSBHostInterface -> IOUSBInterface to update interface properties after an alternate setting is selected #define kUSBHostMessageDeviceLegacyCapture iokit_usbhost_msg(0x10A) // 0xe000510A Apple Internal use only. IOUSBHostDevice -> IOUSBDevice to relay user space re-enumeration for capturing/releasing devices #define kUSBHostMessageControllerInterrupt iokit_usbhost_msg(0x10B) // 0xe000510B Apple Internal use only. Source -> AppleUSBHostController to indicate an interrupt is ready for consumption // User Message Support #define kUSBLegacyMessagePortHasBeenSuspended iokit_usblegacy_err_msg(0x0d) // 0xe000400d Apple Internal use only. Message sent by an IOUSBDevice indicating the completion of a power change on the compatibility service #define kUSBLegacyMessagePortHasBeenResumed iokit_usblegacy_err_msg(0x0b) // 0xe000400b Apple Internal use only. Message sent by an IOUSBDevice indicating the completion of a power change on the compatibility service #define kUSBHostMessageOvercurrentCondition iokit_usblegacy_err_msg(0x13) // 0xe0004013 Apple Internal use only. Message sent to the clients of the device's hub parent, when a device causes an overcurrent condition. The message argument contains the locationID of the device #define kUSBHostMessageNotEnoughPower iokit_usblegacy_err_msg(0x14) // 0xe0004014 Apple Internal use only. Message sent to the clients of the device's hub parent, when a device causes an low power notice to be displayed. The message argument contains the locationID of the device #define kIOUSBHostMessageReallocateExtraCurrent iokit_usblegacy_err_msg(0x18) // 0xe0004018 Message to ask any clients using extra current to attempt to allocate it some more #define kUSBHostMessageEndpointCountExceeded iokit_usblegacy_err_msg(0x19) // 0xe0004019 Apple Internal use only. Message sent to a device when endpoints cannot be created because the USB controller ran out of resources #define kUSBHostMessageDeviceCountExceeded iokit_usblegacy_err_msg(0x1a) // 0xe000401a Apple Internal use only. Message sent by a hub when a device cannot be enumerated because the USB controller ran out of resources #define kUSBHostMessageUnsupportedConfiguration iokit_usblegacy_err_msg(0x1c) // 0xe000401c Apple Internal use only. Message sent to the clients of the device when a device is not supported in the current configuration. The message argument contains the locationID of the device #define kUSBHostMessageHubCountExceeded iokit_usblegacy_err_msg(0x1d) // 0xe000401d Apple Internal use only. Message sent when a 6th hub was plugged in and was not enumerated, as the USB spec only support 5 hubs in a chain #define kUSBHostMessageTDMLowBattery iokit_usblegacy_err_msg(0x1e) // 0xe000401e Apple Internal use only. Message sent when when an attached TDM system battery is running low. /*! @/definedblock */ /*! * @brief Port types returned by IOUSBHostDevice::getPortStatus * * @constant kUSBHostPortTypeStandard A general-purpose USB port. * @constant kUSBHostPortTypeCaptive The attached device cannot be physically disconnected from the port. * @constant kUSBHostPortTypeInternal The attached device cannot be physically disconnected from the host machine. * @constant kUSBHostPortTypeAccessory The attached device may require authentication before function drivers can access it. * @constant kUSBHostPortTypeCount The number of entries in this enum. */ enum tUSBHostPortType { kUSBHostPortTypeStandard = kIOUSBHostPortTypeStandard, kUSBHostPortTypeCaptive = kIOUSBHostPortTypeCaptive, kUSBHostPortTypeInternal = kIOUSBHostPortTypeInternal, kUSBHostPortTypeAccessory = kIOUSBHostPortTypeAccessory, kUSBHostPortTypeExpressCard = kIOUSBHostPortTypeExpressCard, kUSBHostPortTypeCount = kIOUSBHostPortTypeCount }; /*! * @brief Connection speeds returned by IOUSBHostDevice::getPortStatus * @discussion This enumeration matches the default speed ID mappings defined in XHCI 1.0 Table 147. * * @constant kUSBHostPortConnectionSpeedNone No device is connected * @constant kUSBHostPortConnectionSpeedFull A full-speed (12 Mb/s) device is connected * @constant kUSBHostPortConnectionSpeedLow A low-speed (1.5 Mb/s) device is connected * @constant kUSBHostPortConnectionSpeedHigh A high-speed (480 Mb/s) device is connected) * @constant kUSBHostPortConnectionSpeedSuper A superspeed (5 Gb/s) device is connected) * @constant kUSBHostPortConnectionSpeedSuperPlus A superspeed (10 Gb/s) device is connected) * @constant kUSBHostPortConnectionSpeedUSB3Gen2By2 A superspeed (20 Gb/s) device is connected) */ enum tUSBHostConnectionSpeed { kUSBHostPortConnectionSpeedNone = kIOUSBHostConnectionSpeedNone, kUSBHostPortConnectionSpeedFull = kIOUSBHostConnectionSpeedFull, kUSBHostPortConnectionSpeedLow = kIOUSBHostConnectionSpeedLow, kUSBHostPortConnectionSpeedHigh = kIOUSBHostConnectionSpeedHigh, kUSBHostPortConnectionSpeedSuper = kIOUSBHostConnectionSpeedSuper, kUSBHostPortConnectionSpeedSuperPlus = kIOUSBHostConnectionSpeedSuperPlus, kUSBHostPortConnectionSpeedSuperPlusBy2 = kIOUSBHostConnectionSpeedSuperPlusBy2, kUSBHostPortConnectionSpeedCount = kIOUSBHostConnectionSpeedCount }; /*! * @enum tOpenOptions * @brief Option bits used when calling ::open on IOUSBHostFamily services */ enum { kUSBHostOpenOptionSelectAlternateSetting = StandardUSBBit(16), // IOUSBHostInterface kUSBHostOpenOptionUserClientSession = StandardUSBBit(17) // IOUSBHostDevice: Reserved for AppleUSBHostUserClient objects }; /*! * @brief Values returned by IOUSBHostDevice::getPortStatus * * @constant kUSBHostPortStatusPortTypeMask The mask for bits representing the port type. * @constant kUSBHostPortStatusPortTypeStandard A general-purpose USB port. * @constant kUSBHostPortStatusPortTypeCaptive The attached device cannot be physically disconnected from the port. * @constant kUSBHostPortStatusPortTypeInternal The attached device cannot be physically disconnected from the host machine. * @constant kUSBHostPortStatusPortTypeAccessory The attached device may require authentication before function drivers can access it. * @constant kUSBHostPortStatusConnectedSpeedMask The mask for bits representing the connection state. * @constant kUSBHostPortStatusConnectedSpeedNone The port does not have a connected device. * @constant kUSBHostPortStatusConnectedSpeedFull The port has a full-speed device connected. * @constant kUSBHostPortStatusConnectedSpeedLow The port has a low-speed device connected. * @constant kUSBHostPortStatusConnectedSpeedHigh The port has a high-speed device connected. * @constant kUSBHostPortStatusConnectedSpeedSuper The port has a superspeed device connected. * @constant kUSBHostPortStatusResetting The port is currently resetting the link. * @constant kUSBHostPortStatusEnabled The port is enabled and packets are permitted to reach the device. Not valid unless kUSBHostPortStatusConnectedSpeedMask is nonzero. * @constant kUSBHostPortStatusSuspended The port is suspended. Not valid unless kUSBHostPortStatusConnectedSpeedMask is nonzero. * @constant kUSBHostPortStatusOvercurrent The port is in the overcurrent condition. * @constant kUSBHostPortStatusTestMode The port is in test mode. */ enum tUSBHostPortStatus { kUSBHostPortStatusPortTypeMask = kIOUSBHostPortStatusPortTypeMask, kUSBHostPortStatusPortTypePhase = kIOUSBHostPortStatusPortTypePhase, kUSBHostPortStatusPortTypeStandard = kIOUSBHostPortStatusPortTypeStandard, kUSBHostPortStatusPortTypeCaptive = kIOUSBHostPortStatusPortTypeCaptive, kUSBHostPortStatusPortTypeInternal = kIOUSBHostPortStatusPortTypeInternal, kUSBHostPortStatusPortTypeAccessory = kIOUSBHostPortStatusPortTypeAccessory, kUSBHostPortStatusPortTypeReserved = kIOUSBHostPortStatusPortTypeReserved, kUSBHostPortStatusConnectedSpeedMask = kIOUSBHostPortStatusConnectedSpeedMask, kUSBHostPortStatusConnectedSpeedPhase = kIOUSBHostPortStatusConnectedSpeedPhase, kUSBHostPortStatusConnectedSpeedNone = kIOUSBHostPortStatusConnectedSpeedNone, kUSBHostPortStatusConnectedSpeedFull = kIOUSBHostPortStatusConnectedSpeedFull, kUSBHostPortStatusConnectedSpeedLow = kIOUSBHostPortStatusConnectedSpeedLow, kUSBHostPortStatusConnectedSpeedHigh = kIOUSBHostPortStatusConnectedSpeedHigh, kUSBHostPortStatusConnectedSpeedSuper = kIOUSBHostPortStatusConnectedSpeedSuper, kUSBHostPortStatusConnectedSpeedSuperPlus = kIOUSBHostPortStatusConnectedSpeedSuperPlus, kUSBHostPortStatusConnectedSpeedSuperPlusBy2 = kIOUSBHostPortStatusConnectedSpeedSuperPlusBy2, kUSBHostPortStatusResetting = kIOUSBHostPortStatusResetting, kUSBHostPortStatusEnabled = kIOUSBHostPortStatusEnabled, kUSBHostPortStatusSuspended = kIOUSBHostPortStatusSuspended, kUSBHostPortStatusOvercurrent = kIOUSBHostPortStatusOvercurrent, kUSBHostPortStatusTestMode = kIOUSBHostPortStatusTestMode }; /*! @enum tUSBHostDefaultControlRequestTimeout @brief Default control request timeout values in milliseconds */ enum { #if USB_COMPLIANCE_MODE kUSBHostSetAddressTimeout = 50, // USB 2.0 9.2.6.3 kUSBHostStandardRequestNoDataTimeout = 500, // USB 2.0 9.2.6.4 kUSBHostStandardRequestCompletionTimeout = 5000, // USB 2.0 9.2.6.4 kUSBHostStandardRequestSimpleCompletionTimeout = 50, // USB 2.0 9.2.6.4 Standard request with no data stage kUSBHostClassRequestNoDataTimeout = 500, // USB 2.0 9.2.6.5 kUSBHostClassRequestCompletionTimeout = 5000, // USB 2.0 9.2.6.5 kUSBHostVendorRequestNoDataTimeout = 0, kUSBHostVendorRequestCompletionTimeout = 5000, #else // More tolerant timeout values for noncompliant devices kUSBHostSetAddressTimeout = 1000, kUSBHostStandardRequestNoDataTimeout = 0, kUSBHostStandardRequestCompletionTimeout = 5000, kUSBHostStandardRequestSimpleCompletionTimeout = 1000, kUSBHostClassRequestNoDataTimeout = 0, kUSBHostClassRequestCompletionTimeout = 5000, kUSBHostVendorRequestNoDataTimeout = 0, kUSBHostVendorRequestCompletionTimeout = 5000, #endif kUSBHostDefaultControlNoDataTimeoutMS = 0, kUSBHostDefaultControlCompletionTimeoutMS = 5000 }; #pragma mark APCI enumerations // ACPI 5.0a Table 9-227: UPC Return Package Values typedef enum { kUSBHostPortNotConnectable = 0, // Port is not connectable kUSBHostPortConnectable = 1 // Port is connectable either user visible or invisible } tUSBHostPortConnectable; // ACPI 5.0a Table 9-227: UPC Return Package Values typedef enum { kUSBHostConnectorTypeA = 0x00, kUSBHostConnectorTypeMiniAB = 0x01, kUSBHostConnectorTypeExpressCard = 0x02, kUSBHostConnectorTypeUSB3A = 0x03, kUSBHostConnectorTypeUSB3B = 0x04, kUSBHostConnectorTypeUSB3MicroB = 0x05, kUSBHostConnectorTypeUSB3MicroAB = 0x06, kUSBHostConnectorTypeUSB3PowerB = 0x07, kUSBHostConnectorTypeUSBTypeC = 0x09, kUSBHostConnectorTypeUnknown = 0xFE, kUSBHostConnectorTypeProprietary = 0xFF } tUSBHostConnectorType; /*! * @enum tUSBHostPowerSourceType * @brief Power sources used internally by IOUSBHostFamily * @constant kUSBHostPowerSourceTypeStaticPool The power source is a statically allocated pool for software to manage. * @constant kUSBHostPowerSourceTypeSMC The power source is managed by the SMC. * @constant kUSBHostPowerSourceTypeHardware The power source is guaranteed by the hardware and can always allocate the port current limit. */ typedef enum { kUSBHostPowerSourceTypeStaticPool = 0, kUSBHostPowerSourceTypeSMC, kUSBHostPowerSourceTypeHardware }tUSBHostPowerSourceType; #if TARGET_CPU_X86 || TARGET_CPU_X86_64 #ifndef kACPIDevicePathKey #define kACPIDevicePathKey "acpi-path" #endif #ifndef kACPIInterruptTypeValid #define kACPIInterruptTypeValid (1 << 1) #endif // ACPI methods #define kUSBHostACPIPropertyXHCICompanion "XHCN" // The number of the companion XHCI controller, used for multiplexed ports #define kUSBHostACPIPropertyMultiplexor "MUXS" // The ACPI method name for the port multiplexor // _UPC // _EJD #define kSDControllerGPIOResetACPIMethod "SRST" #define kSDControllerGPIOPowerACPIMethod "SPWR" #define kSDPortConnectionBehaviorACPIMethod "SBHV" #define kSDControllerGPIOResetPropertyKey "GPIO_RESET" #define kSDControllerCaptiveUSB3ReaderKey "U3SD" #define kGetBehaviorACPIMethod "GBHV" #define kGPEACPIString "_GPE" #define kRDYForGPIOTest "RDYG" #define kReconfiguredCount "RCFG" #define kUSBPlatformProperties "USBX" #define kUSBTypeCCableDetectACPIMethod "MODU" #define kUSBTypeCCableDetectACPIMethodSupported "RTPC" #define kGPEOCACPIString "GPOC" #define kACPIPortTimingOverride "TMG" // connection types returned by MODU method typedef enum { kUSBTypeCCableTypeNone = 0, kUSBTypeCCableTypeUSB = 1, } tUSBCTypeCableType; #endif typedef enum { kLinkStateU0 = 0, // USB3 Link State U0 (On) kLinkStateU1 = 1, // USB3 Link State U1 (Standby, fast exit) kLinkStateU2 = 2, // USB3 Link State U2 (Standby, slower exit) kLinkStateU3 = 3, // USB3 Link State U3 (Suspend) kLinkStateL0 = 0, // USB2 Link State L0 (On) kLinkStateL1 = 1, // USB2 Link State L1 (Sleep) kLinkStateL2 = 2, // USB2 Link State L2 (Suspend) kLinkStateL3 = 3, // USB2 Link State L3 (Off) } tUSBLinkState; typedef enum { kDescriptorExitLatency, // Descriptor Exit Latencies (DEL). kDeviceExitLatency, // Device Initiated Exit Latencies (PEL) kSystemExitLatency, // System Exit Latency (SEL) kMaxExitLatency, // Max Exit Latency (MEL) // USB2 LPM specific latencies kBestEffortServiceLatency, // Best Effort Service Latency kBestEffortServiceLatencyDeep, // Best Effort Service Latency Deep kDefaultBestEffortServiceLatency, // Default Best Effort Service Latency kDefaultBestEffortServiceLatencyDeep, // Default Best Effort Service Latency Deep kMaxL1BaseExitLatency, // Max Exit Latency for L1 while using BESL base value kMaxL1DeepExitLatency, // Max Exit Latency for L1 while using BESL Deep } tUSBLPMExitLatency; enum { kUSB3LPMMaxU1SEL = 0xFF, kUSB3LPMMaxU1PEL = 0xFF, kUSB3LPMMaxU2SEL = 0xFFFF, kUSB3LPMMaxU2PEL = 0xFFFF, kUSB3LPMMaxU1Timeout = 0x7F, kUSB3LPMU1Disabled = 0, kUSB3LPMU1AcceptOnly = 0xFF, kUSB3LPMMaxU2Timeout = 0xFE00, // In Micro Seconds kUSB3LPMU2Disabled = 0, // In Micro Seconds kUSB3LPMU2AcceptOnly = 0xFF00, // In Micro Seconds kUSB3LPMMaxT3SEL = 100, // SEL:T3 value as per USB 3.0 Section C.1.5.1 in Nano Seconds kUSB3LPMMaxHostSchDelay = 1000, // Maximum Host Scheduling Delay for Max Exit Latency Calculations kUSB3LPMExtraDeviceEL = 4000, // An additional delay(buffer) in Nano Seconds added to Exit Latency reported by the device in its BOS descriptor kUSB2LPMMaxL1Timeout = 0xFF00, // In Micro seconds }; typedef enum { kUSBDeviceLPMStatusDefault = 0, kUSBDeviceLPMStatusDisabled = 1, kUSBDeviceLPMStatusEnabled = 2 } tUSBDeviceLPMStatus; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostHIDDevice.h
/* * Copyright (c) 1998-2006 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef IOUSBHOSTHIDDEVICE_H #define IOUSBHOSTHIDDEVICE_H #include <IOKit/IOBufferMemoryDescriptor.h> #include <IOKit/hid/IOHIDDevice.h> #include <IOKit/usb/IOUSBHostInterface.h> #include <IOKit/usb/StandardUSB.h> #include <IOKit/usb/USBSpec.h> #include <IOKit/usb/IOUSBHostFamily.h> #include <IOKit/IOTimerEventSource.h> #define ENABLE_HIDREPORT_LOGGING 0 enum { kInterruptRetries = 10, kErrorRecoveryInterval = 50 // Milliseconds }; // from IOHIDDescriptorParser.h: // // types of HID reports (input, output, feature) // enum // { // kHIDInputReport = 1, // kHIDOutputReport, // kHIDFeatureReport, // kHIDUnknownReport = 255 // }; // // Report types from high level HID Manager: // from IOHIDKeys.h: // enum IOHIDReportType // { // kIOHIDReportTypeInput = 0, // kIOHIDReportTypeOutput, // kIOHIDReportTypeFeature, // kIOHIDReportTypeCount // }; // #define HID_MGR_2_USB_REPORT_TYPE(x) (x + 1) #define USB_2_HID_MGR_REPORT_TYPE(x) (x - 1) #define kHIDDriverRetryCount 3 #define kUSBHIDReportLoggingLevel "USB HID Report Logging Level" #define kUSBHID_DeviceIdleTimeout "Device Idle Timeout" #define kUSBHID_IoIdleTimeout "I/O Idle Timeout" #define kUSBHostHIDDevicePropertyIdlePolicy "kUSBHIDDeviceIdlePolicy" /*! @typedef IOUSBHostHIDDescriptor @discussion USB HID Descriptor. See the USB HID Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment. */ struct IOUSBHostHIDDescriptor : public StandardUSB::Descriptor { uint16_t descVersNum; uint8_t hidCountryCode; uint8_t hidNumDescriptors; uint8_t hidDescriptorType; uint8_t hidDescriptorLengthLo; uint8_t hidDescriptorLengthHi; } __attribute__((packed)); /*! @typedef IOUSBHIDReportDesc @discussion USB HID Report Descriptor header. See the USB HID Specification at <a href="http://www.usb.org"TARGET="_blank">http://www.usb.org</a>. (This structure should have used the #pragma pack(1) compiler directive to get byte alignment. */ struct IOUSBHostHIDReportDescriptor { uint8_t hidDescriptorType; uint8_t hidDescriptorLengthLo; uint8_t hidDescriptorLengthHi; } __attribute__((packed)); /*! @class IOUSBHostHIDDevice @abstract Driver that matches to USB HID devices. @discussion This class can be overriden to provide for specific behaviors. */ class IOUSBHostHIDDevice : public IOHIDDevice { OSDeclareDefaultStructors(IOUSBHostHIDDevice) private: typedef struct IOUSBHidExpansionData { uint8_t _bInterfaceNumber; } tIOUSBHidExpansionData; tIOUSBHidExpansionData *_expansionData; typedef struct { IOUSBHostCompletion usbCompletion; IOHIDCompletion* hidCompletion; IOMemoryDescriptor* report; } tAsyncContext; protected: IOWorkLoop *_workLoop; IOCommandGate *_gate; IOUSBHostDevice *_device; IOUSBHostInterface *_interface; IOUSBHostPipe *_interruptPipe; IOUSBHostPipe *_interruptOutPipe; IOBufferMemoryDescriptor *_buffer; IOMemoryDescriptor *_zlpDescriptor; IOUSBHostCompletion _completion; IOUSBHostCompletion _zlpCompletion; bool _interruptReadPending; uint32_t _interruptOutMaxSize; uint32_t _zlpBuffer; uint32_t _debugLoggingMask; int32_t _interruptRetries; IOTimerEventSource *_interruptRetriesTimer; // IOHIDDevice Methods virtual bool handleStart (IOService *provider); virtual void interruptRetry(IOTimerEventSource* timer); // IOUSBHIDDevice Methods virtual IOReturn setProtocol (uint16_t protocol); virtual OSString* getStringAtIndex (uint8_t index, uint16_t lang = 0x0409) const; virtual IOReturn getHidDescriptor (uint8_t inDescriptorType, uint8_t inDescriptorIndex, uint8_t *vOutBuf, uint32_t *vOutSize) const; virtual IOReturn getHidDescriptorGated (uint8_t inDescriptorType, uint8_t inDescriptorIndex, uint8_t *vOutBuf, uint32_t *vOutSize) const; virtual IOReturn readInterruptPipeAsync (void); virtual IOReturn readInterruptPipeAsyncGated (void); virtual void interruptReadComplete (void *parameter, IOReturn status, uint32_t bytesTransferred); virtual void setReportComplete (void *parameter, IOReturn status, uint32_t bytesTransferred); virtual void zlpWriteComplete (void *parameter, IOReturn status, uint32_t bytesTransferred); // Protected pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 0); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 1); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 2); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 3); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 4); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 5); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 6); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 7); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 8); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 9); public: // IOService Methods virtual bool start (IOService *provider); virtual bool willTerminate (IOService *provider, IOOptionBits options); virtual void stop (IOService *provider); virtual void free (void); virtual bool setProperty(const OSSymbol* aKey, OSObject* anObject); virtual bool setProperty(const OSString* aKey, OSObject* anObject); virtual bool setProperty(const char* aKey, OSObject* anObject); virtual bool setProperty(const char* aKey, const char * aString); virtual bool setProperty(const char* aKey, bool aBoolean); virtual bool setProperty(const char* aKey, unsigned long long aValue, unsigned int aNumberOfBits); virtual bool setProperty(const char* aKey, void* bytes, unsigned int length); // IOHIDDevice Methods virtual IOReturn newReportDescriptor (IOMemoryDescriptor **descriptor ) const; virtual OSString* newTransportString (void) const; virtual OSString* newManufacturerString (void) const; virtual OSString* newProductString (void) const; virtual OSString* newSerialNumberString (void) const; virtual OSNumber* newVendorIDNumber (void) const; virtual OSNumber* newProductIDNumber (void) const; virtual OSNumber* newVersionNumber (void) const; virtual OSNumber* newLocationIDNumber (void) const; virtual OSNumber* newCountryCodeNumber (void) const; virtual IOReturn getReport (IOMemoryDescriptor *report, IOHIDReportType reportType, IOOptionBits options); virtual IOReturn setReport (IOMemoryDescriptor *report, IOHIDReportType reportType, IOOptionBits options = 0); virtual IOReturn setReport(IOMemoryDescriptor * report, IOHIDReportType reportType, IOOptionBits options, UInt32 completionTimeout, IOHIDCompletion* completion = 0); // IOUSBHIDDevice Methods virtual IOReturn SetIdleMillisecs (UInt16 msecs); virtual UInt32 getMaxReportSize (void) const; virtual OSString* newIndexedString (UInt8 index) const; virtual OSNumber* newReportIntervalNumber() const; // Public pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 10); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 11); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 12); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 13); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 14); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 15); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 16); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 17); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 18); OSMetaClassDeclareReservedUnused(IOUSBHostHIDDevice, 19); }; #endif // IOUSBHOSTHIDDEVICE_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/USBSpec.h
/* * Copyright � 1998-2012 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ /* * Constants that both OS9 and OSX want to define, and whose values are * specified by the USB Standard. * Put in a seperate file so they can be included if the OS9 include file isn't already * included. */ #ifndef _USBSPEC_H #define _USBSPEC_H #include <IOKit/usb/AppleUSBDefinitions.h> #include <IOKit/usb/IOUSBHostFamilyDefinitions.h> #if defined(__has_include) #if __has_include(<IOKit/usb/IOUSBHostFamily.h>) #include <IOKit/usb/IOUSBHostFamily.h> #endif #if __has_include(<IOKit/usb/StandardUSB.h>) #include <IOKit/usb/StandardUSB.h> #ifdef __cplusplus using namespace StandardUSB; #endif #endif #endif #ifdef __cplusplus extern "C" { #endif #if TARGET_OS_OSX || TARGET_OS_MACCATALYST /* Nothing to define */ #else /* @enum Feature constants @discussion Used with SET_FEATURE requests */ enum { kUSBFunctionSuspendLowPower = kIOUSBInterfaceSuspendLowPower, kUSBFunctionSuspendEnableRemoteWake = kIOUSBInterfaceSuspendRemoteWakeEnable }; /*! @enum Device Status @discussion Specified bits returned by a get status request */ enum { kUSBDeviceStatusSelfPowered = kIOUSBDeviceStatusSelfPowered, kUSBDeviceStatusRemoteWake = kIOUSBDeviceStatusRemoteWakeEnable, kUSBDeviceStatusU1Enable = kIOUSBDeviceStatusU1Enable, kUSBDeviceStatusU2Enable = kIOUSBDeviceStatusU2Enable, kUSBDeviceStatusLTMEnable = kIOUSBDeviceStatusLTMEnable, kUSBInterfaceStatusFunctionRemoteWakeCapable = kIOUSBInterfaceStatusRemoteWakeCapable, kUSBInterfaceStatusFunctionRemoteWake = kIOUSBInterfaceStatusRemoteWakeEnable, kUSBPipeStatusHalt = IOUSBEndpointStatusHalt }; #endif /*! @header USBSpec.h @abstract Constants and definitions of parameters that are used in communcating with USB devices and interfaces. @discussion */ /*! @enum Endpoint type @discussion Used in IOUSBFindEndpointRequest's type field */ enum { kUSBControl = kIOUSBEndpointTypeControl, kUSBIsoc = kIOUSBEndpointTypeIsochronous, kUSBBulk = kIOUSBEndpointTypeBulk, kUSBInterrupt = kIOUSBEndpointTypeInterrupt, kUSBAnyType = 0xFF }; /*! @enum Endpoint direction @discussion Used in IOUSBFindEndpointRequest's direction field */ enum { kUSBOut = kIOUSBEndpointDirectionOut, kUSBIn = kIOUSBEndpointDirectionIn, kUSBNone = kIOUSBEndpointDirectionUnknown, kUSBAnyDirn = 3 }; /*! @enum Device Request Type @discussion This type is encoded in the bmRequestType field of a Device Request. It specifies the type of request: standard, class or vendor specific. */ enum { kUSBStandard = kIOUSBDeviceRequestTypeValueStandard, kUSBClass = kIOUSBDeviceRequestTypeValueClass, kUSBVendor = kIOUSBDeviceRequestTypeValueVendor }; /*! @enum Device Request Recipient @discussion This recipient is encoded in the bmRequestType field of a Device Request. It specifies the type of recipient for a request: the device, the interface, or an endpoint. */ enum { kUSBDevice = kIOUSBDeviceRequestRecipientValueDevice, kUSBInterface = kIOUSBDeviceRequestRecipientValueInterface, kUSBEndpoint = kIOUSBDeviceRequestRecipientValueEndpoint, kUSBOther = kIOUSBDeviceRequestRecipientValueOther }; /*! @enum Device Request @discussion Specifies values for the bRequest field of a Device Request. */ enum { kUSBRqGetStatus = kIOUSBDeviceRequestGetStatus, kUSBRqClearFeature = kIOUSBDeviceRequestClearFeature, kUSBRqGetState = kIOUSBDeviceRequestGetState, kUSBRqSetFeature = kIOUSBDeviceRequestSetFeature, kUSBRqReserved2 = 4, kUSBRqSetAddress = kIOUSBDeviceRequestSetAddress, kUSBRqGetDescriptor = kIOUSBDeviceRequestGetDescriptor, kUSBRqSetDescriptor = kIOUSBDeviceRequestSetDescriptor, kUSBRqGetConfig = kIOUSBDeviceRequestGetConfiguration, kUSBRqSetConfig = kIOUSBDeviceRequestSetConfiguration, kUSBRqGetInterface = kIOUSBDeviceRequestGetInterface, kUSBRqSetInterface = kIOUSBDeviceRequestSetInterface, kUSBRqSyncFrame = kIOUSBDeviceRequestSynchFrame, kUSBSetSel = kIOUSBDeviceRequestSetSel, kUSBSetIsochDelay = kIOUSBDeviceRequestSetIsochronousDelay }; /*! @enum USB Descriptors @discussion Specifies values for diffent descriptor types. */ enum { kUSBAnyDesc = 0, // Wildcard for searches kUSBDeviceDesc = kIOUSBDescriptorTypeDevice, kUSBConfDesc = kIOUSBDescriptorTypeConfiguration, kUSBStringDesc = kIOUSBDescriptorTypeString, kUSBInterfaceDesc = kIOUSBDescriptorTypeInterface, kUSBEndpointDesc = kIOUSBDescriptorTypeEndpoint, kUSBDeviceQualifierDesc = kIOUSBDescriptorTypeDeviceQualifier, kUSBOtherSpeedConfDesc = kIOUSBDescriptorTypeOtherSpeedConfiguration, kUSBInterfacePowerDesc = kIOUSBDescriptorTypeInterfacePower, kUSBOnTheGoDesc = kIOUSBDescriptorTypeOTG, kUSDebugDesc = kIOUSBDescriptorTypeDebug, kUSBInterfaceAssociationDesc = kIOUSBDescriptorTypeInterfaceAssociation, kUSBBOSDescriptor = kIOUSBDescriptorTypeBOS, kUSBDeviceCapability = kIOUSBDescriptorTypeDeviceCapability, kUSBSuperSpeedEndpointCompanion = kIOUSBDescriptorTypeSuperSpeedUSBEndpointCompanion, kUSB3HUBDesc = kIOUSBDescriptorTypeSuperSpeedHub, kUSBHIDDesc = kIOUSBDecriptorTypeHID, kUSBReportDesc = kIOUSBDecriptorTypeReport, kUSBPhysicalDesc = 0x23, kUSBHUBDesc = kIOUSBDescriptorTypeHub, }; /*! @enum Device Capability Types @discussion Used with decoding the Device Capability descriptor */ enum { kUSBDeviceCapabilityWirelessUSB = kIOUSBDeviceCapabilityTypeWireless, kUSBDeviceCapabilityUSB20Extension = kIOUSBDeviceCapabilityTypeUSB20Extension, kUSBDeviceCapabilitySuperSpeedUSB = kIOUSBDeviceCapabilityTypeSuperSpeed, kUSBDeviceCapabilityContainerID = kIOUSBDeviceCapabilityTypeContainerID, kUSBDeviceCapabilityBillboard = kIOUSBDeviceCapabilityTypeBillboard, kUSBDeviceCapabilityBillboardAltMode = kIOUSBDeviceCapabilityTypeBillboardAltMode }; /*! @enum Feature Selectors @discussion Used with SET/CLEAR_FEATURE requests. */ enum { kUSBFeatureEndpointStall = IOUSBEndpointFeatureSelectorStall, // Endpoint kUSBFeatureDeviceRemoteWakeup = kIOUSBDeviceFeatureSelectorRemoteWakeup, // Device kUSBFeatureTestMode = kIOUSBDeviceFeatureSelectorTestMode, // Device kUSBFeatureFunctionSuspend = kIOUSBInterfaceFeatureSelectorSuspend, // Interface kUSBFeatureU1Enable = kIOUSBDeviceFeatureSelectorU1Enable, // Device kUSBFeatureU2Enable = kIOUSBDeviceFeatureSelectorU2Enable, // Device kUSBFeatureLTMEnable = kIOUSBDeviceFeatureSelectorLTMEnable // Device }; /*! @enum Miscellaneous bits and masks */ enum { kUSBFunctionRemoteWakeCapableBit = IOUSBBit(0), // GET_STATUS kUSBFunctionRemoteWakeupBit = IOUSBBit(1), // GET_STATUS kUSBLowPowerSuspendStateBit = IOUSBBit(0), // SET_FEATURE(FUNCTION_SUSPEND) kUSBFunctionRemoteWakeEnableBit = IOUSBBit(1) // SET_FEATURE(FUNCTION_SUSPEND) }; /*! @enum USB Power constants @discussion Constants relating to USB Power. */ enum { kUSB100mAAvailable = 50, kUSB500mAAvailable = 250, kUSB100mA = 50, kUSBAtrBusPowered = 0x80, kUSBAtrSelfPowered = 0x40, kUSBAtrRemoteWakeup = 0x20, kUSB2MaxPowerPerPort = kIOUSB20BusCurrentDefault, kUSB150mAAvailable = 75, kUSB900mAAvailable = 450, kUSB150mA = 75, kUSB3MaxPowerPerPort = kIOUSB30BusCurrentDefault }; /*! @enum USB Release constants @discussion Constants relating to USB releases as found in the bcdUSB field of the Device Descriptor. */ enum { kUSBRel10 = 0x0100, kUSBRel11 = 0x0110, kUSBRel20 = 0x0200, kUSBRel30 = 0x0300 }; /*! @enum HID requests @discussion Constants for HID requests. */ enum { kHIDRqGetReport = 1, kHIDRqGetIdle = 2, kHIDRqGetProtocol = 3, kHIDRqSetReport = 9, kHIDRqSetIdle = 10, kHIDRqSetProtocol = 11 }; /*! @enum HID report types @discussion Constants for the three kinds of HID reports. */ enum { kHIDRtInputReport = 1, kHIDRtOutputReport = 2, kHIDRtFeatureReport = 3 }; /*! @enum HID Protocol @discussion Used in the SET_PROTOCOL device request */ enum { kHIDBootProtocolValue = 0, kHIDReportProtocolValue = 1 }; enum { kUSBCapsLockKey = 0x39, kUSBNumLockKey = 0x53, kUSBScrollLockKey = 0x47 }; /*! @enum Device Class Codes @discussion Constants for USB Device classes (bDeviceClass). */ enum { kUSBCompositeClass = 0, kUSBCommClass = 2, // Deprecated kUSBCommunicationClass = 2, kUSBHubClass = 9, kUSBDataClass = 10, kUSBPersonalHealthcareClass = 15, kUSBBillBoardClass = 17, kUSBDiagnosticClass = 220, kUSBWirelessControllerClass = 224, kUSBMiscellaneousClass = 239, kUSBApplicationSpecificClass = 254, kUSBVendorSpecificClass = 255 }; /*! @enum Interface Class @discussion Constants for Interface classes (bInterfaceClass). */ enum { kUSBAudioClass = 1, // Deprecated kUSBAudioInterfaceClass = 1, kUSBCommunicationControlInterfaceClass = 2, kUSBCommunicationDataInterfaceClass = 10, kUSBHIDClass = 3, kUSBHIDInterfaceClass = 3, kUSBPhysicalInterfaceClass = 5, kUSBImageInterfaceClass = 6, kUSBPrintingClass = 7, // Deprecated kUSBPrintingInterfaceClass = 7, kUSBMassStorageClass = 8, // Deprecated kUSBMassStorageInterfaceClass = 8, kUSBChipSmartCardInterfaceClass = 11, kUSBContentSecurityInterfaceClass = 13, kUSBVideoInterfaceClass = 14, kUSBPersonalHealthcareInterfaceClass = 15, kUSBDiagnosticDeviceInterfaceClass = 220, kUSBWirelessControllerInterfaceClass = 224, kUSBApplicationSpecificInterfaceClass = 254, kUSBVendorSpecificInterfaceClass = 255 }; // Obsolete enum { kUSBDisplayClass = 4 // Obsolete }; /*! @enum Interface SubClass @discussion Constants for USB Interface SubClasses (bInterfaceSubClass). */ enum { kUSBCompositeSubClass = 0, kUSBHubSubClass = 0, // For the kUSBAudioInterfaceClass // kUSBAudioControlSubClass = 0x01, kUSBAudioStreamingSubClass = 0x02, kUSBMIDIStreamingSubClass = 0x03, // For the kUSBApplicationSpecificInterfaceClass // kUSBDFUSubClass = 0x01, kUSBIrDABridgeSubClass = 0x02, kUSBTestMeasurementSubClass = 0x03, // For the kUSBMassStorageInterfaceClass // kUSBMassStorageRBCSubClass = 0x01, kUSBMassStorageATAPISubClass = 0x02, kUSBMassStorageQIC157SubClass = 0x03, kUSBMassStorageUFISubClass = 0x04, kUSBMassStorageSFF8070iSubClass = 0x05, kUSBMassStorageSCSISubClass = 0x06, // For the kUSBHIDInterfaceClass // kUSBHIDBootInterfaceSubClass = 0x01, // For the kUSBCommunicationDataInterfaceClass // kUSBCommDirectLineSubClass = 0x01, kUSBCommAbstractSubClass = 0x02, kUSBCommTelephoneSubClass = 0x03, kUSBCommMultiChannelSubClass = 0x04, kUSBCommCAPISubClass = 0x05, kUSBCommEthernetNetworkingSubClass = 0x06, kUSBATMNetworkingSubClass = 0x07, // For the kUSBDiagnosticDeviceInterfaceClass // kUSBReprogrammableDiagnosticSubClass = 0x01, // For the kUSBWirelessControllerInterfaceClass // kUSBRFControllerSubClass = 0x01, // For the kUSBMiscellaneousClass // kUSBCommonClassSubClass = 0x02, // For the kUSBVideoInterfaceClass // kUSBVideoControlSubClass = 0x01, kUSBVideoStreamingSubClass = 0x02, kUSBVideoInterfaceCollectionSubClass = 0x03 }; enum USBClassSpecificDesc { kUSBClassSpecificDescriptor = 0x24 }; /*! @enum Interface Protocol @discussion Reported in the bInterfaceProtocol field of the Interface Descriptor. */ enum { // For kUSBHubClass kHubSuperSpeedProtocol = 3, // For kUSBHIDInterfaceClass // kHIDNoInterfaceProtocol = 0, kHIDKeyboardInterfaceProtocol = 1, kHIDMouseInterfaceProtocol = 2, kUSBVendorSpecificProtocol = 0xff, // For kUSBDiagnosticDeviceInterfaceClass // kUSB2ComplianceDeviceProtocol = 0x01, // For kUSBWirelessControllerInterfaceClass // kUSBBluetoothProgrammingInterfaceProtocol = 0x01, // For kUSBMiscellaneousClass // KUSBInterfaceAssociationDescriptorProtocol = 0x01, // For Mass Storage // kMSCProtocolControlBulkInterrupt = 0x00, kMSCProtocolControlBulk = 0x01, kMSCProtocolBulkOnly = 0x50, kMSCProtocolUSBAttachedSCSI = 0x62 }; /*! @enum DFU Class Attributes @discussion */ enum { kUSBDFUAttributesMask = 0x07, kUSBDFUCanDownloadBit = 0, kUSBDFUCanUploadBit = 1, kUSBDFUManifestationTolerantBit = 2 }; /*! @enum Printer Class Requests @discussion The bRequest parameter for Printing Class Sepcific Requests */ enum { kUSPrintingClassGetDeviceID = 0, kUSPrintingClassGePortStatus = 1, kUSPrintingClassSoftReset = 2 }; /*! @enum Endpoint Descriptor bits @discussion Bit definitions for endpoint descriptor fields */ enum { kUSBbEndpointAddressMask = 0x0f, kUSBbEndpointDirectionBit = kIOUSBEndpointDescriptorDirectionPhase, kUSBbEndpointDirectionMask = kIOUSBEndpointDescriptorDirection, kUSBEndpointDirectionOut = kIOUSBEndpointDescriptorDirectionOut, kUSBEndpointDirectionIn = kIOUSBEndpointDescriptorDirectionIn, kUSBEndpointbmAttributesTransferTypeMask = kIOUSBEndpointDescriptorTransferType, kUSBEndpointbmAttributesSynchronizationTypeMask = kIOUSBEndpointDescriptorSynchronizationType, kUSBEndpointbmAttributesSynchronizationTypeShift = 2, kUSBEndpointbmAttributesUsageTypeMask = kIOUSBEndpointDescriptorUsageType, kUSBEndpointbmAttributesUsageTypeShift = 4, kUSBPeriodicInterruptUsageType = 0, kUSBNotificationInterruptUsageType = 1, kUSBNoSynchronizationIsocSyncType = 0, kUSBAsynchronousIsocSyncType = 1, kUSBAdaptiveIsocSyncType = 2, kUSBSynchronousIsocSyncType = 3, kUSBDataIsocUsageType = 0, kUSBFeedbackIsocUsageType = 1, kUSBImplicitFeedbackDataIsocUsageType = 2 }; /*! @enum USB Device Capability Type constants @discussion Bit definitions and constants for different values of USB Device Capability types */ enum { kUSB20ExtensionLPMSupported = 1, // Bit 1 of bmAttributes of USB 2.0 Extension Device Capability kUSBSuperSpeedLTMCapable = 1, // Bit 1 of bmAttributes of SuperSpeed USB Device Capability kUSBSuperSpeedSupportsLS = 0, // Value of wSpeedSupported indicating that the device supports low speed kUSBSuperSpeedSupportsFS = 1, // Value of wSpeedSupported indicating that the device supports full speed kUSBSuperSpeedSupportsHS = 2, // Value of wSpeedSupported indicating that the device supports high speed kUSBSuperSpeedSupportsSS = 3, // Value of wSpeedSupported indicating that the device supports 5 Gbps }; /*! @enum USB Device Billboard Capability Vconn Power constants @discussion Power needed by the adapter for full functionality */ enum { kUSBBillboardVConn1Watt = 0, kUSBBillboardVConn1P5Watt = 1, kUSBBillboardVConn2Watt = 2, kUSBBillboardVConn3Watt = 3, kUSBBillboardVConn4Watt = 4, kUSBBillboardVConn5Watt = 5, kUSBBillboardVConn6Watt = 6, kUSBBillboardVConnReserved = 7 }; /*! @defineblock USB Billboard Capability Descriptor Constant @define kUSBBillboardVConnNoPowerReq bit position for No Power Required, VConn b2:0 are ignored when this bit is set */ #define kUSBBillboardVConnNoPowerReq 15 /*! @/defineblock */ /*! @enum USB Device Billboard Capability bmConfigured constants @ A bit pair signifying the state of Alternate Modes */ enum { kUSBBillboardUnspecifiedError = 0, kUSBBillboardConfigNotAttempted = 1, kUSBBillboardConfigUnsuccessful = 2, kUSBBillboardAltModeConfigSuccess = 3 }; /*! @enum USB Device Billboard Capability AdditionalFailureInfo constants @ A bit field signifying additional failure information */ enum { kUSBBillboardAdditinalInfoNoPower = 1, kUSBBillboardAdditinalInfoNoUSBPD = 2 }; /*! @defineblock USB Descriptor and IORegistry constants @discussion Various constants used to describe the fields in the various USB Device Descriptors and IORegistry names used for some of those fields @define kUSBDeviceClass The field in the USB Device Descriptor corresponding to the device class @define kUSBDeviceSubClass The field in the USB Device Descriptor corresponding to the device sub class @define kUSBDeviceProtocol The field in the USB Device Descriptor corresponding to the device protocol @define kUSBDeviceMaxPacketSize The field in the USB Device Descriptor corresponding to the maximum packet size for endpoint 0 @define kUSBVendorID The field in the USB Device Descriptor corresponding to the device USB Vendor ID @define kUSBVendorName Deprecated. Use kUSBVendorID @define kUSBProductID The field in the USB Device Descriptor corresponding to the device USB Product ID @define kUSBProductName Deprecated. Use kUSBProductID @define kUSBDeviceReleaseNumber The field in the USB Device Descriptor corresponding to the device release version @define kUSBManufacturerStringIndex The field in the USB Device Descriptor corresponding to the index for the manufacturer's string @define kUSBProductStringIndex The field in the USB Device Descriptor corresponding to the index for the product name's string @define kUSBSerialNumberStringIndex The field in the USB Device Descriptor corresponding to the index for the serial number's string @define kUSBDeviceNumConfigs The field in the USB Configuration Descriptor corresponding to the number of configurations @define kUSBInterfaceNumber The field in the USB Configuration Descriptor corresponding to the number of configurations @define kUSBAlternateSetting The field in the USB Configuration Descriptor corresponding to the number of configurations @define kUSBNumEndpoints The field in the USB Configuration Descriptor corresponding to the number of configurations @define kUSBInterfaceClass The field in the USB Interface Descriptor corresponding to the interface class @define kUSBInterfaceSubClass The field in the USB Interface Descriptor corresponding to the interface sub class @define kUSBInterfaceProtocol The field in the USB Interface Descriptor corresponding to the interface protocol @define kUSBInterfaceStringIndex The field in the USB Interface Descriptor corresponding to the index for the interface name's string @define kUSBConfigurationValue The field in the USB Interface Descriptor corresponding to the configuration @define kUSBProductString IORegistry key for the device's USB Product string @define kUSBVendorString IORegistry key for the device's USB manufacturer string @define kUSBSerialNumberString IORegistry key for the device's USB serial number string @define kUSB1284DeviceID IORegistry key for the 1284 Device ID of a printer */ #define kUSBDeviceClass kUSBHostMatchingPropertyDeviceClass #define kUSBDeviceSubClass kUSBHostMatchingPropertyDeviceSubClass #define kUSBDeviceProtocol kUSBHostMatchingPropertyDeviceProtocol #define kUSBDeviceMaxPacketSize kUSBHostDevicePropertyMaxPacketSize #define kUSBVendorID kUSBHostMatchingPropertyVendorID #define kUSBVendorName kUSBVendorID // bad name - keep for backward compatibility #define kUSBProductID kUSBHostMatchingPropertyProductID #define kUSBProductName kUSBProductID // bad name - keep for backward compatibility #define kUSBDeviceReleaseNumber kUSBHostMatchingPropertyDeviceReleaseNumber #define kUSBManufacturerStringIndex kUSBHostDevicePropertyManufacturerStringIndex #define kUSBProductStringIndex kUSBHostDevicePropertyProductStringIndex #define kUSBSerialNumberStringIndex kUSBHostDevicePropertySerialNumberStringIndex #define kUSBDeviceNumConfigs kUSBHostDevicePropertyNumConfigs #define kUSBInterfaceNumber kUSBHostMatchingPropertyInterfaceNumber #define kUSBAlternateSetting kUSBHostInterfacePropertyAlternateSetting #define kUSBNumEndpoints kUSBHostInterfacePropertyNumEndpoints #define kUSBInterfaceClass kUSBHostMatchingPropertyInterfaceClass #define kUSBInterfaceSubClass kUSBHostMatchingPropertyInterfaceSubClass #define kUSBInterfaceProtocol kUSBHostMatchingPropertyInterfaceProtocol #define kUSBInterfaceStringIndex kUSBHostInterfacePropertyStringIndex #define kUSBConfigurationValue kUSBHostMatchingPropertyConfigurationValue #define kUSBInterfaceString kUSBHostInterfacePropertyString #define kUSB1284DeviceID "1284 Device ID" #define kUSBCompatibilityMatch "USBCompatibilityMatch" #define kUSBStandardVersion kUSBHostDevicePropertyStandardVersion #define kUSBSpecReleaseNumber kUSBStandardVersion #define kUSBDeviceContainerID kUSBContainerID #define kUSBContainerID kUSBHostDevicePropertyContainerID #if TARGET_OS_OSX || TARGET_OS_MACCATALYST #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_14 #define kUSBProductString "USB Product Name" #define kUSBVendorString "USB Vendor Name" #define kUSBSerialNumberString "USB Serial Number" #else #define kUSBProductString kUSBHostDevicePropertyProductString #define kUSBVendorString kUSBHostDevicePropertyVendorString #define kUSBSerialNumberString kUSBHostDevicePropertySerialNumberString #endif /* MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_14 */ #else #define kUSBProductString kUSBHostDevicePropertyProductString #define kUSBVendorString kUSBHostDevicePropertyVendorString #define kUSBSerialNumberString kUSBHostDevicePropertySerialNumberString #endif /*! @enum Apple USB Vendor ID @discussion Apple's vendor ID, assigned by the USB-IF */ enum { kAppleVendorID = kIOUSBAppleVendorID }; #ifdef __cplusplus } #endif #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostFamilyDefinitions.h
/* * Copyright (c) 1998-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header IOUSBHostFamilyDefinitions.h @brief Definitions used for the IOUSBHostFamily !*/ #ifndef IOUSBHostFamily_IOUSBHostFamilyDefinitions_h #define IOUSBHostFamily_IOUSBHostFamilyDefinitions_h #include <TargetConditionals.h> #if TARGET_OS_DRIVERKIT #include <stdint.h> #include <stddef.h> #include <sys/_types/_uuid_t.h> #include <DriverKit/IOTypes.h> #include <DriverKit/IOLib.h> #else #include <IOKit/IOTypes.h> #include <libkern/OSByteOrder.h> #endif #define IOUSBHostFamilyBit(bit) ((uint32_t)(1) << bit) #define IOUSBHostFamilyBitRange(start, end) (~(((uint32_t)(1) << start) - 1) & (((uint32_t)(1) << end) | (((uint32_t)(1) << end) - 1))) #define IOUSBHostFamilyBitRange64(start, end) (~(((uint64_t)(1) << start) - 1) & (((uint64_t)(1) << end) | (((uint64_t)(1) << end) - 1))) #define IOUSBHostFamilyBitRangePhase(start, end) (start) #define iokit_usb_codemask IOUSBHostFamilyBitRange(0, 11) #define iokit_usbhost_group (1 << IOUSBHostFamilyBitRangePhase(12, 13)) #define iokit_usblegacy_group (0 << IOUSBHostFamilyBitRangePhase(12, 13)) #define iokit_usbhost_err(message) ((IOReturn)(iokit_family_err(sub_iokit_usb, iokit_usbhost_group | (message & iokit_usb_codemask)))) #define iokit_usbhost_msg(message) ((uint32_t)(iokit_family_msg(sub_iokit_usb, iokit_usbhost_group | (message & iokit_usb_codemask)))) #define iokit_usblegacy_err_msg(message) ((uint32_t)(sys_iokit | sub_iokit_usb | message)) /*! @definedblock IOUSBHostFamily message codes @discussion Messages passed between USB services using the <code>IOService::message</code> API. */ #define kUSBHostMessageConfigurationSet iokit_usbhost_msg(0x00) // 0xe0005000 IOUSBHostDevice -> clients upon a setConfiguration call. #define kUSBHostMessageRenegotiateCurrent iokit_usbhost_msg(0x01) // 0xe0005001 Request clients to renegotiate bus current allocations #define kUSBHostMessageControllerException iokit_usbhost_msg(0x02) // 0xe0005002 A fatal problem has occurred with an AppleUSBUserHCI controller #define kUSBHostReturnPipeStalled iokit_usbhost_err(0x0) // 0xe0005000 Pipe has issued a STALL handshake. Use clearStall to clear this condition. #define kUSBHostReturnNoPower iokit_usbhost_err(0x1) // 0xe0005001 A setConfiguration call was not able to succeed because all configurations require more power than is available. /*! * @enum tIOUSBHostConnectionSpeed * @brief Connection speeds reported in kUSBHostMatchingPropertySpeed * @discussion This enumeration matches the default speed ID mappings defined in XHCI 1.0 Table 147. * @constant kIOUSBHostConnectionSpeedNone No device is connected * @constant kIOUSBHostConnectionSpeedFull A full-speed (12 Mb/s) device is connected * @constant kIOUSBHostConnectionSpeedLow A low-speed (1.5 Mb/s) device is connected * @constant kIOUSBHostConnectionSpeedHigh A high-speed (480 Mb/s) device is connected) * @constant kIOUSBHostConnectionSpeedSuper A superspeed (5 Gb/s) device is connected) * @constant kIOUSBHostConnectionSpeedSuperPlus A superspeed (10 Gb/s) device is connected) * @constant kIOUSBHostConnectionSpeedSuperPlusBy2 A superspeed (20 Gb/s) device is connected) */ enum tIOUSBHostConnectionSpeed { kIOUSBHostConnectionSpeedNone = 0, kIOUSBHostConnectionSpeedFull = 1, kIOUSBHostConnectionSpeedLow = 2, kIOUSBHostConnectionSpeedHigh = 3, kIOUSBHostConnectionSpeedSuper = 4, kIOUSBHostConnectionSpeedSuperPlus = 5, kIOUSBHostConnectionSpeedSuperPlusBy2 = 6, kIOUSBHostConnectionSpeedCount = 7 }; /*! * @brief Port types returned by IOUSBHostDevice::getPortStatus and kUSBHostPortPropertyStatus * * @constant kIOUSBHostPortTypeStandard A general-purpose USB port. * @constant kIOUSBHostPortTypeCaptive The attached device cannot be physically disconnected from the port. * @constant kIOUSBHostPortTypeInternal The attached device cannot be physically disconnected from the host machine. * @constant kIOUSBHostPortTypeAccessory The attached device may require authentication before function drivers can access it. * @constant kIOUSBHostPortTypeCount The number of entries in this enum. */ enum tIOUSBHostPortType { kIOUSBHostPortTypeStandard = 0, kIOUSBHostPortTypeCaptive, kIOUSBHostPortTypeInternal, kIOUSBHostPortTypeAccessory, kIOUSBHostPortTypeExpressCard, kIOUSBHostPortTypeCount }; /*! * @brief Values returned by IOUSBHostDevice::getPortStatus and kUSBHostPortPropertyStatus * * @constant kIOUSBHostPortStatusPortTypeMask The mask for bits representing the port type. * @constant kIOUSBHostPortStatusPortTypeStandard A general-purpose USB port. * @constant kIOUSBHostPortStatusPortTypeCaptive The attached device cannot be physically disconnected from the port. * @constant kIOUSBHostPortStatusPortTypeInternal The attached device cannot be physically disconnected from the host machine. * @constant kIOUSBHostPortStatusPortTypeAccessory The attached device may require authentication before function drivers can access it. * @constant kIOUSBHostPortStatusConnectedSpeedMask The mask for bits representing the connection state. * @constant kIOUSBHostPortStatusConnectedSpeedNone The port does not have a connected device. * @constant kIOUSBHostPortStatusConnectedSpeedFull The port has a full-speed device connected. * @constant kIOUSBHostPortStatusConnectedSpeedLow The port has a low-speed device connected. * @constant kIOUSBHostPortStatusConnectedSpeedHigh The port has a high-speed device connected. * @constant kIOUSBHostPortStatusConnectedSpeedSuper The port has a superspeed device connected. * @constant kIOUSBHostPortStatusResetting The port is currently resetting the link. * @constant kIOUSBHostPortStatusEnabled The port is enabled and packets are permitted to reach the device. Not valid unless kIOUSBHostPortStatusConnectedSpeedMask is nonzero. * @constant kIOUSBHostPortStatusSuspended The port is suspended. Not valid unless kIOUSBHostPortStatusConnectedSpeedMask is nonzero. * @constant kIOUSBHostPortStatusOvercurrent The port is in the overcurrent condition. * @constant kIOUSBHostPortStatusTestMode The port is in test mode. */ enum tIOUSBHostPortStatus { kIOUSBHostPortStatusPortTypeMask = IOUSBHostFamilyBitRange(0, 3), kIOUSBHostPortStatusPortTypePhase = IOUSBHostFamilyBitRangePhase(0, 3), kIOUSBHostPortStatusPortTypeStandard = (kIOUSBHostPortTypeStandard << IOUSBHostFamilyBitRangePhase(0, 3)), kIOUSBHostPortStatusPortTypeCaptive = (kIOUSBHostPortTypeCaptive << IOUSBHostFamilyBitRangePhase(0, 3)), kIOUSBHostPortStatusPortTypeInternal = (kIOUSBHostPortTypeInternal << IOUSBHostFamilyBitRangePhase(0, 3)), kIOUSBHostPortStatusPortTypeAccessory = (kIOUSBHostPortTypeAccessory << IOUSBHostFamilyBitRangePhase(0, 3)), kIOUSBHostPortStatusPortTypeReserved = IOUSBHostFamilyBitRange(4, 7), kIOUSBHostPortStatusConnectedSpeedMask = IOUSBHostFamilyBitRange(8, 10), kIOUSBHostPortStatusConnectedSpeedPhase = IOUSBHostFamilyBitRangePhase(8, 10), kIOUSBHostPortStatusConnectedSpeedNone = (kIOUSBHostConnectionSpeedNone << IOUSBHostFamilyBitRangePhase(8, 10)), kIOUSBHostPortStatusConnectedSpeedFull = (kIOUSBHostConnectionSpeedFull << IOUSBHostFamilyBitRangePhase(8, 10)), kIOUSBHostPortStatusConnectedSpeedLow = (kIOUSBHostConnectionSpeedLow << IOUSBHostFamilyBitRangePhase(8, 10)), kIOUSBHostPortStatusConnectedSpeedHigh = (kIOUSBHostConnectionSpeedHigh << IOUSBHostFamilyBitRangePhase(8, 10)), kIOUSBHostPortStatusConnectedSpeedSuper = (kIOUSBHostConnectionSpeedSuper << IOUSBHostFamilyBitRangePhase(8, 10)), kIOUSBHostPortStatusConnectedSpeedSuperPlus = (kIOUSBHostConnectionSpeedSuperPlus << IOUSBHostFamilyBitRangePhase(8, 10)), kIOUSBHostPortStatusConnectedSpeedSuperPlusBy2 = (kIOUSBHostConnectionSpeedSuperPlusBy2 << IOUSBHostFamilyBitRangePhase(8, 10)), kIOUSBHostPortStatusResetting = IOUSBHostFamilyBit(11), kIOUSBHostPortStatusEnabled = IOUSBHostFamilyBit(12), kIOUSBHostPortStatusSuspended = IOUSBHostFamilyBit(13), kIOUSBHostPortStatusOvercurrent = IOUSBHostFamilyBit(14), kIOUSBHostPortStatusTestMode = IOUSBHostFamilyBit(15) }; #pragma mark Entitlements #define kIOUSBTransportDextEntitlement "com.apple.developer.driverkit.transport.usb" #define kIOUSBHostVMEntitlement "com.apple.vm.device-access" #define kIOUSBHostControllerInterfaceEntitlement "com.apple.developer.usb.host-controller-interface" #pragma mark Registry property names #define kUSBHostMatchingPropertySpeed "USBSpeed" #define kUSBHostMatchingPropertyPortType "USBPortType" #define kUSBHostMatchingPropertyVendorID "idVendor" #define kUSBHostMatchingPropertyProductID "idProduct" #define kUSBHostMatchingPropertyProductIDMask "idProductMask" #define kUSBHostMatchingPropertyProductIDArray "idProductArray" #define kUSBHostMatchingPropertyDeviceClass "bDeviceClass" #define kUSBHostMatchingPropertyDeviceSubClass "bDeviceSubClass" #define kUSBHostMatchingPropertyDeviceProtocol "bDeviceProtocol" #define kUSBHostMatchingPropertyDeviceReleaseNumber "bcdDevice" #define kUSBHostMatchingPropertyConfigurationValue "bConfigurationValue" #define kUSBHostMatchingPropertyInterfaceClass "bInterfaceClass" #define kUSBHostMatchingPropertyInterfaceSubClass "bInterfaceSubClass" #define kUSBHostMatchingPropertyInterfaceProtocol "bInterfaceProtocol" #define kUSBHostMatchingPropertyInterfaceNumber "bInterfaceNumber" #define kUSBHostPropertyLocationID "locationID" #define kUSBHostPropertyDebugOptions "kUSBDebugOptions" #define kUSBHostPropertyWakePowerSupply "kUSBWakePowerSupply" #define kUSBHostPropertySleepPowerSupply "kUSBSleepPowerSupply" #define kUSBHostPropertyWakePortCurrentLimit "kUSBWakePortCurrentLimit" #define kUSBHostPropertySleepPortCurrentLimit "kUSBSleepPortCurrentLimit" #define kUSBHostPropertyFailedRemoteWake "kUSBFailedRemoteWake" #define kUSBHostPropertyBusCurrentPoolID "UsbBusCurrentPoolID" #define kUSBHostPropertySmcBusCurrentPoolID "UsbSmcBusCurrentPoolID" #define kUSBHostPropertyForcePower "UsbForcePower" #define kUSBHostPropertyForceLinkSpeed "UsbLinkSpeed" #define kUSBHostPropertyForceHardwareException "UsbHardwareException" #define kUSBHostPropertyAllowSoftRetry "UsbAllowSoftRetry" #define kUSBHostUserClientPropertyOwningTaskName "UsbUserClientOwningTaskName" #define kUSBHostUserClientPropertyEntitlementRequired "UsbUserClientEntitlementRequired" #define kUSBHostUserClientPropertyEnableReset "UsbUserClientEnableReset" #define kUSBHostUserClientPropertyEnableDataToggleReset "UsbUserClientEnableDataToggleReset" #define kUSBHostDevicePropertyVendorString "kUSBVendorString" #define kUSBHostDevicePropertySerialNumberString "kUSBSerialNumberString" #define kUSBHostDevicePropertyContainerID "kUSBContainerID" #define kUSBHostDevicePropertyFailedRequestedPower "kUSBFailedRequestedPower" #define kUSBHostDevicePropertyResumeRecoveryTime "kUSBResumeRecoveryTime" #define kUSBHostDevicePropertyPreferredConfiguration "kUSBPreferredConfiguration" #define kUSBHostDevicePropertyPreferredRecoveryConfiguration "kUSBPreferredRecoveryConfiguration" #define kUSBHostDevicePropertyCurrentConfiguration "kUSBCurrentConfiguration" #define kUSBHostDevicePropertyRemoteWakeOverride "kUSBRemoteWakeOverride" #define kUSBHostDevicePropertyConfigurationDescriptorOverride "kUSBConfigurationDescriptorOverride" #define kUSBHostDevicePropertyDeviceDescriptorOverride "kUSBDeviceDescriptorOverride" #define kUSBHostDevicePropertyConfigurationCurrentOverride "kUSBConfigurationCurrentOverride" #define kUSBHostDevicePropertyResetDurationOverride "kUSBResetDurationOverride" #define kUSBHostDevicePropertyDesiredChargingCurrent "kUSBDesiredChargingCurrent" #define kUSBHostDevicePropertyDescriptorOverride "kUSBDescriptorOverride" #define kUSBHostDescriptorOverrideVendorStringIndex "UsbDescriptorOverrideVendorStringIndex" #define kUSBHostDescriptorOverrideProductStringIndex "UsbDescriptorOverrideProductStringIndex" #define kUSBHostDescriptorOverrideSerialNumberStringIndex "UsbDescriptorOverrideSerialNumberStringIndex" #define kUSBHostDevicePropertyDeviceECID "kUSBDeviceECID" #define kUSBHostDevicePropertyEnableLPM "kUSBHostDeviceEnableLPM" #define kUSBHostDevicePropertyDisablePortLPM "kUSBHostDeviceDisablePortLPM" // Disable port initiated LPM for this device #define kUSBHostDevicePropertyStreamsSupported "UsbStreamsSupported" // Default kOSBooleanTrue. OSBoolean indicating if streaming endpoints are supported #define kUSBHostBillboardDevicePropertyNumberOfAlternateModes "bNumberOfAlternateModes" #define kUSBHostBillboardDevicePropertyPreferredAlternateMode "bPreferredAlternateMode" #define kUSBHostBillboardDevicePropertyVCONNPower "VCONNPower" #define kUSBHostBillboardDevicePropertyConfigured "bmConfigured" #define kUSBHostBillboardDevicePropertyAdditionalFailureInfo "bAdditonalFailureInfo" #define kUSBHostBillboardDevicePropertyBcdVersion "BcdVersion" #define kUSBHostBillboardDevicePropertySVID "wSVID" #define kUSBHostBillboardDevicePropertyAlternateMode "bAlternateMode" #define kUSBHostBillboardDevicePropertyAlternateModeStringIndex "iAlternateModeString" #define kUSBHostBillboardDevicePropertyAlternateModeString "AlternateModeString" #define kUSBHostBillboardDevicePropertyAddtionalInfoURLIndex "iAddtionalInfoURL" #define kUSBHostBillboardDevicePropertyAddtionalInfoURL "AddtionalInfoURL" #define kUSBHostBillboardDevicePropertydwAlternateModeVdo "dwAlternateModeVdo" #define kUSBHostInterfacePropertyAlternateSetting "bAlternateSetting" #define kUSBHostPortPropertyStatus "port-status" #define kUSBHostPortPropertyOvercurrent "UsbHostPortOvercurrent" #define kUSBHostPortPropertyPortNumber "port" #define kUSBHostPortPropertyRemovable "removable" #define kUSBHostPortPropertyTestMode "kUSBTestMode" #define kUSBHostPortPropertyUsb3ComplianceMode "kUSBHostPortPropertyUsb3ComplianceMode" #define kUSBHostPortPropertySimulateInterrupt "kUSBSimulateInterrupt" #define kUSBHostPortPropertyBusCurrentAllocation "kUSBBusCurrentAllocation" #define kUSBHostPortPropertyBusCurrentSleepAllocation "kUSBBusCurrentSleepAllocation" #define kUSBHostPortPropertyConnectable "UsbConnectable" #define kUSBHostPortPropertyConnectorType "UsbConnector" #define kUSBHostPortPropertyMux "UsbMux" #define kUSBHostPortPropertyCompanionIndex "kUSBCompanionIndex" #define kUSBHostPortPropertyDisconnectInterval "kUSBDisconnectInterval" #define kUSBHostPortPropertyUsbCPortNumber "UsbCPortNumber" #define kUSBHostPortPropertyCompanionPortNumber "UsbCompanionPortNumber" // OSData key to set/get the port number of the companion port #define kUSBHostPortPropertyPowerSource "UsbPowerSource" #define kUSBHostPortPropertyUSB3Mode "Usb3Mode" #define kUSBHostPortPropertyExternalDeviceResetController "kUSBHostPortExternalDeviceResetController" #define kUSBHostPortPropertyExternalDevicePowerController "kUSBHostPortExternalDevicePowerController" #define kUSBHostPortPropertyCardReader "kUSBHostPortPropertyCardReader" #define kUSBHostPortPropertyCardReaderValidateDescriptors "kUSBHostPortPropertyCardReaderValidateDescriptors" #define kUSBHostHubPropertyPowerSupply "kUSBHubPowerSupply" // OSNumber mA available for downstream ports, 0 for bus-powered #define kUSBHostHubPropertyIdlePolicy "kUSBHubIdlePolicy" // OSNumber ms to be used as device idle policy #define kUSBHostHubPropertyStartupDelay "kUSBHubStartupDelay" // OSNumber ms delay before creating downstream ports #define kUSBHostHubPropertyPortSequenceDelay "kUSBHubPortSequenceDelay" // OSNumber ms delay between port creation #define kUSBHostHubPropertyHubPowerSupplyType "kUSBHubPowerSupplyType" // OSNumber for tPowerSupply hub is, 2 for bus-powered, 1 for self #define kUSBHostHubPropertyGlobalSuspendSupported "UsbHubGlobalSuspendSupported" // OSBoolean false to attempt selective suspend (legacy behavior) #define kUSBHostControllerPropertyIsochronousRequiresContiguous "kUSBIsochronousRequiresContiguous" #define kUSBHostControllerPropertySleepSupported "kUSBSleepSupported" #define kUSBHostControllerPropertyRTD3Supported "UsbRTD3Supported" #define kUSBHostControllerPropertyMuxEnabled "kUSBMuxEnabled" #define kUSBHostControllerPropertyCompanion "kUSBCompanion" // OSBoolean false to disable all companion controllers #define kUSBHostControllerPropertyLowSpeedCompanion "kUSBLowSpeedCompanion" // OSBoolean false to disable low-speed companion controller #define kUSBHostControllerPropertyFullSpeedCompanion "kUSBFullSpeedCompanion" // OSBoolean false to disable full-speed companion controller #define kUSBHostControllerPropertyHighSpeedCompanion "kUSBHighSpeedCompanion" // OSBoolean false to disable high-speed companion controller #define kUSBHostControllerPropertySuperSpeedCompanion "kUSBSuperSpeedCompanion" // OSBoolean false to disable superspeed companion controller #define kUSBHostControllerPropertyRevision "Revision" // OSData Major/minor revision number of controller #define kUSBHostControllerPropertyCompanionControllerName "UsbCompanionControllerName" // OSString key to set/get the name of the service, i.e. companion controller dictionary. #define kUSBHostControllerPropertyDisableUSB3LPM "kUSBHostControllerDisableUSB3LPM" // OSBoolean true to disable USB3 LPM on a given controller #define kUSBHostControllerPropertyDisableUSB2LPM "kUSBHostControllerDisableUSB2LPM" // OSBoolean true to disable USB2 LPM on a given controller #define kUSBHostControllerPropertyDisableWakeSources "UsbHostControllerDisableWakeSources" // OSBoolean true to disable connect/disconnect/overcurrent wake sources #define kUSBHostControllerPropertyPersistFullSpeedIsochronous "UsbHostControllerPersistFullSpeedIsochronous" // OSBoolean true to reduce commands related to full-speed isochronous endpoints #define kUSBHostControllerPropertyDeferRegisterService "UsbHostControllerDeferRegisterService" // OSBoolean true to defer registerService call by base class during start #define kUSBHostControllerPropertyStreamPolicy "UsbHostControllerStreamPolicy" // OSNumber containing tUSBStreamPolicy #define kUSBHostControllerPropertyTierLimit "UsbHostControllerTierLimit" // OSNumber containing the number of tiers supported by this controller (See USB 2.0 § 4.1.1) #define kIOUSBHostDeviceClassName "IOUSBHostDevice" #define kIOUSBHostInterfaceClassName "IOUSBHostInterface" // for IOUSBLib compatibility #define kUSBHostDevicePropertyAddress "kUSBAddress" #define kUSBHostDevicePropertyManufacturerStringIndex "iManufacturer" #define kUSBHostDevicePropertySerialNumberStringIndex "iSerialNumber" #define kUSBHostDevicePropertyProductStringIndex "iProduct" #define kUSBHostDevicePropertyProductString "kUSBProductString" #define kUSBHostDevicePropertyNumConfigs "bNumConfigurations" #define kUSBHostDevicePropertyMaxPacketSize "bMaxPacketSize0" #define kUSBHostDevicePropertyStandardVersion "bcdUSB" #define kUSBHostInterfacePropertyStringIndex "iInterface" #define kUSBHostInterfacePropertyString "kUSBString" #define kUSBHostInterfacePropertyNumEndpoints "bNumEndpoints" // Legacy power properties #define kAppleMaxPortCurrent "AAPL,current-available" #define kAppleCurrentExtra "AAPL,current-extra" #define kAppleMaxPortCurrentInSleep "AAPL,max-port-current-in-sleep" #define kAppleCurrentExtraInSleep "AAPL,current-extra-in-sleep" #define kAppleExternalConnectorBitmap "AAPL,ExternalConnectorBitmap" #endif /* IOUSBHostFamily_IOUSBHostFamilyDefinitions_h */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/AppleUSBHostBulkHIDDevice.h
/* * Copyright (c) 2020 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef APPLEUSBHOSTBULKHIDDEVICE_H #define APPLEUSBHOSTBULKHIDDEVICE_H #include <IOKit/usb/IOUSBHostHIDDevice.h> /*! @class AppleUSBHostBulkHIDDevice @abstract Driver that matches to USB HID devices, adds support for using USB Bulk pipes for HID Devices @discussion This class extends HID Devices to use USB Bulk pipes is available. */ class AppleUSBHostBulkHIDDevice : public IOUSBHostHIDDevice { OSDeclareDefaultStructors(AppleUSBHostBulkHIDDevice); private: typedef struct { uint8_t _bInterfaceNumber; IOUSBHostPipe *_inputPipe; IOUSBHostPipe *_outputPipe; uint32_t _outputMaxSize; } AppleUSBBulkHidExpansionData; AppleUSBBulkHidExpansionData *_expansionData; public: virtual bool handleStart(IOService *provider) APPLE_KEXT_OVERRIDE; virtual void free() APPLE_KEXT_OVERRIDE; }; #endif /* APPLEUSBHOSTBULKHIDDEVICE_H */
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/usb/IOUSBHostStream.h
/* * Copyright (c) 1998-2016 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header IOUSBHostStream.h @brief IOUSBHostStream is an object representing an individual stream within a streaming endpoint. */ #ifndef IOUSBHostFamily_IOUSBHostStream_h #define IOUSBHostFamily_IOUSBHostStream_h #include <IOKit/usb/IOUSBHostFamily.h> #include <IOKit/usb/IOUSBHostIOSource.h> class IOUSBHostPipe; /*! * @class IOUSBHostStream * @brief The OSObject representing an individual stream within a USB endpoint * @discussion This class provides functionality to transfer data across USB. Function drivers should not subclass IOUSBHostStream. */ class __IOUSBHOSTFAMILY_DEPRECATED IOUSBHostStream : public IOUSBHostIOSource { OSDeclareDefaultStructors(IOUSBHostStream) friend class IOUSBHostPipe; public: /*! * @brief Factory method for creating an IOUSBHostStream object * @discussion This method should not be called by function drivers. To create an IOUSBHostStream, use IOUSBHostPipe::copyStream(...) * @param controller AppleUSBHostController to which the USB endpoint is associated * @param device IOUSBHostDevice to which this endpoint belongs * @param pipe IOUSBHostPipe to which this stream belongs * @param streamID The stream ID for this instance * @return Pointer to an IOUSBHostStream object if successful, otherwise NULL */ IOUSBHostStream* withOwnersAndStreamID(AppleUSBHostController* controller, IOUSBHostDevice* device, IOUSBHostPipe* pipe, uint32_t streamID); virtual void free(); /*! * @brief Abort pending I/O requests. * @discussion See IOUSBHostIOSource::abort for documentation. A stream context must be set as non-active on the device via an out-of-band (class-defined) mechanism before this method is called (USB 3.1 8.12.1.4). A non-active stream will not be selected by the device to become the current stream on the endpoint. */ virtual IOReturn abort(IOOptionBits options = kAbortAsynchronous, IOReturn withError = kIOReturnAborted, IOService* forClient = NULL); /*! * @brief Retrieve the IOUSBHostPipe to which this stream belongs * @return IOUSBHostPipe pointer */ virtual IOUSBHostPipe* getPipe() const { return _pipe; } /*! * @brief Retrieve the sream ID for this instance * @return Stream ID */ virtual uint32_t getStreamID() const { return _streamID; } /*! * @brief Enqueue a request on a stream * @discussion See IOUSBHostIOSource::io for documentation * @param completionTimeoutMs Must be 0 for streams. */ virtual IOReturn io(IOMemoryDescriptor* dataBuffer, uint32_t dataBufferLength, IOUSBHostCompletion* completion, uint32_t completionTimeoutMs = 0); /*! * @brief Perform a request on a stream * @discussion See IOUSBHostIOSource::io for documentation * @param completionTimeoutMs Must be 0 for streams. */ virtual IOReturn io(IOMemoryDescriptor* dataBuffer, uint32_t dataBufferLength, uint32_t& bytesTransferred, uint32_t completionTimeoutMs = 0); // Public pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostStream, 0); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 1); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 2); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 3); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 4); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 5); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 6); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 7); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 8); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 9); protected: virtual bool initWithOwnersAndStreamID(AppleUSBHostController* controller, IOUSBHostDevice* device, IOUSBHostPipe* pipe, uint32_t streamID); virtual IOReturn closeGated(); virtual IOReturn destroyGated(); virtual IOReturn abortGated(IOOptionBits options, IOReturn withError, IOService* forClient); // Protected pad slots for future expansion OSMetaClassDeclareReservedUnused(IOUSBHostStream, 10); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 11); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 12); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 13); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 14); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 15); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 16); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 17); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 18); OSMetaClassDeclareReservedUnused(IOUSBHostStream, 19); protected: IOUSBHostPipe* _pipe; uint32_t _streamID; }; #endif
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/avc/IOFireWireAVCUnit.h
/* * Copyright (c) 1998-2001 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@ */ #ifndef _IOKIT_IOFIREWIREAVCUNIT_H #define _IOKIT_IOFIREWIREAVCUNIT_H #include <IOKit/IOService.h> #include <IOKit/firewire/IOFWRegs.h> #include <IOKit/firewire/IOFWAddressSpace.h> #include <IOKit/firewire/IOFWCommand.h> #include <IOKit/avc/IOFireWireAVCConsts.h> extern const OSSymbol *gIOAVCUnitType; class IOFireWireNub; class IOFireWireAVCCommand; class IOFireWirePCRSpace; class IOFireWireAVCUnit; class IOFireWireAVCSubUnit; class IOFireWireAVCAsynchronousCommand; class IOFireWireAVCNub; // The callback prototype for AVC Asynchronous Commands typedef void (*IOFireWireAVCAsynchronousCommandCallback)(void *pRefCon, IOFireWireAVCAsynchronousCommand *pCommandObject); const UInt16 kIOFWAVCAsyncCmdFreed = 0xdead; /*! @class IOFireWireAVCAsynchronousCommand */ class IOFireWireAVCAsynchronousCommand : public IOCommand { OSDeclareDefaultStructors(IOFireWireAVCAsynchronousCommand) void free(void); friend class IOFireWireAVCUnit; protected: /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; public: IOReturn init(const UInt8 * command, UInt32 len, IOFireWireAVCAsynchronousCommandCallback completionCallback, void *pClientRefCon); IOReturn submit(IOFireWireAVCNub *pAVCNub); IOReturn cancel(void); IOReturn reinit(const UInt8 * command, UInt32 cmdLen); // This function returns true if this command is currently waiting for a response bool isPending(void); IOFWAVCAsyncCommandState cmdState; void *pRefCon; UInt8 *pCommandBuf; UInt32 cmdLen; UInt8 *pInterimResponseBuf; UInt32 interimResponseLen; UInt8 *pFinalResponseBuf; UInt32 finalResponseLen; protected: IOFireWireAVCAsynchronousCommandCallback fCallback; IOFireWireAVCUnit *fAVCUnit; IOMemoryDescriptor *fMem; IOFWCommand *fWriteCmd; IOFWDelayCommand *fDelayCmd; UInt16 fWriteNodeID; UInt32 fWriteGen; private: OSMetaClassDeclareReservedUnused(IOFireWireAVCAsynchronousCommand, 0); OSMetaClassDeclareReservedUnused(IOFireWireAVCAsynchronousCommand, 1); OSMetaClassDeclareReservedUnused(IOFireWireAVCAsynchronousCommand, 2); OSMetaClassDeclareReservedUnused(IOFireWireAVCAsynchronousCommand, 3); }; /*! @class IOFireWireAVCNub @abstract nub for AVC devices */ class IOFireWireAVCNub : public IOService { OSDeclareDefaultStructors(IOFireWireAVCNub) protected: IOFireWireNub * fDevice; public: // execute AVC command /*! @function AVCCommand @abstract Sends an AVC command to the device and stores the response. @param command Pointer to command to send. @param cmdLen Length of the command. @param response Pointer to place to store the response. @param responseLen Pointer to response length - initialize to the size of the buffer pointed to by response, updated to the number of bytes returned by the device. */ virtual IOReturn AVCCommand(const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen) = 0; /*! @function AVCCommandInGeneration @abstract Sends an AVC command to the device and stores the response. The command must complete in the specified FireWire bus generation otherwise kIOFireWireBusReset is returned. @param generation The bus generation that the command must execute in. @param command Pointer to command to send. @param cmdLen Length of the command. @param response Pointer to place to store the response. @param responseLen Pointer to response length - initialize to the size of the buffer pointed to by response, updated to the number of bytes returned by the device. */ virtual IOReturn AVCCommandInGeneration(UInt32 generation, const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen) = 0; /*! @function getDevice @abstract Returns the FireWire device nub that is this object's provider . */ IOFireWireNub* getDevice() const {return fDevice;}; /*! @function updateAVCCommandTimeout @abstract By default, AVCCommands timeout 10 seconds after receiving an Interim response. This function resets the timeout of the current command to 10 seconds from the current time. Call this repeatedly for AVC commands that take a very long time to execute to prevent premature timeout. */ virtual IOReturn updateAVCCommandTimeout() = 0; private: OSMetaClassDeclareReservedUsed(IOFireWireAVCNub, 0); OSMetaClassDeclareReservedUnused(IOFireWireAVCNub, 1); OSMetaClassDeclareReservedUnused(IOFireWireAVCNub, 2); OSMetaClassDeclareReservedUnused(IOFireWireAVCNub, 3); }; /*! @class IOFireWireAVCUnit @abstract nub for AVC devices */ class IOFireWireAVCUnit : public IOFireWireAVCNub { OSDeclareDefaultStructors(IOFireWireAVCUnit) friend class IOFireWireAVCAsynchronousCommand; protected: IOFWPseudoAddressSpace *fFCPResponseSpace; IOLock *avcLock; IOFireWireAVCCommand *fCommand; UInt8 fSubUnitCount[kAVCNumSubUnitTypes]; bool fStarted; IOLock *cmdLock; /*! @struct ExpansionData @discussion This structure is used to expand the capablilties of the class in a binary compatible way */ struct ExpansionData { OSArray * fAVCAsyncCommands; IOFireWireController *fControl; bool enableRobustAVCCommandResponseMatching; }; /*! @var fIOFireWireAVCUnitExpansion */ ExpansionData *fIOFireWireAVCUnitExpansion; static UInt32 AVCResponse(void *refcon, UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, const void *buf, IOFWRequestRefCon requestRefcon); static void rescanSubUnits(void *arg); virtual void free(void); virtual void updateSubUnits(bool firstTime); static void AVCAsynchRequestWriteDone(void *refcon, IOReturn status, IOFireWireNub *device, IOFWCommand *fwCmd); static void AVCAsynchDelayDone(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWBusCommand *fwCmd); public: // IOService overrides virtual bool start(IOService *provider); virtual IOReturn message(UInt32 type, IOService *provider, void *argument); virtual IOReturn setProperties (OSObject * properties ); /*! @function handleOpen @abstract Overrideable method to control the open / close behaviour of an IOService. @discussion See IOService for discussion. @param forClient Designates the client of the provider requesting the open. @param options Options for the open, may be interpreted by the implementor of handleOpen. @result Return true if the open was successful, false otherwise. */ virtual bool handleOpen( IOService * forClient, IOOptionBits options, void * arg ); /*! @function handleClose @abstract Overrideable method to control the open / close behaviour of an IOService. @discussion See IOService for discussion. @param forClient Designates the client of the provider requesting the close. @param options Options for the close, may be interpreted by the implementor of handleOpen. */ virtual void handleClose( IOService * forClient, IOOptionBits options ); /*! @function matchPropertyTable @abstract Matching language support Match on the following properties of the unit: Vendor_ID GUID Unit_Type and available sub-units, match if the device has at least the requested number of a sub-unit type: AVCSubUnit_0 -> AVCSubUnit_1f */ virtual bool matchPropertyTable(OSDictionary * table); // execute AVC command /*! @function AVCCommand @abstract Sends an AVC command to the device and stores the response. @param command Pointer to command to send. @param cmdLen Length of the command. @param response Pointer to place to store the response. @param responseLen Pointer to response length - initialize to the size of the buffer pointed to by response, updated to the number of bytes returned by the device. */ virtual IOReturn AVCCommand(const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen); /*! @function AVCCommandInGeneration @abstract Sends an AVC command to the device and stores the response. The command must complete in the specified FireWire bus generation otherwise kIOFireWireBusReset is returned. @param generation The bus generation that the command must execute in. @param command Pointer to command to send. @param cmdLen Length of the command. @param response Pointer to place to store the response. @param responseLen Pointer to response length - initialize to the size of the buffer pointed to by response, updated to the number of bytes returned by the device. */ virtual IOReturn AVCCommandInGeneration(UInt32 generation, const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen); /*! @function updateAVCCommandTimeout @abstract By default, AVCCommands timeout 10 seconds after receiving an Interim response. This function resets the timeout of the current command to 10 seconds from the current time. Call this repeatedly for AVC commands that take a very long time to execute to prevent premature timeout. */ virtual IOReturn updateAVCCommandTimeout(); protected: UInt32 indexOfAVCAsynchronousCommandObject(IOFireWireAVCAsynchronousCommand *pCommandObject); void removeAVCAsynchronousCommandObjectAtIndex(UInt32 index); void lockAVCAsynchronousCommandLock(); void unlockAVCAsynchronousCommandLock(); bool available(); private: OSMetaClassDeclareReservedUnused(IOFireWireAVCUnit, 0); OSMetaClassDeclareReservedUnused(IOFireWireAVCUnit, 1); OSMetaClassDeclareReservedUnused(IOFireWireAVCUnit, 2); OSMetaClassDeclareReservedUnused(IOFireWireAVCUnit, 3); }; /*! @class IOFireWireAVCSubUnit @abstract nub for sub unit of AVC devices. Just for matching, calls the AVC unit for all functions. */ class IOFireWireAVCSubUnit : public IOFireWireAVCNub { OSDeclareDefaultStructors(IOFireWireAVCSubUnit) friend class IOFireWireAVCAsynchronousCommand; protected: IOFireWireAVCUnit *fAVCUnit; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; public: virtual bool init(OSDictionary *propTable, IOFireWireAVCUnit *provider); // IOService overrides virtual IOReturn message(UInt32 type, IOService *provider, void *argument); /*! @function handleOpen @abstract Overrideable method to control the open / close behaviour of an IOService. @discussion See IOService for discussion. @param forClient Designates the client of the provider requesting the open. @param options Options for the open, may be interpreted by the implementor of handleOpen. @result Return true if the open was successful, false otherwise. */ virtual bool handleOpen( IOService * forClient, IOOptionBits options, void * arg ); /*! @function handleClose @abstract Overrideable method to control the open / close behaviour of an IOService. @discussion See IOService for discussion. @param forClient Designates the client of the provider requesting the close. @param options Options for the close, may be interpreted by the implementor of handleOpen. */ virtual void handleClose( IOService * forClient, IOOptionBits options ); /*! @function matchPropertyTable @abstract Matching language support Match on the following properties of the sub unit: Vendor_ID GUID SubUnit_Type */ virtual bool matchPropertyTable(OSDictionary * table); // execute AVC command /*! @function AVCCommand @abstract Sends an AVC command to the device and stores the response. @param command Pointer to command to send. @param cmdLen Length of the command. @param response Pointer to place to store the response. @param responseLen Pointer to response length - initialize to the size of the buffer pointed to by response, updated to the number of bytes returned by the device. */ virtual IOReturn AVCCommand(const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen); /*! @function AVCCommandInGeneration @abstract Sends an AVC command to the device and stores the response. The command must complete in the specified FireWire bus generation otherwise kIOFireWireBusReset is returned. @param generation The bus generation that the command must execute in. @param command Pointer to command to send. @param cmdLen Length of the command. @param response Pointer to place to store the response. @param responseLen Pointer to response length - initialize to the size of the buffer pointed to by response, updated to the number of bytes returned by the device. */ virtual IOReturn AVCCommandInGeneration(UInt32 generation, const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen); /*! @function updateAVCCommandTimeout @abstract By default, AVCCommands timeout 10 seconds after receiving an Interim response. This function resets the timeout of the current command to 10 seconds from the current time. Call this repeatedly for AVC commands that take a very long time to execute to prevent premature timeout. */ virtual IOReturn updateAVCCommandTimeout(); private: OSMetaClassDeclareReservedUnused(IOFireWireAVCSubUnit, 0); OSMetaClassDeclareReservedUnused(IOFireWireAVCSubUnit, 1); OSMetaClassDeclareReservedUnused(IOFireWireAVCSubUnit, 2); OSMetaClassDeclareReservedUnused(IOFireWireAVCSubUnit, 3); }; #endif // _IOKIT_IOFIREWIREAVCUNIT_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/avc/IOFireWireAVCCommand.h
/* * Copyright (c) 1998-2001 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@ */ #ifndef _IOKIT_IOFireWireAVCCommand_H #define _IOKIT_IOFireWireAVCCommand_H #include <IOKit/firewire/IOFWCommand.h> /*! @class IOFireWireAVCCommand */ class IOFireWireAVCCommand : public IOFWCommand { OSDeclareDefaultStructors(IOFireWireAVCCommand) protected: IOFWCommand *fWriteCmd; IOMemoryDescriptor *fMem; const UInt8 *fCommand; UInt32 fCmdLen; UInt8 *fResponse; UInt32 *fResponseLen; int fCurRetries; int fMaxRetries; UInt32 fWriteGen; UInt16 fWriteNodeID; bool bypassRobustCommandResponseMatching; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { bool fStarted; bool fSyncWakeupSignaled; }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *fIOFireWireAVCCommandExpansion; static void writeDone(void *refcon, IOReturn status, IOFireWireNub *device, IOFWCommand *fwCmd); virtual IOReturn complete(IOReturn status); virtual IOReturn execute(); virtual void free(); public: virtual bool init(IOFireWireNub *device, const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 * responseLen); virtual IOReturn reinit(IOFireWireNub *device, const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 * responseLen); static IOFireWireAVCCommand *withNub(IOFireWireNub *device, const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 * responseLen); static IOFireWireAVCCommand *withNub(IOFireWireNub *device, UInt32 generation, const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 * responseLen); virtual UInt32 handleResponse(UInt16 nodeID, UInt32 len, const void *buf); virtual IOReturn resetInterimTimeout(); virtual UInt32 handleResponseWithSimpleMatching(UInt16 nodeID, UInt32 len, const void *buf); virtual IOReturn submit(bool queue = false); private: OSMetaClassDeclareReservedUsed(IOFireWireAVCCommand, 0); OSMetaClassDeclareReservedUnused(IOFireWireAVCCommand, 1); OSMetaClassDeclareReservedUnused(IOFireWireAVCCommand, 2); OSMetaClassDeclareReservedUnused(IOFireWireAVCCommand, 3); }; #endif // _IOKIT_IOFireWireAVCCommand_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/avc/IOFireWireAVCConsts.h
/* * Copyright (c) 1998-2001 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@ */ #ifndef _IOKIT_IOFIREWIREAVCCONSTS_H #define _IOKIT_IOFIREWIREAVCCONSTS_H // Fields of AVC frame typedef enum { kAVCCommandResponse = 0, kAVCAddress = 1, kAVCOpcode = 2, kAVCOperand0 = 3, kAVCOperand1 = 4, kAVCOperand2 = 5, kAVCOperand3 = 6, kAVCOperand4 = 7, kAVCOperand5 = 8, kAVCOperand6 = 9, kAVCOperand7 = 10, kAVCOperand8 = 11 } IOAVCFrameFields; // Command/Response values typedef enum { kAVCControlCommand = 0x00, kAVCStatusInquiryCommand = 0x01, kAVCSpecificInquiryCommand = 0x02, kAVCNotifyCommand = 0x03, kAVCGeneralInquiryCommand = 0x04, kAVCNotImplementedStatus = 0x08, kAVCAcceptedStatus = 0x09, kAVCRejectedStatus = 0x0a, kAVCInTransitionStatus = 0x0b, kAVCImplementedStatus = 0x0c, kAVCChangedStatus = 0x0d, kAVCInterimStatus = 0x0f } IOAVCCommandResponse; // Opcodes typedef enum { // Unit commands kAVCPlugInfoOpcode = 0x02, kAVCOutputPlugSignalFormatOpcode = 0x18, kAVCInputPlugSignalFormatOpcode = 0x19, kAVCUnitInfoOpcode = 0x30, kAVCSubunitInfoOpcode = 0x31, kAVCConnectionsOpcode = 0x22, kAVCConnectOpcode = 0x24, kAVCDisconnectOpcode = 0x25, kAVCPowerOpcode = 0xB2, kAVCSignalSourceOpcode = 0x1A, // Vendor dependent commands kAVCVendorDependentOpcode = 0x00, // Subunit commands kAVCOutputSignalModeOpcode = 0x78, kAVCInputSignalModeOpcode = 0x79, kAVCSignalModeSD525_60 = 0x00, kAVCSignalModeSDL525_60 = 0x04, kAVCSignalModeHD1125_60 = 0x08, kAVCSignalModeSD625_50 = 0x80, kAVCSignalModeSDL625_50 = 0x84, kAVCSignalModeHD1250_50 = 0x88, kAVCSignalModeDVCPro525_60 = 0x78, kAVCSignalModeDVCPro625_50 = 0xf8, kAVCSignalModeDummyOperand = 0xff, kAVCSignalModeMask_50 = 0x80, kAVCSignalModeMask_STYPE = 0x7c, kAVCSignalModeMask_SDL = 0x04, kAVCSignalModeMask_DVCPro25 = 0x78 } IOAVCOpcodes; // Unit/Subunit types typedef enum { kAVCVideoMonitor = 0x00, kAVCAudio = 0x01, kAVCPrinter = 0x02, kAVCDiskRecorder = 0x03, kAVCTapeRecorder = 0x04, kAVCTuner = 0x05, kAVCVideoCamera = 0x07, kAVCCameraStorage = 0x0b, kAVCVendorUnique = 0x1c, kAVCNumSubUnitTypes = 0x20 } IOAVCUnitTypes; #define kAVCAllOpcodes 0xFF #define kAVCAllSubunitsAndUnit 0xEE #define kAVCMaxNumPlugs 31 #define kAVCAnyAvailableIsochPlug 0x7F #define kAVCAnyAvailableExternalPlug 0xFF #define kAVCAnyAvailableSubunitPlug 0xFF #define kAVCMultiplePlugs 0xFD #define kAVCInvalidPlug 0xFE #define IOAVCAddress(type, id) (((type) << 3) | (id)) #define kAVCUnitAddress 0xff #define IOAVCType(address) ((address) >> 3) #define IOAVCId(address) ((address) & 0x7) // Macros for Plug Control Register field manipulation // Master control registers #define kIOFWPCRDataRate FWBitRange(0,1) #define kIOFWPCRDataRatePhase FWBitRangePhase(0,1) #define kIOFWPCRExtension FWBitRange(8,15) #define kIOFWPCRExtensionPhase FWBitRangePhase(8,15) #define kIOFWPCRNumPlugs FWBitRange(27,31) #define kIOFWPCRNumPlugsPhase FWBitRangePhase(27,31) // master output register #define kIOFWPCRBroadcastBase FWBitRange(2,7) #define kIOFWPCRBroadcastBasePhase FWBitRangePhase(2,7) // plug registers #define kIOFWPCROnline FWBitRange(0,0) #define kIOFWPCROnlinePhase FWBitRangePhase(0,0) #define kIOFWPCRBroadcast FWBitRange(1,1) #define kIOFWPCRBroadcastPhase FWBitRangePhase(1,1) #define kIOFWPCRP2PCount FWBitRange(2,7) #define kIOFWPCRP2PCountPhase FWBitRangePhase(2,7) #define kIOFWPCRChannel FWBitRange(10,15) #define kIOFWPCRChannelPhase FWBitRangePhase(10,15) // Extra fields for output plug registers #define kIOFWPCROutputDataRate FWBitRange(16,17) #define kIOFWPCROutputDataRatePhase FWBitRangePhase(16,17) #define kIOFWPCROutputOverhead FWBitRange(18,21) #define kIOFWPCROutputOverheadPhase FWBitRangePhase(18,21) #define kIOFWPCROutputPayload FWBitRange(22,31) #define kIOFWPCROutputPayloadPhase FWBitRangePhase(22,31) // async plug numbers enum { kFWAVCAsyncPlug0 = 0xa0, kFWAVCAsyncPlug1 = 0xa1, kFWAVCAsyncPlug2 = 0xa2, kFWAVCAsyncPlug3 = 0xa3, kFWAVCAsyncPlug4 = 0xa4, kFWAVCAsyncPlug5 = 0xa5, kFWAVCAsyncPlug6 = 0xa6, kFWAVCAsyncPlug7 = 0xa7, kFWAVCAsyncPlug8 = 0xa8, kFWAVCAsyncPlug9 = 0xa9, kFWAVCAsyncPlug10 = 0xa1, kFWAVCAsyncPlug11 = 0xab, kFWAVCAsyncPlug12 = 0xac, kFWAVCAsyncPlug13 = 0xad, kFWAVCAsyncPlug14 = 0xae, kFWAVCAsyncPlug15 = 0xaf, kFWAVCAsyncPlug16 = 0xb0, kFWAVCAsyncPlug17 = 0xb1, kFWAVCAsyncPlug18 = 0xb2, kFWAVCAsyncPlug19 = 0xb3, kFWAVCAsyncPlug20 = 0xb4, kFWAVCAsyncPlug21 = 0xb5, kFWAVCAsyncPlug22 = 0xb6, kFWAVCAsyncPlug23 = 0xb7, kFWAVCAsyncPlug24 = 0xb8, kFWAVCAsyncPlug25 = 0xb9, kFWAVCAsyncPlug26 = 0xba, kFWAVCAsyncPlug27 = 0xbb, kFWAVCAsyncPlug28 = 0xbc, kFWAVCAsyncPlug29 = 0xbd, kFWAVCAsyncPlug30 = 0xbe, kFWAVCAsyncPlugAny = 0xbf }; enum { kFWAVCStateBusSuspended = 0, kFWAVCStateBusResumed = 1, kFWAVCStatePlugReconnected = 2, kFWAVCStatePlugDisconnected = 3, kFWAVCStateDeviceRemoved = 4 }; enum { kFWAVCConsumerMode_MORE = 1, kFWAVCConsumerMode_LAST = 4, kFWAVCConsumerMode_LESS = 5, kFWAVCConsumerMode_JUNK = 6, kFWAVCConsumerMode_LOST = 7 }; enum { kFWAVCProducerMode_SEND = 5, kFWAVCProducerMode_TOSS = 7 }; typedef enum { IOFWAVCPlugSubunitSourceType, IOFWAVCPlugSubunitDestType, IOFWAVCPlugIsochInputType, IOFWAVCPlugIsochOutputType, IOFWAVCPlugAsynchInputType, IOFWAVCPlugAsynchOutputType, IOFWAVCPlugExternalInputType, IOFWAVCPlugExternalOutputType } IOFWAVCPlugTypes; typedef enum { kIOFWAVCSubunitPlugMsgConnected, kIOFWAVCSubunitPlugMsgDisconnected, kIOFWAVCSubunitPlugMsgConnectedPlugModified, kIOFWAVCSubunitPlugMsgSignalFormatModified } IOFWAVCSubunitPlugMessages; // Some plug signal formats #define kAVCPlugSignalFormatNTSCDV 0x80000000 #define kAVCPlugSignalFormatPalDV 0x80800000 #define kAVCPlugSignalFormatMPEGTS 0xA0000000 // Possible states of an AVCAsynchronousCommand typedef enum { kAVCAsyncCommandStatePendingRequest, kAVCAsyncCommandStateRequestSent, kAVCAsyncCommandStateRequestFailed, kAVCAsyncCommandStateWaitingForResponse, kAVCAsyncCommandStateReceivedInterimResponse, kAVCAsyncCommandStateReceivedFinalResponse, kAVCAsyncCommandStateTimeOutBeforeResponse, kAVCAsyncCommandStateBusReset, kAVCAsyncCommandStateOutOfMemory, kAVCAsyncCommandStateCanceled } IOFWAVCAsyncCommandState; #endif // _IOKIT_IOFIREWIREAVCCONSTS_H
0
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit
repos/simulations/libs/system-sdk/macos12/System/Library/Frameworks/Kernel.framework/Headers/IOKit/avc/IOFireWirePCRSpace.h
/* * Copyright (c) 2001 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@ */ /* * * IOFireWirePCRSpace.h * * Class to multiplex access to the PCR addresses. */ #ifndef _IOKIT_IOFIREWIREPCRSPACE_H #define _IOKIT_IOFIREWIREPCRSPACE_H #include <IOKit/firewire/IOFWAddressSpace.h> #include <IOKit/avc/IOFireWireAVCTargetSpace.h> /*! @typedef IOFireWirePCRCallback @abstract Callback called after a successful lock transaction to a plug. @param refcon refcon supplied to the IOFireWireFCPSpace when a client is registered @param nodeID is the node originating the request @param plugNo is the plug number @param oldVal is the value the plug used to contain @param newVal is the quad written into the plug */ typedef void (*IOFireWirePCRCallback)(void *refcon, UInt16 nodeID, UInt32 plug, UInt32 oldVal, UInt32 newVal); class IOFireWireBus; /*! @class IOFireWirePCRSpace @abstract object to multiplex users of the PCR plug registers */ class IOFireWirePCRSpace : public IOFWPseudoAddressSpace { OSDeclareDefaultStructors(IOFireWirePCRSpace) protected: struct Client { IOFireWirePCRCallback func; void * refcon; }; UInt32 fBuf[64]; Client fClients[64]; UInt32 fActivations; IOFireWireAVCTargetSpace * fAVCTargetSpace; IONotifier *fNotifier; /*! @struct ExpansionData @discussion This structure will be used to expand the capablilties of the class in the future. */ struct ExpansionData { }; /*! @var reserved Reserved for future use. (Internal use only) */ ExpansionData *reserved; // Override to notify client of each plug seperately virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len, const void *buf, IOFWRequestRefCon refcon); virtual IOReturn allocatePlug(void *refcon, IOFireWirePCRCallback func, UInt32 &plug, Client* head); virtual void freePlug(UInt32 plug, Client* head); virtual UInt32 readPlug(UInt32 plug); virtual IOReturn updatePlug(UInt32 plug, UInt32 oldVal, UInt32 newVal); public: // Override to handle multiple activations (one per client) virtual IOReturn activate(); virtual void deactivate(); /*! @function init @abstract initializes the IOFireWirePCRSpace object */ virtual bool init(IOFireWireBus *bus); /*! @function getPCRAddressSpace @abstract returns the IOFireWirePCRSpace object for the given FireWire bus @param bus The FireWire bus */ static IOFireWirePCRSpace *getPCRAddressSpace(IOFireWireBus *bus); /*! @function allocateInputPlug @abstract allocates an input plug. @param refcon arbitrary value passed back as first argument of callback. @param func callback function when a successful lock transaction to the plug has been performed @param plug set to the plug number if a plug is successfully allocated */ virtual IOReturn allocateInputPlug(void *refcon, IOFireWirePCRCallback func, UInt32 &plug); /*! @function freeInputPlug @abstract deallocates an input plug. @param plug value returned by allocateInputPlug. */ virtual void freeInputPlug(UInt32 plug); /*! @function readInputPlug @abstract returns the current value of an input plug. @param plug value returned by allocateInputPlug. */ virtual UInt32 readInputPlug(UInt32 plug); /*! @function updateInputPlug @abstract updates the value of an input plug (simulating a lock transaction). @param plug value returned by allocateInputPlug. @param oldVal value returned by readInputPlug. @param newVal new value to store in plug if it's current value is oldVal. */ virtual IOReturn updateInputPlug(UInt32 plug, UInt32 oldVal, UInt32 newVal); /*! @function allocateOutputPlug @abstract allocates an output plug. @param refcon arbitrary value passed back as first argument of callback. @param func callback function when a successful lock transaction to the plug has been performed @param plug set to the plug number if a plug is successfully allocated */ virtual IOReturn allocateOutputPlug(void *refcon, IOFireWirePCRCallback func, UInt32 &plug); /*! @function freeOutputPlug @abstract deallocates an output plug. @param plug value returned by allocateOutputPlug. */ virtual void freeOutputPlug(UInt32 plug); /*! @function readOutputPlug @abstract returns the current value of an output plug. @param plug value returned by allocateOutputPlug. */ virtual UInt32 readOutputPlug(UInt32 plug); /*! @function updateOutputPlug @abstract updates the value of an output plug (simulating a lock transaction). @param plug value returned by allocateOutputPlug. @param oldVal value returned by readOutputPlug. @param newVal new value to store in plug if it's current value is oldVal. */ virtual IOReturn updateOutputPlug(UInt32 plug, UInt32 oldVal, UInt32 newVal); /*! @function readOutputMasterPlug @abstract returns the current value of the output master plug. */ virtual UInt32 readOutputMasterPlug(); /*! @function updateOutputMasterPlug @abstract updates the value of the master output plug (simulating a lock transaction). @param oldVal value returned by readOutputMasterPlug. @param newVal new value to store in plug if it's current value is oldVal. */ virtual IOReturn updateOutputMasterPlug(UInt32 oldVal, UInt32 newVal); /*! @function readInputMasterPlug @abstract returns the current value of the input master plug. */ virtual UInt32 readInputMasterPlug(); /*! @function updateInputMasterPlug @abstract updates the value of the master input plug (simulating a lock transaction). @param oldVal value returned by readInputMasterPlug. @param newVal new value to store in plug if it's current value is oldVal. */ virtual IOReturn updateInputMasterPlug(UInt32 oldVal, UInt32 newVal); /*! @function setAVCTargetSpacePointer */ virtual void setAVCTargetSpacePointer(IOFireWireAVCTargetSpace *pAVCTargetSpace); /*! @function clearAllP2PConnections */ virtual void clearAllP2PConnections(void); private: OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 0); OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 1); OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 2); OSMetaClassDeclareReservedUnused(IOFireWirePCRSpace, 3); }; #endif /* _IOKIT_IOFIREWIREPCRSPACE_H */