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

Function pn_probe

freebsd/x86/cpufreq/powernow.c:883–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

881}
882
883static int
884pn_probe(device_t dev)
885{
886 struct pn_softc *sc;
887 uint64_t status;
888 uint64_t rate;
889 struct pcpu *pc;
890 u_int sfid, mfid, cfid;
891
892 sc = device_get_softc(dev);
893 sc->errata = 0;
894 status = rdmsr(MSR_AMDK7_FIDVID_STATUS);
895
896 pc = cpu_get_pcpu(dev);
897 if (pc == NULL)
898 return (ENODEV);
899
900 cpu_est_clockrate(pc->pc_cpuid, &rate);
901
902 switch (cpu_id & 0xf00) {
903 case 0x600:
904 sfid = PN7_STA_SFID(status);
905 mfid = PN7_STA_MFID(status);
906 cfid = PN7_STA_CFID(status);
907 sc->pn_type = PN7_TYPE;
908 sc->fsb = rate / 100000 / pn7_fid_to_mult[cfid];
909
910 /*
911 * If start FID is different to max FID, then it is a
912 * mobile processor. If not, it is a low powered desktop
913 * processor.
914 */
915 if (PN7_STA_SFID(status) != PN7_STA_MFID(status)) {
916 sc->vid_to_volts = pn7_mobile_vid_to_volts;
917 device_set_desc(dev, "PowerNow! K7");
918 } else {
919 sc->vid_to_volts = pn7_desktop_vid_to_volts;
920 device_set_desc(dev, "Cool`n'Quiet K7");
921 }
922 break;
923
924 case 0xf00:
925 sfid = PN8_STA_SFID(status);
926 mfid = PN8_STA_MFID(status);
927 cfid = PN8_STA_CFID(status);
928 sc->pn_type = PN8_TYPE;
929 sc->vid_to_volts = pn8_vid_to_volts;
930 sc->fsb = rate / 100000 / pn8_fid_to_mult[cfid];
931
932 if (PN8_STA_SFID(status) != PN8_STA_MFID(status))
933 device_set_desc(dev, "PowerNow! K8");
934 else
935 device_set_desc(dev, "Cool`n'Quiet K8");
936 break;
937 default:
938 return (ENODEV);
939 }
940

Callers

nothing calls this directly

Calls 5

device_get_softcFunction · 0.85
cpu_get_pcpuFunction · 0.85
device_set_descFunction · 0.85
rdmsrFunction · 0.50
cpu_est_clockrateFunction · 0.50

Tested by

no test coverage detected