Repository: Piker-Alpha/AppleIntelInfo Branch: master Commit: 029207ed2a02 Files: 12 Total size: 301.7 KB Directory structure: gitextract_6thlbe9e/ ├── .gitignore ├── AppleIntelInfo/ │ ├── AppleIntelInfo-Info.plist │ ├── AppleIntelInfo-Prefix.pch │ ├── AppleIntelInfo.cpp │ ├── AppleIntelInfo.h │ ├── essentials.h │ └── intel_family.h ├── AppleIntelInfo.xcodeproj/ │ └── project.pbxproj ├── AppleIntelRegisterDumper/ │ ├── AppleIntelRegisterDumper.h │ ├── intel_chipset.h │ └── intel_reg.h └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .DS_Store .git xcuserdata project.xcworkspace /AppleIntelInfo/AppleIntelInfo.xcodeproj/xcuserdata /AppleIntelInfo/AppleIntelInfo.xcodeproj/project.xcworkspace ================================================ FILE: AppleIntelInfo/AppleIntelInfo-Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName ${PRODUCT_NAME} CFBundlePackageType KEXT CFBundleShortVersionString 2.9 CFBundleSignature ???? CFBundleVersion 2.9 IOKitPersonalities AppleIntelInfo CFBundleIdentifier com.pikeralpha.driver.${PRODUCT_NAME:rfc1034identifier} IOClass ${PRODUCT_NAME:rfc1034identifier} IOMatchCategory ${PRODUCT_NAME:rfc1034identifier} IOProviderClass IOResources IOResourceMatch IOKit logCStates logIGPU logIPGStyle logIntelRegs logMSRs enableHWP NSHumanReadableCopyright Copyright © 2014-2017 Pike R. Alpha. All rights reserved. OSBundleLibraries com.apple.kpi.bsd 10.4 com.apple.kpi.iokit 10.4 com.apple.kpi.libkern 10.4 com.apple.kpi.mach 10.4 com.apple.kpi.unsupported 10.5 OSBundleRequired Root ================================================ FILE: AppleIntelInfo/AppleIntelInfo-Prefix.pch ================================================ // // Prefix header // // The contents of this file are implicitly included at the beginning of every source file. // ================================================ FILE: AppleIntelInfo/AppleIntelInfo.cpp ================================================ /* * Copyright (c) 2012-2017 Pike R. Alpha. All rights reserved. * * Original idea and initial development of MSRDumper.kext (c) 2011 by RevoGirl. * * Thanks to George for his help and continuation of Sam's work, but it is * time for us to push the envelope and add some really interesting stuff. * * This work is licensed under the Creative Commons Attribution-NonCommercial * 4.0 Unported License => http://creativecommons.org/licenses/by-nc/4.0 */ #include "AppleIntelInfo.h" #if WRITE_LOG_REPORT //============================================================================== int AppleIntelInfo::writeReport(void) { int error = 0; int length = (int)strlen(logBuffer); struct vnode * vp; if (mCtx) { if ((error = vnode_open(FILE_PATH, (O_TRUNC | O_CREAT | FWRITE | O_NOFOLLOW), S_IRUSR | S_IWUSR, VNODE_LOOKUP_NOFOLLOW, &vp, mCtx))) { IOLOG("AppleIntelInfo.kext: Error, vnode_open(%s) failed with error %d!\n", FILE_PATH, error); } else { if ((error = vnode_isreg(vp)) == VREG) { if ((error = vn_rdwr(UIO_WRITE, vp, logBuffer, length, reportFileOffset, UIO_SYSSPACE, IO_NOCACHE|IO_NODELOCKED|IO_UNIT, vfs_context_ucred(mCtx), (int *) 0, vfs_context_proc(mCtx)))) { IOLOG("AppleIntelInfo.kext: Error, vn_rdwr(%s) failed with error %d!\n", FILE_PATH, error); } else { reportFileOffset += length; } } else { IOLOG("AppleIntelInfo.kext: Error, vnode_isreg(%s) failed with error %d!\n", FILE_PATH, error); } if ((error = vnode_close(vp, FWASWRITTEN, mCtx))) { IOLOG("AppleIntelInfo.kext: Error, vnode_close() failed with error %d!\n", error); } } } else { IOLOG("AppleIntelInfo.kext: mCtx == NULL!\n"); error = 0xFFFF; } return error; } #endif #if REPORT_RAPL_MSRS //============================================================================== bool AppleIntelInfo::supportsRAPL(UInt16 aTargetRAPLFeature) { UInt16 supportedRAPLFeatures = 0; switch (gCpuModel) { case INTEL_FAM6_SANDYBRIDGE: // 0x2A case INTEL_FAM6_IVYBRIDGE: // 0x3A case INTEL_FAM6_HASWELL_CORE: // 0x3C case INTEL_FAM6_HASWELL_ULT: // 0x45 case INTEL_FAM6_HASWELL_GT3E: // 0x46 case INTEL_FAM6_BROADWELL_CORE: // 0x3D case INTEL_FAM6_BROADWELL_GT3E: // 0x47 supportedRAPLFeatures = (RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO); break; case INTEL_FAM6_SKYLAKE_MOBILE: // 0x4E case INTEL_FAM6_SKYLAKE_DESKTOP: // 0x5E case INTEL_FAM6_CANNONLAKE_CORE: // 0x66 case INTEL_FAM6_KABYLAKE_MOBILE: // 0x8E case INTEL_FAM6_KABYLAKE_DESKTOP: // 0x9E supportedRAPLFeatures = (RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO); break; case INTEL_FAM6_HASWELL_X: // 0x3F case INTEL_FAM6_SKYLAKE_X: // 0x55 case INTEL_FAM6_BROADWELL_X: // 0x56 case INTEL_FAM6_BROADWELL_XEON_D: // 0x56 case INTEL_FAM6_XEON_PHI_KNL: // 0x57 case INTEL_FAM6_XEON_PHI_KNM: // 0x85 supportedRAPLFeatures = (RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO); break; case INTEL_FAM6_SANDYBRIDGE_X: // 0x2D case INTEL_FAM6_IVYBRIDGE_X: // 0x3E supportedRAPLFeatures = (RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_PKG_PERF_STATUS | RAPL_DRAM_PERF_STATUS | RAPL_PKG_POWER_INFO); break; } if (supportedRAPLFeatures & aTargetRAPLFeature) { return true; } return false; } //============================================================================== void AppleIntelInfo::reportRAPL(UInt16 aTargetRAPL) { unsigned int Y = 0; unsigned int Z = 0; unsigned long long msr = rdmsr64(MSR_RAPL_POWER_UNIT); uint8_t power_unit = bitfield32(msr, 3, 0); uint8_t energy_status_unit = bitfield32(msr, 12, 8); uint8_t time_unit = bitfield32(msr, 19, 16); float joulesPerEnergyUnit = 1. / float(1ULL << energy_status_unit); switch(aTargetRAPL) { case RAPL_BASE: /* 0x606 MSR_RAPL_POWER_UNIT */ IOLOG("\nMSR_RAPL_POWER_UNIT..............(0x606) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Power Units.......................... : %u (1/%d Watt)\n", power_unit, (1 << power_unit)); IOLOG(" - Energy Status Units.................. : %u (%sJoules)\n", energy_status_unit, getUnitText(energy_status_unit)); IOLOG(" - Time Units .......................... : %u (%sSeconds)\n", time_unit, getUnitText(time_unit)); } break; case RAPL_PKG: /* 0x610 MSR_PKG_POWER_LIMIT / 0x611 MSR_PKG_ENERGY_STATUS */ msr = rdmsr64(MSR_PKG_POWER_LIMIT); IOLOG("\nMSR_PKG_POWER_LIMIT..............(0x610) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Package Power Limit #1............... : %llu Watt\n", (bitfield32(msr, 14, 0) >> power_unit)); IOLOG(" - Enable Power Limit #1................ : %s\n", bitfield32(msr, 15, 15) ? "1 (enabled)": "0 (disabled)"); IOLOG(" - Package Clamping Limitation #1....... : %s\n", bitfield32(msr, 16, 16) ? "1 (allow going below OS-requested P/T state during Time Window for Power Limit #1)": "0 (disabled)"); Y = bitfield32(msr, 21, 17); Z = bitfield32(msr, 23, 22); IOLOG(" - Time Window for Power Limit #1....... : %llu (%u milli-Seconds)\n", bitfield32(msr, 23, 17), (unsigned int)(((1 << Y) * (1.0 + Z) / 4.0) * time_unit)); IOLOG(" - Package Power Limit #2............... : %llu Watt\n", (bitfield32(msr, 46, 32) >> power_unit)); IOLOG(" - Enable Power Limit #2................ : %s\n", (msr & (1UL << 47)) ? "1 (enabled)": "0 (disabled)"); IOLOG(" - Package Clamping Limitation #2....... : %s\n", (msr & (1UL << 48)) ? "1 (allow going below OS-requested P/T state setting Time Window for Power Limit #2)": "0 (disabled)"); Y = bitfield32(msr, 53, 49); Z = bitfield32(msr, 55, 54); IOLOG(" - Time Window for Power Limit #2....... : %llu (%u milli-Seconds)\n", bitfield32(msr, 55, 49), (unsigned int)(((1 << Y) * (1.0 + Z) / 4.0) * time_unit)); IOLOG(" - Lock................................. : %s\n", bitfield32(msr, 63, 63) ? "1 (MSR locked until next reset)": "0 (MSR not locked)"); } msr = rdmsr64(MSR_PKG_ENERGY_STATUS); IOLOG("\nMSR_PKG_ENERGY_STATUS............(0x611) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Total Energy Consumed................ : %llu Joules (Watt = Joules / seconds)\n", (long long unsigned)(bitfield32(msr, 31, 0) * joulesPerEnergyUnit)); } break; case RAPL_PKG_PERF_STATUS: /* 0x613 MSR_PKG_PERF_STATUS */ break; case RAPL_PKG_POWER_INFO: /* 0x614 MSR_PKG_POWER_INFO */ msr = rdmsr64(MSR_PKG_POWER_INFO); IOLOG("\nMSR_PKG_POWER_INFO...............(0x614) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Thermal Spec Power................... : %llu Watt\n", (bitfield32(msr, 14, 0) >> power_unit)); IOLOG(" - Minimum Power........................ : %llu\n", (bitfield32(msr, 16, 30) >> power_unit)); IOLOG(" - Maximum Power........................ : %llu\n", (bitfield32(msr, 46, 32) >> power_unit)); IOLOG(" - Maximum Time Window.................. : %llu\n", (bitfield32(msr, 58, 48) >> time_unit)); } break; case RAPL_DRAM: /* 0x618 MSR_DRAM_POWER_LIMIT / 0x619 MSR_DRAM_ENERGY_STATUS */ break; case RAPL_DRAM_PERF_STATUS: /* 0x61b MSR_DRAM_PERF_STATUS */ break; case RAPL_DRAM_POWER_INFO: /* 0x61c MSR_DRAM_POWER_INFO */ break; case RAPL_CORES: /* 0x638 MSR_PP0_POWER_LIMIT / 0x639 MSR_PP0_ENERGY_STATUS */ msr = rdmsr64(MSR_PP0_POWER_LIMIT); IOLOG("\nMSR_PP0_POWER_LIMIT..............(0x638) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Power Limit.......................... : %llu Watt\n", (bitfield32(msr, 14, 0) >> power_unit)); IOLOG(" - Enable Power Limit................... : %s\n", (msr & (1UL << 15)) ? "1 (enabled)": "0 (disabled)"); IOLOG(" - Clamping Limitation.................. : %s\n", (msr & (1UL << 16)) ? "1 (allow going below OS-requested P/T state setting Time Window for Power Limit #2)": "0 (disabled)"); Y = bitfield32(msr, 21, 17); Z = bitfield32(msr, 23, 22); IOLOG(" - Time Window for Power Limit.......... : %llu (%u milli-Seconds)\n", bitfield32(msr, 23, 17), (unsigned int)(((1 << Y) * (1.0 + Z)) * time_unit)); IOLOG(" - Lock................................. : %s\n", bitfield32(msr, 31, 31) ? "1 (MSR locked until next reset)": "0 (MSR not locked)"); } msr = rdmsr64(MSR_PP0_ENERGY_STATUS); IOLOG("\nMSR_PP0_ENERGY_STATUS............(0x639) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Total Energy Consumed................ : %llu Joules (Watt = Joules / seconds)\n", (long long unsigned)(bitfield32(msr, 31, 0) * joulesPerEnergyUnit)); } break; case RAPL_CORE_POLICY: /* 0x63a MSR_PP0_POLICY */ if (gCpuModel == INTEL_FAM6_SANDYBRIDGE) // 0x2A - Intel 325462.pdf Vol.3C 35-120 { msr = rdmsr64(MSR_PP0_POLICY); IOLOG("\nMSR_PP0_POLICY...................(0x63a) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Priority Level....................... : %llu\n", bitfield32(msr, 4, 0)); } } break; case RAPL_GFX: /* 0x640 MSR_PP1_POWER_LIMIT / 0x641 MSR_PP1_ENERGY_STATUS /0x642 MSR_PP1_POLICY */ msr = rdmsr64(MSR_PP1_POWER_LIMIT); IOLOG("\nMSR_PP1_POWER_LIMIT..............(0x640) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Power Limit.......................... : %llu Watt\n", (bitfield32(msr, 14, 0) >> power_unit)); IOLOG(" - Enable Power Limit................... : %s\n", (msr & (1UL << 15)) ? "1 (enabled)": "0 (disabled)"); IOLOG(" - Clamping Limitation.................. : %s\n", (msr & (1UL << 16)) ? "1 (allow going below OS-requested P/T state setting Time Window for Power Limit #2)": "0 (disabled)"); Y = bitfield32(msr, 21, 17); Z = bitfield32(msr, 23, 22); IOLOG(" - Time Window for Power Limit.......... : %llu (%u milli-Seconds)\n", bitfield32(msr, 23, 17), (unsigned int)(((1 << Y) * (1.0 + Z)) * time_unit)); IOLOG(" - Lock................................. : %s\n", bitfield32(msr, 31, 31) ? "1 (MSR locked until next reset)": "0 (MSR not locked)"); } msr = rdmsr64(MSR_PP1_ENERGY_STATUS); IOLOG("\nMSR_PP1_ENERGY_STATUS............(0x641) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Total Energy Consumed................ : %llu Joules (Watt = Joules / seconds)\n", (long long unsigned)(bitfield32(msr, 31, 0) * joulesPerEnergyUnit)); } msr = rdmsr64(MSR_PP1_POLICY); IOLOG("\nMSR_PP1_POLICY...................(0x642) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Priority Level....................... : %llu\n", bitfield32(msr, 4, 0)); } break; } } #endif #if (REPORT_MSRS && REPORT_HWP) //============================================================================== void AppleIntelInfo::reportHWP(void) { uint32_t cpuid_reg[4]; unsigned long long msr; do_cpuid(0x00000006, cpuid_reg); if ((cpuid_reg[eax] & 0x80) == 0x80) { msr = rdmsr64(IA32_PM_ENABLE); if (msr & 1) { short mantissa = 0; short exponent = 0; switch (gCpuModel) { case INTEL_FAM6_SKYLAKE_MOBILE: case INTEL_FAM6_SKYLAKE_DESKTOP: case INTEL_FAM6_KABYLAKE_MOBILE: case INTEL_FAM6_KABYLAKE_DESKTOP: UInt64 pPerf = rdmsr64(IA32_PPERF); UInt64 aPerf = rdmsr64(IA32_APERF); float busy = ((pPerf * 100) / aPerf); UInt8 multiplier = (UInt8)(((gClockRatio + 0.5) * busy) / 100); IOLOG("MSR_PPERF........................(0x63E) : 0x%llX (%d)\n", msr, multiplier); break; } IOLOG("\nIA32_PM_ENABLE...................(0x770) : 0x%llX (HWP Supported and Enabled)\n", msr); msr = rdmsr64(IA32_HWP_CAPABILITIES); IOLOG("\nIA32_HWP_CAPABILITIES............(0x771) : 0x%llX\n", msr); IOLOG("-----------------------------------------\n"); IOLOG(" - Highest Performance.................. : %llu\n", bitfield32(msr, 7, 0)); IOLOG(" - Guaranteed Performance............... : %llu\n", bitfield32(msr, 15, 8)); IOLOG(" - Most Efficient Performance........... : %llu\n", bitfield32(msr, 23, 16)); IOLOG(" - Lowest Performance................... : %llu\n", bitfield32(msr, 31, 24)); if ((cpuid_reg[eax] & 0x800) == 0x800) { msr = rdmsr64(IA32_HWP_REQUEST_PKG); IOLOG("\nIA32_HWP_REQUEST_PKG.............(0x772) : 0x%llX\n", msr); IOLOG("-----------------------------------------\n"); IOLOG(" - Minimum Performance.................. : %llu\n", bitfield32(msr, 7, 0)); IOLOG(" - Maximum Performance.................. : %llu\n", bitfield32(msr, 15, 8)); IOLOG(" - Desired Performance.................. : %llu\n", bitfield32(msr, 23, 16)); IOLOG(" - Energy Efficient Performance......... : %llu\n", bitfield32(msr, 31, 24)); mantissa = bitfield32(msr, 38, 32); exponent = bitfield32(msr, 41, 39); IOLOG(" - Activity Window...................... : %d, %d\n", mantissa, exponent); } if ((cpuid_reg[eax] & 0x100) == 0x100) { msr = rdmsr64(IA32_HWP_INTERRUPT); IOLOG("\nIA32_HWP_INTERRUPT...............(0x773) : 0x%llX\n", msr); IOLOG("------------------------------------------\n"); IOLOG(" - Guaranteed Performance Change........ : %s\n", (msr & 1) ? "1 (Interrupt generated on change of)": "0 (Interrupt generation disabled)"); IOLOG(" - Excursion Minimum.................... : %s\n", (msr & 2) ? "1 (Interrupt generated when unable to meet)": "0 (Interrupt generation disabled)"); } msr = rdmsr64(IA32_HWP_REQUEST); IOLOG("\nIA32_HWP_REQUEST................(0x774) : 0x%llX\n", msr); IOLOG("-----------------------------------------\n"); IOLOG(" - Minimum Performance................. : %llu\n", bitfield32(msr, 7, 0)); IOLOG(" - Maximum Performance................. : %llu\n", bitfield32(msr, 15, 8)); IOLOG(" - Desired Performance................. : %llu\n", bitfield32(msr, 23, 16)); IOLOG(" - Energy Efficient Performance........ : %llu\n", bitfield32(msr, 31, 24)); if ((cpuid_reg[eax] & 0x200) == 0x200) { mantissa = bitfield32(msr, 38, 32); exponent = bitfield32(msr, 41, 39); IOLOG(" - Activity Window..................... : %d, %d\n", mantissa, exponent); } IOLOG(" - Package Control..................... : %s\n", (msr & 0x40000000000) ? "1 (control inputs to be derived from IA32_HWP_REQUEST_PKG)": "0"); msr = rdmsr64(IA32_HWP_STATUS); IOLOG("\nIA32_HWP_STATUS..................(0x777) : 0x%llX\n", msr); IOLOG("-----------------------------------------\n"); IOLOG(" - Guaranteed Performance Change....... : %s\n", (msr & 1) ? "1 (has occured)" : "0 (has not occured)"); IOLOG(" - Excursion To Minimum................ : %s\n", (msr & 4) ? "1 (has occured)" : "0 (has not occured)"); } else { IOLOG("\nIA32_PM_ENABLE...................(0x770) : 0x%llX (HWP Supported but not, yet, enabled)\n", msr); } } } #endif #if (REPORT_MSRS && REPORT_HDC) //============================================================================== void AppleIntelInfo::reportHDC(void) { uint8_t index = 0; unsigned long long msr; IOLOG("HDC Supported\n"); msr = rdmsr64(IA32_PKG_HDC_CTL); IOLOG("\nIA32_PKG_HDC_CTL.................(0xDB0) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG("HDC Pkg Enable...................(0x652) : %s\n", bitfield32(msr, 0, 0) ? "1 (HDC allowed)" : "0 (HDC not allowed)"); } msr = rdmsr64(IA32_PM_CTL1); IOLOG("\nIA32_PM_CTL1.....................(0xDB1) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG("HDC Allow Block..................(0xDB1) : %s\n", bitfield32(msr, 0, 0) ? "1 (HDC blocked)" : "0 (HDC not blocked/allowed)"); } msr = rdmsr64(IA32_THREAD_STALL); IOLOG("\nIA32_THREAD_STALL................(0xDB2) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG("Stall Cycle Counter...............(0xDB2) : %llu, %s\n", msr, msr ? "1 (forced-idle supported)" : "0 (forced-idle not supported)"); } msr = rdmsr64(MSR_PKG_HDC_CONFIG); index = bitfield32(msr, 2, 0); IOLOG("\nMSR_PKG_HDC_CONFIG...............(0x652) : 0x%llX\n", msr); if (msr) { const char * cxCountText[5] = { "no-counting", "count package C2 only", "count package C3 and deeper", "count package C6 and deeper", "count package C7 and deeper" }; IOLOG("------------------------------------------\n"); IOLOG("Pkg Cx Monitor ..................(0x652) : %d (%s)", index, cxCountText[index]); } msr = rdmsr64(MSR_CORE_HDC_RESIDENCY); IOLOG("\nMSR_CORE_HDC_RESIDENCY...........(0x653) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG("Core Cx Duty Cycle Count................ : %llu %s\n", msr, msr ? "(forced-idle cycle count)": "(not supported/no forced-idle serviced)"); } msr = rdmsr64(MSR_PKG_HDC_SHALLOW_RESIDENCY); IOLOG("\nMSR_PKG_HDC_SHALLOW_RESIDENCY....(0x655) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG("Pkg C2 Duty Cycle Count................. : %llu %s\n", msr, msr ? "(forced-idle cycle count)": "(not supported/no forced-idle serviced)"); } msr = rdmsr64(MSR_PKG_HDC_DEEP_RESIDENCY); IOLOG("\nMSR_PKG_HDC_DEEP_RESIDENCY.......(0x656) : 0x%llX\n", msr); if (msr) { const char * cxText[5] = { "x", "2", "3", "6", "7" }; IOLOG("------------------------------------------\n"); IOLOG("Pkg C%s Duty Cycle Count................ : %llu %s\n", cxText[index], msr, msr ? "(forced-idle cycle count)": "(not supported/no forced-idle serviced)"); } } #endif //============================================================================== uint32_t AppleIntelInfo::getBusFrequency(void) { size_t size = 4; uint32_t frequency = 0; switch (gCpuModel) { case INTEL_FAM6_NEHALEM: case INTEL_FAM6_NEHALEM_EP: case INTEL_FAM6_NEHALEM_EX: case INTEL_FAM6_WESTMERE: case INTEL_FAM6_WESTMERE_EP: case INTEL_FAM6_WESTMERE_EX: return (133 * 1000000); break; default: // Check sysctl hw.busfrequency to see if the setup is right or wrong. if (sysctlbyname("hw.busfrequency", &frequency, &size, NULL, 0) == 0) { // Is it 100000000? if ((frequency / 1000000) > 100) { // No. Log warning. IOLOG("\nWarning: Clover hw.busfrequency error detected : %x\n", frequency); } } return (100 * 1000000); break; } return 0; } //============================================================================== const char * AppleIntelInfo::getUnitText(uint8_t unit) { const char * milliText[10] = { "1 ", "500 milli-", "250 milli-", "125 milli-", "62.5 milli-", "31.2 milli-", "15.6 milli-", "7.8 milli-", "3.9 milli-", "2 milli-" }; const char * microText[7] = { "976.6 micro-", "488.3 micro-", "244.1 micro-", "122.1 micro-", "61 micro-", "30.5 micro-", "15.3 micro-" }; if (unit <= 9) { return milliText[unit]; } else { return microText[unit-10]; } return NULL; } #if REPORT_MSRS //============================================================================== bool AppleIntelInfo::hasCPUFeature(long targetCPUFeature) { uint32_t cpuid_reg[4]; do_cpuid(0x00000001, cpuid_reg); uint64_t cpuFeatures = cpuid_reg[ecx]; cpuFeatures = (cpuFeatures << 32) | cpuid_reg[eax]; if (cpuFeatures & targetCPUFeature) { return true; } return false; } #endif #if REPORT_MSRS //============================================================================== void AppleIntelInfo::reportMSRs(void) { uint8_t core_limit; uint32_t performanceState; uint32_t cpuid_reg[4]; uint64_t msr; char brandstring[48]; do_cpuid(0x80000002, cpuid_reg); // First 16 bytes. bcopy((char *)cpuid_reg, &brandstring[0], 16); do_cpuid(0x80000003, cpuid_reg); // Next 16 bytes. bcopy((char *)cpuid_reg, &brandstring[16], 16); do_cpuid(0x80000004, cpuid_reg); // Last 16 bytes. bcopy((char *)cpuid_reg, &brandstring[32], 16); IOLOG("\nProcessor Brandstring....................: %s\n", brandstring); do_cpuid(0x00000001, cpuid_reg); uint8_t model = (bitfield32(cpuid_reg[eax], 19, 16) << 4) + bitfield32(cpuid_reg[eax], 7, 4); IOLOG("\nProcessor Signature..................... : 0x%X\n", cpuid_reg[eax]); IOLOG("------------------------------------------\n"); IOLOG(" - Family............................... : %lu\n", bitfield32(cpuid_reg[eax], 11, 8)); IOLOG(" - Stepping............................. : %lu\n", bitfield32(cpuid_reg[eax], 3, 0)); IOLOG(" - Model................................ : 0x%X (%d)\n", model, model); do_cpuid(0x00000006, cpuid_reg); IOLOG("\nModel Specific Registers (MSRs)\n------------------------------------------\n"); msr = rdmsr64(MSR_IA32_PLATFORM_ID); IOLOG("\nMSR_IA32_PLATFORM_ID.............(0x17) : 0x%llX\n", msr); IOLOG("------------------------------------------\n"); IOLOG(" - Processor Flags...................... : %d\n", (uint8_t)bitfield32(msr, 52, 50)); msr = rdmsr64(MSR_CORE_THREAD_COUNT); IOLOG("\nMSR_CORE_THREAD_COUNT............(0x35) : 0x%llX\n", msr); IOLOG("------------------------------------------\n"); IOLOG(" - Core Count........................... : %d\n", gCoreCount); IOLOG(" - Thread Count......................... : %d\n", gThreadCount); msr = rdmsr64(MSR_PLATFORM_INFO); performanceState = bitfield32(msr, 15, 8); IOLOG("\nMSR_PLATFORM_INFO................(0xCE) : 0x%llX\n", msr); IOLOG("------------------------------------------\n"); IOLOG(" - Maximum Non-Turbo Ratio.............. : 0x%X (%u MHz)\n", performanceState, (performanceState * gBclk)); IOLOG(" - Ratio Limit for Turbo Mode........... : %s\n", (msr & (1 << 28)) ? "1 (programmable)" : "0 (not programmable)"); IOLOG(" - TDP Limit for Turbo Mode............. : %s\n", (msr & (1 << 29)) ? "1 (programmable)" : "0 (not programmable)"); IOLOG(" - Low Power Mode Support............... : %s\n", (msr & (1UL << 32)) ? "1 (LPM supported)": "0 (LMP not supported)"); if (bitfield32(msr, 34, 33) == 0) { IOLOG(" - Number of ConfigTDP Levels........... : 0 (only base TDP level available)\n"); } else { IOLOG(" - Number of ConfigTDP Levels........... : %llu (additional TDP level(s) available)\n", bitfield32(msr, 34, 33)); } IOLOG(" - Maximum Efficiency Ratio............. : %llu\n", bitfield32(msr, 47, 40)); if (bitfield32(msr, 55, 48) > 0) { IOLOG(" - Minimum Operating Ratio.............. : %llu\n", bitfield32(msr, 55, 48)); } UInt64 msr_pmg_cst_config_control = rdmsr64(MSR_PKG_CST_CONFIG_CONTROL); IOLOG("\nMSR_PMG_CST_CONFIG_CONTROL.......(0xE2) : 0x%llX\n", msr_pmg_cst_config_control); IOLOG("------------------------------------------\n"); IOLOG(" - I/O MWAIT Redirection Enable......... : %s\n", (msr_pmg_cst_config_control & (1 << 10)) ? "1 (enabled, IO read of MSR(0xE4) mapped to MWAIT)" : "0 (not enabled)"); IOLOG(" - CFG Lock............................. : %s\n", (msr_pmg_cst_config_control & (1 << 15)) ? "1 (MSR locked until next reset)" : "0 (MSR not locked)"); IOLOG(" - C3 State Auto Demotion............... : %s\n", (msr_pmg_cst_config_control & (1 << 25)) ? "1 (enabled)" : "0 (disabled/unsupported)"); IOLOG(" - C1 State Auto Demotion............... : %s\n", (msr_pmg_cst_config_control & (1 << 26)) ? "1 (enabled)" : "0 (disabled/unsupported)"); IOLOG(" - C3 State Undemotion.................. : %s\n", (msr_pmg_cst_config_control & (1 << 27)) ? "1 (enabled)" : "0 (disabled/unsupported)"); IOLOG(" - C1 State Undemotion.................. : %s\n", (msr_pmg_cst_config_control & (1 << 28)) ? "1 (enabled)" : "0 (disabled/unsupported)"); // Intel® CoreTM M Processors and 5th Generation Intel® CoreTM Processors // Intel® Xeon® Processor D and Intel Xeon Processors E5 v4 Family Based on the Broadwell Microarchitecture IOLOG(" - Package C-State Auto Demotion........ : %s\n", (msr_pmg_cst_config_control & (1 << 29)) ? "1 (enabled)" : "0 (disabled/unsupported)"); IOLOG(" - Package C-State Undemotion........... : %s\n", (msr_pmg_cst_config_control & (1 << 30)) ? "1 (enabled)" : "0 (disabled/unsupported)"); msr = rdmsr64(MSR_PMG_IO_CAPTURE_BASE); IOLOG("\nMSR_PMG_IO_CAPTURE_BASE..........(0xE4) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - LVL_2 Base Address................... : 0x%llx\n", bitfield32(msr, 15, 0)); } if (msr_pmg_cst_config_control & (1 << 10)) { switch(bitfield32(msr, 18, 16)) { case 0: IOLOG(" - C-state Range........................ : %llu (%s)\n", bitfield32(msr, 18, 16), "C3 is the max C-State to include"); break; case 1: IOLOG(" - C-state Range........................ : %llu (%s)\n", bitfield32(msr, 18, 16), "C6 is the max C-State to include"); break; case 2: IOLOG(" - C-state Range........................ : %llu (%s)\n", bitfield32(msr, 18, 16), "C7 is the max C-State to include"); break; } } else { IOLOG(" - C-state Range........................ : %llu (%s)\n", bitfield32(msr, 18, 16), "C-States not included, I/O MWAIT redirection not enabled"); } if (bitfield32(cpuid_reg[ecx], 0, 0) == 1) // Are APERF and MPERF supported? { IOLOG("\nIA32_MPERF.......................(0xE7) : 0x%llX\n", (unsigned long long)rdmsr64(IA32_MPERF)); UInt64 aPerf = rdmsr64(IA32_APERF); IOLOG("IA32_APERF.......................(0xE8) : 0x%llX\n", aPerf); } if (gCpuModel == INTEL_FAM6_BROADWELL_X) { IOLOG("MSR_0x150........................(0x150) : 0x%llX\n", (unsigned long long)rdmsr64(0x150)); } IOLOG("\nMSR_FLEX_RATIO...................(0x194) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_FLEX_RATIO)); if (msr) { IOLOG("------------------------------------------\n"); } msr = rdmsr64(MSR_IA32_PERF_STATUS); performanceState = bitfield32(msr, 15, 0); IOLOG("\nMSR_IA32_PERF_STATUS.............(0x198) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Current Performance State Value...... : 0x%X (%u MHz)\n", performanceState, ((performanceState >> 8) * gBclk)); } msr = rdmsr64(MSR_IA32_PERF_CONTROL); performanceState = bitfield32(msr, 15, 0); IOLOG("\nMSR_IA32_PERF_CONTROL............(0x199) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Target performance State Value....... : 0x%X (%u MHz)\n", performanceState, ((performanceState >> 8) * gBclk)); } if (cpuid_reg[eax] & (1 << 0)) { IOLOG(" - Intel Dynamic Acceleration........... : %s\n", (msr & (1UL << 32)) ? "1 (IDA disengaged)" : "0 (IDA engaged)"); } do_cpuid(0x00000001, cpuid_reg); if (bitfield32(cpuid_reg[edx], 22, 22) == 1) { IOLOG("\nIA32_CLOCK_MODULATION............(0x19A) : 0x%llX\n", (unsigned long long)rdmsr64(IA32_CLOCK_MODULATION)); msr = rdmsr64(IA32_THERM_INTERRUPT); IOLOG("\nIA32_THERM_INTERRUPT.............(0x19B) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - High-Temperature Interrupt Enable.... : %s\n", (msr & (1 << 0)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - Low-Temperature Interrupt Enable..... : %s\n", (msr & (1 << 1)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - PROCHOT# Interrupt Enable............ : %s\n", (msr & (1 << 2)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - FORCEPR# Interrupt Enable............ : %s\n", (msr & (1 << 3)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - Critical Temperature Interrupt Enable : %s\n", (msr & (1 << 4)) ? "1 (enabled)" : "0 (disabled)"); // bit 7:5 Reserved. IOLOG(" - Threshold #1 Value................... : %llu\n", bitfield32(msr, 14, 8)); IOLOG(" - Threshold #1 Interrupt Enable........ : %s\n", (msr & (1 << 15)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - Threshold #2 Value................... : %llu\n", bitfield32(msr, 22, 16)); IOLOG(" - Threshold #2 Interrupt Enable........ : %s\n", (msr & (1 << 23)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - Power Limit Notification Enable...... : %s\n", (msr & (1 << 24)) ? "1 (enabled)" : "0 (disabled)"); // bit 63:25 Reserved. } msr = rdmsr64(IA32_THERM_STATUS); IOLOG("\nIA32_THERM_STATUS................(0x19C) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Thermal Status....................... : %s\n", (msr & (1 << 0)) ? "1" : "0"); IOLOG(" - Thermal Log.......................... : %s\n", (msr & (1 << 1)) ? "1" : "0"); IOLOG(" - PROCHOT # or FORCEPR# event.......... : %s\n", (msr & (1 << 2)) ? "1" : "0"); IOLOG(" - PROCHOT # or FORCEPR# log............ : %s\n", (msr & (1 << 3)) ? "1" : "0"); IOLOG(" - Critical Temperature Status.......... : %s\n", (msr & (1 << 4)) ? "1" : "0"); IOLOG(" - Critical Temperature log............. : %s\n", (msr & (1 << 5)) ? "1" : "0"); IOLOG(" - Thermal Threshold #1 Status.......... : %s\n", (msr & (1 << 6)) ? "1" : "0"); IOLOG(" - Thermal Threshold #1 log............. : %s\n", (msr & (1 << 7)) ? "1" : "0"); IOLOG(" - Thermal Threshold #2 Status.......... : %s\n", (msr & (1 << 8)) ? "1" : "0"); IOLOG(" - Thermal Threshold #2 log............. : %s\n", (msr & (1 << 9)) ? "1" : "0"); IOLOG(" - Power Limitation Status.............. : %s\n", (msr & (1 << 10)) ? "1" : "0"); IOLOG(" - Power Limitation log................. : %s\n", (msr & (1 << 11)) ? "1" : "0"); IOLOG(" - Current Limit Status................. : %s\n", (msr & (1 << 12)) ? "1" : "0"); IOLOG(" - Current Limit log.................... : %s\n", (msr & (1 << 13)) ? "1" : "0"); IOLOG(" - Cross Domain Limit Status............ : %s\n", (msr & (1 << 14)) ? "1" : "0"); IOLOG(" - Cross Domain Limit log............... : %s\n", (msr & (1 << 15)) ? "1" : "0"); IOLOG(" - Digital Readout...................... : %llu\n", bitfield32(msr, 22, 16)); // bit 23-26 Reserved. IOLOG(" - Resolution in Degrees Celsius........ : %llu\n", bitfield32(msr, 30, 27)); IOLOG(" - Reading Valid........................ : %s\n", (msr & (1 << 31)) ? "1 (valid)" : "0 (invalid)"); // bit 63-32 Reserved. } } if (hasCPUFeature(CPUID_FEATURE_TM2)) { msr = rdmsr64(MSR_THERM2_CTL); IOLOG("\nMSR_THERM2_CTL...................(0x19D) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Thermal Monitor Selection (TM1/TM2).. : %s\n", (msr & (1 << 16)) ? "1 (TM1 thermally-initiated on-die modulation of the stop-clock duty cycle)" : "0 (TM2 thermally-initiated frequency transitions)"); } } msr = rdmsr64(IA32_MISC_ENABLES); IOLOG("\nIA32_MISC_ENABLES................(0x1A0) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Fast-Strings......................... : %s\n", (msr & (1 << 0)) ? "1 (enabled)" : "0 (disabled)"); // bit 2:1 Reserved. IOLOG(" - FOPCODE compatibility mode Enable.... : %llu\n", (msr & (1 << 2))); IOLOG(" - Automatic Thermal Control Circuit.... : %s\n", (msr & (1 << 3)) ? "1 (enabled)" : "0 (disabled)"); // bit 6:4 Reserved. IOLOG(" - Split-lock Disable................... : %llu\n", (msr & (1 << 4))); IOLOG(" - Performance Monitoring............... : %s\n", (msr & (1 << 7)) ? "1 (available)" : "not available"); // bit 8 Reserved. IOLOG(" - Bus Lock On Cache Line Splits Disable : %llu\n", (msr & (1 << 8))); IOLOG(" - Hardware prefetch Disable............ : %llu\n", (msr & (1 << 9))); IOLOG(" - Processor Event Based Sampling....... : %s\n", (msr & (1 << 12)) ? "1 (PEBS not supported)" : "0 (PEBS supported)"); IOLOG(" - GV1/2 legacy Enable.................. : %llu\n", (msr & (1 << 15))); IOLOG(" - Enhanced Intel SpeedStep Technology.. : %s\n", (msr & (1 << 16)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - MONITOR FSM.......................... : %s\n", (msr & (1 << 18)) ? "1 (MONITOR/MWAIT supported)" : "0 (MONITOR/MWAIT not supported)"); IOLOG(" - Adjacent sector prefetch Disable..... : %llu\n", (msr & (1 << 19))); IOLOG(" - CFG Lock............................. : %s\n", (msr & (1 << 20)) ? "1 (MSR locked until next reset)" : "0 (MSR not locked)"); IOLOG(" - xTPR Message Disable................. : %s\n", (msr & (1 << 23)) ? "1 (disabled)" : "0 (enabled)"); } msr = rdmsr64(MSR_TEMPERATURE_TARGET); uint8_t time_unit = bitfield32(msr, 6, 0); IOLOG("\nMSR_TEMPERATURE_TARGET...........(0x1A2) : 0x%llX\n", msr); if (msr) { char timeString[25]; memset(timeString, 0, 25); IOLOG("------------------------------------------\n"); if (time_unit) { snprintf(timeString, 25, "(%sSeconds)", getUnitText(time_unit)); } IOLOG(" - Turbo Attenuation Units.............. : %u %s\n", time_unit, timeString); IOLOG(" - Temperature Target................... : %llu\n", bitfield32(msr, 23, 16)); IOLOG(" - TCC Activation Offset................ : %llu\n", bitfield32(msr, 29, 24)); } msr = rdmsr64(MSR_MISC_PWR_MGMT); IOLOG("\nMSR_MISC_PWR_MGMT................(0x1AA) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - EIST Hardware Coordination........... : %s\n", (msr & (1 << 0)) ? "1 (hardware coordination disabled)" : "0 (hardware coordination enabled)"); IOLOG(" - Energy/Performance Bias support...... : %lu\n", bitfield32(cpuid_reg[ecx], 3, 3) ); IOLOG(" - Energy/Performance Bias.............. : %s\n", (msr & (1 << 1)) ? "1 (enabled/MSR visible to software)" : "0 (disabled/MSR not visible to software)"); IOLOG(" - Thermal Interrupt Coordination Enable : %s\n", (msr & (1 << 22)) ? "1 (thermal interrupt routed to all cores)" : "0 (thermal interrupt not rerouted)"); /* HWP related SpeedShift settings */ IOLOG(" - SpeedShift Technology Enable......... : %s\n", (msr & (1 << 6)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - SpeedShift Interrupt Coordination.... : %s\n", (msr & (1 << 7)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - SpeedShift Energy Efficient Perf..... : %s\n", (msr & (1 << 12)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - SpeedShift Technology Setup for HWP.. : %s\n", (msr & 0x10c0) ? "Yes (setup for HWP)" : "No (not setup for HWP)"); } msr = rdmsr64(MSR_TURBO_RATIO_LIMIT); IOLOG("\nMSR_TURBO_RATIO_LIMIT............(0x1AD) : 0x%llX\n", msr); IOLOG("------------------------------------------\n"); for (int i = 1; (i < 9) && (i <= gCoreCount); i++) { core_limit = bitfield32(msr, 7, 0); if (core_limit) { IOLOG(" - Maximum Ratio Limit for C%02d.......... : %X (%u MHz) %s\n", i, core_limit, (core_limit * gBclk), ((i > gCoreCount) && core_limit) ? "(garbage / unused)" : ""); msr = (msr >> 8); } } // // Intel® Xeon® Processor E5 v3 Family // if (gCoreCount > 8) { msr = rdmsr64(MSR_TURBO_RATIO_LIMIT1); IOLOG("\nMSR_TURBO_RATIO_LIMIT1...........(0x1AE) : 0x%llX\n", msr); IOLOG("------------------------------------------\n"); for (int i = 9; (i < 17) && (i <= gCoreCount); i++) { core_limit = bitfield32(msr, 7, 0); if (core_limit) { IOLOG(" - Maximum Ratio Limit for C%02d.......... : %X (%u MHz) %s\n", i, core_limit, (core_limit * gBclk), ((i > gCoreCount) && core_limit) ? "(garbage / unused)" : ""); msr = (msr >> 8); } } } // // Intel® Xeon® Processor E5 v3 Family // if (gCoreCount > 16) { msr = rdmsr64(MSR_TURBO_RATIO_LIMIT2); IOLOG("\nMSR_TURBO_RATIO_LIMIT2...........(0x1AF) : 0x%llX\n", msr); IOLOG("------------------------------------------\n"); for (int i = 17; (i < 33) && (i <= gCoreCount); i++) { core_limit = bitfield32(msr, 7, 0); if (core_limit) { IOLOG(" - Maximum Ratio Limit for C%02d.......... : %X (%u MHz) %s\n", i, core_limit, (core_limit * gBclk), ((i > gCoreCount) && core_limit) ? "(garbage / unused)" : ""); msr = (msr >> 8); } } } do_cpuid(0x00000006, cpuid_reg); if (bitfield32(cpuid_reg[ecx], 3, 3) == 1) { msr = rdmsr64(IA32_ENERGY_PERF_BIAS); IOLOG("\nIA32_ENERGY_PERF_BIAS............(0x1B0) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); switch(bitfield32(msr, 3, 0)) { case 0: case 1: IOLOG(" - Power Policy Preference...............: %llu (%s)\n", bitfield32(msr, 3, 0), "highest performance"); break; case 5: IOLOG(" - Power Policy Preference...............: %llu (%s)\n", bitfield32(msr, 3, 0), "balanced performance and energy saving"); break; case 15: IOLOG(" - Power Policy Preference...............: %llu (%s)\n", bitfield32(msr, 3, 0), "maximize energy saving"); break; } } } msr = rdmsr64(MSR_POWER_CTL); IOLOG("\nMSR_POWER_CTL....................(0x1FC) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - Bi-Directional Processor Hot..........: %s\n", (msr & (1 << 0)) ? "1 (enabled)" : "0 (disabled)"); IOLOG(" - C1E Enable............................: %s\n", (msr & (1 << 1)) ? "1 (enabled)": "0 (disabled)"); } if (supportsRAPL(RAPL_PKG)) { reportRAPL(RAPL_BASE); } if (supportsRAPL(RAPL_PKG)) { reportRAPL(RAPL_PKG); } if (gCpuModel == INTEL_FAM6_SANDYBRIDGE) // 0x2A - Intel 325462.pdf Vol.3C 35-120 { IOLOG("\nMSR_PP0_CURRENT_CONFIG...........(0x601) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PP0_CURRENT_CONFIG)); } if (supportsRAPL(RAPL_CORES)) { reportRAPL(RAPL_CORES); } if (supportsRAPL(RAPL_CORE_POLICY)) { reportRAPL(RAPL_CORES); } if (igpuEnabled && supportsRAPL(RAPL_GFX)) { reportRAPL(RAPL_GFX); } IOLOG("\n"); switch (gCpuModel) { case INTEL_FAM6_IVYBRIDGE: // 0x3A - Intel 325462.pdf (Table 35-23) 35-174 Vol.3C case INTEL_FAM6_IVYBRIDGE_X: // 0x3E case INTEL_FAM6_HASWELL_CORE: // 0x3C - Intel 325462.pdf (Table 35-27) 35-192 Vol.3C case INTEL_FAM6_HASWELL_X: // 0x3F case INTEL_FAM6_HASWELL_ULT: // 0x45 case INTEL_FAM6_HASWELL_GT3E: // 0x46 case INTEL_FAM6_BROADWELL_GT3E: // 0x47 case INTEL_FAM6_SKYLAKE_MOBILE: // 0x4E case INTEL_FAM6_SKYLAKE_X: // 0x55 case INTEL_FAM6_BROADWELL_XEON_D: case INTEL_FAM6_XEON_PHI_KNL: // 0x57 - Intel 325462.pdf (Table 35-40) Vol.3C 35-275 case INTEL_FAM6_SKYLAKE_DESKTOP: // 0x5E - Intel 325462.pdf (Table 35-27) 35-192 Vol.3C case INTEL_FAM6_CANNONLAKE_CORE: // 0x66 case INTEL_FAM6_KABYLAKE_MOBILE: // 0x8E case INTEL_FAM6_KABYLAKE_DESKTOP: // 0x9E IOLOG("MSR_CONFIG_TDP_NOMINAL...........(0x648) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_NOMINAL)); IOLOG("MSR_CONFIG_TDP_LEVEL1............(0x649) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_LEVEL1)); IOLOG("MSR_CONFIG_TDP_LEVEL2............(0x64a) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_LEVEL2)); IOLOG("MSR_CONFIG_TDP_CONTROL...........(0x64b) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_CONTROL)); IOLOG("MSR_TURBO_ACTIVATION_RATIO.......(0x64c) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_TURBO_ACTIVATION_RATIO)); break; } if (gCpuModel >= INTEL_FAM6_SANDYBRIDGE) { IOLOG("MSR_PKGC3_IRTL...................(0x60a) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKGC3_IRTL)); IOLOG("MSR_PKGC6_IRTL...................(0x60b) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKGC6_IRTL)); if (gCheckC7) { IOLOG("MSR_PKGC7_IRTL...................(0x60c) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKGC7_IRTL)); } } if (gCpuModel >= INTEL_FAM6_NEHALEM) { IOLOG("MSR_PKG_C2_RESIDENCY.............(0x60d) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C2_RESIDENCY)); IOLOG("MSR_PKG_C3_RESIDENCY.............(0x3f8) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C3_RESIDENCY)); IOLOG("MSR_PKG_C2_RESIDENCY.............(0x60d) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C2_RESIDENCY)); /* * Is package C3 auto-demotion/undemotion enabled i.e. is bit-25 or bit-27 set? */ if ((msr_pmg_cst_config_control & 0x2000000) || (msr_pmg_cst_config_control & 0x8000000)) { IOLOG("MSR_PKG_C3_RESIDENCY.............(0x3f8) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C3_RESIDENCY)); } } if (gCpuModel >= INTEL_FAM6_SANDYBRIDGE) { IOLOG("MSR_PKG_C6_RESIDENCY.............(0x3f9) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C6_RESIDENCY)); if (gCheckC7) { IOLOG("MSR_PKG_C7_RESIDENCY.............(0x3fa) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C7_RESIDENCY)); } } switch (gCpuModel) { case INTEL_FAM6_BROADWELL_CORE: // 0x3D case INTEL_FAM6_HASWELL_ULT: // 0x45 - Intel 325462.pdf Vol.3C 35-136 case INTEL_FAM6_SKYLAKE_MOBILE: // 0x4E case INTEL_FAM6_SKYLAKE_DESKTOP: // 0x5E case INTEL_FAM6_CANNONLAKE_CORE: // 0x66 case INTEL_FAM6_KABYLAKE_MOBILE: // 0x8E case INTEL_FAM6_KABYLAKE_DESKTOP: // 0x9E IOLOG("MSR_PKG_C8_RESIDENCY.............(0x630) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C8_RESIDENCY)); IOLOG("MSR_PKG_C9_RESIDENCY.............(0x631) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C9_RESIDENCY)); IOLOG("MSR_PKG_C10_RESIDENCY............(0x632) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C10_RESIDENCY)); IOLOG("MSR_PKG_C8_LATENCY...............(0x633) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C8_RESIDENCY)); IOLOG("MSR_PKG_C9_LATENCY...............(0x634) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C9_RESIDENCY)); IOLOG("MSR_PKG_C10_LATENCY..............(0x635) : 0x%llX\n", (unsigned long long)rdmsr64(MSR_PKG_C10_RESIDENCY)); break; } switch (gCpuModel) { case INTEL_FAM6_SKYLAKE_MOBILE: // 0x4E case INTEL_FAM6_SKYLAKE_DESKTOP: // 0x5E case INTEL_FAM6_CANNONLAKE_CORE: // 0x66 case INTEL_FAM6_KABYLAKE_MOBILE: // 0x8E case INTEL_FAM6_KABYLAKE_DESKTOP: // 0x9E msr = rdmsr64(MSR_PLATFORM_ENERGY_COUNTER); IOLOG("\nMSR_PLATFORM_ENERGY_COUNTER......(0x64D) : 0x%llX %s\n", bitfield32(msr, 31, 0), (bitfield32(msr, 31, 0) == 0) ? "(not supported by hardware/BIOS)" : ""); if (msr) { IOLOG("------------------------------------------\n"); } msr = rdmsr64(MSR_PPERF); IOLOG("\nMSR_PPERF........................(0x64E) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); // busy = ((aPerf * 100) / msr); IOLOG(" - Hardware workload scalability........ : %llu\n", bitfield32(msr, 63, 0)); } msr = rdmsr64(MSR_CORE_PERF_LIMIT_REASONS); IOLOG("\nMSR_CORE_PERF_LIMIT_REASONS......(0x64F) : 0x%llX\n", msr); if (msr) { IOLOG("------------------------------------------\n"); IOLOG(" - PROCHOT Status....................... : %s\n", bitfield32(msr, 1, 1) ? "1 (frequency reduced below OS request due to assertion of external PROCHOT)": "0"); IOLOG(" - Thermal Status....................... : %s\n", bitfield32(msr, 2, 2) ? "1 (frequency reduced below OS request due to a thermal event)": "0"); // bit 3 Reserved. IOLOG(" - Residency State Regulation Status.... : %s\n", bitfield32(msr, 4, 4) ? "1 (frequency reduced below OS request due to residency state regulation limit)": "0"); IOLOG(" - Running Average Thermal Limit Status. : %s\n", bitfield32(msr, 5, 5) ? "1 (frequency reduced below OS request due to Running Average Thermal Limit)": "0"); IOLOG(" - VR Therm Alert Status................ : %s\n", bitfield32(msr, 6, 6) ? "1 (frequency reduced below OS request due to a thermal alert from a processor Voltage Regulator)" : "0"); IOLOG(" - VR Therm Design Current Status....... : %s\n", bitfield32(msr, 7, 7) ? "1 (frequency reduced below OS request due to VR thermal design current limit)" : "0"); IOLOG(" - Other Status......................... : %s\n", bitfield32(msr, 8, 8) ? "1 (frequency reduced below OS request due to electrical or other constraints)" : "0"); // bit 9 Reserved. IOLOG(" - Package/Platform-Level #1 Power Limit : %s\n", bitfield32(msr, 10, 10) ? "1 (frequency reduced below OS request due to power limit)" : "0"); IOLOG(" - Package/Platform-Level #2 Power Limit : %s\n", bitfield32(msr, 11, 11) ? "1 (frequency reduced below OS request due to power limit)" : "0"); IOLOG(" - Max Turbo Limit Status............... : %s\n", bitfield32(msr, 12, 12) ? "1 (frequency reduced below OS request due to multi-core turbo limits)" : "0"); IOLOG(" - Turbo Transition Attenuation Status.. : %s\n", bitfield32(msr, 13, 13) ? "1 (frequency reduced below OS request due to turbo transition attenuation)": "0"); // bit 15-14 Reserved. IOLOG(" - PROCHOT Log.......................... : %s\n", bitfield32(msr, 16, 16) ? "1 (status bit has asserted)" : "0"); IOLOG(" - Thermal Log.......................... : %s\n", bitfield32(msr, 17, 17) ? "1 (status bit has asserted)" : "0"); // bit 19-18 Reserved. IOLOG(" - Residency State Regulation Log....... : %s\n", bitfield32(msr, 20, 20) ? "1 (status bit has asserted)" : "0"); IOLOG(" - Running Average Thermal Limit Log.... : %s\n", bitfield32(msr, 21, 21) ? "1 (status bit has asserted)" : "0"); IOLOG(" - VR Therm Alert Log................... : %s\n", bitfield32(msr, 22, 22) ? "1 (status bit has asserted)" : "0"); IOLOG(" - VR Thermal Design Current Log........ : %s\n", bitfield32(msr, 23, 23) ? "1 (status bit has asserted)" : "0"); IOLOG(" - Other Status Log..................... : %s\n", bitfield32(msr, 24, 24) ? "1 (status bit has asserted)" : "0"); // bit 25 Reserved. IOLOG(" - Package/Platform-Level #1 Power Limit : %s\n", bitfield32(msr, 26, 26) ? "1 (status bit has asserted)" : "0"); IOLOG(" - Package/Platform-Level #2 Power Limit : %s\n", bitfield32(msr, 27, 27) ? "1 (status bit has asserted)" : "0"); IOLOG(" - Max Turbo Limit Log.................. : %s\n", bitfield32(msr, 28, 28) ? "1 (status bit has asserted)" : "0"); IOLOG(" - Turbo Transition Attenuation Log..... : %s\n", bitfield32(msr, 29, 29) ? "1 (status bit has asserted)" : "0"); // bit 63-30 Reserved. } #if REPORT_HDC if ((cpuid_reg[eax] & 0x2000) == 0x2000) // bit-13 HDC base registers IA32_PKG_HDC_CTL, IA32_PM_CTL1, IA32_THREAD_STALL MSRs are supported if set. { reportHDC(); } #endif } do_cpuid(0x00000001, cpuid_reg); if (bitfield32(cpuid_reg[ecx], 24, 24) == 1) { IOLOG("\nIA32_TSC_DEADLINE................(0x6E0) : 0x%llX\n", (unsigned long long)rdmsr64(IA32_TSC_DEADLINE)); } #if REPORT_HWP reportHWP(); #endif } #endif #if REPORT_C_STATES //============================================================================== inline void getCStates(void *magic) { UInt32 logicalCoreNumber = cpu_number(); if (gCheckC3 && rdmsr64(MSR_CORE_C3_RESIDENCY) > 0) { gC3Cores |= (1 << logicalCoreNumber); } if (gCheckC6 && rdmsr64(MSR_CORE_C6_RESIDENCY) > 0) { gC6Cores |= (1 << logicalCoreNumber); } if (gCheckC7 && rdmsr64(MSR_CORE_C7_RESIDENCY) > 0) { gC7Cores |= (1 << logicalCoreNumber); } if (logicalCoreNumber < gThreadCount) { // wrmsr64(0x1FC, rdmsr64(0x1FC) & 0xFFFFFFFE); // wrmsr64(0x1FC, rdmsr64(0x1FC) | 0x1); } uint64_t msr = rdmsr64(0x10); gTSC = rdtsc64(); // IOLOG("AICPUI: TSC of logical core %d is: msr(0x10) = 0x%llx, rdtsc = 0x%llx\n", logicalCoreNumber, msr, gTSC); if (msr > (gTSC + 4096)) { IOLog("Error: TSC of logical core %d is out of sync (0x%llx)!\n", logicalCoreNumber, msr); } } #endif //============================================================================== IOReturn AppleIntelInfo::loopTimerEvent(void) { UInt8 currentMultiplier = (rdmsr64(MSR_IA32_PERF_STS) >> 8); gCoreMultipliers |= (1ULL << currentMultiplier); #if REPORT_IGPU_P_STATES UInt8 currentIgpuMultiplier = 0; if (igpuEnabled) { if (gCpuModel == INTEL_FAM6_SKYLAKE_MOBILE || gCpuModel == INTEL_FAM6_SKYLAKE_DESKTOP) { currentIgpuMultiplier = (UInt8)(((gMchbar[1] * 16.666) + 0.5) / 50); } else { currentIgpuMultiplier = (UInt8)gMchbar[1]; } gIGPUMultipliers |= (1ULL << currentIgpuMultiplier); } #endif timerEventSource->setTimeoutTicks(Interval); if (loopLock) { return kIOReturnTimeout; } loopLock = true; #if REPORT_IPG_STYLE UInt8 pState = 0; if (logIPGStyle) { UInt64 aPerf = 0; float busy = 0; aPerf = (rdmsr64(IA32_APERF)); wrmsr64(IA32_APERF, 0ULL); if (gHwpEnabled) { UInt64 pPerf = (rdmsr64(IA32_MPERF)); busy = ((aPerf * 100) / pPerf); } else { UInt64 mPerf = (rdmsr64(IA32_MPERF)); wrmsr64(IA32_MPERF, 0ULL); busy = ((aPerf * 100) / mPerf); } pState = (UInt8)(((gClockRatio + 0.5) * busy) / 100); /* if (pState != currentMultiplier) { */ gCoreMultipliers |= (1ULL << pState); if ((pState < currentMultiplier) && (pState < gMinRatio)) { pState = gMinRatio; } /* * Commented out after fabio67 (fabiosun) confirmed that * the wrmsr() below triggered a KP on his configuration * wrmsr64(199, (pState << 8)); */ // } } #endif #if REPORT_C_STATES if (logCStates) { UInt32 magic = 0; mp_rendezvous_no_intrs(getCStates, &magic); IOSleep(1); } #endif int currentBit = 0; UInt64 value = 0ULL; #if REPORT_IGPU_P_STATES if ((gCoreMultipliers != gTriggeredPStates) || (gIGPUMultipliers != gTriggeredIGPUPStates)) #else #if REPORT_IPG_STYLE if ((gCoreMultipliers != gTriggeredPStates) || (currentMultiplier != pState)) #else if (gCoreMultipliers != gTriggeredPStates) #endif #endif { gTriggeredPStates = gCoreMultipliers; IOLOG("CPU P-States [ "); for (currentBit = gMinRatio; currentBit <= gMaxRatio; currentBit++) { value = (1ULL << currentBit); if ((gTriggeredPStates & value) == value) { if (currentBit == currentMultiplier) { IOLOG("(%d) ", currentBit); } else { IOLOG("%d ", currentBit); } } } #if REPORT_IGPU_P_STATES if (igpuEnabled) { gTriggeredIGPUPStates = gIGPUMultipliers; IOLOG("] iGPU P-States [ "); for (currentBit = 1; currentBit <= 32; currentBit++) { value = (1ULL << currentBit); if ((gTriggeredIGPUPStates & value) == value) { if (currentBit == currentIgpuMultiplier) { IOLOG("(%d) ", currentBit); } else { IOLOG("%d ", currentBit); } } } } #endif IOLOG("]\n"); } #if REPORT_C_STATES if (gCheckC3 && (gTriggeredC3Cores != gC3Cores)) { gTriggeredC3Cores = gC3Cores; IOLOG("CPU C3-Cores [ "); for (currentBit = 0; currentBit < gThreadCount; currentBit++) { value = (1ULL << currentBit); if ((gTriggeredC3Cores & value) == value) { IOLOG("%d ", currentBit); } } IOLOG("]\n"); } if (gCheckC6 && (gTriggeredC6Cores != gC6Cores)) { gTriggeredC6Cores = gC6Cores; IOLOG("CPU C6-Cores [ "); for (currentBit = 0; currentBit < gThreadCount; currentBit++) { value = (1ULL << currentBit); if ((gTriggeredC6Cores & value) == value) { IOLOG("%d ", currentBit); } } IOLOG("]\n"); } if (gCheckC7 && (gTriggeredC7Cores != gC7Cores)) { gTriggeredC7Cores = gC7Cores; IOLOG("CPU C7-Cores [ "); for (currentBit = 0; currentBit < gThreadCount; currentBit++) { value = (1ULL << currentBit); if ((gTriggeredC7Cores & value) == value) { IOLOG("%d ", currentBit); } } IOLOG("]\n"); } #endif loopLock = false; return kIOReturnSuccess; } //============================================================================== IOService* AppleIntelInfo::probe(IOService *provider, SInt32 *score) { IOService *ret = super::probe(provider, score); if (ret != this) { return 0; } return ret; } //============================================================================== bool AppleIntelInfo::start(IOService *provider) { if (IOService::start(provider)) { simpleLock = IOSimpleLockAlloc(); if (simpleLock) { #if WRITE_LOG_REPORT mCtx = vfs_context_create(NULL); #endif uint32_t cpuid_reg[4]; IOLOG("AppleIntelInfo.kext v%s Copyright © 2012-2017 Pike R. Alpha. All rights reserved.\n", VERSION); do_cpuid(0x00000006, cpuid_reg); if ((cpuid_reg[eax] & 0x80) == 0x80) // Is HWP supported? { if (rdmsr64(IA32_PM_ENABLE) & 1) // Yes. Is HWP enabled? { gHwpEnabled = true; // Yes. } #if ENABLE_HWP else { /* * HWP is supported but not enabled (yet) and thus we * check the preference to see if we should enable it. */ OSBoolean * key_enableHWP = OSDynamicCast(OSBoolean, getProperty("enableHWP")); if (key_enableHWP) // Key found? { if ((bool)key_enableHWP->getValue()) // Yes. Check value. { wrmsr64(IA32_PM_ENABLE, 1); // Enable HWP. } } IOLOG("enableHWP................................: %d\n", (bool)key_enableHWP->getValue()); } #endif } #if REPORT_MSRS OSBoolean * key_logMSRs = OSDynamicCast(OSBoolean, getProperty("logMSRs")); if (key_logMSRs) { logMSRs = (bool)key_logMSRs->getValue(); } IOLOG("\nSettings:\n------------------------------------------\nlogMSRs..................................: %d\n", logMSRs); #endif #if REPORT_IGPU_P_STATES OSBoolean * key_logIGPU = OSDynamicCast(OSBoolean, getProperty("logIGPU")); if (key_logIGPU) { igpuEnabled = (bool)key_logIGPU->getValue(); } if (igpuEnabled) { if ((READ_PCI8_NB(DEVEN) & DEVEN_D2EN_MASK) == 0) // Is the IGPU enabled and visible? { igpuEnabled = false; } } IOLOG("logIGPU..................................: %d\n", igpuEnabled); #endif #if REPORT_INTEL_REGS OSBoolean * key_logIntelRegs = OSDynamicCast(OSBoolean, getProperty("logIntelRegs")); if (key_logIntelRegs) { logIntelRegs = (bool)key_logIntelRegs->getValue(); } IOLOG("logIntelRegs............................: %d\n", logIntelRegs); #endif #if REPORT_C_STATES OSBoolean * key_logCStates = OSDynamicCast(OSBoolean, getProperty("logCStates")); if (key_logCStates) { logCStates = (bool)key_logCStates->getValue(); } IOLOG("logCStates...............................: %d\n", logCStates); #endif #if REPORT_IPG_STYLE if ((cpuid_reg[ecx] & 1) == 1) // Are APERF and MPERF supported? { OSBoolean * key_logIPGStyle = OSDynamicCast(OSBoolean, getProperty("logIPGStyle")); if (key_logIPGStyle) { logIPGStyle = (bool)key_logIPGStyle->getValue(); } } else { logIPGStyle = false; } IOLOG("logIPGStyle..............................: %d\n", logIPGStyle); #endif UInt64 msr = rdmsr64(MSR_PLATFORM_INFO); gClockRatio = (UInt8)((msr >> 8) & 0xff); msr = rdmsr64(MSR_IA32_PERF_STS); gCoreMultipliers |= (1ULL << (msr >> 8)); do_cpuid(0x00000001, cpuid_reg); gCpuModel = bitfield32(cpuid_reg[eax], 7, 4) + (bitfield32(cpuid_reg[eax], 19, 16) << 4); gBclk = (getBusFrequency() / 1000000); #if REPORT_C_STATES switch (gCpuModel) // TODO: Verify me! { case INTEL_FAM6_SANDYBRIDGE: // 0x2A - Intel 325462.pdf Vol.3C 35-111 case INTEL_FAM6_SANDYBRIDGE_X: // 0x2D - Intel 325462.pdf Vol.3C 35-111 case INTEL_FAM6_IVYBRIDGE: // 0x3A - Intel 325462.pdf Vol.3C 35-125 (Refering to Table 35-12) case INTEL_FAM6_IVYBRIDGE_X: // 0x3E - Intel 325462.pdf Vol.3C 35-125 (Refering to Table 35-12) // No C7 support for Intel® Xeon® Processor E5-1600 v2/E5-2600 v2 (Product Families Datasheet Volume One of Two page 19) case INTEL_FAM6_HASWELL_CORE: // 0x3C - Intel 325462.pdf Vol.3C 35-136 case INTEL_FAM6_BROADWELL_CORE: // 0x3D case INTEL_FAM6_HASWELL_ULT: // 0x45 - Intel 325462.pdf Vol.3C 35-136 case INTEL_FAM6_HASWELL_GT3E: // 0x46 case INTEL_FAM6_BROADWELL_X: // 0x47 case INTEL_FAM6_SKYLAKE_MOBILE: // 0x4E case INTEL_FAM6_SKYLAKE_DESKTOP: // 0x5E case INTEL_FAM6_CANNONLAKE_CORE: // 0x66 case INTEL_FAM6_KABYLAKE_MOBILE: // 0x8E case INTEL_FAM6_KABYLAKE_DESKTOP: // 0x9E gCheckC7 = true; break; } #endif msr = rdmsr64(MSR_PLATFORM_INFO); gMinRatio = (UInt8)((msr >> 40) & 0xff); gClockRatio = (UInt8)((msr >> 8) & 0xff); msr = rdmsr64(MSR_CORE_THREAD_COUNT); gCoreCount = bitfield32(msr, 31, 16); gThreadCount = bitfield32(msr, 15, 0); #if REPORT_MSRS gTSC = rdtsc64(); IOLOG("InitialTSC...............................: 0x%llx (%llu MHz)\n", gTSC, ((gTSC / gClockRatio) / 1000000000)); // MWAIT information do_cpuid(0x00000005, cpuid_reg); uint32_t supportedMwaitCStates = bitfield32(cpuid_reg[edx], 31, 0); IOLOG("MWAIT C-States...........................: %d\n", supportedMwaitCStates); if (logMSRs) { reportMSRs(); } #endif #if REPORT_INTEL_REGS if (logIntelRegs) { outl(0xcf8, 0x80001000); uint32_t value = inl(0xcfc); if ((value & 0x0000ffff) == 0x8086) { devid = ((value >> 16) & 0x0000ffff); reportIntelRegs(); } } #endif IOLOG("\nCPU Ratio Info:\n------------------------------------------\nBase Clock Frequency (BLCK)............. : %d MHz\n", gBclk); IOLOG("Maximum Efficiency Ratio/Frequency.......: %2d (%4d MHz)\n", gMinRatio, (gMinRatio * gBclk)); IOLOG("Maximum non-Turbo Ratio/Frequency........: %2d (%4d MHz)\n", gClockRatio, (gClockRatio * gBclk)); if (!((rdmsr64(IA32_MISC_ENABLES) >> 32) & 0x40)) // Turbo Mode Enabled? { msr = rdmsr64(MSR_TURBO_RATIO_LIMIT); gMaxRatio = (UInt8)(msr & 0xff); IOLOG("Maximum Turbo Ratio/Frequency............: %2d (%4d MHz)\n", gMaxRatio, (gMaxRatio * gBclk)); } else { gMaxRatio = gClockRatio; IOLOG("Maximum Ratio/Frequency..................: %2d (%4d MHz)\n", gMaxRatio, (gMaxRatio * gBclk)); } #if REPORT_IGPU_P_STATES if (igpuEnabled) { IOPhysicalAddress address = (IOPhysicalAddress)(0xFED10000 + 0x5948); memDescriptor = IOMemoryDescriptor::withPhysicalAddress(address, 0x53, kIODirectionInOut); if (memDescriptor != NULL) { if ((result = memDescriptor->prepare()) == kIOReturnSuccess) { memoryMap = memDescriptor->map(); if (memoryMap != NULL) { gMchbar = (UInt8 *)memoryMap->getVirtualAddress(); // Preventing a stupid (UEFI) BIOS limit. if (gMchbar[0x4C] < gMchbar[0x50]) { gMchbar[0x4C] = gMchbar[0x50]; } // // Examples IGPU multiplier: 17 (multiplier) * 50 (frequency in MHz) = 850 MHz // 22 (multiplier) * 50 (frequency in MHz) = 1100 MHz // 6 P-States: 850, 900, 950, 1000, 1050 and 1100 MHz // // Current RP-State, when the graphics engine is in RC6, this reflects the last used ratio. IOLOG("\nIGPU Info:\n------------------------------------------\n"); IOLOG("IGPU Current Frequency...................: %4d MHz\n", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x01])); // RP_STATE_RATIO (CURRENT_FREQUENCY) // Maximum RPN base frequency capability for the Integrated GFX Engine (GT). IOLOG("IGPU Minimum Frequency...................: %4d MHz\n", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x52])); // RPN_CAP (MIN_FREQUENCY) See also: DSDT->RPNC // Maximum RP1 base frequency capability for the Integrated GFX Engine (GT). IOLOG("IGPU Maximum Non-Turbo Frequency.........: %4d MHz\n", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x51])); // RP1_CAP (MAX_NON_TURBO) See also: DSDT->RP1C // Maximum RP0 base frequency capability for the Integrated GFX Engine (GT). IOLOG("IGPU Maximum Turbo Frequency.............: %4d MHz\n", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x50])); // RP0_CAP (MAX_TURBO)) See also: DSDT->RP0C // Maximum base frequency limit for the Integrated GFX Engine (GT) allowed during run-time. if (gMchbar[0x4C] == 255) { IOLOG("IGPU Maximum limit.......................: No Limit\n\n"); // RPSTT_LIM } else { IOLOG("IGPU Maximum limit.......................: %4d MHz\n\n", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x4C])); // RPSTT_LIM } } else { IOLOG("Error: memoryMap == NULL\n"); } } else { IOLOG("Error: memDescriptor->prepare() failed!\n"); } } else { IOLOG("Error: memDescriptor == NULL\n"); } } #endif IOLOG("P-State ratio * %d = Frequency in MHz\n------------------------------------------\n", gBclk); timerEventSource = IOTimerEventSource::timerEventSource(this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &AppleIntelInfo::loopTimerEvent)); workLoop = getWorkLoop(); if (timerEventSource && workLoop && (kIOReturnSuccess == workLoop->addEventSource(timerEventSource))) { this->registerService(0); timerEventSource->setTimeoutMS(1000); return true; } } } return false; } //============================================================================== void AppleIntelInfo::stop(IOService *provider) { #if WRITE_LOG_REPORT if (mCtx) { vfs_context_rele(mCtx); } #endif if (simpleLock) { IOSimpleLockFree(simpleLock); } if (timerEventSource) { if (workLoop) { timerEventSource->cancelTimeout(); workLoop->removeEventSource(timerEventSource); } timerEventSource->release(); timerEventSource = NULL; } super::stop(provider); } //============================================================================== void AppleIntelInfo::free() { #if REPORT_IGPU_P_STATES if (igpuEnabled) { if (memoryMap) { memoryMap->release(); memoryMap = NULL; } if (memDescriptor) { memDescriptor->release(); memDescriptor = NULL; } } #endif super::free(); } ================================================ FILE: AppleIntelInfo/AppleIntelInfo.h ================================================ /* * Copyright (c) 2012-2017 Pike R. Alpha. All rights reserved. * * Original idea and initial development of MSRDumper.kext (c) 2011 by † RevoGirl. * * A big thank you to George for his help and continuation of Sam's work, but it * was time for me to push the envelope and add some really interesting stuff. * * This work is licensed under the Creative Commons Attribution-NonCommercial * 4.0 Unported License => http://creativecommons.org/licenses/by-nc/4.0 */ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-register" #include #pragma clang diagnostic pop #include #include #include #include #include #include #include #include #include #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-register" #include #pragma clang diagnostic pop #include #define super IOService #define VERSION "2.9" /* * Build settings (0 = disable feature / 1 = enable feature) */ #define REPORT_MSRS 1 #define REPORT_RAPL_MSRS 1 #define REPORT_HWP 1 #define REPORT_HDC 1 #define REPORT_IGPU_P_STATES 1 #define REPORT_C_STATES 1 #define REPORT_IPG_STYLE 1 #define REPORT_INTEL_REGS 0 #define ENABLE_HWP 1 #define WRITE_LOG_REPORT 1 #define MMIO_READ8(Address) (*(volatile UInt8 *)(Address)) #define MMIO_READ16(Address) (*(volatile UInt16 *)(Address)) #define MMIO_READ32(Address) (*(volatile UInt32 *)(gMMIOAddress + Address)) #define NB_BUS 0x00 #define NB_DEV 0x00 #define NB_FUN 0x00 #define DEVEN (0x54) #define DEVEN_D2EN_MASK (0x10) #define NB_PCICFG_SPACE_INDEX_REG 0xcf8 #define NB_PCICFG_SPACE_DATA_REG 0xcfc #define BIT31 0x80000000 #define PCIEX_BASE_ADDRESS 0xF8000000 #define NB_MCH_BASE_ADDRESS 0xFED10000 // (G)MCH Memory Mapped Register Range Base Address (D0:F0:Rx48). #define READ_PCI8(Bx, Dx, Fx, Rx) ReadPci8(Bx, Dx, Fx, Rx) #define READ_PCI8_NB(Rx) READ_PCI8(NB_BUS, NB_DEV, NB_FUN, Rx) #define IGPU_RATIO_TO_FREQUENCY(ratio) ((ratio * 100) / 2) #define NB_PCI_CFG_ADDRESS(bus, dev, func, reg) \ (UInt64) ((((UInt8)(bus) << 24) + ((UInt8)(dev) << 16) + \ ((UInt8)(func) << 8) + ((UInt8)(reg))) & 0xffffffff) #define NB_PCIE_CFG_ADDRESS(bus, dev, func, reg) \ ((UInt32)(PCIEX_BASE_ADDRESS + ((UInt8)(bus) << 20) + \ ((UInt8)(dev) << 15) + ((UInt8)(func) << 12) + (reg))) #if WRITE_LOG_REPORT #define FILE_PATH "/tmp/AppleIntelInfo.dat" #define TEMP_BUFFER_SIZE 256 #define WRITE_BUFFER_SIZE 1024 #define IOLOG(format, args...) \ memset(logBuffer, 0, TEMP_BUFFER_SIZE); \ snprintf(logBuffer, TEMP_BUFFER_SIZE, format, ##args); \ writeReport(); #else #define IOLOG(fmt, args...) IOLog(fmt, ##args) /* * macOS Sierra only! */ #include #define IOLOG(fmt, args...) os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_INFO, fmt, ##args) #endif #define RAPL_BASE 0 #define RAPL_PKG (1 << 0) /* 0x610 MSR_PKG_POWER_LIMIT */ /* 0x611 MSR_PKG_ENERGY_STATUS */ #define RAPL_PKG_PERF_STATUS (1 << 1) /* 0x613 MSR_PKG_PERF_STATUS */ #define RAPL_PKG_POWER_INFO (1 << 2) /* 0x614 MSR_PKG_POWER_INFO */ #define RAPL_DRAM (1 << 3) /* 0x618 MSR_DRAM_POWER_LIMIT */ /* 0x619 MSR_DRAM_ENERGY_STATUS */ #define RAPL_DRAM_PERF_STATUS (1 << 4) /* 0x61b MSR_DRAM_PERF_STATUS */ #define RAPL_DRAM_POWER_INFO (1 << 5) /* 0x61c MSR_DRAM_POWER_INFO */ #define RAPL_CORES_POWER_LIMIT (1 << 6) /* 0x638 MSR_PP0_POWER_LIMIT */ #define RAPL_CORE_POLICY (1 << 7) /* 0x63a MSR_PP0_POLICY */ #define RAPL_GFX (1 << 8) /* 0x640 MSR_PP1_POWER_LIMIT */ /* 0x641 MSR_PP1_ENERGY_STATUS */ /* 0x642 MSR_PP1_POLICY */ #define RAPL_CORES_ENERGY_STATUS (1 << 9) /* 0x639 MSR_PP0_ENERGY_STATUS */ #define RAPL_CORES (RAPL_CORES_ENERGY_STATUS | RAPL_CORES_POWER_LIMIT) //------------------------------------------------------------------------------ static __inline__ void outl(UInt16 port, UInt32 value) { __asm__ volatile("outl %0, %w1" : : "a" (value), "Nd" (port)); } //------------------------------------------------------------------------------ static __inline__ unsigned char inb(UInt16 port) { UInt8 value; __asm__ volatile("inb %w1, %b0" : "=a" (value) : "Nd" (port)); return (value); } //------------------------------------------------------------------------------ static __inline__ unsigned int inl(UInt16 port) { UInt32 value; __asm__ volatile("inl %w1, %0" : "=a" (value) : "Nd" (port)); return (value); } //------------------------------------------------------------------------------ UInt8 ReadPci8(UInt8 Bus, UInt8 Dev, UInt8 Fun, UInt16 Reg) { if (Reg >= 0x100) { return MMIO_READ8((UInt64)NB_PCIE_CFG_ADDRESS(Bus, Dev, Fun, Reg)); } else { outl(NB_PCICFG_SPACE_INDEX_REG, BIT31 | (Bus << 16) | (Dev << 11) | (Fun << 8) | (Reg & 0xfc)); return inb(NB_PCICFG_SPACE_DATA_REG | (UInt8)(Reg & 3)); } } extern "C" void mp_rendezvous_no_intrs(void (*action_func)(void *), void * arg); extern "C" int cpu_number(void); //------------------------------------------------------------------------------ class AppleIntelInfo : public IOService { OSDeclareDefaultStructors (AppleIntelInfo); private: IOSimpleLock *simpleLock; IOWorkLoop *workLoop; IOTimerEventSource *timerEventSource; #ifdef REPORT_IGPU_P_STATES IOMemoryDescriptor *memDescriptor; IOMemoryMap *memoryMap; bool igpuEnabled = false; // Set logIGPU to in Info.plist to enable this feature. #endif IOReturn result = kIOReturnSuccess; virtual IOReturn loopTimerEvent(void); int writeReport(void); #ifdef REPORT_RAPL_MSRS bool supportsRAPL(UInt16 aTargetRAPLFeature); void reportRAPL(UInt16 aTargetRAPL); #endif #ifdef REPORT_MSRS void reportMSRs(void); #ifdef REPORT_HWP void reportHWP(void); #endif #ifdef REPORT_HWP void reportHDC(void); #endif bool hasCPUFeature(long targetCPUFeature); bool logMSRs = true; // Set logIGPU to in Info.plist to disable this feature. #endif bool gHwpEnabled = false; bool loopLock = false; #ifdef REPORT_C_STATES bool logCStates = true; // Set logCStates to in Info.plist to disable this feature. #endif #ifdef REPORT_IPG_STYLE bool logIPGStyle = true; // Set logIPGStyle to in Info.plist to disable this feature. #endif #ifdef REPORT_INTEL_REGS bool logIntelRegs = true; // Set logIntelRegs to in Info.plist to disable this feature. #define DEBUGSTRING(func) void func(char *result, int len, UInt32 reg, UInt32 val) #define DEFINEREG2(reg, func) { reg, #reg, func, 0 } #define DEFINE_FUNC_VOID(func) void func(void) #define DEFINE_FUNC_DUMP(func) void func(struct reg_debug *regs, uint32_t count) void intel_dump_other_regs(void); void dumpRegisters(struct reg_debug *regs, uint32_t count); void getPCHDeviceID(void); void reportIntelRegs(void); #endif uint32_t getBusFrequency(void); const char * getUnitText(uint8_t unit); UInt16 Interval = 50; uint16_t gBclk = 0; UInt64 gCoreMultipliers = 0ULL; UInt64 gTriggeredPStates = 0ULL; UInt64 gIGPUMultipliers = 0ULL; UInt64 gTriggeredIGPUPStates = 0ULL; #if WRITE_LOG_REPORT vfs_context_t mCtx = NULL; long reportFileOffset = 0L; char tempBuffer[TEMP_BUFFER_SIZE]; char logBuffer[WRITE_BUFFER_SIZE]; #endif public: virtual IOService * probe(IOService * provider, SInt32 * score) override; virtual bool start(IOService * provider) override; virtual void stop(IOService * provider) override; virtual void free(void) override; UInt8 gMinRatio = 0; UInt8 gClockRatio = 0; UInt8 gMaxRatio = 0; UInt8 gCpuModel = 0; UInt8 gCoreCount = 0; }; OSDefineMetaClassAndStructors(AppleIntelInfo, IOService) UInt8 gThreadCount = 0; UInt8 gCoreStates = 0ULL; #if REPORT_C_STATES bool gCheckC3 = true; bool gCheckC6 = true; bool gCheckC7 = false; UInt64 gC3Cores = 0; UInt64 gC6Cores = 0; UInt64 gC7Cores = 0; UInt64 gTriggeredC3Cores = 0; UInt64 gTriggeredC6Cores = 0; UInt64 gTriggeredC7Cores = 0; #endif UInt64 gCoreMultipliers = 0ULL; uint64_t gTSC = 0; #ifdef REPORT_IGPU_P_STATES UInt8 * gMchbar = NULL; #endif #if REPORT_INTEL_REGS #include "../AppleIntelRegisterDumper/AppleIntelRegisterDumper.h" #endif ================================================ FILE: AppleIntelInfo/essentials.h ================================================ /* * This work is licensed under the Creative Commons Attribution-NonCommercial * 4.0 Unported License => http://creativecommons.org/licenses/by-nc/4.0 */ #ifndef __LIBSAIO_CPU_ESSENTIALS_H #define __LIBSAIO_CPU_ESSENTIALS_H #include "intel_family.h" /* Copied from xnu/osfmk/cpuid.c (modified for 64-bit values) */ #define bit(n) (1UL << (n)) #define bitmask64(h, l) ((bit(h) | (bit(h) - 1)) & ~ (bit(l) - 1)) #define bitfield32(x, h, l) (((x) & bitmask64(h, l)) >> l) // Added by DHP in 2010. #define CPU_VENDOR_INTEL 0x756E6547 #define CPU_VENDOR_AMD 0x68747541 /* Copied from xnu/osfmk/cpuid.h */ #define CPU_STRING_UNKNOWN "Unknown CPU Typ" // Copied from xnu/osfmk/proc_reg.h #define MSR_IA32_PLATFORM_ID 0x17 #define MSR_CORE_THREAD_COUNT 0x35 #ifndef MSR_PLATFORM_INFO #define MSR_PLATFORM_INFO 0xCE #endif #define MSR_PKG_CST_CONFIG_CONTROL 0xE2 // MSR_PKG_CST_CONFIG_CONTROL #define MSR_PMG_IO_CAPTURE_BASE 0xE4 #define IA32_MPERF 0xE7 #define IA32_APERF 0xE8 #define IA32_PPERF 0x64E #define MSR_IA32_PERF_STATUS 0x0198 // MSR_IA32_PERF_STS in XNU #define MSR_IA32_PERF_CONTROL 0x0199 // IA32_PERF_CTL #ifndef MSR_FLEX_RATIO #define MSR_FLEX_RATIO 0x0194 #endif #define IA32_CLOCK_MODULATION 0x019A #define IA32_THERM_INTERRUPT 0x019B #define IA32_THERM_STATUS 0x019C #define MSR_THERM2_CTL 0x019D #define IA32_MISC_ENABLES 0x01A0 #define MSR_TEMPERATURE_TARGET 0x01A2 #define MSR_MISC_PWR_MGMT 0x01AA #define MSR_TURBO_RATIO_LIMIT 0x01AD #define MSR_TURBO_RATIO_LIMIT1 0x01AE #define MSR_TURBO_RATIO_LIMIT2 0x01AF #define IA32_ENERGY_PERF_BIAS 0x01B0 #define IA32_PLATFORM_DCA_CAP 0x01F8 #define MSR_POWER_CTL 0x01FC #define MSR_PKGC3_IRTL 0x60A #define MSR_PKGC6_IRTL 0x60B #define MSR_PKGC7_IRTL 0x60C #define MSR_PKG_C2_RESIDENCY 0x60D #define MSR_PKG_C3_RESIDENCY 0x3F8 #define MSR_PKG_C6_RESIDENCY 0x3F9 #define MSR_PKG_C7_RESIDENCY 0x3FA #define MSR_CORE_C3_RESIDENCY 0x3FC #define MSR_CORE_C6_RESIDENCY 0x3FD #define MSR_CORE_C7_RESIDENCY 0x3FE #define MSR_PP0_CURRENT_CONFIG 0x601 #define MSR_PP1_CURRENT_CONFIG 0x602 // Sandy Bridge & JakeTown specific 'Running Average Power Limit' MSR's. #define MSR_RAPL_POWER_UNIT 0x606 #define MSR_PKG_POWER_LIMIT 0x610 #define MSR_PKG_ENERGY_STATUS 0x611 #define MSR_PKG_PERF_STATUS 0x613 #define MSR_PKG_POWER_INFO 0x614 // JakeTown only Memory MSR's. #define MSR_DRAM_POWER_LIMIT 0x618 #define MSR_DRAM_ENERGY_STATUS 0x619 #define MSR_DRAM_PERF_STATUS 0x61B #define MSR_DRAM_POWER_INFO 0x61C #define MSR_UNCORE_RATIO_LIMIT 0x620 // Xeon (0x4F) Package residency MSR's. // Haswell-ULT (0x45) Package residency MSR's. #define MSR_PKG_C8_RESIDENCY 0x630 #define MSR_PKG_C9_RESIDENCY 0x631 #define MSR_PKG_C10_RESIDENCY 0x632 // Haswell-ULT C state latency control. #define MSR_PKG_C8_LATENCY 0x633 #define MSR_PKG_C9_LATENCY 0x634 #define MSR_PKG_C10_LATENCY 0x635 // Haswell-ULT VR configurations. #define VR_MISC_CONFIG2 0x636 // Haswell-ULT Alternate BCLK in deep Package C states. #define MSR_COUNTER_24_MHZ 0x637 // Sandy Bridge IA (Core) domain MSR's. #define MSR_PP0_POWER_LIMIT 0x638 #define MSR_PP0_ENERGY_STATUS 0x639 #define MSR_PP0_POLICY 0x63A #define MSR_PP0_PERF_STATUS 0x63B // Sandy Bridge Uncore (IGPU) domain MSR's (Not on JakeTown). #define MSR_PP1_POWER_LIMIT 0x640 #define MSR_PP1_ENERGY_STATUS 0x641 #define MSR_PP1_POLICY 0x642 // Ivy Bridge Specific MSR's #define MSR_CONFIG_TDP_NOMINAL 0x648 #define MSR_CONFIG_TDP_LEVEL1 0x649 #define MSR_CONFIG_TDP_LEVEL2 0x64A #define MSR_CONFIG_TDP_CONTROL 0x64B #define MSR_TURBO_ACTIVATION_RATIO 0x64C // Skylake Specific MSR's. #define MSR_PLATFORM_ENERGY_COUNTER 0x64D #define MSR_PPERF 0x64E #define MSR_CORE_PERF_LIMIT_REASONS 0x64F #define MSR_PKG_HDC_CONFIG 0x652 #define MSR_CORE_HDC_RESIDENCY 0x653 #define MSR_PKG_HDC_SHALLOW_RESIDENCY 0x655 #define MSR_PKG_HDC_DEEP_RESIDENCY 0x656 #define MSR_WEIGHTED_CORE_C0 0x658 #define MSR_ANY_CORE_C0 0x659 #define MSR_ANY_GFXE_C0 0x65A #define MSR_CORE_GFXE_OVERLAP_C0 0x65B #define MSR_PLATFORM_POWER_LIMIT 0x65C #define IA32_TSC_DEADLINE 0x6E0 #define IA32_PKG_HDC_CTL 0xDB0 #define IA32_PM_CTL1 0xDB1 #define IA32_THREAD_STALL 0xDB2 // HPW MSR's #define IA32_PM_ENABLE 0x770 #define IA32_HWP_CAPABILITIES 0x771 #define IA32_HWP_REQUEST_PKG 0x772 #define IA32_HWP_INTERRUPT 0x773 #define IA32_HWP_REQUEST 0x774 #define IA32_HWP_STATUS 0x777 // CPUID leaf index values (pointing to the right spot in CPUID/LEAF array). #define LEAF_0 0 // DHP: Formerly known as CPUID_n #define LEAF_1 1 #define LEAF_2 2 #define LEAF_4 3 #define LEAF_5 4 #define LEAF_6 5 #define LEAF_B 6 #define LEAF_80 7 #define LEAF_81 8 #define MAX_CPUID_LEAVES 9 // DHP: Formerly known as MAX_CPUID /* Copied from: xnu/osfmk/i386/cpuid.h #define CPU_MODEL_YONAH 0x0E #define CPU_MODEL_MEROM 0x0F #define CPU_MODEL_PENRYN 0x17 #define CPU_MODEL_NEHALEM 0x1A #define CPU_MODEL_ATOM 0x1C #define CPU_MODEL_FIELDS 0x1E // Lynnfield, Clarksfield, Jasper (LGA 1156) #define CPU_MODEL_DALES 0x1F // Havendale, Auburndale (LGA 1156) #define CPU_MODEL_DALES_32NM 0x25 // Clarkdale, Arrandale #define CPU_MODEL_SB_CORE 0x2A // Sandy Bridge Core Processors (LGA 1155) #define CPU_MODEL_WESTMERE 0x2C // Gulftown, Westmere-EP, Westmere-WS #define CPU_MODEL_SB_JAKETOWN 0x2D // Sandy Bridge-EP, Sandy Bridge Xeon Processors (LGA 2011) #define CPU_MODEL_NEHALEM_EX 0x2E #define CPU_MODEL_WESTMERE_EX 0x2F #define CPU_MODEL_IB_CORE 0x3A // Ivy Bridge Core Processors (LGA 1155) #define CPU_MODEL_IB_CORE_EX 0x3B // Ivy Bridge Core Processors (LGA 2011) #define CPU_MODEL_IB_CORE_XEON 0x3E #define CPU_MODEL_HASWELL 0x3C #define CPU_MODEL_HASWELL_SVR 0x3F #define CPU_MODEL_HASWELL_ULT 0x45 #define CPU_MODEL_CRYSTALWELL 0x46 #define CPU_MODEL_BROADWELL 0x3D #define CPU_MODEL_BROADWELL_ULX 0x3D #define CPU_MODEL_BROADWELL_ULT 0x3D #define CPU_MODEL_BROADWELL_H 0x47 #define CPU_MODEL_BRYSTALWELL 0x4C #define CPU_MODEL_BROADWELL_E 0x4F #define CPU_MODEL_SKYLAKE 0x4E #define CPU_MODEL_SKYLAKE_ULT 0x4E #define CPU_MODEL_SKYLAKE_ULX 0x4E #define CPU_MODEL_SKYLAKE_X 0x55 #define CPU_MODEL_SKYLAKE_DT 0x5E #define CPU_MODEL_KABYLAKE 0x8E #define CPU_MODEL_KABYLAKE_DT 0x9E */ #define DALES_BRIDGE 1 #define SANDY_BRIDGE 2 #define IVY_BRIDGE 4 #define HASWELL 8 #endif /* !__LIBSAIO_CPU_ESSENTIALS_H */ ================================================ FILE: AppleIntelInfo/intel_family.h ================================================ #ifndef _ASM_X86_INTEL_FAMILY_H #define _ASM_X86_INTEL_FAMILY_H /* * "Big Core" Processors (Branded as Core, Xeon, etc...) * * The "_X" parts are generally the EP and EX Xeons, or the * "Extreme" ones, like Broadwell-E. * * Things ending in "2" are usually because we have no better * name for them. There's no processor called "SILVERMONT2". */ #define INTEL_FAM6_CORE_YONAH 0x0E #define INTEL_FAM6_CORE2_MEROM 0x0F #define INTEL_FAM6_CORE2_MEROM_L 0x16 #define INTEL_FAM6_CORE2_PENRYN 0x17 #define INTEL_FAM6_CORE2_DUNNINGTON 0x1D #define INTEL_FAM6_NEHALEM 0x1E #define INTEL_FAM6_NEHALEM_G 0x1F /* Auburndale / Havendale */ #define INTEL_FAM6_NEHALEM_EP 0x1A #define INTEL_FAM6_NEHALEM_EX 0x2E #define INTEL_FAM6_WESTMERE 0x25 #define INTEL_FAM6_WESTMERE_EP 0x2C #define INTEL_FAM6_WESTMERE_EX 0x2F #define INTEL_FAM6_SANDYBRIDGE 0x2A #define INTEL_FAM6_SANDYBRIDGE_X 0x2D #define INTEL_FAM6_IVYBRIDGE 0x3A #define INTEL_FAM6_IVYBRIDGE_X 0x3E #define INTEL_FAM6_HASWELL_CORE 0x3C #define INTEL_FAM6_HASWELL_X 0x3F #define INTEL_FAM6_HASWELL_ULT 0x45 #define INTEL_FAM6_HASWELL_GT3E 0x46 #define INTEL_FAM6_BROADWELL_CORE 0x3D #define INTEL_FAM6_BROADWELL_XEON_D 0x56 #define INTEL_FAM6_BROADWELL_GT3E 0x47 #define INTEL_FAM6_BROADWELL_X 0x4F #define INTEL_FAM6_BROADWELL_XEON_D 0x56 #define INTEL_FAM6_SKYLAKE_MOBILE 0x4E #define INTEL_FAM6_SKYLAKE_DESKTOP 0x5E #define INTEL_FAM6_SKYLAKE_X 0x55 #define INTEL_FAM6_KABYLAKE_MOBILE 0x8E #define INTEL_FAM6_KABYLAKE_DESKTOP 0x9E #define INTEL_FAM6_CANNONLAKE_CORE 0x66 /* "Small Core" Processors (Atom) */ #define INTEL_FAM6_ATOM_PINEVIEW 0x1C #define INTEL_FAM6_ATOM_LINCROFT 0x26 #define INTEL_FAM6_ATOM_PENWELL 0x27 #define INTEL_FAM6_ATOM_CLOVERVIEW 0x35 #define INTEL_FAM6_ATOM_CEDARVIEW 0x36 #define INTEL_FAM6_ATOM_SILVERMONT1 0x37 /* BayTrail/BYT / Valleyview */ #define INTEL_FAM6_ATOM_SILVERMONT2 0x4D /* Avaton/Rangely */ #define INTEL_FAM6_ATOM_AIRMONT 0x4C /* CherryTrail / Braswell */ #define INTEL_FAM6_ATOM_MERRIFIELD 0x4A /* Tangier */ #define INTEL_FAM6_ATOM_MOOREFIELD 0x5A /* Anniedale */ #define INTEL_FAM6_ATOM_GOLDMONT 0x5C #define INTEL_FAM6_ATOM_GEMINI_LAKE 0x7A #define INTEL_FAM6_ATOM_DENVERTON 0x5F /* Goldmont Microserver */ /* Xeon Phi */ #define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */ #define INTEL_FAM6_XEON_PHI_KNM 0x85 /* Knights Mill */ #endif /* _ASM_X86_INTEL_FAMILY_H */ ================================================ FILE: AppleIntelInfo.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 9001A73619A79C310049DB99 /* intel_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001A73519A79C310049DB99 /* intel_reg.h */; }; 9001A73819A79C390049DB99 /* intel_chipset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001A73719A79C390049DB99 /* intel_chipset.h */; }; 90BE8FCF19A20F4A00E9E8B5 /* AppleIntelInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90BE8FCE19A20F4A00E9E8B5 /* AppleIntelInfo.cpp */; }; 90BE8FD319A20FD200E9E8B5 /* AppleIntelInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 90BE8FD219A20FD200E9E8B5 /* AppleIntelInfo.h */; }; 90BE8FD519A2104A00E9E8B5 /* essentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 90BE8FD419A2104A00E9E8B5 /* essentials.h */; }; 90F0224E1EF918BF0095F865 /* intel_family.h in Headers */ = {isa = PBXBuildFile; fileRef = 90F0224D1EF918BF0095F865 /* intel_family.h */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 9001A73519A79C310049DB99 /* intel_reg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intel_reg.h; path = AppleIntelRegisterDumper/intel_reg.h; sourceTree = ""; }; 9001A73719A79C390049DB99 /* intel_chipset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intel_chipset.h; path = AppleIntelRegisterDumper/intel_chipset.h; sourceTree = ""; }; 90BE8FBB19A20EDF00E9E8B5 /* AppleIntelInfo.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppleIntelInfo.kext; sourceTree = BUILT_PRODUCTS_DIR; }; 90BE8FBF19A20EDF00E9E8B5 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = System/Library/Frameworks/Kernel.framework; sourceTree = SDKROOT; }; 90BE8FC819A20EDF00E9E8B5 /* AppleIntelInfo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppleIntelInfo-Prefix.pch"; sourceTree = ""; }; 90BE8FCE19A20F4A00E9E8B5 /* AppleIntelInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleIntelInfo.cpp; sourceTree = ""; }; 90BE8FD219A20FD200E9E8B5 /* AppleIntelInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleIntelInfo.h; sourceTree = ""; }; 90BE8FD419A2104A00E9E8B5 /* essentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = essentials.h; sourceTree = ""; }; 90EACB9219A6B7F800512CC9 /* AppleIntelRegisterDumper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleIntelRegisterDumper.h; path = AppleIntelRegisterDumper/AppleIntelRegisterDumper.h; sourceTree = ""; }; 90F0224D1EF918BF0095F865 /* intel_family.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intel_family.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 90BE8FB619A20EDF00E9E8B5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 90BE8FB019A20EDF00E9E8B5 = { isa = PBXGroup; children = ( 90BE8FC019A20EDF00E9E8B5 /* AppleIntelInfo */, 90EACB8D19A6B71000512CC9 /* AppleIntelRegisterDumper */, 90BE8FBD19A20EDF00E9E8B5 /* Frameworks */, 90BE8FBC19A20EDF00E9E8B5 /* Products */, ); sourceTree = ""; }; 90BE8FBC19A20EDF00E9E8B5 /* Products */ = { isa = PBXGroup; children = ( 90BE8FBB19A20EDF00E9E8B5 /* AppleIntelInfo.kext */, ); name = Products; sourceTree = ""; }; 90BE8FBD19A20EDF00E9E8B5 /* Frameworks */ = { isa = PBXGroup; children = ( 90BE8FBE19A20EDF00E9E8B5 /* Other Frameworks */, ); name = Frameworks; sourceTree = ""; }; 90BE8FBE19A20EDF00E9E8B5 /* Other Frameworks */ = { isa = PBXGroup; children = ( 90BE8FBF19A20EDF00E9E8B5 /* Kernel.framework */, ); name = "Other Frameworks"; sourceTree = ""; }; 90BE8FC019A20EDF00E9E8B5 /* AppleIntelInfo */ = { isa = PBXGroup; children = ( 90BE8FD019A20FA400E9E8B5 /* Header Files */, 90BE8FD119A20FBD00E9E8B5 /* Source files */, 90BE8FC119A20EDF00E9E8B5 /* Supporting Files */, ); path = AppleIntelInfo; sourceTree = ""; }; 90BE8FC119A20EDF00E9E8B5 /* Supporting Files */ = { isa = PBXGroup; children = ( 90BE8FC819A20EDF00E9E8B5 /* AppleIntelInfo-Prefix.pch */, ); name = "Supporting Files"; sourceTree = ""; }; 90BE8FD019A20FA400E9E8B5 /* Header Files */ = { isa = PBXGroup; children = ( 90F0224D1EF918BF0095F865 /* intel_family.h */, 90BE8FD219A20FD200E9E8B5 /* AppleIntelInfo.h */, 90BE8FD419A2104A00E9E8B5 /* essentials.h */, ); name = "Header Files"; sourceTree = ""; }; 90BE8FD119A20FBD00E9E8B5 /* Source files */ = { isa = PBXGroup; children = ( 90BE8FCE19A20F4A00E9E8B5 /* AppleIntelInfo.cpp */, ); name = "Source files"; sourceTree = ""; }; 90EACB8D19A6B71000512CC9 /* AppleIntelRegisterDumper */ = { isa = PBXGroup; children = ( 90EACB8E19A6B75600512CC9 /* Header Files */, ); name = AppleIntelRegisterDumper; sourceTree = ""; }; 90EACB8E19A6B75600512CC9 /* Header Files */ = { isa = PBXGroup; children = ( 90EACB9219A6B7F800512CC9 /* AppleIntelRegisterDumper.h */, 9001A73519A79C310049DB99 /* intel_reg.h */, 9001A73719A79C390049DB99 /* intel_chipset.h */, ); name = "Header Files"; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ 90BE8FB719A20EDF00E9E8B5 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( 9001A73819A79C390049DB99 /* intel_chipset.h in Headers */, 90BE8FD319A20FD200E9E8B5 /* AppleIntelInfo.h in Headers */, 9001A73619A79C310049DB99 /* intel_reg.h in Headers */, 90F0224E1EF918BF0095F865 /* intel_family.h in Headers */, 90BE8FD519A2104A00E9E8B5 /* essentials.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ 90BE8FBA19A20EDF00E9E8B5 /* AppleIntelInfo */ = { isa = PBXNativeTarget; buildConfigurationList = 90BE8FCB19A20EDF00E9E8B5 /* Build configuration list for PBXNativeTarget "AppleIntelInfo" */; buildPhases = ( 90BE8FB519A20EDF00E9E8B5 /* Sources */, 90BE8FB619A20EDF00E9E8B5 /* Frameworks */, 90BE8FB719A20EDF00E9E8B5 /* Headers */, 90BE8FB819A20EDF00E9E8B5 /* Resources */, 90BE8FB919A20EDF00E9E8B5 /* Rez */, ); buildRules = ( ); dependencies = ( ); name = AppleIntelInfo; productName = AppleIntelInfo; productReference = 90BE8FBB19A20EDF00E9E8B5 /* AppleIntelInfo.kext */; productType = "com.apple.product-type.kernel-extension"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 90BE8FB119A20EDF00E9E8B5 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0800; ORGANIZATIONNAME = wordpress.pikeralpha.com; }; buildConfigurationList = 90BE8FB419A20EDF00E9E8B5 /* Build configuration list for PBXProject "AppleIntelInfo" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, ); mainGroup = 90BE8FB019A20EDF00E9E8B5; productRefGroup = 90BE8FBC19A20EDF00E9E8B5 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 90BE8FBA19A20EDF00E9E8B5 /* AppleIntelInfo */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 90BE8FB819A20EDF00E9E8B5 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXRezBuildPhase section */ 90BE8FB919A20EDF00E9E8B5 /* Rez */ = { isa = PBXRezBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXRezBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 90BE8FB519A20EDF00E9E8B5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 90BE8FCF19A20F4A00E9E8B5 /* AppleIntelInfo.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 90BE8FC919A20EDF00E9E8B5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.11; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; VALID_ARCHS = x86_64; }; name = Debug; }; 90BE8FCA19A20EDF00E9E8B5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.11; SDKROOT = macosx; VALID_ARCHS = x86_64; }; name = Release; }; 90BE8FCC19A20EDF00E9E8B5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "AppleIntelInfo/AppleIntelInfo-Prefix.pch"; INFOPLIST_FILE = "AppleIntelInfo/AppleIntelInfo-Info.plist"; MODULE_NAME = com.pikeralpha.driver.AppleIntelInfo; MODULE_START = 0; MODULE_STOP = 0; MODULE_VERSION = 1.0.0d1; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.pikeralpha.driver.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; VALID_ARCHS = x86_64; WRAPPER_EXTENSION = kext; }; name = Debug; }; 90BE8FCD19A20EDF00E9E8B5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_IDENTITY = ""; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "AppleIntelInfo/AppleIntelInfo-Prefix.pch"; INFOPLIST_FILE = "AppleIntelInfo/AppleIntelInfo-Info.plist"; MODULE_NAME = com.pikeralpha.driver.AppleIntelInfo; MODULE_START = 0; MODULE_STOP = 0; MODULE_VERSION = 1.0.0d1; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.pikeralpha.driver.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; VALID_ARCHS = x86_64; WRAPPER_EXTENSION = kext; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 90BE8FB419A20EDF00E9E8B5 /* Build configuration list for PBXProject "AppleIntelInfo" */ = { isa = XCConfigurationList; buildConfigurations = ( 90BE8FC919A20EDF00E9E8B5 /* Debug */, 90BE8FCA19A20EDF00E9E8B5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 90BE8FCB19A20EDF00E9E8B5 /* Build configuration list for PBXNativeTarget "AppleIntelInfo" */ = { isa = XCConfigurationList; buildConfigurations = ( 90BE8FCC19A20EDF00E9E8B5 /* Debug */, 90BE8FCD19A20EDF00E9E8B5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 90BE8FB119A20EDF00E9E8B5 /* Project object */; } ================================================ FILE: AppleIntelRegisterDumper/AppleIntelRegisterDumper.h ================================================ /* * Copyright © 2006,2009 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * * Eric Anholt * Pike R. Alpha (OS X port) * */ #include "intel_reg.h" #include "intel_chipset.h" #define DEBUGSTRING(func) void func(char *result, int len, UInt32 reg, UInt32 val) #define DEFINEREG(reg) { reg, #reg, NULL, 0 } #define DEFINEREG_16BIT(reg) { reg, #reg, i830_16bit_func, 0 } #define DEFINEREG2(reg, func) { reg, #reg, func, 0 } #define DEFINE_FUNC_DUMP(func) void func(struct reg_debug *regs, uint32_t count) #define DEFINE_FUNC_VOID(func) void func(void) #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) #define intel_dump_regs(regs) dumpRegisters(regs, ARRAY_SIZE(regs)) static uint32_t devid = 0; UInt64 gMMIOAddress = 0; struct reg_debug { UInt32 reg; const char *name; void (*debug_output) (char *result, int len, UInt32 reg, UInt32 val); UInt32 val; }; //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_pipe_ddi_func_ctl) { const char *enable, *port, *mode, *bpc, *vsync, *hsync, *edp_input; const char *width; enable = (val & (1<<31)) ? "enabled" : "disabled"; switch ((val >> 28) & 7) { case 0: port = "no port"; break; case 1: port = "DDIB"; break; case 2: port = "DDIC"; break; case 3: port = "DDID"; break; case 4: port = "DDIE"; break; default: port = "port reserved"; break; } switch ((val >> 24) & 7) { case 0: mode = "HDMI"; break; case 1: mode = "DVI"; break; case 2: mode = "DP SST"; break; case 3: mode = "DP MST"; break; case 4: mode = "FDI"; break; case 5: default: mode = "mode reserved"; break; } switch ((val >> 20) & 7) { case 0: bpc = "8 bpc"; break; case 1: bpc = "10 bpc"; break; case 2: bpc = "6 bpc"; break; case 3: bpc = "12 bpc"; break; default: bpc = "bpc reserved"; break; } hsync = (val & (1<<16)) ? "+HSync" : "-HSync"; vsync = (val & (1<<17)) ? "+VSync" : "-VSync"; switch ((val >> 12) & 7) { case 0: edp_input = "EDP A ON"; break; case 4: edp_input = "EDP A ONOFF"; break; case 5: edp_input = "EDP B ONOFF"; break; case 6: edp_input = "EDP C ONOFF"; break; default: edp_input = "EDP input reserved"; break; } switch ((val >> 1) & 7) { case 0: width = "x1"; break; case 1: width = "x2"; break; case 3: width = "x4"; break; default: width = "reserved width"; break; } snprintf(result, len, "%s, %s, %s, %s, %s, %s, %s, %s", enable, port, mode, bpc, vsync, hsync, edp_input, width); } //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_ddi_buf_ctl) { const char *enable, *reversal, *width, *detected; enable = (val & (1<<31)) ? "enabled" : "disabled"; reversal = (val & (1<<16)) ? "reversed" : "not reversed"; switch ((val >> 1) & 7) { case 0: width = "x1"; break; case 1: width = "x2"; break; case 3: width = "x4"; break; default: width = "reserved"; break; } detected = (val & 1) ? "detected" : "not detected"; snprintf(result, len, "%s %s %s %s", enable, reversal, width, detected); } //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_port_clk_sel) { const char *clock = NULL; switch ((val >> 29 ) & 7) { case 0: clock = "LCPLL 2700"; break; case 1: clock = "LCPLL 1350"; break; case 2: clock = "LCPLL 810"; break; case 3: clock = "SPLL"; break; case 4: clock = "WRPLL 1"; break; case 5: clock = "WRPLL 2"; break; case 6: clock = "Reserved"; break; case 7: clock = "None"; break; } snprintf(result, len, "%s", clock); } //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_pipe_clk_sel) { const char *clock; switch ((val >> 29) & 7) { case 0: clock = "None"; break; case 2: clock = "DDIB"; break; case 3: clock = "DDIC"; break; case 4: clock = "DDID"; break; case 5: clock = "DDIE"; break; default: clock = "Reserved"; break; } snprintf(result, len, "%s", clock); } //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_sfuse_strap) { const char *display, *crt, *lane_reversal, *portb, *portc, *portd; display = (val & (1<<7)) ? "disabled" : "enabled"; crt = (val & (1<<6)) ? "yes" : "no"; lane_reversal = (val & (1<<4)) ? "yes" : "no"; portb = (val & (1<<2)) ? "yes" : "no"; portc = (val & (1<<1)) ? "yes" : "no"; portd = (val & (1<<0)) ? "yes" : "no"; snprintf(result, len, "display %s, crt %s, lane reversal %s, " "port b %s, port c %s, port d %s", display, crt, lane_reversal, portb, portc, portd); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_yxminus1) { snprintf(result, len, "%d, %d", ((val & 0xffff0000) >> 16) + 1, (val & 0xffff) + 1); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_dspcntr) { const char *enabled = val & DISPLAY_PLANE_ENABLE ? "enabled" : "disabled"; char plane = val & DISPPLANE_SEL_PIPE_B ? 'B' : 'A'; if (HAS_PCH_SPLIT(devid) || IS_BROXTON(devid)) { snprintf(result, len, "%s", enabled); } else { snprintf(result, len, "%s, pipe %c", enabled, plane); } } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_dspstride) { snprintf(result, len, "%d", val >> 6); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_xyminus1) { snprintf(result, len, "%d, %d", (val & 0xffff) + 1, ((val & 0xffff0000) >> 16) + 1); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_xy) { snprintf(result, len, "%d, %d", (val & 0xffff), ((val & 0xffff0000) >> 16)); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_pipeconf) { const char *enabled = val & PIPEACONF_ENABLE ? "enabled" : "disabled"; const char *bit30 = NULL; const char *interlace = NULL; int interlace_mode; char buf[256]; int buf_len; if (IS_965(devid)) { bit30 = val & I965_PIPECONF_ACTIVE ? "active" : "inactive"; } else { bit30 = val & PIPEACONF_DOUBLE_WIDE ? "double-wide" : "single-wide"; } if (HAS_PCH_SPLIT(devid) || IS_BROXTON(devid)) { if (IS_IVYBRIDGE(devid) || IS_HASWELL(devid) || IS_BROADWELL(devid) || IS_GEN9(devid)) { interlace_mode = (val >> 21) & 3; } else { interlace_mode = (val >> 21) & 7; } buf_len = snprintf(buf, sizeof(buf), "%s, %s", enabled, bit30); switch (interlace_mode) { case 0: interlace = "pf-pd"; break; case 1: interlace = "pf-id"; break; case 3: interlace = "if-id"; break; case 4: interlace = "if-id-dbl"; break; case 5: interlace = "pf-id-dbl"; break; default: interlace = "rsvd"; break; } if (buf_len < sizeof(buf)) { buf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, ", %s", interlace); } } else if (IS_GEN4(devid) || IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid)) { switch ((val >> 21) & 7) { case 0: case 1: case 2: case 3: interlace = "progressive"; break; case 4: interlace = "interlaced embedded"; break; case 5: interlace = "interlaced"; break; case 6: interlace = "interlaced sdvo"; break; case 7: interlace = "interlaced legacy"; break; } if (buf_len < sizeof(buf)) { buf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, ", %s", interlace); } } if (IS_HASWELL(devid) || IS_IVYBRIDGE(devid) || IS_GEN6(devid) || IS_GEN5(devid)) { const char *rotation = NULL; switch ((val >> 14) & 3) { case 0: rotation = "rotate 0"; break; case 1: rotation = "rotate 90"; break; case 2: rotation = "rotate 180"; break; case 3: rotation = "rotate 270"; break; } if (buf_len < sizeof(buf)) { buf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, ", %s", rotation); } } if (IS_IVYBRIDGE(devid) || IS_GEN6(devid) || IS_GEN5(devid)) { const char *bpc = NULL; switch (val & (7 << 5)) { case PIPECONF_8BPP: bpc = "8bpc"; break; case PIPECONF_10BPP: bpc = "10bpc"; break; case PIPECONF_6BPP: bpc = "6bpc"; break; case PIPECONF_12BPP: bpc = "12bpc"; break; default: bpc = "invalid bpc"; break; } if (buf_len < sizeof(buf)) { buf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, ", %s", bpc); } } snprintf(result, len, "%s", buf); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_hvtotal) { snprintf(result, len, "%d active, %d total", (val & 0xffff) + 1, ((val & 0xffff0000) >> 16) + 1); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_hvsyncblank) { snprintf(result, len, "%d start, %d end", (val & 0xffff) + 1, ((val & 0xffff0000) >> 16) + 1); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_m_tu) { snprintf(result, len, "TU %d, val 0x%x %d", (val >> 25) + 1, val & 0xffffff, val & 0xffffff); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_n) { snprintf(result, len, "val 0x%x %d", val & 0xffffff, val & 0xffffff); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_panel_fitting) { const char *vadapt = NULL; const char *filter_sel = NULL; switch (val & (3 << 25)) { case 0: vadapt = "least"; break; case (1 << 25): vadapt = "moderate"; break; case (2 << 25): vadapt = "reserved"; break; case (3 << 25): vadapt = "most"; break; } switch (val & (3 << 23)) { case 0: filter_sel = "programmed"; break; case (1 << 23): filter_sel = "hardcoded"; break; case (2 << 23): filter_sel = "edge_enhance"; break; case (3 << 23): filter_sel = "edge_soften"; break; } snprintf(result, len, "%s, auto_scale %s, auto_scale_cal %s, v_filter %s, vadapt %s, mode %s, filter_sel %s," "chroma pre-filter %s, vert3tap %s, v_inter_invert %s", val & PF_ENABLE ? "enable" : "disable", val & (1 << 30) ? "no" : "yes", val & (1 << 29) ? "yes" : "no", val & (1 << 28) ? "bypass" : "enable", val & (1 << 27) ? "enable" : "disable", vadapt, filter_sel, val & (1 << 22) ? "enable" : "disable", val & (1 << 21) ? "force" : "auto", val & (1 << 20) ? "field 0" : "field 1"); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_panel_fitting_2) { snprintf(result, len, "vscale %f", val / (float) (1<<15)); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_panel_fitting_3) { snprintf(result, len, "vscale initial phase %f", val / (float) (1<<15)); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_panel_fitting_4) { snprintf(result, len, "hscale %f", val / (float) (1<<15)); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_pf_win) { int a = (val >> 16) & 0x1fff; int b = val & 0xfff; snprintf(result, len, "%d, %d", a, b); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_transconf) { const char *enable = val & TRANS_ENABLE ? "enable" : "disable"; const char *state = val & TRANS_STATE_ENABLE ? "active" : "inactive"; const char *interlace; switch ((val >> 21) & 7) { case 0: interlace = "progressive"; break; case 2: if (IS_GEN5(devid)) { interlace = "interlaced sdvo"; } else { interlace = "rsvd"; } break; case 3: interlace = "interlaced"; break; default: interlace = "rsvd"; } snprintf(result, len, "%s, %s, %s", enable, state, interlace); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_fdi_rx_misc) { snprintf(result, len, "FDI Delay %d", val & ((1 << 13) - 1)); } //------------------------------------------------------------------------------ DEBUGSTRING(ilk_debug_blc_pwm_cpu_ctl2) { int enable, blinking, granularity; const char *pipe = NULL; enable = (val >> 31) & 1; if (IS_GEN5(devid) || IS_GEN6(devid)) { pipe = ((val >> 29) & 1) ? "B" : "A"; } else { switch ((val >> 29) & 3) { case 0: pipe = "A"; break; case 1: pipe = "B"; break; case 2: pipe = "C"; break; case 3: if (IS_IVYBRIDGE(devid)) { pipe = "reserved"; } else { pipe = "EDP"; } break; } } if (IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid)) { snprintf(result, len, "enable %d, pipe %s", enable, pipe); } else { blinking = (val >> 28) & 1; granularity = ((val >> 27) & 1) ? 8 : 128; snprintf(result, len, "enable %d, pipe %s, blinking %d, " "granularity %d", enable, pipe, blinking, granularity); } } //------------------------------------------------------------------------------ DEBUGSTRING(ilk_debug_blc_pwm_cpu_ctl) { int cycle, freq; cycle = (val & 0xFFFF); if (IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid)) { snprintf(result, len, "cycle %d", cycle); } else { freq = (val >> 16) & 0xFFFF; snprintf(result, len, "cycle %d, freq %d", cycle, freq); } } //------------------------------------------------------------------------------ DEBUGSTRING(ibx_debug_blc_pwm_ctl1) { int enable, override, inverted_polarity; enable = (val >> 31) & 1; override = (val >> 30) & 1; inverted_polarity = (val >> 29) & 1; snprintf(result, len, "enable %d, override %d, inverted polarity %d", enable, override, inverted_polarity); } //------------------------------------------------------------------------------ DEBUGSTRING(ibx_debug_blc_pwm_ctl2) { int freq, cycle; freq = (val >> 16) & 0xFFFF; cycle = val & 0xFFFF; snprintf(result, len, "freq %d, cycle %d", freq, cycle); } //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_blc_misc_ctl) { const char *sel; sel = (val & 1) ? "PWM1-CPU PWM2-PCH" : "PWM1-PCH PWM2-CPU"; snprintf(result, len, "%s", sel); } //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_util_pin_ctl) { int enable, data, inverted_polarity; const char *transcoder = NULL; const char *mode = NULL; enable = (val >> 31) & 1; switch ((val >> 29) & 3) { case 0: transcoder = "A"; break; case 1: transcoder = "B"; break; case 2: transcoder = "C"; break; case 3: transcoder = "EDP"; break; } switch ((val >> 24) & 0xF) { case 0: mode = "data"; break; case 1: mode = "PWM"; break; case 4: mode = "Vblank"; break; case 5: mode = "Vsync"; break; default: mode = "reserved"; break; } data = (val >> 23) & 1; inverted_polarity = (val >> 22) & 1; snprintf(result, len, "enable %d, transcoder %s, mode %s, data %d " "inverted polarity %d", enable, transcoder, mode, data, inverted_polarity); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_pp_status) { const char *status = val & PP_ON ? "on" : "off"; const char *ready = val & PP_READY ? "ready" : "not ready"; const char *seq = "unknown"; switch (val & PP_SEQUENCE_MASK) { case PP_SEQUENCE_NONE: seq = "idle"; break; case PP_SEQUENCE_ON: seq = "on"; break; case PP_SEQUENCE_OFF: seq = "off"; break; } snprintf(result, len, "%s, %s, sequencing %s", status, ready, seq); } //------------------------------------------------------------------------------ DEBUGSTRING(ilk_debug_pp_control) { snprintf(result, len, "blacklight %s, %spower down on reset, panel %s", (val & (1 << 2)) ? "enabled" : "disabled", (val & (1 << 1)) ? "" : "do not ", (val & (1 << 0)) ? "on" : "off"); } //------------------------------------------------------------------------------ DEBUGSTRING(hsw_debug_sinterrupt) { int portd, portc, portb, crt; portd = (val >> 23) & 1; portc = (val >> 22) & 1; portb = (val >> 21) & 1; crt = (val >> 19) & 1; snprintf(result, len, "port d:%d, port c:%d, port b:%d, crt:%d", portd, portc, portb, crt); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_vgacntrl) { snprintf(result, len, "%s", val & VGA_DISP_DISABLE ? "disabled" : "enabled"); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_rr_hw_ctl) { snprintf(result, len, "low %d, high %d", val & RR_HW_LOW_POWER_FRAMES_MASK, (val & RR_HW_HIGH_POWER_FRAMES_MASK) >> 8); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_dref_ctl) { const char *cpu_source; const char *ssc_source = val & DREF_SSC_SOURCE_ENABLE ? "enable" : "disable"; const char *nonspread_source = val & DREF_NONSPREAD_SOURCE_ENABLE ? "enable" : "disable"; const char *superspread_source = val & DREF_SUPERSPREAD_SOURCE_ENABLE ? "enable" : "disable"; const char *ssc4_mode = val & DREF_SSC4_CENTERSPREAD ? "centerspread" : "downspread"; const char *ssc1 = val & DREF_SSC1_ENABLE ? "enable" : "disable"; const char *ssc4 = val & DREF_SSC4_ENABLE ? "enable" : "disable"; switch (val & DREF_CPU_SOURCE_OUTPUT_NONSPREAD) { case DREF_CPU_SOURCE_OUTPUT_DISABLE: cpu_source = "disable"; break; case DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD: cpu_source = "downspread"; break; case DREF_CPU_SOURCE_OUTPUT_NONSPREAD: cpu_source = "nonspread"; break; default: cpu_source = "reserved"; } snprintf(result, len, "cpu source %s, ssc_source %s, nonspread_source %s, " "superspread_source %s, ssc4_mode %s, ssc1 %s, ssc4 %s", cpu_source, ssc_source, nonspread_source, superspread_source, ssc4_mode, ssc1, ssc4); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_rawclk_freq) { const char *tp1 = NULL, *tp2 = NULL; switch (val & FDL_TP1_TIMER_MASK) { case 0: tp1 = "0.5us"; break; case (1 << 12): tp1 = "1.0us"; break; case (2 << 12): tp1 = "2.0us"; break; case (3 << 12): tp1 = "4.0us"; break; } switch (val & FDL_TP2_TIMER_MASK) { case 0: tp2 = "1.5us"; break; case (1 << 10): tp2 = "3.0us"; break; case (2 << 10): tp2 = "6.0us"; break; case (3 << 10): tp2 = "12.0us"; break; } snprintf(result, len, "FDL_TP1 timer %s, FDL_TP2 timer %s, freq %d", tp1, tp2, val & RAWCLK_FREQ_MASK); } DEBUGSTRING(snb_debug_dpll_sel) { const char *transa, *transb; const char *dplla = NULL, *dpllb = NULL; if (HAS_CPT) { if (val & TRANSA_DPLL_ENABLE) { transa = "enable"; if (val & TRANSA_DPLLB_SEL) { dplla = "B"; } else { dplla = "A"; } } else { transa = "disable"; } if (val & TRANSB_DPLL_ENABLE) { transb = "enable"; if (val & TRANSB_DPLLB_SEL) { dpllb = "B"; } else { dpllb = "A"; } } else { transb = "disable"; } snprintf(result, len, "TransA DPLL %s (DPLL %s), TransB DPLL %s (DPLL %s)", transa, dplla, transb, dpllb); } } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_pch_dpll) { const char *enable = val & DPLL_VCO_ENABLE ? "enable" : "disable"; const char *highspeed = val & DPLL_DVO_HIGH_SPEED ? "yes" : "no"; const char *mode = NULL; const char *p2 = NULL; int fpa0_p1, fpa1_p1; const char *refclk = NULL; int sdvo_mul; if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_LVDS) { mode = "LVDS"; if (val & DPLLB_LVDS_P2_CLOCK_DIV_7) { p2 = "Div 7"; } else { p2 = "Div 14"; } } else if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_DAC_SERIAL) { mode = "Non-LVDS"; if (val & DPLL_DAC_SERIAL_P2_CLOCK_DIV_5) { p2 = "Div 5"; } else { p2 = "Div 10"; } } fpa0_p1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK) >> 16); fpa1_p1 = ffs((val & DPLL_FPA1_P1_POST_DIV_MASK)); switch (val & PLL_REF_INPUT_MASK) { case PLL_REF_INPUT_DREFCLK: refclk = "default 120Mhz"; break; case PLL_REF_INPUT_SUPER_SSC: refclk = "SuperSSC 120Mhz"; break; case PLL_REF_INPUT_TVCLKINBC: refclk = "SDVO TVClkIn"; break; case PLLB_REF_INPUT_SPREADSPECTRUMIN: refclk = "SSC"; break; case PLL_REF_INPUT_DMICLK: refclk = "DMI RefCLK"; break; } sdvo_mul = ((val & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK) >> 9) + 1; snprintf(result, len, "%s, sdvo high speed %s, mode %s, p2 %s, " "FPA0 P1 %d, FPA1 P1 %d, refclk %s, sdvo/hdmi mul %d", enable, highspeed, mode, p2, fpa0_p1, fpa1_p1, refclk, sdvo_mul); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_fp) { if (IS_IGD(devid)) { snprintf(result, len, "n = %d, m1 = %d, m2 = %d", ffs((val & FP_N_IGD_DIV_MASK) >> FP_N_DIV_SHIFT) - 1, ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT), ((val & FP_M2_IGD_DIV_MASK) >> FP_M2_DIV_SHIFT)); } snprintf(result, len, "n = %d, m1 = %d, m2 = %d", ((val & FP_N_DIV_MASK) >> FP_N_DIV_SHIFT), ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT), ((val & FP_M2_DIV_MASK) >> FP_M2_DIV_SHIFT)); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_fdi_tx_ctl) { const char *train = NULL, *voltage = NULL, *pre_emphasis = NULL, *portw = NULL; switch (val & FDI_LINK_TRAIN_NONE) { case FDI_LINK_TRAIN_PATTERN_1: train = "pattern_1"; break; case FDI_LINK_TRAIN_PATTERN_2: train = "pattern_2"; break; case FDI_LINK_TRAIN_PATTERN_IDLE: train = "pattern_idle"; break; case FDI_LINK_TRAIN_NONE: train = "not train"; break; } if (HAS_CPT) { /* SNB B0 */ switch (val & (0x3f << 22)) { case FDI_LINK_TRAIN_400MV_0DB_SNB_B: voltage = "0.4V"; pre_emphasis = "0dB"; break; case FDI_LINK_TRAIN_400MV_6DB_SNB_B: voltage = "0.4V"; pre_emphasis = "6dB"; break; case FDI_LINK_TRAIN_600MV_3_5DB_SNB_B: voltage = "0.6V"; pre_emphasis = "3.5dB"; break; case FDI_LINK_TRAIN_800MV_0DB_SNB_B: voltage = "0.8V"; pre_emphasis = "0dB"; break; } } else { switch (val & (7 << 25)) { case FDI_LINK_TRAIN_VOLTAGE_0_4V: voltage = "0.4V"; break; case FDI_LINK_TRAIN_VOLTAGE_0_6V: voltage = "0.6V"; break; case FDI_LINK_TRAIN_VOLTAGE_0_8V: voltage = "0.8V"; break; case FDI_LINK_TRAIN_VOLTAGE_1_2V: voltage = "1.2V"; break; default: voltage = "reserved"; } switch (val & (7 << 22)) { case FDI_LINK_TRAIN_PRE_EMPHASIS_NONE: pre_emphasis = "none"; break; case FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X: pre_emphasis = "1.5x"; break; case FDI_LINK_TRAIN_PRE_EMPHASIS_2X: pre_emphasis = "2x"; break; case FDI_LINK_TRAIN_PRE_EMPHASIS_3X: pre_emphasis = "3x"; break; default: pre_emphasis = "reserved"; } } switch (val & (7 << 19)) { case FDI_DP_PORT_WIDTH_X1: portw = "X1"; break; case FDI_DP_PORT_WIDTH_X2: portw = "X2"; break; case FDI_DP_PORT_WIDTH_X3: portw = "X3"; break; case FDI_DP_PORT_WIDTH_X4: portw = "X4"; break; } snprintf(result, len, "%s, train pattern %s, voltage swing %s," "pre-emphasis %s, port width %s, enhanced framing %s, FDI PLL %s, scrambing %s, master mode %s", val & FDI_TX_ENABLE ? "enable" : "disable", train, voltage, pre_emphasis, portw, val & FDI_TX_ENHANCE_FRAME_ENABLE ? "enable" : "disable", val & FDI_TX_PLL_ENABLE ? "enable" : "disable", val & (1 << 7) ? "disable" : "enable", val & (1 << 0) ? "enable" : "disable"); } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_fdi_rx_ctl) { const char *train = NULL, *portw = NULL, *bpc = NULL; if (HAS_CPT) { switch (val & FDI_LINK_TRAIN_PATTERN_MASK_CPT) { case FDI_LINK_TRAIN_PATTERN_1_CPT: train = "pattern_1"; break; case FDI_LINK_TRAIN_PATTERN_2_CPT: train = "pattern_2"; break; case FDI_LINK_TRAIN_PATTERN_IDLE_CPT: train = "pattern_idle"; break; case FDI_LINK_TRAIN_NORMAL_CPT: train = "not train"; break; } } else { switch (val & FDI_LINK_TRAIN_NONE) { case FDI_LINK_TRAIN_PATTERN_1: train = "pattern_1"; break; case FDI_LINK_TRAIN_PATTERN_2: train = "pattern_2"; break; case FDI_LINK_TRAIN_PATTERN_IDLE: train = "pattern_idle"; break; case FDI_LINK_TRAIN_NONE: train = "not train"; break; } } switch (val & (7 << 19)) { case FDI_DP_PORT_WIDTH_X1: portw = "X1"; break; case FDI_DP_PORT_WIDTH_X2: portw = "X2"; break; case FDI_DP_PORT_WIDTH_X3: portw = "X3"; break; case FDI_DP_PORT_WIDTH_X4: portw = "X4"; break; } switch (val & (7 << 16)) { case FDI_8BPC: bpc = "8bpc"; break; case FDI_10BPC: bpc = "10bpc"; break; case FDI_6BPC: bpc = "6bpc"; break; case FDI_12BPC: bpc = "12bpc"; break; } snprintf(result, len, "%s, train pattern %s, port width %s, %s," "link_reverse_strap_overwrite %s, dmi_link_reverse %s, FDI PLL %s," "FS ecc %s, FE ecc %s, FS err report %s, FE err report %s," "scrambing %s, enhanced framing %s, %s", val & FDI_RX_ENABLE ? "enable" : "disable", train, portw, bpc, val & FDI_LINK_REVERSE_OVERWRITE ? "yes" : "no", val & FDI_DMI_LINK_REVERSE_MASK ? "yes" : "no", val & FDI_RX_PLL_ENABLE ? "enable" : "disable", val & FDI_FS_ERR_CORRECT_ENABLE ? "enable" : "disable", val & FDI_FE_ERR_CORRECT_ENABLE ? "enable" : "disable", val & FDI_FS_ERR_REPORT_ENABLE ? "enable" : "disable", val & FDI_FE_ERR_REPORT_ENABLE ? "enable" : "disable", val & (1 << 7) ? "disable" : "enable", val & FDI_RX_ENHANCE_FRAME_ENABLE ? "enable" : "disable", val & FDI_SEL_PCDCLK ? "PCDClk" : "RawClk"); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_adpa) { char disp_pipe = (val & ADPA_PIPE_B_SELECT) ? 'B' : 'A'; const char *enable = (val & ADPA_DAC_ENABLE) ? "enabled" : "disabled"; char hsync = (val & ADPA_HSYNC_ACTIVE_HIGH) ? '+' : '-'; char vsync = (val & ADPA_VSYNC_ACTIVE_HIGH) ? '+' : '-'; if (HAS_CPT) { disp_pipe = val & (1<<29) ? 'B' : 'A'; } if (HAS_PCH_SPLIT(devid)) { snprintf(result, len, "%s, transcoder %c, %chsync, %cvsync", enable, disp_pipe, hsync, vsync); } else { snprintf(result, len, "%s, pipe %c, %chsync, %cvsync", enable, disp_pipe, hsync, vsync); } } //------------------------------------------------------------------------------ DEBUGSTRING(ironlake_debug_hdmi) { int disp_pipe; const char *enable, *bpc = NULL, *encoding; const char *mode, *audio, *vsync, *hsync, *detect; if (val & PORT_ENABLE) { enable = "enabled"; } else { enable = "disabled"; } if (HAS_CPT) { disp_pipe = (val & (3<<29)) >> 29; } else { disp_pipe = (val & TRANSCODER_B) >> 29; } switch (val & (7 << 26)) { case COLOR_FORMAT_8bpc: bpc = "8bpc"; break; case COLOR_FORMAT_12bpc: bpc = "12bpc"; break; } if ((val & (3 << 10)) == TMDS_ENCODING) { encoding = "TMDS"; } else { encoding = "SDVO"; } if (val & (1 << 9)) { mode = "HDMI"; } else { mode = "DVI"; } if (val & AUDIO_ENABLE) { audio = "enabled"; } else { audio = "disabled"; } if (val & VSYNC_ACTIVE_HIGH) { vsync = "+vsync"; } else { vsync = "-vsync"; } if (val & HSYNC_ACTIVE_HIGH) { hsync = "+hsync"; } else { hsync = "-hsync"; } if (val & PORT_DETECTED) { detect = "detected"; } else { detect = "non-detected"; } snprintf(result, len, "%s pipe %c %s %s %s audio %s %s %s %s", enable, disp_pipe + 'A', bpc, encoding, mode, audio, vsync, hsync, detect); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_lvds) { char disp_pipe = val & LVDS_PIPEB_SELECT ? 'B' : 'A'; const char *enable = val & LVDS_PORT_EN ? "enabled" : "disabled"; int depth; const char *channels; if ((val & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP) { depth = 24; } else { depth = 18; } if ((val & LVDS_B0B3_POWER_MASK) == LVDS_B0B3_POWER_UP) { channels = "2 channels"; } else { channels = "1 channel"; } if (HAS_CPT) { disp_pipe = val & (1<<29) ? 'B' : 'A'; } snprintf(result, len, "%s, pipe %c, %d bit, %s", enable, disp_pipe, depth, channels); } //------------------------------------------------------------------------------ DEBUGSTRING(snb_debug_trans_dp_ctl) { const char *enable, *port = NULL, *bpc = NULL, *vsync, *hsync; if (HAS_CPT) { if (val & TRANS_DP_OUTPUT_ENABLE) { enable = "enable"; } else { enable = "disable"; } switch (val & TRANS_DP_PORT_SEL_MASK) { case TRANS_DP_PORT_SEL_B: port = "B"; break; case TRANS_DP_PORT_SEL_C: port = "C"; break; case TRANS_DP_PORT_SEL_D: port = "D"; break; default: port = "none"; break; } switch (val & (7<<9)) { case TRANS_DP_8BPC: bpc = "8bpc"; break; case TRANS_DP_10BPC: bpc = "10bpc"; break; case TRANS_DP_6BPC: bpc = "6bpc"; break; case TRANS_DP_12BPC: bpc = "12bpc"; break; } if (val & TRANS_DP_VSYNC_ACTIVE_HIGH) { vsync = "+vsync"; } else { vsync = "-vsync"; } if (val & TRANS_DP_HSYNC_ACTIVE_HIGH) { hsync = "+hsync"; } else { hsync = "-hsync"; } snprintf(result, len, "%s port %s %s %s %s", enable, port, bpc, vsync, hsync); } } //------------------------------------------------------------------------------ DEBUGSTRING(ivb_debug_port) { const char *drrs = NULL; switch (val & (2 << 30)) { case PORT_DBG_DRRS_HW_STATE_OFF: drrs = "off"; break; case PORT_DBG_DRRS_HW_STATE_LOW: drrs = "low"; break; /* case PORT_DBG_DRRS_HW_STATE_HIGH: drrs = "high"; break; */ } snprintf(result, len, "HW DRRS %s", drrs); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_16bit_func) { snprintf(result, len, "0x%04x", (uint16_t) val); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_dcc) { const char *addressing = NULL; if (IS_MOBILE(devid)) { if (IS_965(devid)) { if (val & (1 << 1)) { addressing = "dual channel interleaved"; } else { addressing = "single or dual channel asymmetric"; } } else { switch (val & 3) { case 0: addressing = "single channel"; break; case 1: addressing = "dual channel asymmetric"; break; case 2: addressing = "dual channel interleaved"; break; case 3: addressing = "unknown channel layout"; break; } } snprintf(result, len, "%s, XOR randomization: %sabled, XOR bit: %d", addressing, (val & (1 << 10)) ? "dis" : "en", (val & (1 << 9)) ? 17 : 11); } } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_chdecmisc) { const char *enhmodesel = NULL; switch ((val >> 5) & 3) { case 1: enhmodesel = "XOR bank/rank"; break; case 2: enhmodesel = "swap bank"; break; case 3: enhmodesel = "XOR bank"; break; case 0: enhmodesel = "none"; break; } snprintf(result, len, "%s, ch2 enh %sabled, ch1 enh %sabled, " "ch0 enh %sabled, " "flex %sabled, ep %spresent", enhmodesel, (val & (1 << 4)) ? "en" : "dis", (val & (1 << 3)) ? "en" : "dis", (val & (1 << 2)) ? "en" : "dis", (val & (1 << 1)) ? "en" : "dis", (val & (1 << 0)) ? "" : "not "); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_vga_pd) { int vga0_p1, vga0_p2, vga1_p1, vga1_p2; /* XXX: i9xx version */ if (val & VGA0_PD_P1_DIV_2) { vga0_p1 = 2; } else { vga0_p1 = ((val & VGA0_PD_P1_MASK) >> VGA0_PD_P1_SHIFT) + 2; } vga0_p2 = (val & VGA0_PD_P2_DIV_4) ? 4 : 2; if (val & VGA1_PD_P1_DIV_2) { vga1_p1 = 2; } else { vga1_p1 = ((val & VGA1_PD_P1_MASK) >> VGA1_PD_P1_SHIFT) + 2; } vga1_p2 = (val & VGA1_PD_P2_DIV_4) ? 4 : 2; snprintf(result, len, "vga0 p1 = %d, p2 = %d, vga1 p1 = %d, p2 = %d", vga0_p1, vga0_p2, vga1_p1, vga1_p2); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_dpll_test) { const char *dpllandiv = val & DPLLA_TEST_N_BYPASS ? ", DPLLA N bypassed" : ""; const char *dpllamdiv = val & DPLLA_TEST_M_BYPASS ? ", DPLLA M bypassed" : ""; const char *dpllainput = val & DPLLA_INPUT_BUFFER_ENABLE ? "" : ", DPLLA input buffer disabled"; const char *dpllbndiv = val & DPLLB_TEST_N_BYPASS ? ", DPLLB N bypassed" : ""; const char *dpllbmdiv = val & DPLLB_TEST_M_BYPASS ? ", DPLLB M bypassed" : ""; const char *dpllbinput = val & DPLLB_INPUT_BUFFER_ENABLE ? "" : ", DPLLB input buffer disabled"; snprintf(result, len, "%s%s%s%s%s%s", dpllandiv, dpllamdiv, dpllainput, dpllbndiv, dpllbmdiv, dpllbinput); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_dspclk_gate_d) { const char *DPUNIT_B = val & DPUNIT_B_CLOCK_GATE_DISABLE ? " DPUNIT_B" : ""; const char *VSUNIT = val & VSUNIT_CLOCK_GATE_DISABLE ? " VSUNIT" : ""; const char *VRHUNIT = val & VRHUNIT_CLOCK_GATE_DISABLE ? " VRHUNIT" : ""; const char *VRDUNIT = val & VRDUNIT_CLOCK_GATE_DISABLE ? " VRDUNIT" : ""; const char *AUDUNIT = val & AUDUNIT_CLOCK_GATE_DISABLE ? " AUDUNIT" : ""; const char *DPUNIT_A = val & DPUNIT_A_CLOCK_GATE_DISABLE ? " DPUNIT_A" : ""; const char *DPCUNIT = val & DPCUNIT_CLOCK_GATE_DISABLE ? " DPCUNIT" : ""; const char *TVRUNIT = val & TVRUNIT_CLOCK_GATE_DISABLE ? " TVRUNIT" : ""; const char *TVCUNIT = val & TVCUNIT_CLOCK_GATE_DISABLE ? " TVCUNIT" : ""; const char *TVFUNIT = val & TVFUNIT_CLOCK_GATE_DISABLE ? " TVFUNIT" : ""; const char *TVEUNIT = val & TVEUNIT_CLOCK_GATE_DISABLE ? " TVEUNIT" : ""; const char *DVSUNIT = val & DVSUNIT_CLOCK_GATE_DISABLE ? " DVSUNIT" : ""; const char *DSSUNIT = val & DSSUNIT_CLOCK_GATE_DISABLE ? " DSSUNIT" : ""; const char *DDBUNIT = val & DDBUNIT_CLOCK_GATE_DISABLE ? " DDBUNIT" : ""; const char *DPRUNIT = val & DPRUNIT_CLOCK_GATE_DISABLE ? " DPRUNIT" : ""; const char *DPFUNIT = val & DPFUNIT_CLOCK_GATE_DISABLE ? " DPFUNIT" : ""; const char *DPBMUNIT = val & DPBMUNIT_CLOCK_GATE_DISABLE ? " DPBMUNIT" : ""; const char *DPLSUNIT = val & DPLSUNIT_CLOCK_GATE_DISABLE ? " DPLSUNIT" : ""; const char *DPLUNIT = val & DPLUNIT_CLOCK_GATE_DISABLE ? " DPLUNIT" : ""; const char *DPOUNIT = val & DPOUNIT_CLOCK_GATE_DISABLE ? " DPOUNIT" : ""; const char *DPBUNIT = val & DPBUNIT_CLOCK_GATE_DISABLE ? " DPBUNIT" : ""; const char *DCUNIT = val & DCUNIT_CLOCK_GATE_DISABLE ? " DCUNIT" : ""; const char *DPUNIT = val & DPUNIT_CLOCK_GATE_DISABLE ? " DPUNIT" : ""; const char *VRUNIT = val & VRUNIT_CLOCK_GATE_DISABLE ? " VRUNIT" : ""; const char *OVHUNIT = val & OVHUNIT_CLOCK_GATE_DISABLE ? " OVHUNIT" : ""; const char *DPIOUNIT = val & DPIOUNIT_CLOCK_GATE_DISABLE ? " DPIOUNIT" : ""; const char *OVFUNIT = val & OVFUNIT_CLOCK_GATE_DISABLE ? " OVFUNIT" : ""; const char *OVBUNIT = val & OVBUNIT_CLOCK_GATE_DISABLE ? " OVBUNIT" : ""; const char *OVRUNIT = val & OVRUNIT_CLOCK_GATE_DISABLE ? " OVRUNIT" : ""; const char *OVCUNIT = val & OVCUNIT_CLOCK_GATE_DISABLE ? " OVCUNIT" : ""; const char *OVUUNIT = val & OVUUNIT_CLOCK_GATE_DISABLE ? " OVUUNIT" : ""; const char *OVLUNIT = val & OVLUNIT_CLOCK_GATE_DISABLE ? " OVLUNIT" : ""; snprintf(result, len, "clock gates disabled:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", DPUNIT_B, VSUNIT, VRHUNIT, VRDUNIT, AUDUNIT, DPUNIT_A, DPCUNIT, TVRUNIT, TVCUNIT, TVFUNIT, TVEUNIT, DVSUNIT, DSSUNIT, DDBUNIT, DPRUNIT, DPFUNIT, DPBMUNIT, DPLSUNIT, DPLUNIT, DPOUNIT, DPBUNIT, DCUNIT, DPUNIT, VRUNIT, OVHUNIT, DPIOUNIT, OVFUNIT, OVBUNIT, OVRUNIT, OVCUNIT, OVUUNIT, OVLUNIT); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_sdvo) { const char *enable = val & SDVO_ENABLE ? "enabled" : "disabled"; char disp_pipe = val & SDVO_PIPE_B_SELECT ? 'B' : 'A'; const char *stall = val & SDVO_STALL_SELECT ? "enabled" : "disabled"; const char *detected = val & SDVO_DETECTED ? "" : "not "; const char *gang = val & SDVOC_GANG_MODE ? ", gang mode" : ""; char sdvoextra[20]; if (IS_915(devid)) { snprintf(sdvoextra, len, ", SDVO mult %d", (int)((val & SDVO_PORT_MULTIPLY_MASK) >> SDVO_PORT_MULTIPLY_SHIFT) + 1); } else { sdvoextra[0] = '\0'; } snprintf(result, len, "%s, pipe %c, stall %s, %sdetected%s%s", enable, disp_pipe, stall, detected, sdvoextra, gang); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_dvo) { const char *enable = val & DVO_ENABLE ? "enabled" : "disabled"; char disp_pipe = val & DVO_PIPE_B_SELECT ? 'B' : 'A'; const char *stall; char hsync = val & DVO_HSYNC_ACTIVE_HIGH ? '+' : '-'; char vsync = val & DVO_VSYNC_ACTIVE_HIGH ? '+' : '-'; switch (val & DVO_PIPE_STALL_MASK) { case DVO_PIPE_STALL_UNUSED: stall = "no stall"; break; case DVO_PIPE_STALL: stall = "stall"; break; case DVO_PIPE_STALL_TV: stall = "TV stall"; break; default: stall = "unknown stall"; break; } snprintf(result, len, "%s, pipe %c, %s, %chsync, %cvsync", enable, disp_pipe, stall, hsync, vsync); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_pp_control) { snprintf(result, len, "power target: %s", val & POWER_TARGET_ON ? "on" : "off"); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_dspstride) { snprintf(result, len, "%d bytes", val); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_pipestat) { const char *_FIFO_UNDERRUN = val & FIFO_UNDERRUN ? " FIFO_UNDERRUN" : ""; const char *_CRC_ERROR_ENABLE = val & CRC_ERROR_ENABLE ? " CRC_ERROR_ENABLE" : ""; const char *_CRC_DONE_ENABLE = val & CRC_DONE_ENABLE ? " CRC_DONE_ENABLE" : ""; const char *_GMBUS_EVENT_ENABLE = val & GMBUS_EVENT_ENABLE ? " GMBUS_EVENT_ENABLE" : ""; const char *_VSYNC_INT_ENABLE = val & VSYNC_INT_ENABLE ? " VSYNC_INT_ENABLE" : ""; const char *_DLINE_COMPARE_ENABLE = val & DLINE_COMPARE_ENABLE ? " DLINE_COMPARE_ENABLE" : ""; const char *_DPST_EVENT_ENABLE = val & DPST_EVENT_ENABLE ? " DPST_EVENT_ENABLE" : ""; const char *_LBLC_EVENT_ENABLE = val & LBLC_EVENT_ENABLE ? " LBLC_EVENT_ENABLE" : ""; const char *_OFIELD_INT_ENABLE = val & OFIELD_INT_ENABLE ? " OFIELD_INT_ENABLE" : ""; const char *_EFIELD_INT_ENABLE = val & EFIELD_INT_ENABLE ? " EFIELD_INT_ENABLE" : ""; const char *_SVBLANK_INT_ENABLE = val & SVBLANK_INT_ENABLE ? " SVBLANK_INT_ENABLE" : ""; const char *_VBLANK_INT_ENABLE = val & VBLANK_INT_ENABLE ? " VBLANK_INT_ENABLE" : ""; const char *_OREG_UPDATE_ENABLE = val & OREG_UPDATE_ENABLE ? " OREG_UPDATE_ENABLE" : ""; const char *_CRC_ERROR_INT_STATUS = val & CRC_ERROR_INT_STATUS ? " CRC_ERROR_INT_STATUS" : ""; const char *_CRC_DONE_INT_STATUS = val & CRC_DONE_INT_STATUS ? " CRC_DONE_INT_STATUS" : ""; const char *_GMBUS_INT_STATUS = val & GMBUS_INT_STATUS ? " GMBUS_INT_STATUS" : ""; const char *_VSYNC_INT_STATUS = val & VSYNC_INT_STATUS ? " VSYNC_INT_STATUS" : ""; const char *_DLINE_COMPARE_STATUS = val & DLINE_COMPARE_STATUS ? " DLINE_COMPARE_STATUS" : ""; const char *_DPST_EVENT_STATUS = val & DPST_EVENT_STATUS ? " DPST_EVENT_STATUS" : ""; const char *_LBLC_EVENT_STATUS = val & LBLC_EVENT_STATUS ? " LBLC_EVENT_STATUS" : ""; const char *_OFIELD_INT_STATUS = val & OFIELD_INT_STATUS ? " OFIELD_INT_STATUS" : ""; const char *_EFIELD_INT_STATUS = val & EFIELD_INT_STATUS ? " EFIELD_INT_STATUS" : ""; const char *_SVBLANK_INT_STATUS = val & SVBLANK_INT_STATUS ? " SVBLANK_INT_STATUS" : ""; const char *_VBLANK_INT_STATUS = val & VBLANK_INT_STATUS ? " VBLANK_INT_STATUS" : ""; const char *_OREG_UPDATE_STATUS = val & OREG_UPDATE_STATUS ? " OREG_UPDATE_STATUS" : ""; snprintf(result, len, "status:%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", _FIFO_UNDERRUN, _CRC_ERROR_ENABLE, _CRC_DONE_ENABLE, _GMBUS_EVENT_ENABLE, _VSYNC_INT_ENABLE, _DLINE_COMPARE_ENABLE, _DPST_EVENT_ENABLE, _LBLC_EVENT_ENABLE, _OFIELD_INT_ENABLE, _EFIELD_INT_ENABLE, _SVBLANK_INT_ENABLE, _VBLANK_INT_ENABLE, _OREG_UPDATE_ENABLE, _CRC_ERROR_INT_STATUS, _CRC_DONE_INT_STATUS, _GMBUS_INT_STATUS, _VSYNC_INT_STATUS, _DLINE_COMPARE_STATUS, _DPST_EVENT_STATUS, _LBLC_EVENT_STATUS, _OFIELD_INT_STATUS, _EFIELD_INT_STATUS, _SVBLANK_INT_STATUS, _VBLANK_INT_STATUS, _OREG_UPDATE_STATUS); } //------------------------------------------------------------------------------ DEBUGSTRING(i830_debug_dpll) { const char *enabled = val & DPLL_VCO_ENABLE ? "enabled" : "disabled"; const char *dvomode = val & DPLL_DVO_HIGH_SPEED ? "dvo" : "non-dvo"; const char *vgamode = val & DPLL_VGA_MODE_DIS ? "" : ", VGA"; const char *mode = "unknown"; const char *clock = "unknown"; const char *fpextra = val & DISPLAY_RATE_SELECT_FPA1 ? ", using FPx1!" : ""; char sdvoextra[20]; int p1, p2 = 0; if (IS_GEN2(devid)) { // char is_lvds = (INREG(LVDS) & LVDS_PORT_EN) && (reg == DPLL_B); char is_lvds = (MMIO_READ32(LVDS) & LVDS_PORT_EN) && (reg == DPLL_B); if (is_lvds) { mode = "LVDS"; p1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS) >> DPLL_FPA01_P1_POST_DIV_SHIFT); // if ((INREG(LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) if ((MMIO_READ32(LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) { p2 = 7; } else { p2 = 14; } } else { mode = "DAC/serial"; if (val & PLL_P1_DIVIDE_BY_TWO) { p1 = 2; } else { /* Map the number in the field to (3, 33) */ p1 = ((val & DPLL_FPA01_P1_POST_DIV_MASK_I830) >> DPLL_FPA01_P1_POST_DIV_SHIFT) + 2; } if (val & PLL_P2_DIVIDE_BY_4) { p2 = 4; } else { p2 = 2; } } } else { if (IS_IGD(devid)) { p1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK_IGD) >> DPLL_FPA01_P1_POST_DIV_SHIFT_IGD); } else { p1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK) >> DPLL_FPA01_P1_POST_DIV_SHIFT); } switch (val & DPLL_MODE_MASK) { case DPLLB_MODE_DAC_SERIAL: mode = "DAC/serial"; p2 = val & DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 ? 5 : 10; break; case DPLLB_MODE_LVDS: mode = "LVDS"; p2 = val & DPLLB_LVDS_P2_CLOCK_DIV_7 ? 7 : 14; break; } } switch (val & PLL_REF_INPUT_MASK) { case PLL_REF_INPUT_DREFCLK: clock = "default"; break; case PLL_REF_INPUT_TVCLKINA: clock = "TV A"; break; case PLL_REF_INPUT_TVCLKINBC: clock = "TV B/C"; break; case PLLB_REF_INPUT_SPREADSPECTRUMIN: if (reg == DPLL_B) clock = "spread spectrum"; break; } if (IS_945(devid)) { snprintf(sdvoextra, len, ", SDVO mult %d", (int)((val & SDVO_MULTIPLIER_MASK) >> SDVO_MULTIPLIER_SHIFT_HIRES) + 1); } else { sdvoextra[0] = '\0'; } snprintf(result, len, "%s, %s%s, %s clock, %s mode, p1 = %d, p2 = %d%s%s", enabled, dvomode, vgamode, clock, mode, p1, p2, fpextra, sdvoextra); } //------------------------------------------------------------------------------ DEBUGSTRING(i810_debug_915_fence) { char format = (val & 1 << 12) ? 'Y' : 'X'; int pitch = 128 << ((val & 0x70) >> 4); unsigned int offset = val & 0x0ff00000; int size = (1024 * 1024) << ((val & 0x700) >> 8); if (IS_965(devid) || (IS_915(devid) && reg >= FENCE_NEW)) { return; } if (format == 'X') { pitch *= 4; } if (val & 1) { snprintf(result, len, "enabled, %c tiled, %4d pitch, 0x%08x - 0x%08x (%dkb)", format, pitch, offset, offset + size, size / 1024); } else { snprintf(result, len, "disabled"); } } //------------------------------------------------------------------------------ DEBUGSTRING(i810_debug_965_fence_start) { const char *enable = (val & FENCE_VALID) ? " enabled" : "disabled"; char format = (val & I965_FENCE_Y_MAJOR) ? 'Y' : 'X'; int pitch = ((val & 0xffc) >> 2) * 128 + 128; unsigned int offset = val & 0xfffff000; if (IS_965(devid)) { snprintf(result, len, "%s, %c tile walk, %4d pitch, 0x%08x start", enable, format, pitch, offset); } } //------------------------------------------------------------------------------ DEBUGSTRING(i810_debug_965_fence_end) { unsigned int end = val & 0xfffff000; if (IS_965(devid)) { snprintf(result, len, " 0x%08x end", end); } } //------------------------------------------------------------------------------ DEBUGSTRING(gen6_rp_control) { snprintf(result, len, "%s", (val & (1 << 7)) ? "enabled" : "disabled"); } //------------------------------------------------------------------------------ static struct reg_debug gen6_fences[] = { #define DEFINEFENCE_SNB(i) \ { FENCE_REG_SANDYBRIDGE_0 + (i) * 8, "FENCE START "#i, NULL, 0 }, \ { FENCE_REG_SANDYBRIDGE_0 + (i) * 8 + 4, "FENCE END "#i, NULL, 0 } DEFINEFENCE_SNB(0), DEFINEFENCE_SNB(1), DEFINEFENCE_SNB(2), DEFINEFENCE_SNB(3), DEFINEFENCE_SNB(4), DEFINEFENCE_SNB(5), DEFINEFENCE_SNB(6), DEFINEFENCE_SNB(7), DEFINEFENCE_SNB(8), DEFINEFENCE_SNB(9), DEFINEFENCE_SNB(10), DEFINEFENCE_SNB(11), DEFINEFENCE_SNB(12), DEFINEFENCE_SNB(13), DEFINEFENCE_SNB(14), DEFINEFENCE_SNB(15), DEFINEFENCE_SNB(16), DEFINEFENCE_SNB(17), DEFINEFENCE_SNB(18), DEFINEFENCE_SNB(19), DEFINEFENCE_SNB(20), DEFINEFENCE_SNB(20), DEFINEFENCE_SNB(21), DEFINEFENCE_SNB(22), DEFINEFENCE_SNB(23), DEFINEFENCE_SNB(24), DEFINEFENCE_SNB(25), DEFINEFENCE_SNB(26), DEFINEFENCE_SNB(27), DEFINEFENCE_SNB(28), DEFINEFENCE_SNB(29), DEFINEFENCE_SNB(30), DEFINEFENCE_SNB(31), }; //------------------------------------------------------------------------------ static struct reg_debug gen6_rp_debug_regs[] = { DEFINEREG2(GEN6_RP_CONTROL, gen6_rp_control), DEFINEREG(GEN6_RPNSWREQ), DEFINEREG(GEN6_RP_DOWN_TIMEOUT), DEFINEREG(GEN6_RP_INTERRUPT_LIMITS), DEFINEREG(GEN6_RP_UP_THRESHOLD), DEFINEREG(GEN6_RP_UP_EI), DEFINEREG(GEN6_RP_DOWN_EI), DEFINEREG(GEN6_RP_IDLE_HYSTERSIS), DEFINEREG(GEN6_RC_STATE), DEFINEREG(GEN6_RC_CONTROL), DEFINEREG(GEN6_RC1_WAKE_RATE_LIMIT), DEFINEREG(GEN6_RC6_WAKE_RATE_LIMIT), DEFINEREG(GEN6_RC_EVALUATION_INTERVAL), DEFINEREG(GEN6_RC_IDLE_HYSTERSIS), DEFINEREG(GEN6_RC_SLEEP), DEFINEREG(GEN6_RC1e_THRESHOLD), DEFINEREG(GEN6_RC6_THRESHOLD), DEFINEREG(GEN6_RC_VIDEO_FREQ), DEFINEREG(GEN6_PMIER), DEFINEREG(GEN6_PMIMR), DEFINEREG(GEN6_PMINTRMSK), }; //------------------------------------------------------------------------------ static struct reg_debug intel_debug_regs[] = { DEFINEREG2(DCC, i830_debug_dcc), DEFINEREG2(CHDECMISC, i830_debug_chdecmisc), DEFINEREG_16BIT(C0DRB0), DEFINEREG_16BIT(C0DRB1), DEFINEREG_16BIT(C0DRB2), DEFINEREG_16BIT(C0DRB3), DEFINEREG_16BIT(C1DRB0), DEFINEREG_16BIT(C1DRB1), DEFINEREG_16BIT(C1DRB2), DEFINEREG_16BIT(C1DRB3), DEFINEREG_16BIT(C0DRA01), DEFINEREG_16BIT(C0DRA23), DEFINEREG_16BIT(C1DRA01), DEFINEREG_16BIT(C1DRA23), DEFINEREG(PGETBL_CTL), DEFINEREG2(VCLK_DIVISOR_VGA0, i830_debug_fp), DEFINEREG2(VCLK_DIVISOR_VGA1, i830_debug_fp), DEFINEREG2(VCLK_POST_DIV, i830_debug_vga_pd), DEFINEREG2(DPLL_TEST, i830_debug_dpll_test), DEFINEREG(CACHE_MODE_0), DEFINEREG(D_STATE), DEFINEREG2(DSPCLK_GATE_D, i830_debug_dspclk_gate_d), DEFINEREG(RENCLK_GATE_D1), DEFINEREG(RENCLK_GATE_D2), /* DEFINEREG(RAMCLK_GATE_D), CRL only */ DEFINEREG2(SDVOB, i830_debug_sdvo), DEFINEREG2(SDVOC, i830_debug_sdvo), /* DEFINEREG(UDIB_SVB_SHB_CODES), CRL only */ /* DEFINEREG(UDIB_SHA_BLANK_CODES), CRL only */ DEFINEREG(SDVOUDI), DEFINEREG(DSPARB), DEFINEREG(FW_BLC), DEFINEREG(FW_BLC2), DEFINEREG(FW_BLC_SELF), DEFINEREG(DSPFW1), DEFINEREG(DSPFW2), DEFINEREG(DSPFW3), DEFINEREG2(ADPA, i830_debug_adpa), DEFINEREG2(LVDS, i830_debug_lvds), DEFINEREG2(DVOA, i830_debug_dvo), DEFINEREG2(DVOB, i830_debug_dvo), DEFINEREG2(DVOC, i830_debug_dvo), DEFINEREG(DVOA_SRCDIM), DEFINEREG(DVOB_SRCDIM), DEFINEREG(DVOC_SRCDIM), DEFINEREG(BLC_PWM_CTL), DEFINEREG(BLC_PWM_CTL2), DEFINEREG2(PP_CONTROL, i830_debug_pp_control), DEFINEREG2(PP_STATUS, i830_debug_pp_status), DEFINEREG(PP_ON_DELAYS), DEFINEREG(PP_OFF_DELAYS), DEFINEREG(PP_DIVISOR), DEFINEREG(PFIT_CONTROL), DEFINEREG(PFIT_PGM_RATIOS), DEFINEREG(PORT_HOTPLUG_EN), DEFINEREG(PORT_HOTPLUG_STAT), DEFINEREG2(DSPACNTR, i830_debug_dspcntr), DEFINEREG2(DSPASTRIDE, i830_debug_dspstride), DEFINEREG2(DSPAPOS, i830_debug_xy), DEFINEREG2(DSPASIZE, i830_debug_xyminus1), DEFINEREG(DSPABASE), DEFINEREG(DSPASURF), DEFINEREG(DSPATILEOFF), DEFINEREG2(PIPEACONF, i830_debug_pipeconf), DEFINEREG2(PIPEASRC, i830_debug_yxminus1), DEFINEREG2(PIPEASTAT, i830_debug_pipestat), DEFINEREG(PIPEA_GMCH_DATA_M), DEFINEREG(PIPEA_GMCH_DATA_N), DEFINEREG(PIPEA_DP_LINK_M), DEFINEREG(PIPEA_DP_LINK_N), DEFINEREG(CURSOR_A_BASE), DEFINEREG(CURSOR_A_CONTROL), DEFINEREG(CURSOR_A_POSITION), DEFINEREG2(FPA0, i830_debug_fp), DEFINEREG2(FPA1, i830_debug_fp), DEFINEREG2(DPLL_A, i830_debug_dpll), DEFINEREG(DPLL_A_MD), DEFINEREG2(HTOTAL_A, i830_debug_hvtotal), DEFINEREG2(HBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_A, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_A, i830_debug_hvtotal), DEFINEREG2(VBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_A, i830_debug_hvsyncblank), DEFINEREG(BCLRPAT_A), DEFINEREG(VSYNCSHIFT_A), DEFINEREG2(DSPBCNTR, i830_debug_dspcntr), DEFINEREG2(DSPBSTRIDE, i830_debug_dspstride), DEFINEREG2(DSPBPOS, i830_debug_xy), DEFINEREG2(DSPBSIZE, i830_debug_xyminus1), DEFINEREG(DSPBBASE), DEFINEREG(DSPBSURF), DEFINEREG(DSPBTILEOFF), DEFINEREG2(PIPEBCONF, i830_debug_pipeconf), DEFINEREG2(PIPEBSRC, i830_debug_yxminus1), DEFINEREG2(PIPEBSTAT, i830_debug_pipestat), DEFINEREG(PIPEB_GMCH_DATA_M), DEFINEREG(PIPEB_GMCH_DATA_N), DEFINEREG(PIPEB_DP_LINK_M), DEFINEREG(PIPEB_DP_LINK_N), DEFINEREG(CURSOR_B_BASE), DEFINEREG(CURSOR_B_CONTROL), DEFINEREG(CURSOR_B_POSITION), DEFINEREG2(FPB0, i830_debug_fp), DEFINEREG2(FPB1, i830_debug_fp), DEFINEREG2(DPLL_B, i830_debug_dpll), DEFINEREG(DPLL_B_MD), DEFINEREG2(HTOTAL_B, i830_debug_hvtotal), DEFINEREG2(HBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_B, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_B, i830_debug_hvtotal), DEFINEREG2(VBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_B, i830_debug_hvsyncblank), DEFINEREG(BCLRPAT_B), DEFINEREG(VSYNCSHIFT_B), DEFINEREG(VCLK_DIVISOR_VGA0), DEFINEREG(VCLK_DIVISOR_VGA1), DEFINEREG(VCLK_POST_DIV), DEFINEREG2(VGACNTRL, i830_debug_vgacntrl), DEFINEREG(TV_CTL), DEFINEREG(TV_DAC), DEFINEREG(TV_CSC_Y), DEFINEREG(TV_CSC_Y2), DEFINEREG(TV_CSC_U), DEFINEREG(TV_CSC_U2), DEFINEREG(TV_CSC_V), DEFINEREG(TV_CSC_V2), DEFINEREG(TV_CLR_KNOBS), DEFINEREG(TV_CLR_LEVEL), DEFINEREG(TV_H_CTL_1), DEFINEREG(TV_H_CTL_2), DEFINEREG(TV_H_CTL_3), DEFINEREG(TV_V_CTL_1), DEFINEREG(TV_V_CTL_2), DEFINEREG(TV_V_CTL_3), DEFINEREG(TV_V_CTL_4), DEFINEREG(TV_V_CTL_5), DEFINEREG(TV_V_CTL_6), DEFINEREG(TV_V_CTL_7), DEFINEREG(TV_SC_CTL_1), DEFINEREG(TV_SC_CTL_2), DEFINEREG(TV_SC_CTL_3), DEFINEREG(TV_WIN_POS), DEFINEREG(TV_WIN_SIZE), DEFINEREG(TV_FILTER_CTL_1), DEFINEREG(TV_FILTER_CTL_2), DEFINEREG(TV_FILTER_CTL_3), DEFINEREG(TV_CC_CONTROL), DEFINEREG(TV_CC_DATA), DEFINEREG(TV_H_LUMA_0), DEFINEREG(TV_H_LUMA_59), DEFINEREG(TV_H_CHROMA_0), DEFINEREG(TV_H_CHROMA_59), DEFINEREG(FBC_CFB_BASE), DEFINEREG(FBC_LL_BASE), DEFINEREG(FBC_CONTROL), DEFINEREG(FBC_COMMAND), DEFINEREG(FBC_STATUS), DEFINEREG(FBC_CONTROL2), DEFINEREG(FBC_FENCE_OFF), DEFINEREG(FBC_MOD_NUM), DEFINEREG(MI_MODE), /* DEFINEREG(MI_DISPLAY_POWER_DOWN), CRL only */ DEFINEREG(MI_ARB_STATE), DEFINEREG(MI_RDRET_STATE), DEFINEREG(ECOSKPD), DEFINEREG(DP_B), DEFINEREG(DPB_AUX_CH_CTL), DEFINEREG(DPB_AUX_CH_DATA1), DEFINEREG(DPB_AUX_CH_DATA2), DEFINEREG(DPB_AUX_CH_DATA3), DEFINEREG(DPB_AUX_CH_DATA4), DEFINEREG(DPB_AUX_CH_DATA5), DEFINEREG(DP_C), DEFINEREG(DPC_AUX_CH_CTL), DEFINEREG(DPC_AUX_CH_DATA1), DEFINEREG(DPC_AUX_CH_DATA2), DEFINEREG(DPC_AUX_CH_DATA3), DEFINEREG(DPC_AUX_CH_DATA4), DEFINEREG(DPC_AUX_CH_DATA5), DEFINEREG(DP_D), DEFINEREG(DPD_AUX_CH_CTL), DEFINEREG(DPD_AUX_CH_DATA1), DEFINEREG(DPD_AUX_CH_DATA2), DEFINEREG(DPD_AUX_CH_DATA3), DEFINEREG(DPD_AUX_CH_DATA4), DEFINEREG(DPD_AUX_CH_DATA5), DEFINEREG(AUD_CONFIG), DEFINEREG(AUD_HDMIW_STATUS), DEFINEREG(AUD_CONV_CHCNT), DEFINEREG(VIDEO_DIP_CTL), DEFINEREG(AUD_PINW_CNTR), DEFINEREG(AUD_CNTL_ST), DEFINEREG(AUD_PIN_CAP), DEFINEREG(AUD_PINW_CAP), DEFINEREG(AUD_PINW_UNSOLRESP), DEFINEREG(AUD_OUT_DIG_CNVT), DEFINEREG(AUD_OUT_CWCAP), DEFINEREG(AUD_GRP_CAP), #define DEFINEFENCE_915(i) \ { FENCE+i*4, "FENCE " #i, i810_debug_915_fence, 0 } #define DEFINEFENCE_945(i) \ { FENCE_NEW+(i - 8) * 4, "FENCE " #i, i810_debug_915_fence, 0 } DEFINEFENCE_915(0), DEFINEFENCE_915(1), DEFINEFENCE_915(2), DEFINEFENCE_915(3), DEFINEFENCE_915(4), DEFINEFENCE_915(5), DEFINEFENCE_915(6), DEFINEFENCE_915(7), DEFINEFENCE_945(8), DEFINEFENCE_945(9), DEFINEFENCE_945(10), DEFINEFENCE_945(11), DEFINEFENCE_945(12), DEFINEFENCE_945(13), DEFINEFENCE_945(14), DEFINEFENCE_945(15), #define DEFINEFENCE_965(i) \ { FENCE_NEW+i*8, "FENCE START " #i, i810_debug_965_fence_start, 0 }, \ { FENCE_NEW+i*8+4, "FENCE END " #i, i810_debug_965_fence_end, 0 } DEFINEFENCE_965(0), DEFINEFENCE_965(1), DEFINEFENCE_965(2), DEFINEFENCE_965(3), DEFINEFENCE_965(4), DEFINEFENCE_965(5), DEFINEFENCE_965(6), DEFINEFENCE_965(7), DEFINEFENCE_965(8), DEFINEFENCE_965(9), DEFINEFENCE_965(10), DEFINEFENCE_965(11), DEFINEFENCE_965(12), DEFINEFENCE_965(13), DEFINEFENCE_965(14), DEFINEFENCE_965(15), DEFINEREG(INST_PM), }; //------------------------------------------------------------------------------ static struct reg_debug ironlake_debug_regs[] = { DEFINEREG(PGETBL_CTL), DEFINEREG(INSTDONE_I965), DEFINEREG(INSTDONE_1), DEFINEREG2(CPU_VGACNTRL, i830_debug_vgacntrl), DEFINEREG(DIGITAL_PORT_HOTPLUG_CNTRL), DEFINEREG2(RR_HW_CTL, ironlake_debug_rr_hw_ctl), DEFINEREG(FDI_PLL_BIOS_0), DEFINEREG(FDI_PLL_BIOS_1), DEFINEREG(FDI_PLL_BIOS_2), DEFINEREG(DISPLAY_PORT_PLL_BIOS_0), DEFINEREG(DISPLAY_PORT_PLL_BIOS_1), DEFINEREG(DISPLAY_PORT_PLL_BIOS_2), DEFINEREG(FDI_PLL_FREQ_CTL), /* pipe B */ DEFINEREG2(PIPEACONF, i830_debug_pipeconf), DEFINEREG2(HTOTAL_A, i830_debug_hvtotal), DEFINEREG2(HBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_A, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_A, i830_debug_hvtotal), DEFINEREG2(VBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_A, i830_debug_hvsyncblank), DEFINEREG(VSYNCSHIFT_A), DEFINEREG2(PIPEASRC, i830_debug_yxminus1), DEFINEREG2(PIPEA_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(PIPEA_DATA_N1, ironlake_debug_n), DEFINEREG2(PIPEA_DATA_M2, ironlake_debug_m_tu), DEFINEREG2(PIPEA_DATA_N2, ironlake_debug_n), DEFINEREG2(PIPEA_LINK_M1, ironlake_debug_n), DEFINEREG2(PIPEA_LINK_N1, ironlake_debug_n), DEFINEREG2(PIPEA_LINK_M2, ironlake_debug_n), DEFINEREG2(PIPEA_LINK_N2, ironlake_debug_n), DEFINEREG2(DSPACNTR, i830_debug_dspcntr), DEFINEREG(DSPABASE), DEFINEREG2(DSPASTRIDE, ironlake_debug_dspstride), DEFINEREG(DSPASURF), DEFINEREG2(DSPATILEOFF, i830_debug_xy), /* pipe B */ DEFINEREG2(PIPEBCONF, i830_debug_pipeconf), DEFINEREG2(HTOTAL_B, i830_debug_hvtotal), DEFINEREG2(HBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_B, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_B, i830_debug_hvtotal), DEFINEREG2(VBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_B, i830_debug_hvsyncblank), DEFINEREG(VSYNCSHIFT_B), DEFINEREG2(PIPEBSRC, i830_debug_yxminus1), DEFINEREG2(PIPEB_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(PIPEB_DATA_N1, ironlake_debug_n), DEFINEREG2(PIPEB_DATA_M2, ironlake_debug_m_tu), DEFINEREG2(PIPEB_DATA_N2, ironlake_debug_n), DEFINEREG2(PIPEB_LINK_M1, ironlake_debug_n), DEFINEREG2(PIPEB_LINK_N1, ironlake_debug_n), DEFINEREG2(PIPEB_LINK_M2, ironlake_debug_n), DEFINEREG2(PIPEB_LINK_N2, ironlake_debug_n), DEFINEREG2(DSPBCNTR, i830_debug_dspcntr), DEFINEREG(DSPBBASE), DEFINEREG2(DSPBSTRIDE, ironlake_debug_dspstride), DEFINEREG(DSPBSURF), DEFINEREG2(DSPBTILEOFF, i830_debug_xy), /* pipe C */ DEFINEREG2(PIPECCONF, i830_debug_pipeconf), DEFINEREG2(HTOTAL_C, i830_debug_hvtotal), DEFINEREG2(HBLANK_C, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_C, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_C, i830_debug_hvtotal), DEFINEREG2(VBLANK_C, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_C, i830_debug_hvsyncblank), DEFINEREG(VSYNCSHIFT_C), DEFINEREG2(PIPECSRC, i830_debug_yxminus1), DEFINEREG2(PIPEC_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(PIPEC_DATA_N1, ironlake_debug_n), DEFINEREG2(PIPEC_DATA_M2, ironlake_debug_m_tu), DEFINEREG2(PIPEC_DATA_N2, ironlake_debug_n), DEFINEREG2(PIPEC_LINK_M1, ironlake_debug_n), DEFINEREG2(PIPEC_LINK_N1, ironlake_debug_n), DEFINEREG2(PIPEC_LINK_M2, ironlake_debug_n), DEFINEREG2(PIPEC_LINK_N2, ironlake_debug_n), DEFINEREG2(DSPCCNTR, i830_debug_dspcntr), DEFINEREG(DSPCBASE), DEFINEREG2(DSPCSTRIDE, ironlake_debug_dspstride), DEFINEREG(DSPCSURF), DEFINEREG2(DSPCTILEOFF, i830_debug_xy), /* Panel fitter */ DEFINEREG2(PFA_CTL_1, ironlake_debug_panel_fitting), DEFINEREG2(PFA_CTL_2, ironlake_debug_panel_fitting_2), DEFINEREG2(PFA_CTL_3, ironlake_debug_panel_fitting_3), DEFINEREG2(PFA_CTL_4, ironlake_debug_panel_fitting_4), DEFINEREG2(PFA_WIN_POS, ironlake_debug_pf_win), DEFINEREG2(PFA_WIN_SIZE, ironlake_debug_pf_win), DEFINEREG2(PFB_CTL_1, ironlake_debug_panel_fitting), DEFINEREG2(PFB_CTL_2, ironlake_debug_panel_fitting_2), DEFINEREG2(PFB_CTL_3, ironlake_debug_panel_fitting_3), DEFINEREG2(PFB_CTL_4, ironlake_debug_panel_fitting_4), DEFINEREG2(PFB_WIN_POS, ironlake_debug_pf_win), DEFINEREG2(PFB_WIN_SIZE, ironlake_debug_pf_win), DEFINEREG2(PFC_CTL_1, ironlake_debug_panel_fitting), DEFINEREG2(PFC_CTL_2, ironlake_debug_panel_fitting_2), DEFINEREG2(PFC_CTL_3, ironlake_debug_panel_fitting_3), DEFINEREG2(PFC_CTL_4, ironlake_debug_panel_fitting_4), DEFINEREG2(PFC_WIN_POS, ironlake_debug_pf_win), DEFINEREG2(PFC_WIN_SIZE, ironlake_debug_pf_win), /* PCH */ DEFINEREG2(PCH_DREF_CONTROL, ironlake_debug_dref_ctl), DEFINEREG2(PCH_RAWCLK_FREQ, ironlake_debug_rawclk_freq), DEFINEREG(PCH_DPLL_TMR_CFG), DEFINEREG(PCH_SSC4_PARMS), DEFINEREG(PCH_SSC4_AUX_PARMS), DEFINEREG2(PCH_DPLL_SEL, snb_debug_dpll_sel), DEFINEREG(PCH_DPLL_ANALOG_CTL), DEFINEREG2(PCH_DPLL_A, ironlake_debug_pch_dpll), DEFINEREG2(PCH_DPLL_B, ironlake_debug_pch_dpll), DEFINEREG2(PCH_FPA0, i830_debug_fp), DEFINEREG2(PCH_FPA1, i830_debug_fp), DEFINEREG2(PCH_FPB0, i830_debug_fp), DEFINEREG2(PCH_FPB1, i830_debug_fp), DEFINEREG2(TRANS_HTOTAL_A, i830_debug_hvtotal), DEFINEREG2(TRANS_HBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(TRANS_HSYNC_A, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VTOTAL_A, i830_debug_hvtotal), DEFINEREG2(TRANS_VBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VSYNC_A, i830_debug_hvsyncblank), DEFINEREG(TRANS_VSYNCSHIFT_A), DEFINEREG2(TRANSA_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(TRANSA_DATA_N1, ironlake_debug_n), DEFINEREG2(TRANSA_DATA_M2, ironlake_debug_m_tu), DEFINEREG2(TRANSA_DATA_N2, ironlake_debug_n), DEFINEREG2(TRANSA_DP_LINK_M1, ironlake_debug_n), DEFINEREG2(TRANSA_DP_LINK_N1, ironlake_debug_n), DEFINEREG2(TRANSA_DP_LINK_M2, ironlake_debug_n), DEFINEREG2(TRANSA_DP_LINK_N2, ironlake_debug_n), DEFINEREG2(TRANS_HTOTAL_B, i830_debug_hvtotal), DEFINEREG2(TRANS_HBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(TRANS_HSYNC_B, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VTOTAL_B, i830_debug_hvtotal), DEFINEREG2(TRANS_VBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VSYNC_B, i830_debug_hvsyncblank), DEFINEREG(TRANS_VSYNCSHIFT_B), DEFINEREG2(TRANSB_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(TRANSB_DATA_N1, ironlake_debug_n), DEFINEREG2(TRANSB_DATA_M2, ironlake_debug_m_tu), DEFINEREG2(TRANSB_DATA_N2, ironlake_debug_n), DEFINEREG2(TRANSB_DP_LINK_M1, ironlake_debug_n), DEFINEREG2(TRANSB_DP_LINK_N1, ironlake_debug_n), DEFINEREG2(TRANSB_DP_LINK_M2, ironlake_debug_n), DEFINEREG2(TRANSB_DP_LINK_N2, ironlake_debug_n), DEFINEREG2(TRANS_HTOTAL_C, i830_debug_hvtotal), DEFINEREG2(TRANS_HBLANK_C, i830_debug_hvsyncblank), DEFINEREG2(TRANS_HSYNC_C, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VTOTAL_C, i830_debug_hvtotal), DEFINEREG2(TRANS_VBLANK_C, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VSYNC_C, i830_debug_hvsyncblank), DEFINEREG(TRANS_VSYNCSHIFT_C), DEFINEREG2(TRANSC_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(TRANSC_DATA_N1, ironlake_debug_n), DEFINEREG2(TRANSC_DATA_M2, ironlake_debug_m_tu), DEFINEREG2(TRANSC_DATA_N2, ironlake_debug_n), DEFINEREG2(TRANSC_DP_LINK_M1, ironlake_debug_n), DEFINEREG2(TRANSC_DP_LINK_N1, ironlake_debug_n), DEFINEREG2(TRANSC_DP_LINK_M2, ironlake_debug_n), DEFINEREG2(TRANSC_DP_LINK_N2, ironlake_debug_n), DEFINEREG2(TRANSACONF, ironlake_debug_transconf), DEFINEREG2(TRANSBCONF, ironlake_debug_transconf), DEFINEREG2(TRANSCCONF, ironlake_debug_transconf), DEFINEREG2(FDI_TXA_CTL, ironlake_debug_fdi_tx_ctl), DEFINEREG2(FDI_TXB_CTL, ironlake_debug_fdi_tx_ctl), DEFINEREG2(FDI_TXC_CTL, ironlake_debug_fdi_tx_ctl), DEFINEREG2(FDI_RXA_CTL, ironlake_debug_fdi_rx_ctl), DEFINEREG2(FDI_RXB_CTL, ironlake_debug_fdi_rx_ctl), DEFINEREG2(FDI_RXC_CTL, ironlake_debug_fdi_rx_ctl), DEFINEREG(DPAFE_BMFUNC), DEFINEREG(DPAFE_DL_IREFCAL0), DEFINEREG(DPAFE_DL_IREFCAL1), DEFINEREG(DPAFE_DP_IREFCAL), DEFINEREG(PCH_DSPCLK_GATE_D), DEFINEREG(PCH_DSP_CHICKEN1), DEFINEREG(PCH_DSP_CHICKEN2), DEFINEREG(PCH_DSP_CHICKEN3), DEFINEREG2(FDI_RXA_MISC, ironlake_debug_fdi_rx_misc), DEFINEREG2(FDI_RXB_MISC, ironlake_debug_fdi_rx_misc), DEFINEREG2(FDI_RXC_MISC, ironlake_debug_fdi_rx_misc), DEFINEREG(FDI_RXA_TUSIZE1), DEFINEREG(FDI_RXA_TUSIZE2), DEFINEREG(FDI_RXB_TUSIZE1), DEFINEREG(FDI_RXB_TUSIZE2), DEFINEREG(FDI_RXC_TUSIZE1), DEFINEREG(FDI_RXC_TUSIZE2), DEFINEREG(FDI_PLL_CTL_1), DEFINEREG(FDI_PLL_CTL_2), DEFINEREG(FDI_RXA_IIR), DEFINEREG(FDI_RXA_IMR), DEFINEREG(FDI_RXB_IIR), DEFINEREG(FDI_RXB_IMR), DEFINEREG2(PCH_ADPA, i830_debug_adpa), DEFINEREG2(HDMIB, ironlake_debug_hdmi), DEFINEREG2(HDMIC, ironlake_debug_hdmi), DEFINEREG2(HDMID, ironlake_debug_hdmi), DEFINEREG2(PCH_LVDS, i830_debug_lvds), DEFINEREG(CPU_eDP_A), DEFINEREG(PCH_DP_B), DEFINEREG(PCH_DP_C), DEFINEREG(PCH_DP_D), DEFINEREG2(TRANS_DP_CTL_A, snb_debug_trans_dp_ctl), DEFINEREG2(TRANS_DP_CTL_B, snb_debug_trans_dp_ctl), DEFINEREG2(TRANS_DP_CTL_C, snb_debug_trans_dp_ctl), DEFINEREG2(BLC_PWM_CPU_CTL2, ilk_debug_blc_pwm_cpu_ctl2), DEFINEREG2(BLC_PWM_CPU_CTL, ilk_debug_blc_pwm_cpu_ctl), DEFINEREG2(BLC_PWM_PCH_CTL1, ibx_debug_blc_pwm_ctl1), DEFINEREG2(BLC_PWM_PCH_CTL2, ibx_debug_blc_pwm_ctl2), DEFINEREG2(PCH_PP_STATUS, i830_debug_pp_status), DEFINEREG2(PCH_PP_CONTROL, ilk_debug_pp_control), DEFINEREG(PCH_PP_ON_DELAYS), DEFINEREG(PCH_PP_OFF_DELAYS), DEFINEREG(PCH_PP_DIVISOR), DEFINEREG2(PORT_DBG, ivb_debug_port), DEFINEREG(RC6_RESIDENCY_TIME), DEFINEREG(RC6p_RESIDENCY_TIME), DEFINEREG(RC6pp_RESIDENCY_TIME), }; //------------------------------------------------------------------------------ static struct reg_debug haswell_debug_regs[] = { /* Power wells */ DEFINEREG(HSW_PWR_WELL_CTL1), DEFINEREG(HSW_PWR_WELL_CTL2), DEFINEREG(HSW_PWR_WELL_CTL3), DEFINEREG(HSW_PWR_WELL_CTL4), DEFINEREG(HSW_PWR_WELL_CTL5), DEFINEREG(HSW_PWR_WELL_CTL6), /* DDI pipe function */ DEFINEREG2(PIPE_DDI_FUNC_CTL_A, hsw_debug_pipe_ddi_func_ctl), DEFINEREG2(PIPE_DDI_FUNC_CTL_B, hsw_debug_pipe_ddi_func_ctl), DEFINEREG2(PIPE_DDI_FUNC_CTL_C, hsw_debug_pipe_ddi_func_ctl), DEFINEREG2(PIPE_DDI_FUNC_CTL_EDP, hsw_debug_pipe_ddi_func_ctl), /* DP transport control */ DEFINEREG(DP_TP_CTL_A), DEFINEREG(DP_TP_CTL_B), DEFINEREG(DP_TP_CTL_C), DEFINEREG(DP_TP_CTL_D), DEFINEREG(DP_TP_CTL_E), /* DP status */ DEFINEREG(DP_TP_STATUS_A), DEFINEREG(DP_TP_STATUS_B), DEFINEREG(DP_TP_STATUS_C), DEFINEREG(DP_TP_STATUS_D), DEFINEREG(DP_TP_STATUS_E), /* DDI buffer control */ DEFINEREG2(DDI_BUF_CTL_A, hsw_debug_ddi_buf_ctl), DEFINEREG2(DDI_BUF_CTL_B, hsw_debug_ddi_buf_ctl), DEFINEREG2(DDI_BUF_CTL_C, hsw_debug_ddi_buf_ctl), DEFINEREG2(DDI_BUF_CTL_D, hsw_debug_ddi_buf_ctl), DEFINEREG2(DDI_BUF_CTL_E, hsw_debug_ddi_buf_ctl), /* Clocks */ DEFINEREG(SPLL_CTL), DEFINEREG(LCPLL_CTL), DEFINEREG(WRPLL_CTL1), DEFINEREG(WRPLL_CTL2), /* DDI port clock control */ DEFINEREG2(PORT_CLK_SEL_A, hsw_debug_port_clk_sel), DEFINEREG2(PORT_CLK_SEL_B, hsw_debug_port_clk_sel), DEFINEREG2(PORT_CLK_SEL_C, hsw_debug_port_clk_sel), DEFINEREG2(PORT_CLK_SEL_D, hsw_debug_port_clk_sel), DEFINEREG2(PORT_CLK_SEL_E, hsw_debug_port_clk_sel), /* Pipe clock control */ DEFINEREG2(PIPE_CLK_SEL_A, hsw_debug_pipe_clk_sel), DEFINEREG2(PIPE_CLK_SEL_B, hsw_debug_pipe_clk_sel), DEFINEREG2(PIPE_CLK_SEL_C, hsw_debug_pipe_clk_sel), /* Fuses */ DEFINEREG2(SFUSE_STRAP, hsw_debug_sfuse_strap), /* Pipe A */ DEFINEREG2(PIPEASRC, i830_debug_yxminus1), DEFINEREG2(DSPACNTR, i830_debug_dspcntr), DEFINEREG2(DSPASTRIDE, ironlake_debug_dspstride), DEFINEREG(DSPASURF), DEFINEREG2(DSPATILEOFF, i830_debug_xy), /* Pipe B */ DEFINEREG2(PIPEBSRC, i830_debug_yxminus1), DEFINEREG2(DSPBCNTR, i830_debug_dspcntr), DEFINEREG2(DSPBSTRIDE, ironlake_debug_dspstride), DEFINEREG(DSPBSURF), DEFINEREG2(DSPBTILEOFF, i830_debug_xy), /* Pipe C */ DEFINEREG2(PIPECSRC, i830_debug_yxminus1), DEFINEREG2(DSPCCNTR, i830_debug_dspcntr), DEFINEREG2(DSPCSTRIDE, ironlake_debug_dspstride), DEFINEREG(DSPCSURF), DEFINEREG2(DSPCTILEOFF, i830_debug_xy), /* Transcoder A */ DEFINEREG2(PIPEACONF, i830_debug_pipeconf), DEFINEREG2(HTOTAL_A, i830_debug_hvtotal), DEFINEREG2(HBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_A, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_A, i830_debug_hvtotal), DEFINEREG2(VBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_A, i830_debug_hvsyncblank), DEFINEREG(VSYNCSHIFT_A), DEFINEREG2(PIPEA_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(PIPEA_DATA_N1, ironlake_debug_n), DEFINEREG2(PIPEA_LINK_M1, ironlake_debug_n), DEFINEREG2(PIPEA_LINK_N1, ironlake_debug_n), /* Transcoder B */ DEFINEREG2(PIPEBCONF, i830_debug_pipeconf), DEFINEREG2(HTOTAL_B, i830_debug_hvtotal), DEFINEREG2(HBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_B, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_B, i830_debug_hvtotal), DEFINEREG2(VBLANK_B, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_B, i830_debug_hvsyncblank), DEFINEREG(VSYNCSHIFT_B), DEFINEREG2(PIPEB_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(PIPEB_DATA_N1, ironlake_debug_n), DEFINEREG2(PIPEB_LINK_M1, ironlake_debug_n), DEFINEREG2(PIPEB_LINK_N1, ironlake_debug_n), /* Transcoder C */ DEFINEREG2(PIPECCONF, i830_debug_pipeconf), DEFINEREG2(HTOTAL_C, i830_debug_hvtotal), DEFINEREG2(HBLANK_C, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_C, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_C, i830_debug_hvtotal), DEFINEREG2(VBLANK_C, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_C, i830_debug_hvsyncblank), DEFINEREG(VSYNCSHIFT_C), DEFINEREG2(PIPEC_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(PIPEC_DATA_N1, ironlake_debug_n), DEFINEREG2(PIPEC_LINK_M1, ironlake_debug_n), DEFINEREG2(PIPEC_LINK_N1, ironlake_debug_n), /* Transcoder EDP */ DEFINEREG2(PIPEEDPCONF, i830_debug_pipeconf), DEFINEREG2(HTOTAL_EDP, i830_debug_hvtotal), DEFINEREG2(HBLANK_EDP, i830_debug_hvsyncblank), DEFINEREG2(HSYNC_EDP, i830_debug_hvsyncblank), DEFINEREG2(VTOTAL_EDP, i830_debug_hvtotal), DEFINEREG2(VBLANK_EDP, i830_debug_hvsyncblank), DEFINEREG2(VSYNC_EDP, i830_debug_hvsyncblank), DEFINEREG(VSYNCSHIFT_EDP), DEFINEREG2(PIPEEDP_DATA_M1, ironlake_debug_m_tu), DEFINEREG2(PIPEEDP_DATA_N1, ironlake_debug_n), DEFINEREG2(PIPEEDP_LINK_M1, ironlake_debug_n), DEFINEREG2(PIPEEDP_LINK_N1, ironlake_debug_n), /* CPU Panel fitter */ DEFINEREG2(PFA_CTL_1, ironlake_debug_panel_fitting), DEFINEREG2(PFA_WIN_POS, ironlake_debug_pf_win), DEFINEREG2(PFA_WIN_SIZE, ironlake_debug_pf_win), DEFINEREG2(PFB_CTL_1, ironlake_debug_panel_fitting), DEFINEREG2(PFB_WIN_POS, ironlake_debug_pf_win), DEFINEREG2(PFB_WIN_SIZE, ironlake_debug_pf_win), DEFINEREG2(PFC_CTL_1, ironlake_debug_panel_fitting), DEFINEREG2(PFC_WIN_POS, ironlake_debug_pf_win), DEFINEREG2(PFC_WIN_SIZE, ironlake_debug_pf_win), /* LPT */ DEFINEREG2(TRANS_HTOTAL_A, i830_debug_hvtotal), DEFINEREG2(TRANS_HBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(TRANS_HSYNC_A, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VTOTAL_A, i830_debug_hvtotal), DEFINEREG2(TRANS_VBLANK_A, i830_debug_hvsyncblank), DEFINEREG2(TRANS_VSYNC_A, i830_debug_hvsyncblank), DEFINEREG(TRANS_VSYNCSHIFT_A), DEFINEREG2(TRANSACONF, ironlake_debug_transconf), DEFINEREG2(FDI_RXA_MISC, ironlake_debug_fdi_rx_misc), DEFINEREG(FDI_RXA_TUSIZE1), DEFINEREG(FDI_RXA_IIR), DEFINEREG(FDI_RXA_IMR), DEFINEREG2(BLC_PWM_CPU_CTL2, ilk_debug_blc_pwm_cpu_ctl2), DEFINEREG2(BLC_PWM_CPU_CTL, ilk_debug_blc_pwm_cpu_ctl), DEFINEREG2(BLC_PWM2_CPU_CTL2, ilk_debug_blc_pwm_cpu_ctl2), DEFINEREG2(BLC_PWM2_CPU_CTL, ilk_debug_blc_pwm_cpu_ctl), DEFINEREG2(BLC_MISC_CTL, hsw_debug_blc_misc_ctl), DEFINEREG2(BLC_PWM_PCH_CTL1, ibx_debug_blc_pwm_ctl1), DEFINEREG2(BLC_PWM_PCH_CTL2, ibx_debug_blc_pwm_ctl2), DEFINEREG2(UTIL_PIN_CTL, hsw_debug_util_pin_ctl), DEFINEREG2(PCH_PP_STATUS, i830_debug_pp_status), DEFINEREG2(PCH_PP_CONTROL, ilk_debug_pp_control), DEFINEREG(PCH_PP_ON_DELAYS), DEFINEREG(PCH_PP_OFF_DELAYS), DEFINEREG(PCH_PP_DIVISOR), DEFINEREG(PIXCLK_GATE), DEFINEREG2(SDEISR, hsw_debug_sinterrupt), DEFINEREG(RC6_RESIDENCY_TIME) }; //------------------------------------------------------------------------------ static struct reg_debug skylake_debug_regs[] = { /* DDI pipe function */ DEFINEREG2(TRANS_DDI_FUNC_CTL_EDP, hsw_debug_pipe_ddi_func_ctl), DEFINEREG2(TRANS_DDI_FUNC_CTL_A, hsw_debug_pipe_ddi_func_ctl), DEFINEREG2(TRANS_DDI_FUNC_CTL_B, hsw_debug_pipe_ddi_func_ctl), DEFINEREG2(TRANS_DDI_FUNC_CTL_C, hsw_debug_pipe_ddi_func_ctl), }; //------------------------------------------------------------------------------ static struct reg_debug i945gm_mi_regs[] = { DEFINEREG(PGETBL_CTL), DEFINEREG(PGTBL_ER), DEFINEREG(EXCC), DEFINEREG(HWS_PGA), DEFINEREG(IPEIR), DEFINEREG(IPEHR), DEFINEREG(INSTDONE), DEFINEREG(NOP_ID), DEFINEREG(HWSTAM), DEFINEREG(SCPD0), DEFINEREG(IER), DEFINEREG(IIR), DEFINEREG(IMR), DEFINEREG(ISR), DEFINEREG(EIR), DEFINEREG(EMR), DEFINEREG(ESR), DEFINEREG(INST_PM), DEFINEREG(ECOSKPD), }; //------------------------------------------------------------------------------ // void AppleIntelInto::intel_dump_other_regs(void) DEFINE_FUNC_VOID(AppleIntelInfo::intel_dump_other_regs) { int i; int fp, dpll; int disp_pipe; int n, m1, m2, m, p1, p2; int ref; int dot; int phase; for (disp_pipe = 0; disp_pipe <= 1; disp_pipe++) { if (disp_pipe == 0) { fp = MMIO_READ32(FPA0); dpll = MMIO_READ32(DPLL_A); } else { fp = MMIO_READ32(FPB0); dpll = MMIO_READ32(DPLL_B); } if (IS_GEN2(devid)) { uint32_t lvds = MMIO_READ32(LVDS); if (devid == PCI_CHIP_I855_GM && (lvds & LVDS_PORT_EN) && (lvds & LVDS_PIPEB_SELECT) == (disp_pipe << 30)) { if ((lvds & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) { p2 = 7; } else { p2 = 14; } switch ((dpll >> 16) & 0x3f) { case 0x01: p1 = 1; break; case 0x02: p1 = 2; break; case 0x04: p1 = 3; break; case 0x08: p1 = 4; break; case 0x10: p1 = 5; break; case 0x20: p1 = 6; break; default: p1 = 1; IOLOG("LVDS P1 0x%x invalid encoding\n", (dpll >> 16) & 0x3f); break; } } else { if (dpll & (1 << 23)) { p2 = 4; } else { p2 = 2; } if (dpll & PLL_P1_DIVIDE_BY_TWO) { p1 = 2; } else { p1 = ((dpll >> 16) & 0x3f) + 2; } } switch ((dpll >> 13) & 0x3) { case 0: ref = 48000; break; case 3: ref = 66000; break; default: ref = 0; IOLOG("ref out of range\n"); break; } } else { uint32_t lvds = MMIO_READ32(LVDS); if ((lvds & LVDS_PORT_EN) && (lvds & LVDS_PIPEB_SELECT) == (disp_pipe << 30)) { if ((lvds & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) { p2 = 7; } else { p2 = 14; } } else { switch ((dpll >> 24) & 0x3) { case 0: p2 = 10; break; case 1: p2 = 5; break; default: p2 = 1; IOLOG("p2 out of range\n"); break; } } if (IS_IGD(devid)) { i = (dpll >> DPLL_FPA01_P1_POST_DIV_SHIFT_IGD) & 0x1ff; } else { i = (dpll >> DPLL_FPA01_P1_POST_DIV_SHIFT) & 0xff; } switch (i) { case 1: p1 = 1; break; case 2: p1 = 2; break; case 4: p1 = 3; break; case 8: p1 = 4; break; case 16: p1 = 5; break; case 32: p1 = 6; break; case 64: p1 = 7; break; case 128: p1 = 8; break; case 256: if (IS_IGD(devid)) { p1 = 9; break; } // fallback default: p1 = 1; IOLOG("p1 out of range\n"); break; } switch ((dpll >> 13) & 0x3) { case 0: ref = 96000; break; case 3: ref = 100000; break; default: ref = 0; IOLOG("ref out of range\n"); break; } } if (IS_965(devid)) { phase = (dpll >> 9) & 0xf; switch (phase) { case 6: break; default: IOLOG("SDVO phase shift %d out of range -- probably not an issue.\n", phase); break; } } switch ((dpll >> 8) & 1) { case 0: break; default: IOLOG("fp select out of range\n"); break; } m1 = ((fp >> 8) & 0x3f); if (IS_IGD(devid)) { n = ffs((fp & FP_N_IGD_DIV_MASK) >> FP_N_DIV_SHIFT) - 1; m2 = (fp & FP_M2_IGD_DIV_MASK) >> FP_M2_DIV_SHIFT; m = m2 + 2; dot = (ref * m) / n / (p1 * p2); } else { n = ((fp >> 16) & 0x3f); m2 = ((fp >> 0) & 0x3f); //m = 5 * (m1 + 2) + (m2 + 2); dot = (ref * (5 * (m1 + 2) + (m2 + 2)) / (n + 2)) / (p1 * p2); } IOLOG("pipe %s dot %d n %d m1 %d m2 %d p1 %d p2 %d\n", disp_pipe == 0 ? "A" : "B", dot, n, m1, m2, p1, p2); } } //------------------------------------------------------------------------------ // void AppleIntelInfo::dumpRegisters(struct reg_debug *regs, uint32_t count) DEFINE_FUNC_DUMP(AppleIntelInfo::dumpRegisters) { char name[30]; char debug[1024]; for (int i = 0; i < count; i++) { UInt32 val = MMIO_READ32((UInt64)regs[i].reg); memset(name, 0, 30); memset(debug, 0, 1024); memcpy(name, regs[i].name, strlen(regs[i].name)); // "123456789 123456789 1234567" strncat(name, "...........................", (27 - strlen(regs[i].name))); if (regs[i].debug_output != NULL) { regs[i].debug_output(debug, sizeof(debug), regs[i].reg, val); IOLOG("%s: 0x%08x (%s)\n", name, val, debug); } else { IOLOG("%s: 0x%08x\n", name, val); } } } //------------------------------------------------------------------------------ // void AppleIntelInfo::getPCHDeviceID(void) DEFINE_FUNC_VOID(AppleIntelInfo::getPCHDeviceID) { outl(0xcf8, 0x8000F800); UInt64 pch_device = inl(0xcfc); IOLOG("PCH device.................: 0x%llX\n", pch_device); if ((pch_device & 0x0000ffff) == 0x8086) { switch ((pch_device & 0xff000000)) { case 0x3b000000: intel_pch = PCH_IBX; break; case 0x1c000000: case 0x1e000000: intel_pch = PCH_CPT; break; case 0x8c000000: case 0x9c000000: intel_pch = PCH_LPT; break; default: intel_pch = PCH_NONE; } } } //------------------------------------------------------------------------------ // void AppleIntelInfo::reportIntelRegs(void) DEFINE_FUNC_VOID(AppleIntelInfo::reportIntelRegs) { getPCHDeviceID(); outl(0xcf8, 0x80001010); UInt64 mmio = (inl(0xcfc) & 0x7FFFC00000); // mask bits 38-22 IOPhysicalAddress address = (IOPhysicalAddress)(mmio); // 16 MB combined for MMIO and Global GTT table aperture (2MB for MMIO, 6MB reserved and 8MB for GTT). IOMemoryDescriptor * memDescriptor = IOMemoryDescriptor::withPhysicalAddress(address, 0x1000000, kIODirectionInOut); if (memDescriptor != NULL) { IOReturn result = memDescriptor->prepare(); if (result == kIOReturnSuccess) { IOMemoryMap * memoryMap = memDescriptor->map(); if (memoryMap != NULL) { int64_t mmio = memoryMap->getVirtualAddress(); gMMIOAddress = mmio; IOLOG("\nIntel Register Data\n------------------------------------\nCPU_VGACNTRL...............: 0x%X\n", MMIO_READ32(CPU_VGACNTRL)); if (IS_SKYLAKE(devid)) { IOLOG("IS_SKYLAKE(devid)\n"); intel_dump_regs(haswell_debug_regs); intel_dump_regs(skylake_debug_regs); } else if (IS_HASWELL(devid) || IS_BROADWELL(devid)) { IOLOG("IS_HASWELL(devid) || IS_BROADWELL(devid)\n"); intel_dump_regs(haswell_debug_regs); } else if (IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid)) { IOLOG("IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid)\n"); intel_dump_regs(ironlake_debug_regs); } else if (IS_945GM(devid)) { IOLOG("IS_945GM(devid)\n"); intel_dump_regs(i945gm_mi_regs); intel_dump_regs(intel_debug_regs); intel_dump_other_regs(); } else { IOLOG("IS_ELSE(devid)\n"); intel_dump_regs(intel_debug_regs); intel_dump_other_regs(); } if (IS_GEN6(devid) || IS_GEN7(devid)) { IOLOG("IS_GEN6(devid) || IS_GEN7(devid)\n"); intel_dump_regs(gen6_fences); intel_dump_regs(gen6_rp_debug_regs); } memoryMap->release(); memoryMap = NULL; } } memDescriptor->release(); memDescriptor = NULL; } } ================================================ FILE: AppleIntelRegisterDumper/intel_chipset.h ================================================ /* * Copyright © 2007 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Authors: * Eric Anholt * */ #ifndef _INTEL_CHIPSET_H #define _INTEL_CHIPSET_H UInt8 intel_pch = 0; enum pch_type { PCH_NONE, PCH_IBX, PCH_CPT, PCH_LPT, }; #define HAS_IBX (intel_pch == PCH_IBX) #define HAS_CPT (intel_pch == PCH_CPT) #define HAS_LPT (intel_pch == PCH_LPT) /* Exclude chipset #defines, they just add noise */ #ifndef __GTK_DOC_IGNORE__ #define PCI_CHIP_I810 0x7121 #define PCI_CHIP_I810_DC100 0x7123 #define PCI_CHIP_I810_E 0x7125 #define PCI_CHIP_I815 0x1132 #define PCI_CHIP_I830_M 0x3577 #define PCI_CHIP_845_G 0x2562 #define PCI_CHIP_I855_GM 0x3582 #define PCI_CHIP_I865_G 0x2572 #define PCI_CHIP_I915_G 0x2582 #define PCI_CHIP_E7221_G 0x258A #define PCI_CHIP_I915_GM 0x2592 #define PCI_CHIP_I945_G 0x2772 #define PCI_CHIP_I945_GM 0x27A2 #define PCI_CHIP_I945_GME 0x27AE #define PCI_CHIP_Q35_G 0x29B2 #define PCI_CHIP_G33_G 0x29C2 #define PCI_CHIP_Q33_G 0x29D2 #define PCI_CHIP_IGD_GM 0xA011 #define PCI_CHIP_IGD_G 0xA001 #define IS_IGDGM(devid) ((devid) == PCI_CHIP_IGD_GM) #define IS_IGDG(devid) ((devid) == PCI_CHIP_IGD_G) #define IS_IGD(devid) (IS_IGDG(devid) || IS_IGDGM(devid)) #define PCI_CHIP_I965_G 0x29A2 #define PCI_CHIP_I965_Q 0x2992 #define PCI_CHIP_I965_G_1 0x2982 #define PCI_CHIP_I946_GZ 0x2972 #define PCI_CHIP_I965_GM 0x2A02 #define PCI_CHIP_I965_GME 0x2A12 #define PCI_CHIP_GM45_GM 0x2A42 #define PCI_CHIP_IGD_E_G 0x2E02 #define PCI_CHIP_Q45_G 0x2E12 #define PCI_CHIP_G45_G 0x2E22 #define PCI_CHIP_G41_G 0x2E32 #define PCI_CHIP_ILD_G 0x0042 #define PCI_CHIP_ILM_G 0x0046 #define PCI_CHIP_SANDYBRIDGE_GT1 0x0102 /* desktop */ #define PCI_CHIP_SANDYBRIDGE_GT2 0x0112 #define PCI_CHIP_SANDYBRIDGE_GT2_PLUS 0x0122 #define PCI_CHIP_SANDYBRIDGE_M_GT1 0x0106 /* mobile */ #define PCI_CHIP_SANDYBRIDGE_M_GT2 0x0116 #define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS 0x0126 #define PCI_CHIP_SANDYBRIDGE_S 0x010A /* server */ #define PCI_CHIP_IVYBRIDGE_GT1 0x0152 /* desktop */ #define PCI_CHIP_IVYBRIDGE_GT2 0x0162 #define PCI_CHIP_IVYBRIDGE_M_GT1 0x0156 /* mobile */ #define PCI_CHIP_IVYBRIDGE_M_GT2 0x0166 #define PCI_CHIP_IVYBRIDGE_S 0x015a /* server */ #define PCI_CHIP_IVYBRIDGE_S_GT2 0x016a /* server */ #define PCI_CHIP_HASWELL_GT1 0x0402 /* Desktop */ #define PCI_CHIP_HASWELL_GT2 0x0412 #define PCI_CHIP_HASWELL_GT3 0x0422 #define PCI_CHIP_HASWELL_M_GT1 0x0406 /* Mobile */ #define PCI_CHIP_HASWELL_M_GT2 0x0416 #define PCI_CHIP_HASWELL_M_GT3 0x0426 #define PCI_CHIP_HASWELL_S_GT1 0x040A /* Server */ #define PCI_CHIP_HASWELL_S_GT2 0x041A #define PCI_CHIP_HASWELL_S_GT3 0x042A #define PCI_CHIP_HASWELL_B_GT1 0x040B /* Reserved */ #define PCI_CHIP_HASWELL_B_GT2 0x041B #define PCI_CHIP_HASWELL_B_GT3 0x042B #define PCI_CHIP_HASWELL_E_GT1 0x040E /* Reserved */ #define PCI_CHIP_HASWELL_E_GT2 0x041E #define PCI_CHIP_HASWELL_E_GT3 0x042E #define PCI_CHIP_HASWELL_SDV_GT1 0x0C02 /* Desktop */ #define PCI_CHIP_HASWELL_SDV_GT2 0x0C12 #define PCI_CHIP_HASWELL_SDV_GT3 0x0C22 #define PCI_CHIP_HASWELL_SDV_M_GT1 0x0C06 /* Mobile */ #define PCI_CHIP_HASWELL_SDV_M_GT2 0x0C16 #define PCI_CHIP_HASWELL_SDV_M_GT3 0x0C26 #define PCI_CHIP_HASWELL_SDV_S_GT1 0x0C0A /* Server */ #define PCI_CHIP_HASWELL_SDV_S_GT2 0x0C1A #define PCI_CHIP_HASWELL_SDV_S_GT3 0x0C2A #define PCI_CHIP_HASWELL_SDV_B_GT1 0x0C0B /* Reserved */ #define PCI_CHIP_HASWELL_SDV_B_GT2 0x0C1B #define PCI_CHIP_HASWELL_SDV_B_GT3 0x0C2B #define PCI_CHIP_HASWELL_SDV_E_GT1 0x0C0E /* Reserved */ #define PCI_CHIP_HASWELL_SDV_E_GT2 0x0C1E #define PCI_CHIP_HASWELL_SDV_E_GT3 0x0C2E #define PCI_CHIP_HASWELL_ULT_GT1 0x0A02 /* Desktop */ #define PCI_CHIP_HASWELL_ULT_GT2 0x0A12 #define PCI_CHIP_HASWELL_ULT_GT3 0x0A22 #define PCI_CHIP_HASWELL_ULT_M_GT1 0x0A06 /* Mobile */ #define PCI_CHIP_HASWELL_ULT_M_GT2 0x0A16 #define PCI_CHIP_HASWELL_ULT_M_GT3 0x0A26 #define PCI_CHIP_HASWELL_ULT_S_GT1 0x0A0A /* Server */ #define PCI_CHIP_HASWELL_ULT_S_GT2 0x0A1A #define PCI_CHIP_HASWELL_ULT_S_GT3 0x0A2A #define PCI_CHIP_HASWELL_ULT_B_GT1 0x0A0B /* Reserved */ #define PCI_CHIP_HASWELL_ULT_B_GT2 0x0A1B #define PCI_CHIP_HASWELL_ULT_B_GT3 0x0A2B #define PCI_CHIP_HASWELL_ULT_E_GT1 0x0A0E /* Reserved */ #define PCI_CHIP_HASWELL_ULT_E_GT2 0x0A1E #define PCI_CHIP_HASWELL_ULT_E_GT3 0x0A2E #define PCI_CHIP_HASWELL_CRW_GT1 0x0D02 /* Desktop */ #define PCI_CHIP_HASWELL_CRW_GT2 0x0D12 #define PCI_CHIP_HASWELL_CRW_GT3 0x0D22 #define PCI_CHIP_HASWELL_CRW_M_GT1 0x0D06 /* Mobile */ #define PCI_CHIP_HASWELL_CRW_M_GT2 0x0D16 #define PCI_CHIP_HASWELL_CRW_M_GT3 0x0D26 #define PCI_CHIP_HASWELL_CRW_S_GT1 0x0D0A /* Server */ #define PCI_CHIP_HASWELL_CRW_S_GT2 0x0D1A #define PCI_CHIP_HASWELL_CRW_S_GT3 0x0D2A #define PCI_CHIP_HASWELL_CRW_B_GT1 0x0D0B /* Reserved */ #define PCI_CHIP_HASWELL_CRW_B_GT2 0x0D1B #define PCI_CHIP_HASWELL_CRW_B_GT3 0x0D2B #define PCI_CHIP_HASWELL_CRW_E_GT1 0x0D0E /* Reserved */ #define PCI_CHIP_HASWELL_CRW_E_GT2 0x0D1E #define PCI_CHIP_HASWELL_CRW_E_GT3 0x0D2E #define BDW_SPARE 0x2 #define BDW_ULT 0x6 #define BDW_IRIS 0xb #define BDW_SERVER 0xa #define BDW_WORKSTATION 0xd #define BDW_ULX 0xe #define PCI_CHIP_VALLEYVIEW_PO 0x0f30 /* VLV PO board */ #define PCI_CHIP_VALLEYVIEW_1 0x0f31 #define PCI_CHIP_VALLEYVIEW_2 0x0f32 #define PCI_CHIP_VALLEYVIEW_3 0x0f33 #define PCI_CHIP_CHERRYVIEW_0 0x22b0 #define PCI_CHIP_CHERRYVIEW_1 0x22b1 #define PCI_CHIP_CHERRYVIEW_2 0x22b2 #define PCI_CHIP_CHERRYVIEW_3 0x22b3 #define PCI_CHIP_SKYLAKE_ULT_GT2 0x1916 #define PCI_CHIP_SKYLAKE_ULT_GT1 0x1906 #define PCI_CHIP_SKYLAKE_ULT_GT3 0x1926 #define PCI_CHIP_SKYLAKE_ULT_GT2F 0x1921 #define PCI_CHIP_SKYLAKE_ULX_GT1 0x190E #define PCI_CHIP_SKYLAKE_ULX_GT2 0x191E #define PCI_CHIP_SKYLAKE_DT_GT2 0x1912 #define PCI_CHIP_SKYLAKE_DT_GT1 0x1902 #define PCI_CHIP_SKYLAKE_HALO_GT2 0x191B #define PCI_CHIP_SKYLAKE_HALO_GT3 0x192B #define PCI_CHIP_SKYLAKE_HALO_GT1 0x190B #define PCI_CHIP_SKYLAKE_SRV_GT2 0x191A #define PCI_CHIP_SKYLAKE_SRV_GT3 0x192A #define PCI_CHIP_SKYLAKE_SRV_GT1 0x190A #define PCI_CHIP_SKYLAKE_WKS_GT2 0x191D #define PCI_CHIP_BROXTON_0 0x0A84 #define PCI_CHIP_BROXTON_1 0x1A84 #define PCI_CHIP_BROXTON_2 0x5A84 #endif /* __GTK_DOC_IGNORE__ */ #define IS_MOBILE(devid) ((devid) == PCI_CHIP_I855_GM || \ (devid) == PCI_CHIP_I915_GM || \ (devid) == PCI_CHIP_I945_GM || \ (devid) == PCI_CHIP_I945_GME || \ (devid) == PCI_CHIP_I965_GM || \ (devid) == PCI_CHIP_I965_GME || \ (devid) == PCI_CHIP_GM45_GM || IS_IGD(devid) || \ (devid) == PCI_CHIP_IVYBRIDGE_M_GT1 || \ (devid) == PCI_CHIP_IVYBRIDGE_M_GT2) #define IS_G45(devid) ((devid) == PCI_CHIP_IGD_E_G || \ (devid) == PCI_CHIP_Q45_G || \ (devid) == PCI_CHIP_G45_G || \ (devid) == PCI_CHIP_G41_G) #define IS_GM45(devid) ((devid) == PCI_CHIP_GM45_GM) #define IS_G4X(devid) (IS_G45(devid) || IS_GM45(devid)) #define IS_ILD(devid) ((devid) == PCI_CHIP_ILD_G) #define IS_ILM(devid) ((devid) == PCI_CHIP_ILM_G) #define IS_915(devid) ((devid) == PCI_CHIP_I915_G || \ (devid) == PCI_CHIP_E7221_G || \ (devid) == PCI_CHIP_I915_GM) #define IS_945GM(devid) ((devid) == PCI_CHIP_I945_GM || \ (devid) == PCI_CHIP_I945_GME) #define IS_945(devid) ((devid) == PCI_CHIP_I945_G || \ (devid) == PCI_CHIP_I945_GM || \ (devid) == PCI_CHIP_I945_GME || \ IS_G33(devid)) #define IS_G33(devid) ((devid) == PCI_CHIP_G33_G || \ (devid) == PCI_CHIP_Q33_G || \ (devid) == PCI_CHIP_Q35_G || IS_IGD(devid)) #define IS_GEN2(devid) ((devid) == PCI_CHIP_I830_M || \ (devid) == PCI_CHIP_845_G || \ (devid) == PCI_CHIP_I855_GM || \ (devid) == PCI_CHIP_I865_G) #define IS_GEN3(devid) (IS_945(devid) || IS_915(devid)) #define IS_GEN4(devid) ((devid) == PCI_CHIP_I965_G || \ (devid) == PCI_CHIP_I965_Q || \ (devid) == PCI_CHIP_I965_G_1 || \ (devid) == PCI_CHIP_I965_GM || \ (devid) == PCI_CHIP_I965_GME || \ (devid) == PCI_CHIP_I946_GZ || \ IS_G4X(devid)) #define IS_GEN5(devid) (IS_ILD(devid) || IS_ILM(devid)) #define IS_GEN6(devid) ((devid) == PCI_CHIP_SANDYBRIDGE_GT1 || \ (devid) == PCI_CHIP_SANDYBRIDGE_GT2 || \ (devid) == PCI_CHIP_SANDYBRIDGE_GT2_PLUS || \ (devid) == PCI_CHIP_SANDYBRIDGE_M_GT1 || \ (devid) == PCI_CHIP_SANDYBRIDGE_M_GT2 || \ (devid) == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS || \ (devid) == PCI_CHIP_SANDYBRIDGE_S) #define IS_GEN7(devid) (IS_IVYBRIDGE(devid) || \ IS_HASWELL(devid) || \ IS_VALLEYVIEW(devid)) #define IS_IVYBRIDGE(devid) ((devid) == PCI_CHIP_IVYBRIDGE_GT1 || \ (devid) == PCI_CHIP_IVYBRIDGE_GT2 || \ (devid) == PCI_CHIP_IVYBRIDGE_M_GT1 || \ (devid) == PCI_CHIP_IVYBRIDGE_M_GT2 || \ (devid) == PCI_CHIP_IVYBRIDGE_S || \ (devid) == PCI_CHIP_IVYBRIDGE_S_GT2) #define IS_VALLEYVIEW(devid) ((devid) == PCI_CHIP_VALLEYVIEW_PO || \ (devid) == PCI_CHIP_VALLEYVIEW_1 || \ (devid) == PCI_CHIP_VALLEYVIEW_2 || \ (devid) == PCI_CHIP_VALLEYVIEW_3) #define IS_HSW_GT1(devid) ((devid) == PCI_CHIP_HASWELL_GT1 || \ (devid) == PCI_CHIP_HASWELL_M_GT1 || \ (devid) == PCI_CHIP_HASWELL_S_GT1 || \ (devid) == PCI_CHIP_HASWELL_B_GT1 || \ (devid) == PCI_CHIP_HASWELL_E_GT1 || \ (devid) == PCI_CHIP_HASWELL_SDV_GT1 || \ (devid) == PCI_CHIP_HASWELL_SDV_M_GT1 || \ (devid) == PCI_CHIP_HASWELL_SDV_S_GT1 || \ (devid) == PCI_CHIP_HASWELL_SDV_B_GT1 || \ (devid) == PCI_CHIP_HASWELL_SDV_E_GT1 || \ (devid) == PCI_CHIP_HASWELL_ULT_GT1 || \ (devid) == PCI_CHIP_HASWELL_ULT_M_GT1 || \ (devid) == PCI_CHIP_HASWELL_ULT_S_GT1 || \ (devid) == PCI_CHIP_HASWELL_ULT_B_GT1 || \ (devid) == PCI_CHIP_HASWELL_ULT_E_GT1 || \ (devid) == PCI_CHIP_HASWELL_CRW_GT1 || \ (devid) == PCI_CHIP_HASWELL_CRW_M_GT1 || \ (devid) == PCI_CHIP_HASWELL_CRW_S_GT1 || \ (devid) == PCI_CHIP_HASWELL_CRW_B_GT1 || \ (devid) == PCI_CHIP_HASWELL_CRW_E_GT1) #define IS_HSW_GT2(devid) ((devid) == PCI_CHIP_HASWELL_GT2 || \ (devid) == PCI_CHIP_HASWELL_M_GT2 || \ (devid) == PCI_CHIP_HASWELL_S_GT2 || \ (devid) == PCI_CHIP_HASWELL_B_GT2 || \ (devid) == PCI_CHIP_HASWELL_E_GT2 || \ (devid) == PCI_CHIP_HASWELL_SDV_GT2 || \ (devid) == PCI_CHIP_HASWELL_SDV_M_GT2 || \ (devid) == PCI_CHIP_HASWELL_SDV_S_GT2 || \ (devid) == PCI_CHIP_HASWELL_SDV_B_GT2 || \ (devid) == PCI_CHIP_HASWELL_SDV_E_GT2 || \ (devid) == PCI_CHIP_HASWELL_ULT_GT2 || \ (devid) == PCI_CHIP_HASWELL_ULT_M_GT2 || \ (devid) == PCI_CHIP_HASWELL_ULT_S_GT2 || \ (devid) == PCI_CHIP_HASWELL_ULT_B_GT2 || \ (devid) == PCI_CHIP_HASWELL_ULT_E_GT2 || \ (devid) == PCI_CHIP_HASWELL_CRW_GT2 || \ (devid) == PCI_CHIP_HASWELL_CRW_M_GT2 || \ (devid) == PCI_CHIP_HASWELL_CRW_S_GT2 || \ (devid) == PCI_CHIP_HASWELL_CRW_B_GT2 || \ (devid) == PCI_CHIP_HASWELL_CRW_E_GT2) #define IS_HSW_GT3(devid) ((devid) == PCI_CHIP_HASWELL_GT3 || \ (devid) == PCI_CHIP_HASWELL_M_GT3 || \ (devid) == PCI_CHIP_HASWELL_S_GT3 || \ (devid) == PCI_CHIP_HASWELL_B_GT3 || \ (devid) == PCI_CHIP_HASWELL_E_GT3 || \ (devid) == PCI_CHIP_HASWELL_SDV_GT3 || \ (devid) == PCI_CHIP_HASWELL_SDV_M_GT3 || \ (devid) == PCI_CHIP_HASWELL_SDV_S_GT3 || \ (devid) == PCI_CHIP_HASWELL_SDV_B_GT3 || \ (devid) == PCI_CHIP_HASWELL_SDV_E_GT3 || \ (devid) == PCI_CHIP_HASWELL_ULT_GT3 || \ (devid) == PCI_CHIP_HASWELL_ULT_M_GT3 || \ (devid) == PCI_CHIP_HASWELL_ULT_S_GT3 || \ (devid) == PCI_CHIP_HASWELL_ULT_B_GT3 || \ (devid) == PCI_CHIP_HASWELL_ULT_E_GT3 || \ (devid) == PCI_CHIP_HASWELL_CRW_GT3 || \ (devid) == PCI_CHIP_HASWELL_CRW_M_GT3 || \ (devid) == PCI_CHIP_HASWELL_CRW_S_GT3 || \ (devid) == PCI_CHIP_HASWELL_CRW_B_GT3 || \ (devid) == PCI_CHIP_HASWELL_CRW_E_GT3) #define IS_HASWELL(devid) (IS_HSW_GT1(devid) || \ IS_HSW_GT2(devid) || \ IS_HSW_GT3(devid)) #define IS_BROADWELL(devid) ((((devid) & 0xff00) != 0x1600) ? 0 : \ ((((devid) & 0x00f0) >> 4) > 3) ? 0 : \ (((devid) & 0x000f) == BDW_SPARE) ? 1 : \ (((devid) & 0x000f) == BDW_ULT) ? 1 : \ (((devid) & 0x000f) == BDW_IRIS) ? 1 : \ (((devid) & 0x000f) == BDW_SERVER) ? 1 : \ (((devid) & 0x000f) == BDW_WORKSTATION) ? 1 : \ (((devid) & 0x000f) == BDW_ULX) ? 1 : 0) #define IS_CHERRYVIEW(devid) ((devid) == PCI_CHIP_CHERRYVIEW_0 || \ (devid) == PCI_CHIP_CHERRYVIEW_1 || \ (devid) == PCI_CHIP_CHERRYVIEW_2 || \ (devid) == PCI_CHIP_CHERRYVIEW_3) #define IS_GEN8(devid) (IS_BROADWELL(devid) || \ IS_CHERRYVIEW(devid)) #define IS_SKL_GT1(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT1 || \ (devid) == PCI_CHIP_SKYLAKE_ULX_GT1 || \ (devid) == PCI_CHIP_SKYLAKE_DT_GT1 || \ (devid) == PCI_CHIP_SKYLAKE_HALO_GT1 || \ (devid) == PCI_CHIP_SKYLAKE_SRV_GT1) #define IS_SKL_GT2(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT2 || \ (devid) == PCI_CHIP_SKYLAKE_ULT_GT2F || \ (devid) == PCI_CHIP_SKYLAKE_ULX_GT2 || \ (devid) == PCI_CHIP_SKYLAKE_DT_GT2 || \ (devid) == PCI_CHIP_SKYLAKE_HALO_GT2 || \ (devid) == PCI_CHIP_SKYLAKE_SRV_GT2 || \ (devid) == PCI_CHIP_SKYLAKE_WKS_GT2) #define IS_SKL_GT3(devid) ((devid) == PCI_CHIP_SKYLAKE_ULT_GT3 || \ (devid) == PCI_CHIP_SKYLAKE_HALO_GT3 || \ (devid) == PCI_CHIP_SKYLAKE_SRV_GT3) #define IS_SKYLAKE(devid) (IS_SKL_GT1(devid) || \ IS_SKL_GT2(devid) || \ IS_SKL_GT3(devid)) #define IS_BROXTON(devid) ((devid) == PCI_CHIP_BROXTON_0 || \ (devid) == PCI_CHIP_BROXTON_1 || \ (devid) == PCI_CHIP_BROXTON_2) #define IS_GEN9(devid) (IS_SKYLAKE(devid) || \ IS_BROXTON(devid)) #define IS_965(devid) (IS_GEN4(devid) || \ IS_GEN5(devid) || \ IS_GEN6(devid) || \ IS_GEN7(devid) || \ IS_GEN8(devid)) #define IS_9XX(devid) (IS_GEN3(devid) || \ IS_GEN4(devid) || \ IS_GEN5(devid) || \ IS_GEN6(devid) || \ IS_GEN7(devid) || \ IS_GEN8(devid) || \ IS_GEN9(devid)) #define IS_INTEL(devid) (IS_GEN2(devid) || \ IS_GEN3(devid) || \ IS_GEN4(devid) || \ IS_GEN5(devid) || \ IS_GEN6(devid) || \ IS_GEN7(devid) || \ IS_GEN8(devid)) #define HAS_PCH_SPLIT(devid) (IS_GEN5(devid) || \ IS_GEN6(devid) || \ IS_IVYBRIDGE(devid) || IS_HASWELL(devid) || \ IS_BROADWELL(devid) || \ IS_SKYLAKE(devid)) #define HAS_BLT_RING(devid) (IS_GEN6(devid) || \ IS_GEN7(devid) || \ IS_GEN8(devid)) #define HAS_BSD_RING(devid) (IS_GEN5(devid) || \ IS_GEN6(devid) || \ IS_GEN7(devid) || \ IS_GEN8(devid)) #define IS_BROADWATER(devid) ((devid) == PCI_CHIP_I946_GZ || \ (devid) == PCI_CHIP_I965_G_1 || \ (devid) == PCI_CHIP_I965_Q || \ (devid) == PCI_CHIP_I965_G) #define IS_CRESTLINE(devid) ((devid) == PCI_CHIP_I965_GM || \ (devid) == PCI_CHIP_I965_GME) #define HAS_VEBOX_RING(devid) (IS_HASWELL(devid)) #endif /* _INTEL_CHIPSET_H */ ================================================ FILE: AppleIntelRegisterDumper/intel_reg.h ================================================ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ /** @file * Register names and fields for Intel graphics. */ /* * Authors: * Keith Whitwell * Eric Anholt * * based on the i740 driver by * Kevin E. Martin * */ #ifndef _I810_REG_H #define _I810_REG_H /* I/O register offsets */ #define SRX 0x3C4 /* p208 */ #define GRX 0x3CE /* p213 */ #define ARX 0x3C0 /* p224 */ /* VGA Color Palette Registers */ #define DACMASK 0x3C6 /* p232 */ #define DACSTATE 0x3C7 /* p232 */ #define DACRX 0x3C7 /* p233 */ #define DACWX 0x3C8 /* p233 */ #define DACDATA 0x3C9 /* p233 */ /* CRT Controller Registers (CRX) */ #define START_ADDR_HI 0x0C /* p246 */ #define START_ADDR_LO 0x0D /* p247 */ #define VERT_SYNC_END 0x11 /* p249 */ #define EXT_VERT_TOTAL 0x30 /* p257 */ #define EXT_VERT_DISPLAY 0x31 /* p258 */ #define EXT_VERT_SYNC_START 0x32 /* p259 */ #define EXT_VERT_BLANK_START 0x33 /* p260 */ #define EXT_HORIZ_TOTAL 0x35 /* p261 */ #define EXT_HORIZ_BLANK 0x39 /* p261 */ #define EXT_START_ADDR 0x40 /* p262 */ #define EXT_START_ADDR_ENABLE 0x80 #define EXT_OFFSET 0x41 /* p263 */ #define EXT_START_ADDR_HI 0x42 /* p263 */ #define INTERLACE_CNTL 0x70 /* p264 */ #define INTERLACE_ENABLE 0x80 #define INTERLACE_DISABLE 0x00 /* Miscellaneous Output Register */ #define MSR_R 0x3CC /* p207 */ #define MSR_W 0x3C2 /* p207 */ #define IO_ADDR_SELECT 0x01 #define MDA_BASE 0x3B0 /* p207 */ #define CGA_BASE 0x3D0 /* p207 */ /* CR80 - IO Control, p264 */ #define IO_CTNL 0x80 #define EXTENDED_ATTR_CNTL 0x02 #define EXTENDED_CRTC_CNTL 0x01 /* GR10 - Address mapping, p221 */ #define ADDRESS_MAPPING 0x10 #define PAGE_TO_LOCAL_MEM_ENABLE 0x10 #define GTT_MEM_MAP_ENABLE 0x08 #define PACKED_MODE_ENABLE 0x04 #define LINEAR_MODE_ENABLE 0x02 #define PAGE_MAPPING_ENABLE 0x01 #define HOTKEY_VBIOS_SWITCH_BLOCK 0x80 #define HOTKEY_SWITCH 0x20 #define HOTKEY_TOGGLE 0x10 /* Blitter control, p378 */ #define BITBLT_CNTL 0x7000c #define COLEXP_MODE 0x30 #define COLEXP_8BPP 0x00 #define COLEXP_16BPP 0x10 #define COLEXP_24BPP 0x20 #define COLEXP_RESERVED 0x30 #define BITBLT_STATUS 0x01 #define CHDECMISC 0x10111 #define DCC 0x10200 #define C0DRB0 0x10200 #define C0DRB1 0x10202 #define C0DRB2 0x10204 #define C0DRB3 0x10206 #define C0DRA01 0x10208 #define C0DRA23 0x1020a #define C1DRB0 0x10600 #define C1DRB1 0x10602 #define C1DRB2 0x10604 #define C1DRB3 0x10606 #define C1DRA01 0x10608 #define C1DRA23 0x1060a /* p375. */ #define DISPLAY_CNTL 0x70008 #define VGA_WRAP_MODE 0x02 #define VGA_WRAP_AT_256KB 0x00 #define VGA_NO_WRAP 0x02 #define GUI_MODE 0x01 #define STANDARD_VGA_MODE 0x00 #define HIRES_MODE 0x01 /* p375 */ #define PIXPIPE_CONFIG_0 0x70009 #define DAC_8_BIT 0x80 #define DAC_6_BIT 0x00 #define HW_CURSOR_ENABLE 0x10 #define EXTENDED_PALETTE 0x01 /* p375 */ #define PIXPIPE_CONFIG_1 0x7000a #define DISPLAY_COLOR_MODE 0x0F #define DISPLAY_VGA_MODE 0x00 #define DISPLAY_8BPP_MODE 0x02 #define DISPLAY_15BPP_MODE 0x04 #define DISPLAY_16BPP_MODE 0x05 #define DISPLAY_24BPP_MODE 0x06 #define DISPLAY_32BPP_MODE 0x07 /* p375 */ #define PIXPIPE_CONFIG_2 0x7000b #define DISPLAY_GAMMA_ENABLE 0x08 #define DISPLAY_GAMMA_DISABLE 0x00 #define OVERLAY_GAMMA_ENABLE 0x04 #define OVERLAY_GAMMA_DISABLE 0x00 /* p380 */ #define DISPLAY_BASE 0x70020 #define DISPLAY_BASE_MASK 0x03fffffc /* Cursor control registers, pp383-384 */ /* Desktop (845G, 865G) */ #define CURSOR_CONTROL 0x70080 #define CURSOR_ENABLE 0x80000000 #define CURSOR_GAMMA_ENABLE 0x40000000 #define CURSOR_STRIDE_MASK 0x30000000 #define CURSOR_FORMAT_SHIFT 24 #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT) #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT) #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT) #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT) #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT) #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT) /* Mobile and i810 */ #define CURSOR_A_CONTROL CURSOR_CONTROL #define CURSOR_ORIGIN_SCREEN 0x00 /* i810 only */ #define CURSOR_ORIGIN_DISPLAY 0x1 /* i810 only */ #define CURSOR_MODE 0x27 #define CURSOR_MODE_DISABLE 0x00 #define CURSOR_MODE_32_4C_AX 0x01 /* i810 only */ #define CURSOR_MODE_64_3C 0x04 #define CURSOR_MODE_64_4C_AX 0x05 #define CURSOR_MODE_64_4C 0x06 #define CURSOR_MODE_64_32B_AX 0x07 #define CURSOR_MODE_64_ARGB_AX (0x20 | CURSOR_MODE_64_32B_AX) #define MCURSOR_PIPE_SELECT (1 << 28) #define MCURSOR_PIPE_A 0x00 #define MCURSOR_PIPE_B (1 << 28) #define MCURSOR_GAMMA_ENABLE (1 << 26) #define MCURSOR_MEM_TYPE_LOCAL (1 << 25) #define CURSOR_BASEADDR 0x70084 #define CURSOR_A_BASE CURSOR_BASEADDR #define CURSOR_BASEADDR_MASK 0x1FFFFF00 #define CURSOR_A_POSITION 0x70088 #define CURSOR_POS_SIGN 0x8000 #define CURSOR_POS_MASK 0x007FF #define CURSOR_X_SHIFT 0 #define CURSOR_Y_SHIFT 16 #define CURSOR_X_LO 0x70088 #define CURSOR_X_HI 0x70089 #define CURSOR_X_POS 0x00 #define CURSOR_X_NEG 0x80 #define CURSOR_Y_LO 0x7008A #define CURSOR_Y_HI 0x7008B #define CURSOR_Y_POS 0x00 #define CURSOR_Y_NEG 0x80 #define CURSOR_A_PALETTE0 0x70090 #define CURSOR_A_PALETTE1 0x70094 #define CURSOR_A_PALETTE2 0x70098 #define CURSOR_A_PALETTE3 0x7009C #define CURSOR_SIZE 0x700A0 #define CURSOR_SIZE_MASK 0x3FF #define CURSOR_SIZE_HSHIFT 0 #define CURSOR_SIZE_VSHIFT 12 #define CURSOR_B_CONTROL 0x700C0 #define CURSOR_B_BASE 0x700C4 #define CURSOR_B_POSITION 0x700C8 #define CURSOR_B_PALETTE0 0x700D0 #define CURSOR_B_PALETTE1 0x700D4 #define CURSOR_B_PALETTE2 0x700D8 #define CURSOR_B_PALETTE3 0x700DC /* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm * not sure they refer to local (graphics) memory. * * These details are for the local memory control registers, * (pp301-310). The test machines are not equiped with local memory, * so nothing is tested. Only a single row seems to be supported. */ #define DRAM_ROW_TYPE 0x3000 #define DRAM_ROW_0 0x01 #define DRAM_ROW_0_SDRAM 0x01 #define DRAM_ROW_0_EMPTY 0x00 #define DRAM_ROW_CNTL_LO 0x3001 #define DRAM_PAGE_MODE_CTRL 0x10 #define DRAM_RAS_TO_CAS_OVRIDE 0x08 #define DRAM_CAS_LATENCY 0x04 #define DRAM_RAS_TIMING 0x02 #define DRAM_RAS_PRECHARGE 0x01 #define DRAM_ROW_CNTL_HI 0x3002 #define DRAM_REFRESH_RATE 0x18 #define DRAM_REFRESH_DISABLE 0x00 #define DRAM_REFRESH_60HZ 0x08 #define DRAM_REFRESH_FAST_TEST 0x10 #define DRAM_REFRESH_RESERVED 0x18 #define DRAM_SMS 0x07 #define DRAM_SMS_NORMAL 0x00 #define DRAM_SMS_NOP_ENABLE 0x01 #define DRAM_SMS_ABPCE 0x02 #define DRAM_SMS_MRCE 0x03 #define DRAM_SMS_CBRCE 0x04 /* p307 */ #define DPMS_SYNC_SELECT 0x5002 #define VSYNC_CNTL 0x08 #define VSYNC_ON 0x00 #define VSYNC_OFF 0x08 #define HSYNC_CNTL 0x02 #define HSYNC_ON 0x00 #define HSYNC_OFF 0x02 #define GPIOA 0x5010 #define GPIOB 0x5014 #define GPIOC 0x5018 #define GPIOD 0x501c #define GPIOE 0x5020 #define GPIOF 0x5024 #define GPIOG 0x5028 #define GPIOH 0x502c # define GPIO_CLOCK_DIR_MASK (1 << 0) # define GPIO_CLOCK_DIR_IN (0 << 1) # define GPIO_CLOCK_DIR_OUT (1 << 1) # define GPIO_CLOCK_VAL_MASK (1 << 2) # define GPIO_CLOCK_VAL_OUT (1 << 3) # define GPIO_CLOCK_VAL_IN (1 << 4) # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5) # define GPIO_DATA_DIR_MASK (1 << 8) # define GPIO_DATA_DIR_IN (0 << 9) # define GPIO_DATA_DIR_OUT (1 << 9) # define GPIO_DATA_VAL_MASK (1 << 10) # define GPIO_DATA_VAL_OUT (1 << 11) # define GPIO_DATA_VAL_IN (1 << 12) # define GPIO_DATA_PULLUP_DISABLE (1 << 13) /* GMBus registers for hardware-assisted (non-bitbanging) I2C access */ #define GMBUS0 0x5100 #define GMBUS1 0x5104 #define GMBUS2 0x5108 #define GMBUS3 0x510c #define GMBUS4 0x5110 #define GMBUS5 0x5120 /* p317, 319 */ #define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */ #define VCLK2_VCO_N 0x600a #define VCLK2_VCO_DIV_SEL 0x6012 #define VCLK_DIVISOR_VGA0 0x6000 #define VCLK_DIVISOR_VGA1 0x6004 #define VCLK_POST_DIV 0x6010 /** Selects a post divisor of 4 instead of 2. */ # define VGA1_PD_P2_DIV_4 (1 << 15) /** Overrides the p2 post divisor field */ # define VGA1_PD_P1_DIV_2 (1 << 13) # define VGA1_PD_P1_SHIFT 8 /** P1 value is 2 greater than this field */ # define VGA1_PD_P1_MASK (0x1f << 8) /** Selects a post divisor of 4 instead of 2. */ # define VGA0_PD_P2_DIV_4 (1 << 7) /** Overrides the p2 post divisor field */ # define VGA0_PD_P1_DIV_2 (1 << 5) # define VGA0_PD_P1_SHIFT 0 /** P1 value is 2 greater than this field */ # define VGA0_PD_P1_MASK (0x1f << 0) #define POST_DIV_SELECT 0x70 #define POST_DIV_1 0x00 #define POST_DIV_2 0x10 #define POST_DIV_4 0x20 #define POST_DIV_8 0x30 #define POST_DIV_16 0x40 #define POST_DIV_32 0x50 #define VCO_LOOP_DIV_BY_4M 0x00 #define VCO_LOOP_DIV_BY_16M 0x04 /* Instruction Parser Mode Register * - p281 * - 2 new bits. */ #define INST_PM 0x20c0 #define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */ #define SYNC_PACKET_FLUSH_ENABLE 0x10 #define TWO_D_INST_DISABLE 0x08 #define THREE_D_INST_DISABLE 0x04 #define STATE_VAR_UPDATE_DISABLE 0x02 #define PAL_STIP_DISABLE 0x01 #define GEN6_GLOBAL_DEBUG_ENABLE 0x10 #define MEMMODE 0x20dc /* Instruction parser error register. p279 */ #define IPEIR 0x2088 #define IPEHR 0x208C #define INSTDONE 0x2090 #define NOP_ID 0x2094 #define SCPD0 0x209c /* debug */ #define INST_PS 0x20c4 #define IPEIR_I965 0x2064 /* i965 */ #define IPEHR_I965 0x2068 /* i965 */ #define INSTDONE_I965 0x206c #define GEN6_INSTDONE_1 0x206c #define INST_PS_I965 0x2070 /* Current active ring head address: */ #define ACTHD_I965 0x2074 #define ACTHD 0x20C8 /* Current primary/secondary DMA fetch addresses: */ #define DMA_FADD_P 0x2078 #define DMA_FADD_S 0x20d4 #define INSTDONE_1 0x207c #define GEN6_INSTDONE_2 0x207c #define CACHE_MODE_0 0x2120 #define CACHE_MODE_1 0x2124 #define MI_MODE 0x209c #define MI_DISPLAY_POWER_DOWN 0x20e0 #define MI_ARB_STATE 0x20e4 #define MI_RDRET_STATE 0x20fc /* Start addresses for each of the primary rings: */ #define PR0_STR 0x20f0 #define PR1_STR 0x20f4 #define PR2_STR 0x20f8 #define WIZ_CTL 0x7c00 #define WIZ_CTL_SINGLE_SUBSPAN (1<<6) #define WIZ_CTL_IGNORE_STALLS (1<<5) #define SVG_WORK_CTL 0x7408 #define TS_CTL 0x7e00 #define TS_MUX_ERR_CODE (0<<8) #define TS_MUX_URB_0 (1<<8) #define TS_MUX_DISPATCH_ID_0 (10<<8) #define TS_MUX_ERR_CODE_VALID (15<<8) #define TS_MUX_TID_0 (16<<8) #define TS_MUX_EUID_0 (18<<8) #define TS_MUX_FFID_0 (22<<8) #define TS_MUX_EOT (26<<8) #define TS_MUX_SIDEBAND_0 (27<<8) #define TS_SNAP_ALL_CHILD (1<<2) #define TS_SNAP_ALL_ROOT (1<<1) #define TS_SNAP_ENABLE (1<<0) #define TS_DEBUG_DATA 0x7e0c #define TD_CTL 0x8000 #define TD_CTL2 0x8004 #define ECOSKPD 0x21d0 #define EXCC 0x2028 /* I965 debug regs: */ #define IA_VERTICES_COUNT_QW 0x2310 #define IA_PRIMITIVES_COUNT_QW 0x2318 #define VS_INVOCATION_COUNT_QW 0x2320 #define GS_INVOCATION_COUNT_QW 0x2328 #define GS_PRIMITIVES_COUNT_QW 0x2330 #define CL_INVOCATION_COUNT_QW 0x2338 #define CL_PRIMITIVES_COUNT_QW 0x2340 #define PS_INVOCATION_COUNT_QW 0x2348 #define PS_DEPTH_COUNT_QW 0x2350 #define TIMESTAMP_QW 0x2358 #define CLKCMP_QW 0x2360 /* General error reporting regs, p296 */ #define EIR 0x20B0 #define EMR 0x20B4 #define ESR 0x20B8 # define ERR_VERTEX_MAX (1 << 5) /* lpt/cst */ # define ERR_PGTBL_ERROR (1 << 4) # define ERR_DISPLAY_OVERLAY_UNDERRUN (1 << 3) # define ERR_MAIN_MEMORY_REFRESH (1 << 1) # define ERR_INSTRUCTION_ERROR (1 << 0) /* Interrupt Control Registers * - new bits for i810 * - new register hwstam (mask) */ #define HWS_PGA 0x2080 #define PWRCTXA 0x2088 /* 965GM+ only */ #define PWRCTX_EN (1<<0) #define HWSTAM 0x2098 /* p290 */ #define IER 0x20a0 /* p291 */ #define IIR 0x20a4 /* p292 */ #define IMR 0x20a8 /* p293 */ #define ISR 0x20ac /* p294 */ #define HW_ERROR 0x8000 #define SYNC_STATUS_TOGGLE 0x1000 #define DPY_0_FLIP_PENDING 0x0800 #define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */ #define OVL_0_FLIP_PENDING 0x0200 #define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */ #define DPY_0_VBLANK 0x0080 #define DPY_0_EVENT 0x0040 #define DPY_1_VBLANK 0x0020 /* not implemented on i810 */ #define DPY_1_EVENT 0x0010 /* not implemented on i810 */ #define HOST_PORT_EVENT 0x0008 /* */ #define CAPTURE_EVENT 0x0004 /* */ #define USER_DEFINED 0x0002 #define BREAKPOINT 0x0001 #define INTR_RESERVED (0x6000 | \ DPY_1_FLIP_PENDING | \ OVL_1_FLIP_PENDING | \ DPY_1_VBLANK | \ DPY_1_EVENT | \ HOST_PORT_EVENT | \ CAPTURE_EVENT ) /* FIFO Watermark and Burst Length Control Register * * - different offset and contents on i810 (p299) (fewer bits per field) * - some overlay fields added * - what does it all mean? */ #define FWATER_BLC 0x20d8 #define FWATER_BLC2 0x20dc #define MM_BURST_LENGTH 0x00700000 #define MM_FIFO_WATERMARK 0x0001F000 #define LM_BURST_LENGTH 0x00000700 #define LM_FIFO_WATERMARK 0x0000001F /* Fence/Tiling ranges [0..7] */ #define FENCE 0x2000 #define FENCE_NR 8 #define FENCE_NEW 0x3000 #define FENCE_NEW_NR 16 #define FENCE_LINEAR 0 #define FENCE_XMAJOR 1 #define FENCE_YMAJOR 2 #define I915G_FENCE_START_MASK 0x0ff00000 #define I830_FENCE_START_MASK 0x07f80000 #define FENCE_START_MASK 0x03F80000 #define FENCE_X_MAJOR 0x00000000 #define FENCE_Y_MAJOR 0x00001000 #define FENCE_SIZE_MASK 0x00000700 #define FENCE_SIZE_512K 0x00000000 #define FENCE_SIZE_1M 0x00000100 #define FENCE_SIZE_2M 0x00000200 #define FENCE_SIZE_4M 0x00000300 #define FENCE_SIZE_8M 0x00000400 #define FENCE_SIZE_16M 0x00000500 #define FENCE_SIZE_32M 0x00000600 #define FENCE_SIZE_64M 0x00000700 #define I915G_FENCE_SIZE_1M 0x00000000 #define I915G_FENCE_SIZE_2M 0x00000100 #define I915G_FENCE_SIZE_4M 0x00000200 #define I915G_FENCE_SIZE_8M 0x00000300 #define I915G_FENCE_SIZE_16M 0x00000400 #define I915G_FENCE_SIZE_32M 0x00000500 #define I915G_FENCE_SIZE_64M 0x00000600 #define I915G_FENCE_SIZE_128M 0x00000700 #define I965_FENCE_X_MAJOR 0x00000000 #define I965_FENCE_Y_MAJOR 0x00000002 #define FENCE_PITCH_1 0x00000000 #define FENCE_PITCH_2 0x00000010 #define FENCE_PITCH_4 0x00000020 #define FENCE_PITCH_8 0x00000030 #define FENCE_PITCH_16 0x00000040 #define FENCE_PITCH_32 0x00000050 #define FENCE_PITCH_64 0x00000060 #define FENCE_VALID 0x00000001 #define FENCE_REG_SANDYBRIDGE_0 0x100000 /* Registers to control page table, p274 */ #define PGETBL_CTL 0x2020 #define PGETBL_ADDR_MASK 0xFFFFF000 #define PGETBL_ENABLE_MASK 0x00000001 #define PGETBL_ENABLED 0x00000001 /** Added in 965G, this field has the actual size of the global GTT */ #define PGETBL_SIZE_MASK 0x0000000e #define PGETBL_SIZE_512KB (0 << 1) #define PGETBL_SIZE_256KB (1 << 1) #define PGETBL_SIZE_128KB (2 << 1) #define PGETBL_SIZE_1MB (3 << 1) #define PGETBL_SIZE_2MB (4 << 1) #define PGETBL_SIZE_1_5MB (5 << 1) #define G33_PGETBL_SIZE_MASK (3 << 8) #define G33_PGETBL_SIZE_1M (1 << 8) #define G33_PGETBL_SIZE_2M (2 << 8) #define I830_PTE_BASE 0x10000 #define PTE_ADDRESS_MASK 0xfffff000 #define PTE_ADDRESS_MASK_HIGH 0x000000f0 /* i915+ */ #define PTE_MAPPING_TYPE_UNCACHED (0 << 1) #define PTE_MAPPING_TYPE_DCACHE (1 << 1) /* i830 only */ #define PTE_MAPPING_TYPE_CACHED (3 << 1) #define PTE_MAPPING_TYPE_MASK (3 << 1) #define PTE_VALID (1 << 0) /** @defgroup PGE_ERR * @{ */ /** Page table debug register for i845 */ #define PGE_ERR 0x2024 #define PGE_ERR_ADDR_MASK 0xFFFFF000 #define PGE_ERR_ID_MASK 0x00000038 #define PGE_ERR_CAPTURE 0x00000000 #define PGE_ERR_OVERLAY 0x00000008 #define PGE_ERR_DISPLAY 0x00000010 #define PGE_ERR_HOST 0x00000018 #define PGE_ERR_RENDER 0x00000020 #define PGE_ERR_BLITTER 0x00000028 #define PGE_ERR_MAPPING 0x00000030 #define PGE_ERR_CMD_PARSER 0x00000038 #define PGE_ERR_TYPE_MASK 0x00000007 #define PGE_ERR_INV_TABLE 0x00000000 #define PGE_ERR_INV_PTE 0x00000001 #define PGE_ERR_MIXED_TYPES 0x00000002 #define PGE_ERR_PAGE_MISS 0x00000003 #define PGE_ERR_ILLEGAL_TRX 0x00000004 #define PGE_ERR_LOCAL_MEM 0x00000005 #define PGE_ERR_TILED 0x00000006 /** @} */ /** @defgroup PGTBL_ER * @{ */ /** Page table debug register for i945 */ # define PGTBL_ER 0x2024 # define PGTBL_ERR_MT_TILING (1 << 27) # define PGTBL_ERR_MT_GTT_PTE (1 << 26) # define PGTBL_ERR_LC_TILING (1 << 25) # define PGTBL_ERR_LC_GTT_PTE (1 << 24) # define PGTBL_ERR_BIN_VERTEXDATA_GTT_PTE (1 << 23) # define PGTBL_ERR_BIN_INSTRUCTION_GTT_PTE (1 << 22) # define PGTBL_ERR_CS_VERTEXDATA_GTT_PTE (1 << 21) # define PGTBL_ERR_CS_INSTRUCTION_GTT_PTE (1 << 20) # define PGTBL_ERR_CS_GTT (1 << 19) # define PGTBL_ERR_OVERLAY_TILING (1 << 18) # define PGTBL_ERR_OVERLAY_GTT_PTE (1 << 16) # define PGTBL_ERR_DISPC_TILING (1 << 14) # define PGTBL_ERR_DISPC_GTT_PTE (1 << 12) # define PGTBL_ERR_DISPB_TILING (1 << 10) # define PGTBL_ERR_DISPB_GTT_PTE (1 << 8) # define PGTBL_ERR_DISPA_TILING (1 << 6) # define PGTBL_ERR_DISPA_GTT_PTE (1 << 4) # define PGTBL_ERR_HOST_PTE_DATA (1 << 1) # define PGTBL_ERR_HOST_GTT_PTE (1 << 0) /** @} */ /* Ring buffer registers, p277, overview p19 */ #define LP_RING 0x2030 #define HP_RING 0x2040 #define RING_TAIL 0x00 #define TAIL_ADDR 0x000FFFF8 #define I830_TAIL_MASK 0x001FFFF8 #define RING_HEAD 0x04 #define HEAD_WRAP_COUNT 0xFFE00000 #define HEAD_WRAP_ONE 0x00200000 #define HEAD_ADDR 0x001FFFFC #define I830_HEAD_MASK 0x001FFFFC #define RING_START 0x08 #define START_ADDR 0x03FFFFF8 #define I830_RING_START_MASK 0xFFFFF000 #define RING_LEN 0x0C #define RING_NR_PAGES 0x001FF000 #define I830_RING_NR_PAGES 0x001FF000 #define RING_REPORT_MASK 0x00000006 #define RING_REPORT_64K 0x00000002 #define RING_REPORT_128K 0x00000004 #define RING_NO_REPORT 0x00000000 #define RING_VALID_MASK 0x00000001 #define RING_VALID 0x00000001 #define RING_INVALID 0x00000000 /* BitBlt Instructions * * There are many more masks & ranges yet to add. */ #define BR00_BITBLT_CLIENT 0x40000000 #define BR00_OP_COLOR_BLT 0x10000000 #define BR00_OP_SRC_COPY_BLT 0x10C00000 #define BR00_OP_FULL_BLT 0x11400000 #define BR00_OP_MONO_SRC_BLT 0x11800000 #define BR00_OP_MONO_SRC_COPY_BLT 0x11000000 #define BR00_OP_MONO_PAT_BLT 0x11C00000 #define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22) #define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000 #define BR00_TPCY_DISABLE 0x00000000 #define BR00_TPCY_ENABLE 0x00000010 #define BR00_TPCY_ROP 0x00000000 #define BR00_TPCY_NO_ROP 0x00000020 #define BR00_TPCY_EQ 0x00000000 #define BR00_TPCY_NOT_EQ 0x00000040 #define BR00_PAT_MSB_FIRST 0x00000000 /* ? */ #define BR00_PAT_VERT_ALIGN 0x000000e0 #define BR00_LENGTH 0x0000000F #define BR09_DEST_ADDR 0x03FFFFFF #define BR11_SOURCE_PITCH 0x00003FFF #define BR12_SOURCE_ADDR 0x03FFFFFF #define BR13_SOLID_PATTERN 0x80000000 #define BR13_RIGHT_TO_LEFT 0x40000000 #define BR13_LEFT_TO_RIGHT 0x00000000 #define BR13_MONO_TRANSPCY 0x20000000 #define BR13_MONO_PATN_TRANS 0x10000000 #define BR13_USE_DYN_DEPTH 0x04000000 #define BR13_DYN_8BPP 0x00000000 #define BR13_DYN_16BPP 0x01000000 #define BR13_DYN_24BPP 0x02000000 #define BR13_ROP_MASK 0x00FF0000 #define BR13_DEST_PITCH 0x0000FFFF #define BR13_PITCH_SIGN_BIT 0x00008000 #define BR14_DEST_HEIGHT 0xFFFF0000 #define BR14_DEST_WIDTH 0x0000FFFF #define BR15_PATTERN_ADDR 0x03FFFFFF #define BR16_SOLID_PAT_COLOR 0x00FFFFFF #define BR16_BACKGND_PAT_CLR 0x00FFFFFF #define BR17_FGND_PAT_CLR 0x00FFFFFF #define BR18_SRC_BGND_CLR 0x00FFFFFF #define BR19_SRC_FGND_CLR 0x00FFFFFF /* Instruction parser instructions */ #define INST_PARSER_CLIENT 0x00000000 #define INST_OP_FLUSH 0x02000000 #define INST_FLUSH_MAP_CACHE 0x00000001 #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) /* Registers in the i810 host-pci bridge pci config space which affect * the i810 graphics operations. */ #define SMRAM_MISCC 0x70 #define GMS 0x000000c0 #define GMS_DISABLE 0x00000000 #define GMS_ENABLE_BARE 0x00000040 #define GMS_ENABLE_512K 0x00000080 #define GMS_ENABLE_1M 0x000000c0 #define USMM 0x00000030 #define USMM_DISABLE 0x00000000 #define USMM_TSEG_ZERO 0x00000010 #define USMM_TSEG_512K 0x00000020 #define USMM_TSEG_1M 0x00000030 #define GFX_MEM_WIN_SIZE 0x00010000 #define GFX_MEM_WIN_32M 0x00010000 #define GFX_MEM_WIN_64M 0x00000000 /* Overkill? I don't know. Need to figure out top of mem to make the * SMRAM calculations come out. Linux seems to have problems * detecting it all on its own, so this seems a reasonable double * check to any user supplied 'mem=...' boot param. * * ... unfortunately this reg doesn't work according to spec on the * test hardware. */ #define WHTCFG_PAMR_DRP 0x50 #define SYS_DRAM_ROW_0_SHIFT 16 #define SYS_DRAM_ROW_1_SHIFT 20 #define DRAM_MASK 0x0f #define DRAM_VALUE_0 0 #define DRAM_VALUE_1 8 /* No 2 value defined */ #define DRAM_VALUE_3 16 #define DRAM_VALUE_4 16 #define DRAM_VALUE_5 24 #define DRAM_VALUE_6 32 #define DRAM_VALUE_7 32 #define DRAM_VALUE_8 48 #define DRAM_VALUE_9 64 #define DRAM_VALUE_A 64 #define DRAM_VALUE_B 96 #define DRAM_VALUE_C 128 #define DRAM_VALUE_D 128 #define DRAM_VALUE_E 192 #define DRAM_VALUE_F 256 /* nice one, geezer */ #define LM_FREQ_MASK 0x10 #define LM_FREQ_133 0x10 #define LM_FREQ_100 0x00 /* These are 3d state registers, but the state is invarient, so we let * the X server handle it: */ /* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135 */ #define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1) #define CC1_UPDATE_KILL_WRITE (1<<28) #define CC1_ENABLE_KILL_WRITE (1<<27) #define CC1_DISABLE_KILL_WRITE 0 #define CC1_UPDATE_COLOR_IDX (1<<26) #define CC1_UPDATE_CHROMA_LOW (1<<25) #define CC1_UPDATE_CHROMA_HI (1<<24) #define CC1_CHROMA_LOW_MASK ((1<<24)-1) #define CC2_COLOR_IDX_SHIFT 24 #define CC2_COLOR_IDX_MASK (0xff<<24) #define CC2_CHROMA_HI_MASK ((1<<24)-1) #define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23)) #define CS_UPDATE_LOAD (1<<17) #define CS_UPDATE_USE (1<<16) #define CS_UPDATE_LOAD (1<<17) #define CS_LOAD_CTX0 0 #define CS_LOAD_CTX1 (1<<8) #define CS_USE_CTX0 0 #define CS_USE_CTX1 (1<<0) /* I810 LCD/TV registers */ #define LCD_TV_HTOTAL 0x60000 #define LCD_TV_C 0x60018 #define LCD_TV_OVRACT 0x6001C #define LCD_TV_ENABLE (1 << 31) #define LCD_TV_VGAMOD (1 << 28) /* I830 CRTC registers */ #define HTOTAL_A 0x60000 #define HBLANK_A 0x60004 #define HSYNC_A 0x60008 #define VTOTAL_A 0x6000c #define VBLANK_A 0x60010 #define VSYNC_A 0x60014 #define PIPEASRC 0x6001c #define BCLRPAT_A 0x60020 #define VSYNCSHIFT_A 0x60028 #define HTOTAL_B 0x61000 #define HBLANK_B 0x61004 #define HSYNC_B 0x61008 #define VTOTAL_B 0x6100c #define VBLANK_B 0x61010 #define VSYNC_B 0x61014 #define PIPEBSRC 0x6101c #define BCLRPAT_B 0x61020 #define VSYNCSHIFT_B 0x61028 #define HTOTAL_C 0x62000 #define HBLANK_C 0x62004 #define HSYNC_C 0x62008 #define VTOTAL_C 0x6200c #define VBLANK_C 0x62010 #define VSYNC_C 0x62014 #define PIPECSRC 0x6201c #define BCLRPAT_C 0x62020 #define VSYNCSHIFT_C 0x62028 #define HTOTAL_EDP 0x6F000 #define HBLANK_EDP 0x6F004 #define HSYNC_EDP 0x6F008 #define VTOTAL_EDP 0x6F00c #define VBLANK_EDP 0x6F010 #define VSYNC_EDP 0x6F014 #define VSYNCSHIFT_EDP 0x6F028 #define PP_STATUS 0x61200 # define PP_ON (1 << 31) /** * Indicates that all dependencies of the panel are on: * * - PLL enabled * - pipe enabled * - LVDS/DVOB/DVOC on */ # define PP_READY (1 << 30) # define PP_SEQUENCE_NONE (0 << 28) # define PP_SEQUENCE_ON (1 << 28) # define PP_SEQUENCE_OFF (2 << 28) # define PP_SEQUENCE_MASK 0x30000000 #define PP_CONTROL 0x61204 # define POWER_DOWN_ON_RESET (1 << 1) # define POWER_TARGET_ON (1 << 0) #define PP_ON_DELAYS 0x61208 #define PP_OFF_DELAYS 0x6120c #define PP_DIVISOR 0x61210 #define PFIT_CONTROL 0x61230 # define PFIT_ENABLE (1 << 31) /* Pre-965 */ # define VERT_INTERP_DISABLE (0 << 10) # define VERT_INTERP_BILINEAR (1 << 10) # define VERT_INTERP_MASK (3 << 10) # define VERT_AUTO_SCALE (1 << 9) # define HORIZ_INTERP_DISABLE (0 << 6) # define HORIZ_INTERP_BILINEAR (1 << 6) # define HORIZ_INTERP_MASK (3 << 6) # define HORIZ_AUTO_SCALE (1 << 5) # define PANEL_8TO6_DITHER_ENABLE (1 << 3) /* 965+ */ # define PFIT_PIPE_MASK (3 << 29) # define PFIT_PIPE_SHIFT 29 # define PFIT_SCALING_MODE_MASK (7 << 26) # define PFIT_SCALING_AUTO (0 << 26) # define PFIT_SCALING_PROGRAMMED (1 << 26) # define PFIT_SCALING_PILLAR (2 << 26) # define PFIT_SCALING_LETTER (3 << 26) # define PFIT_FILTER_SELECT_MASK (3 << 24) # define PFIT_FILTER_FUZZY (0 << 24) # define PFIT_FILTER_CRISP (1 << 24) # define PFIT_FILTER_MEDIAN (2 << 24) #define PFIT_PGM_RATIOS 0x61234 /* Pre-965 */ # define PFIT_VERT_SCALE_SHIFT 20 # define PFIT_VERT_SCALE_MASK 0xfff00000 # define PFIT_HORIZ_SCALE_SHIFT 4 # define PFIT_HORIZ_SCALE_MASK 0x0000fff0 /* 965+ */ # define PFIT_VERT_SCALE_SHIFT_965 16 # define PFIT_VERT_SCALE_MASK_965 0x1fff0000 # define PFIT_HORIZ_SCALE_SHIFT_965 0 # define PFIT_HORIZ_SCALE_MASK_965 0x00001fff #define DPLL_A 0x06014 #define DPLL_B 0x06018 # define DPLL_VCO_ENABLE (1 << 31) # define DPLL_DVO_HIGH_SPEED (1 << 30) # define DPLL_SYNCLOCK_ENABLE (1 << 29) # define DPLL_VGA_MODE_DIS (1 << 28) # define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */ # define DPLLB_MODE_LVDS (2 << 26) /* i915 */ # define DPLL_MODE_MASK (3 << 26) # define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */ # define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */ # define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */ # define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */ # define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */ # define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */ # define DPLL_FPA01_P1_POST_DIV_MASK_IGD 0x00ff8000 /* IGD */ /** * The i830 generation, in DAC/serial mode, defines p1 as two plus this * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set. */ # define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000 /** * The i830 generation, in LVDS mode, defines P1 as the bit number set within * this field (only one bit may be set). */ # define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000 # define DPLL_FPA01_P1_POST_DIV_SHIFT 16 # define DPLL_FPA01_P1_POST_DIV_SHIFT_IGD 15 # define PLL_P2_DIVIDE_BY_4 (1 << 23) /* i830, required in DVO non-gang */ # define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */ # define PLL_REF_INPUT_DREFCLK (0 << 13) # define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */ # define PLL_REF_INPUT_SUPER_SSC (1 << 13) /* Ironlake: 120M SSC */ # define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */ # define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13) # define PLL_REF_INPUT_MASK (3 << 13) # define PLL_REF_INPUT_DMICLK (5 << 13) /* Ironlake: DMI refclk */ # define PLL_LOAD_PULSE_PHASE_SHIFT 9 /* * Parallel to Serial Load Pulse phase selection. * Selects the phase for the 10X DPLL clock for the PCIe * digital display port. The range is 4 to 13; 10 or more * is just a flip delay. The default is 6 */ # define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT) # define DISPLAY_RATE_SELECT_FPA1 (1 << 8) /* Ironlake */ # define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT 9 # define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK (7 << 9) # define PLL_REF_SDVO_HDMI_MULTIPLIER(x) (((x)-1)<< PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT) # define DPLL_FPA1_P1_POST_DIV_SHIFT 0 # define DPLL_FPA1_P1_POST_DIV_MASK 0xff /** * SDVO multiplier for 945G/GM. Not used on 965. * * \sa DPLL_MD_UDI_MULTIPLIER_MASK */ # define SDVO_MULTIPLIER_MASK 0x000000ff # define SDVO_MULTIPLIER_SHIFT_HIRES 4 # define SDVO_MULTIPLIER_SHIFT_VGA 0 /** @defgroup DPLL_MD * @{ */ /** Pipe A SDVO/UDI clock multiplier/divider register for G965. */ #define DPLL_A_MD 0x0601c /** Pipe B SDVO/UDI clock multiplier/divider register for G965. */ #define DPLL_B_MD 0x06020 /** * UDI pixel divider, controlling how many pixels are stuffed into a packet. * * Value is pixels minus 1. Must be set to 1 pixel for SDVO. */ # define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000 # define DPLL_MD_UDI_DIVIDER_SHIFT 24 /** UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */ # define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000 # define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16 /** * SDVO/UDI pixel multiplier. * * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus * clock rate is 10 times the DPLL clock. At low resolution/refresh rate * modes, the bus rate would be below the limits, so SDVO allows for stuffing * dummy bytes in the datastream at an increased clock rate, with both sides of * the link knowing how many bytes are fill. * * So, for a mode with a dotclock of 65Mhz, we would want to double the clock * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be * set to 130Mhz, and the SDVO multiplier set to 2x in this register and * through an SDVO command. * * This register field has values of multiplication factor minus 1, with * a maximum multiplier of 5 for SDVO. */ # define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00 # define DPLL_MD_UDI_MULTIPLIER_SHIFT 8 /** SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK. * This best be set to the default value (3) or the CRT won't work. No, * I don't entirely understand what this does... */ # define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f # define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0 /** @} */ #define DPLL_TEST 0x606c # define DPLLB_TEST_SDVO_DIV_1 (0 << 22) # define DPLLB_TEST_SDVO_DIV_2 (1 << 22) # define DPLLB_TEST_SDVO_DIV_4 (2 << 22) # define DPLLB_TEST_SDVO_DIV_MASK (3 << 22) # define DPLLB_TEST_N_BYPASS (1 << 19) # define DPLLB_TEST_M_BYPASS (1 << 18) # define DPLLB_INPUT_BUFFER_ENABLE (1 << 16) # define DPLLA_TEST_N_BYPASS (1 << 3) # define DPLLA_TEST_M_BYPASS (1 << 2) # define DPLLA_INPUT_BUFFER_ENABLE (1 << 0) #define D_STATE 0x6104 #define DSPCLK_GATE_D 0x6200 # define DPUNIT_B_CLOCK_GATE_DISABLE (1 << 30) /* 965 */ # define VSUNIT_CLOCK_GATE_DISABLE (1 << 29) /* 965 */ # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* 965 */ # define VRDUNIT_CLOCK_GATE_DISABLE (1 << 27) /* 965 */ # define AUDUNIT_CLOCK_GATE_DISABLE (1 << 26) /* 965 */ # define DPUNIT_A_CLOCK_GATE_DISABLE (1 << 25) /* 965 */ # define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24) /* 965 */ # define TVRUNIT_CLOCK_GATE_DISABLE (1 << 23) /* 915-945 */ # define TVCUNIT_CLOCK_GATE_DISABLE (1 << 22) /* 915-945 */ # define TVFUNIT_CLOCK_GATE_DISABLE (1 << 21) /* 915-945 */ # define TVEUNIT_CLOCK_GATE_DISABLE (1 << 20) /* 915-945 */ # define DVSUNIT_CLOCK_GATE_DISABLE (1 << 19) /* 915-945 */ # define DSSUNIT_CLOCK_GATE_DISABLE (1 << 18) /* 915-945 */ # define DDBUNIT_CLOCK_GATE_DISABLE (1 << 17) /* 915-945 */ # define DPRUNIT_CLOCK_GATE_DISABLE (1 << 16) /* 915-945 */ # define DPFUNIT_CLOCK_GATE_DISABLE (1 << 15) /* 915-945 */ # define DPBMUNIT_CLOCK_GATE_DISABLE (1 << 14) /* 915-945 */ # define DPLSUNIT_CLOCK_GATE_DISABLE (1 << 13) /* 915-945 */ # define DPLUNIT_CLOCK_GATE_DISABLE (1 << 12) /* 915-945 */ # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11) # define DPBUNIT_CLOCK_GATE_DISABLE (1 << 10) # define DCUNIT_CLOCK_GATE_DISABLE (1 << 9) # define DPUNIT_CLOCK_GATE_DISABLE (1 << 8) # define VRUNIT_CLOCK_GATE_DISABLE (1 << 7) /* 915+: reserved */ # define OVHUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 830-865 */ # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6) /* 915-945 */ # define OVFUNIT_CLOCK_GATE_DISABLE (1 << 5) # define OVBUNIT_CLOCK_GATE_DISABLE (1 << 4) /** * This bit must be set on the 830 to prevent hangs when turning off the * overlay scaler. */ # define OVRUNIT_CLOCK_GATE_DISABLE (1 << 3) # define OVCUNIT_CLOCK_GATE_DISABLE (1 << 2) # define OVUUNIT_CLOCK_GATE_DISABLE (1 << 1) # define ZVUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 830 */ # define OVLUNIT_CLOCK_GATE_DISABLE (1 << 0) /* 845,865 */ #define RENCLK_GATE_D1 0x6204 # define BLITTER_CLOCK_GATE_DISABLE (1 << 13) /* 945GM only */ # define MPEG_CLOCK_GATE_DISABLE (1 << 12) /* 945GM only */ # define PC_FE_CLOCK_GATE_DISABLE (1 << 11) # define PC_BE_CLOCK_GATE_DISABLE (1 << 10) # define WINDOWER_CLOCK_GATE_DISABLE (1 << 9) # define INTERPOLATOR_CLOCK_GATE_DISABLE (1 << 8) # define COLOR_CALCULATOR_CLOCK_GATE_DISABLE (1 << 7) # define MOTION_COMP_CLOCK_GATE_DISABLE (1 << 6) # define MAG_CLOCK_GATE_DISABLE (1 << 5) /** This bit must be unset on 855,865 */ # define MECI_CLOCK_GATE_DISABLE (1 << 4) # define DCMP_CLOCK_GATE_DISABLE (1 << 3) # define MEC_CLOCK_GATE_DISABLE (1 << 2) # define MECO_CLOCK_GATE_DISABLE (1 << 1) /** This bit must be set on 855,865. */ # define SV_CLOCK_GATE_DISABLE (1 << 0) # define I915_MPEG_CLOCK_GATE_DISABLE (1 << 16) # define I915_VLD_IP_PR_CLOCK_GATE_DISABLE (1 << 15) # define I915_MOTION_COMP_CLOCK_GATE_DISABLE (1 << 14) # define I915_BD_BF_CLOCK_GATE_DISABLE (1 << 13) # define I915_SF_SE_CLOCK_GATE_DISABLE (1 << 12) # define I915_WM_CLOCK_GATE_DISABLE (1 << 11) # define I915_IZ_CLOCK_GATE_DISABLE (1 << 10) # define I915_PI_CLOCK_GATE_DISABLE (1 << 9) # define I915_DI_CLOCK_GATE_DISABLE (1 << 8) # define I915_SH_SV_CLOCK_GATE_DISABLE (1 << 7) # define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE (1 << 6) # define I915_SC_CLOCK_GATE_DISABLE (1 << 5) # define I915_FL_CLOCK_GATE_DISABLE (1 << 4) # define I915_DM_CLOCK_GATE_DISABLE (1 << 3) # define I915_PS_CLOCK_GATE_DISABLE (1 << 2) # define I915_CC_CLOCK_GATE_DISABLE (1 << 1) # define I915_BY_CLOCK_GATE_DISABLE (1 << 0) # define I965_RCZ_CLOCK_GATE_DISABLE (1 << 30) /** This bit must always be set on 965G/965GM */ # define I965_RCC_CLOCK_GATE_DISABLE (1 << 29) # define I965_RCPB_CLOCK_GATE_DISABLE (1 << 28) # define I965_DAP_CLOCK_GATE_DISABLE (1 << 27) # define I965_ROC_CLOCK_GATE_DISABLE (1 << 26) # define I965_GW_CLOCK_GATE_DISABLE (1 << 25) # define I965_TD_CLOCK_GATE_DISABLE (1 << 24) /** This bit must always be set on 965G */ # define I965_ISC_CLOCK_GATE_DISABLE (1 << 23) # define I965_IC_CLOCK_GATE_DISABLE (1 << 22) # define I965_EU_CLOCK_GATE_DISABLE (1 << 21) # define I965_IF_CLOCK_GATE_DISABLE (1 << 20) # define I965_TC_CLOCK_GATE_DISABLE (1 << 19) # define I965_SO_CLOCK_GATE_DISABLE (1 << 17) # define I965_FBC_CLOCK_GATE_DISABLE (1 << 16) # define I965_MARI_CLOCK_GATE_DISABLE (1 << 15) # define I965_MASF_CLOCK_GATE_DISABLE (1 << 14) # define I965_MAWB_CLOCK_GATE_DISABLE (1 << 13) # define I965_EM_CLOCK_GATE_DISABLE (1 << 12) # define I965_UC_CLOCK_GATE_DISABLE (1 << 11) # define I965_SI_CLOCK_GATE_DISABLE (1 << 6) # define I965_MT_CLOCK_GATE_DISABLE (1 << 5) # define I965_PL_CLOCK_GATE_DISABLE (1 << 4) # define I965_DG_CLOCK_GATE_DISABLE (1 << 3) # define I965_QC_CLOCK_GATE_DISABLE (1 << 2) # define I965_FT_CLOCK_GATE_DISABLE (1 << 1) # define I965_DM_CLOCK_GATE_DISABLE (1 << 0) #define RENCLK_GATE_D2 0x6208 #define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9) #define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7) #define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6) #define RAMCLK_GATE_D 0x6210 /* CRL only */ #define DEUC 0x6214 /* CRL only */ /* * This is a PCI config space register to manipulate backlight brightness * It is used when the BLM_LEGACY_MODE is turned on. When enabled, the first * byte of this config register sets brightness within the range from * 0 to 0xff */ #define LEGACY_BACKLIGHT_BRIGHTNESS 0xf4 #define BLC_PWM_CTL 0x61254 #define BACKLIGHT_MODULATION_FREQ_SHIFT (17) #define BACKLIGHT_MODULATION_FREQ_SHIFT2 (16) /** * This is the most significant 15 bits of the number of backlight cycles in a * complete cycle of the modulated backlight control. * * The actual value is this field multiplied by two. */ #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17) #define BACKLIGHT_MODULATION_FREQ_MASK2 (0xffff << 16) #define BLM_LEGACY_MODE (1 << 16) /** * This is the number of cycles out of the backlight modulation cycle for which * the backlight is on. * * This field must be no greater than the number of cycles in the complete * backlight modulation cycle. */ #define BACKLIGHT_DUTY_CYCLE_SHIFT (0) #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff) /* On 965+ backlight control is in another register */ #define BLC_PWM_CTL2 0x61250 #define BLM_LEGACY_MODE2 (1 << 30) #define BLM_CTL 0x61260 #define BLM_THRESHOLD_0 0x61270 #define BLM_THRESHOLD_1 0x61274 #define BLM_THRESHOLD_2 0x61278 #define BLM_THRESHOLD_3 0x6127c #define BLM_THRESHOLD_4 0x61280 #define BLM_THRESHOLD_5 0x61284 #define BLM_ACCUMULATOR_0 0x61290 #define BLM_ACCUMULATOR_1 0x61294 #define BLM_ACCUMULATOR_2 0x61298 #define BLM_ACCUMULATOR_3 0x6129c #define BLM_ACCUMULATOR_4 0x612a0 #define BLM_ACCUMULATOR_5 0x612a4 #define FPA0 0x06040 #define FPA1 0x06044 #define FPB0 0x06048 #define FPB1 0x0604c # define FP_N_DIV_MASK 0x003f0000 # define FP_N_IGD_DIV_MASK 0x00ff0000 # define FP_N_DIV_SHIFT 16 # define FP_M1_DIV_MASK 0x00003f00 # define FP_M1_DIV_SHIFT 8 # define FP_M2_DIV_MASK 0x0000003f # define FP_M2_IGD_DIV_MASK 0x000000ff # define FP_M2_DIV_SHIFT 0 #define PORT_HOTPLUG_EN 0x61110 # define HDMIB_HOTPLUG_INT_EN (1 << 29) # define HDMIC_HOTPLUG_INT_EN (1 << 28) # define HDMID_HOTPLUG_INT_EN (1 << 27) # define SDVOB_HOTPLUG_INT_EN (1 << 26) # define SDVOC_HOTPLUG_INT_EN (1 << 25) # define TV_HOTPLUG_INT_EN (1 << 18) # define CRT_HOTPLUG_INT_EN (1 << 9) # define CRT_HOTPLUG_ACTIVATION_PERIOD_32 (0 << 8) /* must use period 64 on GM45 according to docs */ # define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8) # define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7) # define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7) # define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5) # define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5) # define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5) # define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5) # define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5) # define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4) # define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4) # define CRT_HOTPLUG_FORCE_DETECT (1 << 3) # define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2) # define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) # define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */ #define PORT_HOTPLUG_STAT 0x61114 # define HDMIB_HOTPLUG_INT_STATUS (1 << 29) # define HDMIC_HOTPLUG_INT_STATUS (1 << 28) # define HDMID_HOTPLUG_INT_STATUS (1 << 27) # define CRT_HOTPLUG_INT_STATUS (1 << 11) # define TV_HOTPLUG_INT_STATUS (1 << 10) # define CRT_HOTPLUG_MONITOR_MASK (3 << 8) # define CRT_HOTPLUG_MONITOR_COLOR (3 << 8) # define CRT_HOTPLUG_MONITOR_MONO (2 << 8) # define CRT_HOTPLUG_MONITOR_NONE (0 << 8) # define SDVOC_HOTPLUG_INT_STATUS (1 << 7) # define SDVOB_HOTPLUG_INT_STATUS (1 << 6) #define SDVOB 0x61140 #define SDVOC 0x61160 #define SDVO_ENABLE (1 << 31) #define SDVO_PIPE_B_SELECT (1 << 30) #define SDVO_STALL_SELECT (1 << 29) #define SDVO_INTERRUPT_ENABLE (1 << 26) /** * 915G/GM SDVO pixel multiplier. * * Programmed value is multiplier - 1, up to 5x. * * \sa DPLL_MD_UDI_MULTIPLIER_MASK */ #define SDVO_PORT_MULTIPLY_MASK (7 << 23) #define SDVO_PORT_MULTIPLY_SHIFT 23 #define SDVO_PHASE_SELECT_MASK (15 << 19) #define SDVO_PHASE_SELECT_DEFAULT (6 << 19) #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18) #define SDVOC_GANG_MODE (1 << 16) #define SDVO_ENCODING_SDVO (0x0 << 10) #define SDVO_ENCODING_HDMI (0x2 << 10) /** Requird for HDMI operation */ #define SDVO_NULL_PACKETS_DURING_VSYNC (1 << 9) #define SDVO_BORDER_ENABLE (1 << 7) #define SDVO_AUDIO_ENABLE (1 << 6) /** New with 965, default is to be set */ #define SDVO_VSYNC_ACTIVE_HIGH (1 << 4) /** New with 965, default is to be set */ #define SDVO_HSYNC_ACTIVE_HIGH (1 << 3) /** 915/945 only, read-only bit */ #define SDVOB_PCIE_CONCURRENCY (1 << 3) #define SDVO_DETECTED (1 << 2) /* Bits to be preserved when writing */ #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14)) #define SDVOC_PRESERVE_MASK (1 << 17) #define UDIB_SVB_SHB_CODES 0x61144 #define UDIB_SHA_BLANK_CODES 0x61148 #define UDIB_START_END_FILL_CODES 0x6114c #define SDVOUDI 0x61150 #define I830_HTOTAL_MASK 0xfff0000 #define I830_HACTIVE_MASK 0x7ff #define I830_HBLANKEND_MASK 0xfff0000 #define I830_HBLANKSTART_MASK 0xfff #define I830_HSYNCEND_MASK 0xfff0000 #define I830_HSYNCSTART_MASK 0xfff #define I830_VTOTAL_MASK 0xfff0000 #define I830_VACTIVE_MASK 0x7ff #define I830_VBLANKEND_MASK 0xfff0000 #define I830_VBLANKSTART_MASK 0xfff #define I830_VSYNCEND_MASK 0xfff0000 #define I830_VSYNCSTART_MASK 0xfff #define I830_PIPEA_HORZ_MASK 0x7ff0000 #define I830_PIPEA_VERT_MASK 0x7ff #define ADPA 0x61100 #define ADPA_DAC_ENABLE (1<<31) #define ADPA_DAC_DISABLE 0 #define ADPA_PIPE_SELECT_MASK (1<<30) #define ADPA_PIPE_A_SELECT 0 #define ADPA_PIPE_B_SELECT (1<<30) #define ADPA_USE_VGA_HVPOLARITY (1<<15) #define ADPA_SETS_HVPOLARITY 0 #define ADPA_VSYNC_CNTL_DISABLE (1<<11) #define ADPA_VSYNC_CNTL_ENABLE 0 #define ADPA_HSYNC_CNTL_DISABLE (1<<10) #define ADPA_HSYNC_CNTL_ENABLE 0 #define ADPA_VSYNC_ACTIVE_HIGH (1<<4) #define ADPA_VSYNC_ACTIVE_LOW 0 #define ADPA_HSYNC_ACTIVE_HIGH (1<<3) #define ADPA_HSYNC_ACTIVE_LOW 0 #define PCH_DSP_CHICKEN1 0x42000 #define PCH_DSP_CHICKEN2 0x42004 #define PCH_DSP_CHICKEN3 0x4200c #define PCH_DSPCLK_GATE_D 0x42020 #define PCH_DSPRAMCLK_GATE_D 0x42024 #define PCH_3DCGDIS0 0x46020 #define PCH_3DCGDIS1 0x46024 #define PCH_3DRAMCGDIS0 0x46028 #define SOUTH_DSPCLK_GATE_D 0xc2020 #define CPU_eDP_A 0x64000 #define PCH_DP_B 0xe4100 #define PCH_DP_C 0xe4200 #define PCH_DP_D 0xe4300 #define DVOA 0x61120 #define DVOB 0x61140 #define DVOC 0x61160 #define DVO_ENABLE (1 << 31) #define DVO_PIPE_B_SELECT (1 << 30) #define DVO_PIPE_STALL_UNUSED (0 << 28) #define DVO_PIPE_STALL (1 << 28) #define DVO_PIPE_STALL_TV (2 << 28) #define DVO_PIPE_STALL_MASK (3 << 28) #define DVO_USE_VGA_SYNC (1 << 15) #define DVO_DATA_ORDER_I740 (0 << 14) #define DVO_DATA_ORDER_FP (1 << 14) #define DVO_VSYNC_DISABLE (1 << 11) #define DVO_HSYNC_DISABLE (1 << 10) #define DVO_VSYNC_TRISTATE (1 << 9) #define DVO_HSYNC_TRISTATE (1 << 8) #define DVO_BORDER_ENABLE (1 << 7) #define DVO_DATA_ORDER_GBRG (1 << 6) #define DVO_DATA_ORDER_RGGB (0 << 6) #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6) #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6) #define DVO_VSYNC_ACTIVE_HIGH (1 << 4) #define DVO_HSYNC_ACTIVE_HIGH (1 << 3) #define DVO_BLANK_ACTIVE_HIGH (1 << 2) #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */ #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */ #define DVO_PRESERVE_MASK (0x7<<24) #define DVOA_SRCDIM 0x61124 #define DVOB_SRCDIM 0x61144 #define DVOC_SRCDIM 0x61164 #define DVO_SRCDIM_HORIZONTAL_SHIFT 12 #define DVO_SRCDIM_VERTICAL_SHIFT 0 /** @defgroup LVDS * @{ */ /** * This register controls the LVDS output enable, pipe selection, and data * format selection. * * All of the clock/data pairs are force powered down by power sequencing. */ #define LVDS 0x61180 /** * Enables the LVDS port. This bit must be set before DPLLs are enabled, as * the DPLL semantics change when the LVDS is assigned to that pipe. */ # define LVDS_PORT_EN (1 << 31) /** Selects pipe B for LVDS data. Must be set on pre-965. */ # define LVDS_PIPEB_SELECT (1 << 30) /* on 965, dithering is enabled in this register, not PFIT_CONTROL */ # define LVDS_DITHER_ENABLE (1 << 25) /* * Selects between .0 and .1 formats: * * 0 = 1x18.0, 2x18.0, 1x24.0 or 2x24.0 * 1 = 1x24.1 or 2x24.1 */ # define LVDS_DATA_FORMAT_DOT_ONE (1 << 24) /* Using LE instead of HS on second channel control signal */ # define LVDS_LE_CONTROL_ENABLE (1 << 23) /* Using LF instead of VS on second channel control signal */ # define LVDS_LF_CONTROL_ENABLE (1 << 22) /* invert vsync signal polarity */ # define LVDS_VSYNC_POLARITY_INVERT (1 << 21) /* invert hsync signal polarity */ # define LVDS_HSYNC_POLARITY_INVERT (1 << 20) /* invert display enable signal polarity */ # define LVDS_DE_POLARITY_INVERT (1 << 19) /* * Control signals for second channel, ignored in single channel modes */ /* send DE, HS, VS on second channel */ # define LVDS_SECOND_CHANNEL_DE_HS_VS (0 << 17) # define LVDS_SECOND_CHANNEL_RESERVED (1 << 17) /* Send zeros instead of DE, HS, VS on second channel */ # define LVDS_SECOND_CHANNEL_ZEROS (2 << 17) /* Set DE=0, HS=LE, VS=LF on second channel */ # define LVDS_SECOND_CHANNEL_HS_VS (3 << 17) /* * Send duplicate data for channel reserved bits, otherwise send zeros */ # define LVDS_CHANNEL_DUP_RESERVED (1 << 16) /* * Enable border for unscaled (or aspect-scaled) display */ # define LVDS_BORDER_ENABLE (1 << 15) /* * Tri-state the LVDS buffers when powered down, otherwise * they are set to 0V */ # define LVDS_POWER_DOWN_TRI_STATE (1 << 10) /** * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per * pixel. */ # define LVDS_A0A2_CLKA_POWER_MASK (3 << 8) # define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8) # define LVDS_A0A2_CLKA_POWER_UP (3 << 8) /** * Controls the A3 data pair, which contains the additional LSBs for 24 bit * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be * on. */ # define LVDS_A3_POWER_MASK (3 << 6) # define LVDS_A3_POWER_DOWN (0 << 6) # define LVDS_A3_POWER_UP (3 << 6) /** * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP * is set. */ # define LVDS_CLKB_POWER_MASK (3 << 4) # define LVDS_CLKB_POWER_DOWN (0 << 4) # define LVDS_CLKB_POWER_UP (3 << 4) /** * Controls the B0-B3 data pairs. This must be set to match the DPLL p2 * setting for whether we are in dual-channel mode. The B3 pair will * additionally only be powered up when LVDS_A3_POWER_UP is set. */ # define LVDS_B0B3_POWER_MASK (3 << 2) # define LVDS_B0B3_POWER_DOWN (0 << 2) # define LVDS_B0B3_POWER_UP (3 << 2) /** @} */ #define DP_B 0x64100 #define DPB_AUX_CH_CTL 0x64110 #define DPB_AUX_CH_DATA1 0x64114 #define DPB_AUX_CH_DATA2 0x64118 #define DPB_AUX_CH_DATA3 0x6411c #define DPB_AUX_CH_DATA4 0x64120 #define DPB_AUX_CH_DATA5 0x64124 #define DP_C 0x64200 #define DPC_AUX_CH_CTL 0x64210 #define DPC_AUX_CH_DATA1 0x64214 #define DPC_AUX_CH_DATA2 0x64218 #define DPC_AUX_CH_DATA3 0x6421c #define DPC_AUX_CH_DATA4 0x64220 #define DPC_AUX_CH_DATA5 0x64224 #define DP_D 0x64300 #define DPD_AUX_CH_CTL 0x64310 #define DPD_AUX_CH_DATA1 0x64314 #define DPD_AUX_CH_DATA2 0x64318 #define DPD_AUX_CH_DATA3 0x6431c #define DPD_AUX_CH_DATA4 0x64320 #define DPD_AUX_CH_DATA5 0x64324 /* * Two channel clock control. Turn this on if you need clkb for two channel mode * Overridden by global LVDS power sequencing */ /* clkb off */ # define LVDS_CLKB_POWER_DOWN (0 << 4) /* powered up, but clkb forced to 0 */ # define LVDS_CLKB_POWER_PARTIAL (1 << 4) /* clock B running */ # define LVDS_CLKB_POWER_UP (3 << 4) /* * Two channel mode B0-B2 control. Sets state when power is on. * Set to POWER_DOWN in single channel mode, other settings enable * two channel mode. The CLKB power control controls whether that clock * is enabled during two channel mode. * */ /* Everything is off, including B3 and CLKB */ # define LVDS_B_POWER_DOWN (0 << 2) /* B0, B1, B2 and data lines forced to 0. timing is active */ # define LVDS_B_POWER_PARTIAL (1 << 2) /* data lines active (both timing and colour) */ # define LVDS_B_POWER_UP (3 << 2) /** @defgroup TV_CTL * @{ */ #define TV_CTL 0x68000 /** Enables the TV encoder */ # define TV_ENC_ENABLE (1 << 31) /** Sources the TV encoder input from pipe B instead of A. */ # define TV_ENC_PIPEB_SELECT (1 << 30) /** Outputs composite video (DAC A only) */ # define TV_ENC_OUTPUT_COMPOSITE (0 << 28) /** Outputs SVideo video (DAC B/C) */ # define TV_ENC_OUTPUT_SVIDEO (1 << 28) /** Outputs Component video (DAC A/B/C) */ # define TV_ENC_OUTPUT_COMPONENT (2 << 28) /** Outputs Composite and SVideo (DAC A/B/C) */ # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28) # define TV_TRILEVEL_SYNC (1 << 21) /** Enables slow sync generation (945GM only) */ # define TV_SLOW_SYNC (1 << 20) /** Selects 4x oversampling for 480i and 576p */ # define TV_OVERSAMPLE_4X (0 << 18) /** Selects 2x oversampling for 720p and 1080i */ # define TV_OVERSAMPLE_2X (1 << 18) /** Selects no oversampling for 1080p */ # define TV_OVERSAMPLE_NONE (2 << 18) /** Selects 8x oversampling */ # define TV_OVERSAMPLE_8X (3 << 18) /** Selects progressive mode rather than interlaced */ # define TV_PROGRESSIVE (1 << 17) /** Sets the colorburst to PAL mode. Required for non-M PAL modes. */ # define TV_PAL_BURST (1 << 16) /** Field for setting delay of Y compared to C */ # define TV_YC_SKEW_MASK (7 << 12) /** Enables a fix for 480p/576p standard definition modes on the 915GM only */ # define TV_ENC_SDP_FIX (1 << 11) /** * Enables a fix for the 915GM only. * * Not sure what it does. */ # define TV_ENC_C0_FIX (1 << 10) /** Bits that must be preserved by software */ # define TV_CTL_SAVE ((1 << 11) | (3 << 9) | (7 << 6) | 0xf) # define TV_FUSE_STATE_MASK (3 << 4) /** Read-only state that reports all features enabled */ # define TV_FUSE_STATE_ENABLED (0 << 4) /** Read-only state that reports that Macrovision is disabled in hardware*/ # define TV_FUSE_STATE_NO_MACROVISION (1 << 4) /** Read-only state that reports that TV-out is disabled in hardware. */ # define TV_FUSE_STATE_DISABLED (2 << 4) /** Normal operation */ # define TV_TEST_MODE_NORMAL (0 << 0) /** Encoder test pattern 1 - combo pattern */ # define TV_TEST_MODE_PATTERN_1 (1 << 0) /** Encoder test pattern 2 - full screen vertical 75% color bars */ # define TV_TEST_MODE_PATTERN_2 (2 << 0) /** Encoder test pattern 3 - full screen horizontal 75% color bars */ # define TV_TEST_MODE_PATTERN_3 (3 << 0) /** Encoder test pattern 4 - random noise */ # define TV_TEST_MODE_PATTERN_4 (4 << 0) /** Encoder test pattern 5 - linear color ramps */ # define TV_TEST_MODE_PATTERN_5 (5 << 0) /** * This test mode forces the DACs to 50% of full output. * * This is used for load detection in combination with TVDAC_SENSE_MASK */ # define TV_TEST_MODE_MONITOR_DETECT (7 << 0) # define TV_TEST_MODE_MASK (7 << 0) /** @} */ /** @defgroup TV_DAC * @{ */ #define TV_DAC 0x68004 /** * Reports that DAC state change logic has reported change (RO). * * This gets cleared when TV_DAC_STATE_EN is cleared */ # define TVDAC_STATE_CHG (1 << 31) # define TVDAC_SENSE_MASK (7 << 28) /** Reports that DAC A voltage is above the detect threshold */ # define TVDAC_A_SENSE (1 << 30) /** Reports that DAC B voltage is above the detect threshold */ # define TVDAC_B_SENSE (1 << 29) /** Reports that DAC C voltage is above the detect threshold */ # define TVDAC_C_SENSE (1 << 28) /** * Enables DAC state detection logic, for load-based TV detection. * * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set * to off, for load detection to work. */ # define TVDAC_STATE_CHG_EN (1 << 27) /** Sets the DAC A sense value to high */ # define TVDAC_A_SENSE_CTL (1 << 26) /** Sets the DAC B sense value to high */ # define TVDAC_B_SENSE_CTL (1 << 25) /** Sets the DAC C sense value to high */ # define TVDAC_C_SENSE_CTL (1 << 24) /** Overrides the ENC_ENABLE and DAC voltage levels */ # define DAC_CTL_OVERRIDE (1 << 7) /** Sets the slew rate. Must be preserved in software */ # define ENC_TVDAC_SLEW_FAST (1 << 6) # define DAC_A_1_3_V (0 << 4) # define DAC_A_1_1_V (1 << 4) # define DAC_A_0_7_V (2 << 4) # define DAC_A_OFF (3 << 4) # define DAC_B_1_3_V (0 << 2) # define DAC_B_1_1_V (1 << 2) # define DAC_B_0_7_V (2 << 2) # define DAC_B_OFF (3 << 2) # define DAC_C_1_3_V (0 << 0) # define DAC_C_1_1_V (1 << 0) # define DAC_C_0_7_V (2 << 0) # define DAC_C_OFF (3 << 0) /** @} */ /** * CSC coefficients are stored in a floating point format with 9 bits of * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n, * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with * -1 (0x3) being the only legal negative value. */ #define TV_CSC_Y 0x68010 # define TV_RY_MASK 0x07ff0000 # define TV_RY_SHIFT 16 # define TV_GY_MASK 0x00000fff # define TV_GY_SHIFT 0 #define TV_CSC_Y2 0x68014 # define TV_BY_MASK 0x07ff0000 # define TV_BY_SHIFT 16 /** * Y attenuation for component video. * * Stored in 1.9 fixed point. */ # define TV_AY_MASK 0x000003ff # define TV_AY_SHIFT 0 #define TV_CSC_U 0x68018 # define TV_RU_MASK 0x07ff0000 # define TV_RU_SHIFT 16 # define TV_GU_MASK 0x000007ff # define TV_GU_SHIFT 0 #define TV_CSC_U2 0x6801c # define TV_BU_MASK 0x07ff0000 # define TV_BU_SHIFT 16 /** * U attenuation for component video. * * Stored in 1.9 fixed point. */ # define TV_AU_MASK 0x000003ff # define TV_AU_SHIFT 0 #define TV_CSC_V 0x68020 # define TV_RV_MASK 0x0fff0000 # define TV_RV_SHIFT 16 # define TV_GV_MASK 0x000007ff # define TV_GV_SHIFT 0 #define TV_CSC_V2 0x68024 # define TV_BV_MASK 0x07ff0000 # define TV_BV_SHIFT 16 /** * V attenuation for component video. * * Stored in 1.9 fixed point. */ # define TV_AV_MASK 0x000007ff # define TV_AV_SHIFT 0 /** @defgroup TV_CSC_KNOBS * @{ */ #define TV_CLR_KNOBS 0x68028 /** 2s-complement brightness adjustment */ # define TV_BRIGHTNESS_MASK 0xff000000 # define TV_BRIGHTNESS_SHIFT 24 /** Contrast adjustment, as a 2.6 unsigned floating point number */ # define TV_CONTRAST_MASK 0x00ff0000 # define TV_CONTRAST_SHIFT 16 /** Saturation adjustment, as a 2.6 unsigned floating point number */ # define TV_SATURATION_MASK 0x0000ff00 # define TV_SATURATION_SHIFT 8 /** Hue adjustment, as an integer phase angle in degrees */ # define TV_HUE_MASK 0x000000ff # define TV_HUE_SHIFT 0 /** @} */ /** @defgroup TV_CLR_LEVEL * @{ */ #define TV_CLR_LEVEL 0x6802c /** Controls the DAC level for black */ # define TV_BLACK_LEVEL_MASK 0x01ff0000 # define TV_BLACK_LEVEL_SHIFT 16 /** Controls the DAC level for blanking */ # define TV_BLANK_LEVEL_MASK 0x000001ff # define TV_BLANK_LEVEL_SHIFT 0 /* @} */ /** @defgroup TV_H_CTL_1 * @{ */ #define TV_H_CTL_1 0x68030 /** Number of pixels in the hsync. */ # define TV_HSYNC_END_MASK 0x1fff0000 # define TV_HSYNC_END_SHIFT 16 /** Total number of pixels minus one in the line (display and blanking). */ # define TV_HTOTAL_MASK 0x00001fff # define TV_HTOTAL_SHIFT 0 /** @} */ /** @defgroup TV_H_CTL_2 * @{ */ #define TV_H_CTL_2 0x68034 /** Enables the colorburst (needed for non-component color) */ # define TV_BURST_ENA (1 << 31) /** Offset of the colorburst from the start of hsync, in pixels minus one. */ # define TV_HBURST_START_SHIFT 16 # define TV_HBURST_START_MASK 0x1fff0000 /** Length of the colorburst */ # define TV_HBURST_LEN_SHIFT 0 # define TV_HBURST_LEN_MASK 0x0001fff /** @} */ /** @defgroup TV_H_CTL_3 * @{ */ #define TV_H_CTL_3 0x68038 /** End of hblank, measured in pixels minus one from start of hsync */ # define TV_HBLANK_END_SHIFT 16 # define TV_HBLANK_END_MASK 0x1fff0000 /** Start of hblank, measured in pixels minus one from start of hsync */ # define TV_HBLANK_START_SHIFT 0 # define TV_HBLANK_START_MASK 0x0001fff /** @} */ /** @defgroup TV_V_CTL_1 * @{ */ #define TV_V_CTL_1 0x6803c /** XXX */ # define TV_NBR_END_SHIFT 16 # define TV_NBR_END_MASK 0x07ff0000 /** XXX */ # define TV_VI_END_F1_SHIFT 8 # define TV_VI_END_F1_MASK 0x00003f00 /** XXX */ # define TV_VI_END_F2_SHIFT 0 # define TV_VI_END_F2_MASK 0x0000003f /** @} */ /** @defgroup TV_V_CTL_2 * @{ */ #define TV_V_CTL_2 0x68040 /** Length of vsync, in half lines */ # define TV_VSYNC_LEN_MASK 0x07ff0000 # define TV_VSYNC_LEN_SHIFT 16 /** Offset of the start of vsync in field 1, measured in one less than the * number of half lines. */ # define TV_VSYNC_START_F1_MASK 0x00007f00 # define TV_VSYNC_START_F1_SHIFT 8 /** * Offset of the start of vsync in field 2, measured in one less than the * number of half lines. */ # define TV_VSYNC_START_F2_MASK 0x0000007f # define TV_VSYNC_START_F2_SHIFT 0 /** @} */ /** @defgroup TV_V_CTL_3 * @{ */ #define TV_V_CTL_3 0x68044 /** Enables generation of the equalization signal */ # define TV_EQUAL_ENA (1 << 31) /** Length of vsync, in half lines */ # define TV_VEQ_LEN_MASK 0x007f0000 # define TV_VEQ_LEN_SHIFT 16 /** Offset of the start of equalization in field 1, measured in one less than * the number of half lines. */ # define TV_VEQ_START_F1_MASK 0x0007f00 # define TV_VEQ_START_F1_SHIFT 8 /** * Offset of the start of equalization in field 2, measured in one less than * the number of half lines. */ # define TV_VEQ_START_F2_MASK 0x000007f # define TV_VEQ_START_F2_SHIFT 0 /** @} */ /** @defgroup TV_V_CTL_4 * @{ */ #define TV_V_CTL_4 0x68048 /** * Offset to start of vertical colorburst, measured in one less than the * number of lines from vertical start. */ # define TV_VBURST_START_F1_MASK 0x003f0000 # define TV_VBURST_START_F1_SHIFT 16 /** * Offset to the end of vertical colorburst, measured in one less than the * number of lines from the start of NBR. */ # define TV_VBURST_END_F1_MASK 0x000000ff # define TV_VBURST_END_F1_SHIFT 0 /** @} */ /** @defgroup TV_V_CTL_5 * @{ */ #define TV_V_CTL_5 0x6804c /** * Offset to start of vertical colorburst, measured in one less than the * number of lines from vertical start. */ # define TV_VBURST_START_F2_MASK 0x003f0000 # define TV_VBURST_START_F2_SHIFT 16 /** * Offset to the end of vertical colorburst, measured in one less than the * number of lines from the start of NBR. */ # define TV_VBURST_END_F2_MASK 0x000000ff # define TV_VBURST_END_F2_SHIFT 0 /** @} */ /** @defgroup TV_V_CTL_6 * @{ */ #define TV_V_CTL_6 0x68050 /** * Offset to start of vertical colorburst, measured in one less than the * number of lines from vertical start. */ # define TV_VBURST_START_F3_MASK 0x003f0000 # define TV_VBURST_START_F3_SHIFT 16 /** * Offset to the end of vertical colorburst, measured in one less than the * number of lines from the start of NBR. */ # define TV_VBURST_END_F3_MASK 0x000000ff # define TV_VBURST_END_F3_SHIFT 0 /** @} */ /** @defgroup TV_V_CTL_7 * @{ */ #define TV_V_CTL_7 0x68054 /** * Offset to start of vertical colorburst, measured in one less than the * number of lines from vertical start. */ # define TV_VBURST_START_F4_MASK 0x003f0000 # define TV_VBURST_START_F4_SHIFT 16 /** * Offset to the end of vertical colorburst, measured in one less than the * number of lines from the start of NBR. */ # define TV_VBURST_END_F4_MASK 0x000000ff # define TV_VBURST_END_F4_SHIFT 0 /** @} */ /** @defgroup TV_SC_CTL_1 * @{ */ #define TV_SC_CTL_1 0x68060 /** Turns on the first subcarrier phase generation DDA */ # define TV_SC_DDA1_EN (1 << 31) /** Turns on the first subcarrier phase generation DDA */ # define TV_SC_DDA2_EN (1 << 30) /** Turns on the first subcarrier phase generation DDA */ # define TV_SC_DDA3_EN (1 << 29) /** Sets the subcarrier DDA to reset frequency every other field */ # define TV_SC_RESET_EVERY_2 (0 << 24) /** Sets the subcarrier DDA to reset frequency every fourth field */ # define TV_SC_RESET_EVERY_4 (1 << 24) /** Sets the subcarrier DDA to reset frequency every eighth field */ # define TV_SC_RESET_EVERY_8 (2 << 24) /** Sets the subcarrier DDA to never reset the frequency */ # define TV_SC_RESET_NEVER (3 << 24) /** Sets the peak amplitude of the colorburst.*/ # define TV_BURST_LEVEL_MASK 0x00ff0000 # define TV_BURST_LEVEL_SHIFT 16 /** Sets the increment of the first subcarrier phase generation DDA */ # define TV_SCDDA1_INC_MASK 0x00000fff # define TV_SCDDA1_INC_SHIFT 0 /** @} */ /** @defgroup TV_SC_CTL_2 * @{ */ #define TV_SC_CTL_2 0x68064 /** Sets the rollover for the second subcarrier phase generation DDA */ # define TV_SCDDA2_SIZE_MASK 0x7fff0000 # define TV_SCDDA2_SIZE_SHIFT 16 /** Sets the increent of the second subcarrier phase generation DDA */ # define TV_SCDDA2_INC_MASK 0x00007fff # define TV_SCDDA2_INC_SHIFT 0 /** @} */ /** @defgroup TV_SC_CTL_3 * @{ */ #define TV_SC_CTL_3 0x68068 /** Sets the rollover for the third subcarrier phase generation DDA */ # define TV_SCDDA3_SIZE_MASK 0x7fff0000 # define TV_SCDDA3_SIZE_SHIFT 16 /** Sets the increent of the third subcarrier phase generation DDA */ # define TV_SCDDA3_INC_MASK 0x00007fff # define TV_SCDDA3_INC_SHIFT 0 /** @} */ /** @defgroup TV_WIN_POS * @{ */ #define TV_WIN_POS 0x68070 /** X coordinate of the display from the start of horizontal active */ # define TV_XPOS_MASK 0x1fff0000 # define TV_XPOS_SHIFT 16 /** Y coordinate of the display from the start of vertical active (NBR) */ # define TV_YPOS_MASK 0x00000fff # define TV_YPOS_SHIFT 0 /** @} */ /** @defgroup TV_WIN_SIZE * @{ */ #define TV_WIN_SIZE 0x68074 /** Horizontal size of the display window, measured in pixels*/ # define TV_XSIZE_MASK 0x1fff0000 # define TV_XSIZE_SHIFT 16 /** * Vertical size of the display window, measured in pixels. * * Must be even for interlaced modes. */ # define TV_YSIZE_MASK 0x00000fff # define TV_YSIZE_SHIFT 0 /** @} */ /** @defgroup TV_FILTER_CTL_1 * @{ */ #define TV_FILTER_CTL_1 0x68080 /** * Enables automatic scaling calculation. * * If set, the rest of the registers are ignored, and the calculated values can * be read back from the register. */ # define TV_AUTO_SCALE (1 << 31) /** * Disables the vertical filter. * * This is required on modes more than 1024 pixels wide */ # define TV_V_FILTER_BYPASS (1 << 29) /** Enables adaptive vertical filtering */ # define TV_VADAPT (1 << 28) # define TV_VADAPT_MODE_MASK (3 << 26) /** Selects the least adaptive vertical filtering mode */ # define TV_VADAPT_MODE_LEAST (0 << 26) /** Selects the moderately adaptive vertical filtering mode */ # define TV_VADAPT_MODE_MODERATE (1 << 26) /** Selects the most adaptive vertical filtering mode */ # define TV_VADAPT_MODE_MOST (3 << 26) /** * Sets the horizontal scaling factor. * * This should be the fractional part of the horizontal scaling factor divided * by the oversampling rate. TV_HSCALE should be less than 1, and set to: * * (src width - 1) / ((oversample * dest width) - 1) */ # define TV_HSCALE_FRAC_MASK 0x00003fff # define TV_HSCALE_FRAC_SHIFT 0 /** @} */ /** @defgroup TV_FILTER_CTL_2 * @{ */ #define TV_FILTER_CTL_2 0x68084 /** * Sets the integer part of the 3.15 fixed-point vertical scaling factor. * * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1) */ # define TV_VSCALE_INT_MASK 0x00038000 # define TV_VSCALE_INT_SHIFT 15 /** * Sets the fractional part of the 3.15 fixed-point vertical scaling factor. * * \sa TV_VSCALE_INT_MASK */ # define TV_VSCALE_FRAC_MASK 0x00007fff # define TV_VSCALE_FRAC_SHIFT 0 /** @} */ /** @defgroup TV_FILTER_CTL_3 * @{ */ #define TV_FILTER_CTL_3 0x68088 /** * Sets the integer part of the 3.15 fixed-point vertical scaling factor. * * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1)) * * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes. */ # define TV_VSCALE_IP_INT_MASK 0x00038000 # define TV_VSCALE_IP_INT_SHIFT 15 /** * Sets the fractional part of the 3.15 fixed-point vertical scaling factor. * * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes. * * \sa TV_VSCALE_IP_INT_MASK */ # define TV_VSCALE_IP_FRAC_MASK 0x00007fff # define TV_VSCALE_IP_FRAC_SHIFT 0 /** @} */ /** @defgroup TV_CC_CONTROL * @{ */ #define TV_CC_CONTROL 0x68090 # define TV_CC_ENABLE (1 << 31) /** * Specifies which field to send the CC data in. * * CC data is usually sent in field 0. */ # define TV_CC_FID_MASK (1 << 27) # define TV_CC_FID_SHIFT 27 /** Sets the horizontal position of the CC data. Usually 135. */ # define TV_CC_HOFF_MASK 0x03ff0000 # define TV_CC_HOFF_SHIFT 16 /** Sets the vertical position of the CC data. Usually 21 */ # define TV_CC_LINE_MASK 0x0000003f # define TV_CC_LINE_SHIFT 0 /** @} */ /** @defgroup TV_CC_DATA * @{ */ #define TV_CC_DATA 0x68094 # define TV_CC_RDY (1 << 31) /** Second word of CC data to be transmitted. */ # define TV_CC_DATA_2_MASK 0x007f0000 # define TV_CC_DATA_2_SHIFT 16 /** First word of CC data to be transmitted. */ # define TV_CC_DATA_1_MASK 0x0000007f # define TV_CC_DATA_1_SHIFT 0 /** @} */ /** @{ */ #define TV_H_LUMA_0 0x68100 #define TV_H_LUMA_59 0x681ec #define TV_H_CHROMA_0 0x68200 #define TV_H_CHROMA_59 0x682ec #define TV_V_LUMA_0 0x68300 #define TV_V_LUMA_42 0x683a8 #define TV_V_CHROMA_0 0x68400 #define TV_V_CHROMA_42 0x684a8 /** @} */ #define PIPEA_DSL 0x70000 #define PIPEACONF 0x70008 #define PIPEACONF_ENABLE (1<<31) #define PIPEACONF_DISABLE 0 #define PIPEACONF_DOUBLE_WIDE (1<<30) #define I965_PIPECONF_ACTIVE (1<<30) #define PIPEACONF_SINGLE_WIDE 0 #define PIPEACONF_PIPE_UNLOCKED 0 #define PIPEACONF_PIPE_LOCKED (1<<25) #define PIPEACONF_PALETTE 0 #define PIPEACONF_GAMMA (1<<24) #define PIPECONF_FORCE_BORDER (1<<25) #define PIPECONF_PROGRESSIVE (0 << 21) #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21) #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) /* ironlake: gamma */ #define PIPECONF_PALETTE_8BIT (0<<24) #define PIPECONF_PALETTE_10BIT (1<<24) #define PIPECONF_PALETTE_12BIT (2<<24) #define PIPECONF_FORCE_BORDER (1<<25) #define PIPECONF_PROGRESSIVE (0 << 21) #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21) #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21) /* ironlake */ #define PIPECONF_MSA_TIMING_DELAY (0<<18) /* for eDP */ #define PIPECONF_NO_DYNAMIC_RATE_CHANGE (0 << 16) #define PIPECONF_NO_ROTATION (0<<14) #define PIPECONF_FULL_COLOR_RANGE (0<<13) #define PIPECONF_CE_COLOR_RANGE (1<<13) #define PIPECONF_COLOR_SPACE_RGB (0<<11) #define PIPECONF_COLOR_SPACE_YUV601 (1<<11) #define PIPECONF_COLOR_SPACE_YUV709 (2<<11) #define PIPECONF_CONNECT_DEFAULT (0<<9) #define PIPECONF_8BPP (0<<5) #define PIPECONF_10BPP (1<<5) #define PIPECONF_6BPP (2<<5) #define PIPECONF_12BPP (3<<5) #define PIPECONF_ENABLE_DITHER (1<<4) #define PIPECONF_DITHER_SPATIAL (0<<2) #define PIPECONF_DITHER_ST1 (1<<2) #define PIPECONF_DITHER_ST2 (2<<2) #define PIPECONF_DITHER_TEMPORAL (3<<2) #define PIPEAGCMAXRED 0x70010 #define PIPEAGCMAXGREEN 0x70014 #define PIPEAGCMAXBLUE 0x70018 #define PIPEASTAT 0x70024 # define FIFO_UNDERRUN (1 << 31) # define CRC_ERROR_ENABLE (1 << 29) # define CRC_DONE_ENABLE (1 << 28) # define GMBUS_EVENT_ENABLE (1 << 27) # define VSYNC_INT_ENABLE (1 << 25) # define DLINE_COMPARE_ENABLE (1 << 24) # define DPST_EVENT_ENABLE (1 << 23) # define LBLC_EVENT_ENABLE (1 << 22) # define OFIELD_INT_ENABLE (1 << 21) # define EFIELD_INT_ENABLE (1 << 20) # define SVBLANK_INT_ENABLE (1 << 18) # define VBLANK_INT_ENABLE (1 << 17) # define OREG_UPDATE_ENABLE (1 << 16) # define CRC_ERROR_INT_STATUS (1 << 13) # define CRC_DONE_INT_STATUS (1 << 12) # define GMBUS_INT_STATUS (1 << 11) # define VSYNC_INT_STATUS (1 << 9) # define DLINE_COMPARE_STATUS (1 << 8) # define DPST_EVENT_STATUS (1 << 7) # define LBLC_EVENT_STATUS (1 << 6) # define OFIELD_INT_STATUS (1 << 5) # define EFIELD_INT_STATUS (1 << 4) # define SVBLANK_INT_STATUS (1 << 2) # define VBLANK_INT_STATUS (1 << 1) # define OREG_UPDATE_STATUS (1 << 0) #define FW_BLC 0x020d8 #define FW_BLC2 0x020dc #define FW_BLC_SELF 0x020e0 /* 915+ only */ #define DSPARB 0x70030 #define DSPARB_CSTART_SHIFT 7 #define DSPARB_BSTART_SHIFT 0 #define DSPARB_BEND_SHIFT 9 /* on 855 */ #define DSPARB_AEND_SHIFT 0 #define DSPFW1 0x70034 #define DSPFW2 0x70038 #define DSPFW3 0x7003c /* * The two pipe frame counter registers are not synchronized, so * reading a stable value is somewhat tricky. The following code * should work: * * do { * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT; * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >> PIPE_FRAME_LOW_SHIFT); * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT); * } while (high1 != high2); * frame = (high1 << 8) | low1; */ #define PIPEAFRAMEHIGH 0x70040 #define PIPE_FRAME_HIGH_MASK 0x0000ffff #define PIPE_FRAME_HIGH_SHIFT 0 #define PIPEAFRAMEPIXEL 0x70044 #define PIPE_FRAME_LOW_MASK 0xff000000 #define PIPE_FRAME_LOW_SHIFT 24 /* * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register * and is 24 bits wide. */ #define PIPE_PIXEL_MASK 0x00ffffff #define PIPE_PIXEL_SHIFT 0 /* * Computing GMCH M and N values. * * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes * * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz) * * The GMCH value is used internally */ #define PIPEA_GMCH_DATA_M 0x70050 /* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */ #define PIPE_GMCH_DATA_M_TU_SIZE_MASK (0x3f << 25) #define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT 25 #define PIPE_GMCH_DATA_M_MASK (0xffffff) #define PIPEA_GMCH_DATA_N 0x70054 #define PIPE_GMCH_DATA_N_MASK (0xffffff) /* * Computing Link M and N values. * * Link M / N = pixel_clock / ls_clk * * (the DP spec calls pixel_clock the 'strm_clk') * * The Link value is transmitted in the Main Stream * Attributes and VB-ID. */ #define PIPEA_DP_LINK_M 0x70060 #define PIPEA_DP_LINK_M_MASK (0xffffff) #define PIPEA_DP_LINK_N 0x70064 #define PIPEA_DP_LINK_N_MASK (0xffffff) #define PIPEB_DSL 0x71000 #define PIPEBCONF 0x71008 #define PIPEBGCMAXRED 0x71010 #define PIPEBGCMAXGREEN 0x71014 #define PIPEBGCMAXBLUE 0x71018 #define PIPEBSTAT 0x71024 #define PIPEBFRAMEHIGH 0x71040 #define PIPEBFRAMEPIXEL 0x71044 #define PIPEB_GMCH_DATA_M 0x71050 #define PIPEB_GMCH_DATA_N 0x71054 #define PIPEB_DP_LINK_M 0x71060 #define PIPEB_DP_LINK_N 0x71064 #define PIPECCONF 0x72008 #define PIPECGCMAXRED 0x72010 #define PIPECGCMAXGREEN 0x72014 #define PIPECGCMAXBLUE 0x72018 #define PIPECSTAT 0x72024 #define PIPECFRAMEHIGH 0x72040 #define PIPECFRAMEPIXEL 0x72044 #define PIPEC_GMCH_DATA_M 0x72050 #define PIPEC_GMCH_DATA_N 0x72054 #define PIPEC_DP_LINK_M 0x72060 #define PIPEC_DP_LINK_N 0x72064 #define PIPEEDPCONF 0x7F008 #define DSPACNTR 0x70180 #define DSPBCNTR 0x71180 #define DSPCCNTR 0x72180 #define DISPLAY_PLANE_ENABLE (1<<31) #define DISPLAY_PLANE_DISABLE 0 #define DISPLAY_PLANE_TILED (1<<10) #define DISPPLANE_GAMMA_ENABLE (1<<30) #define DISPPLANE_GAMMA_DISABLE 0 #define DISPPLANE_PIXFORMAT_MASK (0xf<<26) #define DISPPLANE_8BPP (0x2<<26) #define DISPPLANE_15_16BPP (0x4<<26) #define DISPPLANE_16BPP (0x5<<26) #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26) #define DISPPLANE_32BPP (0x7<<26) #define DISPPLANE_STEREO_ENABLE (1<<25) #define DISPPLANE_STEREO_DISABLE 0 #define DISPPLANE_SEL_PIPE_MASK (1<<24) #define DISPPLANE_SEL_PIPE_A 0 #define DISPPLANE_SEL_PIPE_B (1<<24) #define DISPPLANE_SRC_KEY_ENABLE (1<<22) #define DISPPLANE_SRC_KEY_DISABLE 0 #define DISPPLANE_LINE_DOUBLE (1<<20) #define DISPPLANE_NO_LINE_DOUBLE 0 #define DISPPLANE_STEREO_POLARITY_FIRST 0 #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) /* plane B only */ #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15) #define DISPPLANE_ALPHA_TRANS_DISABLE 0 #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0 #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1) #define DSPABASE 0x70184 #define DSPASTRIDE 0x70188 #define DSPBBASE 0x71184 #define DSPBADDR DSPBBASE #define DSPBSTRIDE 0x71188 #define DSPCBASE 0x72184 #define DSPCADDR DSPCBASE #define DSPCSTRIDE 0x72188 #define DSPAKEYVAL 0x70194 #define DSPAKEYMASK 0x70198 #define DSPAPOS 0x7018C /* reserved */ #define DSPASIZE 0x70190 #define DSPBPOS 0x7118C #define DSPBSIZE 0x71190 #define DSPASURF 0x7019C #define DSPATILEOFF 0x701A4 #define DSPBSURF 0x7119C #define DSPBTILEOFF 0x711A4 #define DSPCSURF 0x7219C #define DSPCTILEOFF 0x721A4 #define VGACNTRL 0x71400 # define VGA_DISP_DISABLE (1 << 31) # define VGA_2X_MODE (1 << 30) # define VGA_PIPE_B_SELECT (1 << 29) /* Various masks for reserved bits, etc. */ #define I830_FWATER1_MASK (~((1<<11)|(1<<10)|(1<<9)| \ (1<<8)|(1<<26)|(1<<25)|(1<<24)|(1<<5)|(1<<4)|(1<<3)| \ (1<<2)|(1<<1)|1|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))) #define I830_FWATER2_MASK ~(0) #define DV0A_RESERVED ((1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1) #define DV0B_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<16)|(1<<5)|(1<<1)|1) #define VGA0_N_DIVISOR_MASK ((1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) #define VGA0_M1_DIVISOR_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)) #define VGA0_M2_DIVISOR_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) #define VGA0_M1M2N_RESERVED ~(VGA0_N_DIVISOR_MASK|VGA0_M1_DIVISOR_MASK|VGA0_M2_DIVISOR_MASK) #define VGA0_POSTDIV_MASK ((1<<7)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) #define VGA1_POSTDIV_MASK ((1<<15)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)) #define VGA_POSTDIV_RESERVED ~(VGA0_POSTDIV_MASK|VGA1_POSTDIV_MASK|(1<<7)|(1<<15)) #define DPLLA_POSTDIV_MASK ((1<<23)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) #define DPLLA_RESERVED ((1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<22)|(1<<15)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) #define ADPA_RESERVED ((1<<2)|(1<<1)|1|(1<<9)|(1<<8)|(1<<7)|(1<<6)|(1<<5)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) #define SUPER_WORD 32 #define BURST_A_MASK ((1<<11)|(1<<10)|(1<<9)|(1<<8)) #define BURST_B_MASK ((1<<26)|(1<<25)|(1<<24)) #define WATER_A_MASK ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1) #define WATER_B_MASK ((1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)) #define WATER_RESERVED ((1<<31)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<7)|(1<<6)) #define PIPEACONF_RESERVED ((1<<29)|(1<<28)|(1<<27)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff) #define PIPEBCONF_RESERVED ((1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<23)|(1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)|0xffff) #define DSPACNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0xffff) #define DSPBCNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0x7ffe) #define I830_GMCH_CTRL 0x52 #define I830_GMCH_ENABLED 0x4 #define I830_GMCH_MEM_MASK 0x1 #define I830_GMCH_MEM_64M 0x1 #define I830_GMCH_MEM_128M 0 #define I830_GMCH_GMS_MASK 0x70 #define I830_GMCH_GMS_DISABLED 0x00 #define I830_GMCH_GMS_LOCAL 0x10 #define I830_GMCH_GMS_STOLEN_512 0x20 #define I830_GMCH_GMS_STOLEN_1024 0x30 #define I830_GMCH_GMS_STOLEN_8192 0x40 #define I830_RDRAM_CHANNEL_TYPE 0x03010 #define I830_RDRAM_ND(x) (((x) & 0x20) >> 5) #define I830_RDRAM_DDT(x) (((x) & 0x18) >> 3) #define I855_GMCH_GMS_MASK (0xF << 4) #define I855_GMCH_GMS_DISABLED 0x00 #define I855_GMCH_GMS_STOLEN_1M (0x1 << 4) #define I855_GMCH_GMS_STOLEN_4M (0x2 << 4) #define I855_GMCH_GMS_STOLEN_8M (0x3 << 4) #define I855_GMCH_GMS_STOLEN_16M (0x4 << 4) #define I855_GMCH_GMS_STOLEN_32M (0x5 << 4) #define I915G_GMCH_GMS_STOLEN_48M (0x6 << 4) #define I915G_GMCH_GMS_STOLEN_64M (0x7 << 4) #define G33_GMCH_GMS_STOLEN_128M (0x8 << 4) #define G33_GMCH_GMS_STOLEN_256M (0x9 << 4) #define INTEL_GMCH_GMS_STOLEN_96M (0xa << 4) #define INTEL_GMCH_GMS_STOLEN_160M (0xb << 4) #define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4) #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) #define I85X_CAPID 0x44 #define I85X_VARIANT_MASK 0x7 #define I85X_VARIANT_SHIFT 5 #define I855_GME 0x0 #define I855_GM 0x4 #define I852_GME 0x2 #define I852_GM 0x5 #define I915_GCFGC 0xf0 #define I915_LOW_FREQUENCY_ENABLE (1 << 7) #define I915_DISPLAY_CLOCK_190_200_MHZ (0 << 4) #define I915_DISPLAY_CLOCK_333_MHZ (4 << 4) #define I915_DISPLAY_CLOCK_MASK (7 << 4) #define I855_HPLLCC 0xc0 #define I855_CLOCK_CONTROL_MASK (3 << 0) #define I855_CLOCK_133_200 (0 << 0) #define I855_CLOCK_100_200 (1 << 0) #define I855_CLOCK_100_133 (2 << 0) #define I855_CLOCK_166_250 (3 << 0) /* BLT commands */ #define COLOR_BLT_CMD ((2<<29)|(0x40<<22)|(0x3)) #define COLOR_BLT_WRITE_ALPHA (1<<21) #define COLOR_BLT_WRITE_RGB (1<<20) #define XY_COLOR_BLT_CMD_NOLEN ((2<<29)|(0x50<<22)) #define XY_COLOR_BLT_WRITE_ALPHA (1<<21) #define XY_COLOR_BLT_WRITE_RGB (1<<20) #define XY_COLOR_BLT_TILED (1<<11) #define XY_SETUP_CLIP_BLT_CMD ((2<<29)|(3<<22)|1) #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)) #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) #define XY_SRC_COPY_BLT_DST_TILED (1<<11) #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|0x4) #define SRC_COPY_BLT_WRITE_ALPHA (1<<21) #define SRC_COPY_BLT_WRITE_RGB (1<<20) #define XY_PAT_BLT_IMMEDIATE ((2<<29)|(0x72<<22)) #define XY_MONO_PAT_BLT_CMD ((0x2<<29)|(0x52<<22)|0x7) #define XY_MONO_PAT_VERT_SEED ((1<<10)|(1<<9)|(1<<8)) #define XY_MONO_PAT_HORT_SEED ((1<<14)|(1<<13)|(1<<12)) #define XY_MONO_PAT_BLT_WRITE_ALPHA (1<<21) #define XY_MONO_PAT_BLT_WRITE_RGB (1<<20) #define XY_MONO_SRC_BLT_CMD ((0x2<<29)|(0x54<<22)|(0x6)) #define XY_MONO_SRC_BLT_WRITE_ALPHA (1<<21) #define XY_MONO_SRC_BLT_WRITE_RGB (1<<20) #define MI_STORE_DWORD_IMM ((0x20<<23)|2) #define MI_MEM_VIRTUAL (1 << 22) /* 965+ only */ #define MI_SET_CONTEXT (0x18<<23) #define CTXT_NO_RESTORE (1) #define CTXT_PALETTE_SAVE_DISABLE (1<<3) #define CTXT_PALETTE_RESTORE_DISABLE (1<<2) /* Dword 0 */ #define MI_VERTEX_BUFFER (0x17<<23) #define MI_VERTEX_BUFFER_IDX(x) (x<<20) #define MI_VERTEX_BUFFER_PITCH(x) (x<<13) #define MI_VERTEX_BUFFER_WIDTH(x) (x<<6) /* Dword 1 */ #define MI_VERTEX_BUFFER_DISABLE (1) /* Overlay Flip */ #define MI_OVERLAY_FLIP (0x11<<23) #define MI_OVERLAY_FLIP_CONTINUE (0<<21) #define MI_OVERLAY_FLIP_ON (1<<21) #define MI_OVERLAY_FLIP_OFF (2<<21) /* Wait for Events */ #define MI_WAIT_FOR_EVENT (0x03<<23) #define MI_WAIT_FOR_PIPEB_SVBLANK (1<<18) #define MI_WAIT_FOR_PIPEA_SVBLANK (1<<17) #define MI_WAIT_FOR_OVERLAY_FLIP (1<<16) #define MI_WAIT_FOR_PIPEB_VBLANK (1<<7) #define MI_WAIT_FOR_PIPEA_VBLANK (1<<3) #define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW (1<<5) #define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW (1<<1) #define MI_LOAD_SCAN_LINES_INCL (0x12<<23) /* Flush */ #define MI_FLUSH (0x04<<23) #define MI_WRITE_DIRTY_STATE (1<<4) #define MI_END_SCENE (1<<3) #define MI_GLOBAL_SNAPSHOT_COUNT_RESET (1<<3) #define MI_INHIBIT_RENDER_CACHE_FLUSH (1<<2) #define MI_STATE_INSTRUCTION_CACHE_FLUSH (1<<1) #define MI_INVALIDATE_MAP_CACHE (1<<0) /* broadwater flush bits */ #define BRW_MI_GLOBAL_SNAPSHOT_RESET (1 << 3) /* Noop */ #define MI_NOOP 0x00 #define MI_NOOP_WRITE_ID (1<<22) #define MI_NOOP_ID_MASK (1<<22 - 1) #define STATE3D_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x01<<16)) /* Batch */ #define MI_BATCH_BUFFER ((0x30 << 23) | 1) #define MI_BATCH_BUFFER_START (0x31 << 23) #define MI_BATCH_BUFFER_END (0xA << 23) #define MI_BATCH_NON_SECURE (1) #define MI_BATCH_NON_SECURE_I965 (1 << 8) #define MAX_DISPLAY_PIPES 2 typedef enum { CrtIndex = 0, TvIndex, DfpIndex, LfpIndex, Crt2Index, Tv2Index, Dfp2Index, Lfp2Index, NumDisplayTypes } DisplayType; /* What's connected to the pipes (as reported by the BIOS) */ #define PIPE_ACTIVE_MASK 0xff #define PIPE_CRT_ACTIVE (1 << CrtIndex) #define PIPE_TV_ACTIVE (1 << TvIndex) #define PIPE_DFP_ACTIVE (1 << DfpIndex) #define PIPE_LCD_ACTIVE (1 << LfpIndex) #define PIPE_CRT2_ACTIVE (1 << Crt2Index) #define PIPE_TV2_ACTIVE (1 << Tv2Index) #define PIPE_DFP2_ACTIVE (1 << Dfp2Index) #define PIPE_LCD2_ACTIVE (1 << Lfp2Index) #define PIPE_SIZED_DISP_MASK (PIPE_DFP_ACTIVE | \ PIPE_LCD_ACTIVE | \ PIPE_DFP2_ACTIVE) #define PIPE_A_SHIFT 0 #define PIPE_B_SHIFT 8 #define PIPE_SHIFT(n) ((n) == 0 ? \ PIPE_A_SHIFT : PIPE_B_SHIFT) /* * Some BIOS scratch area registers. The 845 (and 830?) store the amount * of video memory available to the BIOS in SWF1. */ #define SWF0 0x71410 #define SWF1 0x71414 #define SWF2 0x71418 #define SWF3 0x7141c #define SWF4 0x71420 #define SWF5 0x71424 #define SWF6 0x71428 /* * 855 scratch registers. */ #define SWF00 0x70410 #define SWF01 0x70414 #define SWF02 0x70418 #define SWF03 0x7041c #define SWF04 0x70420 #define SWF05 0x70424 #define SWF06 0x70428 #define SWF10 SWF0 #define SWF11 SWF1 #define SWF12 SWF2 #define SWF13 SWF3 #define SWF14 SWF4 #define SWF15 SWF5 #define SWF16 SWF6 #define SWF30 0x72414 #define SWF31 0x72418 #define SWF32 0x7241c /* * Overlay registers. These are overlay registers accessed via MMIO. * Those loaded via the overlay register page are defined in i830_video.c. */ #define OVADD 0x30000 #define DOVSTA 0x30008 #define OC_BUF (0x3<<20) #define OGAMC5 0x30010 #define OGAMC4 0x30014 #define OGAMC3 0x30018 #define OGAMC2 0x3001c #define OGAMC1 0x30020 #define OGAMC0 0x30024 /* * Palette registers */ #define PALETTE_A 0x0a000 #define PALETTE_B 0x0a800 /* Framebuffer compression */ #define FBC_CFB_BASE 0x03200 /* 4k page aligned */ #define FBC_LL_BASE 0x03204 /* 4k page aligned */ #define FBC_CONTROL 0x03208 #define FBC_CTL_EN (1<<31) #define FBC_CTL_PERIODIC (1<<30) #define FBC_CTL_INTERVAL_SHIFT (16) #define FBC_CTL_UNCOMPRESSIBLE (1<<14) #define FBC_CTL_STRIDE_SHIFT (5) #define FBC_CTL_FENCENO (1<<0) #define FBC_COMMAND 0x0320c #define FBC_CMD_COMPRESS (1<<0) #define FBC_STATUS 0x03210 #define FBC_STAT_COMPRESSING (1<<31) #define FBC_STAT_COMPRESSED (1<<30) #define FBC_STAT_MODIFIED (1<<29) #define FBC_STAT_CURRENT_LINE (1<<0) #define FBC_CONTROL2 0x03214 #define FBC_CTL_FENCE_DBL (0<<4) #define FBC_CTL_IDLE_IMM (0<<2) #define FBC_CTL_IDLE_FULL (1<<2) #define FBC_CTL_IDLE_LINE (2<<2) #define FBC_CTL_IDLE_DEBUG (3<<2) #define FBC_CTL_CPU_FENCE (1<<1) #define FBC_CTL_PLANEA (0<<0) #define FBC_CTL_PLANEB (1<<0) #define FBC_FENCE_OFF 0x0321b #define FBC_MOD_NUM 0x03220 #define FBC_TAG_DEBUG 0x03300 #define FBC_LL_SIZE (1536) #define FBC_LL_PAD (32) /* Framebuffer compression version 2 */ #define DPFC_CB_BASE 0x3200 #define DPFC_CONTROL 0x3208 #define DPFC_CTL_EN (1<<31) #define DPFC_CTL_PLANEA (0<<30) #define DPFC_CTL_PLANEB (1<<30) #define DPFC_CTL_FENCE_EN (1<<29) #define DPFC_CTL_LIMIT_1X (0<<6) #define DPFC_CTL_LIMIT_2X (1<<6) #define DPFC_CTL_LIMIT_4X (2<<6) #define DPFC_RECOMP_CTL 0x320c #define DPFC_RECOMP_STALL_EN (1<<27) #define DPFC_RECOMP_STALL_WM_SHIFT (16) #define DPFC_RECOMP_STALL_WM_MASK (0x07ff0000) #define DPFC_RECOMP_TIMER_COUNT_SHIFT (0) #define DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f) #define DPFC_STATUS 0x3210 #define DPFC_INVAL_SEG_SHIFT (16) #define DPFC_INVAL_SEG_MASK (0x07ff0000) #define DPFC_COMP_SEG_SHIFT (0) #define DPFC_COMP_SEG_MASK (0x000003ff) #define DPFC_STATUS2 0x3214 #define DPFC_FENCE_YOFF 0x3218 #define PEG_BAND_GAP_DATA 0x14d68 #define MCHBAR_RENDER_STANDBY 0x111B8 #define RENDER_STANDBY_ENABLE (1 << 30) /* Ironlake */ /* warmup time in us */ #define WARMUP_PCH_REF_CLK_SSC_MOD 1 #define WARMUP_PCH_FDI_RECEIVER_PLL 25 #define WARMUP_PCH_DPLL 50 #define WARMUP_CPU_DP_PLL 20 #define WARMUP_CPU_FDI_TRANSMITTER_PLL 10 #define WARMUP_DMI_LATENCY 20 #define FDI_TRAIN_PATTERN_1_TIME 0.5 #define FDI_TRAIN_PATTERN_2_TIME 1.5 #define FDI_ONE_IDLE_PATTERN_TIME 31 #define CPU_VGACNTRL 0x41000 #define DIGITAL_PORT_HOTPLUG_CNTRL 0x44030 #define DIGITAL_PORTA_HOTPLUG_ENABLE (1 << 4) #define DIGITAL_PORTA_SHORT_PULSE_2MS (0 << 2) #define DIGITAL_PORTA_SHORT_PULSE_4_5MS (1 << 2) #define DIGITAL_PORTA_SHORT_PULSE_6MS (2 << 2) #define DIGITAL_PORTA_SHORT_PULSE_100MS (3 << 2) #define DIGITAL_PORTA_NO_DETECT (0 << 0) #define DIGITAL_PORTA_LONG_PULSE_DETECT_MASK (1 << 1) #define DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK (1 << 0) /* refresh rate hardware control */ #define RR_HW_CTL 0x45300 #define RR_HW_LOW_POWER_FRAMES_MASK 0xff #define RR_HW_HIGH_POWER_FRAMES_MASK 0xff00 #define FDI_PLL_BIOS_0 0x46000 #define FDI_PLL_BIOS_1 0x46004 #define FDI_PLL_BIOS_2 0x46008 #define DISPLAY_PORT_PLL_BIOS_0 0x4600c #define DISPLAY_PORT_PLL_BIOS_1 0x46010 #define DISPLAY_PORT_PLL_BIOS_2 0x46014 #define FDI_PLL_FREQ_CTL 0x46030 #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24) #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00 #define FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK 0xff #define PIPEA_DATA_M1 0x60030 #define TU_SIZE(x) (((x)-1) << 25) /* default size 64 */ #define TU_SIZE_MASK 0x7e000000 #define PIPEA_DATA_M1_OFFSET 0 #define PIPEA_DATA_N1 0x60034 #define PIPEA_DATA_N1_OFFSET 0 #define PIPEA_DATA_M2 0x60038 #define PIPEA_DATA_M2_OFFSET 0 #define PIPEA_DATA_N2 0x6003c #define PIPEA_DATA_N2_OFFSET 0 #define PIPEA_LINK_M1 0x60040 #define PIPEA_LINK_M1_OFFSET 0 #define PIPEA_LINK_N1 0x60044 #define PIPEA_LINK_N1_OFFSET 0 #define PIPEA_LINK_M2 0x60048 #define PIPEA_LINK_M2_OFFSET 0 #define PIPEA_LINK_N2 0x6004c #define PIPEA_LINK_N2_OFFSET 0 /* PIPEB timing regs are same start from 0x61000 */ #define PIPEB_DATA_M1 0x61030 #define PIPEB_DATA_N1 0x61034 #define PIPEB_DATA_M2 0x61038 #define PIPEB_DATA_N2 0x6103c #define PIPEB_LINK_M1 0x61040 #define PIPEB_LINK_N1 0x61044 #define PIPEB_LINK_M2 0x61048 #define PIPEB_LINK_N2 0x6104c /* PIPEC timing regs */ #define PIPEC_DATA_M1 0x62030 #define PIPEC_DATA_N1 0x62034 #define PIPEC_DATA_M2 0x62038 #define PIPEC_DATA_N2 0x6203c #define PIPEC_LINK_M1 0x62040 #define PIPEC_LINK_N1 0x62044 #define PIPEC_LINK_M2 0x62048 #define PIPEC_LINK_N2 0x6204c #define PIPEEDP_DATA_M1 0x6F030 #define PIPEEDP_DATA_N1 0x6F034 #define PIPEEDP_LINK_M1 0x6F040 #define PIPEEDP_LINK_N1 0x6F044 /* PIPECONF for pipe A/B addr is same */ /* cusor A is only connected to pipe A, cursor B is connected to pipe B. Otherwise no change. */ /* Plane A/B, DSPACNTR/DSPBCNTR addr not changed */ /* CPU panel fitter */ #define PFA_CTL_1 0x68080 #define PFB_CTL_1 0x68880 #define PFC_CTL_1 0x69080 #define PF_ENABLE (1<<31) #define PFA_CTL_2 0x68084 #define PFB_CTL_2 0x68884 #define PFC_CTL_2 0x69084 #define PFA_CTL_3 0x68088 #define PFB_CTL_3 0x68888 #define PFC_CTL_3 0x69088 #define PFA_CTL_4 0x68090 #define PFB_CTL_4 0x68890 #define PFC_CTL_4 0x69090 #define PFA_WIN_POS 0x68070 #define PFB_WIN_POS 0x68870 #define PFC_WIN_POS 0x69070 #define PFA_WIN_SIZE 0x68074 #define PFB_WIN_SIZE 0x68874 #define PFC_WIN_SIZE 0x69074 /* legacy palette */ #define LGC_PALETTE_A 0x4a000 #define LGC_PALETTE_B 0x4a800 /* interrupts */ #define DE_MASTER_IRQ_CONTROL (1 << 31) #define DE_SPRITEB_FLIP_DONE (1 << 29) #define DE_SPRITEA_FLIP_DONE (1 << 28) #define DE_PLANEB_FLIP_DONE (1 << 27) #define DE_PLANEA_FLIP_DONE (1 << 26) #define DE_PCU_EVENT (1 << 25) #define DE_GTT_FAULT (1 << 24) #define DE_POISON (1 << 23) #define DE_PERFORM_COUNTER (1 << 22) #define DE_PCH_EVENT (1 << 21) #define DE_AUX_CHANNEL_A (1 << 20) #define DE_DP_A_HOTPLUG (1 << 19) #define DE_GSE (1 << 18) #define DE_PIPEB_VBLANK (1 << 15) #define DE_PIPEB_EVEN_FIELD (1 << 14) #define DE_PIPEB_ODD_FIELD (1 << 13) #define DE_PIPEB_LINE_COMPARE (1 << 12) #define DE_PIPEB_VSYNC (1 << 11) #define DE_PIPEB_FIFO_UNDERRUN (1 << 8) #define DE_PIPEA_VBLANK (1 << 7) #define DE_PIPEA_EVEN_FIELD (1 << 6) #define DE_PIPEA_ODD_FIELD (1 << 5) #define DE_PIPEA_LINE_COMPARE (1 << 4) #define DE_PIPEA_VSYNC (1 << 3) #define DE_PIPEA_FIFO_UNDERRUN (1 << 0) #define DEISR 0x44000 #define DEIMR 0x44004 #define DEIIR 0x44008 #define DEIER 0x4400c /* GT interrupt */ #define GT_SYNC_STATUS (1 << 2) #define GT_USER_INTERRUPT (1 << 0) #define GTISR 0x44010 #define GTIMR 0x44014 #define GTIIR 0x44018 #define GTIER 0x4401c /* PCH */ /* south display engine interrupt */ #define SDE_CRT_HOTPLUG (1 << 11) #define SDE_PORTD_HOTPLUG (1 << 10) #define SDE_PORTC_HOTPLUG (1 << 9) #define SDE_PORTB_HOTPLUG (1 << 8) #define SDE_SDVOB_HOTPLUG (1 << 6) #define SDEISR 0xc4000 #define SDEIMR 0xc4004 #define SDEIIR 0xc4008 #define SDEIER 0xc400c /* digital port hotplug */ #define PCH_PORT_HOTPLUG 0xc4030 #define PORTD_HOTPLUG_ENABLE (1 << 20) #define PORTD_PULSE_DURATION_2ms (0) #define PORTD_PULSE_DURATION_4_5ms (1 << 18) #define PORTD_PULSE_DURATION_6ms (2 << 18) #define PORTD_PULSE_DURATION_100ms (3 << 18) #define PORTD_HOTPLUG_NO_DETECT (0) #define PORTD_HOTPLUG_SHORT_DETECT (1 << 16) #define PORTD_HOTPLUG_LONG_DETECT (1 << 17) #define PORTC_HOTPLUG_ENABLE (1 << 12) #define PORTC_PULSE_DURATION_2ms (0) #define PORTC_PULSE_DURATION_4_5ms (1 << 10) #define PORTC_PULSE_DURATION_6ms (2 << 10) #define PORTC_PULSE_DURATION_100ms (3 << 10) #define PORTC_HOTPLUG_NO_DETECT (0) #define PORTC_HOTPLUG_SHORT_DETECT (1 << 8) #define PORTC_HOTPLUG_LONG_DETECT (1 << 9) #define PORTB_HOTPLUG_ENABLE (1 << 4) #define PORTB_PULSE_DURATION_2ms (0) #define PORTB_PULSE_DURATION_4_5ms (1 << 2) #define PORTB_PULSE_DURATION_6ms (2 << 2) #define PORTB_PULSE_DURATION_100ms (3 << 2) #define PORTB_HOTPLUG_NO_DETECT (0) #define PORTB_HOTPLUG_SHORT_DETECT (1 << 0) #define PORTB_HOTPLUG_LONG_DETECT (1 << 1) #define PCH_GPIOA 0xc5010 #define PCH_GPIOB 0xc5014 #define PCH_GPIOC 0xc5018 #define PCH_GPIOD 0xc501c #define PCH_GPIOE 0xc5020 #define PCH_GPIOF 0xc5024 #define PCH_GMBUS0 0xc5100 #define PCH_GMBUS1 0xc5104 #define PCH_GMBUS2 0xc5108 #define PCH_GMBUS3 0xc510c #define PCH_GMBUS4 0xc5110 #define PCH_GMBUS5 0xc5120 #define PCH_DPLL_A 0xc6014 #define PCH_DPLL_B 0xc6018 #define PCH_FPA0 0xc6040 #define PCH_FPA1 0xc6044 #define PCH_FPB0 0xc6048 #define PCH_FPB1 0xc604c #define PCH_DPLL_TEST 0xc606c #define PCH_DREF_CONTROL 0xC6200 #define DREF_CONTROL_MASK 0x7fc3 #define DREF_CPU_SOURCE_OUTPUT_DISABLE (0<<13) #define DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD (2<<13) #define DREF_CPU_SOURCE_OUTPUT_NONSPREAD (3<<13) #define DREF_SSC_SOURCE_DISABLE (0<<11) #define DREF_SSC_SOURCE_ENABLE (2<<11) #define DREF_NONSPREAD_SOURCE_DISABLE (0<<9) #define DREF_NONSPREAD_SOURCE_ENABLE (2<<9) #define DREF_SUPERSPREAD_SOURCE_DISABLE (0<<7) #define DREF_SUPERSPREAD_SOURCE_ENABLE (2<<7) #define DREF_SSC4_DOWNSPREAD (0<<6) #define DREF_SSC4_CENTERSPREAD (1<<6) #define DREF_SSC1_DISABLE (0<<1) #define DREF_SSC1_ENABLE (1<<1) #define DREF_SSC4_DISABLE (0) #define DREF_SSC4_ENABLE (1) #define PCH_RAWCLK_FREQ 0xc6204 #define FDL_TP1_TIMER_SHIFT 12 #define FDL_TP1_TIMER_MASK (3<<12) #define FDL_TP2_TIMER_SHIFT 10 #define FDL_TP2_TIMER_MASK (3<<10) #define RAWCLK_FREQ_MASK 0x3ff #define PCH_DPLL_TMR_CFG 0xc6208 #define PCH_SSC4_PARMS 0xc6210 #define PCH_SSC4_AUX_PARMS 0xc6214 /* CPT */ #define PCH_DPLL_ANALOG_CTL 0xc6300 #define PCH_DPLL_SEL 0xc7000 #define TRANSA_DPLL_ENABLE (1<<3) #define TRANSA_DPLLA_SEL (0) #define TRANSA_DPLLB_SEL (1<<0) #define TRANSB_DPLL_ENABLE (1<<7) #define TRANSB_DPLLA_SEL (0<<4) #define TRANSB_DPLLB_SEL (1<<4) #define TRANSC_DPLL_ENABLE (1<<11) #define TRANSC_DPLLA_SEL (0<<8) #define TRANSC_DPLLB_SEL (1<<8) /* transcoder */ #define TRANS_HTOTAL_A 0xe0000 #define TRANS_HBLANK_A 0xe0004 #define TRANS_HSYNC_A 0xe0008 #define TRANS_VTOTAL_A 0xe000c #define TRANS_VBLANK_A 0xe0010 #define TRANS_VSYNC_A 0xe0014 #define TRANS_VSYNCSHIFT_A 0xe0028 #define TRANS_HTOTAL_A 0xe0000 #define TRANS_HTOTAL_SHIFT 16 #define TRANS_HACTIVE_SHIFT 0 #define TRANS_HBLANK_A 0xe0004 #define TRANS_HBLANK_END_SHIFT 16 #define TRANS_HBLANK_START_SHIFT 0 #define TRANS_HSYNC_A 0xe0008 #define TRANS_HSYNC_END_SHIFT 16 #define TRANS_HSYNC_START_SHIFT 0 #define TRANS_VTOTAL_A 0xe000c #define TRANS_VTOTAL_SHIFT 16 #define TRANS_VACTIVE_SHIFT 0 #define TRANS_VBLANK_A 0xe0010 #define TRANS_VBLANK_END_SHIFT 16 #define TRANS_VBLANK_START_SHIFT 0 #define TRANS_VSYNC_A 0xe0014 #define TRANS_VSYNC_END_SHIFT 16 #define TRANS_VSYNC_START_SHIFT 0 #define TRANS_VSYNCSHIFT_A 0xe0028 #define TRANSA_DATA_M1 0xe0030 #define TRANSA_DATA_N1 0xe0034 #define TRANSA_DATA_M2 0xe0038 #define TRANSA_DATA_N2 0xe003c #define TRANSA_DP_LINK_M1 0xe0040 #define TRANSA_DP_LINK_N1 0xe0044 #define TRANSA_DP_LINK_M2 0xe0048 #define TRANSA_DP_LINK_N2 0xe004c #define TRANS_HTOTAL_B 0xe1000 #define TRANS_HBLANK_B 0xe1004 #define TRANS_HSYNC_B 0xe1008 #define TRANS_VTOTAL_B 0xe100c #define TRANS_VBLANK_B 0xe1010 #define TRANS_VSYNC_B 0xe1014 #define TRANS_VSYNCSHIFT_B 0xe1028 #define TRANSB_DATA_M1 0xe1030 #define TRANSB_DATA_N1 0xe1034 #define TRANSB_DATA_M2 0xe1038 #define TRANSB_DATA_N2 0xe103c #define TRANSB_DP_LINK_M1 0xe1040 #define TRANSB_DP_LINK_N1 0xe1044 #define TRANSB_DP_LINK_M2 0xe1048 #define TRANSB_DP_LINK_N2 0xe104c #define TRANS_HTOTAL_C 0xe2000 #define TRANS_HBLANK_C 0xe2004 #define TRANS_HSYNC_C 0xe2008 #define TRANS_VTOTAL_C 0xe200c #define TRANS_VBLANK_C 0xe2010 #define TRANS_VSYNC_C 0xe2014 #define TRANS_VSYNCSHIFT_C 0xe2028 #define TRANSC_DATA_M1 0xe2030 #define TRANSC_DATA_N1 0xe2034 #define TRANSC_DATA_M2 0xe2038 #define TRANSC_DATA_N2 0xe203c #define TRANSC_DP_LINK_M1 0xe2040 #define TRANSC_DP_LINK_N1 0xe2044 #define TRANSC_DP_LINK_M2 0xe2048 #define TRANSC_DP_LINK_N2 0xe204c #define TRANSACONF 0xf0008 #define TRANSBCONF 0xf1008 #define TRANSCCONF 0xf2008 #define TRANS_DISABLE (0<<31) #define TRANS_ENABLE (1<<31) #define TRANS_STATE_MASK (1<<30) #define TRANS_STATE_DISABLE (0<<30) #define TRANS_STATE_ENABLE (1<<30) #define TRANS_FSYNC_DELAY_HB1 (0<<27) #define TRANS_FSYNC_DELAY_HB2 (1<<27) #define TRANS_FSYNC_DELAY_HB3 (2<<27) #define TRANS_FSYNC_DELAY_HB4 (3<<27) #define TRANS_DP_AUDIO_ONLY (1<<26) #define TRANS_DP_VIDEO_AUDIO (0<<26) #define TRANS_PROGRESSIVE (0<<21) #define TRANS_8BPC (0<<5) #define TRANS_10BPC (1<<5) #define TRANS_6BPC (2<<5) #define TRANS_12BPC (3<<5) #define FDI_RXA_CHICKEN 0xc200c #define FDI_RXB_CHICKEN 0xc2010 #define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1) /* CPU: FDI_TX */ #define FDI_TXA_CTL 0x60100 #define FDI_TXB_CTL 0x61100 #define FDI_TXC_CTL 0x62100 #define FDI_TX_DISABLE (0<<31) #define FDI_TX_ENABLE (1<<31) #define FDI_LINK_TRAIN_PATTERN_1 (0<<28) #define FDI_LINK_TRAIN_PATTERN_2 (1<<28) #define FDI_LINK_TRAIN_PATTERN_IDLE (2<<28) #define FDI_LINK_TRAIN_NONE (3<<28) #define FDI_LINK_TRAIN_VOLTAGE_0_4V (0<<25) #define FDI_LINK_TRAIN_VOLTAGE_0_6V (1<<25) #define FDI_LINK_TRAIN_VOLTAGE_0_8V (2<<25) #define FDI_LINK_TRAIN_VOLTAGE_1_2V (3<<25) #define FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22) #define FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22) #define FDI_LINK_TRAIN_PRE_EMPHASIS_2X (2<<22) #define FDI_LINK_TRAIN_PRE_EMPHASIS_3X (3<<22) /* ILK always use 400mV 0dB for voltage swing and pre-emphasis level. SNB has different settings. */ /* SNB A-stepping */ #define FDI_LINK_TRAIN_400MV_0DB_SNB_A (0x38<<22) #define FDI_LINK_TRAIN_400MV_6DB_SNB_A (0x02<<22) #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22) #define FDI_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22) /* SNB B-stepping */ #define FDI_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22) #define FDI_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22) #define FDI_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22) #define FDI_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22) #define FDI_LINK_TRAIN_VOL_EMP_MASK (0x3f<<22) #define FDI_DP_PORT_WIDTH_X1 (0<<19) #define FDI_DP_PORT_WIDTH_X2 (1<<19) #define FDI_DP_PORT_WIDTH_X3 (2<<19) #define FDI_DP_PORT_WIDTH_X4 (3<<19) #define FDI_TX_ENHANCE_FRAME_ENABLE (1<<18) /* Ironlake: hardwired to 1 */ #define FDI_TX_PLL_ENABLE (1<<14) /* both Tx and Rx */ #define FDI_SCRAMBLING_ENABLE (0<<7) #define FDI_SCRAMBLING_DISABLE (1<<7) /* Additional cpu TX control regs, from ivb bspec */ #define DPAFE_BMFUNC 0x6c024 #define DPAFE_DL_IREFCAL0 0x6c02c #define DPAFE_DL_IREFCAL1 0x6c030 #define DPAFE_DP_IREFCAL 0x6c034 /* FDI_RX, FDI_X is hard-wired to Transcoder_X */ #define FDI_RXA_CTL 0xf000c #define FDI_RXB_CTL 0xf100c #define FDI_RXC_CTL 0xf200c #define FDI_RX_ENABLE (1<<31) #define FDI_RX_DISABLE (0<<31) /* train, dp width same as FDI_TX */ #define FDI_DP_PORT_WIDTH_X8 (7<<19) #define FDI_8BPC (0<<16) #define FDI_10BPC (1<<16) #define FDI_6BPC (2<<16) #define FDI_12BPC (3<<16) #define FDI_LINK_REVERSE_OVERWRITE (1<<15) #define FDI_DMI_LINK_REVERSE_MASK (1<<14) #define FDI_RX_PLL_ENABLE (1<<13) #define FDI_FS_ERR_CORRECT_ENABLE (1<<11) #define FDI_FE_ERR_CORRECT_ENABLE (1<<10) #define FDI_FS_ERR_REPORT_ENABLE (1<<9) #define FDI_FE_ERR_REPORT_ENABLE (1<<8) #define FDI_RX_ENHANCE_FRAME_ENABLE (1<<6) #define FDI_SEL_RAWCLK (0<<4) #define FDI_SEL_PCDCLK (1<<4) /* CPT */ #define FDI_AUTO_TRAINING (1<<10) #define FDI_LINK_TRAIN_PATTERN_1_CPT (0<<8) #define FDI_LINK_TRAIN_PATTERN_2_CPT (1<<8) #define FDI_LINK_TRAIN_PATTERN_IDLE_CPT (2<<8) #define FDI_LINK_TRAIN_NORMAL_CPT (3<<8) #define FDI_LINK_TRAIN_PATTERN_MASK_CPT (3<<8) #define FDI_RXA_MISC 0xf0010 #define FDI_RXB_MISC 0xf1010 #define FDI_RXC_MISC 0xf2010 #define FDI_RXA_TUSIZE1 0xf0030 #define FDI_RXA_TUSIZE2 0xf0038 #define FDI_RXB_TUSIZE1 0xf1030 #define FDI_RXB_TUSIZE2 0xf1038 #define FDI_RXC_TUSIZE1 0xf2030 #define FDI_RXC_TUSIZE2 0xf2038 /* FDI_RX interrupt register format */ #define FDI_RX_INTER_LANE_ALIGN (1<<10) #define FDI_RX_SYMBOL_LOCK (1<<9) /* train 2 */ #define FDI_RX_BIT_LOCK (1<<8) /* train 1 */ #define FDI_RX_TRAIN_PATTERN_2_FAIL (1<<7) #define FDI_RX_FS_CODE_ERR (1<<6) #define FDI_RX_FE_CODE_ERR (1<<5) #define FDI_RX_SYMBOL_ERR_RATE_ABOVE (1<<4) #define FDI_RX_HDCP_LINK_FAIL (1<<3) #define FDI_RX_PIXEL_FIFO_OVERFLOW (1<<2) #define FDI_RX_CROSS_CLOCK_OVERFLOW (1<<1) #define FDI_RX_SYMBOL_QUEUE_OVERFLOW (1<<0) #define FDI_RXA_IIR 0xf0014 #define FDI_RXA_IMR 0xf0018 #define FDI_RXB_IIR 0xf1014 #define FDI_RXB_IMR 0xf1018 #define FDI_PLL_CTL_1 0xfe000 #define FDI_PLL_CTL_2 0xfe004 /* CRT */ #define PCH_ADPA 0xe1100 #define ADPA_TRANS_SELECT_MASK (1<<30) #define ADPA_TRANS_A_SELECT 0 #define ADPA_TRANS_B_SELECT (1<<30) /* HPD is here */ #define ADPA_CRT_HOTPLUG_MASK 0x03ff0000 /* bit 25-16 */ #define ADPA_CRT_HOTPLUG_MONITOR_NONE (0<<24) #define ADPA_CRT_HOTPLUG_MONITOR_MASK (3<<24) #define ADPA_CRT_HOTPLUG_MONITOR_COLOR (3<<24) #define ADPA_CRT_HOTPLUG_MONITOR_MONO (2<<24) #define ADPA_CRT_HOTPLUG_ENABLE (1<<23) #define ADPA_CRT_HOTPLUG_PERIOD_64 (0<<22) #define ADPA_CRT_HOTPLUG_PERIOD_128 (1<<22) #define ADPA_CRT_HOTPLUG_WARMUP_5MS (0<<21) #define ADPA_CRT_HOTPLUG_WARMUP_10MS (1<<21) #define ADPA_CRT_HOTPLUG_SAMPLE_2S (0<<20) #define ADPA_CRT_HOTPLUG_SAMPLE_4S (1<<20) #define ADPA_CRT_HOTPLUG_VOLTAGE_40 (0<<18) #define ADPA_CRT_HOTPLUG_VOLTAGE_50 (1<<18) #define ADPA_CRT_HOTPLUG_VOLTAGE_60 (2<<18) #define ADPA_CRT_HOTPLUG_VOLTAGE_70 (3<<18) #define ADPA_CRT_HOTPLUG_VOLREF_325MV (0<<17) #define ADPA_CRT_HOTPLUG_VOLREF_475MV (1<<17) #define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16) /* polarity control not changed */ /* or SDVOB */ #define HDMIB 0xe1140 #define PORT_ENABLE (1 << 31) #define TRANSCODER_A (0) #define TRANSCODER_B (1 << 30) #define COLOR_FORMAT_8bpc (0) #define COLOR_FORMAT_12bpc (3 << 26) #define SDVOB_HOTPLUG_ENABLE (1 << 23) #define SDVO_ENCODING (0) #define TMDS_ENCODING (2 << 10) #define NULL_PACKET_VSYNC_ENABLE (1 << 9) #define SDVOB_BORDER_ENABLE (1 << 7) #define AUDIO_ENABLE (1 << 6) #define VSYNC_ACTIVE_HIGH (1 << 4) #define HSYNC_ACTIVE_HIGH (1 << 3) #define PORT_DETECTED (1 << 2) #define HDMIC 0xe1150 #define HDMID 0xe1160 #define PCH_LVDS 0xe1180 /* Since IVB, the old _CTL2 is now _CTL and the old _CTL is now _DATA. */ #define BLC_PWM_CPU_CTL2 0x48250 #define BLC_PWM2_CPU_CTL2 0x48350 #define PWM_ENABLE (1 << 31) #define PWM_PIPE_A (0 << 29) #define PWM_PIPE_B (1 << 29) #define BLC_PWM_CPU_CTL 0x48254 #define BLC_PWM2_CPU_CTL 0x48354 #define BLC_MISC_CTL 0x48360 #define UTIL_PIN_CTL 0x48400 #define BLC_PWM_PCH_CTL1 0xc8250 #define PWM_PCH_ENABLE (1 << 31) #define PWM_POLARITY_ACTIVE_LOW (1 << 29) #define PWM_POLARITY_ACTIVE_HIGH (0 << 29) #define PWM_POLARITY_ACTIVE_LOW2 (1 << 28) #define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28) #define BLC_PWM_PCH_CTL2 0xc8254 #define PCH_PP_STATUS 0xc7200 #define PCH_PP_CONTROL 0xc7204 #define EDP_FORCE_VDD (1 << 3) #define EDP_BLC_ENABLE (1 << 2) #define PANEL_POWER_RESET (1 << 1) #define PANEL_POWER_OFF (0 << 0) #define PANEL_POWER_ON (1 << 0) #define PCH_PP_ON_DELAYS 0xc7208 #define EDP_PANEL (1 << 30) #define PCH_PP_OFF_DELAYS 0xc720c #define PCH_PP_DIVISOR 0xc7210 #define AUD_CONFIG 0x62000 #define AUD_DEBUG 0x62010 #define AUD_VID_DID 0x62020 #define AUD_RID 0x62024 #define AUD_SUBN_CNT 0x62028 #define AUD_FUNC_GRP 0x62040 #define AUD_SUBN_CNT2 0x62044 #define AUD_GRP_CAP 0x62048 #define AUD_PWRST 0x6204c #define AUD_SUPPWR 0x62050 #define AUD_SID 0x62054 #define AUD_OUT_CWCAP 0x62070 #define AUD_OUT_PCMSIZE 0x62074 #define AUD_OUT_STR 0x62078 #define AUD_OUT_DIG_CNVT 0x6207c #define AUD_OUT_CH_STR 0x62080 #define AUD_OUT_STR_DESC 0x62084 #define AUD_PINW_CAP 0x620a0 #define AUD_PIN_CAP 0x620a4 #define AUD_PINW_CONNLNG 0x620a8 #define AUD_PINW_CONNLST 0x620ac #define AUD_PINW_CNTR 0x620b0 #define AUD_PINW_UNSOLRESP 0x620b8 #define AUD_CNTL_ST 0x620b4 #define AUD_PINW_CONFIG 0x620bc #define AUD_HDMIW_STATUS 0x620d4 #define AUD_HDMIW_HDMIEDID 0x6210c #define AUD_HDMIW_INFOFR 0x62118 #define AUD_CONV_CHCNT 0x62120 #define AUD_CTS_ENABLE 0x62128 #define VIDEO_DIP_CTL 0x61170 #define VIDEO_DIP_DATA 0x61178 /* CPT */ #define TRANS_DP_CTL_A 0xe0300 #define TRANS_DP_CTL_B 0xe1300 #define TRANS_DP_CTL_C 0xe2300 #define TRANS_DP_OUTPUT_ENABLE (1<<31) #define TRANS_DP_PORT_SEL_B (0<<29) #define TRANS_DP_PORT_SEL_C (1<<29) #define TRANS_DP_PORT_SEL_D (2<<29) #define TRANS_DP_PORT_SEL_MASK (3<<29) #define TRANS_DP_AUDIO_ONLY (1<<26) #define TRANS_DP_ENH_FRAMING (1<<18) #define TRANS_DP_8BPC (0<<9) #define TRANS_DP_10BPC (1<<9) #define TRANS_DP_6BPC (2<<9) #define TRANS_DP_12BPC (3<<9) #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) #define TRANS_DP_VSYNC_ACTIVE_LOW 0 #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) #define TRANS_DP_HSYNC_ACTIVE_LOW 0 /* Debug regs */ #define GEN6_TD_CTL 0x7000 /* <= GEN5 was at 0x8000 */ #define GEN6_TD_CTL_FORCE_TD_BKPT (1<<4) /* Port debugging */ #define PORT_DBG 0x42308 #define PORT_DBG_DRRS_HW_STATE_OFF (0<<30) #define PORT_DBG_DRRS_HW_STATE_LOW (1<<30) #define PORT_DBG_DRRS_HW_STATE_HIGH (2<<30) /* RC6 residence counters */ #define RC6_RESIDENCY_TIME 0x138108 #define RC6p_RESIDENCY_TIME 0x13810C #define RC6pp_RESIDENCY_TIME 0x138110 #define GEN6_RPNSWREQ 0xA008 #define GEN6_RC_VIDEO_FREQ 0xA00C #define GEN6_RC_CONTROL 0xA090 #define GEN6_RP_DOWN_TIMEOUT 0xA010 #define GEN6_RP_INTERRUPT_LIMITS 0xA014 #define GEN6_RPSTAT1 0xA01C #define GEN6_RP_CONTROL 0xA024 #define GEN6_RP_UP_THRESHOLD 0xA02C #define GEN6_RP_DOWN_THRESHOLD 0xA030 #define GEN6_RP_CUR_UP_EI 0xA050 #define GEN6_RP_CUR_UP 0xA054 #define GEN6_RP_PREV_UP 0xA058 #define GEN6_RP_CUR_DOWN_EI 0xA05C #define GEN6_RP_CUR_DOWN 0xA060 #define GEN6_RP_PREV_DOWN 0xA064 #define GEN6_RP_UP_EI 0xA068 #define GEN6_RP_DOWN_EI 0xA06C #define GEN6_RP_IDLE_HYSTERSIS 0xA070 #define GEN6_RC_STATE 0xA094 #define GEN6_RC1_WAKE_RATE_LIMIT 0xA098 #define GEN6_RC6_WAKE_RATE_LIMIT 0xA09C #define GEN6_RC6pp_WAKE_RATE_LIMIT 0xA0A0 #define GEN6_RC_EVALUATION_INTERVAL 0xA0A8 #define GEN6_RC_IDLE_HYSTERSIS 0xA0AC #define GEN6_RC_SLEEP 0xA0B0 #define GEN6_RC1e_THRESHOLD 0xA0B4 #define GEN6_RC6_THRESHOLD 0xA0B8 #define GEN6_RC6p_THRESHOLD 0xA0BC #define GEN6_RC6pp_THRESHOLD 0xA0C0 #define GEN6_PMINTRMSK 0xA168 #define GEN6_RC_EVALUATION_INTERVAL 0xA0A8 #define GEN6_RC_IDLE_HYSTERSIS 0xA0AC #define GEN6_PMIER 0x4402C #define GEN6_PMIMR 0x44024 /* rps_lock */ #define GEN6_PMINTRMSK 0xA168 /* Haswell-related items */ /* HSW Power Wells */ #define HSW_PWR_WELL_CTL1 0x45400 /* BIOS */ #define HSW_PWR_WELL_CTL2 0x45404 /* Driver */ #define HSW_PWR_WELL_CTL3 0x45408 /* KVMR */ #define HSW_PWR_WELL_CTL4 0x4540C /* Debug */ #define HSW_PWR_WELL_ENABLE_REQUEST (1<<31) #define HSW_PWR_WELL_STATE_ENABLED (1<<30) #define HSW_PWR_WELL_CTL5 0x45410 #define HSW_PWR_WELL_ENABLE_SINGLE_STEP (1<<31) #define HSW_PWR_WELL_PWR_GATE_OVERRIDE (1<<20) #define HSW_PWR_WELL_FORCE_ON (1<<19) #define HSW_PWR_WELL_CTL6 0x45414 /* Per-pipe DDI Function Control */ #define PIPE_DDI_FUNC_CTL_A 0x60400 #define PIPE_DDI_FUNC_CTL_B 0x61400 #define PIPE_DDI_FUNC_CTL_C 0x62400 #define PIPE_DDI_FUNC_CTL_EDP 0x6F400 #define DDI_FUNC_CTL(pipe) _PIPE(pipe, \ PIPE_DDI_FUNC_CTL_A, \ PIPE_DDI_FUNC_CTL_B) #define PIPE_DDI_FUNC_ENABLE (1<<31) /* Those bits are ignored by pipe EDP since it can only connect to DDI A */ #define PIPE_DDI_PORT_MASK (0xf<<28) #define PIPE_DDI_SELECT_PORT(x) ((x)<<28) #define PIPE_DDI_MODE_SELECT_HDMI (0<<24) #define PIPE_DDI_MODE_SELECT_DVI (1<<24) #define PIPE_DDI_MODE_SELECT_DP_SST (2<<24) #define PIPE_DDI_MODE_SELECT_DP_MST (3<<24) #define PIPE_DDI_MODE_SELECT_FDI (4<<24) #define PIPE_DDI_BPC_8 (0<<20) #define PIPE_DDI_BPC_10 (1<<20) #define PIPE_DDI_BPC_6 (2<<20) #define PIPE_DDI_BPC_12 (3<<20) #define PIPE_DDI_BFI_ENABLE (1<<4) #define PIPE_DDI_PORT_WIDTH_X1 (0<<1) #define PIPE_DDI_PORT_WIDTH_X2 (1<<1) #define PIPE_DDI_PORT_WIDTH_X4 (3<<1) /* DisplayPort Transport Control */ #define DP_TP_CTL_A 0x64040 #define DP_TP_CTL_B 0x64140 #define DP_TP_CTL_C 0x64240 #define DP_TP_CTL_D 0x64340 #define DP_TP_CTL_E 0x64440 #define DP_TP_CTL_ENABLE (1<<31) #define DP_TP_CTL_MODE_SST (0<<27) #define DP_TP_CTL_MODE_MST (1<<27) #define DP_TP_CTL_ENHANCED_FRAME_ENABLE (1<<18) #define DP_TP_CTL_FDI_AUTOTRAIN (1<<15) #define DP_TP_CTL_LINK_TRAIN_MASK (7<<8) #define DP_TP_CTL_LINK_TRAIN_PAT1 (0<<8) #define DP_TP_CTL_LINK_TRAIN_PAT2 (1<<8) #define DP_TP_CTL_LINK_TRAIN_NORMAL (3<<8) /* DisplayPort Transport Status */ #define DP_TP_STATUS_A 0x64044 #define DP_TP_STATUS_B 0x64144 #define DP_TP_STATUS_C 0x64244 #define DP_TP_STATUS_D 0x64344 #define DP_TP_STATUS_E 0x64444 #define DP_TP_STATUS_AUTOTRAIN_DONE (1<<12) /* DDI Buffer Control */ #define DDI_BUF_CTL_A 0x64000 #define DDI_BUF_CTL_B 0x64100 #define DDI_BUF_CTL_C 0x64200 #define DDI_BUF_CTL_D 0x64300 #define DDI_BUF_CTL_E 0x64400 #define DDI_BUF_CTL_ENABLE (1<<31) #define DDI_BUF_EMP_400MV_0DB_HSW (0<<24) /* Sel0 */ #define DDI_BUF_EMP_400MV_3_5DB_HSW (1<<24) /* Sel1 */ #define DDI_BUF_EMP_400MV_6DB_HSW (2<<24) /* Sel2 */ #define DDI_BUF_EMP_400MV_9_5DB_HSW (3<<24) /* Sel3 */ #define DDI_BUF_EMP_600MV_0DB_HSW (4<<24) /* Sel4 */ #define DDI_BUF_EMP_600MV_3_5DB_HSW (5<<24) /* Sel5 */ #define DDI_BUF_EMP_600MV_6DB_HSW (6<<24) /* Sel6 */ #define DDI_BUF_EMP_800MV_0DB_HSW (7<<24) /* Sel7 */ #define DDI_BUF_EMP_800MV_3_5DB_HSW (8<<24) /* Sel8 */ #define DDI_BUF_EMP_MASK (0xf<<24) #define DDI_BUF_IS_IDLE (1<<7) #define DDI_PORT_WIDTH_X1 (0<<1) #define DDI_PORT_WIDTH_X2 (1<<1) #define DDI_PORT_WIDTH_X4 (3<<1) #define DDI_INIT_DISPLAY_DETECTED (1<<0) /* LPT PIXCLK_GATE */ #define PIXCLK_GATE 0xC6020 #define PIXCLK_GATE_UNGATE 1<<0 #define PIXCLK_GATE_GATE 0<<0 /* SPLL */ #define SPLL_CTL 0x46020 #define SPLL_PLL_ENABLE (1<<31) #define SPLL_PLL_SCC (1<<28) #define SPLL_PLL_NON_SCC (2<<28) #define SPLL_PLL_FREQ_810MHz (0<<26) #define SPLL_PLL_FREQ_1350MHz (1<<26) /* WRPLL */ #define WRPLL_CTL1 0x46040 #define WRPLL_CTL2 0x46060 #define WRPLL_PLL_ENABLE (1<<31) #define WRPLL_PLL_SELECT_SSC (0x01<<28) #define WRPLL_PLL_SELECT_NON_SCC (0x02<<28) #define WRPLL_PLL_SELECT_LCPLL_2700 (0x03<<28) /* WRPLL divider programming */ #define WRPLL_DIVIDER_REFERENCE(x) ((x)<<0) #define WRPLL_DIVIDER_POST(x) ((x)<<8) #define WRPLL_DIVIDER_FEEDBACK(x) ((x)<<16) /* Port clock selection */ #define PORT_CLK_SEL_A 0x46100 #define PORT_CLK_SEL_B 0x46104 #define PORT_CLK_SEL_C 0x46108 #define PORT_CLK_SEL_D 0x4610C #define PORT_CLK_SEL_E 0x46110 #define PORT_CLK_SEL_LCPLL_2700 (0<<29) #define PORT_CLK_SEL_LCPLL_1350 (1<<29) #define PORT_CLK_SEL_LCPLL_810 (2<<29) #define PORT_CLK_SEL_SPLL (3<<29) #define PORT_CLK_SEL_WRPLL1 (4<<29) #define PORT_CLK_SEL_WRPLL2 (5<<29) /* Pipe clock selection */ #define PIPE_CLK_SEL_A 0x46140 #define PIPE_CLK_SEL_B 0x46144 #define PIPE_CLK_SEL_C 0x46148 /* For each pipe, we need to select the corresponding port clock */ #define PIPE_CLK_SEL_DISABLED (0x0<<29) #define PIPE_CLK_SEL_PORT(x) ((x+1)<<29) /* LCPLL Control */ #define LCPLL_CTL 0x130040 #define LCPLL_PLL_DISABLE (1<<31) #define LCPLL_PLL_LOCK (1<<30) #define LCPLL_CD_CLOCK_DISABLE (1<<25) #define LCPLL_CD2X_CLOCK_DISABLE (1<<23) /* Pipe WM_LINETIME - watermark line time */ #define WM_PIPE_A 0x45100 #define WM_PIPE_B 0x45104 #define WM_PIPE_C 0x45200 #define WM_LP1 0x45108 #define WM_LP2 0x4510C #define WM_LP3 0x45110 #define WM_LP1_SPR 0x45120 #define WM_LP2_SPR 0x45124 #define WM_LP3_SPR 0x45128 #define WM_MISC 0x45260 #define WM_SR_CNT 0x45264 #define WM_DBG 0x45280 #define PIPE_WM_LINETIME_A 0x45270 #define PIPE_WM_LINETIME_B 0x45274 #define PIPE_WM_LINETIME_C 0x45278 #define PIPE_WM_LINETIME_MASK (0x1ff) #define PIPE_WM_LINETIME_TIME(x) ((x)) #define PIPE_WM_LINETIME_IPS_LINETIME_MASK (0x1ff<<16) #define PIPE_WM_LINETIME_IPS_LINETIME(x) ((x)<<16) /* SFUSE_STRAP */ #define SFUSE_STRAP 0xc2014 #define SFUSE_STRAP_DDIB_DETECTED (1<<2) #define SFUSE_STRAP_DDIC_DETECTED (1<<1) #define SFUSE_STRAP_DDID_DETECTED (1<<0) /* Valleyview related items */ #define VLV_DISPLAY_BASE 0x180000 /* * IOSF sideband */ #define VLV_IOSF_DOORBELL_REQ (VLV_DISPLAY_BASE + 0x2100) #define IOSF_DEVFN_SHIFT 24 #define IOSF_OPCODE_SHIFT 16 #define IOSF_PORT_SHIFT 8 #define IOSF_BYTE_ENABLES_SHIFT 4 #define IOSF_BAR_SHIFT 1 #define IOSF_SB_BUSY (1<<0) #define IOSF_PORT_BUNIT 0x3 #define IOSF_PORT_PUNIT 0x4 #define IOSF_PORT_NC 0x11 #define IOSF_PORT_DPIO 0x12 #define IOSF_PORT_DPIO_2 0x1a #define IOSF_PORT_GPIO_NC 0x13 #define IOSF_PORT_CCK 0x14 #define IOSF_PORT_CCU 0xA9 #define IOSF_PORT_GPS_CORE 0x48 #define IOSF_PORT_FLISDSI 0x1B #define VLV_IOSF_DATA (VLV_DISPLAY_BASE + 0x2104) #define VLV_IOSF_ADDR (VLV_DISPLAY_BASE + 0x2108) /* Some Skylake test registers */ #define TRANS_DDI_FUNC_CTL_EDP 0x6f400 #define TRANS_DDI_FUNC_CTL_A 0x60400 #define TRANS_DDI_FUNC_CTL_B 0x61400 #define TRANS_DDI_FUNC_CTL_C 0x62400 #endif /* _I810_REG_H */ ================================================ FILE: README.md ================================================ AppleIntelInfo.kext =================== What do I need to do? Step 1.) Download the project from Github and compile it with Xcode. Step 2.) Fix file ownership and permissions. ``` sh sudo chown -R root:wheel AppleIntelInfo.kext sudo chmod -R 755 AppleIntelInfo.kext ``` Step 3.) Load AppleIntelInfo.kext? ``` sh sudo kextload AppleIntelInfo.kext or with sudo kextutil AppleIntelInfo.kext ``` Warning: Do not copy the kext to: /System/Library/Extensions or /Library/Extensions and do not inject it with help of the boot loader! Step 4.) Unload AppleIntelInfo.kext? ``` sh sudo kextunload AppleIntelInfo.kext ``` Where can I find the output? The output of AppleIntelInfo.kext can be found with ``` sh sudo cat /tmp/AppleIntelInfo.dat ``` Note: This has changed in version 1.2 (data no longer added to /var/log/system.log) Settings -------- There are five (5) settings that you can change in AppleIntelInfo.kext/Contents/Info.plist: ``` logCStates logIGPU logIPGStyle logIntelRegs logMSRs ``` All set to YES by default. Bugs ---- All possible bugs (so called 'issues') should be filed at: https://github.com/Piker-Alpha/AppleIntelInfo/issues Please do **not** use my blog for this. Thank you!