Page MenuHomeFreeBSD

D57700.diff
No OneTemporary

D57700.diff

Index: sys/compat/linuxkpi/common/include/asm/cpu_device_id.h
===================================================================
--- sys/compat/linuxkpi/common/include/asm/cpu_device_id.h
+++ sys/compat/linuxkpi/common/include/asm/cpu_device_id.h
@@ -7,6 +7,8 @@
#ifndef _LINUXKPI_ASM_CPU_DEVICE_ID_H_
#define _LINUXKPI_ASM_CPU_DEVICE_ID_H_
+#include <linux/bits.h>
+
#define VFM_MODEL_BIT 0
#define VFM_FAMILY_BIT 8
#define VFM_VENDOR_BIT 16
@@ -30,4 +32,27 @@
#include <asm/intel-family.h>
#include <asm/processor.h>
+#define X86_CPU_ID_FLAG_ENTRY_VALID BIT(0)
+
+#define X86_MATCH_VENDORID_FAM_MODEL_STEPPINGS_FEATURE( \
+ _vendor, _family, _model, _steppings, _feature) { \
+ .vendor = _vendor, \
+ .family = _family, \
+ .model = _model, \
+ .steppings = _steppings, \
+ .feature = _feature, \
+ .flags = X86_CPU_ID_FLAG_ENTRY_VALID, \
+}
+
+#define X86_MATCH_VFM(_vfm, _data) \
+ X86_MATCH_VENDORID_FAM_MODEL_STEPPINGS_FEATURE( \
+ VFM_VENDOR(_vfm), \
+ VFM_FAMILY(_vfm), \
+ VFM_MODEL(_vfm), \
+ X86_STEPPING_ANY, \
+ X86_FEATURE_ANY)
+
+const struct x86_cpu_id *linuxkpi_x86_match_cpu(const struct x86_cpu_id *match_array);
+#define x86_match_cpu(match_array) linuxkpi_x86_match_cpu(match_array)
+
#endif /* _LINUXKPI_ASM_CPU_DEVICE_ID_H_ */
Index: sys/compat/linuxkpi/common/include/linux/bits.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/bits.h
+++ sys/compat/linuxkpi/common/include/linux/bits.h
@@ -8,6 +8,8 @@
#ifndef _LINUXKPI_LINUX_BITS_H_
#define _LINUXKPI_LINUX_BITS_H_
+#include <linux/bitops.h>
+
#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
Index: sys/compat/linuxkpi/common/include/linux/mod_devicetable.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/mod_devicetable.h
+++ sys/compat/linuxkpi/common/include/linux/mod_devicetable.h
@@ -81,6 +81,23 @@
#define ACPI_ID_LEN 16
+struct x86_cpu_id {
+ uint16_t vendor;
+ uint16_t family;
+ uint16_t model;
+ uint16_t steppings;
+ uint16_t feature;
+ uint16_t flags;
+};
+
+#define X86_VENDOR_ANY 0xffff
+#define X86_FAMILY_ANY 0
+#define X86_MODEL_ANY 0
+#define X86_STEPPING_ANY 0
+#define X86_STEP_MIN 0
+#define X86_STEP_MAX 0xf
+#define X86_FEATURE_ANY 0
+
/* -----------------------------------------------------------------------------
* USB
*/
Index: sys/compat/linuxkpi/common/src/linux_compat.c
===================================================================
--- sys/compat/linuxkpi/common/src/linux_compat.c
+++ sys/compat/linuxkpi/common/src/linux_compat.c
@@ -99,8 +99,11 @@
#include <linux/printk.h>
#include <linux/seq_file.h>
#include <linux/uuid.h>
+#include <linux/mod_devicetable.h>
#if defined(__i386__) || defined(__amd64__)
+#include <asm/cpu_device_id.h>
+#include <asm/cpufeature.h>
#include <asm/smp.h>
#include <asm/processor.h>
#endif
@@ -3013,6 +3016,41 @@
}
SYSUNINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_uninit, NULL);
+const struct x86_cpu_id *
+linuxkpi_x86_match_cpu(const struct x86_cpu_id *match_array)
+{
+ const struct x86_cpu_id *match;
+
+ for (match = match_array;
+ match->flags & X86_CPU_ID_FLAG_ENTRY_VALID;
+ match++)
+ {
+ if (match->vendor != X86_VENDOR_ANY &&
+ match->vendor != boot_cpu_data.x86_vendor)
+ continue;
+
+ if (match->family != X86_FAMILY_ANY &&
+ match->family != boot_cpu_data.x86)
+ continue;
+
+ if (match->model != X86_MODEL_ANY &&
+ match->model != boot_cpu_data.x86_model)
+ continue;
+
+ if (match->model != X86_MODEL_ANY &&
+ match->model != boot_cpu_data.x86_model)
+ continue;
+
+ if (match->feature != X86_FEATURE_ANY &&
+ !static_cpu_has(match->feature))
+ continue;
+
+ return (match);
+ }
+
+ return (NULL);
+}
+
/*
* NOTE: Linux frequently uses "unsigned long" for pointer to integer
* conversion and vice versa, where in FreeBSD "uintptr_t" would be

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 29, 11:22 AM (12 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37453913
Default Alt Text
D57700.diff (4 KB)

Event Timeline