mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 07:09:57 +00:00
trivial: Add a helper method to check for an Intel CPU
Some plugins will be Intel specific.
This commit is contained in:
parent
46f5415eda
commit
9223c89019
@ -19,6 +19,8 @@
|
||||
#include <shlwapi.h>
|
||||
#endif
|
||||
|
||||
#include <cpuid.h>
|
||||
|
||||
#include <archive_entry.h>
|
||||
#include <archive.h>
|
||||
#include <errno.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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: *;
|
||||
|
Loading…
Reference in New Issue
Block a user