Exemplo n.º 1
0
void
k8_powernow_setperf(int level)
{
	unsigned int i;
	struct k8pnow_cpu_state *cstate;

	cstate = k8pnow_current_state;

	i = ((level * cstate->n_states) + 1) / 101;
	if (i >= cstate->n_states)
		i = cstate->n_states - 1;

	k8pnow_transition(cstate, i);
}
Exemplo n.º 2
0
void
k8pnow_acpi_pss_changed(struct acpicpu_pss * pss, int npss)
{
	int curs, needtran;
	struct k8pnow_cpu_state *cstate, *nstate;
	uint32_t ctrl;
	uint64_t status;

	status = rdmsr(MSR_AMDK7_FIDVID_STATUS);
	cstate = k8pnow_current_state;

	nstate = malloc(sizeof(struct k8pnow_cpu_state), M_DEVBUF, M_NOWAIT);
	if (!nstate)
		return;

	curs = k8pnow_acpi_states(nstate, pss, npss, status);
	needtran = 0;

	if (curs < 0) {
		/* Our current opearting state is not among the ones found the new PSS */
		curs = ((perflevel * npss) + 1) / 101;
		if (curs >= npss)
			curs = npss - 1;
		needtran = 1;
	}

	ctrl = pss[curs].pss_ctrl;

	nstate->rvo = PN8_ACPI_CTRL_TO_RVO(ctrl);
	nstate->vst = PN8_ACPI_CTRL_TO_VST(ctrl);
	nstate->mvs = PN8_ACPI_CTRL_TO_MVS(ctrl);
	nstate->pll = PN8_ACPI_CTRL_TO_PLL(ctrl);
	nstate->irt = PN8_ACPI_CTRL_TO_IRT(ctrl);
	nstate->low = 0;
	nstate->n_states = npss;

	if (needtran)
		k8pnow_transition(nstate, curs);

	free(cstate, M_DEVBUF, sizeof(*cstate));
	k8pnow_current_state = nstate;
}