| 7805 | } |
| 7806 | |
| 7807 | EFI_STATUS |
| 7808 | SaveSettings () |
| 7809 | { |
| 7810 | // TODO: SetVariable().. |
| 7811 | // here we can apply user settings instead of default one |
| 7812 | gMobile = gSettings.Mobile; |
| 7813 | |
| 7814 | if ((gSettings.BusSpeed != 0) && (gSettings.BusSpeed > 10 * kilo) && (gSettings.BusSpeed < 500 * kilo)) { |
| 7815 | switch (gCPUStructure.Model) { |
| 7816 | case CPU_MODEL_PENTIUM_M: |
| 7817 | case CPU_MODEL_ATOM:// Atom |
| 7818 | case CPU_MODEL_DOTHAN:// Pentium M, Dothan, 90nm |
| 7819 | case CPU_MODEL_YONAH:// Core Duo/Solo, Pentium M DC |
| 7820 | case CPU_MODEL_MEROM:// Core Xeon, Core 2 Duo, 65nm, Mobile |
| 7821 | //case CPU_MODEL_CONROE:// Core Xeon, Core 2 Duo, 65nm, Desktop like Merom but not mobile |
| 7822 | case CPU_MODEL_CELERON: |
| 7823 | case CPU_MODEL_PENRYN:// Core 2 Duo/Extreme, Xeon, 45nm , Mobile |
| 7824 | case CPU_MODEL_NEHALEM:// Core i7 LGA1366, Xeon 5500, "Bloomfield", "Gainstown", 45nm |
| 7825 | case CPU_MODEL_FIELDS:// Core i7, i5 LGA1156, "Clarksfield", "Lynnfield", "Jasper", 45nm |
| 7826 | case CPU_MODEL_DALES:// Core i7, i5, Nehalem |
| 7827 | case CPU_MODEL_CLARKDALE:// Core i7, i5, i3 LGA1156, "Westmere", "Clarkdale", , 32nm |
| 7828 | case CPU_MODEL_WESTMERE:// Core i7 LGA1366, Six-core, "Westmere", "Gulftown", 32nm |
| 7829 | case CPU_MODEL_NEHALEM_EX:// Core i7, Nehalem-Ex Xeon, "Beckton" |
| 7830 | case CPU_MODEL_WESTMERE_EX:// Core i7, Nehalem-Ex Xeon, "Eagleton" |
| 7831 | gCPUStructure.ExternalClock = gSettings.BusSpeed; |
| 7832 | //DBG("Read ExternalClock: %d MHz\n", (INT32)(DivU64x32(gCPUStructure.ExternalClock, kilo))); |
| 7833 | break; |
| 7834 | default: |
| 7835 | //DBG("Read ExternalClock: %d MHz\n", (INT32)(DivU64x32(gSettings.BusSpeed, kilo))); |
| 7836 | |
| 7837 | // for sandy bridge or newer |
| 7838 | // to match ExternalClock 25 MHz like real mac, divide BusSpeed by 4 |
| 7839 | gCPUStructure.ExternalClock = (gSettings.BusSpeed + 3) / 4; |
| 7840 | //DBG("Corrected ExternalClock: %d MHz\n", (INT32)(DivU64x32(gCPUStructure.ExternalClock, kilo))); |
| 7841 | break; |
| 7842 | } |
| 7843 | |
| 7844 | gCPUStructure.FSBFrequency = MultU64x64 (gSettings.BusSpeed, kilo); //kHz -> Hz |
| 7845 | gCPUStructure.MaxSpeed = (UINT32)(DivU64x32 ((UINT64)gSettings.BusSpeed * gCPUStructure.MaxRatio, 10000)); //kHz->MHz |
| 7846 | } |
| 7847 | |
| 7848 | if ((gSettings.CpuFreqMHz > 100) && (gSettings.CpuFreqMHz < 20000)) { |
| 7849 | gCPUStructure.MaxSpeed = gSettings.CpuFreqMHz; |
| 7850 | } |
| 7851 | |
| 7852 | // to determine the use of Table 132 |
| 7853 | if (gSettings.QPI) { |
| 7854 | gSettings.SetTable132 = TRUE; |
| 7855 | //DBG("QPI: use Table 132\n"); |
| 7856 | } |
| 7857 | else { |
| 7858 | switch (gCPUStructure.Model) { |
| 7859 | case CPU_MODEL_NEHALEM:// Core i7 LGA1366, Xeon 5500, "Bloomfield", "Gainstown", 45nm |
| 7860 | case CPU_MODEL_WESTMERE:// Core i7 LGA1366, Six-core, "Westmere", "Gulftown", 32nm |
| 7861 | case CPU_MODEL_NEHALEM_EX:// Core i7, Nehalem-Ex Xeon, "Beckton" |
| 7862 | case CPU_MODEL_WESTMERE_EX:// Core i7, Nehalem-Ex Xeon, "Eagleton" |
| 7863 | gSettings.SetTable132 = TRUE; |
| 7864 | DBG("QPI: use Table 132\n"); |
no test coverage detected