MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pn_decode_pst

Function pn_decode_pst

freebsd/x86/cpufreq/powernow.c:636–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634}
635
636static int
637pn_decode_pst(device_t dev)
638{
639 int maxpst;
640 struct pn_softc *sc;
641 u_int cpuid, maxfid, startvid;
642 u_long sig;
643 struct psb_header *psb;
644 uint8_t *p;
645 u_int regs[4];
646 uint64_t status;
647
648 sc = device_get_softc(dev);
649
650 do_cpuid(0x80000001, regs);
651 cpuid = regs[0];
652
653 if ((cpuid & 0xfff) == 0x760)
654 sc->errata |= A0_ERRATA;
655
656 status = rdmsr(MSR_AMDK7_FIDVID_STATUS);
657
658 switch (sc->pn_type) {
659 case PN7_TYPE:
660 maxfid = PN7_STA_MFID(status);
661 startvid = PN7_STA_SVID(status);
662 break;
663 case PN8_TYPE:
664 maxfid = PN8_STA_MFID(status);
665 /*
666 * we should actually use a variable named 'maxvid' if K8,
667 * but why introducing a new variable for that?
668 */
669 startvid = PN8_STA_MVID(status);
670 break;
671 default:
672 return (ENODEV);
673 }
674
675 if (bootverbose) {
676 device_printf(dev, "STATUS: 0x%jx\n", status);
677 device_printf(dev, "STATUS: maxfid: 0x%02x\n", maxfid);
678 device_printf(dev, "STATUS: %s: 0x%02x\n",
679 sc->pn_type == PN7_TYPE ? "startvid" : "maxvid",
680 startvid);
681 }
682
683 sig = bios_sigsearch(PSB_START, PSB_SIG, PSB_LEN, PSB_STEP, PSB_OFF);
684 if (sig) {
685 struct pst_header *pst;
686
687 psb = (struct psb_header*)(uintptr_t)BIOS_PADDRTOVADDR(sig);
688
689 switch (psb->version) {
690 default:
691 return (ENODEV);
692 case 0x14:
693 /*

Callers 1

pn_attachFunction · 0.85

Calls 8

device_get_softcFunction · 0.85
device_printfFunction · 0.85
absFunction · 0.85
decode_pstFunction · 0.85
cpuid_is_k7Function · 0.85
do_cpuidFunction · 0.50
rdmsrFunction · 0.50
bios_sigsearchFunction · 0.50

Tested by

no test coverage detected