/*
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_LICENSE_OSREFERENCE_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@
+ * 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_LICENSE_OSREFERENCE_HEADER_END@
*/
/*
* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
#error IOLib.h is for kernel use only
#endif
-#ifndef IOKIT_DEPRECATED
-#define IOKIT_DEPRECATED 1
-#endif
+#include <sys/cdefs.h>
+
+#include <sys/appleapiopts.h>
#include <IOKit/system.h>
#include <libkern/OSAtomic.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
#include <kern/thread_call.h>
#include <kern/clock.h>
+
/*
* min/max macros.
*/
@discussion This is a utility to allocate memory in the kernel, with an alignment restriction which is specified as a byte count, and will allocate only physically contiguous memory. The request may fail if memory is fragmented, and may cause large amounts of paging activity. This function may block and so should not be called from interrupt level or while a simple lock is held.
@param size Size of the memory requested.
@param alignment Byte count of the alignment for the memory. For example, pass 256 to get memory allocated at an address with bits 0-7 zero.
- @param physicalAddress IOMallocContiguous returns the physical address of the allocated memory here, if physicalAddress is a non-zero pointer.
+ @param physicalAddress IOMallocContiguous returns the physical address of the allocated memory here, if physicalAddress is a non-zero pointer. The physicalAddress argument is deprecated and should be passed as NULL. To obtain the physical address for a memory buffer, use the IODMACommand class in conjunction with the IOMemoryDescriptor or IOBufferMemoryDescriptor classes.
@result Virtual address of the allocated memory, or zero on failure. */
void * IOMallocContiguous(vm_size_t size, vm_size_t alignment,
#define IONew(type,number) (type*)IOMalloc(sizeof(type) * (number) )
#define IODelete(ptr,type,number) IOFree( (ptr) , sizeof(type) * (number) )
+/////////////////////////////////////////////////////////////////////////////
+//
+//
+// These functions are now implemented in IOMapper.cpp
+//
+//
+/////////////////////////////////////////////////////////////////////////////
+
+/*! @function IOMappedRead8
+ @abstract Read one byte from the desired "Physical" IOSpace address.
+ @discussion Read one byte from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @result Data contained at that location */
+
+UInt8 IOMappedRead8(IOPhysicalAddress address);
+
+/*! @function IOMappedRead16
+ @abstract Read two bytes from the desired "Physical" IOSpace address.
+ @discussion Read two bytes from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @result Data contained at that location */
+
+UInt16 IOMappedRead16(IOPhysicalAddress address);
+
+/*! @function IOMappedRead32
+ @abstract Read four bytes from the desired "Physical" IOSpace address.
+ @discussion Read four bytes from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @result Data contained at that location */
+
+UInt32 IOMappedRead32(IOPhysicalAddress address);
+
+/*! @function IOMappedRead64
+ @abstract Read eight bytes from the desired "Physical" IOSpace address.
+ @discussion Read eight bytes from the desired "Physical" IOSpace address. This function allows the developer to read an address returned from any memory descriptor's getPhysicalSegment routine. It can then be used by segmenting a physical page slightly to tag the physical page with its kernel space virtual address.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @result Data contained at that location */
+
+UInt64 IOMappedRead64(IOPhysicalAddress address);
+
+/*! @function IOMappedWrite8
+ @abstract Write one byte to the desired "Physical" IOSpace address.
+ @discussion Write one byte to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @param value Data to be writen to the desired location */
+
+void IOMappedWrite8(IOPhysicalAddress address, UInt8 value);
+
+/*! @function IOMappedWrite16
+ @abstract Write two bytes to the desired "Physical" IOSpace address.
+ @discussion Write two bytes to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @param value Data to be writen to the desired location */
+
+void IOMappedWrite16(IOPhysicalAddress address, UInt16 value);
+
+/*! @function IOMappedWrite32
+ @abstract Write four bytes to the desired "Physical" IOSpace address.
+ @discussion Write four bytes to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @param value Data to be writen to the desired location */
+
+void IOMappedWrite32(IOPhysicalAddress address, UInt32 value);
+
+/*! @function IOMappedWrite64
+ @abstract Write eight bytes to the desired "Physical" IOSpace address.
+ @discussion Write eight bytes to the desired "Physical" IOSpace address. This function allows the developer to write to an address returned from any memory descriptor's getPhysicalSegment routine.
+ @param address The desired address, as returned by IOMemoryDescriptor::getPhysicalSegment.
+ @param value Data to be writen to the desired location */
+
+void IOMappedWrite64(IOPhysicalAddress address, UInt64 value);
+
/*! @function IOSetProcessorCacheMode
@abstract Sets the processor cache mode for mapped memory.
@discussion This function sets the cache mode of an already mapped & wired memory range. Note this may not be supported on I/O mappings or shared memory - it is far preferable to set the cache mode as mappings are created with the IOMemoryDescriptor::map method.
@abstract Terminate exceution of current thread.
@discussion This function destroys the currently running thread, and does not return. */
-volatile void IOExitThread();
+void IOExitThread(void) __dead2;
/*! @function IOSleep
@abstract Sleep the calling thread for a number of milliseconds.
void IOLog(const char *format, ...)
__attribute__((format(printf, 1, 2)));
+#ifndef _FN_KPRINTF
+#define _FN_KPRINTF
void kprintf(const char *format, ...);
+#endif
+#ifndef _FN_KPRINTF_DECLARED
+#define _FN_KPRINTF_DECLARED
+#endif
/*
* Convert a integer constant (typically a #define or enum) to a string
(((value) / (multiple)) * (multiple));
-#if IOKIT_DEPRECATED
+#ifdef __APPLE_API_OBSOLETE
/* The following API is deprecated */
void IOPanic(const char *reason);
-/* The AbsoluteTime clock API exported by kern/clock.h
+/* The API exported by kern/clock.h
should be used for high resolution timing. */
void IOGetTime( mach_timespec_t * clock_time);
extern mach_timespec_t IOZeroTvalspec;
-#endif /* IOKIT_DEPRECATED */
+#endif /* __APPLE_API_OBSOLETE */
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
+__END_DECLS
#endif /* !__IOKIT_IOLIB_H */