Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120825
b: refs/heads/master
c: fd8cd7e
h: refs/heads/master
i:
  120823: acdb20c
v: v3
  • Loading branch information
Alok Kataria authored and H. Peter Anvin committed Nov 4, 2008
1 parent 482fc59 commit b475855
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6bdbfe99916398dbb28d83833cc04757110f2738
refs/heads/master: fd8cd7e1919fc1c27fe2fdccd2a1cd32f791ef0f
7 changes: 6 additions & 1 deletion trunk/arch/x86/kernel/cpu/vmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ static unsigned long __vmware_get_tsc_khz(void)
return tsc_hz;
}

/*
* While checking the dmi string infomation, just checking the product
* serial key should be enough, as this will always have a VMware
* specific string when running under VMware hypervisor.
*/
int vmware_platform(void)
{
if (cpu_has_hypervisor) {
Expand All @@ -74,7 +79,7 @@ int vmware_platform(void)
hyper_vendor_id[12] = '\0';
if (!strcmp(hyper_vendor_id, "VMwareVMware"))
return 1;
} else if (dmi_available && dmi_name_in_vendors("VMware") &&
} else if (dmi_available && dmi_name_in_serial("VMware") &&
__vmware_platform())
return 1;

Expand Down
11 changes: 11 additions & 0 deletions trunk/drivers/firmware/dmi_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,17 @@ const char *dmi_get_system_info(int field)
}
EXPORT_SYMBOL(dmi_get_system_info);

/**
* dmi_name_in_serial - Check if string is in the DMI product serial
* information.
*/
int dmi_name_in_serial(const char *str)
{
int f = DMI_PRODUCT_SERIAL;
if (dmi_ident[f] && strstr(dmi_ident[f], str))
return 1;
return 0;
}

/**
* dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information.
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/dmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
extern void dmi_scan_machine(void);
extern int dmi_get_year(int field);
extern int dmi_name_in_vendors(const char *str);
extern int dmi_name_in_serial(const char *str);
extern int dmi_available;
extern int dmi_walk(void (*decode)(const struct dmi_header *));

Expand All @@ -56,6 +57,7 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
static inline void dmi_scan_machine(void) { return; }
static inline int dmi_get_year(int year) { return 0; }
static inline int dmi_name_in_vendors(const char *s) { return 0; }
static inline int dmi_name_in_serial(const char *s) { return 0; }
#define dmi_available 0
static inline int dmi_walk(void (*decode)(const struct dmi_header *))
{ return -1; }
Expand Down

0 comments on commit b475855

Please sign in to comment.