hwpmc_amd.c (183266) | hwpmc_amd.c (184205) |
---|---|
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 * --- 16 unchanged lines hidden (view full) --- 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 32#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 * --- 16 unchanged lines hidden (view full) --- 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 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_amd.c 183266 2008-09-22 10:37:02Z jkoshy $"); | 33__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_amd.c 184205 2008-10-23 15:53:51Z des $"); |
34 35/* Support for the AMD K7 and later processors */ 36 37#include <sys/param.h> 38#include <sys/lock.h> 39#include <sys/malloc.h> 40#include <sys/mutex.h> 41#include <sys/pmc.h> --- 791 unchanged lines hidden (view full) --- 833 struct amd_cpu *pcs; 834 struct pmc_hw *phw; 835 836 KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), 837 ("[amd,%d] insane cpu number %d", __LINE__, cpu)); 838 839 PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu); 840 | 34 35/* Support for the AMD K7 and later processors */ 36 37#include <sys/param.h> 38#include <sys/lock.h> 39#include <sys/malloc.h> 40#include <sys/mutex.h> 41#include <sys/pmc.h> --- 791 unchanged lines hidden (view full) --- 833 struct amd_cpu *pcs; 834 struct pmc_hw *phw; 835 836 KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), 837 ("[amd,%d] insane cpu number %d", __LINE__, cpu)); 838 839 PMCDBG(MDP,INI,1,"amd-init cpu=%d", cpu); 840 |
841 MALLOC(pcs, struct amd_cpu *, sizeof(struct amd_cpu), M_PMC, | 841 pcs = malloc(sizeof(struct amd_cpu), M_PMC, |
842 M_WAITOK|M_ZERO); 843 844 phw = &pcs->pc_amdpmcs[0]; 845 846 /* 847 * Initialize the per-cpu mutex and set the content of the 848 * hardware descriptors to a known state. 849 */ --- 56 unchanged lines hidden (view full) --- 906 KASSERT(pcs->pc_hwpmcs[i]->phw_pmc == NULL, 907 ("[amd,%d] CPU%d/PMC%d in use", __LINE__, cpu, i)); 908 KASSERT(AMD_PMC_IS_STOPPED(AMD_PMC_EVSEL_0 + (i-1)), 909 ("[amd,%d] CPU%d/PMC%d not stopped", __LINE__, cpu, i)); 910 } 911#endif 912 913 pmc_pcpu[cpu] = NULL; | 842 M_WAITOK|M_ZERO); 843 844 phw = &pcs->pc_amdpmcs[0]; 845 846 /* 847 * Initialize the per-cpu mutex and set the content of the 848 * hardware descriptors to a known state. 849 */ --- 56 unchanged lines hidden (view full) --- 906 KASSERT(pcs->pc_hwpmcs[i]->phw_pmc == NULL, 907 ("[amd,%d] CPU%d/PMC%d in use", __LINE__, cpu, i)); 908 KASSERT(AMD_PMC_IS_STOPPED(AMD_PMC_EVSEL_0 + (i-1)), 909 ("[amd,%d] CPU%d/PMC%d not stopped", __LINE__, cpu, i)); 910 } 911#endif 912 913 pmc_pcpu[cpu] = NULL; |
914 FREE(pcs, M_PMC); | 914 free(pcs, M_PMC); |
915 return 0; 916} 917 918/* 919 * Initialize ourselves. 920 */ 921 922struct pmc_mdep * --- 32 unchanged lines hidden (view full) --- 955 (void) printf("pmc: Unknown AMD CPU.\n"); 956 return NULL; 957 } 958 959#ifdef DEBUG 960 amd_pmc_class = class; 961#endif 962 | 915 return 0; 916} 917 918/* 919 * Initialize ourselves. 920 */ 921 922struct pmc_mdep * --- 32 unchanged lines hidden (view full) --- 955 (void) printf("pmc: Unknown AMD CPU.\n"); 956 return NULL; 957 } 958 959#ifdef DEBUG 960 amd_pmc_class = class; 961#endif 962 |
963 MALLOC(pmc_mdep, struct pmc_mdep *, sizeof(struct pmc_mdep), | 963 pmc_mdep = malloc(sizeof(struct pmc_mdep), |
964 M_PMC, M_WAITOK|M_ZERO); 965 966 pmc_mdep->pmd_cputype = cputype; 967 pmc_mdep->pmd_npmc = AMD_NPMCS; 968 969 /* this processor has two classes of usable PMCs */ 970 pmc_mdep->pmd_nclass = 2; 971 --- 41 unchanged lines hidden --- | 964 M_PMC, M_WAITOK|M_ZERO); 965 966 pmc_mdep->pmd_cputype = cputype; 967 pmc_mdep->pmd_npmc = AMD_NPMCS; 968 969 /* this processor has two classes of usable PMCs */ 970 pmc_mdep->pmd_nclass = 2; 971 --- 41 unchanged lines hidden --- |