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; }
void k8pnow_acpi_pss_changed(struct acpicpu_pss * pss, int npss) { int curs; struct k8pnow_cpu_state * cstate; uint32_t ctrl; uint64_t status; status = rdmsr(MSR_AMDK7_FIDVID_STATUS); cstate = k8pnow_current_state; curs = k8pnow_acpi_states(cstate, pss, npss, status); ctrl = pss[curs].pss_ctrl; cstate->rvo = PN8_ACPI_CTRL_TO_RVO(ctrl); cstate->vst = PN8_ACPI_CTRL_TO_VST(ctrl); cstate->mvs = PN8_ACPI_CTRL_TO_MVS(ctrl); cstate->pll = PN8_ACPI_CTRL_TO_PLL(ctrl); cstate->irt = PN8_ACPI_CTRL_TO_IRT(ctrl); cstate->low = 0; cstate->n_states = npss; }
int k8pnow_acpi_init(struct k8pnow_cpu_state * cstate, uint64_t status) { int curs; uint32_t ctrl; struct acpicpu_pss *pss; cstate->n_states = acpicpu_fetch_pss(&pss); if (cstate->n_states == 0) return 0; acpicpu_set_notify(k8pnow_acpi_pss_changed); curs = k8pnow_acpi_states(cstate, pss, cstate->n_states, status); ctrl = pss[curs].pss_ctrl; cstate->rvo = PN8_ACPI_CTRL_TO_RVO(ctrl); cstate->vst = PN8_ACPI_CTRL_TO_VST(ctrl); cstate->mvs = PN8_ACPI_CTRL_TO_MVS(ctrl); cstate->pll = PN8_ACPI_CTRL_TO_PLL(ctrl); cstate->irt = PN8_ACPI_CTRL_TO_IRT(ctrl); cstate->low = 0; return 1; }