#ifdef KERNEL_PRIVATE
#ifndef _PPC_SIMPLE_LOCK_TYPES_H_
#define _PPC_SIMPLE_LOCK_TYPES_H_
#ifdef KERNEL_PRIVATE
#include <mach/boolean.h>
#include <kern/kern_types.h>
#include <sys/appleapiopts.h>
#ifdef MACH_KERNEL_PRIVATE
#include <ppc/hw_lock_types.h>
#include <ppc/locks.h>
#include <mach_ldebug.h>
#endif
#ifdef MACH_KERNEL_PRIVATE
#if MACH_LDEBUG
#define USLOCK_DEBUG 1
#else
#define USLOCK_DEBUG 0
#endif
#if !USLOCK_DEBUG
typedef lck_spin_t usimple_lock_data_t, *usimple_lock_t;
#else
typedef struct uslock_debug {
void *lock_pc;
void *lock_thread;
unsigned long duration[2];
unsigned short state;
unsigned char lock_cpu;
void *unlock_thread;
unsigned char unlock_cpu;
void *unlock_pc;
} uslock_debug;
typedef struct {
hw_lock_data_t interlock;
unsigned short lock_type;
#define USLOCK_TAG 0x5353
uslock_debug debug;
} usimple_lock_data_t, *usimple_lock_t;
#endif
#else
typedef struct slock {
unsigned int lock_data[10];
} usimple_lock_data_t, *usimple_lock_t;
#endif
#define USIMPLE_LOCK_NULL ((usimple_lock_t) 0)
#if !defined(decl_simple_lock_data)
typedef usimple_lock_data_t *simple_lock_t;
typedef usimple_lock_data_t simple_lock_data_t;
#define decl_simple_lock_data(class,name) \
class simple_lock_data_t name;
#endif
#ifdef MACH_KERNEL_PRIVATE
#if !MACH_LDEBUG
#define MACHINE_SIMPLE_LOCK
extern void ppc_usimple_lock_init(simple_lock_t,unsigned short);
extern void ppc_usimple_lock(simple_lock_t);
extern void ppc_usimple_unlock_rwmb(simple_lock_t);
extern void ppc_usimple_unlock_rwcmb(simple_lock_t);
extern unsigned int ppc_usimple_lock_try(simple_lock_t);
#define simple_lock_init(l,t) ppc_usimple_lock_init(l,t)
#define simple_lock(l) ppc_usimple_lock(l)
#define simple_unlock(l) ppc_usimple_unlock_rwcmb(l)
#define simple_unlock_rwmb(l) ppc_usimple_unlock_rwmb(l)
#define simple_lock_try(l) ppc_usimple_lock_try(l)
#define simple_lock_addr(l) (&(l))
#define thread_sleep_simple_lock(l, e, i) \
thread_sleep_fast_usimple_lock((l), (e), (i))
#endif
extern unsigned int hw_lock_bit(
unsigned int *,
unsigned int,
unsigned int);
extern unsigned int hw_cpu_sync(
unsigned int *,
unsigned int);
extern unsigned int hw_cpu_wcng(
unsigned int *,
unsigned int,
unsigned int);
extern unsigned int hw_lock_mbits(
unsigned int *,
unsigned int,
unsigned int,
unsigned int,
unsigned int);
void hw_unlock_bit(
unsigned int *,
unsigned int);
#endif
#endif
#endif
#endif