Date: Thu, 30 Apr 2026 11:40:24 +0000 From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 65dc0e9071a5 - main - linuxkpi: Define `VFM_*()` macros in <asm/cpu_device_id.h> Message-ID: <69f33fa8.22d35.1a24e7df@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=65dc0e9071a5ea206d6fbf070c974ebcfdea3680 commit 65dc0e9071a5ea206d6fbf070c974ebcfdea3680 Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2026-04-22 16:23:16 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2026-04-30 11:40:01 +0000 linuxkpi: Define `VFM_*()` macros in <asm/cpu_device_id.h> They use another set of constants and macros in <asm/intel-family.h>. All these macros are defined regardless of the architecture, even though they are specific to x86. Perhaps we should restrict them using #ifdefs. The amdgpu DRM driver started to used `VFM_MODEL()` and the `INTEL_*LAKE*` constants in Linux 6.12.x. Reviewed by: bz, olce Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56585 --- .../linuxkpi/common/include/asm/cpu_device_id.h | 33 ++++++++++++++++++++++ .../linuxkpi/common/include/asm/intel-family.h | 9 ++++++ 2 files changed, 42 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/asm/cpu_device_id.h b/sys/compat/linuxkpi/common/include/asm/cpu_device_id.h new file mode 100644 index 000000000000..a01d63a75a7e --- /dev/null +++ b/sys/compat/linuxkpi/common/include/asm/cpu_device_id.h @@ -0,0 +1,33 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2026 The FreeBSD Foundation + */ + +#ifndef _LINUXKPI_ASM_CPU_DEVICE_ID_H_ +#define _LINUXKPI_ASM_CPU_DEVICE_ID_H_ + +#define VFM_MODEL_BIT 0 +#define VFM_FAMILY_BIT 8 +#define VFM_VENDOR_BIT 16 +#define VFM_RSVD_BIT 24 + +#define VFM_MODEL_MASK GENMASK(VFM_FAMILY_BIT - 1, VFM_MODEL_BIT) +#define VFM_FAMILY_MASK GENMASK(VFM_VENDOR_BIT - 1, VFM_FAMILY_BIT) +#define VFM_VENDOR_MASK GENMASK(VFM_RSVD_BIT - 1, VFM_VENDOR_BIT) + +#define VFM_MODEL(vfm) (((vfm) & VFM_MODEL_MASK) >> VFM_MODEL_BIT) +#define VFM_FAMILY(vfm) (((vfm) & VFM_FAMILY_MASK) >> VFM_FAMILY_BIT) +#define VFM_VENDOR(vfm) (((vfm) & VFM_VENDOR_MASK) >> VFM_VENDOR_BIT) + +#define VFM_MAKE(_vendor, _family, _model) ( \ + ((_model) << VFM_MODEL_BIT) | \ + ((_family) << VFM_FAMILY_BIT) | \ + ((_vendor) << VFM_VENDOR_BIT) \ +) + +#include <linux/mod_devicetable.h> +#include <asm/intel-family.h> +#include <asm/processor.h> + +#endif /* _LINUXKPI_ASM_CPU_DEVICE_ID_H_ */ diff --git a/sys/compat/linuxkpi/common/include/asm/intel-family.h b/sys/compat/linuxkpi/common/include/asm/intel-family.h index 91ad1d1a8ff3..db815e0c012d 100644 --- a/sys/compat/linuxkpi/common/include/asm/intel-family.h +++ b/sys/compat/linuxkpi/common/include/asm/intel-family.h @@ -1,5 +1,14 @@ /* Public domain. */ +#define IFM(_fam, _model) VFM_MAKE(X86_VENDOR_INTEL, _fam, _model) + +#define INTEL_ALDERLAKE IFM(6, 0x97) +#define INTEL_ALDERLAKE_L IFM(6, 0x9A) + +#define INTEL_RAPTORLAKE IFM(6, 0xB7) +#define INTEL_RAPTORLAKE_P IFM(6, 0xBA) +#define INTEL_RAPTORLAKE_S IFM(6, 0xBF) + #define INTEL_FAM6_ALDERLAKE 0x97 #define INTEL_FAM6_ALDERLAKE_L 0x9Ahome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f33fa8.22d35.1a24e7df>
