1b2c86006SEmmanuel Vadot /*- 2b2c86006SEmmanuel Vadot * SPDX-License-Identifier: BSD-2-Clause 3b2c86006SEmmanuel Vadot * 4b2c86006SEmmanuel Vadot * Copyright (c) 2021 Vladimir Kondratyev <wulf@FreeBSD.org> 5b2c86006SEmmanuel Vadot * 6b2c86006SEmmanuel Vadot * Redistribution and use in source and binary forms, with or without 7b2c86006SEmmanuel Vadot * modification, are permitted provided that the following conditions 8b2c86006SEmmanuel Vadot * are met: 9b2c86006SEmmanuel Vadot * 10b2c86006SEmmanuel Vadot * 1. Redistributions of source code must retain the above copyright 11b2c86006SEmmanuel Vadot * notice, this list of conditions and the following disclaimer. 12b2c86006SEmmanuel Vadot * 2. Redistributions in binary form must reproduce the above copyright 13b2c86006SEmmanuel Vadot * notice, this list of conditions and the following disclaimer in the 14b2c86006SEmmanuel Vadot * documentation and/or other materials provided with the distribution. 15b2c86006SEmmanuel Vadot * 16b2c86006SEmmanuel Vadot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17b2c86006SEmmanuel Vadot * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18b2c86006SEmmanuel Vadot * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19b2c86006SEmmanuel Vadot * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20b2c86006SEmmanuel Vadot * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21b2c86006SEmmanuel Vadot * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22b2c86006SEmmanuel Vadot * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23b2c86006SEmmanuel Vadot * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24b2c86006SEmmanuel Vadot * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25b2c86006SEmmanuel Vadot * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26b2c86006SEmmanuel Vadot */ 27b2c86006SEmmanuel Vadot 28b2c86006SEmmanuel Vadot #ifndef _LINUXKPI_ASM_PROCESSOR_H_ 29b2c86006SEmmanuel Vadot #define _LINUXKPI_ASM_PROCESSOR_H_ 30b2c86006SEmmanuel Vadot 31b2c86006SEmmanuel Vadot #include <sys/types.h> 32b2c86006SEmmanuel Vadot #include <machine/cpufunc.h> 33b2c86006SEmmanuel Vadot #include <machine/cpu.h> 34b2c86006SEmmanuel Vadot 35b2c86006SEmmanuel Vadot #if defined(__i386__) || defined(__amd64__) 36*b8c88a61SVladimir Kondratyev #define X86_VENDOR_INTEL 0 37*b8c88a61SVladimir Kondratyev #define X86_VENDOR_CYRIX 1 38*b8c88a61SVladimir Kondratyev #define X86_VENDOR_AMD 2 39*b8c88a61SVladimir Kondratyev #define X86_VENDOR_UMC 3 40*b8c88a61SVladimir Kondratyev #define X86_VENDOR_CENTAUR 5 41*b8c88a61SVladimir Kondratyev #define X86_VENDOR_TRANSMETA 7 42*b8c88a61SVladimir Kondratyev #define X86_VENDOR_NSC 8 43*b8c88a61SVladimir Kondratyev #define X86_VENDOR_HYGON 9 44*b8c88a61SVladimir Kondratyev #define X86_VENDOR_NUM 12 45*b8c88a61SVladimir Kondratyev 46*b8c88a61SVladimir Kondratyev #define X86_VENDOR_UNKNOWN 0xff 47*b8c88a61SVladimir Kondratyev 48b2c86006SEmmanuel Vadot struct cpuinfo_x86 { 49b2c86006SEmmanuel Vadot uint8_t x86; 50a27902c1SJean-Sébastien Pédron uint8_t x86_model; 51b2c86006SEmmanuel Vadot uint16_t x86_clflush_size; 5258cf3a69SJean-Sébastien Pédron uint16_t x86_max_cores; 53*b8c88a61SVladimir Kondratyev uint8_t x86_vendor; 54b2c86006SEmmanuel Vadot }; 55b2c86006SEmmanuel Vadot 56b2c86006SEmmanuel Vadot extern struct cpuinfo_x86 boot_cpu_data; 57488e8a7fSBjoern A. Zeeb extern struct cpuinfo_x86 *__cpu_data; 58a27902c1SJean-Sébastien Pédron #define cpu_data(cpu) __cpu_data[cpu] 59b2c86006SEmmanuel Vadot #endif 60b2c86006SEmmanuel Vadot 61ee247fc1SEmmanuel Vadot #define cpu_relax() cpu_spinwait() 62ee247fc1SEmmanuel Vadot 63b2c86006SEmmanuel Vadot #endif /* _LINUXKPI_ASM_PROCESSOR_H_ */ 64