diff --git a/libfwupdplugin/fu-common.c b/libfwupdplugin/fu-common.c index 064ce62b8..790cd6b7c 100644 --- a/libfwupdplugin/fu-common.c +++ b/libfwupdplugin/fu-common.c @@ -19,6 +19,8 @@ #include #endif +#include + #include #include #include @@ -2026,3 +2028,31 @@ fu_common_kernel_locked_down (void) return FALSE; #endif } + +/** + * fu_common_is_cpu_intel: + * + * Uses CPUID to discover the CPU vendor and check if it is Intel. + * + * Return value: %TRUE if the vendor was Intel. + * + * Since: 1.5.0 + **/ +gboolean +fu_common_is_cpu_intel (void) +{ + guint eax = 0; + guint ebx = 0; + guint ecx = 0; + guint edx = 0; + guint level = 0; + + /* get vendor */ + __get_cpuid(level, &eax, &ebx, &ecx, &edx); + if (ebx == signature_INTEL_ebx && + edx == signature_INTEL_edx && + ecx == signature_INTEL_ecx) { + return TRUE; + } + return FALSE; +} diff --git a/libfwupdplugin/fu-common.h b/libfwupdplugin/fu-common.h index ce5ef0c7f..13e0bbf7a 100644 --- a/libfwupdplugin/fu-common.h +++ b/libfwupdplugin/fu-common.h @@ -224,3 +224,4 @@ gchar **fu_common_strnsplit (const gchar *str, const gchar *delimiter, gint max_tokens); gboolean fu_common_kernel_locked_down (void); +gboolean fu_common_is_cpu_intel (void); diff --git a/libfwupdplugin/fwupdplugin.map b/libfwupdplugin/fwupdplugin.map index 5d1db3e44..f99275061 100644 --- a/libfwupdplugin/fwupdplugin.map +++ b/libfwupdplugin/fwupdplugin.map @@ -584,6 +584,7 @@ LIBFWUPDPLUGIN_1.4.1 { LIBFWUPDPLUGIN_1.5.0 { global: fu_common_filename_glob; + fu_common_is_cpu_intel; fu_udev_device_get_parent_name; fu_udev_device_get_sysfs_attr; local: *;