+ kIODirectionOutIn = kIODirectionOut | kIODirectionIn,
+ kIODirectionInOut = kIODirectionIn | kIODirectionOut,
+
+ // these flags are valid for the prepare() method only
+ kIODirectionPrepareToPhys32 = 0x00000004,
+ kIODirectionPrepareNoFault = 0x00000008,
+ kIODirectionPrepareReserved1 = 0x00000010,
+#define IODIRECTIONPREPARENONCOHERENTDEFINED 1
+ kIODirectionPrepareNonCoherent = 0x00000020,
+};
+#ifdef __LP64__
+typedef IOOptionBits IODirection;
+#endif /* __LP64__ */
+
+/*
+ * IOOptionBits used in the withOptions variant
+ */
+enum {
+ kIOMemoryDirectionMask = 0x00000007,
+#ifdef XNU_KERNEL_PRIVATE
+ kIOMemoryAutoPrepare = 0x00000008, // Shared with Buffer MD
+#endif
+
+ kIOMemoryTypeVirtual = 0x00000010,
+ kIOMemoryTypePhysical = 0x00000020,
+ kIOMemoryTypeUPL = 0x00000030,
+ kIOMemoryTypePersistentMD = 0x00000040, // Persistent Memory Descriptor
+ kIOMemoryTypeUIO = 0x00000050,
+#ifdef __LP64__
+ kIOMemoryTypeVirtual64 = kIOMemoryTypeVirtual,
+ kIOMemoryTypePhysical64 = kIOMemoryTypePhysical,
+#else /* !__LP64__ */
+ kIOMemoryTypeVirtual64 = 0x00000060,
+ kIOMemoryTypePhysical64 = 0x00000070,
+#endif /* !__LP64__ */
+ kIOMemoryTypeMask = 0x000000f0,
+
+ kIOMemoryAsReference = 0x00000100,
+ kIOMemoryBufferPageable = 0x00000400,
+ kIOMemoryMapperNone = 0x00000800, // Shared with Buffer MD
+ kIOMemoryHostOnly = 0x00001000, // Never DMA accessible
+#ifdef XNU_KERNEL_PRIVATE
+ kIOMemoryRedirected = 0x00004000,
+ kIOMemoryPreparedReadOnly = 0x00008000,
+#endif
+ kIOMemoryPersistent = 0x00010000,
+#ifdef XNU_KERNEL_PRIVATE
+ kIOMemoryReserved6156215 = 0x00020000,
+#endif
+ kIOMemoryThreadSafe = 0x00100000, // Shared with Buffer MD
+ kIOMemoryClearEncrypt = 0x00200000, // Shared with Buffer MD
+};
+
+#define kIOMapperSystem ((IOMapper *) 0)
+
+enum
+{
+ kIOMemoryPurgeableKeepCurrent = 1,
+
+ kIOMemoryPurgeableNonVolatile = 2,
+ kIOMemoryPurgeableVolatile = 3,
+ kIOMemoryPurgeableEmpty = 4,
+
+ // modifiers for kIOMemoryPurgeableVolatile behavior
+ kIOMemoryPurgeableVolatileGroup0 = VM_VOLATILE_GROUP_0,
+ kIOMemoryPurgeableVolatileGroup1 = VM_VOLATILE_GROUP_1,
+ kIOMemoryPurgeableVolatileGroup2 = VM_VOLATILE_GROUP_2,
+ kIOMemoryPurgeableVolatileGroup3 = VM_VOLATILE_GROUP_3,
+ kIOMemoryPurgeableVolatileGroup4 = VM_VOLATILE_GROUP_4,
+ kIOMemoryPurgeableVolatileGroup5 = VM_VOLATILE_GROUP_5,
+ kIOMemoryPurgeableVolatileGroup6 = VM_VOLATILE_GROUP_6,
+ kIOMemoryPurgeableVolatileGroup7 = VM_VOLATILE_GROUP_7,
+ kIOMemoryPurgeableVolatileBehaviorFifo = VM_PURGABLE_BEHAVIOR_FIFO,
+ kIOMemoryPurgeableVolatileBehaviorLifo = VM_PURGABLE_BEHAVIOR_LIFO,
+ kIOMemoryPurgeableVolatileOrderingObsolete = VM_PURGABLE_ORDERING_OBSOLETE,
+ kIOMemoryPurgeableVolatileOrderingNormal = VM_PURGABLE_ORDERING_NORMAL,
+};
+enum
+{
+ kIOMemoryIncoherentIOFlush = 1,
+ kIOMemoryIncoherentIOStore = 2,
+
+ kIOMemoryClearEncrypted = 50,
+ kIOMemorySetEncrypted = 51,
+};
+
+#define IOMEMORYDESCRIPTOR_SUPPORTS_DMACOMMAND 1
+
+struct IODMAMapSpecification
+{
+ uint64_t alignment;
+ IOService * device;
+ uint32_t options;
+ uint8_t numAddressBits;
+ uint8_t resvA[3];
+ uint32_t resvB[4];
+};
+
+enum
+{
+ kIODMAMapWriteAccess = 0x00000002,
+ kIODMAMapPhysicallyContiguous = 0x00000010,
+ kIODMAMapDeviceMemory = 0x00000020,
+ kIODMAMapPagingPath = 0x00000040,
+ kIODMAMapIdentityMap = 0x00000080,
+};
+
+
+enum
+{
+ kIOPreparationIDUnprepared = 0,
+ kIOPreparationIDUnsupported = 1,
+ kIOPreparationIDAlwaysPrepared = 2,