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/powerpc/include/bat.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  * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-4-Clause
    3  *
    4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Jason R. Thorpe.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   29  * POSSIBILITY OF SUCH DAMAGE.
   30  */
   31 
   32 /*-
   33  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
   34  * Copyright (C) 1995, 1996 TooLs GmbH.
   35  * All rights reserved.
   36  *
   37  * Redistribution and use in source and binary forms, with or without
   38  * modification, are permitted provided that the following conditions
   39  * are met:
   40  * 1. Redistributions of source code must retain the above copyright
   41  *    notice, this list of conditions and the following disclaimer.
   42  * 2. Redistributions in binary form must reproduce the above copyright
   43  *    notice, this list of conditions and the following disclaimer in the
   44  *    documentation and/or other materials provided with the distribution.
   45  * 3. All advertising materials mentioning features or use of this software
   46  *    must display the following acknowledgement:
   47  *      This product includes software developed by TooLs GmbH.
   48  * 4. The name of TooLs GmbH may not be used to endorse or promote products
   49  *    derived from this software without specific prior written permission.
   50  *
   51  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
   52  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   53  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   54  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   55  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   56  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
   57  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   58  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   59  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
   60  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   61  *
   62  *      $NetBSD: bat.h,v 1.2 1999/12/18 01:36:06 thorpej Exp $
   63  * $FreeBSD$
   64  */
   65 
   66 #ifndef _MACHINE_BAT_H_
   67 #define _MACHINE_BAT_H_
   68 
   69 #ifndef LOCORE
   70 struct bat {
   71         u_int32_t batu;
   72         u_int32_t batl;
   73 };
   74 #endif
   75 
   76 /* Lower BAT bits (all but PowerPC 601): */
   77 #define BAT_PBS         0xfffe0000      /* physical block start */
   78 #define BAT_W           0x00000040      /* 1 = write-through, 0 = write-back */
   79 #define BAT_I           0x00000020      /* cache inhibit */
   80 #define BAT_M           0x00000010      /* memory coherency enable */
   81 #define BAT_G           0x00000008      /* guarded region */
   82 
   83 #define BAT_PP_NONE     0x00000000      /* no access permission */
   84 #define BAT_PP_RO_S     0x00000001      /* read-only (soft) */
   85 #define BAT_PP_RW       0x00000002      /* read/write */
   86 #define BAT_PP_RO       0x00000003      /* read-only */
   87 
   88 /* Upper BAT bits (all but PowerPC 601): */
   89 #define BAT_EBS         0xfffe0000      /* effective block start */
   90 #define BAT_BL          0x00001ffc      /* block length */
   91 #define BAT_Vs          0x00000002      /* valid in supervisor mode */
   92 #define BAT_Vu          0x00000001      /* valid in user mode */
   93 
   94 #define BAT_V           (BAT_Vs|BAT_Vu)
   95 
   96 /* Block Length encoding (all but PowerPC 601): */
   97 #define BAT_BL_128K     0x00000000
   98 #define BAT_BL_256K     0x00000004
   99 #define BAT_BL_512K     0x0000000c
  100 #define BAT_BL_1M       0x0000001c
  101 #define BAT_BL_2M       0x0000003c
  102 #define BAT_BL_4M       0x0000007c
  103 #define BAT_BL_8M       0x000000fc
  104 #define BAT_BL_16M      0x000001fc
  105 #define BAT_BL_32M      0x000003fc
  106 #define BAT_BL_64M      0x000007fc
  107 #define BAT_BL_128M     0x00000ffc
  108 #define BAT_BL_256M     0x00001ffc
  109 
  110 #define BATU(va, len, v)                                                \
  111         (((va) & BAT_EBS) | ((len) & BAT_BL) | ((v) & BAT_V))
  112 
  113 #define BATL(pa, wimg, pp)                                              \
  114         (((pa) & BAT_PBS) | (wimg) | (pp))
  115 
  116 /* Lower BAT bits (PowerPC 601): */
  117 #define BAT601_PBN      0xfffe0000      /* physical block number */
  118 #define BAT601_V        0x00000040      /* valid */
  119 #define BAT601_BSM      0x0000003f      /* block size mask */
  120 
  121 /* Upper BAT bits (PowerPC 601): */
  122 #define BAT601_BLPI     0xfffe0000      /* block logical page index */
  123 #define BAT601_W        0x00000040      /* 1 = write-through, 0 = write-back */
  124 #define BAT601_I        0x00000020      /* cache inhibit */
  125 #define BAT601_M        0x00000010      /* memory coherency enable */
  126 #define BAT601_Ks       0x00000008      /* key-supervisor */
  127 #define BAT601_Ku       0x00000004      /* key-user */
  128 
  129 /*
  130  * Permission bits on the PowerPC 601 are modified by the appropriate
  131  * Key bit:
  132  *
  133  *      Key     PP      Access
  134  *      0       NONE    read/write
  135  *      0       RO_S    read/write
  136  *      0       RW      read/write
  137  *      0       RO      read-only
  138  *
  139  *      1       NONE    none
  140  *      1       RO_S    read-only
  141  *      1       RW      read/write
  142  *      1       RO      read-only
  143  */
  144 #define BAT601_PP_NONE  0x00000000      /* no access permission */
  145 #define BAT601_PP_RO_S  0x00000001      /* read-only (soft) */
  146 #define BAT601_PP_RW    0x00000002      /* read/write */
  147 #define BAT601_PP_RO    0x00000003      /* read-only */
  148 
  149 /* Block Size Mask encoding (PowerPC 601): */
  150 #define BAT601_BSM_128K 0x00000000
  151 #define BAT601_BSM_256K 0x00000001
  152 #define BAT601_BSM_512K 0x00000003
  153 #define BAT601_BSM_1M   0x00000007
  154 #define BAT601_BSM_2M   0x0000000f
  155 #define BAT601_BSM_4M   0x0000001f
  156 #define BAT601_BSM_8M   0x0000003f
  157 
  158 #define BATU601(va, wim, key, pp)                                       \
  159         (((va) & BAT601_BLPI) | (wim) | (key) | (pp))
  160 
  161 #define BATL601(pa, size, v)                                            \
  162         (((pa) & BAT601_PBN) | (v) | (size))
  163 
  164 #if defined(_KERNEL) && !defined(LOCORE)
  165 extern struct bat battable[16];
  166 #endif
  167 
  168 #endif  /* _MACHINE_BAT_H_ */

Cache object: d8a1dc4ef7d55dab2dc9dadb09b700e0


[ 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.