xref: /netbsd-src/sys/external/bsd/drm2/include/asm/processor.h (revision 3d6cb408ba199e3fc0c7cd7bbcf7c4d1ea667df6)
1*3d6cb408Sriastradh /*	$NetBSD: processor.h,v 1.6 2021/12/19 01:46:08 riastradh Exp $	*/
26cb10275Sriastradh 
36cb10275Sriastradh /*-
46cb10275Sriastradh  * Copyright (c) 2013 The NetBSD Foundation, Inc.
56cb10275Sriastradh  * All rights reserved.
66cb10275Sriastradh  *
76cb10275Sriastradh  * This code is derived from software contributed to The NetBSD Foundation
86cb10275Sriastradh  * by Taylor R. Campbell.
96cb10275Sriastradh  *
106cb10275Sriastradh  * Redistribution and use in source and binary forms, with or without
116cb10275Sriastradh  * modification, are permitted provided that the following conditions
126cb10275Sriastradh  * are met:
136cb10275Sriastradh  * 1. Redistributions of source code must retain the above copyright
146cb10275Sriastradh  *    notice, this list of conditions and the following disclaimer.
156cb10275Sriastradh  * 2. Redistributions in binary form must reproduce the above copyright
166cb10275Sriastradh  *    notice, this list of conditions and the following disclaimer in the
176cb10275Sriastradh  *    documentation and/or other materials provided with the distribution.
186cb10275Sriastradh  *
196cb10275Sriastradh  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
206cb10275Sriastradh  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
216cb10275Sriastradh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
226cb10275Sriastradh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
236cb10275Sriastradh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
246cb10275Sriastradh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
256cb10275Sriastradh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
266cb10275Sriastradh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
276cb10275Sriastradh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
286cb10275Sriastradh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
296cb10275Sriastradh  * POSSIBILITY OF SUCH DAMAGE.
306cb10275Sriastradh  */
316cb10275Sriastradh 
326cb10275Sriastradh #ifndef _ASM_PROCESSOR_H_
33cc7d357cSriastradh #define _ASM_PROCESSOR_H_
346cb10275Sriastradh 
353ed9a215Sriastradh #include <sys/param.h>
366cb10275Sriastradh 
37*3d6cb408Sriastradh #include <sys/lock.h>
38*3d6cb408Sriastradh 
39*3d6cb408Sriastradh #define	cpu_relax()	SPINLOCK_BACKOFF_HOOK
406cb10275Sriastradh 
41388f1e9bSriastradh #if defined(__i386__) || defined(__x86_64__)
42388f1e9bSriastradh static inline void
clflushopt(void * p)43388f1e9bSriastradh clflushopt(void *p)
44388f1e9bSriastradh {
45388f1e9bSriastradh 	/* XXX Test CPUID bit, use CLFLUSHOPT...  */
46388f1e9bSriastradh 	asm volatile ("clflush %0" : : "m" (*(const char *)p));
47388f1e9bSriastradh }
48388f1e9bSriastradh #endif
49388f1e9bSriastradh 
506cb10275Sriastradh #endif  /* _ASM_PROCESSOR_H_ */
51