Annotation of kernel/machdep/ppc/pmap.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:  * Copyright (c) 1990 The University of Utah and
                     27:  * the Center for Software Science at the University of Utah (CSS).
                     28:  * All rights reserved.
                     29:  *
                     30:  * Permission to use, copy, modify and distribute this software is hereby
                     31:  * granted provided that (1) source code retains these copyright, permission,
                     32:  * and disclaimer notices, and (2) redistributions including binaries
                     33:  * reproduce the notices in supporting documentation, and (3) all advertising
                     34:  * materials mentioning features or use of this software display the following
                     35:  * acknowledgement: ``This product includes software developed by the Center
                     36:  * for Software Science at the University of Utah.''
                     37:  *
                     38:  * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
                     39:  * IS" CONDITION.  THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
                     40:  * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     41:  *
                     42:  * CSS requests users of this software to return to [email protected] any
                     43:  * improvements that they make and grant CSS redistribution rights.
                     44:  *
                     45:  *     Utah $Hdr: pmap.h 1.13 91/09/25$
                     46:  *     Author: Mike Hibler, Bob Wheeler, University of Utah CSS, 9/90
                     47:  */
                     48: 
                     49: /*
                     50:  *     Pmap header for ppc
                     51:  */
                     52: 
                     53: #ifndef        _PPC_PMAP_H_
                     54: #define        _PPC_PMAP_H_
                     55: 
                     56: /*#include <mach/vm_types.h>*/
                     57: #include <mach/machine/vm_types.h>
                     58: #include <mach/vm_prot.h>
                     59: #include <mach/vm_statistics.h>
                     60: #include <mach/machine/kern_return.h>
                     61: #include <kern/lock.h>
                     62: /*#include <kern/queue.h>*/
                     63: 
                     64: /* The size of the hash table and mapping entries and the size
                     65:  * of the VM needed by the linux server is proportional
                     66:  * to the amount of physical memory. The hash table and mapping
                     67:  * entries must be allocated in contiguous physical memory.
                     68:  * Currently, the limits are set up so that 128M is the ceiling
                     69:  */
                     70: 
                     71: #define MAX_SUPPORTED_PHYSICAL_MEMORY  (128*1024*1024)
                     72: 
                     73: struct pmap {
                     74:        decl_simple_lock_data(, lock)        /* Lock on map */
                     75:        int                     ref_count;   /* reference count */
                     76:        space_t                 space;       /* space for this pmap */
                     77:        struct pmap             *next;       /* linked list of free pmaps */
                     78:        struct pmap_statistics  stats;       /* statistics */
                     79: };
                     80: 
                     81: typedef struct pmap *pmap_t;
                     82: 
                     83: #define PMAP_NULL  ((pmap_t) 0)
                     84: 
                     85: extern pmap_t  kernel_pmap;                    /* The kernel's map */
                     86: 
                     87: #define        PMAP_SWITCH_USER(th, map, my_cpu) th->map = map;        
                     88: 
                     89: #define PMAP_ACTIVATE(pmap, th, cpu)
                     90: #define PMAP_DEACTIVATE(pmap, th, cpu)
                     91: #define PMAP_CONTEXT(pmap,th)
                     92: 
                     93: #define pmap_kernel_va(VA)     \
                     94:        (((VA) >= VM_MIN_KERNEL_ADDRESS) && ((VA) <= VM_MAX_KERNEL_ADDRESS))
                     95: 
                     96: #define        PPC_SID_KERNEL  0       /* Must change KERNEL_SEG_REG0_VALUE if !0 */
                     97: #define SID_MAX        ((1<<20) - 1)   /* Space ID=20 bits, segment_id=SID + 4 bits */
                     98: #define PPC_SID_PRIME 356299   /* generate non-repetative "different" sids */
                     99: #define PPC_SID_MASK  0xfffff   /* within a 20-bit field */
                    100: 
                    101: #define pmap_kernel()                  (kernel_pmap)
                    102: #define        pmap_resident_count(pmap)       ((pmap)->stats.resident_count)
                    103: #define pmap_remove_attributes(pmap,start,end)
                    104: #define pmap_copy(dpmap,spmap,da,len,sa)
                    105: 
                    106: #define pmap_phys_address(x)   ((x) << PPC_PGSHIFT)
                    107: #define pmap_phys_to_frame(x)  ((x) >> PPC_PGSHIFT)
                    108: 
                    109: #define PMAP_PTOB(x)           ((x) << PPC_PGSHIFT)
                    110: 
                    111: /* 
                    112:  * prototypes.
                    113:  */
                    114: extern void            ppc_protection_init(void);
                    115: extern vm_offset_t     kvtophys(vm_offset_t addr);
                    116: extern vm_offset_t     phystokv(vm_offset_t addr);
                    117: extern vm_offset_t     pmap_map(vm_offset_t va,
                    118:                                 vm_offset_t spa,
                    119:                                 vm_offset_t epa,
                    120:                                 vm_prot_t prot);
                    121: extern kern_return_t    pmap_add_physical_memory(vm_offset_t spa,
                    122:                                                 vm_offset_t epa,
                    123:                                                 boolean_t available,
                    124:                                                 unsigned int attr);
                    125: extern vm_offset_t     pmap_map_bd(vm_offset_t va,
                    126:                                    vm_offset_t spa,
                    127:                                    vm_offset_t epa,
                    128:                                    vm_prot_t prot);
                    129: extern void            pmap_bootstrap(unsigned int mem_size,
                    130:                                       vm_offset_t *first_avail);
                    131: extern void            pmap_block_map(vm_offset_t pa,
                    132:                                       vm_size_t size,
                    133:                                       vm_prot_t prot,
                    134:                                       int entry, 
                    135:                                       int dtlb);
                    136: extern void            pmap_switch(pmap_t);
                    137: 
                    138: extern vm_offset_t pmap_extract(pmap_t pmap,
                    139:                                vm_offset_t va);
                    140: 
                    141: extern void pmap_remove_all(vm_offset_t pa);
                    142: 
                    143: extern boolean_t pmap_verify_free(vm_offset_t pa);
                    144: 
                    145: extern void flush_cache(vm_offset_t pa, unsigned length);
                    146: extern void flush_cache_v(vm_offset_t pa, unsigned length);
                    147: extern void invalidate_cache_v(vm_offset_t pa, unsigned length);
                    148: typedef enum {
                    149:     cache_default,
                    150:     cache_writethrough,
                    151:     cache_disable
                    152: } cache_spec_t;
                    153: 
                    154: void pmap_enter_cache_spec(
                    155:                pmap_t          pmap,
                    156:                vm_offset_t     va,
                    157:                vm_offset_t     pa,
                    158:                vm_prot_t       prot,
                    159:                boolean_t       wired,
                    160:                cache_spec_t    caching);
                    161: 
                    162: #endif /* _PPC_PMAP_H_ */
                    163: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.