svn commit: r247074 - in projects/pmac_pmu/sys/powerpc: cpufreq powermac
Justin Hibbits
jhibbits at FreeBSD.org
Thu Feb 21 04:44:47 UTC 2013
Author: jhibbits
Date: Thu Feb 21 04:44:46 2013
New Revision: 247074
URL: http://svnweb.freebsd.org/changeset/base/247074
Log:
PMU speed changes now work. When coming out of reset the AP bringup code,
which I use, sets the PCPU thread to the idle thread. To work around this, I
set it after the fact to the current thread (contents of %r2).
Since CPU speed change works, I can also clean up the debug printf()s.
Modified:
projects/pmac_pmu/sys/powerpc/cpufreq/pmufreq.c
projects/pmac_pmu/sys/powerpc/powermac/pmu.c
Modified: projects/pmac_pmu/sys/powerpc/cpufreq/pmufreq.c
==============================================================================
--- projects/pmac_pmu/sys/powerpc/cpufreq/pmufreq.c Thu Feb 21 02:52:13 2013 (r247073)
+++ projects/pmac_pmu/sys/powerpc/cpufreq/pmufreq.c Thu Feb 21 04:44:46 2013 (r247074)
@@ -194,7 +194,6 @@ pmufreq_set(device_t dev, const struct c
if (error == 0)
sc->curfreq = set->freq;
- printf("exit from here\n");
return error;
}
Modified: projects/pmac_pmu/sys/powerpc/powermac/pmu.c
==============================================================================
--- projects/pmac_pmu/sys/powerpc/powermac/pmu.c Thu Feb 21 02:52:13 2013 (r247073)
+++ projects/pmac_pmu/sys/powerpc/powermac/pmu.c Thu Feb 21 04:44:46 2013 (r247074)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/clock.h>
+#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/sysctl.h>
@@ -1113,6 +1114,8 @@ void pmu_sleep_int(void)
while (1)
mtmsr(msr);
}
+ pcpup->pc_curthread = curthread;
+ pcpup->pc_curpcb = curthread->td_pcb;
pmap_activate(curthread);
powerpc_sync();
mtspr(SPR_SPRG0, sprgs[0]);
@@ -1132,7 +1135,8 @@ pmu_sleep(SYSCTL_HANDLER_ARGS)
int error;
struct pmu_softc *sc = arg1;
uint8_t clrcmd[] = {PMU_PWR_CLR_POWERUP_EVENTS, 0xff, 0xff};
- uint8_t setcmd[] = {PMU_PWR_SET_POWERUP_EVENTS, 0, PMU_PWR_WAKEUP_LID_OPEN|PMU_PWR_WAKEUP_KEY};
+ uint8_t setcmd[] = {PMU_PWR_SET_POWERUP_EVENTS, 0,
+ PMU_PWR_WAKEUP_LID_OPEN|PMU_PWR_WAKEUP_KEY};
uint8_t sleepcmd[] = {'M', 'A', 'T', 'T'};
uint8_t resp[16];
uint8_t reg;
@@ -1167,45 +1171,11 @@ pmu_sleep(SYSCTL_HANDLER_ARGS)
mtx_unlock(&Giant);
}
mtx_unlock(&sc->sc_mutex);
- printf("failure: %d\n", error);
DEVICE_RESUME(root_bus);
return (error);
}
-static void
-pmu_print_registers(void)
-{
- register_t reg;
- int i;
-
- printf("curthread: %p\n", curthread);
- printf("srr0: %"PRIxPTR"\n", mfspr(SPR_SRR0));
- printf("DBAT0U %"PRIxPTR"\n", mfspr(SPR_DBAT0U));
- printf("DBAT0L %"PRIxPTR"\n", mfspr(SPR_DBAT0L));
- printf("DBAT1U %"PRIxPTR"\n", mfspr(SPR_DBAT1U));
- printf("DBAT1L %"PRIxPTR"\n", mfspr(SPR_DBAT1L));
- printf("DBAT2U %"PRIxPTR"\n", mfspr(SPR_DBAT2U));
- printf("DBAT2L %"PRIxPTR"\n", mfspr(SPR_DBAT2L));
- printf("DBAT3U %"PRIxPTR"\n", mfspr(SPR_DBAT3U));
- printf("DBAT3L %"PRIxPTR"\n", mfspr(SPR_DBAT3L));
- printf("IBAT0U %"PRIxPTR"\n", mfspr(SPR_IBAT0U));
- printf("IBAT0L %"PRIxPTR"\n", mfspr(SPR_IBAT0L));
- printf("IBAT1U %"PRIxPTR"\n", mfspr(SPR_IBAT1U));
- printf("IBAT1L %"PRIxPTR"\n", mfspr(SPR_IBAT1L));
- printf("IBAT2U %"PRIxPTR"\n", mfspr(SPR_IBAT2U));
- printf("IBAT2L %"PRIxPTR"\n", mfspr(SPR_IBAT2L));
- printf("IBAT3U %"PRIxPTR"\n", mfspr(SPR_IBAT3U));
- printf("IBAT3L %"PRIxPTR"\n", mfspr(SPR_IBAT3L));
-
- for (i = 0; i < 16; i++) {
- reg = mfsrin(i << ADDR_SR_SHFT);
- printf("sr%d = %"PRIxPTR"\n", i, reg);
- }
- reg = mfspr(SPR_SDR1);
- printf("SDR1 = %"PRIxPTR"\n", reg);
-}
-
int
pmu_set_speed(int high_speed)
{
@@ -1226,16 +1196,13 @@ pmu_set_speed(int high_speed)
else
sleepcmd[4] = 1;
- mtx_lock(&sc->sc_mutex);
pmu_send(sc, PMU_CPU_SPEED, 5, sleepcmd, 16, resp);
- mtx_unlock(&sc->sc_mutex);
pmu_print_registers();
unin_chip_sleep(NULL, 1);
pmu_sleep_int();
unin_chip_resume(NULL);
pmu_print_registers();
-// mtdec(1);
spinlock_exit();
pmu_write_reg(sc, vIER, 0x90);
More information about the svn-src-projects
mailing list