Date: Fri, 18 Apr 2014 06:39:01 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264635 - head/sys/dev/hwpmc Message-ID: <201404180639.s3I6d1uM090301@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Fri Apr 18 06:39:00 2014 New Revision: 264635 URL: http://svnweb.freebsd.org/changeset/base/264635 Log: Enable and disable the PMC unit at load/unload time, respectively. MFC after: 3 weeks Modified: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c head/sys/dev/hwpmc/hwpmc_ppc970.c Modified: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Fri Apr 18 01:15:45 2014 (r264634) +++ head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Fri Apr 18 06:39:00 2014 (r264635) @@ -580,6 +580,7 @@ mpc7xxx_pcpu_init(struct pmc_mdep *md, i /* 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, i { 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; } Modified: head/sys/dev/hwpmc/hwpmc_ppc970.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_ppc970.c Fri Apr 18 01:15:45 2014 (r264634) +++ head/sys/dev/hwpmc/hwpmc_ppc970.c Fri Apr 18 06:39:00 2014 (r264635) @@ -575,6 +575,7 @@ ppc970_pcpu_init(struct pmc_mdep *md, in 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, in { 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404180639.s3I6d1uM090301>