mutex.h revision 1.9
11.9Sriastrad/*	$NetBSD: mutex.h,v 1.9 2023/07/12 12:50:12 riastradh Exp $	*/
21.1Skochi
31.1Skochi/*-
41.1Skochi * Copyright (c) 2008 The NetBSD Foundation, Inc.
51.1Skochi * All rights reserved.
61.1Skochi *
71.1Skochi * This code is derived from software contributed to The NetBSD Foundation
81.1Skochi * by Takayoshi Kochi.
91.1Skochi *
101.1Skochi * Redistribution and use in source and binary forms, with or without
111.1Skochi * modification, are permitted provided that the following conditions
121.1Skochi * are met:
131.1Skochi * 1. Redistributions of source code must retain the above copyright
141.1Skochi *    notice, this list of conditions and the following disclaimer.
151.1Skochi * 2. Redistributions in binary form must reproduce the above copyright
161.1Skochi *    notice, this list of conditions and the following disclaimer in the
171.1Skochi *    documentation and/or other materials provided with the distribution.
181.7Sriastrad *
191.1Skochi * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Skochi * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Skochi * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Skochi * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Skochi * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Skochi * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Skochi * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Skochi * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Skochi * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Skochi * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Skochi * POSSIBILITY OF SUCH DAMAGE.
301.2Skochi */
311.1Skochi
321.1Skochi#ifndef _IA64_MUTEX_H_
331.1Skochi#define	_IA64_MUTEX_H_
341.1Skochi
351.9Sriastrad#include <sys/types.h>
361.9Sriastrad
371.4Skiyohara#ifndef __MUTEX_PRIVATE
381.4Skiyohara
391.1Skochistruct kmutex {
401.4Skiyohara	uintptr_t	mtx_pad1;
411.4Skiyohara	uint32_t	mtx_pad2[2];
421.1Skochi};
431.1Skochi
441.4Skiyohara#else
451.4Skiyohara
461.8Sriastrad#include <machine/intr.h>
471.8Sriastrad
481.4Skiyoharastruct kmutex {
491.4Skiyohara	volatile uintptr_t	mtx_owner;
501.4Skiyohara	ipl_cookie_t		mtx_ipl;
511.4Skiyohara	__cpu_simple_lock_t	mtx_lock;
521.4Skiyohara};
531.1Skochi
541.1Skochi/* XXX when we implement mutex_enter()/mutex_exit(), uncomment this
551.1Skochi#define __HAVE_MUTEX_STUBS		1
561.1Skochi*/
571.1Skochi/* XXX when we implement mutex_spin_enter()/mutex_spin_exit(), uncomment this
581.1Skochi#define __HAVE_SPIN_MUTEX_STUBS		1
591.1Skochi*/
601.1Skochi#define	__HAVE_SIMPLE_MUTEXES		1
611.1Skochi
621.1Skochi#endif	/* __MUTEX_PRIVATE */
631.1Skochi
641.1Skochi#endif	/* _IA64_MUTEX_H_ */
65