The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/iokit/IOKit/IOMapper.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1998-2003 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
    5  * 
    6  * This file contains Original Code and/or Modifications of Original Code
    7  * as defined in and that are subject to the Apple Public Source License
    8  * Version 2.0 (the 'License'). You may not use this file except in
    9  * compliance with the License. The rights granted to you under the License
   10  * may not be used to create, or enable the creation or redistribution of,
   11  * unlawful or unlicensed copies of an Apple operating system, or to
   12  * circumvent, violate, or enable the circumvention or violation of, any
   13  * terms of an Apple operating system software license agreement.
   14  * 
   15  * Please obtain a copy of the License at
   16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
   17  * 
   18  * The Original Code and all software distributed under the License are
   19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   23  * Please see the License for the specific language governing rights and
   24  * limitations under the License.
   25  * 
   26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
   27  */
   28 
   29 #ifndef __IOKIT_IOMAPPER_H
   30 #define __IOKIT_IOMAPPER_H
   31 
   32 #include <sys/cdefs.h>
   33 
   34 __BEGIN_DECLS
   35 #include <IOKit/IOTypes.h>
   36 #include <mach/vm_types.h>
   37 
   38 // These are C accessors to the system mapper for non-IOKit clients
   39 ppnum_t IOMapperIOVMAlloc(unsigned pages);
   40 void IOMapperIOVMFree(ppnum_t addr, unsigned pages);
   41 
   42 ppnum_t IOMapperInsertPage(ppnum_t addr, unsigned offset, ppnum_t page);
   43 void IOMapperInsertPPNPages(ppnum_t addr, unsigned offset,
   44                             ppnum_t *pageList, unsigned pageCount);
   45 void IOMapperInsertUPLPages(ppnum_t addr, unsigned offset,
   46                             upl_page_info_t *pageList, unsigned pageCount);
   47 
   48 mach_vm_address_t IOMallocPhysical(mach_vm_size_t size, mach_vm_address_t mask);
   49 
   50 void IOFreePhysical(mach_vm_address_t address, mach_vm_size_t size);
   51 
   52 __END_DECLS
   53 
   54 #if __cplusplus
   55 
   56 #include <IOKit/IOService.h>
   57 #include <IOKit/IOMemoryDescriptor.h>
   58 
   59 class OSData;
   60 
   61 class IOMapper : public IOService
   62 {
   63     OSDeclareAbstractStructors(IOMapper);
   64 
   65     // Give the platform expert access to setMapperRequired();
   66     friend class IOPlatformExpert;
   67 
   68 private:
   69     enum SystemMapperState {
   70         kNoMapper  = 0,
   71         kUnknown   = 1,
   72         kHasMapper = 2, // Any other value is pointer to a live mapper
   73         kWaitMask  = 3,
   74     };
   75 protected:
   76     void *fTable;
   77     ppnum_t fTablePhys;
   78     IOItemCount fTableSize;
   79     OSData *fTableHandle;
   80     bool fIsSystem;
   81 
   82 
   83     static void setMapperRequired(bool hasMapper);
   84     static void waitForSystemMapper();
   85 
   86     virtual bool initHardware(IOService *provider) = 0;
   87 
   88     virtual bool allocTable(IOByteCount size);
   89 
   90 public:
   91     virtual bool start(IOService *provider);
   92     virtual void free();
   93 
   94     // Static routines capable of allocating tables that are physically
   95     // contiguous in real memory space.
   96     static OSData * NewARTTable(IOByteCount size,
   97                                 void ** virtAddrP, ppnum_t *physAddrP);
   98     static void FreeARTTable(OSData *handle, IOByteCount size);
   99 
  100 
  101     // To get access to the system mapper IOMapper::gSystem 
  102     static IOMapper *gSystem;
  103 
  104     virtual ppnum_t iovmAlloc(IOItemCount pages) = 0;
  105     virtual void iovmFree(ppnum_t addr, IOItemCount pages) = 0;
  106 
  107     virtual void iovmInsert(ppnum_t addr, IOItemCount offset, ppnum_t page) = 0;
  108     virtual void iovmInsert(ppnum_t addr, IOItemCount offset,
  109                             ppnum_t *pageList, IOItemCount pageCount);
  110     virtual void iovmInsert(ppnum_t addr, IOItemCount offset,
  111                             upl_page_info_t *pageList, IOItemCount pageCount);
  112     static void checkForSystemMapper()
  113         { if ((vm_address_t) gSystem & kWaitMask) waitForSystemMapper(); };
  114 
  115     // Function will panic if the given address is not found in a valid
  116     // iovm mapping.
  117     virtual addr64_t mapAddr(IOPhysicalAddress addr) = 0;
  118 
  119     // Get the address mask to or into an address to bypass this mapper
  120     virtual bool getBypassMask(addr64_t *maskP) const
  121     OSMetaClassDeclareReservedUsed(IOMapper, 0);
  122 
  123 private:
  124     OSMetaClassDeclareReservedUnused(IOMapper, 1);
  125     OSMetaClassDeclareReservedUnused(IOMapper, 2);
  126     OSMetaClassDeclareReservedUnused(IOMapper, 3);
  127     OSMetaClassDeclareReservedUnused(IOMapper, 4);
  128     OSMetaClassDeclareReservedUnused(IOMapper, 5);
  129     OSMetaClassDeclareReservedUnused(IOMapper, 6);
  130     OSMetaClassDeclareReservedUnused(IOMapper, 7);
  131     OSMetaClassDeclareReservedUnused(IOMapper, 8);
  132     OSMetaClassDeclareReservedUnused(IOMapper, 9);
  133     OSMetaClassDeclareReservedUnused(IOMapper, 10);
  134     OSMetaClassDeclareReservedUnused(IOMapper, 11);
  135     OSMetaClassDeclareReservedUnused(IOMapper, 12);
  136     OSMetaClassDeclareReservedUnused(IOMapper, 13);
  137     OSMetaClassDeclareReservedUnused(IOMapper, 14);
  138     OSMetaClassDeclareReservedUnused(IOMapper, 15);
  139 };
  140 
  141 #endif /* __cplusplus */
  142 
  143 #endif /* !__IOKIT_IOMAPPER_H */

Cache object: 6557e400b7c577123e2c850041afddff


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.