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/osfmk/ppc/simple_lock.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) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * The contents of this file constitute Original Code as defined in and
    7  * are subject to the Apple Public Source License Version 1.1 (the
    8  * "License").  You may not use this file except in compliance with the
    9  * License.  Please obtain a copy of the License at
   10  * http://www.apple.com/publicsource and read it before using this file.
   11  * 
   12  * This Original Code and all software distributed under the License are
   13  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   14  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   15  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   16  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
   17  * License for the specific language governing rights and limitations
   18  * under the License.
   19  * 
   20  * @APPLE_LICENSE_HEADER_END@
   21  */
   22 /*
   23  * @OSF_COPYRIGHT@
   24  */
   25 /* 
   26  * Mach Operating System
   27  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
   28  * All Rights Reserved.
   29  * 
   30  * Permission to use, copy, modify and distribute this software and its
   31  * documentation is hereby granted, provided that both the copyright
   32  * notice and this permission notice appear in all copies of the
   33  * software, derivative works or modified versions, and any portions
   34  * thereof, and that both notices appear in supporting documentation.
   35  * 
   36  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   37  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   38  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   39  * 
   40  * Carnegie Mellon requests users of this software to return to
   41  * 
   42  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   43  *  School of Computer Science
   44  *  Carnegie Mellon University
   45  *  Pittsburgh PA 15213-3890
   46  * 
   47  * any improvements or extensions that they make and grant Carnegie Mellon
   48  * the rights to redistribute these changes.
   49  */
   50 
   51 #ifdef  KERNEL_PRIVATE
   52 
   53 #ifndef _PPC_SIMPLE_LOCK_TYPES_H_
   54 #define _PPC_SIMPLE_LOCK_TYPES_H_
   55 
   56 #ifdef  KERNEL_PRIVATE
   57 #include <mach/boolean.h>
   58 #include <kern/kern_types.h>
   59 
   60 #include <sys/appleapiopts.h>
   61 #ifdef  MACH_KERNEL_PRIVATE
   62 #include <ppc/hw_lock_types.h>
   63 #include <ppc/locks.h>
   64 #include <mach_ldebug.h>
   65 #endif
   66 
   67 #ifdef MACH_KERNEL_PRIVATE
   68 
   69 #if MACH_LDEBUG
   70 #define USLOCK_DEBUG 1
   71 #else
   72 #define USLOCK_DEBUG 0
   73 #endif
   74 
   75 #if     !USLOCK_DEBUG
   76 
   77 typedef lck_spin_t usimple_lock_data_t, *usimple_lock_t;
   78 
   79 #else
   80 
   81 typedef struct uslock_debug {
   82         void                    *lock_pc;       /* pc where lock operation began    */
   83         void                    *lock_thread;   /* thread that acquired lock */
   84         unsigned long   duration[2];
   85         unsigned short  state;
   86         unsigned char   lock_cpu;
   87         void                    *unlock_thread; /* last thread to release lock */
   88         unsigned char   unlock_cpu;
   89         void                    *unlock_pc;     /* pc where lock operation ended    */
   90 } uslock_debug;
   91 
   92 typedef struct {
   93         hw_lock_data_t  interlock;      /* must be first... see lock.c */
   94         unsigned short  lock_type;      /* must be second... see lock.c */
   95 #define USLOCK_TAG      0x5353
   96         uslock_debug    debug;
   97 } usimple_lock_data_t, *usimple_lock_t;
   98 
   99 #endif  /* USLOCK_DEBUG */
  100 
  101 #else
  102 
  103 typedef struct slock {
  104         unsigned int    lock_data[10];
  105 } usimple_lock_data_t, *usimple_lock_t;
  106 
  107 #endif  /* MACH_KERNEL_PRIVATE */
  108 
  109 #define USIMPLE_LOCK_NULL       ((usimple_lock_t) 0)
  110 
  111 #if !defined(decl_simple_lock_data)
  112 
  113 typedef usimple_lock_data_t     *simple_lock_t;
  114 typedef usimple_lock_data_t     simple_lock_data_t;
  115 
  116 #define decl_simple_lock_data(class,name) \
  117         class   simple_lock_data_t      name;
  118 
  119 #endif  /* !defined(decl_simple_lock_data) */
  120 
  121 #ifdef  MACH_KERNEL_PRIVATE
  122 #if     !MACH_LDEBUG
  123 
  124 #define MACHINE_SIMPLE_LOCK
  125 
  126 extern void                                             ppc_usimple_lock_init(simple_lock_t,unsigned short);
  127 extern void                                             ppc_usimple_lock(simple_lock_t);
  128 extern void                                             ppc_usimple_unlock_rwmb(simple_lock_t);
  129 extern void                                             ppc_usimple_unlock_rwcmb(simple_lock_t);
  130 extern unsigned int                             ppc_usimple_lock_try(simple_lock_t);
  131 
  132 #define simple_lock_init(l,t)   ppc_usimple_lock_init(l,t)
  133 #define simple_lock(l)                  ppc_usimple_lock(l)
  134 #define simple_unlock(l)                ppc_usimple_unlock_rwcmb(l)
  135 #define simple_unlock_rwmb(l)   ppc_usimple_unlock_rwmb(l)
  136 #define simple_lock_try(l)              ppc_usimple_lock_try(l)
  137 #define simple_lock_addr(l)             (&(l))
  138 #define thread_sleep_simple_lock(l, e, i) \
  139                                                                 thread_sleep_fast_usimple_lock((l), (e), (i))
  140 #endif  /* !MACH_LDEBUG */
  141 
  142 extern unsigned int             hw_lock_bit(
  143                                         unsigned int *,
  144                                         unsigned int,
  145                                         unsigned int);
  146 
  147 extern unsigned int             hw_cpu_sync(
  148                                         unsigned int *,
  149                                         unsigned int);
  150 
  151 extern unsigned int             hw_cpu_wcng(
  152                                         unsigned int *,
  153                                         unsigned int,
  154                                         unsigned int);
  155 
  156 extern unsigned int             hw_lock_mbits(
  157                                         unsigned int *,
  158                                         unsigned int,
  159                                         unsigned int,
  160                                         unsigned int,
  161                                         unsigned int);
  162 
  163 void                            hw_unlock_bit(
  164                                         unsigned int *,
  165                                         unsigned int);
  166 
  167 #endif  /* MACH_KERNEL_PRIVATE */
  168 #endif  /* KERNEL_PRIVATE */
  169 
  170 #endif /* !_PPC_SIMPLE_LOCK_TYPES_H_ */
  171 
  172 #endif  /* KERNEL_PRIVATE */

Cache object: 6063539aef668fd67a5dc3c3534cdb19


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