xref: /freebsd/sys/compat/linuxkpi/common/include/asm/smp.h (revision 307f78f3ed90a4145eeb2c8cc79bc95b2666f57a)
1c12488bbSMark Johnston /*-
2c12488bbSMark Johnston  * Copyright (c) 2017 Mark Johnston <markj@FreeBSD.org>
3c12488bbSMark Johnston  *
4c12488bbSMark Johnston  * Redistribution and use in source and binary forms, with or without
5c12488bbSMark Johnston  * modification, are permitted provided that the following conditions are
6c12488bbSMark Johnston  * met:
7c12488bbSMark Johnston  * 1. Redistributions of source code must retain the above copyright
8c12488bbSMark Johnston  *    notice, this list of conditions and the following disclaimer.
9c12488bbSMark Johnston  * 2. Redistributions in binary form must reproduce the above copyright
10c12488bbSMark Johnston  *    notice, this list of conditions and the following disclaimer in
11c12488bbSMark Johnston  *    the documentation and/or other materials provided with the
12c12488bbSMark Johnston  *    distribution.
13c12488bbSMark Johnston  *
14c12488bbSMark Johnston  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15c12488bbSMark Johnston  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16c12488bbSMark Johnston  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17c12488bbSMark Johnston  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18c12488bbSMark Johnston  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19c12488bbSMark Johnston  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20c12488bbSMark Johnston  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21c12488bbSMark Johnston  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22c12488bbSMark Johnston  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23c12488bbSMark Johnston  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24c12488bbSMark Johnston  * SUCH DAMAGE.
25c12488bbSMark Johnston  *
26c12488bbSMark Johnston  * $FreeBSD$
27c12488bbSMark Johnston  */
28c12488bbSMark Johnston 
29*307f78f3SVladimir Kondratyev #ifndef _LINUXKPI_ASM_SMP_H_
30*307f78f3SVladimir Kondratyev #define	_LINUXKPI_ASM_SMP_H_
31c12488bbSMark Johnston 
32c12488bbSMark Johnston #if defined(__i386__) || defined(__amd64__)
33c12488bbSMark Johnston 
34c12488bbSMark Johnston #define	wbinvd_on_all_cpus()	linux_wbinvd_on_all_cpus()
35c12488bbSMark Johnston 
36c12488bbSMark Johnston int	linux_wbinvd_on_all_cpus(void);
37c12488bbSMark Johnston 
38c12488bbSMark Johnston #endif
39c12488bbSMark Johnston 
40d6c83356SMark Johnston #define	get_cpu() ({			\
41e4ba1a50SMark Johnston 	critical_enter();		\
42d6c83356SMark Johnston 	PCPU_GET(cpuid);		\
43d6c83356SMark Johnston })
44d6c83356SMark Johnston 
45d6c83356SMark Johnston #define	put_cpu()			\
46e4ba1a50SMark Johnston 	critical_exit()
47d6c83356SMark Johnston 
48*307f78f3SVladimir Kondratyev #endif /* _LINUXKPI_ASM_SMP_H_ */
49