diff options
| -rw-r--r-- | arch/x86/kernel/cpu/vmware.c | 7 | ||||
| -rw-r--r-- | drivers/firmware/dmi_scan.c | 11 | ||||
| -rw-r--r-- | include/linux/dmi.h | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c index a0905ecfe7d2..c034bda842d9 100644 --- a/arch/x86/kernel/cpu/vmware.c +++ b/arch/x86/kernel/cpu/vmware.c | |||
| @@ -61,6 +61,11 @@ static unsigned long __vmware_get_tsc_khz(void) | |||
| 61 | return tsc_hz; | 61 | return tsc_hz; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | /* | ||
| 65 | * While checking the dmi string infomation, just checking the product | ||
| 66 | * serial key should be enough, as this will always have a VMware | ||
| 67 | * specific string when running under VMware hypervisor. | ||
| 68 | */ | ||
| 64 | int vmware_platform(void) | 69 | int vmware_platform(void) |
| 65 | { | 70 | { |
| 66 | if (cpu_has_hypervisor) { | 71 | if (cpu_has_hypervisor) { |
| @@ -74,7 +79,7 @@ int vmware_platform(void) | |||
| 74 | hyper_vendor_id[12] = '\0'; | 79 | hyper_vendor_id[12] = '\0'; |
| 75 | if (!strcmp(hyper_vendor_id, "VMwareVMware")) | 80 | if (!strcmp(hyper_vendor_id, "VMwareVMware")) |
| 76 | return 1; | 81 | return 1; |
| 77 | } else if (dmi_available && dmi_name_in_vendors("VMware") && | 82 | } else if (dmi_available && dmi_name_in_serial("VMware") && |
| 78 | __vmware_platform()) | 83 | __vmware_platform()) |
| 79 | return 1; | 84 | return 1; |
| 80 | 85 | ||
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 3e526b6d00cb..d66d41282907 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
| @@ -467,6 +467,17 @@ const char *dmi_get_system_info(int field) | |||
| 467 | } | 467 | } |
| 468 | EXPORT_SYMBOL(dmi_get_system_info); | 468 | EXPORT_SYMBOL(dmi_get_system_info); |
| 469 | 469 | ||
| 470 | /** | ||
| 471 | * dmi_name_in_serial - Check if string is in the DMI product serial | ||
| 472 | * information. | ||
| 473 | */ | ||
| 474 | int dmi_name_in_serial(const char *str) | ||
| 475 | { | ||
| 476 | int f = DMI_PRODUCT_SERIAL; | ||
| 477 | if (dmi_ident[f] && strstr(dmi_ident[f], str)) | ||
| 478 | return 1; | ||
| 479 | return 0; | ||
| 480 | } | ||
| 470 | 481 | ||
| 471 | /** | 482 | /** |
| 472 | * dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. | 483 | * dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. |
diff --git a/include/linux/dmi.h b/include/linux/dmi.h index e5084eb5943a..2bfda178f274 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h | |||
| @@ -44,6 +44,7 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name, | |||
| 44 | extern void dmi_scan_machine(void); | 44 | extern void dmi_scan_machine(void); |
| 45 | extern int dmi_get_year(int field); | 45 | extern int dmi_get_year(int field); |
| 46 | extern int dmi_name_in_vendors(const char *str); | 46 | extern int dmi_name_in_vendors(const char *str); |
| 47 | extern int dmi_name_in_serial(const char *str); | ||
| 47 | extern int dmi_available; | 48 | extern int dmi_available; |
| 48 | extern int dmi_walk(void (*decode)(const struct dmi_header *)); | 49 | extern int dmi_walk(void (*decode)(const struct dmi_header *)); |
| 49 | 50 | ||
| @@ -56,6 +57,7 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na | |||
| 56 | static inline void dmi_scan_machine(void) { return; } | 57 | static inline void dmi_scan_machine(void) { return; } |
| 57 | static inline int dmi_get_year(int year) { return 0; } | 58 | static inline int dmi_get_year(int year) { return 0; } |
| 58 | static inline int dmi_name_in_vendors(const char *s) { return 0; } | 59 | static inline int dmi_name_in_vendors(const char *s) { return 0; } |
| 60 | static inline int dmi_name_in_serial(const char *s) { return 0; } | ||
| 59 | #define dmi_available 0 | 61 | #define dmi_available 0 |
| 60 | static inline int dmi_walk(void (*decode)(const struct dmi_header *)) | 62 | static inline int dmi_walk(void (*decode)(const struct dmi_header *)) |
| 61 | { return -1; } | 63 | { return -1; } |
