Deleted Added
full compact
hwpmc_amd.c (185555) hwpmc_amd.c (229076)
1/*-
2 * Copyright (c) 2003-2008 Joseph Koshy
3 * Copyright (c) 2007 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by A. Joseph Koshy under
7 * sponsorship from the FreeBSD Foundation and Google, Inc.
8 *

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003-2008 Joseph Koshy
3 * Copyright (c) 2007 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * Portions of this software were developed by A. Joseph Koshy under
7 * sponsorship from the FreeBSD Foundation and Google, Inc.
8 *

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_amd.c 185555 2008-12-02 10:46:35Z jkoshy $");
32__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_amd.c 229076 2011-12-31 12:37:07Z dim $");
33
34/* Support for the AMD K7 and later processors */
35
36#include <sys/param.h>
37#include <sys/lock.h>
38#include <sys/malloc.h>
39#include <sys/mutex.h>
40#include <sys/pmc.h>

--- 843 unchanged lines hidden (view full) ---

884 /*
885 * The presence of hardware performance counters on the AMD
886 * Athlon, Duron or later processors, is _not_ indicated by
887 * any of the processor feature flags set by the 'CPUID'
888 * instruction, so we only check the 'instruction family'
889 * field returned by CPUID for instruction family >= 6.
890 */
891
33
34/* Support for the AMD K7 and later processors */
35
36#include <sys/param.h>
37#include <sys/lock.h>
38#include <sys/malloc.h>
39#include <sys/mutex.h>
40#include <sys/pmc.h>

--- 843 unchanged lines hidden (view full) ---

884 /*
885 * The presence of hardware performance counters on the AMD
886 * Athlon, Duron or later processors, is _not_ indicated by
887 * any of the processor feature flags set by the 'CPUID'
888 * instruction, so we only check the 'instruction family'
889 * field returned by CPUID for instruction family >= 6.
890 */
891
892 class = cputype = -1;
893 name = NULL;
894 switch (cpu_id & 0xF00) {
895#if defined(__i386__)
896 case 0x600: /* Athlon(tm) processor */
897 classindex = PMC_MDEP_CLASS_INDEX_K7;
898 cputype = PMC_CPU_AMD_K7;
899 class = PMC_CLASS_K7;
900 name = "K7";
901 break;
902#endif
903 case 0xF00: /* Athlon64/Opteron processor */
904 classindex = PMC_MDEP_CLASS_INDEX_K8;
905 cputype = PMC_CPU_AMD_K8;
906 class = PMC_CLASS_K8;
907 name = "K8";
908 break;
892 name = NULL;
893 switch (cpu_id & 0xF00) {
894#if defined(__i386__)
895 case 0x600: /* Athlon(tm) processor */
896 classindex = PMC_MDEP_CLASS_INDEX_K7;
897 cputype = PMC_CPU_AMD_K7;
898 class = PMC_CLASS_K7;
899 name = "K7";
900 break;
901#endif
902 case 0xF00: /* Athlon64/Opteron processor */
903 classindex = PMC_MDEP_CLASS_INDEX_K8;
904 cputype = PMC_CPU_AMD_K8;
905 class = PMC_CLASS_K8;
906 name = "K8";
907 break;
909 }
910
908
911 if ((int) cputype == -1) {
909 default:
912 (void) printf("pmc: Unknown AMD CPU.\n");
913 return NULL;
914 }
915
916#ifdef DEBUG
917 amd_pmc_class = class;
918#endif
919

--- 118 unchanged lines hidden ---
910 (void) printf("pmc: Unknown AMD CPU.\n");
911 return NULL;
912 }
913
914#ifdef DEBUG
915 amd_pmc_class = class;
916#endif
917

--- 118 unchanged lines hidden ---