diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2014-04-18 06:39:00 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2014-04-18 06:39:00 +0000 |
commit | c76bc003ed95c83ae30bae208317339cb79ac5a2 (patch) | |
tree | 6a06823c290833f1d5b8441bcfa7b9208a5c2b80 /sys/dev/hwpmc | |
parent | 4d0de44f396761afb39e1ef261052a3cdc07e39c (diff) | |
download | FreeBSD-src-c76bc003ed95c83ae30bae208317339cb79ac5a2.zip FreeBSD-src-c76bc003ed95c83ae30bae208317339cb79ac5a2.tar.gz |
Enable and disable the PMC unit at load/unload time, respectively.
MFC after: 3 weeks
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_mpc7xxx.c | 4 | ||||
-rw-r--r-- | sys/dev/hwpmc/hwpmc_ppc970.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mpc7xxx.c b/sys/dev/hwpmc/hwpmc_mpc7xxx.c index 8394e12..7162257 100644 --- a/sys/dev/hwpmc/hwpmc_mpc7xxx.c +++ b/sys/dev/hwpmc/hwpmc_mpc7xxx.c @@ -580,6 +580,7 @@ mpc7xxx_pcpu_init(struct pmc_mdep *md, int cpu) /* Clear the MMCRs, and set FC, to disable all PMCs. */ mtspr(SPR_MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE); mtspr(SPR_MMCR1, 0); + mtmsr(mfmsr() | PSL_PMM); return 0; } @@ -589,10 +590,13 @@ mpc7xxx_pcpu_fini(struct pmc_mdep *md, int cpu) { uint32_t mmcr0 = mfspr(SPR_MMCR0); + mtmsr(mfmsr() & ~PSL_PMM); mmcr0 |= SPR_MMCR0_FC; mtspr(SPR_MMCR0, mmcr0); + free(powerpc_pcpu[cpu]->pc_ppcpmcs, M_PMC); free(powerpc_pcpu[cpu], M_PMC); + return 0; } diff --git a/sys/dev/hwpmc/hwpmc_ppc970.c b/sys/dev/hwpmc/hwpmc_ppc970.c index 0d73508..1ff2fd8 100644 --- a/sys/dev/hwpmc/hwpmc_ppc970.c +++ b/sys/dev/hwpmc/hwpmc_ppc970.c @@ -575,6 +575,7 @@ ppc970_pcpu_init(struct pmc_mdep *md, int cpu) mtspr(SPR_970MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE | SPR_970MMCR0_PMC1SEL(0x8) | SPR_970MMCR0_PMC2SEL(0x8)); mtspr(SPR_970MMCR1, 0x4218420); + mtmsr(mfmsr() | PSL_PMM); return 0; } @@ -584,11 +585,14 @@ ppc970_pcpu_fini(struct pmc_mdep *md, int cpu) { register_t mmcr0 = mfspr(SPR_MMCR0); + mtmsr(mfmsr() & ~PSL_PMM); mmcr0 |= SPR_MMCR0_FC; mmcr0 &= ~SPR_MMCR0_PMXE; mtspr(SPR_MMCR0, mmcr0); + free(powerpc_pcpu[cpu]->pc_ppcpmcs, M_PMC); free(powerpc_pcpu[cpu], M_PMC); + return 0; } |