~n-muench/ubuntu/precise/open-vm-tools/open-vm-tools.raring-precise.backport

« back to all changes in this revision

Viewing changes to lib/include/cpuid_info.h

  • Committer: Package Import Robot
  • Author(s): Nate Muench
  • Date: 2012-01-23 16:09:45 UTC
  • mfrom: (1.4.6) (2.4.26 sid)
  • Revision ID: package-import@ubuntu.com-20120123160945-b6s0r1vkcovucpf3
Tags: 2011.12.20-562307-0ubuntu1
* Merge latest upstream git tag. Fixes building on Precise
  (LP: #898289, LP: #905612)

* Items merged from Debian unstable:
  - debian/control:
    + open-vm-tools recommends open-vm-dkms. (LP: #598933)
    + open-vm-tools now suggests open-vm-toolbox. (LP: #604998)
  (From 2011.08.21-471295-1 release)
  - Updating maintainer and uploaders fields.
  - Removing vcs fields.
  - Removing references to Daniel's old email address.
  - Updating years in copyright file.
  - Updating to standards version 3.9.2.
  - Updating to debhelper version 8.
  - Switching to source format 3.0 (quilt).
  - Removing manual chrpath setting.
  - Removing exclusion from plugins from debhelper shlibs.
  - Rediffing kvers.patch.
  (From 2011.09.23-491607-1 release)
  - Marking binary architecture-dependend packages as linux and kfreebsd
  only.
  - Removing liburiparser-dev from build-depends as upstream dropped
  unity support.
  - Building with libproc-dev on amd64 again.
  - Dropping disabling of dnet support.
  (From 2011.09.23-491607-2 release)
  - Adding doxygen to build-depends for api documentation.
  - Adding libcunit1-dev to build-depends for test suites.
  - Minimizing rules file.
  - Adding open-vm-tools-dev package, containing only the api
    documentation for now.
  (From 2011.09.23-491607-3 release)
  - Sorting overrides in rules alphabetically.
  - Compacting copyright file.
  - Adding udev rule to set timeout for vmware scsi devices
  (From 2011.12.20-562307-1 release)
  - Adding patch to correct typo in upstreams dkms configuration

* Remaining Changes:
  - Remove Stable part of version numbering.
  - debian folder:
    + Re-added open-vm-dkms.postinst & open-vm-dkms.prerm.
      * Allows dkms modules to compile upon installation.
  - debian/control:
    + Re-add open-vm-source and make into a transitional package
      for open-vm-toolbox.
    + Return dependancies that were moved to open-vm-tools back to
      open-vm-toolbox.
  - debian/rules and debian/open-vm-toolbox.lintian-overrides:
    + Make vmware-user-suid-wrapper suid-root
  - debian/rules:
    + Added CFLAGS field with -Wno-deprecated-declarations
      * Will suppress issues with glib 2.31 or later.
    + Add line to copy vmware-xdg-detect-de into place.
    + Install vmware-user.desktop through toolbox package.
  - debian/open-vm-tools.init:
    + Re-add 'modprobe [-r] vmblock'.
    + Add 'modprobe [-r] vmxnet'.
      * Incase it's not loaded during boot.
    + Remove and re-add pcnet32 module
      * Will be done before (remove) and after (readd) vmxnet module
        is added.
      * If vmxnet doesn't exist (aka modules fail to build), pcnet32 can be
        still used for network connectivity.
      * Workaround until a better fix can be done.
  - Re-add gnome-session to debian/local/xautostart.conf
  - Manpages removed (from debian/manpages):
    + vmmemctl.9
    + vmxnet3.9
    + Remove references to manpages that have been removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*********************************************************
2
 
 * Copyright (C) 1998-2008 VMware, Inc. All rights reserved.
 
2
 * Copyright (C) 1998-2011 VMware, Inc. All rights reserved.
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify it
5
5
 * under the terms of the GNU Lesser General Public License as published
92
92
   return id0Out;
93
93
}
94
94
 
95
 
 
96
 
/*
97
 
 *----------------------------------------------------------------------
98
 
 *
99
 
 * CPUIDSummary_SafeToUseMC0_CTL --
100
 
 *
101
 
 *      Determines whether it is safe to write to the MCE control
102
 
 *      register MC0_CTL.
103
 
 *      Known safe:     P4, All AMD, all family 6 model > 0x1a, except core/atom
104
 
 *      Don't know:     P2, P3
105
 
 *
106
 
 * Results:
107
 
 *      True iff it is known to be safe.
108
 
 *
109
 
 * Side effects:
110
 
 *      None.
111
 
 *
112
 
 *----------------------------------------------------------------------
113
 
 */
114
 
static INLINE Bool
115
 
CPUIDSummary_SafeToUseMC0_CTL(CPUIDSummary* cpuidSummary)
116
 
{
117
 
   CPUIDRegs id0;
118
 
 
119
 
   CPUIDSummary_RegsFromCpuid0(&cpuidSummary->id0, &id0);   
120
 
   return CPUID_IsVendorAMD(&id0) ||
121
 
      (CPUID_IsVendorIntel(&id0) &&
122
 
       (CPUID_FAMILY_IS_PENTIUM4(cpuidSummary->id1.version) ||
123
 
        (CPUID_FAMILY_IS_P6(cpuidSummary->id1.version) &&
124
 
         (CPUID_EFFECTIVE_MODEL(cpuidSummary->id1.version) ==
125
 
            CPUID_MODEL_NEHALEM_1A ||
126
 
          CPUID_EFFECTIVE_MODEL(cpuidSummary->id1.version) >=
127
 
            CPUID_MODEL_NEHALEM_1E))));
128
 
}
129
 
 
130
 
 
131
 
/* The following functions return the number of cores per package
132
 
   and set *numThreadsPerCore to the number of hardware threads per core. */ 
133
 
static INLINE uint32
134
 
CPUIDSummary_VIACoresPerPackage(CPUIDSummary *cpuid,
135
 
                                uint32 *numThreadsPerCore)
136
 
{
137
 
   *numThreadsPerCore = 1;
138
 
   return 1;
139
 
}
140
 
 
141
 
static INLINE uint32 
142
 
CPUIDSummary_AMDCoresPerPackage(CPUIDSummary *cpuid,
143
 
                                uint32 *numThreadsPerCore)
144
 
{
145
 
   uint32 version = cpuid->id1.version, numEntries = cpuid->id80.numEntries;
146
 
   *numThreadsPerCore = 1;
147
 
   return CPUID_FAMILY_IS_K8STAR(version) && numEntries >= 0x80000008 ?
148
 
             CPUID_AMDCoresPerPackage(cpuid->id88.ecx) : 1;
149
 
}
150
 
 
151
 
static INLINE uint32
152
 
CPUIDSummary_IntelCoresPerPackage(CPUIDSummary *cpuid,
153
 
                                  uint32 *numThreadsPerCore)
154
 
{
155
 
   uint32 numCoresPerPackage;
156
 
   
157
 
   *numThreadsPerCore = numCoresPerPackage = 1;
158
 
   /*
159
 
    * Multi-core processors have the HT feature bit set even if they don't
160
 
    * support HT.  The reported number of HT is the total, not per core.
161
 
    */
162
 
   if (CPUID_ISSET(1, EDX, HTT, cpuid->id1.edxFeatures)) {
163
 
      *numThreadsPerCore = CPUID_GET(1, EBX, LCPU_COUNT, cpuid->id1.ebx);
164
 
       if (cpuid->id0.numEntries >= 4) {
165
 
         numCoresPerPackage =
166
 
            CPUID_IntelCoresPerPackage(__GET_EAX_FROM_CPUID4(0));
167
 
#ifdef ASSERT
168
 
         ASSERT(*numThreadsPerCore % numCoresPerPackage == 0);
169
 
#endif
170
 
         *numThreadsPerCore /= numCoresPerPackage;
171
 
      }
172
 
   }
173
 
   return numCoresPerPackage;
174
 
}
175
 
 
176
95
#endif