[
  {
    "path": ".gitignore",
    "content": ".DS_Store\n.git\n\nxcuserdata\nproject.xcworkspace\n\n/AppleIntelInfo/AppleIntelInfo.xcodeproj/xcuserdata\n/AppleIntelInfo/AppleIntelInfo.xcodeproj/project.xcworkspace\n"
  },
  {
    "path": "AppleIntelInfo/AppleIntelInfo-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>${EXECUTABLE_NAME}</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>${PRODUCT_NAME}</string>\n\t<key>CFBundlePackageType</key>\n\t<string>KEXT</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>2.9</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>2.9</string>\n\t<key>IOKitPersonalities</key>\n\t<dict>\n\t\t<key>AppleIntelInfo</key>\n\t\t<dict>\n\t\t\t<key>CFBundleIdentifier</key>\n\t\t\t<string>com.pikeralpha.driver.${PRODUCT_NAME:rfc1034identifier}</string>\n\t\t\t<key>IOClass</key>\n\t\t\t<string>${PRODUCT_NAME:rfc1034identifier}</string>\n\t\t\t<key>IOMatchCategory</key>\n\t\t\t<string>${PRODUCT_NAME:rfc1034identifier}</string>\n\t\t\t<key>IOProviderClass</key>\n\t\t\t<string>IOResources</string>\n\t\t\t<key>IOResourceMatch</key>\n\t\t\t<string>IOKit</string>\n\t\t\t<key>logCStates</key>\n\t\t\t<true/>\n\t\t\t<key>logIGPU</key>\n\t\t\t<true/>\n\t\t\t<key>logIPGStyle</key>\n\t\t\t<true/>\n\t\t\t<key>logIntelRegs</key>\n\t\t\t<false/>\n\t\t\t<key>logMSRs</key>\n\t\t\t<true/>\n\t\t\t<key>enableHWP</key>\n\t\t\t<false/>\n\t\t</dict>\n\t</dict>\n\t<key>NSHumanReadableCopyright</key>\n\t<string>Copyright © 2014-2017 Pike R. Alpha. All rights reserved.</string>\n\t<key>OSBundleLibraries</key>\n\t<dict>\n\t\t<key>com.apple.kpi.bsd</key>\n\t\t<string>10.4</string>\n\t\t<key>com.apple.kpi.iokit</key>\n\t\t<string>10.4</string>\n\t\t<key>com.apple.kpi.libkern</key>\n\t\t<string>10.4</string>\n\t\t<key>com.apple.kpi.mach</key>\n\t\t<string>10.4</string>\n\t\t<key>com.apple.kpi.unsupported</key>\n\t\t<string>10.5</string>\n\t</dict>\n\t<key>OSBundleRequired</key>\n\t<string>Root</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "AppleIntelInfo/AppleIntelInfo-Prefix.pch",
    "content": "//\n//  Prefix header\n//\n//  The contents of this file are implicitly included at the beginning of every source file.\n//\n\n"
  },
  {
    "path": "AppleIntelInfo/AppleIntelInfo.cpp",
    "content": "/*\n * Copyright (c) 2012-2017 Pike R. Alpha. All rights reserved.\n *\n * Original idea and initial development of MSRDumper.kext (c) 2011 by RevoGirl.\n *\n * Thanks to George for his help and continuation of Sam's work, but it is\n * time for us to push the envelope and add some really interesting stuff.\n *\n * This work is licensed under the Creative Commons Attribution-NonCommercial\n * 4.0 Unported License => http://creativecommons.org/licenses/by-nc/4.0\n */\n\n#include \"AppleIntelInfo.h\"\n\n\n#if WRITE_LOG_REPORT\n//==============================================================================\n\nint AppleIntelInfo::writeReport(void)\n{\n\tint error = 0;\n\tint length = (int)strlen(logBuffer);\n\n\tstruct vnode * vp;\n\t\n\tif (mCtx)\n\t{\n\t\tif ((error = vnode_open(FILE_PATH, (O_TRUNC | O_CREAT | FWRITE | O_NOFOLLOW), S_IRUSR | S_IWUSR, VNODE_LOOKUP_NOFOLLOW, &vp, mCtx)))\n\t\t{\n\t\t\tIOLOG(\"AppleIntelInfo.kext: Error, vnode_open(%s) failed with error %d!\\n\", FILE_PATH, error);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif ((error = vnode_isreg(vp)) == VREG)\n\t\t\t{\n\t\t\t\tif ((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))))\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"AppleIntelInfo.kext: Error, vn_rdwr(%s) failed with error %d!\\n\", FILE_PATH, error);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treportFileOffset += length;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tIOLOG(\"AppleIntelInfo.kext: Error, vnode_isreg(%s) failed with error %d!\\n\", FILE_PATH, error);\n\t\t\t}\n\t\t\n\t\t\tif ((error = vnode_close(vp, FWASWRITTEN, mCtx)))\n\t\t\t{\n\t\t\t\tIOLOG(\"AppleIntelInfo.kext: Error, vnode_close() failed with error %d!\\n\", error);\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tIOLOG(\"AppleIntelInfo.kext: mCtx == NULL!\\n\");\n\t\terror = 0xFFFF;\n\t}\n\t\n\treturn error;\n}\n#endif\n\n\n#if REPORT_RAPL_MSRS\n//==============================================================================\n\nbool AppleIntelInfo::supportsRAPL(UInt16 aTargetRAPLFeature)\n{\n\tUInt16 supportedRAPLFeatures = 0;\n\n\tswitch (gCpuModel)\n\t{\n\t\tcase INTEL_FAM6_SANDYBRIDGE:\t\t// 0x2A\n\t\tcase INTEL_FAM6_IVYBRIDGE:\t\t\t// 0x3A\n\t\tcase INTEL_FAM6_HASWELL_CORE:\t\t// 0x3C\n\t\tcase INTEL_FAM6_HASWELL_ULT:\t\t// 0x45\n\t\tcase INTEL_FAM6_HASWELL_GT3E:\t\t// 0x46\n\t\tcase INTEL_FAM6_BROADWELL_CORE:\t\t// 0x3D\n\t\tcase INTEL_FAM6_BROADWELL_GT3E:\t\t// 0x47\n\t\t\tsupportedRAPLFeatures = (RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_GFX | RAPL_PKG_POWER_INFO);\n\t\t\tbreak;\n\n\t\tcase INTEL_FAM6_SKYLAKE_MOBILE:\t\t// 0x4E\n\t\tcase INTEL_FAM6_SKYLAKE_DESKTOP:\t// 0x5E\n\t\tcase INTEL_FAM6_CANNONLAKE_CORE:\t// 0x66\n\t\tcase INTEL_FAM6_KABYLAKE_MOBILE:\t// 0x8E\n\t\tcase INTEL_FAM6_KABYLAKE_DESKTOP:\t// 0x9E\n\t\t\tsupportedRAPLFeatures = (RAPL_PKG | RAPL_CORES | RAPL_CORE_POLICY | RAPL_DRAM | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_GFX | RAPL_PKG_POWER_INFO);\n\t\t\tbreak;\n\n\t\tcase INTEL_FAM6_HASWELL_X:\t\t\t// 0x3F\n\t\tcase INTEL_FAM6_SKYLAKE_X:\t\t\t// 0x55\n\t\tcase INTEL_FAM6_BROADWELL_X:\t\t// 0x56\n\t\tcase INTEL_FAM6_BROADWELL_XEON_D:\t// 0x56\n\t\tcase INTEL_FAM6_XEON_PHI_KNL:\t\t// 0x57\n        case INTEL_FAM6_XEON_PHI_KNM:\t\t// 0x85\n\t\t\tsupportedRAPLFeatures = (RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO);\n\t\t\tbreak;\n\n\t\tcase INTEL_FAM6_SANDYBRIDGE_X:\t\t// 0x2D\n\t\tcase INTEL_FAM6_IVYBRIDGE_X:\t\t// 0x3E\n\t\t\tsupportedRAPLFeatures = (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);\n\t\t\tbreak;\n\t}\n\t\n\tif (supportedRAPLFeatures & aTargetRAPLFeature)\n\t{\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}\n\n\n//==============================================================================\n\nvoid AppleIntelInfo::reportRAPL(UInt16 aTargetRAPL)\n{\n\tunsigned int Y = 0;\n\tunsigned int Z = 0;\n\tunsigned long long msr = rdmsr64(MSR_RAPL_POWER_UNIT);\n\n\tuint8_t power_unit = bitfield32(msr, 3, 0);\n\tuint8_t energy_status_unit = bitfield32(msr, 12, 8);\n\tuint8_t time_unit = bitfield32(msr, 19, 16);\n\n\tfloat joulesPerEnergyUnit = 1. / float(1ULL << energy_status_unit);\n\n\tswitch(aTargetRAPL)\n\t{\n\t\tcase RAPL_BASE:\t\t\t\t/* 0x606 MSR_RAPL_POWER_UNIT */\n\t\t\tIOLOG(\"\\nMSR_RAPL_POWER_UNIT..............(0x606) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Power Units.......................... : %u (1/%d Watt)\\n\", power_unit, (1 << power_unit));\n\t\t\t\tIOLOG(\" - Energy Status Units.................. : %u (%sJoules)\\n\", energy_status_unit, getUnitText(energy_status_unit));\n\t\t\t\tIOLOG(\" - Time Units .......................... : %u (%sSeconds)\\n\", time_unit, getUnitText(time_unit));\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase RAPL_PKG:\t\t\t\t\t/* 0x610 MSR_PKG_POWER_LIMIT / 0x611 MSR_PKG_ENERGY_STATUS */\n\t\t\tmsr = rdmsr64(MSR_PKG_POWER_LIMIT);\n\t\t\t\n\t\t\tIOLOG(\"\\nMSR_PKG_POWER_LIMIT..............(0x610) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Package Power Limit #1............... : %llu Watt\\n\", (bitfield32(msr, 14, 0) >> power_unit));\n\t\t\t\tIOLOG(\" - Enable Power Limit #1................ : %s\\n\", bitfield32(msr, 15, 15) ? \"1 (enabled)\": \"0 (disabled)\");\n\t\t\t\tIOLOG(\" - 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)\");\n\t\t\t\t\n\t\t\t\tY = bitfield32(msr, 21, 17);\n\t\t\t\tZ = bitfield32(msr, 23, 22);\n\t\t\t\t\n\t\t\t\tIOLOG(\" - 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));\n\t\t\t\tIOLOG(\" - Package Power Limit #2............... : %llu Watt\\n\", (bitfield32(msr, 46, 32) >> power_unit));\n\t\t\t\tIOLOG(\" - Enable Power Limit #2................ : %s\\n\", (msr & (1UL << 47)) ? \"1 (enabled)\": \"0 (disabled)\");\n\t\t\t\tIOLOG(\" - 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)\");\n\t\t\t\t\n\t\t\t\tY = bitfield32(msr, 53, 49);\n\t\t\t\tZ = bitfield32(msr, 55, 54);\n\t\t\t\t\n\t\t\t\tIOLOG(\" - 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));\n\t\t\t\tIOLOG(\" - Lock................................. : %s\\n\", bitfield32(msr, 63, 63) ? \"1 (MSR locked until next reset)\": \"0 (MSR not locked)\");\n\t\t\t}\n\t\t\t\n\t\t\tmsr = rdmsr64(MSR_PKG_ENERGY_STATUS);\n\t\t\t\n\t\t\tIOLOG(\"\\nMSR_PKG_ENERGY_STATUS............(0x611) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Total Energy Consumed................ : %llu Joules (Watt = Joules / seconds)\\n\", (long long unsigned)(bitfield32(msr, 31, 0) * joulesPerEnergyUnit));\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase RAPL_PKG_PERF_STATUS:\t\t/* 0x613 MSR_PKG_PERF_STATUS */\n\t\t\tbreak;\n\n\t\tcase RAPL_PKG_POWER_INFO:\t\t/* 0x614 MSR_PKG_POWER_INFO */\n\t\t\tmsr = rdmsr64(MSR_PKG_POWER_INFO);\n\t\t\t\n\t\t\tIOLOG(\"\\nMSR_PKG_POWER_INFO...............(0x614) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Thermal Spec Power................... : %llu Watt\\n\", (bitfield32(msr, 14, 0) >> power_unit));\n\t\t\t\tIOLOG(\" - Minimum Power........................ : %llu\\n\", (bitfield32(msr, 16, 30) >> power_unit));\n\t\t\t\tIOLOG(\" - Maximum Power........................ : %llu\\n\", (bitfield32(msr, 46, 32) >> power_unit));\n\t\t\t\tIOLOG(\" - Maximum Time Window.................. : %llu\\n\", (bitfield32(msr, 58, 48) >> time_unit));\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase RAPL_DRAM:\t\t\t\t/* 0x618 MSR_DRAM_POWER_LIMIT / 0x619 MSR_DRAM_ENERGY_STATUS */\n\t\t\tbreak;\n\n\t\tcase RAPL_DRAM_PERF_STATUS:\t/* 0x61b MSR_DRAM_PERF_STATUS */\n\t\t\tbreak;\n\n\t\tcase RAPL_DRAM_POWER_INFO:\t/* 0x61c MSR_DRAM_POWER_INFO */\n\t\t\tbreak;\n\n\t\tcase RAPL_CORES:\t\t\t/* 0x638 MSR_PP0_POWER_LIMIT / 0x639 MSR_PP0_ENERGY_STATUS */\n\t\t\tmsr = rdmsr64(MSR_PP0_POWER_LIMIT);\n\t\t\t\n\t\t\tIOLOG(\"\\nMSR_PP0_POWER_LIMIT..............(0x638) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Power Limit.......................... : %llu Watt\\n\", (bitfield32(msr, 14, 0) >> power_unit));\n\t\t\t\tIOLOG(\" - Enable Power Limit................... : %s\\n\", (msr & (1UL << 15)) ? \"1 (enabled)\": \"0 (disabled)\");\n\t\t\t\tIOLOG(\" - 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)\");\n\t\t\t\t\n\t\t\t\tY = bitfield32(msr, 21, 17);\n\t\t\t\tZ = bitfield32(msr, 23, 22);\n\t\t\t\t\n\t\t\t\tIOLOG(\" - Time Window for Power Limit.......... : %llu (%u milli-Seconds)\\n\", bitfield32(msr, 23, 17), (unsigned int)(((1 << Y) * (1.0 + Z)) * time_unit));\n\t\t\t\tIOLOG(\" - Lock................................. : %s\\n\", bitfield32(msr, 31, 31) ? \"1 (MSR locked until next reset)\": \"0 (MSR not locked)\");\n\t\t\t}\n\t\t\t\n\t\t\tmsr = rdmsr64(MSR_PP0_ENERGY_STATUS);\n\t\t\t\n\t\t\tIOLOG(\"\\nMSR_PP0_ENERGY_STATUS............(0x639) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Total Energy Consumed................ : %llu Joules (Watt = Joules / seconds)\\n\", (long long unsigned)(bitfield32(msr, 31, 0) * joulesPerEnergyUnit));\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase RAPL_CORE_POLICY:\t\t/* 0x63a MSR_PP0_POLICY */\n\t\t\tif (gCpuModel == INTEL_FAM6_SANDYBRIDGE) // 0x2A - Intel 325462.pdf Vol.3C 35-120\n\t\t\t{\n\t\t\t\tmsr = rdmsr64(MSR_PP0_POLICY);\n\t\t\t\t\n\t\t\t\tIOLOG(\"\\nMSR_PP0_POLICY...................(0x63a) : 0x%llX\\n\", msr);\n\t\t\t\t\n\t\t\t\tif (msr)\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\t\tIOLOG(\" - Priority Level....................... : %llu\\n\", bitfield32(msr, 4, 0));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase RAPL_GFX:\t\t\t\t/* 0x640 MSR_PP1_POWER_LIMIT / 0x641 MSR_PP1_ENERGY_STATUS /0x642 MSR_PP1_POLICY */\n\t\t\tmsr = rdmsr64(MSR_PP1_POWER_LIMIT);\n\n\t\t\tIOLOG(\"\\nMSR_PP1_POWER_LIMIT..............(0x640) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Power Limit.......................... : %llu Watt\\n\", (bitfield32(msr, 14, 0) >> power_unit));\n\t\t\t\tIOLOG(\" - Enable Power Limit................... : %s\\n\", (msr & (1UL << 15)) ? \"1 (enabled)\": \"0 (disabled)\");\n\t\t\t\tIOLOG(\" - 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)\");\n\t\t\t\t\n\t\t\t\tY = bitfield32(msr, 21, 17);\n\t\t\t\tZ = bitfield32(msr, 23, 22);\n\t\t\t\t\n\t\t\t\tIOLOG(\" - Time Window for Power Limit.......... : %llu (%u milli-Seconds)\\n\", bitfield32(msr, 23, 17), (unsigned int)(((1 << Y) * (1.0 + Z)) * time_unit));\n\t\t\t\tIOLOG(\" - Lock................................. : %s\\n\", bitfield32(msr, 31, 31) ? \"1 (MSR locked until next reset)\": \"0 (MSR not locked)\");\n\t\t\t}\n\t\t\t\n\t\t\tmsr = rdmsr64(MSR_PP1_ENERGY_STATUS);\n\t\t\t\n\t\t\tIOLOG(\"\\nMSR_PP1_ENERGY_STATUS............(0x641) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Total Energy Consumed................ : %llu Joules (Watt = Joules / seconds)\\n\", (long long unsigned)(bitfield32(msr, 31, 0) * joulesPerEnergyUnit));\n\t\t\t}\n\t\t\t\n\t\t\tmsr = rdmsr64(MSR_PP1_POLICY);\n\t\t\t\n\t\t\tIOLOG(\"\\nMSR_PP1_POLICY...................(0x642) : 0x%llX\\n\", msr);\n\t\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Priority Level....................... : %llu\\n\", bitfield32(msr, 4, 0));\n\t\t\t}\n\n\t\t\tbreak;\n\t}\n}\n#endif\n\n\n#if (REPORT_MSRS && REPORT_HWP)\n//==============================================================================\n\nvoid AppleIntelInfo::reportHWP(void)\n{\n\tuint32_t cpuid_reg[4];\n\tunsigned long long msr;\n\n\tdo_cpuid(0x00000006, cpuid_reg);\n\n\tif ((cpuid_reg[eax] & 0x80) == 0x80)\n\t{\n\t\tmsr = rdmsr64(IA32_PM_ENABLE);\n\n\t\tif (msr & 1)\n\t\t{\n\t\t\tshort mantissa\t= 0;\n\t\t\tshort exponent\t= 0;\n\n\t\t\tswitch (gCpuModel)\n\t\t\t{\n\t\t\t\tcase INTEL_FAM6_SKYLAKE_MOBILE:\n\t\t\t\tcase INTEL_FAM6_SKYLAKE_DESKTOP:\n\t\t\t\tcase INTEL_FAM6_KABYLAKE_MOBILE:\n\t\t\t\tcase INTEL_FAM6_KABYLAKE_DESKTOP:\n\t\t\t\t\tUInt64 pPerf = rdmsr64(IA32_PPERF);\n\t\t\t\t\tUInt64 aPerf = rdmsr64(IA32_APERF);\n\t\t\t\t\tfloat busy = ((pPerf * 100) / aPerf);\n\t\t\t\t\tUInt8 multiplier = (UInt8)(((gClockRatio + 0.5) * busy) / 100);\n\n\t\t\t\t\tIOLOG(\"MSR_PPERF........................(0x63E) : 0x%llX (%d)\\n\", msr, multiplier);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tIOLOG(\"\\nIA32_PM_ENABLE...................(0x770) : 0x%llX (HWP Supported and Enabled)\\n\", msr);\n\t\t\t\n\t\t\tmsr = rdmsr64(IA32_HWP_CAPABILITIES);\n\n\t\t\tIOLOG(\"\\nIA32_HWP_CAPABILITIES............(0x771) : 0x%llX\\n\", msr);\n\t\t\tIOLOG(\"-----------------------------------------\\n\");\n\t\t\tIOLOG(\" - Highest Performance.................. : %llu\\n\", bitfield32(msr, 7, 0));\n\t\t\tIOLOG(\" - Guaranteed Performance............... : %llu\\n\", bitfield32(msr, 15, 8));\n\t\t\tIOLOG(\" - Most Efficient Performance........... : %llu\\n\", bitfield32(msr, 23, 16));\n\t\t\tIOLOG(\" - Lowest Performance................... : %llu\\n\", bitfield32(msr, 31, 24));\n\n\t\t\tif ((cpuid_reg[eax] & 0x800) == 0x800)\n\t\t\t{\n\t\t\t\tmsr = rdmsr64(IA32_HWP_REQUEST_PKG);\n\t\t\t\t\n\t\t\t\tIOLOG(\"\\nIA32_HWP_REQUEST_PKG.............(0x772) : 0x%llX\\n\", msr);\n\t\t\t\tIOLOG(\"-----------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Minimum Performance.................. : %llu\\n\", bitfield32(msr, 7, 0));\n\t\t\t\tIOLOG(\" - Maximum Performance.................. : %llu\\n\", bitfield32(msr, 15, 8));\n\t\t\t\tIOLOG(\" - Desired Performance.................. : %llu\\n\", bitfield32(msr, 23, 16));\n\t\t\t\tIOLOG(\" - Energy Efficient Performance......... : %llu\\n\", bitfield32(msr, 31, 24));\n\n\t\t\t\tmantissa = bitfield32(msr, 38, 32);\n\t\t\t\texponent = bitfield32(msr, 41, 39);\n\n\t\t\t\tIOLOG(\" - Activity Window...................... : %d, %d\\n\", mantissa, exponent);\n\t\t\t}\n\t\t\t\n\t\t\tif ((cpuid_reg[eax] & 0x100) == 0x100)\n\t\t\t{\n\t\t\t\tmsr = rdmsr64(IA32_HWP_INTERRUPT);\n\n\t\t\t\tIOLOG(\"\\nIA32_HWP_INTERRUPT...............(0x773) : 0x%llX\\n\", msr);\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - Guaranteed Performance Change........ : %s\\n\", (msr & 1) ? \"1 (Interrupt generated on change of)\": \"0 (Interrupt generation disabled)\");\n\t\t\t\tIOLOG(\" - Excursion Minimum.................... : %s\\n\", (msr & 2) ? \"1 (Interrupt generated when unable to meet)\": \"0 (Interrupt generation disabled)\");\n\t\t\t}\n\t\t\t\n\t\t\tmsr = rdmsr64(IA32_HWP_REQUEST);\n\t\t\t\n\t\t\tIOLOG(\"\\nIA32_HWP_REQUEST................(0x774) : 0x%llX\\n\", msr);\n\t\t\tIOLOG(\"-----------------------------------------\\n\");\n\t\t\tIOLOG(\" - Minimum Performance................. : %llu\\n\", bitfield32(msr, 7, 0));\n\t\t\tIOLOG(\" - Maximum Performance................. : %llu\\n\", bitfield32(msr, 15, 8));\n\t\t\tIOLOG(\" - Desired Performance................. : %llu\\n\", bitfield32(msr, 23, 16));\n\t\t\tIOLOG(\" - Energy Efficient Performance........ : %llu\\n\", bitfield32(msr, 31, 24));\n\n\t\t\tif ((cpuid_reg[eax] & 0x200) == 0x200)\n\t\t\t{\n\t\t\t\tmantissa = bitfield32(msr, 38, 32);\n\t\t\t\texponent = bitfield32(msr, 41, 39);\n\n\t\t\t\tIOLOG(\" - Activity Window..................... : %d, %d\\n\", mantissa, exponent);\n\t\t\t}\n\n\t\t\tIOLOG(\" - Package Control..................... : %s\\n\", (msr & 0x40000000000) ? \"1 (control inputs to be derived from IA32_HWP_REQUEST_PKG)\": \"0\");\n\t\t\t\n\t\t\tmsr = rdmsr64(IA32_HWP_STATUS);\n\n\t\t\tIOLOG(\"\\nIA32_HWP_STATUS..................(0x777) : 0x%llX\\n\", msr);\n\t\t\tIOLOG(\"-----------------------------------------\\n\");\n\t\t\tIOLOG(\" - Guaranteed Performance Change....... : %s\\n\", (msr & 1) ? \"1 (has occured)\" : \"0 (has not occured)\");\n\t\t\tIOLOG(\" - Excursion To Minimum................ : %s\\n\", (msr & 4) ? \"1 (has occured)\" : \"0 (has not occured)\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tIOLOG(\"\\nIA32_PM_ENABLE...................(0x770) : 0x%llX (HWP Supported but not, yet, enabled)\\n\", msr);\n\t\t}\n\t}\n}\n#endif\n\n\n#if (REPORT_MSRS && REPORT_HDC)\n//==============================================================================\n\nvoid AppleIntelInfo::reportHDC(void)\n{\n\tuint8_t index = 0;\n\tunsigned long long msr;\n\n\tIOLOG(\"HDC Supported\\n\");\n\n\tmsr = rdmsr64(IA32_PKG_HDC_CTL);\n\n\tIOLOG(\"\\nIA32_PKG_HDC_CTL.................(0xDB0) : 0x%llX\\n\", msr);\n\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\"HDC Pkg Enable...................(0x652) : %s\\n\", bitfield32(msr, 0, 0) ? \"1 (HDC allowed)\" : \"0 (HDC not allowed)\");\n\t}\n\n\tmsr = rdmsr64(IA32_PM_CTL1);\n\n\tIOLOG(\"\\nIA32_PM_CTL1.....................(0xDB1) : 0x%llX\\n\", msr);\n\t\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\"HDC Allow Block..................(0xDB1) : %s\\n\", bitfield32(msr, 0, 0) ? \"1 (HDC blocked)\" : \"0 (HDC not blocked/allowed)\");\n\t}\n\n\tmsr = rdmsr64(IA32_THREAD_STALL);\n\t\n\tIOLOG(\"\\nIA32_THREAD_STALL................(0xDB2) : 0x%llX\\n\", msr);\n\t\n\tif (msr)\n\t{\n\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\"Stall Cycle Counter...............(0xDB2) : %llu, %s\\n\", msr, msr ? \"1 (forced-idle supported)\" : \"0 (forced-idle not supported)\");\n\t}\n\n\tmsr = rdmsr64(MSR_PKG_HDC_CONFIG);\n\tindex = bitfield32(msr, 2, 0);\n\n\tIOLOG(\"\\nMSR_PKG_HDC_CONFIG...............(0x652) : 0x%llX\\n\", msr);\n\n\tif (msr)\n\t{\n\t\tconst char * cxCountText[5] = { \"no-counting\", \"count package C2 only\", \"count package C3 and deeper\", \"count package C6 and deeper\", \"count package C7 and deeper\" };\n\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\"Pkg Cx Monitor ..................(0x652) : %d (%s)\", index, cxCountText[index]);\n\t}\n\t\n\tmsr = rdmsr64(MSR_CORE_HDC_RESIDENCY);\n\n\tIOLOG(\"\\nMSR_CORE_HDC_RESIDENCY...........(0x653) : 0x%llX\\n\", msr);\n\t\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\"Core Cx Duty Cycle Count................ : %llu %s\\n\", msr, msr ? \"(forced-idle cycle count)\": \"(not supported/no forced-idle serviced)\");\n\t\t\n\t}\n\t\n\tmsr = rdmsr64(MSR_PKG_HDC_SHALLOW_RESIDENCY);\n\n\tIOLOG(\"\\nMSR_PKG_HDC_SHALLOW_RESIDENCY....(0x655) : 0x%llX\\n\", msr);\n\t\n\tif (msr)\n\t{\n\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\"Pkg C2 Duty Cycle Count................. : %llu %s\\n\", msr, msr ? \"(forced-idle cycle count)\": \"(not supported/no forced-idle serviced)\");\n\t\t\n\t}\n\t\n\tmsr = rdmsr64(MSR_PKG_HDC_DEEP_RESIDENCY);\n\n\tIOLOG(\"\\nMSR_PKG_HDC_DEEP_RESIDENCY.......(0x656) : 0x%llX\\n\", msr);\n\t\n\tif (msr)\n\t{\n\t\tconst char * cxText[5] = { \"x\", \"2\", \"3\", \"6\", \"7\" };\n\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\"Pkg C%s Duty Cycle Count................ : %llu %s\\n\", cxText[index], msr, msr ? \"(forced-idle cycle count)\": \"(not supported/no forced-idle serviced)\");\n\t\t\n\t}\n}\n#endif\n\n\n//==============================================================================\n\nuint32_t AppleIntelInfo::getBusFrequency(void)\n{\n\tsize_t size = 4;\n\tuint32_t frequency = 0;\n\n\tswitch (gCpuModel)\n\t{\n\t\tcase INTEL_FAM6_NEHALEM:\n \t\tcase INTEL_FAM6_NEHALEM_EP:\n   \t\tcase INTEL_FAM6_NEHALEM_EX:\n\t\tcase INTEL_FAM6_WESTMERE:\n\t\tcase INTEL_FAM6_WESTMERE_EP:\n\t\tcase INTEL_FAM6_WESTMERE_EX:\n\t\t\treturn (133 * 1000000);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\t// Check sysctl hw.busfrequency to see if the setup is right or wrong.\n\t\t\tif (sysctlbyname(\"hw.busfrequency\", &frequency, &size, NULL, 0) == 0)\n\t\t\t{\n\t\t\t\t// Is it 100000000?\n\t\t\t\tif ((frequency / 1000000) > 100)\n\t\t\t\t{\n\t\t\t\t\t// No. Log warning.\n\t\t\t\t\tIOLOG(\"\\nWarning: Clover hw.busfrequency error detected : %x\\n\", frequency);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn (100 * 1000000);\n\t\t\tbreak;\n\t}\n\treturn 0;\n}\n\n\n//==============================================================================\n\nconst char * AppleIntelInfo::getUnitText(uint8_t unit)\n{\n\tconst 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-\" };\n\tconst char * microText[7] = { \"976.6 micro-\", \"488.3 micro-\", \"244.1 micro-\", \"122.1 micro-\", \"61 micro-\", \"30.5 micro-\", \"15.3 micro-\" };\n\n\tif (unit <= 9)\n\t{\n\t\treturn milliText[unit];\n\t}\n\telse\n\t{\n\t\treturn microText[unit-10];\n\t}\n\n\treturn NULL;\n}\n\n\n#if REPORT_MSRS\n//==============================================================================\n\nbool AppleIntelInfo::hasCPUFeature(long targetCPUFeature)\n{\n\tuint32_t cpuid_reg[4];\n\tdo_cpuid(0x00000001, cpuid_reg);\n\t\n\tuint64_t cpuFeatures = cpuid_reg[ecx];\n\tcpuFeatures = (cpuFeatures << 32) | cpuid_reg[eax];\n\n\tif (cpuFeatures & targetCPUFeature)\n\t{\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}\n#endif\n\n\n#if REPORT_MSRS\n//==============================================================================\n\nvoid AppleIntelInfo::reportMSRs(void)\n{\n\tuint8_t core_limit;\n\tuint32_t performanceState;\n\tuint32_t cpuid_reg[4];\n\tuint64_t msr;\n\n\tchar brandstring[48];\n\n\tdo_cpuid(0x80000002, cpuid_reg);\t// First 16 bytes.\n\tbcopy((char *)cpuid_reg, &brandstring[0], 16);\n \n\tdo_cpuid(0x80000003, cpuid_reg);\t// Next 16 bytes.\n\tbcopy((char *)cpuid_reg, &brandstring[16], 16);\n\t\n\tdo_cpuid(0x80000004, cpuid_reg);\t// Last 16 bytes.\n\tbcopy((char *)cpuid_reg, &brandstring[32], 16);\n\t\n\tIOLOG(\"\\nProcessor Brandstring....................: %s\\n\", brandstring);\n\n\tdo_cpuid(0x00000001, cpuid_reg);\n\tuint8_t model = (bitfield32(cpuid_reg[eax], 19, 16) << 4) + bitfield32(cpuid_reg[eax],  7,  4);\n\n\tIOLOG(\"\\nProcessor Signature..................... : 0x%X\\n\", cpuid_reg[eax]);\n\tIOLOG(\"------------------------------------------\\n\");\n\tIOLOG(\" - Family............................... : %lu\\n\", bitfield32(cpuid_reg[eax], 11,  8));\n\tIOLOG(\" - Stepping............................. : %lu\\n\", bitfield32(cpuid_reg[eax],  3,  0));\n\tIOLOG(\" - Model................................ : 0x%X (%d)\\n\", model, model);\n\n\tdo_cpuid(0x00000006, cpuid_reg);\n\n\tIOLOG(\"\\nModel Specific Registers (MSRs)\\n------------------------------------------\\n\");\n    \n\tmsr = rdmsr64(MSR_IA32_PLATFORM_ID);\n    \n\tIOLOG(\"\\nMSR_IA32_PLATFORM_ID.............(0x17)  : 0x%llX\\n\", msr);\n\tIOLOG(\"------------------------------------------\\n\");\n    IOLOG(\" - Processor Flags...................... : %d\\n\", (uint8_t)bitfield32(msr, 52, 50));\n    \n\tmsr = rdmsr64(MSR_CORE_THREAD_COUNT);\n    \n\tIOLOG(\"\\nMSR_CORE_THREAD_COUNT............(0x35)  : 0x%llX\\n\", msr);\n\tIOLOG(\"------------------------------------------\\n\");\n\tIOLOG(\" - Core Count........................... : %d\\n\", gCoreCount);\n\tIOLOG(\" - Thread Count......................... : %d\\n\", gThreadCount);\n\n\tmsr = rdmsr64(MSR_PLATFORM_INFO);\n\tperformanceState = bitfield32(msr, 15, 8);\n\n\tIOLOG(\"\\nMSR_PLATFORM_INFO................(0xCE)  : 0x%llX\\n\", msr);\n\tIOLOG(\"------------------------------------------\\n\");\n\tIOLOG(\" - Maximum Non-Turbo Ratio.............. : 0x%X (%u MHz)\\n\", performanceState, (performanceState * gBclk));\n\tIOLOG(\" - Ratio Limit for Turbo Mode........... : %s\\n\", (msr & (1 << 28)) ? \"1 (programmable)\" : \"0 (not programmable)\");\n\tIOLOG(\" - TDP Limit for Turbo Mode............. : %s\\n\", (msr & (1 << 29)) ? \"1 (programmable)\" : \"0 (not programmable)\");\n\tIOLOG(\" - Low Power Mode Support............... : %s\\n\", (msr & (1UL << 32)) ? \"1 (LPM supported)\": \"0 (LMP not supported)\");\n\n\tif (bitfield32(msr, 34, 33) == 0)\n\t{\n\t\tIOLOG(\" - Number of ConfigTDP Levels........... : 0 (only base TDP level available)\\n\");\n\t}\n\telse\n\t{\n\t\tIOLOG(\" - Number of ConfigTDP Levels........... : %llu (additional TDP level(s) available)\\n\", bitfield32(msr, 34, 33));\n\t}\n\n\tIOLOG(\" - Maximum Efficiency Ratio............. : %llu\\n\", bitfield32(msr, 47, 40));\n\t\n\tif (bitfield32(msr, 55, 48) > 0)\n\t{\n\t\tIOLOG(\" - Minimum Operating Ratio.............. : %llu\\n\", bitfield32(msr, 55, 48));\n\t}\n\n\tUInt64 msr_pmg_cst_config_control = rdmsr64(MSR_PKG_CST_CONFIG_CONTROL);\n\n\tIOLOG(\"\\nMSR_PMG_CST_CONFIG_CONTROL.......(0xE2)  : 0x%llX\\n\", msr_pmg_cst_config_control);\n\tIOLOG(\"------------------------------------------\\n\");\n\tIOLOG(\" - 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)\");\n\tIOLOG(\" - CFG Lock............................. : %s\\n\", (msr_pmg_cst_config_control & (1 << 15)) ? \"1 (MSR locked until next reset)\" : \"0 (MSR not locked)\");\n\n\tIOLOG(\" - C3 State Auto Demotion............... : %s\\n\", (msr_pmg_cst_config_control & (1 << 25)) ? \"1 (enabled)\" : \"0 (disabled/unsupported)\");\n\tIOLOG(\" - C1 State Auto Demotion............... : %s\\n\", (msr_pmg_cst_config_control & (1 << 26)) ? \"1 (enabled)\" : \"0 (disabled/unsupported)\");\n\n\tIOLOG(\" - C3 State Undemotion.................. : %s\\n\", (msr_pmg_cst_config_control & (1 << 27)) ? \"1 (enabled)\" : \"0 (disabled/unsupported)\");\n\tIOLOG(\" - C1 State Undemotion.................. : %s\\n\", (msr_pmg_cst_config_control & (1 << 28)) ? \"1 (enabled)\" : \"0 (disabled/unsupported)\");\n\n\t// Intel® CoreTM M Processors and 5th Generation Intel® CoreTM Processors\n\t// Intel® Xeon® Processor D and Intel Xeon Processors E5 v4 Family Based on the Broadwell Microarchitecture\n\tIOLOG(\" - Package C-State Auto Demotion........ : %s\\n\", (msr_pmg_cst_config_control & (1 << 29)) ? \"1 (enabled)\" : \"0 (disabled/unsupported)\");\n\tIOLOG(\" - Package C-State Undemotion........... : %s\\n\", (msr_pmg_cst_config_control & (1 << 30)) ? \"1 (enabled)\" : \"0 (disabled/unsupported)\");\n\n\tmsr = rdmsr64(MSR_PMG_IO_CAPTURE_BASE);\n\n\tIOLOG(\"\\nMSR_PMG_IO_CAPTURE_BASE..........(0xE4)  : 0x%llX\\n\", msr);\n\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\" - LVL_2 Base Address................... : 0x%llx\\n\", bitfield32(msr, 15, 0));\n\t}\n\n\tif (msr_pmg_cst_config_control & (1 << 10))\n\t{\n\t\tswitch(bitfield32(msr, 18, 16))\n\t\t{\n\t\t\tcase 0: IOLOG(\" - C-state Range........................ : %llu (%s)\\n\", bitfield32(msr, 18, 16), \"C3 is the max C-State to include\");\n\t\t\t\tbreak;\n\n\t\t\tcase 1: IOLOG(\" - C-state Range........................ : %llu (%s)\\n\", bitfield32(msr, 18, 16), \"C6 is the max C-State to include\");\n\t\t\t\tbreak;\n\n\t\t\tcase 2: IOLOG(\" - C-state Range........................ : %llu (%s)\\n\", bitfield32(msr, 18, 16), \"C7 is the max C-State to include\");\n\t\t\t\tbreak;\n\t\t}\n\t}\n\telse\n\t{\n\t\tIOLOG(\" - C-state Range........................ : %llu (%s)\\n\", bitfield32(msr, 18, 16), \"C-States not included, I/O MWAIT redirection not enabled\");\n\t}\n\n\tif (bitfield32(cpuid_reg[ecx], 0, 0) == 1) // Are APERF and MPERF supported?\n\t{\n\t\tIOLOG(\"\\nIA32_MPERF.......................(0xE7)  : 0x%llX\\n\", (unsigned long long)rdmsr64(IA32_MPERF));\n\t\n\t\tUInt64 aPerf = rdmsr64(IA32_APERF);\n\n\t\tIOLOG(\"IA32_APERF.......................(0xE8)  : 0x%llX\\n\", aPerf);\n\t}\n\n\tif (gCpuModel == INTEL_FAM6_BROADWELL_X)\n\t{\n\t\tIOLOG(\"MSR_0x150........................(0x150) : 0x%llX\\n\", (unsigned long long)rdmsr64(0x150));\n\t}\n\n\tIOLOG(\"\\nMSR_FLEX_RATIO...................(0x194) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_FLEX_RATIO));\n\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t}\n\n\tmsr = rdmsr64(MSR_IA32_PERF_STATUS);\n\tperformanceState = bitfield32(msr, 15, 0);\n\n\tIOLOG(\"\\nMSR_IA32_PERF_STATUS.............(0x198) : 0x%llX\\n\", msr);\n\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\" - Current Performance State Value...... : 0x%X (%u MHz)\\n\", performanceState, ((performanceState >> 8) * gBclk));\n\t}\n\n\tmsr = rdmsr64(MSR_IA32_PERF_CONTROL);\n\tperformanceState = bitfield32(msr, 15, 0);\n\n\tIOLOG(\"\\nMSR_IA32_PERF_CONTROL............(0x199) : 0x%llX\\n\", msr);\n\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\" - Target performance State Value....... : 0x%X (%u MHz)\\n\", performanceState, ((performanceState >> 8) * gBclk));\n\t}\n\n\tif (cpuid_reg[eax] & (1 << 0))\n\t{\n\t\tIOLOG(\" - Intel Dynamic Acceleration........... : %s\\n\", (msr & (1UL << 32)) ? \"1 (IDA disengaged)\" : \"0 (IDA engaged)\");\n\t}\n\n\tdo_cpuid(0x00000001, cpuid_reg);\n\n\tif (bitfield32(cpuid_reg[edx], 22, 22) == 1)\n\t{\n\t\tIOLOG(\"\\nIA32_CLOCK_MODULATION............(0x19A) : 0x%llX\\n\", (unsigned long long)rdmsr64(IA32_CLOCK_MODULATION));\n\n\t\tmsr = rdmsr64(IA32_THERM_INTERRUPT);\n\n\t\tIOLOG(\"\\nIA32_THERM_INTERRUPT.............(0x19B) : 0x%llX\\n\", msr);\n\n\t\tif (msr)\n\t\t{\n\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\tIOLOG(\" - High-Temperature Interrupt Enable.... : %s\\n\", (msr & (1 <<  0)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\tIOLOG(\" - Low-Temperature Interrupt Enable..... : %s\\n\", (msr & (1 <<  1)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\tIOLOG(\" - PROCHOT# Interrupt Enable............ : %s\\n\", (msr & (1 <<  2)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\tIOLOG(\" - FORCEPR# Interrupt Enable............ : %s\\n\", (msr & (1 <<  3)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\tIOLOG(\" - Critical Temperature Interrupt Enable : %s\\n\", (msr & (1 <<  4)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\t// bit 7:5 Reserved.\n\t\t\tIOLOG(\" - Threshold #1 Value................... : %llu\\n\", bitfield32(msr, 14, 8));\n\t\t\tIOLOG(\" - Threshold #1 Interrupt Enable........ : %s\\n\", (msr & (1 << 15)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\tIOLOG(\" - Threshold #2 Value................... : %llu\\n\", bitfield32(msr, 22, 16));\n\t\t\tIOLOG(\" - Threshold #2 Interrupt Enable........ : %s\\n\", (msr & (1 << 23)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\tIOLOG(\" - Power Limit Notification Enable...... : %s\\n\", (msr & (1 << 24)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t\t// bit 63:25 Reserved.\n\t\t}\n\n\t\tmsr = rdmsr64(IA32_THERM_STATUS);\n\n\t\tIOLOG(\"\\nIA32_THERM_STATUS................(0x19C) : 0x%llX\\n\", msr);\n\n\t\tif (msr)\n\t\t{\n\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\tIOLOG(\" - Thermal Status....................... : %s\\n\", (msr & (1 <<  0)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Thermal Log.......................... : %s\\n\", (msr & (1 <<  1)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - PROCHOT # or FORCEPR# event.......... : %s\\n\", (msr & (1 <<  2)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - PROCHOT # or FORCEPR# log............ : %s\\n\", (msr & (1 <<  3)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Critical Temperature Status.......... : %s\\n\", (msr & (1 <<  4)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Critical Temperature log............. : %s\\n\", (msr & (1 <<  5)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Thermal Threshold #1 Status.......... : %s\\n\", (msr & (1 <<  6)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Thermal Threshold #1 log............. : %s\\n\", (msr & (1 <<  7)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Thermal Threshold #2 Status.......... : %s\\n\", (msr & (1 <<  8)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Thermal Threshold #2 log............. : %s\\n\", (msr & (1 <<  9)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Power Limitation Status.............. : %s\\n\", (msr & (1 << 10)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Power Limitation log................. : %s\\n\", (msr & (1 << 11)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Current Limit Status................. : %s\\n\", (msr & (1 << 12)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Current Limit log.................... : %s\\n\", (msr & (1 << 13)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Cross Domain Limit Status............ : %s\\n\", (msr & (1 << 14)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Cross Domain Limit log............... : %s\\n\", (msr & (1 << 15)) ? \"1\" : \"0\");\n\t\t\tIOLOG(\" - Digital Readout...................... : %llu\\n\", bitfield32(msr, 22, 16));\n\t\t\t// bit 23-26 Reserved.\n\t\t\tIOLOG(\" - Resolution in Degrees Celsius........ : %llu\\n\", bitfield32(msr, 30, 27));\n\t\t\tIOLOG(\" - Reading Valid........................ : %s\\n\", (msr & (1 << 31)) ? \"1 (valid)\" : \"0 (invalid)\");\n\t\t\t// bit 63-32 Reserved.\n\t\t}\n\t}\n\n\tif (hasCPUFeature(CPUID_FEATURE_TM2))\n\t{\n\t\tmsr = rdmsr64(MSR_THERM2_CTL);\n\n\t\tIOLOG(\"\\nMSR_THERM2_CTL...................(0x19D) : 0x%llX\\n\", msr);\n\n\t\tif (msr)\n\t\t{\n\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\tIOLOG(\" - 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)\");\n\t\t}\n\t}\n\n\tmsr = rdmsr64(IA32_MISC_ENABLES);\n\n\tIOLOG(\"\\nIA32_MISC_ENABLES................(0x1A0) : 0x%llX\\n\", msr);\n\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\" - Fast-Strings......................... : %s\\n\", (msr & (1 <<  0)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t// bit 2:1 Reserved.\n\t\tIOLOG(\" - FOPCODE compatibility mode Enable.... : %llu\\n\", (msr & (1 <<  2)));\n\t\tIOLOG(\" - Automatic Thermal Control Circuit.... : %s\\n\", (msr & (1 <<  3)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\t// bit 6:4 Reserved.\n\t\tIOLOG(\" - Split-lock Disable................... : %llu\\n\", (msr & (1 <<  4)));\n\t\tIOLOG(\" - Performance Monitoring............... : %s\\n\", (msr & (1 <<  7)) ? \"1 (available)\" : \"not available\");\n\t\t// bit 8 Reserved.\n\t\tIOLOG(\" - Bus Lock On Cache Line Splits Disable : %llu\\n\", (msr & (1 <<  8)));\n\t\tIOLOG(\" - Hardware prefetch Disable............ : %llu\\n\", (msr & (1 <<  9)));\n\n\t\tIOLOG(\" - Processor Event Based Sampling....... : %s\\n\", (msr & (1 << 12)) ? \"1 (PEBS not supported)\" : \"0 (PEBS supported)\");\n\t\tIOLOG(\" - GV1/2 legacy Enable.................. : %llu\\n\", (msr & (1 << 15)));\n\t\tIOLOG(\" - Enhanced Intel SpeedStep Technology.. : %s\\n\", (msr & (1 << 16)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\tIOLOG(\" - MONITOR FSM.......................... : %s\\n\", (msr & (1 << 18)) ? \"1 (MONITOR/MWAIT supported)\" : \"0 (MONITOR/MWAIT not supported)\");\n\t\tIOLOG(\" - Adjacent sector prefetch Disable..... : %llu\\n\", (msr & (1 << 19)));\n\t\tIOLOG(\" - CFG Lock............................. : %s\\n\", (msr & (1 << 20)) ? \"1 (MSR locked until next reset)\" : \"0 (MSR not locked)\");\n\t\tIOLOG(\" - xTPR Message Disable................. : %s\\n\", (msr & (1 << 23)) ? \"1 (disabled)\" : \"0 (enabled)\");\n\n\t}\n\n\tmsr = rdmsr64(MSR_TEMPERATURE_TARGET);\n\tuint8_t time_unit = bitfield32(msr, 6, 0);\n\n\tIOLOG(\"\\nMSR_TEMPERATURE_TARGET...........(0x1A2) : 0x%llX\\n\", msr);\n\t\n\tif (msr)\n\t{\n\t\tchar timeString[25];\n\t\tmemset(timeString, 0, 25);\n\t\tIOLOG(\"------------------------------------------\\n\");\n\n\t\tif (time_unit)\n\t\t{\n\t\t\tsnprintf(timeString, 25, \"(%sSeconds)\", getUnitText(time_unit));\n\t\t}\n\n\t\tIOLOG(\" - Turbo Attenuation Units.............. : %u %s\\n\", time_unit, timeString);\n\t\tIOLOG(\" - Temperature Target................... : %llu\\n\", bitfield32(msr, 23, 16));\n\t\tIOLOG(\" - TCC Activation Offset................ : %llu\\n\", bitfield32(msr, 29, 24));\n\t}\n\n\tmsr = rdmsr64(MSR_MISC_PWR_MGMT);\n\n\tIOLOG(\"\\nMSR_MISC_PWR_MGMT................(0x1AA) : 0x%llX\\n\", msr);\n\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\" - EIST Hardware Coordination........... : %s\\n\", (msr & (1 <<  0)) ? \"1 (hardware coordination disabled)\" : \"0 (hardware coordination enabled)\");\n\n\t\tIOLOG(\" - Energy/Performance Bias support...... : %lu\\n\", bitfield32(cpuid_reg[ecx],  3,  3) );\n\t\tIOLOG(\" - Energy/Performance Bias.............. : %s\\n\", (msr & (1 <<  1)) ? \"1 (enabled/MSR visible to software)\" : \"0 (disabled/MSR not visible to software)\");\n\t\t\n\t\tIOLOG(\" - Thermal Interrupt Coordination Enable : %s\\n\", (msr & (1 << 22)) ? \"1 (thermal interrupt routed to all cores)\" : \"0 (thermal interrupt not rerouted)\");\n\t\t\n\t\t/* HWP related SpeedShift settings */\n\t\tIOLOG(\" - SpeedShift Technology Enable......... : %s\\n\", (msr & (1 <<  6)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\tIOLOG(\" - SpeedShift Interrupt Coordination.... : %s\\n\", (msr & (1 <<  7)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\tIOLOG(\" - SpeedShift Energy Efficient Perf..... : %s\\n\", (msr & (1 << 12)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\tIOLOG(\" - SpeedShift Technology Setup for HWP.. : %s\\n\", (msr & 0x10c0) ? \"Yes (setup for HWP)\" : \"No (not setup for HWP)\");\n\t}\n\n\tmsr = rdmsr64(MSR_TURBO_RATIO_LIMIT);\n\n\tIOLOG(\"\\nMSR_TURBO_RATIO_LIMIT............(0x1AD) : 0x%llX\\n\", msr);\n\tIOLOG(\"------------------------------------------\\n\");\n\n\tfor (int i = 1; (i < 9) && (i <= gCoreCount); i++)\n\t{\n\t\tcore_limit = bitfield32(msr, 7, 0);\n\t\t\n\t\tif (core_limit)\n\t\t{\n\t\t\tIOLOG(\" - Maximum Ratio Limit for C%02d.......... : %X (%u MHz) %s\\n\", i, core_limit, (core_limit * gBclk), ((i > gCoreCount) && core_limit) ? \"(garbage / unused)\" : \"\");\n\n\t\t\tmsr = (msr >> 8);\n\t\t}\n\t}\n\t//\n\t// Intel® Xeon® Processor E5 v3 Family\n\t//\n\tif (gCoreCount > 8)\n\t{\n\t\tmsr = rdmsr64(MSR_TURBO_RATIO_LIMIT1);\n\t\n\t\tIOLOG(\"\\nMSR_TURBO_RATIO_LIMIT1...........(0x1AE) : 0x%llX\\n\", msr);\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\n\t\tfor (int i = 9; (i < 17) && (i <= gCoreCount); i++)\n\t\t{\n\t\t\tcore_limit = bitfield32(msr, 7, 0);\n\t\t\n\t\t\tif (core_limit)\n\t\t\t{\n\t\t\t\tIOLOG(\" - Maximum Ratio Limit for C%02d.......... : %X (%u MHz) %s\\n\", i, core_limit, (core_limit * gBclk), ((i > gCoreCount) && core_limit) ? \"(garbage / unused)\" : \"\");\n\t\t\n\t\t\t\tmsr = (msr >> 8);\n\t\t\t}\n\t\t}\n\t}\n\t//\n\t// Intel® Xeon® Processor E5 v3 Family\n\t//\n\tif (gCoreCount > 16)\n\t{\n\t\tmsr = rdmsr64(MSR_TURBO_RATIO_LIMIT2);\n\t\n\t\tIOLOG(\"\\nMSR_TURBO_RATIO_LIMIT2...........(0x1AF) : 0x%llX\\n\", msr);\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\n\t\tfor (int i = 17; (i < 33) && (i <= gCoreCount); i++)\n\t\t{\n\t\t\tcore_limit = bitfield32(msr, 7, 0);\n\t\t\n\t\t\tif (core_limit)\n\t\t\t{\n\t\t\t\tIOLOG(\" - Maximum Ratio Limit for C%02d.......... : %X (%u MHz) %s\\n\", i, core_limit, (core_limit * gBclk), ((i > gCoreCount) && core_limit) ? \"(garbage / unused)\" : \"\");\n\t\t\n\t\t\t\tmsr = (msr >> 8);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tdo_cpuid(0x00000006, cpuid_reg);\n\n\tif (bitfield32(cpuid_reg[ecx], 3, 3) == 1)\n\t{\n\t\tmsr = rdmsr64(IA32_ENERGY_PERF_BIAS);\n\n\t\tIOLOG(\"\\nIA32_ENERGY_PERF_BIAS............(0x1B0) : 0x%llX\\n\", msr);\n\t\t\n\t\tif (msr)\n\t\t{\n\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\n\t\t\tswitch(bitfield32(msr, 3, 0))\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\tcase 1:\n\t\t\t\t\tIOLOG(\" - Power Policy Preference...............: %llu (%s)\\n\", bitfield32(msr, 3, 0), \"highest performance\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 5:\n\t\t\t\t\tIOLOG(\" - Power Policy Preference...............: %llu (%s)\\n\", bitfield32(msr, 3, 0), \"balanced performance and energy saving\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 15:\n\t\t\t\t\tIOLOG(\" - Power Policy Preference...............: %llu (%s)\\n\", bitfield32(msr, 3, 0), \"maximize energy saving\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tmsr = rdmsr64(MSR_POWER_CTL);\n\n\tIOLOG(\"\\nMSR_POWER_CTL....................(0x1FC) : 0x%llX\\n\", msr);\n\t\n\tif (msr)\n\t{\n\t\tIOLOG(\"------------------------------------------\\n\");\n\t\tIOLOG(\" - Bi-Directional Processor Hot..........: %s\\n\", (msr & (1 <<  0)) ? \"1 (enabled)\" : \"0 (disabled)\");\n\t\tIOLOG(\" - C1E Enable............................: %s\\n\", (msr & (1 <<  1)) ? \"1 (enabled)\": \"0 (disabled)\");\n\t}\n\n\tif (supportsRAPL(RAPL_PKG))\n\t{\n\t\treportRAPL(RAPL_BASE);\n\t}\n\n\tif (supportsRAPL(RAPL_PKG))\n\t{\n\t\treportRAPL(RAPL_PKG);\n\t}\n\n\tif (gCpuModel == INTEL_FAM6_SANDYBRIDGE) // 0x2A - Intel 325462.pdf Vol.3C 35-120\n\t{\n\t\tIOLOG(\"\\nMSR_PP0_CURRENT_CONFIG...........(0x601) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PP0_CURRENT_CONFIG));\n\t}\n\n\tif (supportsRAPL(RAPL_CORES))\n\t{\n\t\treportRAPL(RAPL_CORES);\n\t}\n\n\tif (supportsRAPL(RAPL_CORE_POLICY))\n\t{\n\t\treportRAPL(RAPL_CORES);\n\t}\n\n\tif (igpuEnabled && supportsRAPL(RAPL_GFX))\n\t{\n\t\treportRAPL(RAPL_GFX);\n\t}\n\t\n\tIOLOG(\"\\n\");\n\n\tswitch (gCpuModel)\n\t{\n\t\tcase INTEL_FAM6_IVYBRIDGE:\t\t\t// 0x3A - Intel 325462.pdf (Table 35-23) 35-174 Vol.3C\n        case INTEL_FAM6_IVYBRIDGE_X:\t\t// 0x3E\n\t\t\t\n\t\tcase INTEL_FAM6_HASWELL_CORE:\t\t// 0x3C - Intel 325462.pdf (Table 35-27) 35-192 Vol.3C\n\t\tcase INTEL_FAM6_HASWELL_X:\t\t\t// 0x3F\n        case INTEL_FAM6_HASWELL_ULT:\t\t// 0x45\n\t\t\t\n\t\tcase INTEL_FAM6_HASWELL_GT3E:\t\t// 0x46\n\t\tcase INTEL_FAM6_BROADWELL_GT3E:\t\t// 0x47\n\t\tcase INTEL_FAM6_SKYLAKE_MOBILE:\t\t// 0x4E\n\t\tcase INTEL_FAM6_SKYLAKE_X:\t\t\t// 0x55\n\t\tcase INTEL_FAM6_BROADWELL_XEON_D:\n\t\tcase INTEL_FAM6_XEON_PHI_KNL:\t\t// 0x57 - Intel 325462.pdf (Table 35-40) Vol.3C 35-275\n        case INTEL_FAM6_SKYLAKE_DESKTOP:\t// 0x5E - Intel 325462.pdf (Table 35-27) 35-192 Vol.3C\n\t\tcase INTEL_FAM6_CANNONLAKE_CORE:\t// 0x66\n\t\tcase INTEL_FAM6_KABYLAKE_MOBILE:\t// 0x8E\n\t\tcase INTEL_FAM6_KABYLAKE_DESKTOP:\t// 0x9E\n\t\t\t\n\t\t\tIOLOG(\"MSR_CONFIG_TDP_NOMINAL...........(0x648) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_NOMINAL));\n\t\t\tIOLOG(\"MSR_CONFIG_TDP_LEVEL1............(0x649) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_LEVEL1));\n\t\t\tIOLOG(\"MSR_CONFIG_TDP_LEVEL2............(0x64a) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_LEVEL2));\n\t\t\tIOLOG(\"MSR_CONFIG_TDP_CONTROL...........(0x64b) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_CONFIG_TDP_CONTROL));\n\t\t\tIOLOG(\"MSR_TURBO_ACTIVATION_RATIO.......(0x64c) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_TURBO_ACTIVATION_RATIO));\n\t\t\tbreak;\n\t}\n\n\tif (gCpuModel >= INTEL_FAM6_SANDYBRIDGE)\n\t{\n\t\tIOLOG(\"MSR_PKGC3_IRTL...................(0x60a) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKGC3_IRTL));\n\t\tIOLOG(\"MSR_PKGC6_IRTL...................(0x60b) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKGC6_IRTL));\n\n\t\tif (gCheckC7)\n\t\t{\n\t\t\tIOLOG(\"MSR_PKGC7_IRTL...................(0x60c) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKGC7_IRTL));\n\t\t}\n\t}\n\n\tif (gCpuModel >= INTEL_FAM6_NEHALEM)\n\t{\n\t\tIOLOG(\"MSR_PKG_C2_RESIDENCY.............(0x60d) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C2_RESIDENCY));\n\t\tIOLOG(\"MSR_PKG_C3_RESIDENCY.............(0x3f8) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C3_RESIDENCY));\n\n\t\tIOLOG(\"MSR_PKG_C2_RESIDENCY.............(0x60d) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C2_RESIDENCY));\n\t\t/*\n\t\t * Is package C3 auto-demotion/undemotion enabled i.e. is bit-25 or bit-27 set?\n\t\t */\n\t\tif ((msr_pmg_cst_config_control & 0x2000000) || (msr_pmg_cst_config_control & 0x8000000))\n\t\t{\n\t\t\tIOLOG(\"MSR_PKG_C3_RESIDENCY.............(0x3f8) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C3_RESIDENCY));\n\t\t}\n\t}\n\t\n\tif (gCpuModel >= INTEL_FAM6_SANDYBRIDGE)\n\t{\n\t\tIOLOG(\"MSR_PKG_C6_RESIDENCY.............(0x3f9) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C6_RESIDENCY));\n\t\n\t\tif (gCheckC7)\n\t\t{\n\t\t\tIOLOG(\"MSR_PKG_C7_RESIDENCY.............(0x3fa) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C7_RESIDENCY));\n\t\t}\n\t}\n\n\tswitch (gCpuModel)\n\t{\n\t\tcase INTEL_FAM6_BROADWELL_CORE:\t\t// 0x3D\n\t\tcase INTEL_FAM6_HASWELL_ULT:\t\t// 0x45 - Intel 325462.pdf Vol.3C 35-136\n\t\tcase INTEL_FAM6_SKYLAKE_MOBILE:\t\t// 0x4E\n\t\tcase INTEL_FAM6_SKYLAKE_DESKTOP:\t// 0x5E\n\t\tcase INTEL_FAM6_CANNONLAKE_CORE:\t// 0x66\n        case INTEL_FAM6_KABYLAKE_MOBILE:\t// 0x8E\n\t\tcase INTEL_FAM6_KABYLAKE_DESKTOP:\t// 0x9E\n\t\t\tIOLOG(\"MSR_PKG_C8_RESIDENCY.............(0x630) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C8_RESIDENCY));\n\t\t\tIOLOG(\"MSR_PKG_C9_RESIDENCY.............(0x631) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C9_RESIDENCY));\n\t\t\tIOLOG(\"MSR_PKG_C10_RESIDENCY............(0x632) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C10_RESIDENCY));\n\t\t\n\t\t\tIOLOG(\"MSR_PKG_C8_LATENCY...............(0x633) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C8_RESIDENCY));\n\t\t\tIOLOG(\"MSR_PKG_C9_LATENCY...............(0x634) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C9_RESIDENCY));\n\t\t\tIOLOG(\"MSR_PKG_C10_LATENCY..............(0x635) : 0x%llX\\n\", (unsigned long long)rdmsr64(MSR_PKG_C10_RESIDENCY));\n\t\t\tbreak;\n\t}\n\n\tswitch (gCpuModel)\n\t{\n\t\tcase INTEL_FAM6_SKYLAKE_MOBILE:\t\t// 0x4E\n\t\tcase INTEL_FAM6_SKYLAKE_DESKTOP:\t// 0x5E\n\t\tcase INTEL_FAM6_CANNONLAKE_CORE:\t// 0x66\n\t\tcase INTEL_FAM6_KABYLAKE_MOBILE:\t// 0x8E\n\t\tcase INTEL_FAM6_KABYLAKE_DESKTOP:\t// 0x9E\n\n\t\t\tmsr = rdmsr64(MSR_PLATFORM_ENERGY_COUNTER);\n\n\t\t\tIOLOG(\"\\nMSR_PLATFORM_ENERGY_COUNTER......(0x64D) : 0x%llX %s\\n\", bitfield32(msr, 31, 0), (bitfield32(msr, 31, 0) == 0) ? \"(not supported by hardware/BIOS)\" : \"\");\n\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t}\n\t\t\n\t\t\tmsr = rdmsr64(MSR_PPERF);\n\n\t\t\tIOLOG(\"\\nMSR_PPERF........................(0x64E) : 0x%llX\\n\", msr);\n\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\n\t\t\t\t// busy = ((aPerf * 100) / msr);\n\t\t\t\tIOLOG(\" - Hardware workload scalability........ : %llu\\n\", bitfield32(msr, 63, 0));\n\t\t\t}\n\n\t\t\tmsr = rdmsr64(MSR_CORE_PERF_LIMIT_REASONS);\n\n\t\t\tIOLOG(\"\\nMSR_CORE_PERF_LIMIT_REASONS......(0x64F) : 0x%llX\\n\", msr);\n\t\t\n\t\t\tif (msr)\n\t\t\t{\n\t\t\t\tIOLOG(\"------------------------------------------\\n\");\n\t\t\t\tIOLOG(\" - PROCHOT Status....................... : %s\\n\", bitfield32(msr,  1,  1) ? \"1 (frequency reduced below OS request due to assertion of external PROCHOT)\": \"0\");\n\t\t\t\tIOLOG(\" - Thermal Status....................... : %s\\n\", bitfield32(msr,  2,  2) ? \"1 (frequency reduced below OS request due to a thermal event)\": \"0\");\n\t\t\t\t// bit  3 Reserved.\n\t\t\t\tIOLOG(\" - Residency State Regulation Status.... : %s\\n\", bitfield32(msr,  4,  4) ? \"1 (frequency reduced below OS request due to residency state regulation limit)\": \"0\");\n\t\t\t\tIOLOG(\" - Running Average Thermal Limit Status. : %s\\n\", bitfield32(msr,  5,  5) ? \"1 (frequency reduced below OS request due to Running Average Thermal Limit)\": \"0\");\n\t\t\t\tIOLOG(\" - 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\");\n\t\t\t\tIOLOG(\" - 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\");\n\t\t\t\tIOLOG(\" - Other Status......................... : %s\\n\", bitfield32(msr,  8,  8) ? \"1 (frequency reduced below OS request due to electrical or other constraints)\" : \"0\");\n\t\t\t\t// bit  9 Reserved.\n\t\t\t\tIOLOG(\" - Package/Platform-Level #1 Power Limit : %s\\n\", bitfield32(msr, 10, 10) ? \"1 (frequency reduced below OS request due to power limit)\" : \"0\");\n\t\t\t\tIOLOG(\" - Package/Platform-Level #2 Power Limit : %s\\n\", bitfield32(msr, 11, 11) ? \"1 (frequency reduced below OS request due to power limit)\" : \"0\");\n\t\t\t\tIOLOG(\" - Max Turbo Limit Status............... : %s\\n\", bitfield32(msr, 12, 12) ? \"1 (frequency reduced below OS request due to multi-core turbo limits)\" : \"0\");\n\t\t\t\tIOLOG(\" - Turbo Transition Attenuation Status.. : %s\\n\", bitfield32(msr, 13, 13) ? \"1 (frequency reduced below OS request due to turbo transition attenuation)\": \"0\");\n\t\t\t\t// bit 15-14 Reserved.\n\t\t\t\tIOLOG(\" - PROCHOT Log.......................... : %s\\n\", bitfield32(msr, 16, 16) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - Thermal Log.......................... : %s\\n\", bitfield32(msr, 17, 17) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\t// bit 19-18 Reserved.\n\t\t\t\tIOLOG(\" - Residency State Regulation Log....... : %s\\n\", bitfield32(msr, 20, 20) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - Running Average Thermal Limit Log.... : %s\\n\", bitfield32(msr, 21, 21) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - VR Therm Alert Log................... : %s\\n\", bitfield32(msr, 22, 22) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - VR Thermal Design Current Log........ : %s\\n\", bitfield32(msr, 23, 23) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - Other Status Log..................... : %s\\n\", bitfield32(msr, 24, 24) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\t// bit 25 Reserved.\n\t\t\t\tIOLOG(\" - Package/Platform-Level #1 Power Limit : %s\\n\", bitfield32(msr, 26, 26) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - Package/Platform-Level #2 Power Limit : %s\\n\", bitfield32(msr, 27, 27) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - Max Turbo Limit Log.................. : %s\\n\", bitfield32(msr, 28, 28) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\tIOLOG(\" - Turbo Transition Attenuation Log..... : %s\\n\", bitfield32(msr, 29, 29) ? \"1 (status bit has asserted)\" : \"0\");\n\t\t\t\t// bit 63-30 Reserved.\n\t\t\t}\n#if REPORT_HDC\n\t\t\tif ((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.\n\t\t\t{\n\t\t\t\treportHDC();\n\t\t\t}\n#endif\n\t}\n\t\n\tdo_cpuid(0x00000001, cpuid_reg);\n\n\tif (bitfield32(cpuid_reg[ecx], 24, 24) == 1)\n\t{\n\t\tIOLOG(\"\\nIA32_TSC_DEADLINE................(0x6E0) : 0x%llX\\n\", (unsigned long long)rdmsr64(IA32_TSC_DEADLINE));\n\t}\n\n#if REPORT_HWP\n\treportHWP();\n#endif\n}\n#endif\n\n\n#if REPORT_C_STATES\n//==============================================================================\n\ninline void getCStates(void *magic)\n{\n\tUInt32 logicalCoreNumber = cpu_number();\n\n\tif (gCheckC3 && rdmsr64(MSR_CORE_C3_RESIDENCY) > 0)\n\t{\n\t\tgC3Cores |= (1 << logicalCoreNumber);\n\t}\n\n\tif (gCheckC6 && rdmsr64(MSR_CORE_C6_RESIDENCY) > 0)\n\t{\n\t\tgC6Cores |= (1 << logicalCoreNumber);\n\t}\n\n\tif (gCheckC7 && rdmsr64(MSR_CORE_C7_RESIDENCY) > 0)\n\t{\n\t\tgC7Cores |= (1 << logicalCoreNumber);\n\t}\n\n\tif (logicalCoreNumber < gThreadCount)\n\t{\n\t\t// wrmsr64(0x1FC, rdmsr64(0x1FC) & 0xFFFFFFFE);\n\t\t// wrmsr64(0x1FC, rdmsr64(0x1FC) | 0x1);\n\t}\n\n\tuint64_t msr = rdmsr64(0x10);\n\tgTSC = rdtsc64();\n\t\n\t// IOLOG(\"AICPUI: TSC of logical core %d is: msr(0x10) = 0x%llx, rdtsc = 0x%llx\\n\", logicalCoreNumber, msr, gTSC);\n\n\tif (msr > (gTSC + 4096))\n\t{\n\t\tIOLog(\"Error: TSC of logical core %d is out of sync (0x%llx)!\\n\", logicalCoreNumber, msr);\n\t}\n}\n#endif\n\n\n//==============================================================================\n\nIOReturn AppleIntelInfo::loopTimerEvent(void)\n{\n\tUInt8 currentMultiplier = (rdmsr64(MSR_IA32_PERF_STS) >> 8);\n\tgCoreMultipliers |= (1ULL << currentMultiplier);\n\n#if REPORT_IGPU_P_STATES\n\tUInt8 currentIgpuMultiplier = 0;\n\n\tif (igpuEnabled)\n\t{\n\t\tif (gCpuModel == INTEL_FAM6_SKYLAKE_MOBILE || gCpuModel == INTEL_FAM6_SKYLAKE_DESKTOP)\n\t\t{\n\t\t\tcurrentIgpuMultiplier = (UInt8)(((gMchbar[1] * 16.666) + 0.5) / 50);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcurrentIgpuMultiplier = (UInt8)gMchbar[1];\n\t\t}\n\n\t\tgIGPUMultipliers |= (1ULL << currentIgpuMultiplier);\n\t}\n#endif\n\t\n\ttimerEventSource->setTimeoutTicks(Interval);\n\n\tif (loopLock)\n\t{\n\t\treturn kIOReturnTimeout;\n\t}\n\n\tloopLock = true;\n\n#if REPORT_IPG_STYLE\n\tUInt8 pState = 0;\n\n\tif (logIPGStyle)\n\t{\n\t\tUInt64 aPerf = 0;\n\t\tfloat busy = 0;\n\n\t\taPerf = (rdmsr64(IA32_APERF));\n\t\twrmsr64(IA32_APERF, 0ULL);\n\n\t\tif (gHwpEnabled)\n\t\t{\n\t\t\tUInt64 pPerf = (rdmsr64(IA32_MPERF));\n\t\t\tbusy = ((aPerf * 100) / pPerf);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tUInt64 mPerf = (rdmsr64(IA32_MPERF));\n\t\t\twrmsr64(IA32_MPERF, 0ULL);\n\t\t\tbusy = ((aPerf * 100) / mPerf);\n\t\t}\n\n\t\tpState = (UInt8)(((gClockRatio + 0.5) * busy) / 100);\n\n/*\t\tif (pState != currentMultiplier)\n\t\t{ */\n\t\t\tgCoreMultipliers |= (1ULL << pState);\n\n\t\t\tif ((pState < currentMultiplier) && (pState < gMinRatio))\n\t\t\t{\n\t\t\t\tpState = gMinRatio;\n\t\t\t}\n\t\t\t/*\n\t\t\t * Commented out after fabio67 (fabiosun) confirmed that\n\t\t\t * the wrmsr() below triggered a KP on his configuration\n\t\t\t * wrmsr64(199, (pState << 8));\n\t\t\t */\n\t\t// }\n\t}\n#endif\n\n#if REPORT_C_STATES\n\tif (logCStates)\n\t{\n\t\tUInt32 magic = 0;\n\t\tmp_rendezvous_no_intrs(getCStates, &magic);\n\t\tIOSleep(1);\n\t}\n#endif\n\n\tint currentBit = 0;\n\tUInt64 value = 0ULL;\n\n#if REPORT_IGPU_P_STATES\n\tif ((gCoreMultipliers != gTriggeredPStates) || (gIGPUMultipliers != gTriggeredIGPUPStates))\n#else\n\t#if REPORT_IPG_STYLE\n\t\tif ((gCoreMultipliers != gTriggeredPStates) || (currentMultiplier != pState))\n\t#else\n\t\tif (gCoreMultipliers != gTriggeredPStates)\n\t#endif\n#endif\n\t\t{\n\t\t\tgTriggeredPStates = gCoreMultipliers;\n\t\t\tIOLOG(\"CPU P-States [ \");\n\n\t\t\tfor (currentBit = gMinRatio; currentBit <= gMaxRatio; currentBit++)\n\t\t\t{\n\t\t\t\tvalue = (1ULL << currentBit);\n\n\t\t\t\tif ((gTriggeredPStates & value) == value)\n\t\t\t\t{\n\t\t\t\t\tif (currentBit == currentMultiplier)\n\t\t\t\t\t{\n\t\t\t\t\t\tIOLOG(\"(%d) \", currentBit);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tIOLOG(\"%d \", currentBit);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n#if REPORT_IGPU_P_STATES\n\t\t\tif (igpuEnabled)\n\t\t\t{\n\t\t\t\tgTriggeredIGPUPStates = gIGPUMultipliers;\n\t\t\t\tIOLOG(\"] iGPU P-States [ \");\n\n\t\t\t\tfor (currentBit = 1; currentBit <= 32; currentBit++)\n\t\t\t\t{\n\t\t\t\t\tvalue = (1ULL << currentBit);\n\n\t\t\t\t\tif ((gTriggeredIGPUPStates & value) == value)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (currentBit == currentIgpuMultiplier)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tIOLOG(\"(%d) \", currentBit);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tIOLOG(\"%d \", currentBit);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif\n\t\t\tIOLOG(\"]\\n\");\n\t\t}\n\n#if REPORT_C_STATES\n\tif (gCheckC3 && (gTriggeredC3Cores != gC3Cores))\n\t{\n\t\tgTriggeredC3Cores = gC3Cores;\n\t\tIOLOG(\"CPU C3-Cores [ \");\n\n\t\tfor (currentBit = 0; currentBit < gThreadCount; currentBit++)\n\t\t{\n\t\t\tvalue = (1ULL << currentBit);\n\n\t\t\tif ((gTriggeredC3Cores & value) == value)\n\t\t\t{\n\t\t\t\tIOLOG(\"%d \", currentBit);\n\t\t\t}\n\t\t}\n\n\t\tIOLOG(\"]\\n\");\n\t}\n\n\tif (gCheckC6 && (gTriggeredC6Cores != gC6Cores))\n\t{\n\t\tgTriggeredC6Cores = gC6Cores;\n\t\tIOLOG(\"CPU C6-Cores [ \");\n\n\t\tfor (currentBit = 0; currentBit < gThreadCount; currentBit++)\n\t\t{\n\t\t\tvalue = (1ULL << currentBit);\n\n\t\t\tif ((gTriggeredC6Cores & value) == value)\n\t\t\t{\n\t\t\t\tIOLOG(\"%d \", currentBit);\n\t\t\t}\n\t\t}\n\n\t\tIOLOG(\"]\\n\");\n\t}\n\n\tif (gCheckC7 && (gTriggeredC7Cores != gC7Cores))\n\t{\n\t\tgTriggeredC7Cores = gC7Cores;\n\t\tIOLOG(\"CPU C7-Cores [ \");\n\n\t\tfor (currentBit = 0; currentBit < gThreadCount; currentBit++)\n\t\t{\n\t\t\tvalue = (1ULL << currentBit);\n\n\t\t\tif ((gTriggeredC7Cores & value) == value)\n\t\t\t{\n\t\t\t\tIOLOG(\"%d \", currentBit);\n\t\t\t}\n\t\t}\n\n\t\tIOLOG(\"]\\n\");\n\t}\n#endif\n\n\tloopLock = false;\n\n\treturn kIOReturnSuccess;\n}\n\n\n//==============================================================================\n\nIOService* AppleIntelInfo::probe(IOService *provider, SInt32 *score)\n{\n\tIOService *ret = super::probe(provider, score);\n\n\tif (ret != this)\n\t{\n\t\treturn 0;\n\t}\n\n\treturn ret;\n}\n\n\n//==============================================================================\n\nbool AppleIntelInfo::start(IOService *provider)\n{\n\tif (IOService::start(provider))\n\t{\n\t\tsimpleLock = IOSimpleLockAlloc();\n\n\t\tif (simpleLock)\n\t\t{\n#if WRITE_LOG_REPORT\n\t\t\tmCtx = vfs_context_create(NULL);\n#endif\n\t\t\tuint32_t cpuid_reg[4];\n\n\t\t\tIOLOG(\"AppleIntelInfo.kext v%s Copyright © 2012-2017 Pike R. Alpha. All rights reserved.\\n\", VERSION);\n\t\t\t\n\t\t\tdo_cpuid(0x00000006, cpuid_reg);\n\t\t\t\n\t\t\tif ((cpuid_reg[eax] & 0x80) == 0x80) // Is HWP supported?\n\t\t\t{\n\t\t\t\tif (rdmsr64(IA32_PM_ENABLE) & 1) // Yes. Is HWP enabled?\n\t\t\t\t{\n\t\t\t\t\tgHwpEnabled = true; // Yes.\n\t\t\t\t}\n#if ENABLE_HWP\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t/*\n\t\t\t\t\t * HWP is supported but not enabled (yet) and thus we\n\t\t\t\t\t * check the preference to see if we should enable it.\n\t\t\t\t\t */\n\t\t\t\t\tOSBoolean * key_enableHWP = OSDynamicCast(OSBoolean, getProperty(\"enableHWP\"));\n\t\t\t\n\t\t\t\t\tif (key_enableHWP) // Key found?\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((bool)key_enableHWP->getValue()) // Yes. Check value.\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twrmsr64(IA32_PM_ENABLE, 1); // Enable HWP.\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tIOLOG(\"enableHWP................................: %d\\n\", (bool)key_enableHWP->getValue());\n\t\t\t\t}\n#endif\n\t\t\t}\n\n#if REPORT_MSRS\n\t\t\tOSBoolean * key_logMSRs = OSDynamicCast(OSBoolean, getProperty(\"logMSRs\"));\n\n\t\t\tif (key_logMSRs)\n\t\t\t{\n\t\t\t\tlogMSRs = (bool)key_logMSRs->getValue();\n\t\t\t}\n\n\t\t\tIOLOG(\"\\nSettings:\\n------------------------------------------\\nlogMSRs..................................: %d\\n\", logMSRs);\n#endif\n\n#if REPORT_IGPU_P_STATES\n\t\t\tOSBoolean * key_logIGPU = OSDynamicCast(OSBoolean, getProperty(\"logIGPU\"));\n\n\t\t\tif (key_logIGPU)\n\t\t\t{\n\t\t\t\tigpuEnabled = (bool)key_logIGPU->getValue();\n\t\t\t}\n\n\t\t\tif (igpuEnabled)\n\t\t\t{\n\t\t\t\tif ((READ_PCI8_NB(DEVEN) & DEVEN_D2EN_MASK) == 0) // Is the IGPU enabled and visible?\n\t\t\t\t{\n\t\t\t\t\tigpuEnabled = false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tIOLOG(\"logIGPU..................................: %d\\n\", igpuEnabled);\n#endif\n\n#if REPORT_INTEL_REGS\n\t\t\tOSBoolean * key_logIntelRegs = OSDynamicCast(OSBoolean, getProperty(\"logIntelRegs\"));\n\n\t\t\tif (key_logIntelRegs)\n\t\t\t{\n\t\t\t\tlogIntelRegs = (bool)key_logIntelRegs->getValue();\n\t\t\t}\n\n\t\t\tIOLOG(\"logIntelRegs............................: %d\\n\", logIntelRegs);\n#endif\n\n#if REPORT_C_STATES\n\t\t\tOSBoolean * key_logCStates = OSDynamicCast(OSBoolean, getProperty(\"logCStates\"));\n\n\t\t\tif (key_logCStates)\n\t\t\t{\n\t\t\t\tlogCStates = (bool)key_logCStates->getValue();\n\t\t\t}\n\n\t\t\tIOLOG(\"logCStates...............................: %d\\n\", logCStates);\n#endif\n\n#if REPORT_IPG_STYLE\n\t\t\tif ((cpuid_reg[ecx] & 1) == 1) // Are APERF and MPERF supported?\n\t\t\t{\n\t\t\t\tOSBoolean * key_logIPGStyle = OSDynamicCast(OSBoolean, getProperty(\"logIPGStyle\"));\n\t\t\t\n\t\t\t\tif (key_logIPGStyle)\n\t\t\t\t{\n\t\t\t\t\tlogIPGStyle = (bool)key_logIPGStyle->getValue();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlogIPGStyle = false;\n\t\t\t}\n\n\t\t\tIOLOG(\"logIPGStyle..............................: %d\\n\", logIPGStyle);\n#endif\n\t\t\t\n\t\t\tUInt64 msr = rdmsr64(MSR_PLATFORM_INFO);\n\t\t\tgClockRatio = (UInt8)((msr >> 8) & 0xff);\n\n\t\t\tmsr = rdmsr64(MSR_IA32_PERF_STS);\n\t\t\tgCoreMultipliers |= (1ULL << (msr >> 8));\n\t\t\t\n\t\t\tdo_cpuid(0x00000001, cpuid_reg);\n\t\t\t\n\t\t\tgCpuModel = bitfield32(cpuid_reg[eax], 7,  4) + (bitfield32(cpuid_reg[eax], 19, 16) << 4);\n\n\t\t\tgBclk = (getBusFrequency() / 1000000);\n\n#if REPORT_C_STATES\n\t\t\tswitch (gCpuModel) // TODO: Verify me!\n\t\t\t{\n\t\t\t\tcase INTEL_FAM6_SANDYBRIDGE:\t\t// 0x2A - Intel 325462.pdf Vol.3C 35-111\n\t\t\t\tcase INTEL_FAM6_SANDYBRIDGE_X:\t\t// 0x2D - Intel 325462.pdf Vol.3C 35-111\n\t\t\t\tcase INTEL_FAM6_IVYBRIDGE:\t\t\t// 0x3A - Intel 325462.pdf Vol.3C 35-125 (Refering to Table 35-12)\n\t\t\t\tcase INTEL_FAM6_IVYBRIDGE_X:\t\t// 0x3E - Intel 325462.pdf Vol.3C 35-125 (Refering to Table 35-12)\n\t\t\t\t\t// No C7 support for Intel® Xeon® Processor E5-1600 v2/E5-2600 v2 (Product Families Datasheet Volume One of Two page 19)\n\t\t\t\tcase INTEL_FAM6_HASWELL_CORE:\t\t// 0x3C - Intel 325462.pdf Vol.3C 35-136\n\t\t\t\tcase INTEL_FAM6_BROADWELL_CORE:\t\t// 0x3D\n\t\t\t\tcase INTEL_FAM6_HASWELL_ULT:\t\t// 0x45 - Intel 325462.pdf Vol.3C 35-136\n\t\t\t\tcase INTEL_FAM6_HASWELL_GT3E:\t\t// 0x46\n\t\t\t\tcase INTEL_FAM6_BROADWELL_X:\t\t// 0x47\n\t\t\t\tcase INTEL_FAM6_SKYLAKE_MOBILE:\t\t// 0x4E\n\t\t\t\tcase INTEL_FAM6_SKYLAKE_DESKTOP:\t// 0x5E\n\t\t\t\tcase INTEL_FAM6_CANNONLAKE_CORE:\t// 0x66\n\t\t\t\tcase INTEL_FAM6_KABYLAKE_MOBILE:\t// 0x8E\n\t\t\t\tcase INTEL_FAM6_KABYLAKE_DESKTOP:\t// 0x9E\n\t\t\t\t\tgCheckC7 = true;\n\t\t\t\t\tbreak;\n\t\t\t}\n#endif\n\t\t\t\n\t\t\tmsr = rdmsr64(MSR_PLATFORM_INFO);\n\t\t\tgMinRatio = (UInt8)((msr >> 40) & 0xff);\n\t\t\tgClockRatio = (UInt8)((msr >> 8) & 0xff);\n\t\t\tmsr = rdmsr64(MSR_CORE_THREAD_COUNT);\n\t\t\tgCoreCount = bitfield32(msr, 31, 16);\n\t\t\tgThreadCount = bitfield32(msr, 15, 0);\n\n#if REPORT_MSRS\n\t\t\tgTSC = rdtsc64();\n\t\t\tIOLOG(\"InitialTSC...............................: 0x%llx (%llu MHz)\\n\", gTSC, ((gTSC / gClockRatio) / 1000000000));\n\n\t\t\t// MWAIT information\n\t\t\tdo_cpuid(0x00000005, cpuid_reg);\n\t\t\tuint32_t supportedMwaitCStates = bitfield32(cpuid_reg[edx], 31,  0);\n\n\t\t\tIOLOG(\"MWAIT C-States...........................: %d\\n\", supportedMwaitCStates);\n\n\t\t\tif (logMSRs)\n\t\t\t{\n\t\t\t\treportMSRs();\n\t\t\t}\n#endif\n\n#if REPORT_INTEL_REGS\n\t\t\tif (logIntelRegs)\n\t\t\t{\n\t\t\t\toutl(0xcf8, 0x80001000);\n\t\t\t\tuint32_t value = inl(0xcfc);\n\t\t\t\t\n\t\t\t\tif ((value & 0x0000ffff) == 0x8086)\n\t\t\t\t{\n\t\t\t\t\tdevid = ((value >> 16) & 0x0000ffff);\n\t\t\t\t\t\n\t\t\t\t\treportIntelRegs();\n\t\t\t\t}\n\t\t\t}\n#endif\n\n\t\t\tIOLOG(\"\\nCPU Ratio Info:\\n------------------------------------------\\nBase Clock Frequency (BLCK)............. : %d MHz\\n\", gBclk);\n\t\t\tIOLOG(\"Maximum Efficiency Ratio/Frequency.......: %2d (%4d MHz)\\n\", gMinRatio, (gMinRatio * gBclk));\n\t\t\tIOLOG(\"Maximum non-Turbo Ratio/Frequency........: %2d (%4d MHz)\\n\", gClockRatio, (gClockRatio * gBclk));\n\t\t\t\n\t\t\tif (!((rdmsr64(IA32_MISC_ENABLES) >> 32) & 0x40))\t// Turbo Mode Enabled?\n\t\t\t{\n\t\t\t\tmsr = rdmsr64(MSR_TURBO_RATIO_LIMIT);\n\t\t\t\tgMaxRatio = (UInt8)(msr & 0xff);\n\t\t\t\tIOLOG(\"Maximum Turbo Ratio/Frequency............: %2d (%4d MHz)\\n\", gMaxRatio, (gMaxRatio * gBclk));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tgMaxRatio = gClockRatio;\n\t\t\t\tIOLOG(\"Maximum Ratio/Frequency..................: %2d (%4d MHz)\\n\", gMaxRatio, (gMaxRatio * gBclk));\n\t\t\t}\n\n#if REPORT_IGPU_P_STATES\n\t\t\tif (igpuEnabled)\n\t\t\t{\n\t\t\t\tIOPhysicalAddress address = (IOPhysicalAddress)(0xFED10000 + 0x5948);\n\t\t\t\tmemDescriptor = IOMemoryDescriptor::withPhysicalAddress(address, 0x53, kIODirectionInOut);\n\n\t\t\t\tif (memDescriptor != NULL)\n\t\t\t\t{\n\t\t\t\t\tif ((result = memDescriptor->prepare()) == kIOReturnSuccess)\n\t\t\t\t\t{\n\t\t\t\t\t\tmemoryMap = memDescriptor->map();\n\n\t\t\t\t\t\tif (memoryMap != NULL)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgMchbar = (UInt8 *)memoryMap->getVirtualAddress();\n\n\t\t\t\t\t\t\t// Preventing a stupid (UEFI) BIOS limit.\n\t\t\t\t\t\t\tif (gMchbar[0x4C] < gMchbar[0x50])\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tgMchbar[0x4C] = gMchbar[0x50];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Examples IGPU multiplier:\t17 (multiplier) * 50 (frequency in MHz) =  850 MHz\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\t22 (multiplier) * 50 (frequency in MHz) = 1100 MHz\n\t\t\t\t\t\t\t//\t\t\t\t\t\t\t\t6 P-States: 850, 900, 950, 1000, 1050 and 1100 MHz\n\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t// Current RP-State, when the graphics engine is in RC6, this reflects the last used ratio.\n\t\t\t\t\t\t\tIOLOG(\"\\nIGPU Info:\\n------------------------------------------\\n\");\n\t\t\t\t\t\t\tIOLOG(\"IGPU Current Frequency...................: %4d MHz\\n\", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x01])); // RP_STATE_RATIO (CURRENT_FREQUENCY)\n\t\t\t\t\t\t\t// Maximum RPN base frequency capability for the Integrated GFX Engine (GT).\n\t\t\t\t\t\t\tIOLOG(\"IGPU Minimum Frequency...................: %4d MHz\\n\", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x52])); // RPN_CAP (MIN_FREQUENCY) See also: DSDT->RPNC\n\t\t\t\t\t\t\t// Maximum RP1 base frequency capability for the Integrated GFX Engine (GT).\n\t\t\t\t\t\t\tIOLOG(\"IGPU Maximum Non-Turbo Frequency.........: %4d MHz\\n\", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x51])); // RP1_CAP (MAX_NON_TURBO) See also: DSDT->RP1C\n\t\t\t\t\t\t\t// Maximum RP0 base frequency capability for the Integrated GFX Engine (GT).\n\t\t\t\t\t\t\tIOLOG(\"IGPU Maximum Turbo Frequency.............: %4d MHz\\n\", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x50])); // RP0_CAP (MAX_TURBO)) See also: DSDT->RP0C\n\n\t\t\t\t\t\t\t// Maximum base frequency limit for the Integrated GFX Engine (GT) allowed during run-time.\n\t\t\t\t\t\t\tif (gMchbar[0x4C] == 255)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tIOLOG(\"IGPU Maximum limit.......................: No Limit\\n\\n\"); // RPSTT_LIM\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tIOLOG(\"IGPU Maximum limit.......................: %4d MHz\\n\\n\", IGPU_RATIO_TO_FREQUENCY((UInt8)gMchbar[0x4C])); // RPSTT_LIM\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tIOLOG(\"Error: memoryMap == NULL\\n\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tIOLOG(\"Error: memDescriptor->prepare() failed!\\n\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"Error: memDescriptor == NULL\\n\");\n\t\t\t\t}\n\t\t\t}\n#endif\n\t\t\tIOLOG(\"P-State ratio * %d = Frequency in MHz\\n------------------------------------------\\n\", gBclk);\n\n\t\t\ttimerEventSource = IOTimerEventSource::timerEventSource(this, OSMemberFunctionCast(IOTimerEventSource::Action, this, &AppleIntelInfo::loopTimerEvent));\n\t\t\tworkLoop = getWorkLoop();\n\n\t\t\tif (timerEventSource && workLoop && (kIOReturnSuccess == workLoop->addEventSource(timerEventSource)))\n\t\t\t{\n\t\t\t\tthis->registerService(0);\n\t\t\t\ttimerEventSource->setTimeoutMS(1000);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n\n\n//==============================================================================\n\nvoid AppleIntelInfo::stop(IOService *provider)\n{\n#if\tWRITE_LOG_REPORT\n\tif (mCtx)\n\t{\n\t\tvfs_context_rele(mCtx);\n\t}\n#endif\n\n\tif (simpleLock)\n\t{\n\t\tIOSimpleLockFree(simpleLock);\n\t}\n\n\tif (timerEventSource)\n\t{\n\t\tif (workLoop)\n\t\t{\n\t\t\ttimerEventSource->cancelTimeout();\n\t\t\tworkLoop->removeEventSource(timerEventSource);\n\t\t}\n\n\t\ttimerEventSource->release();\n\t\ttimerEventSource = NULL;\n\t}\n\n\tsuper::stop(provider);\n}\n\n\n//==============================================================================\n\nvoid AppleIntelInfo::free()\n{\n#if REPORT_IGPU_P_STATES\n\tif (igpuEnabled)\n\t{\n\t\tif (memoryMap)\n\t\t{\n\t\t\tmemoryMap->release();\n\t\t\tmemoryMap = NULL;\n\t\t}\n\n\t\tif (memDescriptor)\n\t\t{\n\t\t\tmemDescriptor->release();\n\t\t\tmemDescriptor = NULL;\n\t\t}\n\t}\n#endif\n\n\tsuper::free();\n}\n"
  },
  {
    "path": "AppleIntelInfo/AppleIntelInfo.h",
    "content": "/*\n * Copyright (c) 2012-2017 Pike R. Alpha. All rights reserved.\n *\n * Original idea and initial development of MSRDumper.kext (c) 2011 by † RevoGirl.\n *\n * A big thank you to George for his help and continuation of Sam's work, but it\n * was time for me to push the envelope and add some really interesting stuff.\n *\n * This work is licensed under the Creative Commons Attribution-NonCommercial\n * 4.0 Unported License => http://creativecommons.org/licenses/by-nc/4.0\n */\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-register\"\n#include <IOKit/IOLib.h>\n#pragma clang diagnostic pop\n\n#include <IOKit/IOService.h>\n#include <IOKit/IOWorkLoop.h>\n#include <IOKit/IOMemoryDescriptor.h>\n#include <IOKit/IOTimerEventSource.h>\n\n#include <sys/vnode.h>\n#include <sys/fcntl.h>\n#include <sys/proc.h>\n#include <i386/cpuid.h>\n\n#include <libkern/sysctl.h>\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated-register\"\n#include <i386/proc_reg.h>\n#pragma clang diagnostic pop\n\n#include <essentials.h>\n\n#define super IOService\n\n#define VERSION\t\t\t\t\t\"2.9\"\n\n/*\n * Build settings (0 = disable feature / 1 = enable feature)\n */\n\n#define REPORT_MSRS\t\t\t\t1\n#define REPORT_RAPL_MSRS\t\t1\n#define REPORT_HWP\t\t\t\t1\n#define REPORT_HDC\t\t\t\t1\n\n#define REPORT_IGPU_P_STATES\t1\n#define REPORT_C_STATES\t\t\t1\n#define REPORT_IPG_STYLE\t\t1\n#define REPORT_INTEL_REGS\t\t0\n\n#define ENABLE_HWP\t\t\t\t1\n\n#define WRITE_LOG_REPORT\t\t1\n\n#define MMIO_READ8(Address)\t\t\t(*(volatile UInt8  *)(Address))\n#define MMIO_READ16(Address)\t\t(*(volatile UInt16 *)(Address))\n#define MMIO_READ32(Address)\t\t(*(volatile UInt32 *)(gMMIOAddress + Address))\n\n#define NB_BUS\t0x00\n#define NB_DEV\t0x00\n#define NB_FUN\t0x00\n\n#define DEVEN\t(0x54)\n#define DEVEN_D2EN_MASK\t(0x10)\n\n#define NB_PCICFG_SPACE_INDEX_REG\t0xcf8\n#define NB_PCICFG_SPACE_DATA_REG\t0xcfc\n\n#define BIT31\t\t\t\t\t\t0x80000000\n\n#define PCIEX_BASE_ADDRESS\t\t\t0xF8000000\n#define NB_MCH_BASE_ADDRESS\t\t\t0xFED10000\t// (G)MCH Memory Mapped Register Range Base Address (D0:F0:Rx48).\n\n#define READ_PCI8(Bx, Dx, Fx, Rx)\tReadPci8(Bx, Dx, Fx, Rx)\n#define READ_PCI8_NB(Rx)\t\t\tREAD_PCI8(NB_BUS, NB_DEV, NB_FUN, Rx)\n\n#define IGPU_RATIO_TO_FREQUENCY(ratio)\t((ratio * 100) / 2)\n\n#define NB_PCI_CFG_ADDRESS(bus, dev, func, reg) \\\n(UInt64) ((((UInt8)(bus) << 24) + ((UInt8)(dev) << 16) + \\\n((UInt8)(func) << 8) + ((UInt8)(reg))) & 0xffffffff)\n\n#define NB_PCIE_CFG_ADDRESS(bus, dev, func, reg) \\\n((UInt32)(PCIEX_BASE_ADDRESS + ((UInt8)(bus) << 20) + \\\n((UInt8)(dev) << 15) + ((UInt8)(func) << 12) + (reg)))\n\n#if WRITE_LOG_REPORT\n\t#define\tFILE_PATH \"/tmp/AppleIntelInfo.dat\"\n\n\t#define TEMP_BUFFER_SIZE\t256\n\t#define WRITE_BUFFER_SIZE\t1024\n\n\t#define IOLOG(format, args...)\t\t\t\t\t\t\t\\\n\tmemset(logBuffer, 0, TEMP_BUFFER_SIZE);\t\t\t\t\t\\\n\tsnprintf(logBuffer, TEMP_BUFFER_SIZE, format, ##args);\t\\\n\twriteReport();\n#else\n\t#define IOLOG(fmt, args...) IOLog(fmt, ##args)\n\t/*\n\t * macOS Sierra only!\n\t */\n\t#include <os/log.h>\n\t#define IOLOG(fmt, args...) os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_INFO, fmt, ##args)\n#endif\n\n\n#define RAPL_BASE\t\t\t\t\t0\n\n#define RAPL_PKG\t\t\t\t\t(1 << 0)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x610 MSR_PKG_POWER_LIMIT */\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x611 MSR_PKG_ENERGY_STATUS */\n\n#define RAPL_PKG_PERF_STATUS\t\t(1 << 1)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x613 MSR_PKG_PERF_STATUS */\n\n#define RAPL_PKG_POWER_INFO\t\t\t(1 << 2)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x614 MSR_PKG_POWER_INFO */\n\n#define RAPL_DRAM\t\t\t\t\t(1 << 3)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x618 MSR_DRAM_POWER_LIMIT */\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x619 MSR_DRAM_ENERGY_STATUS */\n\n#define RAPL_DRAM_PERF_STATUS\t\t(1 << 4)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x61b MSR_DRAM_PERF_STATUS */\n\n#define RAPL_DRAM_POWER_INFO\t\t(1 << 5)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x61c MSR_DRAM_POWER_INFO */\n\n#define RAPL_CORES_POWER_LIMIT\t\t(1 << 6)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x638 MSR_PP0_POWER_LIMIT */\n\n#define RAPL_CORE_POLICY\t\t\t(1 << 7)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x63a MSR_PP0_POLICY */\n\n#define RAPL_GFX\t\t\t\t\t(1 << 8)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x640 MSR_PP1_POWER_LIMIT */\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x641 MSR_PP1_ENERGY_STATUS */\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x642 MSR_PP1_POLICY */\n\n#define RAPL_CORES_ENERGY_STATUS\t(1 << 9)\n\t\t\t\t\t\t\t\t\t\t\t\t/* 0x639 MSR_PP0_ENERGY_STATUS */\n\n#define RAPL_CORES (RAPL_CORES_ENERGY_STATUS | RAPL_CORES_POWER_LIMIT)\n\n\n//------------------------------------------------------------------------------\n\nstatic __inline__ void outl(UInt16 port, UInt32 value)\n{\n\t__asm__ volatile(\"outl %0, %w1\" : : \"a\" (value), \"Nd\" (port));\n}\n\n//------------------------------------------------------------------------------\n\nstatic __inline__ unsigned char inb(UInt16 port)\n{\n\tUInt8 value;\n\t__asm__ volatile(\"inb %w1, %b0\" : \"=a\" (value) : \"Nd\" (port));\n\treturn (value);\n}\n\n//------------------------------------------------------------------------------\n\nstatic __inline__ unsigned int inl(UInt16 port)\n{\n\tUInt32 value;\n\t__asm__ volatile(\"inl %w1, %0\" : \"=a\" (value) : \"Nd\" (port));\n\treturn (value);\n}\n\n//------------------------------------------------------------------------------\n\nUInt8 ReadPci8(UInt8 Bus, UInt8 Dev, UInt8 Fun, UInt16 Reg)\n{\n\tif (Reg >= 0x100)\n\t{\n\t\treturn MMIO_READ8((UInt64)NB_PCIE_CFG_ADDRESS(Bus, Dev, Fun, Reg));\n\t}\n\telse\n\t{\n\t\toutl(NB_PCICFG_SPACE_INDEX_REG, BIT31 | (Bus << 16) | (Dev << 11) | (Fun << 8) | (Reg & 0xfc));\n\t\treturn inb(NB_PCICFG_SPACE_DATA_REG | (UInt8)(Reg & 3));\n\t}\n}\n\nextern \"C\" void mp_rendezvous_no_intrs(void (*action_func)(void *), void * arg);\nextern \"C\" int cpu_number(void);\n\n//------------------------------------------------------------------------------\n\nclass AppleIntelInfo : public IOService\n{\n\tOSDeclareDefaultStructors (AppleIntelInfo);\n\t\nprivate:\n\tIOSimpleLock\t\t*simpleLock;\n\tIOWorkLoop\t\t\t*workLoop;\n\tIOTimerEventSource\t*timerEventSource;\n\t\n#ifdef REPORT_IGPU_P_STATES\n\tIOMemoryDescriptor\t*memDescriptor;\n\tIOMemoryMap\t\t\t*memoryMap;\n\n\tbool igpuEnabled\t= false;\t// Set <key>logIGPU</key> to <true/> in Info.plist to enable this feature.\n#endif\n\t\n\tIOReturn result\t\t= kIOReturnSuccess;\n\t\n\tvirtual IOReturn loopTimerEvent(void);\n\n\tint writeReport(void);\n\n#ifdef REPORT_RAPL_MSRS\n\tbool supportsRAPL(UInt16 aTargetRAPLFeature);\n\tvoid reportRAPL(UInt16 aTargetRAPL);\n#endif\n\n#ifdef REPORT_MSRS\n\tvoid reportMSRs(void);\n\n\t#ifdef REPORT_HWP\n\tvoid reportHWP(void);\n\t#endif\n\n\t#ifdef REPORT_HWP\n\tvoid reportHDC(void);\n\t#endif\n\n\tbool hasCPUFeature(long targetCPUFeature);\n\n\tbool logMSRs\t\t= true;\t\t// Set <key>logIGPU</key> to <false/> in Info.plist to disable this feature.\n#endif\n\n\tbool gHwpEnabled\t= false;\n\n\tbool loopLock\t\t= false;\n\n#ifdef REPORT_C_STATES\n\tbool logCStates\t\t= true;\t\t//  Set <key>logCStates</key> to <false/> in Info.plist to disable this feature.\n#endif\n\n#ifdef REPORT_IPG_STYLE\n\tbool logIPGStyle\t= true;\t\t//  Set <key>logIPGStyle</key> to <false/> in Info.plist to disable this feature.\n#endif\n\n#ifdef REPORT_INTEL_REGS\n\tbool logIntelRegs\t= true;\t\t//  Set <key>logIntelRegs</key> to <false/> in Info.plist to disable this feature.\n\n\t#define DEBUGSTRING(func) void func(char *result, int len, UInt32 reg, UInt32 val)\n\t#define DEFINEREG2(reg, func) { reg, #reg, func, 0 }\n\n\t#define DEFINE_FUNC_VOID(func) void func(void)\n\t#define DEFINE_FUNC_DUMP(func) void func(struct reg_debug *regs, uint32_t count)\n\t\n\tvoid intel_dump_other_regs(void);\n\tvoid dumpRegisters(struct reg_debug *regs, uint32_t count);\n\tvoid getPCHDeviceID(void);\n\tvoid reportIntelRegs(void);\n#endif\n\n\tuint32_t getBusFrequency(void);\n\n\tconst char * getUnitText(uint8_t unit);\n\n\tUInt16 Interval\t\t\t\t\t= 50;\n\tuint16_t gBclk\t\t\t\t\t= 0;\n\n\tUInt64\tgCoreMultipliers\t\t= 0ULL;\n\tUInt64\tgTriggeredPStates\t\t= 0ULL;\n\t\n\tUInt64\tgIGPUMultipliers\t\t= 0ULL;\n\tUInt64\tgTriggeredIGPUPStates\t= 0ULL;\n\n#if WRITE_LOG_REPORT\n\tvfs_context_t mCtx\t\t\t\t= NULL;\n\tlong reportFileOffset\t\t\t= 0L;\n\n\tchar tempBuffer[TEMP_BUFFER_SIZE];\n\tchar logBuffer[WRITE_BUFFER_SIZE];\n#endif\n\npublic:\n\tvirtual IOService *\tprobe(IOService * provider, SInt32 * score) override;\n\tvirtual bool start(IOService * provider) override;\n\tvirtual void stop(IOService * provider) override;\n\tvirtual void free(void) override;\n\t\n\tUInt8\tgMinRatio\t\t= 0;\n\tUInt8\tgClockRatio\t\t= 0;\n\tUInt8\tgMaxRatio\t\t= 0;\n\tUInt8\tgCpuModel\t\t= 0;\n\tUInt8\tgCoreCount\t\t= 0;\n};\n\nOSDefineMetaClassAndStructors(AppleIntelInfo, IOService)\n\nUInt8\tgThreadCount\t= 0;\nUInt8\tgCoreStates\t= 0ULL;\n\n#if REPORT_C_STATES\n\tbool\tgCheckC3\t= true;\n\tbool\tgCheckC6\t= true;\n\tbool\tgCheckC7\t= false;\n\n\tUInt64\tgC3Cores\t= 0;\n\tUInt64\tgC6Cores\t= 0;\n\tUInt64\tgC7Cores\t= 0;\n\n\tUInt64\tgTriggeredC3Cores\t= 0;\n\tUInt64\tgTriggeredC6Cores\t= 0;\n\tUInt64\tgTriggeredC7Cores\t= 0;\n#endif\n\nUInt64\tgCoreMultipliers = 0ULL;\n\nuint64_t gTSC = 0;\n\n#ifdef REPORT_IGPU_P_STATES\nUInt8\t* gMchbar\t= NULL;\n#endif\n\n#if REPORT_INTEL_REGS\n\t#include \"../AppleIntelRegisterDumper/AppleIntelRegisterDumper.h\"\n#endif\n"
  },
  {
    "path": "AppleIntelInfo/essentials.h",
    "content": "/*\n * This work is licensed under the Creative Commons Attribution-NonCommercial\n * 4.0 Unported License => http://creativecommons.org/licenses/by-nc/4.0\n */\n\n#ifndef __LIBSAIO_CPU_ESSENTIALS_H\n#define __LIBSAIO_CPU_ESSENTIALS_H\n\n#include \"intel_family.h\"\n\n/* Copied from xnu/osfmk/cpuid.c (modified for 64-bit values) */\n#define bit(n)\t\t\t\t(1UL << (n))\n#define bitmask64(h, l)\t\t((bit(h) | (bit(h) - 1)) & ~ (bit(l) - 1))\n#define bitfield32(x, h, l)\t(((x) & bitmask64(h, l)) >> l)\n\n// Added by DHP in 2010.\n#define CPU_VENDOR_INTEL\t0x756E6547\n#define CPU_VENDOR_AMD\t\t0x68747541\n\n\n/* Copied from xnu/osfmk/cpuid.h */\n#define CPU_STRING_UNKNOWN \"Unknown CPU Typ\"\n\n// Copied from xnu/osfmk/proc_reg.h\n#define MSR_IA32_PLATFORM_ID\t\t\t0x17\n#define\tMSR_CORE_THREAD_COUNT\t\t\t0x35\n\n#ifndef MSR_PLATFORM_INFO\n\t#define MSR_PLATFORM_INFO\t\t\t0xCE\n#endif\n\n#define MSR_PKG_CST_CONFIG_CONTROL\t\t0xE2\t// MSR_PKG_CST_CONFIG_CONTROL\n#define MSR_PMG_IO_CAPTURE_BASE\t\t\t0xE4\n#define IA32_MPERF\t\t\t\t\t\t0xE7\n#define IA32_APERF\t\t\t\t\t\t0xE8\n#define IA32_PPERF\t\t\t\t\t\t0x64E\n\n#define\tMSR_IA32_PERF_STATUS\t\t\t0x0198\t// MSR_IA32_PERF_STS in XNU\n#define\tMSR_IA32_PERF_CONTROL\t\t\t0x0199\t// IA32_PERF_CTL\n\n#ifndef MSR_FLEX_RATIO\n\t#define MSR_FLEX_RATIO\t\t\t\t0x0194\n#endif\n\n#define IA32_CLOCK_MODULATION\t\t\t0x019A\n#define IA32_THERM_INTERRUPT\t\t\t0x019B\n#define IA32_THERM_STATUS\t\t\t\t0x019C\n#define MSR_THERM2_CTL\t\t\t\t\t0x019D\n\n#define IA32_MISC_ENABLES\t\t\t\t0x01A0\n#define MSR_TEMPERATURE_TARGET\t\t\t0x01A2\n#define MSR_MISC_PWR_MGMT\t\t\t\t0x01AA\n#define\tMSR_TURBO_RATIO_LIMIT\t\t\t0x01AD\n#define\tMSR_TURBO_RATIO_LIMIT1\t\t\t0x01AE\n#define\tMSR_TURBO_RATIO_LIMIT2\t\t\t0x01AF\n\n#define IA32_ENERGY_PERF_BIAS\t\t\t0x01B0\n#define IA32_PLATFORM_DCA_CAP\t\t\t0x01F8\n#define MSR_POWER_CTL\t\t\t\t\t0x01FC\n\n#define MSR_PKGC3_IRTL\t\t\t\t\t0x60A\n#define MSR_PKGC6_IRTL\t\t\t\t\t0x60B\n#define MSR_PKGC7_IRTL\t\t\t\t\t0x60C\n\n#define MSR_PKG_C2_RESIDENCY\t\t\t0x60D\n#define MSR_PKG_C3_RESIDENCY\t\t\t0x3F8\n#define MSR_PKG_C6_RESIDENCY\t\t\t0x3F9\n#define MSR_PKG_C7_RESIDENCY\t\t\t0x3FA\n\n#define MSR_CORE_C3_RESIDENCY\t\t\t0x3FC\n#define MSR_CORE_C6_RESIDENCY\t\t\t0x3FD\n#define MSR_CORE_C7_RESIDENCY\t\t\t0x3FE\n\n#define MSR_PP0_CURRENT_CONFIG\t\t\t0x601\n#define MSR_PP1_CURRENT_CONFIG\t\t\t0x602\n\n// Sandy Bridge & JakeTown specific 'Running Average Power Limit' MSR's.\n#define MSR_RAPL_POWER_UNIT\t\t\t\t0x606\n\n#define MSR_PKG_POWER_LIMIT\t\t\t\t0x610\n#define MSR_PKG_ENERGY_STATUS\t\t\t0x611\n#define MSR_PKG_PERF_STATUS\t\t\t\t0x613\n#define MSR_PKG_POWER_INFO\t\t\t\t0x614\n\n// JakeTown only Memory MSR's.\n#define MSR_DRAM_POWER_LIMIT\t\t\t0x618\n#define MSR_DRAM_ENERGY_STATUS\t\t\t0x619\n#define MSR_DRAM_PERF_STATUS\t\t\t0x61B\n#define MSR_DRAM_POWER_INFO\t\t\t\t0x61C\n\n#define MSR_UNCORE_RATIO_LIMIT\t\t\t0x620\n\n// Xeon (0x4F) Package residency MSR's.\n// Haswell-ULT (0x45) Package residency MSR's.\n#define MSR_PKG_C8_RESIDENCY\t\t\t0x630\n#define MSR_PKG_C9_RESIDENCY\t\t\t0x631\n#define MSR_PKG_C10_RESIDENCY\t\t\t0x632\n\n// Haswell-ULT C state latency control.\n#define MSR_PKG_C8_LATENCY\t\t\t\t0x633\n#define MSR_PKG_C9_LATENCY\t\t\t\t0x634\n#define MSR_PKG_C10_LATENCY\t\t\t\t0x635\n\n// Haswell-ULT VR configurations.\n#define VR_MISC_CONFIG2\t\t\t\t\t0x636\n\n// Haswell-ULT Alternate BCLK in deep Package C states.\n#define MSR_COUNTER_24_MHZ\t\t\t\t0x637\n\n// Sandy Bridge IA (Core) domain MSR's.\n#define MSR_PP0_POWER_LIMIT\t\t\t\t0x638\n#define MSR_PP0_ENERGY_STATUS\t\t\t0x639\n#define MSR_PP0_POLICY\t\t\t\t\t0x63A\n#define MSR_PP0_PERF_STATUS\t\t\t\t0x63B\n\n// Sandy Bridge Uncore (IGPU) domain MSR's (Not on JakeTown).\n#define MSR_PP1_POWER_LIMIT\t\t\t\t0x640\n#define MSR_PP1_ENERGY_STATUS\t\t\t0x641\n#define MSR_PP1_POLICY\t\t\t\t\t0x642\n\n// Ivy Bridge Specific MSR's\n#define MSR_CONFIG_TDP_NOMINAL\t\t\t0x648\n#define MSR_CONFIG_TDP_LEVEL1\t\t\t0x649\n#define MSR_CONFIG_TDP_LEVEL2\t\t\t0x64A\n#define MSR_CONFIG_TDP_CONTROL\t\t\t0x64B\n#define MSR_TURBO_ACTIVATION_RATIO\t\t0x64C\n\n// Skylake Specific MSR's.\n#define MSR_PLATFORM_ENERGY_COUNTER\t\t0x64D\n#define MSR_PPERF\t\t\t\t\t\t0x64E\n#define MSR_CORE_PERF_LIMIT_REASONS\t\t0x64F\n\n#define MSR_PKG_HDC_CONFIG\t\t\t\t0x652\n\n#define MSR_CORE_HDC_RESIDENCY\t\t\t0x653\n#define MSR_PKG_HDC_SHALLOW_RESIDENCY\t0x655\n#define MSR_PKG_HDC_DEEP_RESIDENCY\t\t0x656\n\n#define MSR_WEIGHTED_CORE_C0\t\t\t0x658\n#define MSR_ANY_CORE_C0\t\t\t\t\t0x659\n#define MSR_ANY_GFXE_C0\t\t\t\t\t0x65A\n#define MSR_CORE_GFXE_OVERLAP_C0\t\t0x65B\n#define MSR_PLATFORM_POWER_LIMIT\t\t0x65C\n\n#define IA32_TSC_DEADLINE\t\t\t\t0x6E0\n\n#define IA32_PKG_HDC_CTL\t\t\t\t0xDB0\n#define IA32_PM_CTL1\t\t\t\t\t0xDB1\n#define IA32_THREAD_STALL\t\t\t\t0xDB2\n\n// HPW MSR's\n#define IA32_PM_ENABLE\t\t\t\t\t0x770\n#define IA32_HWP_CAPABILITIES\t\t\t0x771\n#define IA32_HWP_REQUEST_PKG\t\t\t0x772\n#define IA32_HWP_INTERRUPT\t\t\t\t0x773\n#define IA32_HWP_REQUEST\t\t\t\t0x774\n#define IA32_HWP_STATUS\t\t\t\t\t0x777\n\n// CPUID leaf index values (pointing to the right spot in CPUID/LEAF array).\n\n#define LEAF_0\t\t\t\t0\t\t\t// DHP: Formerly known as CPUID_n\n#define LEAF_1\t\t\t\t1\n#define LEAF_2\t\t\t\t2\n#define LEAF_4\t\t\t\t3\n#define LEAF_5\t\t\t\t4\n#define LEAF_6\t\t\t\t5\n#define LEAF_B\t\t\t\t6\n#define LEAF_80\t\t\t\t7\n#define LEAF_81\t\t\t\t8\n\n#define MAX_CPUID_LEAVES\t9\t\t\t// DHP: Formerly known as MAX_CPUID\n\n/* Copied from: xnu/osfmk/i386/cpuid.h\n#define CPU_MODEL_YONAH  \t\t\t0x0E\n#define CPU_MODEL_MEROM\t\t\t\t0x0F\n#define CPU_MODEL_PENRYN\t\t\t0x17\n#define CPU_MODEL_NEHALEM\t\t\t0x1A\n#define CPU_MODEL_ATOM\t\t\t\t0x1C\n#define CPU_MODEL_FIELDS\t\t\t0x1E\t// Lynnfield, Clarksfield, Jasper (LGA 1156)\n#define CPU_MODEL_DALES\t\t\t\t0x1F\t// Havendale, Auburndale (LGA 1156)\n#define CPU_MODEL_DALES_32NM\t\t0x25\t// Clarkdale, Arrandale\n#define CPU_MODEL_SB_CORE\t\t\t0x2A\t// Sandy Bridge Core Processors (LGA 1155)\n#define CPU_MODEL_WESTMERE\t\t\t0x2C\t// Gulftown, Westmere-EP, Westmere-WS\n#define CPU_MODEL_SB_JAKETOWN\t\t0x2D\t// Sandy Bridge-EP, Sandy Bridge Xeon Processors (LGA 2011)\n#define CPU_MODEL_NEHALEM_EX\t\t0x2E\n#define CPU_MODEL_WESTMERE_EX\t\t0x2F\n#define CPU_MODEL_IB_CORE\t\t\t0x3A\t// Ivy Bridge Core Processors (LGA 1155)\n#define CPU_MODEL_IB_CORE_EX\t\t0x3B\t// Ivy Bridge Core Processors (LGA 2011)\n#define CPU_MODEL_IB_CORE_XEON\t\t0x3E\n\n#define CPU_MODEL_HASWELL\t\t\t0x3C\n#define CPU_MODEL_HASWELL_SVR\t\t0x3F\n#define CPU_MODEL_HASWELL_ULT\t\t0x45\n#define CPU_MODEL_CRYSTALWELL\t\t0x46\n\n#define CPU_MODEL_BROADWELL\t\t\t0x3D\n#define CPU_MODEL_BROADWELL_ULX\t\t0x3D\n#define CPU_MODEL_BROADWELL_ULT\t\t0x3D\n#define CPU_MODEL_BROADWELL_H\t\t0x47\n#define CPU_MODEL_BRYSTALWELL\t\t0x4C\n#define CPU_MODEL_BROADWELL_E\t\t0x4F\n\n#define CPU_MODEL_SKYLAKE\t\t\t0x4E\n#define CPU_MODEL_SKYLAKE_ULT\t\t0x4E\n#define CPU_MODEL_SKYLAKE_ULX\t\t0x4E\n#define CPU_MODEL_SKYLAKE_X\t\t\t0x55\n#define CPU_MODEL_SKYLAKE_DT\t\t0x5E\n\n#define CPU_MODEL_KABYLAKE\t\t\t0x8E\n#define CPU_MODEL_KABYLAKE_DT\t\t0x9E\n*/\n\n#define DALES_BRIDGE\t1\n#define SANDY_BRIDGE\t2\n#define IVY_BRIDGE\t\t4\n#define HASWELL\t\t\t8\n\n#endif /* !__LIBSAIO_CPU_ESSENTIALS_H */\n"
  },
  {
    "path": "AppleIntelInfo/intel_family.h",
    "content": "#ifndef _ASM_X86_INTEL_FAMILY_H\n#define _ASM_X86_INTEL_FAMILY_H\n\n/*\n * \"Big Core\" Processors (Branded as Core, Xeon, etc...)\n *\n * The \"_X\" parts are generally the EP and EX Xeons, or the\n * \"Extreme\" ones, like Broadwell-E.\n *\n * Things ending in \"2\" are usually because we have no better\n * name for them.  There's no processor called \"SILVERMONT2\".\n */\n\n#define INTEL_FAM6_CORE_YONAH\t\t0x0E\n#define INTEL_FAM6_CORE2_MEROM\t\t0x0F\n#define INTEL_FAM6_CORE2_MEROM_L\t0x16\n#define INTEL_FAM6_CORE2_PENRYN\t\t0x17\n#define INTEL_FAM6_CORE2_DUNNINGTON\t0x1D\n\n#define INTEL_FAM6_NEHALEM\t\t\t0x1E\n#define INTEL_FAM6_NEHALEM_G\t\t0x1F /* Auburndale / Havendale */\n#define INTEL_FAM6_NEHALEM_EP\t\t0x1A\n#define INTEL_FAM6_NEHALEM_EX\t\t0x2E\n#define INTEL_FAM6_WESTMERE\t\t\t0x25\n#define INTEL_FAM6_WESTMERE_EP\t\t0x2C\n#define INTEL_FAM6_WESTMERE_EX\t\t0x2F\n\n#define INTEL_FAM6_SANDYBRIDGE\t\t0x2A\n#define INTEL_FAM6_SANDYBRIDGE_X\t0x2D\n#define INTEL_FAM6_IVYBRIDGE\t\t0x3A\n#define INTEL_FAM6_IVYBRIDGE_X\t\t0x3E\n\n#define INTEL_FAM6_HASWELL_CORE\t\t0x3C\n#define INTEL_FAM6_HASWELL_X\t\t0x3F\n#define INTEL_FAM6_HASWELL_ULT\t\t0x45\n#define INTEL_FAM6_HASWELL_GT3E\t\t0x46\n\n#define INTEL_FAM6_BROADWELL_CORE\t0x3D\n#define INTEL_FAM6_BROADWELL_XEON_D\t0x56\n#define INTEL_FAM6_BROADWELL_GT3E\t0x47\n#define INTEL_FAM6_BROADWELL_X\t\t0x4F\n#define INTEL_FAM6_BROADWELL_XEON_D\t0x56\n\n#define INTEL_FAM6_SKYLAKE_MOBILE\t0x4E\n#define INTEL_FAM6_SKYLAKE_DESKTOP\t0x5E\n#define INTEL_FAM6_SKYLAKE_X\t\t0x55\n#define INTEL_FAM6_KABYLAKE_MOBILE\t0x8E\n#define INTEL_FAM6_KABYLAKE_DESKTOP\t0x9E\n\n#define INTEL_FAM6_CANNONLAKE_CORE\t0x66\n\n/* \"Small Core\" Processors (Atom) */\n\n#define INTEL_FAM6_ATOM_PINEVIEW\t0x1C\n#define INTEL_FAM6_ATOM_LINCROFT\t0x26\n#define INTEL_FAM6_ATOM_PENWELL\t\t0x27\n#define INTEL_FAM6_ATOM_CLOVERVIEW\t0x35\n#define INTEL_FAM6_ATOM_CEDARVIEW\t0x36\n#define INTEL_FAM6_ATOM_SILVERMONT1\t0x37 /* BayTrail/BYT / Valleyview */\n#define INTEL_FAM6_ATOM_SILVERMONT2\t0x4D /* Avaton/Rangely */\n#define INTEL_FAM6_ATOM_AIRMONT\t\t0x4C /* CherryTrail / Braswell */\n#define INTEL_FAM6_ATOM_MERRIFIELD\t0x4A /* Tangier */\n#define INTEL_FAM6_ATOM_MOOREFIELD\t0x5A /* Anniedale */\n#define INTEL_FAM6_ATOM_GOLDMONT\t0x5C\n#define INTEL_FAM6_ATOM_GEMINI_LAKE\t0x7A\n#define INTEL_FAM6_ATOM_DENVERTON\t0x5F /* Goldmont Microserver */\n\n/* Xeon Phi */\n\n#define INTEL_FAM6_XEON_PHI_KNL\t\t0x57 /* Knights Landing */\n#define INTEL_FAM6_XEON_PHI_KNM\t\t0x85 /* Knights Mill */\n\n#endif /* _ASM_X86_INTEL_FAMILY_H */\n"
  },
  {
    "path": "AppleIntelInfo.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t9001A73619A79C310049DB99 /* intel_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001A73519A79C310049DB99 /* intel_reg.h */; };\n\t\t9001A73819A79C390049DB99 /* intel_chipset.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001A73719A79C390049DB99 /* intel_chipset.h */; };\n\t\t90BE8FCF19A20F4A00E9E8B5 /* AppleIntelInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 90BE8FCE19A20F4A00E9E8B5 /* AppleIntelInfo.cpp */; };\n\t\t90BE8FD319A20FD200E9E8B5 /* AppleIntelInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 90BE8FD219A20FD200E9E8B5 /* AppleIntelInfo.h */; };\n\t\t90BE8FD519A2104A00E9E8B5 /* essentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 90BE8FD419A2104A00E9E8B5 /* essentials.h */; };\n\t\t90F0224E1EF918BF0095F865 /* intel_family.h in Headers */ = {isa = PBXBuildFile; fileRef = 90F0224D1EF918BF0095F865 /* intel_family.h */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXFileReference section */\n\t\t9001A73519A79C310049DB99 /* intel_reg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intel_reg.h; path = AppleIntelRegisterDumper/intel_reg.h; sourceTree = \"<group>\"; };\n\t\t9001A73719A79C390049DB99 /* intel_chipset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intel_chipset.h; path = AppleIntelRegisterDumper/intel_chipset.h; sourceTree = \"<group>\"; };\n\t\t90BE8FBB19A20EDF00E9E8B5 /* AppleIntelInfo.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppleIntelInfo.kext; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t90BE8FBF19A20EDF00E9E8B5 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = System/Library/Frameworks/Kernel.framework; sourceTree = SDKROOT; };\n\t\t90BE8FC819A20EDF00E9E8B5 /* AppleIntelInfo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = \"AppleIntelInfo-Prefix.pch\"; sourceTree = \"<group>\"; };\n\t\t90BE8FCE19A20F4A00E9E8B5 /* AppleIntelInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppleIntelInfo.cpp; sourceTree = \"<group>\"; };\n\t\t90BE8FD219A20FD200E9E8B5 /* AppleIntelInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppleIntelInfo.h; sourceTree = \"<group>\"; };\n\t\t90BE8FD419A2104A00E9E8B5 /* essentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = essentials.h; sourceTree = \"<group>\"; };\n\t\t90EACB9219A6B7F800512CC9 /* AppleIntelRegisterDumper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppleIntelRegisterDumper.h; path = AppleIntelRegisterDumper/AppleIntelRegisterDumper.h; sourceTree = \"<group>\"; };\n\t\t90F0224D1EF918BF0095F865 /* intel_family.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intel_family.h; sourceTree = \"<group>\"; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t90BE8FB619A20EDF00E9E8B5 /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t90BE8FB019A20EDF00E9E8B5 = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90BE8FC019A20EDF00E9E8B5 /* AppleIntelInfo */,\n\t\t\t\t90EACB8D19A6B71000512CC9 /* AppleIntelRegisterDumper */,\n\t\t\t\t90BE8FBD19A20EDF00E9E8B5 /* Frameworks */,\n\t\t\t\t90BE8FBC19A20EDF00E9E8B5 /* Products */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90BE8FBC19A20EDF00E9E8B5 /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90BE8FBB19A20EDF00E9E8B5 /* AppleIntelInfo.kext */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90BE8FBD19A20EDF00E9E8B5 /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90BE8FBE19A20EDF00E9E8B5 /* Other Frameworks */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90BE8FBE19A20EDF00E9E8B5 /* Other Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90BE8FBF19A20EDF00E9E8B5 /* Kernel.framework */,\n\t\t\t);\n\t\t\tname = \"Other Frameworks\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90BE8FC019A20EDF00E9E8B5 /* AppleIntelInfo */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90BE8FD019A20FA400E9E8B5 /* Header Files */,\n\t\t\t\t90BE8FD119A20FBD00E9E8B5 /* Source files */,\n\t\t\t\t90BE8FC119A20EDF00E9E8B5 /* Supporting Files */,\n\t\t\t);\n\t\t\tpath = AppleIntelInfo;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90BE8FC119A20EDF00E9E8B5 /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90BE8FC819A20EDF00E9E8B5 /* AppleIntelInfo-Prefix.pch */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90BE8FD019A20FA400E9E8B5 /* Header Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90F0224D1EF918BF0095F865 /* intel_family.h */,\n\t\t\t\t90BE8FD219A20FD200E9E8B5 /* AppleIntelInfo.h */,\n\t\t\t\t90BE8FD419A2104A00E9E8B5 /* essentials.h */,\n\t\t\t);\n\t\t\tname = \"Header Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90BE8FD119A20FBD00E9E8B5 /* Source files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90BE8FCE19A20F4A00E9E8B5 /* AppleIntelInfo.cpp */,\n\t\t\t);\n\t\t\tname = \"Source files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90EACB8D19A6B71000512CC9 /* AppleIntelRegisterDumper */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90EACB8E19A6B75600512CC9 /* Header Files */,\n\t\t\t);\n\t\t\tname = AppleIntelRegisterDumper;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t90EACB8E19A6B75600512CC9 /* Header Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t90EACB9219A6B7F800512CC9 /* AppleIntelRegisterDumper.h */,\n\t\t\t\t9001A73519A79C310049DB99 /* intel_reg.h */,\n\t\t\t\t9001A73719A79C390049DB99 /* intel_chipset.h */,\n\t\t\t);\n\t\t\tname = \"Header Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXHeadersBuildPhase section */\n\t\t90BE8FB719A20EDF00E9E8B5 /* Headers */ = {\n\t\t\tisa = PBXHeadersBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t9001A73819A79C390049DB99 /* intel_chipset.h in Headers */,\n\t\t\t\t90BE8FD319A20FD200E9E8B5 /* AppleIntelInfo.h in Headers */,\n\t\t\t\t9001A73619A79C310049DB99 /* intel_reg.h in Headers */,\n\t\t\t\t90F0224E1EF918BF0095F865 /* intel_family.h in Headers */,\n\t\t\t\t90BE8FD519A2104A00E9E8B5 /* essentials.h in Headers */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXHeadersBuildPhase section */\n\n/* Begin PBXNativeTarget section */\n\t\t90BE8FBA19A20EDF00E9E8B5 /* AppleIntelInfo */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 90BE8FCB19A20EDF00E9E8B5 /* Build configuration list for PBXNativeTarget \"AppleIntelInfo\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t90BE8FB519A20EDF00E9E8B5 /* Sources */,\n\t\t\t\t90BE8FB619A20EDF00E9E8B5 /* Frameworks */,\n\t\t\t\t90BE8FB719A20EDF00E9E8B5 /* Headers */,\n\t\t\t\t90BE8FB819A20EDF00E9E8B5 /* Resources */,\n\t\t\t\t90BE8FB919A20EDF00E9E8B5 /* Rez */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = AppleIntelInfo;\n\t\t\tproductName = AppleIntelInfo;\n\t\t\tproductReference = 90BE8FBB19A20EDF00E9E8B5 /* AppleIntelInfo.kext */;\n\t\t\tproductType = \"com.apple.product-type.kernel-extension\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t90BE8FB119A20EDF00E9E8B5 /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 0800;\n\t\t\t\tORGANIZATIONNAME = wordpress.pikeralpha.com;\n\t\t\t};\n\t\t\tbuildConfigurationList = 90BE8FB419A20EDF00E9E8B5 /* Build configuration list for PBXProject \"AppleIntelInfo\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t);\n\t\t\tmainGroup = 90BE8FB019A20EDF00E9E8B5;\n\t\t\tproductRefGroup = 90BE8FBC19A20EDF00E9E8B5 /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t90BE8FBA19A20EDF00E9E8B5 /* AppleIntelInfo */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t90BE8FB819A20EDF00E9E8B5 /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXRezBuildPhase section */\n\t\t90BE8FB919A20EDF00E9E8B5 /* Rez */ = {\n\t\t\tisa = PBXRezBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXRezBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t90BE8FB519A20EDF00E9E8B5 /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t90BE8FCF19A20F4A00E9E8B5 /* AppleIntelInfo.cpp in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin XCBuildConfiguration section */\n\t\t90BE8FC919A20EDF00E9E8B5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_SYMBOLS_PRIVATE_EXTERN = NO;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.11;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVALID_ARCHS = x86_64;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t90BE8FCA19A20EDF00E9E8B5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\tCOPY_PHASE_STRIP = YES;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_ENABLE_OBJC_EXCEPTIONS = YES;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.11;\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVALID_ARCHS = x86_64;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t90BE8FCC19A20EDF00E9E8B5 /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"AppleIntelInfo/AppleIntelInfo-Prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"AppleIntelInfo/AppleIntelInfo-Info.plist\";\n\t\t\t\tMODULE_NAME = com.pikeralpha.driver.AppleIntelInfo;\n\t\t\t\tMODULE_START = 0;\n\t\t\t\tMODULE_STOP = 0;\n\t\t\t\tMODULE_VERSION = 1.0.0d1;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.pikeralpha.driver.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVALID_ARCHS = x86_64;\n\t\t\t\tWRAPPER_EXTENSION = kext;\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t90BE8FCD19A20EDF00E9E8B5 /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbuildSettings = {\n\t\t\t\tCODE_SIGN_IDENTITY = \"\";\n\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;\n\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n\t\t\t\tGCC_PREFIX_HEADER = \"AppleIntelInfo/AppleIntelInfo-Prefix.pch\";\n\t\t\t\tINFOPLIST_FILE = \"AppleIntelInfo/AppleIntelInfo-Info.plist\";\n\t\t\t\tMODULE_NAME = com.pikeralpha.driver.AppleIntelInfo;\n\t\t\t\tMODULE_START = 0;\n\t\t\t\tMODULE_STOP = 0;\n\t\t\t\tMODULE_VERSION = 1.0.0d1;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = \"com.pikeralpha.driver.${PRODUCT_NAME:rfc1034identifier}\";\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tSDKROOT = macosx;\n\t\t\t\tVALID_ARCHS = x86_64;\n\t\t\t\tWRAPPER_EXTENSION = kext;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t90BE8FB419A20EDF00E9E8B5 /* Build configuration list for PBXProject \"AppleIntelInfo\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t90BE8FC919A20EDF00E9E8B5 /* Debug */,\n\t\t\t\t90BE8FCA19A20EDF00E9E8B5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t90BE8FCB19A20EDF00E9E8B5 /* Build configuration list for PBXNativeTarget \"AppleIntelInfo\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t90BE8FCC19A20EDF00E9E8B5 /* Debug */,\n\t\t\t\t90BE8FCD19A20EDF00E9E8B5 /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 90BE8FB119A20EDF00E9E8B5 /* Project object */;\n}\n"
  },
  {
    "path": "AppleIntelRegisterDumper/AppleIntelRegisterDumper.h",
    "content": "\n/*\n * Copyright © 2006,2009 Intel Corporation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice (including the next\n * paragraph) shall be included in all copies or substantial portions of the\n * Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * Authors:\n *\n *    Eric Anholt <eric@anholt.net>\n *    Pike R. Alpha <pikeralpha@yahoo.com> (OS X port)\n *\n */\n\n#include \"intel_reg.h\"\n#include \"intel_chipset.h\"\n\n#define DEBUGSTRING(func) void func(char *result, int len, UInt32 reg, UInt32 val)\n\n#define DEFINEREG(reg) { reg, #reg, NULL, 0 }\n#define DEFINEREG_16BIT(reg) { reg, #reg, i830_16bit_func, 0 }\n#define DEFINEREG2(reg, func) { reg, #reg, func, 0 }\n\n#define DEFINE_FUNC_DUMP(func) void func(struct reg_debug *regs, uint32_t count)\n#define DEFINE_FUNC_VOID(func) void func(void)\n\n#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))\n#define intel_dump_regs(regs) dumpRegisters(regs, ARRAY_SIZE(regs))\n\nstatic uint32_t devid = 0;\n\nUInt64 gMMIOAddress\t= 0;\n\nstruct reg_debug\n{\n\tUInt32 reg;\n\tconst char *name;\n\tvoid (*debug_output) (char *result, int len, UInt32 reg, UInt32 val);\n\tUInt32 val;\n};\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_pipe_ddi_func_ctl)\n{\n\tconst char *enable, *port, *mode, *bpc, *vsync, *hsync, *edp_input;\n\tconst char *width;\n\n\tenable = (val & (1<<31)) ? \"enabled\" : \"disabled\";\n\t\n\tswitch ((val >> 28) & 7)\n\t{\n\t\tcase 0:\n\t\t\tport = \"no port\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tport = \"DDIB\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tport = \"DDIC\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tport = \"DDID\";\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tport = \"DDIE\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tport = \"port reserved\";\n\t\t\tbreak;\n\t}\n\n\tswitch ((val >> 24) & 7)\n\t{\n\t\tcase 0:\n\t\t\tmode = \"HDMI\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tmode = \"DVI\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tmode = \"DP SST\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tmode = \"DP MST\";\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tmode = \"FDI\";\n\t\t\tbreak;\n\t\tcase 5:\n\t\tdefault:\n\t\t\tmode = \"mode reserved\";\n\t\t\tbreak;\n\t}\n\n\tswitch ((val >> 20) & 7)\n\t{\n\t\tcase 0:\n\t\t\tbpc = \"8 bpc\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tbpc = \"10 bpc\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tbpc = \"6 bpc\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tbpc = \"12 bpc\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbpc = \"bpc reserved\";\n\t\t\tbreak;\n\t}\n\n\thsync = (val & (1<<16)) ? \"+HSync\" : \"-HSync\";\n\tvsync = (val & (1<<17)) ? \"+VSync\" : \"-VSync\";\n\n\tswitch ((val >> 12) & 7)\n\t{\n\t\tcase 0:\n\t\t\tedp_input = \"EDP A ON\";\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tedp_input = \"EDP A ONOFF\";\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tedp_input = \"EDP B ONOFF\";\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tedp_input = \"EDP C ONOFF\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tedp_input = \"EDP input reserved\";\n\t\t\tbreak;\n\t}\n\n\tswitch ((val >> 1) & 7)\n\t{\n\t\tcase 0:\n\t\t\twidth = \"x1\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\twidth = \"x2\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\twidth = \"x4\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\twidth = \"reserved width\";\n\t\t\tbreak;\n\t}\n\n\tsnprintf(result, len, \"%s, %s, %s, %s, %s, %s, %s, %s\", enable, port, mode, bpc, vsync, hsync, edp_input, width);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_ddi_buf_ctl)\n{\n\tconst char *enable, *reversal, *width, *detected;\n\n\tenable = (val & (1<<31)) ? \"enabled\" : \"disabled\";\n\treversal = (val & (1<<16)) ? \"reversed\" : \"not reversed\";\n\n\tswitch ((val >> 1) & 7)\n\t{\n\t\tcase 0:\n\t\t\twidth = \"x1\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\twidth = \"x2\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\twidth = \"x4\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\twidth = \"reserved\";\n\t\t\tbreak;\n\t}\n\n\tdetected = (val & 1) ? \"detected\" : \"not detected\";\n\n\tsnprintf(result, len, \"%s %s %s %s\", enable, reversal, width, detected);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_port_clk_sel)\n{\n\tconst char *clock = NULL;\n\n\tswitch ((val >> 29 ) & 7)\n\t{\n\t\tcase 0:\n\t\t\tclock = \"LCPLL 2700\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tclock = \"LCPLL 1350\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tclock = \"LCPLL 810\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tclock = \"SPLL\";\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tclock = \"WRPLL 1\";\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tclock = \"WRPLL 2\";\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tclock = \"Reserved\";\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tclock = \"None\";\n\t\t\tbreak;\n\t}\n\n\tsnprintf(result, len, \"%s\", clock);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_pipe_clk_sel)\n{\n\tconst char *clock;\n\n\tswitch ((val >> 29) & 7)\n\t{\n\t\tcase 0:\n\t\t\tclock = \"None\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tclock = \"DDIB\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tclock = \"DDIC\";\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tclock = \"DDID\";\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tclock = \"DDIE\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tclock = \"Reserved\";\n\t\t\tbreak;\n\t}\n\n\tsnprintf(result, len, \"%s\", clock);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_sfuse_strap)\n{\n\tconst char *display, *crt, *lane_reversal, *portb, *portc, *portd;\n\n\tdisplay = (val & (1<<7)) ? \"disabled\" : \"enabled\";\n\tcrt = (val & (1<<6)) ? \"yes\" : \"no\";\n\tlane_reversal = (val & (1<<4)) ? \"yes\" : \"no\";\n\tportb = (val & (1<<2)) ? \"yes\" : \"no\";\n\tportc = (val & (1<<1)) ? \"yes\" : \"no\";\n\tportd = (val & (1<<0)) ? \"yes\" : \"no\";\n\n\tsnprintf(result, len, \"display %s, crt %s, lane reversal %s, \"\n\t\t\t \"port b %s, port c %s, port d %s\", display, crt, lane_reversal,\n\t\t\t portb, portc, portd);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_yxminus1)\n{\n\tsnprintf(result, len, \"%d, %d\", ((val & 0xffff0000) >> 16) + 1, (val & 0xffff) + 1);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_dspcntr)\n{\n\tconst char *enabled = val & DISPLAY_PLANE_ENABLE ? \"enabled\" : \"disabled\";\n\tchar plane = val & DISPPLANE_SEL_PIPE_B ? 'B' : 'A';\n\n\tif (HAS_PCH_SPLIT(devid) || IS_BROXTON(devid))\n\t{\n\t\tsnprintf(result, len, \"%s\", enabled);\n\t}\n\telse\n\t{\n\t\tsnprintf(result, len, \"%s, pipe %c\", enabled, plane);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_dspstride)\n{\n\tsnprintf(result, len, \"%d\", val >> 6);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_xyminus1)\n{\n\tsnprintf(result, len, \"%d, %d\", (val & 0xffff) + 1, ((val & 0xffff0000) >> 16) + 1);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_xy)\n{\n\tsnprintf(result, len, \"%d, %d\", (val & 0xffff), ((val & 0xffff0000) >> 16));\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_pipeconf)\n{\n\tconst char *enabled = val & PIPEACONF_ENABLE ? \"enabled\" : \"disabled\";\n\tconst char *bit30 = NULL;\n\tconst char *interlace = NULL;\n    int interlace_mode;\n\tchar buf[256];\n\tint buf_len;\n\n\tif (IS_965(devid))\n\t{\n\t\tbit30 = val & I965_PIPECONF_ACTIVE ? \"active\" : \"inactive\";\n\t}\n\telse\n\t{\n\t\tbit30 = val & PIPEACONF_DOUBLE_WIDE ? \"double-wide\" : \"single-wide\";\n\t}\n\n\tif (HAS_PCH_SPLIT(devid) || IS_BROXTON(devid))\n\t{\n\t\t\n        \n        if (IS_IVYBRIDGE(devid) || IS_HASWELL(devid) || IS_BROADWELL(devid) || IS_GEN9(devid))\n        {\n            interlace_mode = (val >> 21) & 3;\n        }\n        else\n        {\n            interlace_mode = (val >> 21) & 7;\n        }\n\n\t\tbuf_len = snprintf(buf, sizeof(buf), \"%s, %s\", enabled, bit30);\n\n\t\tswitch (interlace_mode)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\tinterlace = \"pf-pd\";\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tinterlace = \"pf-id\";\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tinterlace = \"if-id\";\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tinterlace = \"if-id-dbl\";\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tinterlace = \"pf-id-dbl\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tinterlace = \"rsvd\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (buf_len < sizeof(buf))\n\t\t{\n\t\t\tbuf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, \", %s\", interlace);\n\t\t}\n\t\t\n\t}\n\telse if (IS_GEN4(devid) || IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))\n\t{\n\t\tswitch ((val >> 21) & 7)\n\t\t{\n\t\t\tcase 0:\n\t\t\tcase 1:\n\t\t\tcase 2:\n\t\t\tcase 3:\n\t\t\t\tinterlace = \"progressive\";\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\tinterlace = \"interlaced embedded\";\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\tinterlace = \"interlaced\";\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tinterlace = \"interlaced sdvo\";\n\t\t\t\tbreak;\n\t\t\tcase 7:\n\t\t\t\tinterlace = \"interlaced legacy\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (buf_len < sizeof(buf))\n\t\t{\n\t\t\tbuf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, \", %s\", interlace);\n\t\t}\n\t}\n\t\n\tif (IS_HASWELL(devid) || IS_IVYBRIDGE(devid) || IS_GEN6(devid) || IS_GEN5(devid))\n\t{\n\t\tconst char *rotation = NULL;\n\n\t\tswitch ((val >> 14) & 3)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\trotation = \"rotate 0\";\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\trotation = \"rotate 90\";\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\trotation = \"rotate 180\";\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\trotation = \"rotate 270\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (buf_len < sizeof(buf))\n\t\t{\n\t\t\tbuf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, \", %s\", rotation);\n\t\t}\n\t}\n\n\tif (IS_IVYBRIDGE(devid) || IS_GEN6(devid) || IS_GEN5(devid))\n\t{\n\t\tconst char *bpc = NULL;\n\n\t\tswitch (val & (7 << 5))\n\t\t{\n\t\t\tcase PIPECONF_8BPP:\n\t\t\t\tbpc = \"8bpc\";\n\t\t\t\tbreak;\n\t\t\tcase PIPECONF_10BPP:\n\t\t\t\tbpc = \"10bpc\";\n\t\t\t\tbreak;\n\t\t\tcase PIPECONF_6BPP:\n\t\t\t\tbpc = \"6bpc\";\n\t\t\t\tbreak;\n\t\t\tcase PIPECONF_12BPP:\n\t\t\t\tbpc = \"12bpc\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbpc = \"invalid bpc\";\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tif (buf_len < sizeof(buf))\n\t\t{\n\t\t\tbuf_len += snprintf(&buf[buf_len], sizeof(buf) - buf_len, \", %s\", bpc);\n\t\t}\n\t}\n\n\tsnprintf(result, len, \"%s\", buf);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_hvtotal)\n{\n\tsnprintf(result, len, \"%d active, %d total\", (val & 0xffff) + 1, ((val & 0xffff0000) >> 16) + 1);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_hvsyncblank)\n{\n\tsnprintf(result, len, \"%d start, %d end\", (val & 0xffff) + 1, ((val & 0xffff0000) >> 16) + 1);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_m_tu)\n{\n\tsnprintf(result, len, \"TU %d, val 0x%x %d\", (val >> 25) + 1, val & 0xffffff, val & 0xffffff);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_n)\n{\n\tsnprintf(result, len, \"val 0x%x %d\", val & 0xffffff, val & 0xffffff);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_panel_fitting)\n{\n\tconst char *vadapt = NULL;\n\tconst char *filter_sel = NULL;\n\n\tswitch (val & (3 << 25))\n\t{\n\t\tcase 0:\n\t\t\tvadapt = \"least\";\n\t\t\tbreak;\n\t\tcase (1 << 25):\n\t\t\tvadapt = \"moderate\";\n\t\t\tbreak;\n\t\tcase (2 << 25):\n\t\t\tvadapt = \"reserved\";\n\t\t\tbreak;\n\t\tcase (3 << 25):\n\t\t\tvadapt = \"most\";\n\t\t\tbreak;\n\t}\n\n\tswitch (val & (3 << 23))\n\t{\n\t\tcase 0:\n\t\t\tfilter_sel = \"programmed\";\n\t\t\tbreak;\n\t\tcase (1 << 23):\n\t\t\tfilter_sel = \"hardcoded\";\n\t\t\tbreak;\n\t\tcase (2 << 23):\n\t\t\tfilter_sel = \"edge_enhance\";\n\t\t\tbreak;\n\t\tcase (3 << 23):\n\t\t\tfilter_sel = \"edge_soften\";\n\t\t\tbreak;\n\t}\n\n\tsnprintf(result, len,\n\t\t\t \"%s, auto_scale %s, auto_scale_cal %s, v_filter %s, vadapt %s, mode %s, filter_sel %s,\"\n\t\t\t \"chroma pre-filter %s, vert3tap %s, v_inter_invert %s\",\n\t\t\t val & PF_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & (1 << 30) ? \"no\" : \"yes\",\n\t\t\t val & (1 << 29) ? \"yes\" : \"no\",\n\t\t\t val & (1 << 28) ? \"bypass\" : \"enable\",\n\t\t\t val & (1 << 27) ? \"enable\" : \"disable\",\n\t\t\t vadapt, filter_sel,\n\t\t\t val & (1 << 22) ? \"enable\" : \"disable\",\n\t\t\t val & (1 << 21) ? \"force\" : \"auto\",\n\t\t\t val & (1 << 20) ? \"field 0\" : \"field 1\");\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_panel_fitting_2)\n{\n\tsnprintf(result, len, \"vscale %f\", val / (float) (1<<15));\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_panel_fitting_3)\n{\n\tsnprintf(result, len, \"vscale initial phase %f\", val / (float) (1<<15));\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_panel_fitting_4)\n{\n\tsnprintf(result, len, \"hscale %f\", val / (float) (1<<15));\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_pf_win)\n{\n\tint a = (val >> 16) & 0x1fff;\n\tint b = val & 0xfff;\n\n\tsnprintf(result, len, \"%d, %d\", a, b);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_transconf)\n{\n\tconst char *enable = val & TRANS_ENABLE ? \"enable\" : \"disable\";\n\tconst char *state = val & TRANS_STATE_ENABLE ? \"active\" : \"inactive\";\n\tconst char *interlace;\n\t\n\tswitch ((val >> 21) & 7)\n\t{\n\t\tcase 0:\n\t\t\tinterlace = \"progressive\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tif (IS_GEN5(devid))\n\t\t\t{\n\t\t\t\tinterlace = \"interlaced sdvo\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tinterlace = \"rsvd\";\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tinterlace = \"interlaced\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tinterlace = \"rsvd\";\n\t}\n\n\tsnprintf(result, len, \"%s, %s, %s\", enable, state, interlace);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_fdi_rx_misc)\n{\n\tsnprintf(result, len, \"FDI Delay %d\", val & ((1 << 13) - 1));\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ilk_debug_blc_pwm_cpu_ctl2)\n{\n\tint enable, blinking, granularity;\n\tconst char *pipe = NULL;\n\n\tenable = (val >> 31) & 1;\n\n\tif (IS_GEN5(devid) || IS_GEN6(devid))\n\t{\n\t\tpipe = ((val >> 29) & 1) ? \"B\" : \"A\";\n\t}\n\telse\n\t{\n\t\tswitch ((val >> 29) & 3)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\tpipe = \"A\";\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tpipe = \"B\";\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tpipe = \"C\";\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tif (IS_IVYBRIDGE(devid))\n\t\t\t\t{\n\t\t\t\t\tpipe = \"reserved\";\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpipe = \"EDP\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid))\n\t{\n\t\tsnprintf(result, len, \"enable %d, pipe %s\", enable, pipe);\n\t}\n\telse\n\t{\n\t\tblinking = (val >> 28) & 1;\n\t\tgranularity = ((val >> 27) & 1) ? 8 : 128;\n\n\t\tsnprintf(result, len, \"enable %d, pipe %s, blinking %d, \"\n\t\t\t\t \"granularity %d\", enable, pipe, blinking, granularity);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ilk_debug_blc_pwm_cpu_ctl)\n{\n\tint cycle, freq;\n\n\tcycle = (val & 0xFFFF);\n\t\n\tif (IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid))\n\t{\n\t\tsnprintf(result, len, \"cycle %d\", cycle);\n\t}\n\telse\n\t{\n\t\tfreq = (val >> 16) & 0xFFFF;\n\n\t\tsnprintf(result, len, \"cycle %d, freq %d\", cycle, freq);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ibx_debug_blc_pwm_ctl1)\n{\n\tint enable, override, inverted_polarity;\n\n\tenable = (val >> 31) & 1;\n\toverride = (val >> 30) & 1;\n\tinverted_polarity = (val >> 29) & 1;\n\n\tsnprintf(result, len, \"enable %d, override %d, inverted polarity %d\",\n\tenable, override, inverted_polarity);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ibx_debug_blc_pwm_ctl2)\n{\n\tint freq, cycle;\n\n\tfreq = (val >> 16) & 0xFFFF;\n\tcycle = val & 0xFFFF;\n\n\tsnprintf(result, len, \"freq %d, cycle %d\", freq, cycle);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_blc_misc_ctl)\n{\n\tconst char *sel;\n\n\tsel = (val & 1) ? \"PWM1-CPU PWM2-PCH\" : \"PWM1-PCH PWM2-CPU\";\n\n\tsnprintf(result, len, \"%s\", sel);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_util_pin_ctl)\n{\n\tint enable, data, inverted_polarity;\n\tconst char *transcoder = NULL;\n\tconst char *mode = NULL;\n\n\tenable = (val >> 31) & 1;\n\n\tswitch ((val >> 29) & 3)\n\t{\n\t\tcase 0:\n\t\t\ttranscoder = \"A\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\ttranscoder = \"B\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\ttranscoder = \"C\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\ttranscoder = \"EDP\";\n\t\t\tbreak;\n\t}\n\n\tswitch ((val >> 24) & 0xF)\n\t{\n\t\tcase 0:\n\t\t\tmode = \"data\";\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tmode = \"PWM\";\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tmode = \"Vblank\";\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tmode = \"Vsync\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tmode = \"reserved\";\n\t\t\tbreak;\n\t}\n\n\tdata = (val >> 23) & 1;\n\tinverted_polarity = (val >> 22) & 1;\n\n\tsnprintf(result, len, \"enable %d, transcoder %s, mode %s, data %d \"\n\t\t\t \"inverted polarity %d\", enable, transcoder, mode, data,\n\t\t\t inverted_polarity);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_pp_status)\n{\n\tconst char *status = val & PP_ON ? \"on\" : \"off\";\n\tconst char *ready = val & PP_READY ? \"ready\" : \"not ready\";\n\tconst char *seq = \"unknown\";\n\n\tswitch (val & PP_SEQUENCE_MASK)\n\t{\n\t\tcase PP_SEQUENCE_NONE:\n\t\t\tseq = \"idle\";\n\t\t\tbreak;\n\t\tcase PP_SEQUENCE_ON:\n\t\t\tseq = \"on\";\n\t\t\tbreak;\n\t\tcase PP_SEQUENCE_OFF:\n\t\t\tseq = \"off\";\n\t\t\tbreak;\n\t}\n\n\tsnprintf(result, len, \"%s, %s, sequencing %s\", status, ready, seq);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ilk_debug_pp_control)\n{\n\tsnprintf(result, len, \"blacklight %s, %spower down on reset, panel %s\",\n\t\t\t (val & (1 << 2)) ? \"enabled\" : \"disabled\",\n\t\t\t (val & (1 << 1)) ? \"\" : \"do not \",\n\t\t\t (val & (1 << 0)) ? \"on\" : \"off\");\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(hsw_debug_sinterrupt)\n{\n\tint portd, portc, portb, crt;\n\t\n\tportd = (val >> 23) & 1;\n\tportc = (val >> 22) & 1;\n\tportb = (val >> 21) & 1;\n\tcrt = (val >> 19) & 1;\n\t\n\tsnprintf(result, len, \"port d:%d, port c:%d, port b:%d, crt:%d\", portd, portc, portb, crt);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_vgacntrl)\n{\n\tsnprintf(result, len, \"%s\", val & VGA_DISP_DISABLE ? \"disabled\" : \"enabled\");\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_rr_hw_ctl)\n{\n\tsnprintf(result, len, \"low %d, high %d\", val & RR_HW_LOW_POWER_FRAMES_MASK, (val & RR_HW_HIGH_POWER_FRAMES_MASK) >> 8);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_dref_ctl)\n{\n\tconst char *cpu_source;\n\tconst char *ssc_source = val & DREF_SSC_SOURCE_ENABLE ? \"enable\" : \"disable\";\n\tconst char *nonspread_source =\n\tval & DREF_NONSPREAD_SOURCE_ENABLE ? \"enable\" : \"disable\";\n\tconst char *superspread_source =\n\tval & DREF_SUPERSPREAD_SOURCE_ENABLE ? \"enable\" : \"disable\";\n\tconst char *ssc4_mode =\n\tval & DREF_SSC4_CENTERSPREAD ? \"centerspread\" : \"downspread\";\n\tconst char *ssc1 = val & DREF_SSC1_ENABLE ? \"enable\" : \"disable\";\n\tconst char *ssc4 = val & DREF_SSC4_ENABLE ? \"enable\" : \"disable\";\n\t\n\tswitch (val & DREF_CPU_SOURCE_OUTPUT_NONSPREAD)\n\t{\n\t\tcase DREF_CPU_SOURCE_OUTPUT_DISABLE:\n\t\t\tcpu_source = \"disable\";\n\t\t\tbreak;\n\t\tcase DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD:\n\t\t\tcpu_source = \"downspread\";\n\t\t\tbreak;\n\t\tcase DREF_CPU_SOURCE_OUTPUT_NONSPREAD:\n\t\t\tcpu_source = \"nonspread\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tcpu_source = \"reserved\";\n\t}\n\tsnprintf(result, len, \"cpu source %s, ssc_source %s, nonspread_source %s, \"\n\t\t\t \"superspread_source %s, ssc4_mode %s, ssc1 %s, ssc4 %s\",\n\t\t\t cpu_source, ssc_source, nonspread_source,\n\t\t\t superspread_source, ssc4_mode, ssc1, ssc4);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_rawclk_freq)\n{\n\tconst char *tp1 = NULL, *tp2 = NULL;\n\t\n\tswitch (val & FDL_TP1_TIMER_MASK)\n\t{\n\t\tcase 0:\n\t\t\ttp1 = \"0.5us\";\n\t\t\tbreak;\n\t\tcase (1 << 12):\n\t\t\ttp1 = \"1.0us\";\n\t\t\tbreak;\n\t\tcase (2 << 12):\n\t\t\ttp1 = \"2.0us\";\n\t\t\tbreak;\n\t\tcase (3 << 12):\n\t\t\ttp1 = \"4.0us\";\n\t\t\tbreak;\n\t}\n\n\tswitch (val & FDL_TP2_TIMER_MASK)\n\t{\n\t\tcase 0:\n\t\t\ttp2 = \"1.5us\";\n\t\t\tbreak;\n\t\tcase (1 << 10):\n\t\t\ttp2 = \"3.0us\";\n\t\t\tbreak;\n\t\tcase (2 << 10):\n\t\t\ttp2 = \"6.0us\";\n\t\t\tbreak;\n\t\tcase (3 << 10):\n\t\t\ttp2 = \"12.0us\";\n\t\t\tbreak;\n\t}\n\n\tsnprintf(result, len, \"FDL_TP1 timer %s, FDL_TP2 timer %s, freq %d\", tp1, tp2, val & RAWCLK_FREQ_MASK);\n}\n\nDEBUGSTRING(snb_debug_dpll_sel)\n{\n\tconst char *transa, *transb;\n\tconst char *dplla = NULL, *dpllb = NULL;\n\n\tif (HAS_CPT)\n\t{\n\t\tif (val & TRANSA_DPLL_ENABLE)\n\t\t{\n\t\t\ttransa = \"enable\";\n\n\t\t\tif (val & TRANSA_DPLLB_SEL)\n\t\t\t{\n\t\t\t\tdplla = \"B\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdplla = \"A\";\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttransa = \"disable\";\n\t\t}\n\n\t\tif (val & TRANSB_DPLL_ENABLE)\n\t\t{\n\t\t\ttransb = \"enable\";\n\n\t\t\tif (val & TRANSB_DPLLB_SEL)\n\t\t\t{\n\t\t\t\tdpllb = \"B\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdpllb = \"A\";\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttransb = \"disable\";\n\t\t}\n\n\t\tsnprintf(result, len, \"TransA DPLL %s (DPLL %s), TransB DPLL %s (DPLL %s)\", transa, dplla, transb, dpllb);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_pch_dpll)\n{\n\tconst char *enable = val & DPLL_VCO_ENABLE ? \"enable\" : \"disable\";\n\tconst char *highspeed = val & DPLL_DVO_HIGH_SPEED ? \"yes\" : \"no\";\n\tconst char *mode = NULL;\n\tconst char *p2 = NULL;\n\tint fpa0_p1, fpa1_p1;\n\tconst char *refclk = NULL;\n\tint sdvo_mul;\n\t\t\n\tif ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_LVDS)\n\t{\n\t\tmode = \"LVDS\";\n\n\t\tif (val & DPLLB_LVDS_P2_CLOCK_DIV_7)\n\t\t{\n\t\t\tp2 = \"Div 7\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tp2 = \"Div 14\";\n\t\t}\n\t}\n\telse if ((val & DPLLB_MODE_LVDS) == DPLLB_MODE_DAC_SERIAL)\n\t{\n\t\tmode = \"Non-LVDS\";\n\n\t\tif (val & DPLL_DAC_SERIAL_P2_CLOCK_DIV_5)\n\t\t{\n\t\t\tp2 = \"Div 5\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tp2 = \"Div 10\";\n\t\t}\n\t}\n\n\tfpa0_p1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK) >> 16);\n\tfpa1_p1 = ffs((val & DPLL_FPA1_P1_POST_DIV_MASK));\n\t\t\n\tswitch (val & PLL_REF_INPUT_MASK)\n\t{\n\t\tcase PLL_REF_INPUT_DREFCLK:\n\t\t\trefclk = \"default 120Mhz\";\n\t\t\tbreak;\n\t\tcase PLL_REF_INPUT_SUPER_SSC:\n\t\t\trefclk = \"SuperSSC 120Mhz\";\n\t\t\tbreak;\n\t\tcase PLL_REF_INPUT_TVCLKINBC:\n\t\t\trefclk = \"SDVO TVClkIn\";\n\t\t\tbreak;\n\t\tcase PLLB_REF_INPUT_SPREADSPECTRUMIN:\n\t\t\trefclk = \"SSC\";\n\t\t\tbreak;\n\t\tcase PLL_REF_INPUT_DMICLK:\n\t\t\trefclk = \"DMI RefCLK\";\n\t\t\tbreak;\n\t}\n\t\t\n\tsdvo_mul = ((val & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK) >> 9) + 1;\n\t\t\n\tsnprintf(result, len, \"%s, sdvo high speed %s, mode %s, p2 %s, \"\n\t\t\t \"FPA0 P1 %d, FPA1 P1 %d, refclk %s, sdvo/hdmi mul %d\",\n\t\t\t enable, highspeed, mode, p2, fpa0_p1, fpa1_p1, refclk, sdvo_mul);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_fp)\n{\n\tif (IS_IGD(devid))\n\t{\n\t\tsnprintf(result, len, \"n = %d, m1 = %d, m2 = %d\",\n\t\t\t\t ffs((val & FP_N_IGD_DIV_MASK) >> FP_N_DIV_SHIFT) - 1,\n\t\t\t\t ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT),\n\t\t\t\t ((val & FP_M2_IGD_DIV_MASK) >> FP_M2_DIV_SHIFT));\n\t}\n\n\tsnprintf(result, len, \"n = %d, m1 = %d, m2 = %d\",\n\t\t\t ((val & FP_N_DIV_MASK) >> FP_N_DIV_SHIFT),\n\t\t\t ((val & FP_M1_DIV_MASK) >> FP_M1_DIV_SHIFT),\n\t\t\t ((val & FP_M2_DIV_MASK) >> FP_M2_DIV_SHIFT));\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_fdi_tx_ctl)\n{\n\tconst char *train = NULL, *voltage = NULL, *pre_emphasis = NULL, *portw =\n\tNULL;\n\n\tswitch (val & FDI_LINK_TRAIN_NONE)\n\t{\n\t\tcase FDI_LINK_TRAIN_PATTERN_1:\n\t\t\ttrain = \"pattern_1\";\n\t\t\tbreak;\n\t\tcase FDI_LINK_TRAIN_PATTERN_2:\n\t\t\ttrain = \"pattern_2\";\n\t\t\tbreak;\n\t\tcase FDI_LINK_TRAIN_PATTERN_IDLE:\n\t\t\ttrain = \"pattern_idle\";\n\t\t\tbreak;\n\t\tcase FDI_LINK_TRAIN_NONE:\n\t\t\ttrain = \"not train\";\n\t\t\tbreak;\n\t}\n\n\tif (HAS_CPT)\n\t{\n\t\t/* SNB B0 */\n\t\tswitch (val & (0x3f << 22))\n\t\t{\n\t\t\tcase FDI_LINK_TRAIN_400MV_0DB_SNB_B:\n\t\t\t\tvoltage = \"0.4V\";\n\t\t\t\tpre_emphasis = \"0dB\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_400MV_6DB_SNB_B:\n\t\t\t\tvoltage = \"0.4V\";\n\t\t\t\tpre_emphasis = \"6dB\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_600MV_3_5DB_SNB_B:\n\t\t\t\tvoltage = \"0.6V\";\n\t\t\t\tpre_emphasis = \"3.5dB\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_800MV_0DB_SNB_B:\n\t\t\t\tvoltage = \"0.8V\";\n\t\t\t\tpre_emphasis = \"0dB\";\n\t\t\t\tbreak;\n\t\t}\n\t}\n\telse\n\t{\n\t\tswitch (val & (7 << 25))\n\t\t{\n\t\t\tcase FDI_LINK_TRAIN_VOLTAGE_0_4V:\n\t\t\t\tvoltage = \"0.4V\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_VOLTAGE_0_6V:\n\t\t\t\tvoltage = \"0.6V\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_VOLTAGE_0_8V:\n\t\t\t\tvoltage = \"0.8V\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_VOLTAGE_1_2V:\n\t\t\t\tvoltage = \"1.2V\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tvoltage = \"reserved\";\n\t\t}\n\t\t\n\t\tswitch (val & (7 << 22))\n\t\t{\n\t\t\tcase FDI_LINK_TRAIN_PRE_EMPHASIS_NONE:\n\t\t\t\tpre_emphasis = \"none\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X:\n\t\t\t\tpre_emphasis = \"1.5x\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_PRE_EMPHASIS_2X:\n\t\t\t\tpre_emphasis = \"2x\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_PRE_EMPHASIS_3X:\n\t\t\t\tpre_emphasis = \"3x\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tpre_emphasis = \"reserved\";\n\t\t}\n\t\t\n\t}\n\n\tswitch (val & (7 << 19))\n\t{\n\t\tcase FDI_DP_PORT_WIDTH_X1:\n\t\t\tportw = \"X1\";\n\t\t\tbreak;\n\t\tcase FDI_DP_PORT_WIDTH_X2:\n\t\t\tportw = \"X2\";\n\t\t\tbreak;\n\t\tcase FDI_DP_PORT_WIDTH_X3:\n\t\t\tportw = \"X3\";\n\t\t\tbreak;\n\t\tcase FDI_DP_PORT_WIDTH_X4:\n\t\t\tportw = \"X4\";\n\t\t\tbreak;\n\t}\n\n\tsnprintf(result, len, \"%s, train pattern %s, voltage swing %s,\"\n\t\t\t \"pre-emphasis %s, port width %s, enhanced framing %s, FDI PLL %s, scrambing %s, master mode %s\",\n\t\t\t val & FDI_TX_ENABLE ? \"enable\" : \"disable\",\n\t\t\t train, voltage, pre_emphasis, portw,\n\t\t\t val & FDI_TX_ENHANCE_FRAME_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & FDI_TX_PLL_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & (1 << 7) ? \"disable\" : \"enable\",\n\t\t\t val & (1 << 0) ? \"enable\" : \"disable\");\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_fdi_rx_ctl)\n{\n\tconst char *train = NULL, *portw = NULL, *bpc = NULL;\n\t\n\tif (HAS_CPT)\n\t{\n\t\tswitch (val & FDI_LINK_TRAIN_PATTERN_MASK_CPT)\n\t\t{\n\t\t\tcase FDI_LINK_TRAIN_PATTERN_1_CPT:\n\t\t\t\ttrain = \"pattern_1\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_PATTERN_2_CPT:\n\t\t\t\ttrain = \"pattern_2\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_PATTERN_IDLE_CPT:\n\t\t\t\ttrain = \"pattern_idle\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_NORMAL_CPT:\n\t\t\t\ttrain = \"not train\";\n\t\t\t\tbreak;\n\t\t}\n\t}\n\telse\n\t{\n\t\tswitch (val & FDI_LINK_TRAIN_NONE)\n\t\t{\n\t\t\tcase FDI_LINK_TRAIN_PATTERN_1:\n\t\t\t\ttrain = \"pattern_1\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_PATTERN_2:\n\t\t\t\ttrain = \"pattern_2\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_PATTERN_IDLE:\n\t\t\t\ttrain = \"pattern_idle\";\n\t\t\t\tbreak;\n\t\t\tcase FDI_LINK_TRAIN_NONE:\n\t\t\t\ttrain = \"not train\";\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tswitch (val & (7 << 19))\n\t{\n\t\tcase FDI_DP_PORT_WIDTH_X1:\n\t\t\tportw = \"X1\";\n\t\t\tbreak;\n\t\tcase FDI_DP_PORT_WIDTH_X2:\n\t\t\tportw = \"X2\";\n\t\t\tbreak;\n\t\tcase FDI_DP_PORT_WIDTH_X3:\n\t\t\tportw = \"X3\";\n\t\t\tbreak;\n\t\tcase FDI_DP_PORT_WIDTH_X4:\n\t\t\tportw = \"X4\";\n\t\t\tbreak;\n\t}\n\t\n\tswitch (val & (7 << 16))\n\t{\n\t\tcase FDI_8BPC:\n\t\t\tbpc = \"8bpc\";\n\t\t\tbreak;\n\t\tcase FDI_10BPC:\n\t\t\tbpc = \"10bpc\";\n\t\t\tbreak;\n\t\tcase FDI_6BPC:\n\t\t\tbpc = \"6bpc\";\n\t\t\tbreak;\n\t\tcase FDI_12BPC:\n\t\t\tbpc = \"12bpc\";\n\t\t\tbreak;\n\t}\n\t\n\tsnprintf(result, len, \"%s, train pattern %s, port width %s, %s,\"\n\t\t\t \"link_reverse_strap_overwrite %s, dmi_link_reverse %s, FDI PLL %s,\"\n\t\t\t \"FS ecc %s, FE ecc %s, FS err report %s, FE err report %s,\"\n\t\t\t \"scrambing %s, enhanced framing %s, %s\",\n\t\t\t val & FDI_RX_ENABLE ? \"enable\" : \"disable\",\n\t\t\t train, portw, bpc,\n\t\t\t val & FDI_LINK_REVERSE_OVERWRITE ? \"yes\" : \"no\",\n\t\t\t val & FDI_DMI_LINK_REVERSE_MASK ? \"yes\" : \"no\",\n\t\t\t val & FDI_RX_PLL_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & FDI_FS_ERR_CORRECT_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & FDI_FE_ERR_CORRECT_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & FDI_FS_ERR_REPORT_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & FDI_FE_ERR_REPORT_ENABLE ? \"enable\" : \"disable\",\n\t\t\t val & (1 << 7) ? \"disable\" : \"enable\",\n\t\t\t val & FDI_RX_ENHANCE_FRAME_ENABLE ? \"enable\" :\n\t\t\t \"disable\", val & FDI_SEL_PCDCLK ? \"PCDClk\" : \"RawClk\");\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_adpa)\n{\n\tchar disp_pipe = (val & ADPA_PIPE_B_SELECT) ? 'B' : 'A';\n\tconst char *enable = (val & ADPA_DAC_ENABLE) ? \"enabled\" : \"disabled\";\n\tchar hsync = (val & ADPA_HSYNC_ACTIVE_HIGH) ? '+' : '-';\n\tchar vsync = (val & ADPA_VSYNC_ACTIVE_HIGH) ? '+' : '-';\n\n\tif (HAS_CPT)\n\t{\n\t\tdisp_pipe = val & (1<<29) ? 'B' : 'A';\n\t}\n\t\n\tif (HAS_PCH_SPLIT(devid))\n\t{\n\t\tsnprintf(result, len, \"%s, transcoder %c, %chsync, %cvsync\", enable, disp_pipe, hsync, vsync);\n\t}\n\telse\n\t{\n\t\tsnprintf(result, len, \"%s, pipe %c, %chsync, %cvsync\", enable, disp_pipe, hsync, vsync);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ironlake_debug_hdmi)\n{\n\tint disp_pipe;\n\tconst char *enable, *bpc = NULL, *encoding;\n\tconst char *mode, *audio, *vsync, *hsync, *detect;\n\t\n\tif (val & PORT_ENABLE)\n\t{\n\t\tenable = \"enabled\";\n\t}\n\telse\n\t{\n\t\tenable = \"disabled\";\n\t}\n\t\n\tif (HAS_CPT)\n\t{\n\t\tdisp_pipe = (val & (3<<29)) >> 29;\n\t}\n\telse\n\t{\n\t\tdisp_pipe = (val & TRANSCODER_B) >> 29;\n\t}\n\n\tswitch (val & (7 << 26))\n\t{\n\t\tcase COLOR_FORMAT_8bpc:\n\t\t\tbpc = \"8bpc\";\n\t\t\tbreak;\n\t\tcase COLOR_FORMAT_12bpc:\n\t\t\tbpc = \"12bpc\";\n\t\t\tbreak;\n\t}\n\n\tif ((val & (3 << 10)) == TMDS_ENCODING)\n\t{\n\t\tencoding = \"TMDS\";\n\t}\n\telse\n\t{\n\t\tencoding = \"SDVO\";\n\t}\n\n\tif (val & (1 << 9))\n\t{\n\t\tmode = \"HDMI\";\n\t}\n\telse\n\t{\n\t\tmode = \"DVI\";\n\t}\n\n\tif (val & AUDIO_ENABLE)\n\t{\n\t\taudio = \"enabled\";\n\t}\n\telse\n\t{\n\t\taudio = \"disabled\";\n\t}\n\n\tif (val & VSYNC_ACTIVE_HIGH)\n\t{\n\t\tvsync = \"+vsync\";\n\t}\n\telse\n\t{\n\t\tvsync = \"-vsync\";\n\t}\n\n\tif (val & HSYNC_ACTIVE_HIGH)\n\t{\n\t\thsync = \"+hsync\";\n\t}\n\telse\n\t{\n\t\thsync = \"-hsync\";\n\t}\n\t\n\tif (val & PORT_DETECTED)\n\t{\n\t\tdetect = \"detected\";\n\t}\n\telse\n\t{\n\t\tdetect = \"non-detected\";\n\t}\n\t\n\tsnprintf(result, len, \"%s pipe %c %s %s %s audio %s %s %s %s\", enable, disp_pipe + 'A', bpc, encoding, mode, audio, vsync, hsync, detect);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_lvds)\n{\n\tchar disp_pipe = val & LVDS_PIPEB_SELECT ? 'B' : 'A';\n\tconst char *enable = val & LVDS_PORT_EN ? \"enabled\" : \"disabled\";\n\tint depth;\n\tconst char *channels;\n\t\n\tif ((val & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP)\n\t{\n\t\tdepth = 24;\n\t}\n\telse\n\t{\n\t\tdepth = 18;\n\t}\n\n\tif ((val & LVDS_B0B3_POWER_MASK) == LVDS_B0B3_POWER_UP)\n\t{\n\t\tchannels = \"2 channels\";\n\t}\n\telse\n\t{\n\t\tchannels = \"1 channel\";\n\t}\n\t\n\tif (HAS_CPT)\n\t{\n\t\tdisp_pipe = val & (1<<29) ? 'B' : 'A';\n\t}\n\n\tsnprintf(result, len, \"%s, pipe %c, %d bit, %s\", enable, disp_pipe, depth, channels);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(snb_debug_trans_dp_ctl)\n{\n\tconst char *enable, *port = NULL, *bpc = NULL, *vsync, *hsync;\n\t\n\tif (HAS_CPT)\n\t{\n\t\tif (val & TRANS_DP_OUTPUT_ENABLE)\n\t\t{\n\t\t\tenable = \"enable\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tenable = \"disable\";\n\t\t}\n\t\n\t\tswitch (val & TRANS_DP_PORT_SEL_MASK)\n\t\t{\n\t\t\tcase TRANS_DP_PORT_SEL_B:\n\t\t\t\tport = \"B\";\n\t\t\t\tbreak;\n\t\t\tcase TRANS_DP_PORT_SEL_C:\n\t\t\t\tport = \"C\";\n\t\t\t\tbreak;\n\t\t\tcase TRANS_DP_PORT_SEL_D:\n\t\t\t\tport = \"D\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tport = \"none\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\tswitch (val & (7<<9))\n\t\t{\n\t\t\tcase TRANS_DP_8BPC:\n\t\t\t\tbpc = \"8bpc\";\n\t\t\t\tbreak;\n\t\t\tcase TRANS_DP_10BPC:\n\t\t\t\tbpc = \"10bpc\";\n\t\t\t\tbreak;\n\t\t\tcase TRANS_DP_6BPC:\n\t\t\t\tbpc = \"6bpc\";\n\t\t\t\tbreak;\n\t\t\tcase TRANS_DP_12BPC:\n\t\t\t\tbpc = \"12bpc\";\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (val & TRANS_DP_VSYNC_ACTIVE_HIGH)\n\t\t{\n\t\t\tvsync = \"+vsync\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvsync = \"-vsync\";\n\t\t}\n\n\t\tif (val & TRANS_DP_HSYNC_ACTIVE_HIGH)\n\t\t{\n\t\t\thsync = \"+hsync\";\n\t\t}\n\t\telse\n\t\t{\n\t\t\thsync = \"-hsync\";\n\t\t}\n\n\t\tsnprintf(result, len, \"%s port %s %s %s %s\", enable, port, bpc, vsync, hsync);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(ivb_debug_port)\n{\n\tconst char *drrs = NULL;\n\n\tswitch (val & (2 << 30))\n\t{\n\t\tcase PORT_DBG_DRRS_HW_STATE_OFF:\n\t\t\tdrrs = \"off\";\n\t\t\tbreak;\n\t\tcase PORT_DBG_DRRS_HW_STATE_LOW:\n\t\t\tdrrs = \"low\";\n\t\t\tbreak;\n\t\t/* case PORT_DBG_DRRS_HW_STATE_HIGH:\n\t\t\tdrrs = \"high\";\n\t\t\tbreak; */\n\t}\n\n\tsnprintf(result, len, \"HW DRRS %s\", drrs);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_16bit_func)\n{\n\tsnprintf(result, len, \"0x%04x\", (uint16_t) val);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_dcc)\n{\n\tconst char *addressing = NULL;\n\t\n\tif (IS_MOBILE(devid))\n\t{\n\t\tif (IS_965(devid))\n\t\t{\n\t\t\tif (val & (1 << 1))\n\t\t\t{\n\t\t\t\taddressing = \"dual channel interleaved\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\taddressing = \"single or dual channel asymmetric\";\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tswitch (val & 3)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\taddressing = \"single channel\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\taddressing = \"dual channel asymmetric\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\taddressing = \"dual channel interleaved\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\taddressing = \"unknown channel layout\";\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\n\t\tsnprintf(result, len, \"%s, XOR randomization: %sabled, XOR bit: %d\",\n\t\t\t\t addressing, (val & (1 << 10)) ? \"dis\" : \"en\", (val & (1 << 9)) ? 17 : 11);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_chdecmisc)\n{\n\tconst char *enhmodesel = NULL;\n\t\n\tswitch ((val >> 5) & 3)\n\t{\n\t\tcase 1:\n\t\t\tenhmodesel = \"XOR bank/rank\";\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tenhmodesel = \"swap bank\";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tenhmodesel = \"XOR bank\";\n\t\t\tbreak;\n\t\tcase 0:\n\t\t\tenhmodesel = \"none\";\n\t\t\tbreak;\n\t}\n\t\n\tsnprintf(result, len,\n\t\t\t \"%s, ch2 enh %sabled, ch1 enh %sabled, \"\n\t\t\t \"ch0 enh %sabled, \"\n\t\t\t \"flex %sabled, ep %spresent\", enhmodesel,\n\t\t\t (val & (1 << 4)) ? \"en\" : \"dis\",\n\t\t\t (val & (1 << 3)) ? \"en\" : \"dis\",\n\t\t\t (val & (1 << 2)) ? \"en\" : \"dis\",\n\t\t\t (val & (1 << 1)) ? \"en\" : \"dis\",\n\t\t\t (val & (1 << 0)) ? \"\" : \"not \");\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_vga_pd)\n{\n\tint vga0_p1, vga0_p2, vga1_p1, vga1_p2;\n\t\n\t/* XXX: i9xx version */\n\t\n\tif (val & VGA0_PD_P1_DIV_2)\n\t{\n\t\tvga0_p1 = 2;\n\t}\n\telse\n\t{\n\t\tvga0_p1 = ((val & VGA0_PD_P1_MASK) >> VGA0_PD_P1_SHIFT) + 2;\n\t}\n\n\tvga0_p2 = (val & VGA0_PD_P2_DIV_4) ? 4 : 2;\n\t\n\tif (val & VGA1_PD_P1_DIV_2)\n\t{\n\t\tvga1_p1 = 2;\n\t}\n\telse\n\t{\n\t\tvga1_p1 = ((val & VGA1_PD_P1_MASK) >> VGA1_PD_P1_SHIFT) + 2;\n\t}\n\n\tvga1_p2 = (val & VGA1_PD_P2_DIV_4) ? 4 : 2;\n\t\n\tsnprintf(result, len, \"vga0 p1 = %d, p2 = %d, vga1 p1 = %d, p2 = %d\", vga0_p1, vga0_p2, vga1_p1, vga1_p2);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_dpll_test)\n{\n\tconst char *dpllandiv = val & DPLLA_TEST_N_BYPASS ? \", DPLLA N bypassed\" : \"\";\n\tconst char *dpllamdiv = val & DPLLA_TEST_M_BYPASS ? \", DPLLA M bypassed\" : \"\";\n\tconst char *dpllainput = val & DPLLA_INPUT_BUFFER_ENABLE ? \"\" : \", DPLLA input buffer disabled\";\n\tconst char *dpllbndiv = val & DPLLB_TEST_N_BYPASS ? \", DPLLB N bypassed\" : \"\";\n\tconst char *dpllbmdiv = val & DPLLB_TEST_M_BYPASS ? \", DPLLB M bypassed\" : \"\";\n\tconst char *dpllbinput = val & DPLLB_INPUT_BUFFER_ENABLE ? \"\" : \", DPLLB input buffer disabled\";\n\t\n\tsnprintf(result, len, \"%s%s%s%s%s%s\", dpllandiv, dpllamdiv, dpllainput, dpllbndiv, dpllbmdiv, dpllbinput);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_dspclk_gate_d)\n{\n\tconst char *DPUNIT_B = val & DPUNIT_B_CLOCK_GATE_DISABLE ? \" DPUNIT_B\" : \"\";\n\tconst char *VSUNIT = val & VSUNIT_CLOCK_GATE_DISABLE ? \" VSUNIT\" : \"\";\n\tconst char *VRHUNIT = val & VRHUNIT_CLOCK_GATE_DISABLE ? \" VRHUNIT\" : \"\";\n\tconst char *VRDUNIT = val & VRDUNIT_CLOCK_GATE_DISABLE ? \" VRDUNIT\" : \"\";\n\tconst char *AUDUNIT = val & AUDUNIT_CLOCK_GATE_DISABLE ? \" AUDUNIT\" : \"\";\n\tconst char *DPUNIT_A = val & DPUNIT_A_CLOCK_GATE_DISABLE ? \" DPUNIT_A\" : \"\";\n\tconst char *DPCUNIT = val & DPCUNIT_CLOCK_GATE_DISABLE ? \" DPCUNIT\" : \"\";\n\tconst char *TVRUNIT = val & TVRUNIT_CLOCK_GATE_DISABLE ? \" TVRUNIT\" : \"\";\n\tconst char *TVCUNIT = val & TVCUNIT_CLOCK_GATE_DISABLE ? \" TVCUNIT\" : \"\";\n\tconst char *TVFUNIT = val & TVFUNIT_CLOCK_GATE_DISABLE ? \" TVFUNIT\" : \"\";\n\tconst char *TVEUNIT = val & TVEUNIT_CLOCK_GATE_DISABLE ? \" TVEUNIT\" : \"\";\n\tconst char *DVSUNIT = val & DVSUNIT_CLOCK_GATE_DISABLE ? \" DVSUNIT\" : \"\";\n\tconst char *DSSUNIT = val & DSSUNIT_CLOCK_GATE_DISABLE ? \" DSSUNIT\" : \"\";\n\tconst char *DDBUNIT = val & DDBUNIT_CLOCK_GATE_DISABLE ? \" DDBUNIT\" : \"\";\n\tconst char *DPRUNIT = val & DPRUNIT_CLOCK_GATE_DISABLE ? \" DPRUNIT\" : \"\";\n\tconst char *DPFUNIT = val & DPFUNIT_CLOCK_GATE_DISABLE ? \" DPFUNIT\" : \"\";\n\tconst char *DPBMUNIT = val & DPBMUNIT_CLOCK_GATE_DISABLE ? \" DPBMUNIT\" : \"\";\n\tconst char *DPLSUNIT = val & DPLSUNIT_CLOCK_GATE_DISABLE ? \" DPLSUNIT\" : \"\";\n\tconst char *DPLUNIT = val & DPLUNIT_CLOCK_GATE_DISABLE ? \" DPLUNIT\" : \"\";\n\tconst char *DPOUNIT = val & DPOUNIT_CLOCK_GATE_DISABLE ? \" DPOUNIT\" : \"\";\n\tconst char *DPBUNIT = val & DPBUNIT_CLOCK_GATE_DISABLE ? \" DPBUNIT\" : \"\";\n\tconst char *DCUNIT = val & DCUNIT_CLOCK_GATE_DISABLE ? \" DCUNIT\" : \"\";\n\tconst char *DPUNIT = val & DPUNIT_CLOCK_GATE_DISABLE ? \" DPUNIT\" : \"\";\n\tconst char *VRUNIT = val & VRUNIT_CLOCK_GATE_DISABLE ? \" VRUNIT\" : \"\";\n\tconst char *OVHUNIT = val & OVHUNIT_CLOCK_GATE_DISABLE ? \" OVHUNIT\" : \"\";\n\tconst char *DPIOUNIT = val & DPIOUNIT_CLOCK_GATE_DISABLE ? \" DPIOUNIT\" : \"\";\n\tconst char *OVFUNIT = val & OVFUNIT_CLOCK_GATE_DISABLE ? \" OVFUNIT\" : \"\";\n\tconst char *OVBUNIT = val & OVBUNIT_CLOCK_GATE_DISABLE ? \" OVBUNIT\" : \"\";\n\tconst char *OVRUNIT = val & OVRUNIT_CLOCK_GATE_DISABLE ? \" OVRUNIT\" : \"\";\n\tconst char *OVCUNIT = val & OVCUNIT_CLOCK_GATE_DISABLE ? \" OVCUNIT\" : \"\";\n\tconst char *OVUUNIT = val & OVUUNIT_CLOCK_GATE_DISABLE ? \" OVUUNIT\" : \"\";\n\tconst char *OVLUNIT = val & OVLUNIT_CLOCK_GATE_DISABLE ? \" OVLUNIT\" : \"\";\n\t\n\tsnprintf(result, len,\n\t\t\t \"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\",\n\t\t\t DPUNIT_B, VSUNIT, VRHUNIT, VRDUNIT, AUDUNIT, DPUNIT_A, DPCUNIT,\n\t\t\t TVRUNIT, TVCUNIT, TVFUNIT, TVEUNIT, DVSUNIT, DSSUNIT, DDBUNIT,\n\t\t\t DPRUNIT, DPFUNIT, DPBMUNIT, DPLSUNIT, DPLUNIT, DPOUNIT, DPBUNIT,\n\t\t\t DCUNIT, DPUNIT, VRUNIT, OVHUNIT, DPIOUNIT, OVFUNIT, OVBUNIT,\n\t\t\t OVRUNIT, OVCUNIT, OVUUNIT, OVLUNIT);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_sdvo)\n{\n\tconst char *enable = val & SDVO_ENABLE ? \"enabled\" : \"disabled\";\n\tchar disp_pipe = val & SDVO_PIPE_B_SELECT ? 'B' : 'A';\n\tconst char *stall = val & SDVO_STALL_SELECT ? \"enabled\" : \"disabled\";\n\tconst char *detected = val & SDVO_DETECTED ? \"\" : \"not \";\n\tconst char *gang = val & SDVOC_GANG_MODE ? \", gang mode\" : \"\";\n\tchar sdvoextra[20];\n\t\n\tif (IS_915(devid))\n\t{\n\t\tsnprintf(sdvoextra, len, \", SDVO mult %d\", (int)((val & SDVO_PORT_MULTIPLY_MASK) >> SDVO_PORT_MULTIPLY_SHIFT) + 1);\n\t}\n\telse\n\t{\n\t\tsdvoextra[0] = '\\0';\n\t}\n\t\n\tsnprintf(result, len, \"%s, pipe %c, stall %s, %sdetected%s%s\", enable, disp_pipe, stall, detected, sdvoextra, gang);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_dvo)\n{\n\tconst char *enable = val & DVO_ENABLE ? \"enabled\" : \"disabled\";\n\tchar disp_pipe = val & DVO_PIPE_B_SELECT ? 'B' : 'A';\n\tconst char *stall;\n\tchar hsync = val & DVO_HSYNC_ACTIVE_HIGH ? '+' : '-';\n\tchar vsync = val & DVO_VSYNC_ACTIVE_HIGH ? '+' : '-';\n\t\n\tswitch (val & DVO_PIPE_STALL_MASK)\n\t{\n\t\tcase DVO_PIPE_STALL_UNUSED:\n\t\t\tstall = \"no stall\";\n\t\t\tbreak;\n\t\tcase DVO_PIPE_STALL:\n\t\t\tstall = \"stall\";\n\t\t\tbreak;\n\t\tcase DVO_PIPE_STALL_TV:\n\t\t\tstall = \"TV stall\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tstall = \"unknown stall\";\n\t\t\tbreak;\n\t}\n\t\n\tsnprintf(result, len, \"%s, pipe %c, %s, %chsync, %cvsync\", enable, disp_pipe, stall, hsync, vsync);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_pp_control)\n{\n\tsnprintf(result, len, \"power target: %s\", val & POWER_TARGET_ON ? \"on\" : \"off\");\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_dspstride)\n{\n\tsnprintf(result, len, \"%d bytes\", val);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_pipestat)\n{\n\tconst char *_FIFO_UNDERRUN = val & FIFO_UNDERRUN ? \" FIFO_UNDERRUN\" : \"\";\n\tconst char *_CRC_ERROR_ENABLE =\n\tval & CRC_ERROR_ENABLE ? \" CRC_ERROR_ENABLE\" : \"\";\n\tconst char *_CRC_DONE_ENABLE =\n\tval & CRC_DONE_ENABLE ? \" CRC_DONE_ENABLE\" : \"\";\n\tconst char *_GMBUS_EVENT_ENABLE =\n\tval & GMBUS_EVENT_ENABLE ? \" GMBUS_EVENT_ENABLE\" : \"\";\n\tconst char *_VSYNC_INT_ENABLE =\n\tval & VSYNC_INT_ENABLE ? \" VSYNC_INT_ENABLE\" : \"\";\n\tconst char *_DLINE_COMPARE_ENABLE =\n\tval & DLINE_COMPARE_ENABLE ? \" DLINE_COMPARE_ENABLE\" : \"\";\n\tconst char *_DPST_EVENT_ENABLE =\n\tval & DPST_EVENT_ENABLE ? \" DPST_EVENT_ENABLE\" : \"\";\n\tconst char *_LBLC_EVENT_ENABLE =\n\tval & LBLC_EVENT_ENABLE ? \" LBLC_EVENT_ENABLE\" : \"\";\n\tconst char *_OFIELD_INT_ENABLE =\n\tval & OFIELD_INT_ENABLE ? \" OFIELD_INT_ENABLE\" : \"\";\n\tconst char *_EFIELD_INT_ENABLE =\n\tval & EFIELD_INT_ENABLE ? \" EFIELD_INT_ENABLE\" : \"\";\n\tconst char *_SVBLANK_INT_ENABLE =\n\tval & SVBLANK_INT_ENABLE ? \" SVBLANK_INT_ENABLE\" : \"\";\n\tconst char *_VBLANK_INT_ENABLE =\n\tval & VBLANK_INT_ENABLE ? \" VBLANK_INT_ENABLE\" : \"\";\n\tconst char *_OREG_UPDATE_ENABLE =\n\tval & OREG_UPDATE_ENABLE ? \" OREG_UPDATE_ENABLE\" : \"\";\n\tconst char *_CRC_ERROR_INT_STATUS =\n\tval & CRC_ERROR_INT_STATUS ? \" CRC_ERROR_INT_STATUS\" : \"\";\n\tconst char *_CRC_DONE_INT_STATUS =\n\tval & CRC_DONE_INT_STATUS ? \" CRC_DONE_INT_STATUS\" : \"\";\n\tconst char *_GMBUS_INT_STATUS =\n\tval & GMBUS_INT_STATUS ? \" GMBUS_INT_STATUS\" : \"\";\n\tconst char *_VSYNC_INT_STATUS =\n\tval & VSYNC_INT_STATUS ? \" VSYNC_INT_STATUS\" : \"\";\n\tconst char *_DLINE_COMPARE_STATUS =\n\tval & DLINE_COMPARE_STATUS ? \" DLINE_COMPARE_STATUS\" : \"\";\n\tconst char *_DPST_EVENT_STATUS =\n\tval & DPST_EVENT_STATUS ? \" DPST_EVENT_STATUS\" : \"\";\n\tconst char *_LBLC_EVENT_STATUS =\n\tval & LBLC_EVENT_STATUS ? \" LBLC_EVENT_STATUS\" : \"\";\n\tconst char *_OFIELD_INT_STATUS =\n\tval & OFIELD_INT_STATUS ? \" OFIELD_INT_STATUS\" : \"\";\n\tconst char *_EFIELD_INT_STATUS =\n\tval & EFIELD_INT_STATUS ? \" EFIELD_INT_STATUS\" : \"\";\n\tconst char *_SVBLANK_INT_STATUS =\n\tval & SVBLANK_INT_STATUS ? \" SVBLANK_INT_STATUS\" : \"\";\n\tconst char *_VBLANK_INT_STATUS =\n\tval & VBLANK_INT_STATUS ? \" VBLANK_INT_STATUS\" : \"\";\n\tconst char *_OREG_UPDATE_STATUS =\n\tval & OREG_UPDATE_STATUS ? \" OREG_UPDATE_STATUS\" : \"\";\n\tsnprintf(result, len,\n\t\t\t \"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\",\n\t\t\t _FIFO_UNDERRUN,\n\t\t\t _CRC_ERROR_ENABLE,\n\t\t\t _CRC_DONE_ENABLE,\n\t\t\t _GMBUS_EVENT_ENABLE,\n\t\t\t _VSYNC_INT_ENABLE,\n\t\t\t _DLINE_COMPARE_ENABLE,\n\t\t\t _DPST_EVENT_ENABLE,\n\t\t\t _LBLC_EVENT_ENABLE,\n\t\t\t _OFIELD_INT_ENABLE,\n\t\t\t _EFIELD_INT_ENABLE,\n\t\t\t _SVBLANK_INT_ENABLE,\n\t\t\t _VBLANK_INT_ENABLE,\n\t\t\t _OREG_UPDATE_ENABLE,\n\t\t\t _CRC_ERROR_INT_STATUS,\n\t\t\t _CRC_DONE_INT_STATUS,\n\t\t\t _GMBUS_INT_STATUS,\n\t\t\t _VSYNC_INT_STATUS,\n\t\t\t _DLINE_COMPARE_STATUS,\n\t\t\t _DPST_EVENT_STATUS,\n\t\t\t _LBLC_EVENT_STATUS,\n\t\t\t _OFIELD_INT_STATUS,\n\t\t\t _EFIELD_INT_STATUS,\n\t\t\t _SVBLANK_INT_STATUS,\n\t\t\t _VBLANK_INT_STATUS,\n\t\t\t _OREG_UPDATE_STATUS);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i830_debug_dpll)\n{\n\tconst char *enabled = val & DPLL_VCO_ENABLE ? \"enabled\" : \"disabled\";\n\tconst char *dvomode = val & DPLL_DVO_HIGH_SPEED ? \"dvo\" : \"non-dvo\";\n\tconst char *vgamode = val & DPLL_VGA_MODE_DIS ? \"\" : \", VGA\";\n\tconst char *mode = \"unknown\";\n\tconst char *clock = \"unknown\";\n\tconst char *fpextra = val & DISPLAY_RATE_SELECT_FPA1 ? \", using FPx1!\" : \"\";\n\tchar sdvoextra[20];\n\tint p1, p2 = 0;\n\t\n\tif (IS_GEN2(devid))\n\t{\n\t\t// char is_lvds = (INREG(LVDS) & LVDS_PORT_EN) && (reg == DPLL_B);\n\t\tchar is_lvds = (MMIO_READ32(LVDS) & LVDS_PORT_EN) && (reg == DPLL_B);\n\t\t\n\t\tif (is_lvds)\n\t\t{\n\t\t\tmode = \"LVDS\";\n\t\t\tp1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS) >> DPLL_FPA01_P1_POST_DIV_SHIFT);\n\n\t\t\t// if ((INREG(LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP)\n\t\t\tif ((MMIO_READ32(LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP)\n\t\t\t{\n\t\t\t\tp2 = 7;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tp2 = 14;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmode = \"DAC/serial\";\n\n\t\t\tif (val & PLL_P1_DIVIDE_BY_TWO)\n\t\t\t{\n\t\t\t\tp1 = 2;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t/* Map the number in the field to (3, 33) */\n\t\t\t\tp1 = ((val & DPLL_FPA01_P1_POST_DIV_MASK_I830) >> DPLL_FPA01_P1_POST_DIV_SHIFT) + 2;\n\t\t\t}\n\n\t\t\tif (val & PLL_P2_DIVIDE_BY_4)\n\t\t\t{\n\t\t\t\tp2 = 4;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tp2 = 2;\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (IS_IGD(devid))\n\t\t{\n\t\t\tp1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK_IGD) >> DPLL_FPA01_P1_POST_DIV_SHIFT_IGD);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tp1 = ffs((val & DPLL_FPA01_P1_POST_DIV_MASK) >> DPLL_FPA01_P1_POST_DIV_SHIFT);\n\t\t}\n\t\tswitch (val & DPLL_MODE_MASK)\n\t\t{\n\t\t\tcase DPLLB_MODE_DAC_SERIAL:\n\t\t\t\tmode = \"DAC/serial\";\n\t\t\t\tp2 = val & DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 ? 5 : 10;\n\t\t\t\tbreak;\n\t\t\tcase DPLLB_MODE_LVDS:\n\t\t\t\tmode = \"LVDS\";\n\t\t\t\tp2 = val & DPLLB_LVDS_P2_CLOCK_DIV_7 ? 7 : 14;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tswitch (val & PLL_REF_INPUT_MASK)\n\t{\n\t\tcase PLL_REF_INPUT_DREFCLK:\n\t\t\tclock = \"default\";\n\t\t\tbreak;\n\t\tcase PLL_REF_INPUT_TVCLKINA:\n\t\t\tclock = \"TV A\";\n\t\t\tbreak;\n\t\tcase PLL_REF_INPUT_TVCLKINBC:\n\t\t\tclock = \"TV B/C\";\n\t\t\tbreak;\n\t\tcase PLLB_REF_INPUT_SPREADSPECTRUMIN:\n\t\t\tif (reg == DPLL_B)\n\t\t\t\tclock = \"spread spectrum\";\n\t\t\tbreak;\n\t}\n\t\n\tif (IS_945(devid))\n\t{\n\t\tsnprintf(sdvoextra, len, \", SDVO mult %d\", (int)((val & SDVO_MULTIPLIER_MASK) >> SDVO_MULTIPLIER_SHIFT_HIRES) + 1);\n\t}\n\telse\n\t{\n\t\tsdvoextra[0] = '\\0';\n\t}\n\t\n\tsnprintf(result, len, \"%s, %s%s, %s clock, %s mode, p1 = %d, p2 = %d%s%s\",  enabled, dvomode, vgamode, clock, mode, p1, p2,  fpextra, sdvoextra);\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i810_debug_915_fence)\n{\n\tchar format = (val & 1 << 12) ? 'Y' : 'X';\n\tint pitch = 128 << ((val & 0x70) >> 4);\n\tunsigned int offset = val & 0x0ff00000;\n\tint size = (1024 * 1024) << ((val & 0x700) >> 8);\n\t\n\tif (IS_965(devid) || (IS_915(devid) && reg >= FENCE_NEW))\n\t{\n\t\treturn;\n\t}\n\t\n\tif (format == 'X')\n\t{\n\t\tpitch *= 4;\n\t}\n\n\tif (val & 1)\n\t{\n\t\tsnprintf(result, len, \"enabled, %c tiled, %4d pitch, 0x%08x - 0x%08x (%dkb)\", format, pitch, offset, offset + size, size / 1024);\n\t}\n\telse\n\t{\n\t\tsnprintf(result, len, \"disabled\");\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i810_debug_965_fence_start)\n{\n\tconst char *enable = (val & FENCE_VALID) ? \" enabled\" : \"disabled\";\n\tchar format = (val & I965_FENCE_Y_MAJOR) ? 'Y' : 'X';\n\tint pitch = ((val & 0xffc) >> 2) * 128 + 128;\n\tunsigned int offset = val & 0xfffff000;\n\t\n\tif (IS_965(devid))\n\t{\n\t\tsnprintf(result, len, \"%s, %c tile walk, %4d pitch, 0x%08x start\", enable, format, pitch, offset);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(i810_debug_965_fence_end)\n{\n\tunsigned int end = val & 0xfffff000;\n\t\n\tif (IS_965(devid))\n\t{\n\t\tsnprintf(result, len, \"                                   0x%08x end\", end);\n\t}\n}\n\n//------------------------------------------------------------------------------\n\nDEBUGSTRING(gen6_rp_control)\n{\n\tsnprintf(result, len, \"%s\", (val & (1 << 7)) ? \"enabled\" : \"disabled\");\n}\n\n//------------------------------------------------------------------------------\n\nstatic struct reg_debug gen6_fences[] = {\n#define DEFINEFENCE_SNB(i) \\\n{ FENCE_REG_SANDYBRIDGE_0 + (i) * 8, \"FENCE START \"#i, NULL, 0 }, \\\n{ FENCE_REG_SANDYBRIDGE_0 + (i) * 8 + 4, \"FENCE END \"#i, NULL, 0 }\n\tDEFINEFENCE_SNB(0),\n\tDEFINEFENCE_SNB(1),\n\tDEFINEFENCE_SNB(2),\n\tDEFINEFENCE_SNB(3),\n\tDEFINEFENCE_SNB(4),\n\tDEFINEFENCE_SNB(5),\n\tDEFINEFENCE_SNB(6),\n\tDEFINEFENCE_SNB(7),\n\tDEFINEFENCE_SNB(8),\n\tDEFINEFENCE_SNB(9),\n\tDEFINEFENCE_SNB(10),\n\tDEFINEFENCE_SNB(11),\n\tDEFINEFENCE_SNB(12),\n\tDEFINEFENCE_SNB(13),\n\tDEFINEFENCE_SNB(14),\n\tDEFINEFENCE_SNB(15),\n\tDEFINEFENCE_SNB(16),\n\tDEFINEFENCE_SNB(17),\n\tDEFINEFENCE_SNB(18),\n\tDEFINEFENCE_SNB(19),\n\tDEFINEFENCE_SNB(20),\n\tDEFINEFENCE_SNB(20),\n\tDEFINEFENCE_SNB(21),\n\tDEFINEFENCE_SNB(22),\n\tDEFINEFENCE_SNB(23),\n\tDEFINEFENCE_SNB(24),\n\tDEFINEFENCE_SNB(25),\n\tDEFINEFENCE_SNB(26),\n\tDEFINEFENCE_SNB(27),\n\tDEFINEFENCE_SNB(28),\n\tDEFINEFENCE_SNB(29),\n\tDEFINEFENCE_SNB(30),\n\tDEFINEFENCE_SNB(31),\n};\n\n//------------------------------------------------------------------------------\n\nstatic struct reg_debug gen6_rp_debug_regs[] = {\n\tDEFINEREG2(GEN6_RP_CONTROL, gen6_rp_control),\n\tDEFINEREG(GEN6_RPNSWREQ),\n\tDEFINEREG(GEN6_RP_DOWN_TIMEOUT),\n\tDEFINEREG(GEN6_RP_INTERRUPT_LIMITS),\n\tDEFINEREG(GEN6_RP_UP_THRESHOLD),\n\tDEFINEREG(GEN6_RP_UP_EI),\n\tDEFINEREG(GEN6_RP_DOWN_EI),\n\tDEFINEREG(GEN6_RP_IDLE_HYSTERSIS),\n\tDEFINEREG(GEN6_RC_STATE),\n\tDEFINEREG(GEN6_RC_CONTROL),\n\tDEFINEREG(GEN6_RC1_WAKE_RATE_LIMIT),\n\tDEFINEREG(GEN6_RC6_WAKE_RATE_LIMIT),\n\tDEFINEREG(GEN6_RC_EVALUATION_INTERVAL),\n\tDEFINEREG(GEN6_RC_IDLE_HYSTERSIS),\n\tDEFINEREG(GEN6_RC_SLEEP),\n\tDEFINEREG(GEN6_RC1e_THRESHOLD),\n\tDEFINEREG(GEN6_RC6_THRESHOLD),\n\tDEFINEREG(GEN6_RC_VIDEO_FREQ),\n\tDEFINEREG(GEN6_PMIER),\n\tDEFINEREG(GEN6_PMIMR),\n\tDEFINEREG(GEN6_PMINTRMSK),\n};\n\n//------------------------------------------------------------------------------\n\nstatic struct reg_debug intel_debug_regs[] = {\n\tDEFINEREG2(DCC, i830_debug_dcc),\n\tDEFINEREG2(CHDECMISC, i830_debug_chdecmisc),\n\tDEFINEREG_16BIT(C0DRB0),\n\tDEFINEREG_16BIT(C0DRB1),\n\tDEFINEREG_16BIT(C0DRB2),\n\tDEFINEREG_16BIT(C0DRB3),\n\tDEFINEREG_16BIT(C1DRB0),\n\tDEFINEREG_16BIT(C1DRB1),\n\tDEFINEREG_16BIT(C1DRB2),\n\tDEFINEREG_16BIT(C1DRB3),\n\tDEFINEREG_16BIT(C0DRA01),\n\tDEFINEREG_16BIT(C0DRA23),\n\tDEFINEREG_16BIT(C1DRA01),\n\tDEFINEREG_16BIT(C1DRA23),\n\t\n\tDEFINEREG(PGETBL_CTL),\n\t\n\tDEFINEREG2(VCLK_DIVISOR_VGA0, i830_debug_fp),\n\tDEFINEREG2(VCLK_DIVISOR_VGA1, i830_debug_fp),\n\tDEFINEREG2(VCLK_POST_DIV, i830_debug_vga_pd),\n\tDEFINEREG2(DPLL_TEST, i830_debug_dpll_test),\n\tDEFINEREG(CACHE_MODE_0),\n\tDEFINEREG(D_STATE),\n\tDEFINEREG2(DSPCLK_GATE_D, i830_debug_dspclk_gate_d),\n\tDEFINEREG(RENCLK_GATE_D1),\n\tDEFINEREG(RENCLK_GATE_D2),\n\t/*  DEFINEREG(RAMCLK_GATE_D),\tCRL only */\n\tDEFINEREG2(SDVOB, i830_debug_sdvo),\n\tDEFINEREG2(SDVOC, i830_debug_sdvo),\n\t/*    DEFINEREG(UDIB_SVB_SHB_CODES), CRL only */\n\t/*    DEFINEREG(UDIB_SHA_BLANK_CODES), CRL only */\n\tDEFINEREG(SDVOUDI),\n\tDEFINEREG(DSPARB),\n\tDEFINEREG(FW_BLC),\n\tDEFINEREG(FW_BLC2),\n\tDEFINEREG(FW_BLC_SELF),\n\tDEFINEREG(DSPFW1),\n\tDEFINEREG(DSPFW2),\n\tDEFINEREG(DSPFW3),\n\t\n\tDEFINEREG2(ADPA, i830_debug_adpa),\n\tDEFINEREG2(LVDS, i830_debug_lvds),\n\tDEFINEREG2(DVOA, i830_debug_dvo),\n\tDEFINEREG2(DVOB, i830_debug_dvo),\n\tDEFINEREG2(DVOC, i830_debug_dvo),\n\tDEFINEREG(DVOA_SRCDIM),\n\tDEFINEREG(DVOB_SRCDIM),\n\tDEFINEREG(DVOC_SRCDIM),\n\t\n\tDEFINEREG(BLC_PWM_CTL),\n\tDEFINEREG(BLC_PWM_CTL2),\n\t\n\tDEFINEREG2(PP_CONTROL, i830_debug_pp_control),\n\tDEFINEREG2(PP_STATUS, i830_debug_pp_status),\n\tDEFINEREG(PP_ON_DELAYS),\n\tDEFINEREG(PP_OFF_DELAYS),\n\tDEFINEREG(PP_DIVISOR),\n\tDEFINEREG(PFIT_CONTROL),\n\tDEFINEREG(PFIT_PGM_RATIOS),\n\tDEFINEREG(PORT_HOTPLUG_EN),\n\tDEFINEREG(PORT_HOTPLUG_STAT),\n\t\n\tDEFINEREG2(DSPACNTR, i830_debug_dspcntr),\n\tDEFINEREG2(DSPASTRIDE, i830_debug_dspstride),\n\tDEFINEREG2(DSPAPOS, i830_debug_xy),\n\tDEFINEREG2(DSPASIZE, i830_debug_xyminus1),\n\tDEFINEREG(DSPABASE),\n\tDEFINEREG(DSPASURF),\n\tDEFINEREG(DSPATILEOFF),\n\tDEFINEREG2(PIPEACONF, i830_debug_pipeconf),\n\tDEFINEREG2(PIPEASRC, i830_debug_yxminus1),\n\tDEFINEREG2(PIPEASTAT, i830_debug_pipestat),\n\tDEFINEREG(PIPEA_GMCH_DATA_M),\n\tDEFINEREG(PIPEA_GMCH_DATA_N),\n\tDEFINEREG(PIPEA_DP_LINK_M),\n\tDEFINEREG(PIPEA_DP_LINK_N),\n\tDEFINEREG(CURSOR_A_BASE),\n\tDEFINEREG(CURSOR_A_CONTROL),\n\tDEFINEREG(CURSOR_A_POSITION),\n\t\n\tDEFINEREG2(FPA0, i830_debug_fp),\n\tDEFINEREG2(FPA1, i830_debug_fp),\n\tDEFINEREG2(DPLL_A, i830_debug_dpll),\n\tDEFINEREG(DPLL_A_MD),\n\tDEFINEREG2(HTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG(BCLRPAT_A),\n\tDEFINEREG(VSYNCSHIFT_A),\n\t\n\tDEFINEREG2(DSPBCNTR, i830_debug_dspcntr),\n\tDEFINEREG2(DSPBSTRIDE, i830_debug_dspstride),\n\tDEFINEREG2(DSPBPOS, i830_debug_xy),\n\tDEFINEREG2(DSPBSIZE, i830_debug_xyminus1),\n\tDEFINEREG(DSPBBASE),\n\tDEFINEREG(DSPBSURF),\n\tDEFINEREG(DSPBTILEOFF),\n\tDEFINEREG2(PIPEBCONF, i830_debug_pipeconf),\n\tDEFINEREG2(PIPEBSRC, i830_debug_yxminus1),\n\tDEFINEREG2(PIPEBSTAT, i830_debug_pipestat),\n\tDEFINEREG(PIPEB_GMCH_DATA_M),\n\tDEFINEREG(PIPEB_GMCH_DATA_N),\n\tDEFINEREG(PIPEB_DP_LINK_M),\n\tDEFINEREG(PIPEB_DP_LINK_N),\n\tDEFINEREG(CURSOR_B_BASE),\n\tDEFINEREG(CURSOR_B_CONTROL),\n\tDEFINEREG(CURSOR_B_POSITION),\n\t\n\tDEFINEREG2(FPB0, i830_debug_fp),\n\tDEFINEREG2(FPB1, i830_debug_fp),\n\tDEFINEREG2(DPLL_B, i830_debug_dpll),\n\tDEFINEREG(DPLL_B_MD),\n\tDEFINEREG2(HTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG(BCLRPAT_B),\n\tDEFINEREG(VSYNCSHIFT_B),\n\t\n\tDEFINEREG(VCLK_DIVISOR_VGA0),\n\tDEFINEREG(VCLK_DIVISOR_VGA1),\n\tDEFINEREG(VCLK_POST_DIV),\n\tDEFINEREG2(VGACNTRL, i830_debug_vgacntrl),\n\t\n\tDEFINEREG(TV_CTL),\n\tDEFINEREG(TV_DAC),\n\tDEFINEREG(TV_CSC_Y),\n\tDEFINEREG(TV_CSC_Y2),\n\tDEFINEREG(TV_CSC_U),\n\tDEFINEREG(TV_CSC_U2),\n\tDEFINEREG(TV_CSC_V),\n\tDEFINEREG(TV_CSC_V2),\n\tDEFINEREG(TV_CLR_KNOBS),\n\tDEFINEREG(TV_CLR_LEVEL),\n\tDEFINEREG(TV_H_CTL_1),\n\tDEFINEREG(TV_H_CTL_2),\n\tDEFINEREG(TV_H_CTL_3),\n\tDEFINEREG(TV_V_CTL_1),\n\tDEFINEREG(TV_V_CTL_2),\n\tDEFINEREG(TV_V_CTL_3),\n\tDEFINEREG(TV_V_CTL_4),\n\tDEFINEREG(TV_V_CTL_5),\n\tDEFINEREG(TV_V_CTL_6),\n\tDEFINEREG(TV_V_CTL_7),\n\tDEFINEREG(TV_SC_CTL_1),\n\tDEFINEREG(TV_SC_CTL_2),\n\tDEFINEREG(TV_SC_CTL_3),\n\tDEFINEREG(TV_WIN_POS),\n\tDEFINEREG(TV_WIN_SIZE),\n\tDEFINEREG(TV_FILTER_CTL_1),\n\tDEFINEREG(TV_FILTER_CTL_2),\n\tDEFINEREG(TV_FILTER_CTL_3),\n\tDEFINEREG(TV_CC_CONTROL),\n\tDEFINEREG(TV_CC_DATA),\n\tDEFINEREG(TV_H_LUMA_0),\n\tDEFINEREG(TV_H_LUMA_59),\n\tDEFINEREG(TV_H_CHROMA_0),\n\tDEFINEREG(TV_H_CHROMA_59),\n\t\n\tDEFINEREG(FBC_CFB_BASE),\n\tDEFINEREG(FBC_LL_BASE),\n\tDEFINEREG(FBC_CONTROL),\n\tDEFINEREG(FBC_COMMAND),\n\tDEFINEREG(FBC_STATUS),\n\tDEFINEREG(FBC_CONTROL2),\n\tDEFINEREG(FBC_FENCE_OFF),\n\tDEFINEREG(FBC_MOD_NUM),\n\t\n\tDEFINEREG(MI_MODE),\n\t/* DEFINEREG(MI_DISPLAY_POWER_DOWN), CRL only */\n\tDEFINEREG(MI_ARB_STATE),\n\tDEFINEREG(MI_RDRET_STATE),\n\tDEFINEREG(ECOSKPD),\n\t\n\tDEFINEREG(DP_B),\n\tDEFINEREG(DPB_AUX_CH_CTL),\n\tDEFINEREG(DPB_AUX_CH_DATA1),\n\tDEFINEREG(DPB_AUX_CH_DATA2),\n\tDEFINEREG(DPB_AUX_CH_DATA3),\n\tDEFINEREG(DPB_AUX_CH_DATA4),\n\tDEFINEREG(DPB_AUX_CH_DATA5),\n\t\n\tDEFINEREG(DP_C),\n\tDEFINEREG(DPC_AUX_CH_CTL),\n\tDEFINEREG(DPC_AUX_CH_DATA1),\n\tDEFINEREG(DPC_AUX_CH_DATA2),\n\tDEFINEREG(DPC_AUX_CH_DATA3),\n\tDEFINEREG(DPC_AUX_CH_DATA4),\n\tDEFINEREG(DPC_AUX_CH_DATA5),\n\t\n\tDEFINEREG(DP_D),\n\tDEFINEREG(DPD_AUX_CH_CTL),\n\tDEFINEREG(DPD_AUX_CH_DATA1),\n\tDEFINEREG(DPD_AUX_CH_DATA2),\n\tDEFINEREG(DPD_AUX_CH_DATA3),\n\tDEFINEREG(DPD_AUX_CH_DATA4),\n\tDEFINEREG(DPD_AUX_CH_DATA5),\n\t\n\tDEFINEREG(AUD_CONFIG),\n\tDEFINEREG(AUD_HDMIW_STATUS),\n\tDEFINEREG(AUD_CONV_CHCNT),\n\tDEFINEREG(VIDEO_DIP_CTL),\n\tDEFINEREG(AUD_PINW_CNTR),\n\tDEFINEREG(AUD_CNTL_ST),\n\tDEFINEREG(AUD_PIN_CAP),\n\tDEFINEREG(AUD_PINW_CAP),\n\tDEFINEREG(AUD_PINW_UNSOLRESP),\n\tDEFINEREG(AUD_OUT_DIG_CNVT),\n\tDEFINEREG(AUD_OUT_CWCAP),\n\tDEFINEREG(AUD_GRP_CAP),\n\t\n#define DEFINEFENCE_915(i) \\\n{ FENCE+i*4, \"FENCE  \" #i, i810_debug_915_fence, 0 }\n#define DEFINEFENCE_945(i)\t\t\t\t\t\t\\\n{ FENCE_NEW+(i - 8) * 4, \"FENCE  \" #i, i810_debug_915_fence, 0 }\n\t\n\tDEFINEFENCE_915(0),\n\tDEFINEFENCE_915(1),\n\tDEFINEFENCE_915(2),\n\tDEFINEFENCE_915(3),\n\tDEFINEFENCE_915(4),\n\tDEFINEFENCE_915(5),\n\tDEFINEFENCE_915(6),\n\tDEFINEFENCE_915(7),\n\tDEFINEFENCE_945(8),\n\tDEFINEFENCE_945(9),\n\tDEFINEFENCE_945(10),\n\tDEFINEFENCE_945(11),\n\tDEFINEFENCE_945(12),\n\tDEFINEFENCE_945(13),\n\tDEFINEFENCE_945(14),\n\tDEFINEFENCE_945(15),\n\t\n#define DEFINEFENCE_965(i) \\\n{ FENCE_NEW+i*8, \"FENCE START \" #i, i810_debug_965_fence_start, 0 }, \\\n{ FENCE_NEW+i*8+4, \"FENCE END \" #i, i810_debug_965_fence_end, 0 }\n\t\n\tDEFINEFENCE_965(0),\n\tDEFINEFENCE_965(1),\n\tDEFINEFENCE_965(2),\n\tDEFINEFENCE_965(3),\n\tDEFINEFENCE_965(4),\n\tDEFINEFENCE_965(5),\n\tDEFINEFENCE_965(6),\n\tDEFINEFENCE_965(7),\n\tDEFINEFENCE_965(8),\n\tDEFINEFENCE_965(9),\n\tDEFINEFENCE_965(10),\n\tDEFINEFENCE_965(11),\n\tDEFINEFENCE_965(12),\n\tDEFINEFENCE_965(13),\n\tDEFINEFENCE_965(14),\n\tDEFINEFENCE_965(15),\n\t\n\tDEFINEREG(INST_PM),\n};\n\n//------------------------------------------------------------------------------\n\nstatic struct reg_debug ironlake_debug_regs[] = {\n\tDEFINEREG(PGETBL_CTL),\n\tDEFINEREG(INSTDONE_I965),\n\tDEFINEREG(INSTDONE_1),\n\tDEFINEREG2(CPU_VGACNTRL, i830_debug_vgacntrl),\n\tDEFINEREG(DIGITAL_PORT_HOTPLUG_CNTRL),\n\t\n\tDEFINEREG2(RR_HW_CTL, ironlake_debug_rr_hw_ctl),\n\t\n\tDEFINEREG(FDI_PLL_BIOS_0),\n\tDEFINEREG(FDI_PLL_BIOS_1),\n\tDEFINEREG(FDI_PLL_BIOS_2),\n\t\n\tDEFINEREG(DISPLAY_PORT_PLL_BIOS_0),\n\tDEFINEREG(DISPLAY_PORT_PLL_BIOS_1),\n\tDEFINEREG(DISPLAY_PORT_PLL_BIOS_2),\n\t\n\tDEFINEREG(FDI_PLL_FREQ_CTL),\n\t\n\t/* pipe B */\n\t\n\tDEFINEREG2(PIPEACONF, i830_debug_pipeconf),\n\t\n\tDEFINEREG2(HTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG(VSYNCSHIFT_A),\n\tDEFINEREG2(PIPEASRC, i830_debug_yxminus1),\n\t\n\tDEFINEREG2(PIPEA_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEA_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEA_DATA_M2, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEA_DATA_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(PIPEA_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(PIPEA_LINK_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEA_LINK_M2, ironlake_debug_n),\n\tDEFINEREG2(PIPEA_LINK_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(DSPACNTR, i830_debug_dspcntr),\n\tDEFINEREG(DSPABASE),\n\tDEFINEREG2(DSPASTRIDE, ironlake_debug_dspstride),\n\tDEFINEREG(DSPASURF),\n\tDEFINEREG2(DSPATILEOFF, i830_debug_xy),\n\t\n\t/* pipe B */\n\t\n\tDEFINEREG2(PIPEBCONF, i830_debug_pipeconf),\n\t\n\tDEFINEREG2(HTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG(VSYNCSHIFT_B),\n\tDEFINEREG2(PIPEBSRC, i830_debug_yxminus1),\n\t\n\tDEFINEREG2(PIPEB_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEB_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEB_DATA_M2, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEB_DATA_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(PIPEB_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(PIPEB_LINK_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEB_LINK_M2, ironlake_debug_n),\n\tDEFINEREG2(PIPEB_LINK_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(DSPBCNTR, i830_debug_dspcntr),\n\tDEFINEREG(DSPBBASE),\n\tDEFINEREG2(DSPBSTRIDE, ironlake_debug_dspstride),\n\tDEFINEREG(DSPBSURF),\n\tDEFINEREG2(DSPBTILEOFF, i830_debug_xy),\n\t\n\t/* pipe C */\n\t\n\tDEFINEREG2(PIPECCONF, i830_debug_pipeconf),\n\t\n\tDEFINEREG2(HTOTAL_C, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_C, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_C, i830_debug_hvsyncblank),\n\tDEFINEREG(VSYNCSHIFT_C),\n\tDEFINEREG2(PIPECSRC, i830_debug_yxminus1),\n\t\n\tDEFINEREG2(PIPEC_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEC_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEC_DATA_M2, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEC_DATA_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(PIPEC_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(PIPEC_LINK_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEC_LINK_M2, ironlake_debug_n),\n\tDEFINEREG2(PIPEC_LINK_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(DSPCCNTR, i830_debug_dspcntr),\n\tDEFINEREG(DSPCBASE),\n\tDEFINEREG2(DSPCSTRIDE, ironlake_debug_dspstride),\n\tDEFINEREG(DSPCSURF),\n\tDEFINEREG2(DSPCTILEOFF, i830_debug_xy),\n\t\n\t/* Panel fitter */\n\t\n\tDEFINEREG2(PFA_CTL_1, ironlake_debug_panel_fitting),\n\tDEFINEREG2(PFA_CTL_2, ironlake_debug_panel_fitting_2),\n\tDEFINEREG2(PFA_CTL_3, ironlake_debug_panel_fitting_3),\n\tDEFINEREG2(PFA_CTL_4, ironlake_debug_panel_fitting_4),\n\tDEFINEREG2(PFA_WIN_POS, ironlake_debug_pf_win),\n\tDEFINEREG2(PFA_WIN_SIZE, ironlake_debug_pf_win),\n\tDEFINEREG2(PFB_CTL_1, ironlake_debug_panel_fitting),\n\tDEFINEREG2(PFB_CTL_2, ironlake_debug_panel_fitting_2),\n\tDEFINEREG2(PFB_CTL_3, ironlake_debug_panel_fitting_3),\n\tDEFINEREG2(PFB_CTL_4, ironlake_debug_panel_fitting_4),\n\tDEFINEREG2(PFB_WIN_POS, ironlake_debug_pf_win),\n\tDEFINEREG2(PFB_WIN_SIZE, ironlake_debug_pf_win),\n\tDEFINEREG2(PFC_CTL_1, ironlake_debug_panel_fitting),\n\tDEFINEREG2(PFC_CTL_2, ironlake_debug_panel_fitting_2),\n\tDEFINEREG2(PFC_CTL_3, ironlake_debug_panel_fitting_3),\n\tDEFINEREG2(PFC_CTL_4, ironlake_debug_panel_fitting_4),\n\tDEFINEREG2(PFC_WIN_POS, ironlake_debug_pf_win),\n\tDEFINEREG2(PFC_WIN_SIZE, ironlake_debug_pf_win),\n\t\n\t/* PCH */\n\t\n\tDEFINEREG2(PCH_DREF_CONTROL, ironlake_debug_dref_ctl),\n\tDEFINEREG2(PCH_RAWCLK_FREQ, ironlake_debug_rawclk_freq),\n\tDEFINEREG(PCH_DPLL_TMR_CFG),\n\tDEFINEREG(PCH_SSC4_PARMS),\n\tDEFINEREG(PCH_SSC4_AUX_PARMS),\n\tDEFINEREG2(PCH_DPLL_SEL, snb_debug_dpll_sel),\n\tDEFINEREG(PCH_DPLL_ANALOG_CTL),\n\t\n\tDEFINEREG2(PCH_DPLL_A, ironlake_debug_pch_dpll),\n\tDEFINEREG2(PCH_DPLL_B, ironlake_debug_pch_dpll),\n\tDEFINEREG2(PCH_FPA0, i830_debug_fp),\n\tDEFINEREG2(PCH_FPA1, i830_debug_fp),\n\tDEFINEREG2(PCH_FPB0, i830_debug_fp),\n\tDEFINEREG2(PCH_FPB1, i830_debug_fp),\n\t\n\tDEFINEREG2(TRANS_HTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_HBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_HSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_VBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG(TRANS_VSYNCSHIFT_A),\n\t\n\tDEFINEREG2(TRANSA_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(TRANSA_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(TRANSA_DATA_M2, ironlake_debug_m_tu),\n\tDEFINEREG2(TRANSA_DATA_N2, ironlake_debug_n),\n\tDEFINEREG2(TRANSA_DP_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(TRANSA_DP_LINK_N1, ironlake_debug_n),\n\tDEFINEREG2(TRANSA_DP_LINK_M2, ironlake_debug_n),\n\tDEFINEREG2(TRANSA_DP_LINK_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(TRANS_HTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_HBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_HSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_VBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG(TRANS_VSYNCSHIFT_B),\n\t\n\tDEFINEREG2(TRANSB_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(TRANSB_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(TRANSB_DATA_M2, ironlake_debug_m_tu),\n\tDEFINEREG2(TRANSB_DATA_N2, ironlake_debug_n),\n\tDEFINEREG2(TRANSB_DP_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(TRANSB_DP_LINK_N1, ironlake_debug_n),\n\tDEFINEREG2(TRANSB_DP_LINK_M2, ironlake_debug_n),\n\tDEFINEREG2(TRANSB_DP_LINK_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(TRANS_HTOTAL_C, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_HBLANK_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_HSYNC_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VTOTAL_C, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_VBLANK_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VSYNC_C, i830_debug_hvsyncblank),\n\tDEFINEREG(TRANS_VSYNCSHIFT_C),\n\t\n\tDEFINEREG2(TRANSC_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(TRANSC_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(TRANSC_DATA_M2, ironlake_debug_m_tu),\n\tDEFINEREG2(TRANSC_DATA_N2, ironlake_debug_n),\n\tDEFINEREG2(TRANSC_DP_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(TRANSC_DP_LINK_N1, ironlake_debug_n),\n\tDEFINEREG2(TRANSC_DP_LINK_M2, ironlake_debug_n),\n\tDEFINEREG2(TRANSC_DP_LINK_N2, ironlake_debug_n),\n\t\n\tDEFINEREG2(TRANSACONF, ironlake_debug_transconf),\n\tDEFINEREG2(TRANSBCONF, ironlake_debug_transconf),\n\tDEFINEREG2(TRANSCCONF, ironlake_debug_transconf),\n\t\n\tDEFINEREG2(FDI_TXA_CTL, ironlake_debug_fdi_tx_ctl),\n\tDEFINEREG2(FDI_TXB_CTL, ironlake_debug_fdi_tx_ctl),\n\tDEFINEREG2(FDI_TXC_CTL, ironlake_debug_fdi_tx_ctl),\n\tDEFINEREG2(FDI_RXA_CTL, ironlake_debug_fdi_rx_ctl),\n\tDEFINEREG2(FDI_RXB_CTL, ironlake_debug_fdi_rx_ctl),\n\tDEFINEREG2(FDI_RXC_CTL, ironlake_debug_fdi_rx_ctl),\n\t\n\tDEFINEREG(DPAFE_BMFUNC),\n\tDEFINEREG(DPAFE_DL_IREFCAL0),\n\tDEFINEREG(DPAFE_DL_IREFCAL1),\n\tDEFINEREG(DPAFE_DP_IREFCAL),\n\t\n\tDEFINEREG(PCH_DSPCLK_GATE_D),\n\tDEFINEREG(PCH_DSP_CHICKEN1),\n\tDEFINEREG(PCH_DSP_CHICKEN2),\n\tDEFINEREG(PCH_DSP_CHICKEN3),\n\t\n\tDEFINEREG2(FDI_RXA_MISC, ironlake_debug_fdi_rx_misc),\n\tDEFINEREG2(FDI_RXB_MISC, ironlake_debug_fdi_rx_misc),\n\tDEFINEREG2(FDI_RXC_MISC, ironlake_debug_fdi_rx_misc),\n\tDEFINEREG(FDI_RXA_TUSIZE1),\n\tDEFINEREG(FDI_RXA_TUSIZE2),\n\tDEFINEREG(FDI_RXB_TUSIZE1),\n\tDEFINEREG(FDI_RXB_TUSIZE2),\n\tDEFINEREG(FDI_RXC_TUSIZE1),\n\tDEFINEREG(FDI_RXC_TUSIZE2),\n\t\n\tDEFINEREG(FDI_PLL_CTL_1),\n\tDEFINEREG(FDI_PLL_CTL_2),\n\t\n\tDEFINEREG(FDI_RXA_IIR),\n\tDEFINEREG(FDI_RXA_IMR),\n\tDEFINEREG(FDI_RXB_IIR),\n\tDEFINEREG(FDI_RXB_IMR),\n\t\n\tDEFINEREG2(PCH_ADPA, i830_debug_adpa),\n\tDEFINEREG2(HDMIB, ironlake_debug_hdmi),\n\tDEFINEREG2(HDMIC, ironlake_debug_hdmi),\n\tDEFINEREG2(HDMID, ironlake_debug_hdmi),\n\tDEFINEREG2(PCH_LVDS, i830_debug_lvds),\n\tDEFINEREG(CPU_eDP_A),\n\tDEFINEREG(PCH_DP_B),\n\tDEFINEREG(PCH_DP_C),\n\tDEFINEREG(PCH_DP_D),\n\tDEFINEREG2(TRANS_DP_CTL_A, snb_debug_trans_dp_ctl),\n\tDEFINEREG2(TRANS_DP_CTL_B, snb_debug_trans_dp_ctl),\n\tDEFINEREG2(TRANS_DP_CTL_C, snb_debug_trans_dp_ctl),\n\t\n\tDEFINEREG2(BLC_PWM_CPU_CTL2, ilk_debug_blc_pwm_cpu_ctl2),\n\tDEFINEREG2(BLC_PWM_CPU_CTL, ilk_debug_blc_pwm_cpu_ctl),\n\tDEFINEREG2(BLC_PWM_PCH_CTL1, ibx_debug_blc_pwm_ctl1),\n\tDEFINEREG2(BLC_PWM_PCH_CTL2, ibx_debug_blc_pwm_ctl2),\n\t\n\tDEFINEREG2(PCH_PP_STATUS, i830_debug_pp_status),\n\tDEFINEREG2(PCH_PP_CONTROL, ilk_debug_pp_control),\n\tDEFINEREG(PCH_PP_ON_DELAYS),\n\tDEFINEREG(PCH_PP_OFF_DELAYS),\n\tDEFINEREG(PCH_PP_DIVISOR),\n\t\n\tDEFINEREG2(PORT_DBG, ivb_debug_port),\n\t\n\tDEFINEREG(RC6_RESIDENCY_TIME),\n\tDEFINEREG(RC6p_RESIDENCY_TIME),\n\tDEFINEREG(RC6pp_RESIDENCY_TIME),\n};\n\n//------------------------------------------------------------------------------\n\nstatic struct reg_debug haswell_debug_regs[] = {\n\t/* Power wells */\n\tDEFINEREG(HSW_PWR_WELL_CTL1),\n\tDEFINEREG(HSW_PWR_WELL_CTL2),\n\tDEFINEREG(HSW_PWR_WELL_CTL3),\n\tDEFINEREG(HSW_PWR_WELL_CTL4),\n\tDEFINEREG(HSW_PWR_WELL_CTL5),\n\tDEFINEREG(HSW_PWR_WELL_CTL6),\n\t\n\t/* DDI pipe function */\n\tDEFINEREG2(PIPE_DDI_FUNC_CTL_A, hsw_debug_pipe_ddi_func_ctl),\n\tDEFINEREG2(PIPE_DDI_FUNC_CTL_B, hsw_debug_pipe_ddi_func_ctl),\n\tDEFINEREG2(PIPE_DDI_FUNC_CTL_C, hsw_debug_pipe_ddi_func_ctl),\n\tDEFINEREG2(PIPE_DDI_FUNC_CTL_EDP, hsw_debug_pipe_ddi_func_ctl),\n\t\n\t/* DP transport control */\n\tDEFINEREG(DP_TP_CTL_A),\n\tDEFINEREG(DP_TP_CTL_B),\n\tDEFINEREG(DP_TP_CTL_C),\n\tDEFINEREG(DP_TP_CTL_D),\n\tDEFINEREG(DP_TP_CTL_E),\n\t\n\t/* DP status */\n\tDEFINEREG(DP_TP_STATUS_A),\n\tDEFINEREG(DP_TP_STATUS_B),\n\tDEFINEREG(DP_TP_STATUS_C),\n\tDEFINEREG(DP_TP_STATUS_D),\n\tDEFINEREG(DP_TP_STATUS_E),\n\t\n\t/* DDI buffer control */\n\tDEFINEREG2(DDI_BUF_CTL_A, hsw_debug_ddi_buf_ctl),\n\tDEFINEREG2(DDI_BUF_CTL_B, hsw_debug_ddi_buf_ctl),\n\tDEFINEREG2(DDI_BUF_CTL_C, hsw_debug_ddi_buf_ctl),\n\tDEFINEREG2(DDI_BUF_CTL_D, hsw_debug_ddi_buf_ctl),\n\tDEFINEREG2(DDI_BUF_CTL_E, hsw_debug_ddi_buf_ctl),\n\t\n\t/* Clocks */\n\tDEFINEREG(SPLL_CTL),\n\tDEFINEREG(LCPLL_CTL),\n\tDEFINEREG(WRPLL_CTL1),\n\tDEFINEREG(WRPLL_CTL2),\n\t\n\t/* DDI port clock control */\n\tDEFINEREG2(PORT_CLK_SEL_A, hsw_debug_port_clk_sel),\n\tDEFINEREG2(PORT_CLK_SEL_B, hsw_debug_port_clk_sel),\n\tDEFINEREG2(PORT_CLK_SEL_C, hsw_debug_port_clk_sel),\n\tDEFINEREG2(PORT_CLK_SEL_D, hsw_debug_port_clk_sel),\n\tDEFINEREG2(PORT_CLK_SEL_E, hsw_debug_port_clk_sel),\n\t\n\t/* Pipe clock control */\n\tDEFINEREG2(PIPE_CLK_SEL_A, hsw_debug_pipe_clk_sel),\n\tDEFINEREG2(PIPE_CLK_SEL_B, hsw_debug_pipe_clk_sel),\n\tDEFINEREG2(PIPE_CLK_SEL_C, hsw_debug_pipe_clk_sel),\n\t\n\t/* Fuses */\n\tDEFINEREG2(SFUSE_STRAP, hsw_debug_sfuse_strap),\n\t\n\t/* Pipe A */\n\tDEFINEREG2(PIPEASRC, i830_debug_yxminus1),\n\tDEFINEREG2(DSPACNTR, i830_debug_dspcntr),\n\tDEFINEREG2(DSPASTRIDE, ironlake_debug_dspstride),\n\tDEFINEREG(DSPASURF),\n\tDEFINEREG2(DSPATILEOFF, i830_debug_xy),\n\t\n\t/* Pipe B */\n\tDEFINEREG2(PIPEBSRC, i830_debug_yxminus1),\n\tDEFINEREG2(DSPBCNTR, i830_debug_dspcntr),\n\tDEFINEREG2(DSPBSTRIDE, ironlake_debug_dspstride),\n\tDEFINEREG(DSPBSURF),\n\tDEFINEREG2(DSPBTILEOFF, i830_debug_xy),\n\t\n\t/* Pipe C */\n\tDEFINEREG2(PIPECSRC, i830_debug_yxminus1),\n\tDEFINEREG2(DSPCCNTR, i830_debug_dspcntr),\n\tDEFINEREG2(DSPCSTRIDE, ironlake_debug_dspstride),\n\tDEFINEREG(DSPCSURF),\n\tDEFINEREG2(DSPCTILEOFF, i830_debug_xy),\n\t\n\t/* Transcoder A */\n\tDEFINEREG2(PIPEACONF, i830_debug_pipeconf),\n\tDEFINEREG2(HTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG(VSYNCSHIFT_A),\n\tDEFINEREG2(PIPEA_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEA_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEA_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(PIPEA_LINK_N1, ironlake_debug_n),\n\t\n\t/* Transcoder B */\n\tDEFINEREG2(PIPEBCONF, i830_debug_pipeconf),\n\tDEFINEREG2(HTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_B, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_B, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_B, i830_debug_hvsyncblank),\n\tDEFINEREG(VSYNCSHIFT_B),\n\tDEFINEREG2(PIPEB_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEB_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEB_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(PIPEB_LINK_N1, ironlake_debug_n),\n\t\n\t/* Transcoder C */\n\tDEFINEREG2(PIPECCONF, i830_debug_pipeconf),\n\tDEFINEREG2(HTOTAL_C, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_C, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_C, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_C, i830_debug_hvsyncblank),\n\tDEFINEREG(VSYNCSHIFT_C),\n\tDEFINEREG2(PIPEC_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEC_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEC_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(PIPEC_LINK_N1, ironlake_debug_n),\n\t\n\t/* Transcoder EDP */\n\tDEFINEREG2(PIPEEDPCONF, i830_debug_pipeconf),\n\tDEFINEREG2(HTOTAL_EDP, i830_debug_hvtotal),\n\tDEFINEREG2(HBLANK_EDP, i830_debug_hvsyncblank),\n\tDEFINEREG2(HSYNC_EDP, i830_debug_hvsyncblank),\n\tDEFINEREG2(VTOTAL_EDP, i830_debug_hvtotal),\n\tDEFINEREG2(VBLANK_EDP, i830_debug_hvsyncblank),\n\tDEFINEREG2(VSYNC_EDP, i830_debug_hvsyncblank),\n\tDEFINEREG(VSYNCSHIFT_EDP),\n\tDEFINEREG2(PIPEEDP_DATA_M1, ironlake_debug_m_tu),\n\tDEFINEREG2(PIPEEDP_DATA_N1, ironlake_debug_n),\n\tDEFINEREG2(PIPEEDP_LINK_M1, ironlake_debug_n),\n\tDEFINEREG2(PIPEEDP_LINK_N1, ironlake_debug_n),\n\t\n\t/* CPU Panel fitter */\n\tDEFINEREG2(PFA_CTL_1, ironlake_debug_panel_fitting),\n\tDEFINEREG2(PFA_WIN_POS, ironlake_debug_pf_win),\n\tDEFINEREG2(PFA_WIN_SIZE, ironlake_debug_pf_win),\n\t\n\tDEFINEREG2(PFB_CTL_1, ironlake_debug_panel_fitting),\n\tDEFINEREG2(PFB_WIN_POS, ironlake_debug_pf_win),\n\tDEFINEREG2(PFB_WIN_SIZE, ironlake_debug_pf_win),\n\t\n\tDEFINEREG2(PFC_CTL_1, ironlake_debug_panel_fitting),\n\tDEFINEREG2(PFC_WIN_POS, ironlake_debug_pf_win),\n\tDEFINEREG2(PFC_WIN_SIZE, ironlake_debug_pf_win),\n\t\n\t/* LPT */\n\tDEFINEREG2(TRANS_HTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_HBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_HSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VTOTAL_A, i830_debug_hvtotal),\n\tDEFINEREG2(TRANS_VBLANK_A, i830_debug_hvsyncblank),\n\tDEFINEREG2(TRANS_VSYNC_A, i830_debug_hvsyncblank),\n\tDEFINEREG(TRANS_VSYNCSHIFT_A),\n\t\n\tDEFINEREG2(TRANSACONF, ironlake_debug_transconf),\n\t\n\tDEFINEREG2(FDI_RXA_MISC, ironlake_debug_fdi_rx_misc),\n\tDEFINEREG(FDI_RXA_TUSIZE1),\n\tDEFINEREG(FDI_RXA_IIR),\n\tDEFINEREG(FDI_RXA_IMR),\n\t\n\tDEFINEREG2(BLC_PWM_CPU_CTL2, ilk_debug_blc_pwm_cpu_ctl2),\n\tDEFINEREG2(BLC_PWM_CPU_CTL, ilk_debug_blc_pwm_cpu_ctl),\n\tDEFINEREG2(BLC_PWM2_CPU_CTL2, ilk_debug_blc_pwm_cpu_ctl2),\n\tDEFINEREG2(BLC_PWM2_CPU_CTL, ilk_debug_blc_pwm_cpu_ctl),\n\tDEFINEREG2(BLC_MISC_CTL, hsw_debug_blc_misc_ctl),\n\tDEFINEREG2(BLC_PWM_PCH_CTL1, ibx_debug_blc_pwm_ctl1),\n\tDEFINEREG2(BLC_PWM_PCH_CTL2, ibx_debug_blc_pwm_ctl2),\n\t\n\tDEFINEREG2(UTIL_PIN_CTL, hsw_debug_util_pin_ctl),\n\t\n\tDEFINEREG2(PCH_PP_STATUS, i830_debug_pp_status),\n\tDEFINEREG2(PCH_PP_CONTROL, ilk_debug_pp_control),\n\tDEFINEREG(PCH_PP_ON_DELAYS),\n\tDEFINEREG(PCH_PP_OFF_DELAYS),\n\tDEFINEREG(PCH_PP_DIVISOR),\n\t\n\tDEFINEREG(PIXCLK_GATE),\n\t\n\tDEFINEREG2(SDEISR, hsw_debug_sinterrupt),\n\t\n\tDEFINEREG(RC6_RESIDENCY_TIME)\n};\n\n//------------------------------------------------------------------------------\n\nstatic struct reg_debug skylake_debug_regs[] = {\n\t/* DDI pipe function */\n\tDEFINEREG2(TRANS_DDI_FUNC_CTL_EDP,\thsw_debug_pipe_ddi_func_ctl),\n\tDEFINEREG2(TRANS_DDI_FUNC_CTL_A, hsw_debug_pipe_ddi_func_ctl),\n\tDEFINEREG2(TRANS_DDI_FUNC_CTL_B, hsw_debug_pipe_ddi_func_ctl),\n\tDEFINEREG2(TRANS_DDI_FUNC_CTL_C, hsw_debug_pipe_ddi_func_ctl),\n};\n\n//------------------------------------------------------------------------------\n\nstatic struct reg_debug i945gm_mi_regs[] = {\n\tDEFINEREG(PGETBL_CTL),\n\tDEFINEREG(PGTBL_ER),\n\tDEFINEREG(EXCC),\n\tDEFINEREG(HWS_PGA),\n\tDEFINEREG(IPEIR),\n\tDEFINEREG(IPEHR),\n\tDEFINEREG(INSTDONE),\n\tDEFINEREG(NOP_ID),\n\tDEFINEREG(HWSTAM),\n\tDEFINEREG(SCPD0),\n\tDEFINEREG(IER),\n\tDEFINEREG(IIR),\n\tDEFINEREG(IMR),\n\tDEFINEREG(ISR),\n\tDEFINEREG(EIR),\n\tDEFINEREG(EMR),\n\tDEFINEREG(ESR),\n\tDEFINEREG(INST_PM),\n\tDEFINEREG(ECOSKPD),\n};\n\n//------------------------------------------------------------------------------\n\n// void AppleIntelInto::intel_dump_other_regs(void)\n\nDEFINE_FUNC_VOID(AppleIntelInfo::intel_dump_other_regs)\n{\n\tint i;\n\tint fp, dpll;\n\tint disp_pipe;\n\tint n, m1, m2, m, p1, p2;\n\tint ref;\n\tint dot;\n\tint phase;\n\t\n\tfor (disp_pipe = 0; disp_pipe <= 1; disp_pipe++)\n\t{\n\t\tif (disp_pipe == 0)\n\t\t{\n\t\t\tfp = MMIO_READ32(FPA0);\n\t\t\tdpll = MMIO_READ32(DPLL_A);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfp = MMIO_READ32(FPB0);\n\t\t\tdpll = MMIO_READ32(DPLL_B);\n\t\t}\n\n\t\tif (IS_GEN2(devid))\n\t\t{\n\t\t\tuint32_t lvds = MMIO_READ32(LVDS);\n\n\t\t\tif (devid == PCI_CHIP_I855_GM && (lvds & LVDS_PORT_EN) && (lvds & LVDS_PIPEB_SELECT) == (disp_pipe << 30))\n\t\t\t{\n\t\t\t\tif ((lvds & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP)\n\t\t\t\t{\n\t\t\t\t\tp2 = 7;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp2 = 14;\n\t\t\t\t}\n\n\t\t\t\tswitch ((dpll >> 16) & 0x3f)\n\t\t\t\t{\n\t\t\t\t\tcase 0x01:\n\t\t\t\t\t\tp1 = 1;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0x02:\n\t\t\t\t\t\tp1 = 2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0x04:\n\t\t\t\t\t\tp1 = 3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0x08:\n\t\t\t\t\t\tp1 = 4;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0x10:\n\t\t\t\t\t\tp1 = 5;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 0x20:\n\t\t\t\t\t\tp1 = 6;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tp1 = 1;\n\t\t\t\t\t\tIOLOG(\"LVDS P1 0x%x invalid encoding\\n\", (dpll >> 16) & 0x3f);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tif (dpll & (1 << 23))\n\t\t\t\t{\n\t\t\t\t\tp2 = 4;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp2 = 2;\n\t\t\t\t}\n\n\t\t\t\tif (dpll & PLL_P1_DIVIDE_BY_TWO)\n\t\t\t\t{\n\t\t\t\t\tp1 = 2;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp1 = ((dpll >> 16) & 0x3f) + 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tswitch ((dpll >> 13) & 0x3)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tref = 48000;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tref = 66000;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tref = 0;\n\t\t\t\t\tIOLOG(\"ref out of range\\n\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tuint32_t lvds = MMIO_READ32(LVDS);\n\n\t\t\tif ((lvds & LVDS_PORT_EN) && (lvds & LVDS_PIPEB_SELECT) == (disp_pipe << 30))\n\t\t\t{\n\t\t\t\tif ((lvds & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP)\n\t\t\t\t{\n\t\t\t\t\tp2 = 7;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tp2 = 14;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tswitch ((dpll >> 24) & 0x3)\n\t\t\t\t{\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\tp2 = 10;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\tp2 = 5;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tp2 = 1;\n\t\t\t\t\t\tIOLOG(\"p2 out of range\\n\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (IS_IGD(devid))\n\t\t\t{\n\t\t\t\ti = (dpll >> DPLL_FPA01_P1_POST_DIV_SHIFT_IGD) & 0x1ff;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\ti = (dpll >> DPLL_FPA01_P1_POST_DIV_SHIFT) & 0xff;\n\t\t\t}\n\n\t\t\tswitch (i)\n\t\t\t{\n\t\t\t\tcase 1:\n\t\t\t\t\tp1 = 1;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\tp1 = 2;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\tp1 = 3;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 8:\n\t\t\t\t\tp1 = 4;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 16:\n\t\t\t\t\tp1 = 5;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 32:\n\t\t\t\t\tp1 = 6;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 64:\n\t\t\t\t\tp1 = 7;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 128:\n\t\t\t\t\tp1 = 8;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 256:\n\t\t\t\t\tif (IS_IGD(devid))\n\t\t\t\t\t{\n\t\t\t\t\t\tp1 = 9;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\t// fallback\n\t\t\t\tdefault:\n\t\t\t\t\tp1 = 1;\n\t\t\t\t\tIOLOG(\"p1 out of range\\n\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tswitch ((dpll >> 13) & 0x3)\n\t\t\t{\n\t\t\t\tcase 0:\n\t\t\t\t\tref = 96000;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\tref = 100000;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tref = 0;\n\t\t\t\t\tIOLOG(\"ref out of range\\n\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (IS_965(devid))\n\t\t{\n\t\t\tphase = (dpll >> 9) & 0xf;\n\n\t\t\tswitch (phase)\n\t\t\t{\n\t\t\t\tcase 6:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tIOLOG(\"SDVO phase shift %d out of range -- probably not an issue.\\n\", phase);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tswitch ((dpll >> 8) & 1)\n\t\t{\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tIOLOG(\"fp select out of range\\n\");\n\t\t\t\tbreak;\n\t\t}\n\n\t\tm1 = ((fp >> 8) & 0x3f);\n\n\t\tif (IS_IGD(devid))\n\t\t{\n\t\t\tn = ffs((fp & FP_N_IGD_DIV_MASK) >> FP_N_DIV_SHIFT) - 1;\n\t\t\tm2 = (fp & FP_M2_IGD_DIV_MASK) >> FP_M2_DIV_SHIFT;\n\t\t\tm = m2 + 2;\n\t\t\tdot = (ref * m) / n / (p1 * p2);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tn = ((fp >> 16) & 0x3f);\n\t\t\tm2 = ((fp >> 0) & 0x3f);\n\t\t\t//m = 5 * (m1 + 2) + (m2 + 2);\n\t\t\tdot = (ref * (5 * (m1 + 2) + (m2 + 2)) / (n + 2)) / (p1 * p2);\n\t\t}\n\t\t\n\t\tIOLOG(\"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);\n\t}\n}\n\n//------------------------------------------------------------------------------\n// void AppleIntelInfo::dumpRegisters(struct reg_debug *regs, uint32_t count)\n\nDEFINE_FUNC_DUMP(AppleIntelInfo::dumpRegisters)\n{\n\tchar name[30];\n\tchar debug[1024];\n\n\tfor (int i = 0; i < count; i++)\n\t{\n\t\tUInt32 val = MMIO_READ32((UInt64)regs[i].reg);\n\n\t\tmemset(name, 0, 30);\n\t\tmemset(debug, 0, 1024);\n\t\tmemcpy(name, regs[i].name, strlen(regs[i].name));\n\t\t//\t\t\t  \"123456789 123456789 1234567\"\n\t\tstrncat(name, \"...........................\", (27 - strlen(regs[i].name)));\n\n\t\tif (regs[i].debug_output != NULL)\n\t\t{\n\t\t\tregs[i].debug_output(debug, sizeof(debug), regs[i].reg, val);\n\t\t\tIOLOG(\"%s: 0x%08x (%s)\\n\", name, val, debug);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tIOLOG(\"%s: 0x%08x\\n\", name, val);\n\t\t}\n\t}\n}\n\n//------------------------------------------------------------------------------\n// void AppleIntelInfo::getPCHDeviceID(void)\n\nDEFINE_FUNC_VOID(AppleIntelInfo::getPCHDeviceID)\n{\n\toutl(0xcf8, 0x8000F800);\n\tUInt64 pch_device = inl(0xcfc);\n\n\tIOLOG(\"PCH device.................: 0x%llX\\n\", pch_device);\n\n\tif ((pch_device & 0x0000ffff) == 0x8086)\n\t{\n\t\tswitch ((pch_device & 0xff000000))\n\t\t{\n\t\t\tcase 0x3b000000:\n\t\t\t\tintel_pch = PCH_IBX;\n\t\t\t\tbreak;\n\t\t\tcase 0x1c000000:\n\t\t\tcase 0x1e000000:\n\t\t\t\tintel_pch = PCH_CPT;\n\t\t\t\tbreak;\n\t\t\tcase 0x8c000000:\n\t\t\tcase 0x9c000000:\n\t\t\t\tintel_pch = PCH_LPT;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tintel_pch = PCH_NONE;\n\t\t}\n\t}\n}\n\n//------------------------------------------------------------------------------\n// void AppleIntelInfo::reportIntelRegs(void)\n\nDEFINE_FUNC_VOID(AppleIntelInfo::reportIntelRegs)\n{\n\tgetPCHDeviceID();\n\n\toutl(0xcf8, 0x80001010);\n\tUInt64 mmio = (inl(0xcfc) & 0x7FFFC00000); // mask bits 38-22\n\n\tIOPhysicalAddress address = (IOPhysicalAddress)(mmio);\n\n\t// 16 MB combined for MMIO and Global GTT table aperture (2MB for MMIO, 6MB reserved and 8MB for GTT).\n\tIOMemoryDescriptor * memDescriptor = IOMemoryDescriptor::withPhysicalAddress(address, 0x1000000, kIODirectionInOut);\n\n\tif (memDescriptor != NULL)\n\t{\n\t\tIOReturn result = memDescriptor->prepare();\n\n\t\tif (result == kIOReturnSuccess)\n\t\t{\n\t\t\tIOMemoryMap * memoryMap = memDescriptor->map();\n\n\t\t\tif (memoryMap != NULL)\n\t\t\t{\n\t\t\t\tint64_t mmio = memoryMap->getVirtualAddress();\n\t\t\t\tgMMIOAddress = mmio;\n\n\t\t\t\tIOLOG(\"\\nIntel Register Data\\n------------------------------------\\nCPU_VGACNTRL...............: 0x%X\\n\", MMIO_READ32(CPU_VGACNTRL));\n\n\t\t\t\tif (IS_SKYLAKE(devid))\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"IS_SKYLAKE(devid)\\n\");\n\t\t\t\t\tintel_dump_regs(haswell_debug_regs);\n\t\t\t\t\tintel_dump_regs(skylake_debug_regs);\n\t\t\t\t}\n\t\t\t\telse if (IS_HASWELL(devid) || IS_BROADWELL(devid))\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"IS_HASWELL(devid) || IS_BROADWELL(devid)\\n\");\n\t\t\t\t\tintel_dump_regs(haswell_debug_regs);\n\t\t\t\t}\n\t\t\t\telse if (IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid))\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"IS_GEN5(devid) || IS_GEN6(devid) || IS_IVYBRIDGE(devid)\\n\");\n\t\t\t\t\tintel_dump_regs(ironlake_debug_regs);\n\t\t\t\t}\n\t\t\t\telse if (IS_945GM(devid))\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"IS_945GM(devid)\\n\");\n\t\t\t\t\tintel_dump_regs(i945gm_mi_regs);\n\t\t\t\t\tintel_dump_regs(intel_debug_regs);\n\t\t\t\t\tintel_dump_other_regs();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"IS_ELSE(devid)\\n\");\n\t\t\t\t\tintel_dump_regs(intel_debug_regs);\n\t\t\t\t\tintel_dump_other_regs();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (IS_GEN6(devid) || IS_GEN7(devid))\n\t\t\t\t{\n\t\t\t\t\tIOLOG(\"IS_GEN6(devid) || IS_GEN7(devid)\\n\");\n\t\t\t\t\tintel_dump_regs(gen6_fences);\n\t\t\t\t\tintel_dump_regs(gen6_rp_debug_regs);\n\t\t\t\t}\n\n\t\t\t\tmemoryMap->release();\n\t\t\t\tmemoryMap = NULL;\n\t\t\t}\n\t\t}\n\n\t\tmemDescriptor->release();\n\t\tmemDescriptor = NULL;\n\t}\n}\n\n"
  },
  {
    "path": "AppleIntelRegisterDumper/intel_chipset.h",
    "content": "/*\n * Copyright © 2007 Intel Corporation\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice (including the next\n * paragraph) shall be included in all copies or substantial portions of the\n * Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n *\n * Authors:\n *    Eric Anholt <eric@anholt.net>\n *\n */\n\n#ifndef _INTEL_CHIPSET_H\n#define _INTEL_CHIPSET_H\n\nUInt8 intel_pch = 0;\n\nenum pch_type {\n\tPCH_NONE,\n\tPCH_IBX,\n\tPCH_CPT,\n\tPCH_LPT,\n};\n\n#define HAS_IBX (intel_pch == PCH_IBX)\n#define HAS_CPT (intel_pch == PCH_CPT)\n#define HAS_LPT (intel_pch == PCH_LPT)\n\n/* Exclude chipset #defines, they just add noise */\n#ifndef __GTK_DOC_IGNORE__\n\n#define PCI_CHIP_I810\t\t\t0x7121\n#define PCI_CHIP_I810_DC100\t\t0x7123\n#define PCI_CHIP_I810_E\t\t\t0x7125\n#define PCI_CHIP_I815\t\t\t0x1132\n\n#define PCI_CHIP_I830_M\t\t\t0x3577\n#define PCI_CHIP_845_G\t\t\t0x2562\n#define PCI_CHIP_I855_GM\t\t0x3582\n#define PCI_CHIP_I865_G\t\t\t0x2572\n\n#define PCI_CHIP_I915_G\t\t\t0x2582\n#define PCI_CHIP_E7221_G\t\t0x258A\n#define PCI_CHIP_I915_GM\t\t0x2592\n#define PCI_CHIP_I945_G\t\t\t0x2772\n#define PCI_CHIP_I945_GM\t\t0x27A2\n#define PCI_CHIP_I945_GME\t\t0x27AE\n\n#define PCI_CHIP_Q35_G\t\t\t0x29B2\n#define PCI_CHIP_G33_G\t\t\t0x29C2\n#define PCI_CHIP_Q33_G\t\t\t0x29D2\n\n#define PCI_CHIP_IGD_GM\t\t\t0xA011\n#define PCI_CHIP_IGD_G\t\t\t0xA001\n\n#define IS_IGDGM(devid)\t\t((devid) == PCI_CHIP_IGD_GM)\n#define IS_IGDG(devid)\t\t((devid) == PCI_CHIP_IGD_G)\n#define IS_IGD(devid)\t\t(IS_IGDG(devid) || IS_IGDGM(devid))\n\n#define PCI_CHIP_I965_G\t\t\t0x29A2\n#define PCI_CHIP_I965_Q\t\t\t0x2992\n#define PCI_CHIP_I965_G_1\t\t0x2982\n#define PCI_CHIP_I946_GZ\t\t0x2972\n#define PCI_CHIP_I965_GM\t\t0x2A02\n#define PCI_CHIP_I965_GME\t\t0x2A12\n\n#define PCI_CHIP_GM45_GM\t\t0x2A42\n\n#define PCI_CHIP_IGD_E_G\t\t0x2E02\n#define PCI_CHIP_Q45_G\t\t\t0x2E12\n#define PCI_CHIP_G45_G\t\t\t0x2E22\n#define PCI_CHIP_G41_G\t\t\t0x2E32\n\n#define PCI_CHIP_ILD_G\t\t\t0x0042\n#define PCI_CHIP_ILM_G\t\t\t0x0046\n\n#define PCI_CHIP_SANDYBRIDGE_GT1\t0x0102 /* desktop */\n#define PCI_CHIP_SANDYBRIDGE_GT2\t0x0112\n#define PCI_CHIP_SANDYBRIDGE_GT2_PLUS\t0x0122\n#define PCI_CHIP_SANDYBRIDGE_M_GT1\t0x0106 /* mobile */\n#define PCI_CHIP_SANDYBRIDGE_M_GT2\t0x0116\n#define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS\t0x0126\n#define PCI_CHIP_SANDYBRIDGE_S\t\t0x010A /* server */\n\n#define PCI_CHIP_IVYBRIDGE_GT1\t\t0x0152 /* desktop */\n#define PCI_CHIP_IVYBRIDGE_GT2\t\t0x0162\n#define PCI_CHIP_IVYBRIDGE_M_GT1\t0x0156 /* mobile */\n#define PCI_CHIP_IVYBRIDGE_M_GT2\t0x0166\n#define PCI_CHIP_IVYBRIDGE_S\t\t0x015a /* server */\n#define PCI_CHIP_IVYBRIDGE_S_GT2\t0x016a /* server */\n\n#define PCI_CHIP_HASWELL_GT1\t\t0x0402 /* Desktop */\n#define PCI_CHIP_HASWELL_GT2\t\t0x0412\n#define PCI_CHIP_HASWELL_GT3\t\t0x0422\n#define PCI_CHIP_HASWELL_M_GT1\t\t0x0406 /* Mobile */\n#define PCI_CHIP_HASWELL_M_GT2\t\t0x0416\n#define PCI_CHIP_HASWELL_M_GT3\t\t0x0426\n#define PCI_CHIP_HASWELL_S_GT1\t\t0x040A /* Server */\n#define PCI_CHIP_HASWELL_S_GT2\t\t0x041A\n#define PCI_CHIP_HASWELL_S_GT3\t\t0x042A\n#define PCI_CHIP_HASWELL_B_GT1\t\t0x040B /* Reserved */\n#define PCI_CHIP_HASWELL_B_GT2\t\t0x041B\n#define PCI_CHIP_HASWELL_B_GT3\t\t0x042B\n#define PCI_CHIP_HASWELL_E_GT1\t\t0x040E /* Reserved */\n#define PCI_CHIP_HASWELL_E_GT2\t\t0x041E\n#define PCI_CHIP_HASWELL_E_GT3\t\t0x042E\n#define PCI_CHIP_HASWELL_SDV_GT1\t0x0C02 /* Desktop */\n#define PCI_CHIP_HASWELL_SDV_GT2\t0x0C12\n#define PCI_CHIP_HASWELL_SDV_GT3\t0x0C22\n#define PCI_CHIP_HASWELL_SDV_M_GT1\t0x0C06 /* Mobile */\n#define PCI_CHIP_HASWELL_SDV_M_GT2\t0x0C16\n#define PCI_CHIP_HASWELL_SDV_M_GT3\t0x0C26\n#define PCI_CHIP_HASWELL_SDV_S_GT1\t0x0C0A /* Server */\n#define PCI_CHIP_HASWELL_SDV_S_GT2\t0x0C1A\n#define PCI_CHIP_HASWELL_SDV_S_GT3\t0x0C2A\n#define PCI_CHIP_HASWELL_SDV_B_GT1\t0x0C0B /* Reserved */\n#define PCI_CHIP_HASWELL_SDV_B_GT2\t0x0C1B\n#define PCI_CHIP_HASWELL_SDV_B_GT3\t0x0C2B\n#define PCI_CHIP_HASWELL_SDV_E_GT1\t0x0C0E /* Reserved */\n#define PCI_CHIP_HASWELL_SDV_E_GT2\t0x0C1E\n#define PCI_CHIP_HASWELL_SDV_E_GT3\t0x0C2E\n#define PCI_CHIP_HASWELL_ULT_GT1\t0x0A02 /* Desktop */\n#define PCI_CHIP_HASWELL_ULT_GT2\t0x0A12\n#define PCI_CHIP_HASWELL_ULT_GT3\t0x0A22\n#define PCI_CHIP_HASWELL_ULT_M_GT1\t0x0A06 /* Mobile */\n#define PCI_CHIP_HASWELL_ULT_M_GT2\t0x0A16\n#define PCI_CHIP_HASWELL_ULT_M_GT3\t0x0A26\n#define PCI_CHIP_HASWELL_ULT_S_GT1\t0x0A0A /* Server */\n#define PCI_CHIP_HASWELL_ULT_S_GT2\t0x0A1A\n#define PCI_CHIP_HASWELL_ULT_S_GT3\t0x0A2A\n#define PCI_CHIP_HASWELL_ULT_B_GT1\t0x0A0B /* Reserved */\n#define PCI_CHIP_HASWELL_ULT_B_GT2\t0x0A1B\n#define PCI_CHIP_HASWELL_ULT_B_GT3\t0x0A2B\n#define PCI_CHIP_HASWELL_ULT_E_GT1\t0x0A0E /* Reserved */\n#define PCI_CHIP_HASWELL_ULT_E_GT2\t0x0A1E\n#define PCI_CHIP_HASWELL_ULT_E_GT3\t0x0A2E\n#define PCI_CHIP_HASWELL_CRW_GT1\t0x0D02 /* Desktop */\n#define PCI_CHIP_HASWELL_CRW_GT2\t0x0D12\n#define PCI_CHIP_HASWELL_CRW_GT3\t0x0D22\n#define PCI_CHIP_HASWELL_CRW_M_GT1\t0x0D06 /* Mobile */\n#define PCI_CHIP_HASWELL_CRW_M_GT2\t0x0D16\n#define PCI_CHIP_HASWELL_CRW_M_GT3\t0x0D26\n#define PCI_CHIP_HASWELL_CRW_S_GT1\t0x0D0A /* Server */\n#define PCI_CHIP_HASWELL_CRW_S_GT2\t0x0D1A\n#define PCI_CHIP_HASWELL_CRW_S_GT3\t0x0D2A\n#define PCI_CHIP_HASWELL_CRW_B_GT1\t0x0D0B /* Reserved */\n#define PCI_CHIP_HASWELL_CRW_B_GT2\t0x0D1B\n#define PCI_CHIP_HASWELL_CRW_B_GT3\t0x0D2B\n#define PCI_CHIP_HASWELL_CRW_E_GT1\t0x0D0E /* Reserved */\n#define PCI_CHIP_HASWELL_CRW_E_GT2\t0x0D1E\n#define PCI_CHIP_HASWELL_CRW_E_GT3\t0x0D2E\n#define BDW_SPARE\t\t\t\t\t0x2\n#define BDW_ULT\t\t\t\t\t\t0x6\n#define BDW_IRIS\t\t\t\t\t0xb\n#define BDW_SERVER\t\t\t\t\t0xa\n#define BDW_WORKSTATION\t\t\t\t0xd\n#define BDW_ULX\t\t\t\t\t\t0xe\n\n#define PCI_CHIP_VALLEYVIEW_PO\t\t0x0f30 /* VLV PO board */\n#define PCI_CHIP_VALLEYVIEW_1\t\t0x0f31\n#define PCI_CHIP_VALLEYVIEW_2\t\t0x0f32\n#define PCI_CHIP_VALLEYVIEW_3\t\t0x0f33\n\n#define PCI_CHIP_CHERRYVIEW_0\t\t0x22b0\n#define PCI_CHIP_CHERRYVIEW_1\t\t0x22b1\n#define PCI_CHIP_CHERRYVIEW_2\t\t0x22b2\n#define PCI_CHIP_CHERRYVIEW_3\t\t0x22b3\n\n#define PCI_CHIP_SKYLAKE_ULT_GT2\t0x1916\n#define PCI_CHIP_SKYLAKE_ULT_GT1\t0x1906\n#define PCI_CHIP_SKYLAKE_ULT_GT3\t0x1926\n#define PCI_CHIP_SKYLAKE_ULT_GT2F\t0x1921\n#define PCI_CHIP_SKYLAKE_ULX_GT1\t0x190E\n#define PCI_CHIP_SKYLAKE_ULX_GT2\t0x191E\n#define PCI_CHIP_SKYLAKE_DT_GT2\t\t0x1912\n#define PCI_CHIP_SKYLAKE_DT_GT1\t\t0x1902\n#define PCI_CHIP_SKYLAKE_HALO_GT2\t0x191B\n#define PCI_CHIP_SKYLAKE_HALO_GT3\t0x192B\n#define PCI_CHIP_SKYLAKE_HALO_GT1 \t0x190B\n#define PCI_CHIP_SKYLAKE_SRV_GT2\t0x191A\n#define PCI_CHIP_SKYLAKE_SRV_GT3\t0x192A\n#define PCI_CHIP_SKYLAKE_SRV_GT1\t0x190A\n#define PCI_CHIP_SKYLAKE_WKS_GT2 \t0x191D\n\n#define PCI_CHIP_BROXTON_0\t\t\t0x0A84\n#define PCI_CHIP_BROXTON_1\t\t\t0x1A84\n#define PCI_CHIP_BROXTON_2\t\t\t0x5A84\n\n#endif /* __GTK_DOC_IGNORE__ */\n\n#define IS_MOBILE(devid)\t((devid) == PCI_CHIP_I855_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I915_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I945_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I945_GME || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_GME || \\\n\t\t\t\t (devid) == PCI_CHIP_GM45_GM || IS_IGD(devid) || \\\n\t\t\t\t (devid) == PCI_CHIP_IVYBRIDGE_M_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_IVYBRIDGE_M_GT2)\n\n#define IS_G45(devid)\t\t((devid) == PCI_CHIP_IGD_E_G || \\\n\t\t\t\t (devid) == PCI_CHIP_Q45_G || \\\n\t\t\t\t (devid) == PCI_CHIP_G45_G || \\\n\t\t\t\t (devid) == PCI_CHIP_G41_G)\n#define IS_GM45(devid)\t\t((devid) == PCI_CHIP_GM45_GM)\n#define IS_G4X(devid)\t\t(IS_G45(devid) || IS_GM45(devid))\n\n#define IS_ILD(devid)\t\t((devid) == PCI_CHIP_ILD_G)\n#define IS_ILM(devid)\t\t((devid) == PCI_CHIP_ILM_G)\n\n#define IS_915(devid)\t\t((devid) == PCI_CHIP_I915_G || \\\n\t\t\t\t (devid) == PCI_CHIP_E7221_G || \\\n\t\t\t\t (devid) == PCI_CHIP_I915_GM)\n\n#define IS_945GM(devid)\t\t((devid) == PCI_CHIP_I945_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I945_GME)\n\n#define IS_945(devid)\t\t((devid) == PCI_CHIP_I945_G || \\\n\t\t\t\t (devid) == PCI_CHIP_I945_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I945_GME || \\\n\t\t\t\t IS_G33(devid))\n\n#define IS_G33(devid)\t\t((devid) == PCI_CHIP_G33_G || \\\n\t\t\t\t (devid) == PCI_CHIP_Q33_G || \\\n\t\t\t\t (devid) == PCI_CHIP_Q35_G || IS_IGD(devid))\n\n#define IS_GEN2(devid)\t\t((devid) == PCI_CHIP_I830_M || \\\n\t\t\t\t (devid) == PCI_CHIP_845_G || \\\n\t\t\t\t (devid) == PCI_CHIP_I855_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I865_G)\n\n#define IS_GEN3(devid)\t\t(IS_945(devid) || IS_915(devid))\n\n#define IS_GEN4(devid)\t\t((devid) == PCI_CHIP_I965_G || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_Q || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_G_1 || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_GME || \\\n\t\t\t\t (devid) == PCI_CHIP_I946_GZ || \\\n\t\t\t\t IS_G4X(devid))\n\n#define IS_GEN5(devid)\t\t(IS_ILD(devid) || IS_ILM(devid))\n\n#define IS_GEN6(devid)\t\t((devid) == PCI_CHIP_SANDYBRIDGE_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_SANDYBRIDGE_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_SANDYBRIDGE_GT2_PLUS || \\\n\t\t\t\t (devid) == PCI_CHIP_SANDYBRIDGE_M_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_SANDYBRIDGE_M_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS || \\\n\t\t\t\t (devid) == PCI_CHIP_SANDYBRIDGE_S)\n\n#define IS_GEN7(devid)\t\t(IS_IVYBRIDGE(devid) || \\\n\t\t\t\t IS_HASWELL(devid) || \\\n\t\t\t\t IS_VALLEYVIEW(devid))\n\n#define IS_IVYBRIDGE(devid)\t((devid) == PCI_CHIP_IVYBRIDGE_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_IVYBRIDGE_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_IVYBRIDGE_M_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_IVYBRIDGE_M_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_IVYBRIDGE_S || \\\n\t\t\t\t (devid) == PCI_CHIP_IVYBRIDGE_S_GT2)\n\n#define IS_VALLEYVIEW(devid)\t((devid) == PCI_CHIP_VALLEYVIEW_PO || \\\n\t\t\t\t (devid) == PCI_CHIP_VALLEYVIEW_1 || \\\n\t\t\t\t (devid) == PCI_CHIP_VALLEYVIEW_2 || \\\n\t\t\t\t (devid) == PCI_CHIP_VALLEYVIEW_3)\n\n#define IS_HSW_GT1(devid)\t((devid) == PCI_CHIP_HASWELL_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_M_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_S_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_B_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_E_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_M_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_S_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_B_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_E_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_M_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_S_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_B_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_E_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_M_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_S_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_B_GT1 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_E_GT1)\n#define IS_HSW_GT2(devid)\t((devid) == PCI_CHIP_HASWELL_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_M_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_S_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_B_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_E_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_M_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_S_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_B_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_E_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_M_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_S_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_B_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_E_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_M_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_S_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_B_GT2 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_E_GT2)\n#define IS_HSW_GT3(devid)\t((devid) == PCI_CHIP_HASWELL_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_M_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_S_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_B_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_E_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_M_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_S_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_B_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_SDV_E_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_M_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_S_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_B_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_ULT_E_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_M_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_S_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_B_GT3 || \\\n\t\t\t\t (devid) == PCI_CHIP_HASWELL_CRW_E_GT3)\n\n#define IS_HASWELL(devid)\t(IS_HSW_GT1(devid) || \\\n\t\t\t\t IS_HSW_GT2(devid) || \\\n\t\t\t\t IS_HSW_GT3(devid))\n\n#define IS_BROADWELL(devid)\t((((devid) & 0xff00) != 0x1600) ? 0 : \\\n\t\t\t\t((((devid) & 0x00f0) >> 4) > 3) ? 0 : \\\n\t\t\t\t (((devid) & 0x000f) == BDW_SPARE) ? 1 : \\\n\t\t\t\t (((devid) & 0x000f) == BDW_ULT) ? 1 : \\\n\t\t\t\t (((devid) & 0x000f) == BDW_IRIS) ? 1 : \\\n\t\t\t\t (((devid) & 0x000f) == BDW_SERVER) ? 1 : \\\n\t\t\t\t (((devid) & 0x000f) == BDW_WORKSTATION) ? 1 : \\\n\t\t\t\t (((devid) & 0x000f) == BDW_ULX) ? 1 : 0)\n\n#define IS_CHERRYVIEW(devid)\t((devid) == PCI_CHIP_CHERRYVIEW_0 || \\\n\t\t\t\t (devid) == PCI_CHIP_CHERRYVIEW_1 || \\\n\t\t\t\t (devid) == PCI_CHIP_CHERRYVIEW_2 || \\\n\t\t\t\t (devid) == PCI_CHIP_CHERRYVIEW_3)\n\n#define IS_GEN8(devid)\t\t(IS_BROADWELL(devid) || \\\n\t\t\t\t IS_CHERRYVIEW(devid))\n\n#define IS_SKL_GT1(devid)\t((devid) == PCI_CHIP_SKYLAKE_ULT_GT1\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_ULX_GT1\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_DT_GT1\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_HALO_GT1\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_SRV_GT1)\n\n#define IS_SKL_GT2(devid)\t((devid) == PCI_CHIP_SKYLAKE_ULT_GT2\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_ULT_GT2F\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_ULX_GT2\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_DT_GT2\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_HALO_GT2\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_SRV_GT2\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_WKS_GT2)\n\n#define IS_SKL_GT3(devid)\t((devid) == PCI_CHIP_SKYLAKE_ULT_GT3\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_HALO_GT3\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_SKYLAKE_SRV_GT3)\n\n#define IS_SKYLAKE(devid)\t(IS_SKL_GT1(devid) || \\\n\t\t\t\t IS_SKL_GT2(devid) || \\\n\t\t\t\t IS_SKL_GT3(devid))\n\n#define IS_BROXTON(devid)\t((devid) == PCI_CHIP_BROXTON_0\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_BROXTON_1\t|| \\\n\t\t\t\t (devid) == PCI_CHIP_BROXTON_2)\n\n#define IS_GEN9(devid)\t\t(IS_SKYLAKE(devid) || \\\n\t\t\t\t IS_BROXTON(devid))\n\n#define IS_965(devid)\t\t(IS_GEN4(devid) || \\\n\t\t\t\t IS_GEN5(devid) || \\\n\t\t\t\t IS_GEN6(devid) || \\\n\t\t\t\t IS_GEN7(devid) || \\\n\t\t\t\t IS_GEN8(devid))\n\n#define IS_9XX(devid)\t\t(IS_GEN3(devid) || \\\n\t\t\t\t IS_GEN4(devid) || \\\n\t\t\t\t IS_GEN5(devid) || \\\n\t\t\t\t IS_GEN6(devid) || \\\n\t\t\t\t IS_GEN7(devid) || \\\n\t\t\t\t IS_GEN8(devid) || \\\n\t\t\t\t IS_GEN9(devid))\n\n#define IS_INTEL(devid)\t\t(IS_GEN2(devid) || \\\n\t\t\t\t IS_GEN3(devid) || \\\n\t\t\t\t IS_GEN4(devid) || \\\n\t\t\t\t IS_GEN5(devid) || \\\n\t\t\t\t IS_GEN6(devid) || \\\n\t\t\t\t IS_GEN7(devid) || \\\n\t\t\t\t IS_GEN8(devid))\n\n#define HAS_PCH_SPLIT(devid)\t(IS_GEN5(devid) || \\\n\t\t\t\t IS_GEN6(devid) || \\\n\t\t\t\t IS_IVYBRIDGE(devid) || IS_HASWELL(devid) || \\\n\t\t\t\t IS_BROADWELL(devid) || \\\n\t\t\t\t IS_SKYLAKE(devid))\n\n#define HAS_BLT_RING(devid)\t(IS_GEN6(devid) || \\\n\t\t\t\t IS_GEN7(devid) || \\\n\t\t\t\t IS_GEN8(devid))\n\n#define HAS_BSD_RING(devid)\t(IS_GEN5(devid) || \\\n\t\t\t\t IS_GEN6(devid) || \\\n\t\t\t\t IS_GEN7(devid) || \\\n\t\t\t\t IS_GEN8(devid))\n\n#define IS_BROADWATER(devid)\t((devid) == PCI_CHIP_I946_GZ || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_G_1 || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_Q || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_G)\n\n#define IS_CRESTLINE(devid)\t((devid) == PCI_CHIP_I965_GM || \\\n\t\t\t\t (devid) == PCI_CHIP_I965_GME)\n\n#define HAS_VEBOX_RING(devid)   (IS_HASWELL(devid))\n\n#endif /* _INTEL_CHIPSET_H */\n"
  },
  {
    "path": "AppleIntelRegisterDumper/intel_reg.h",
    "content": "/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.13 2003/02/06 04:18:04 dawes Exp $ */\n/**************************************************************************\n\nCopyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.\nAll Rights Reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sub license, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice (including the\nnext paragraph) shall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\nIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR\nANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n**************************************************************************/\n\n/** @file\n * Register names and fields for Intel graphics.\n */\n\n/*\n * Authors:\n *   Keith Whitwell <keith@tungstengraphics.com>\n *   Eric Anholt <eric@anholt.net>\n *\n *   based on the i740 driver by\n *        Kevin E. Martin <kevin@precisioninsight.com> \n *   \n */\n\n#ifndef _I810_REG_H\n#define _I810_REG_H\n\n/* I/O register offsets\n */\n#define SRX 0x3C4\t\t/* p208 */\n#define GRX 0x3CE\t\t/* p213 */\n#define ARX 0x3C0\t\t/* p224 */\n\n/* VGA Color Palette Registers */\n#define DACMASK  0x3C6\t\t/* p232 */\n#define DACSTATE 0x3C7\t\t/* p232 */\n#define DACRX    0x3C7\t\t/* p233 */\n#define DACWX    0x3C8\t\t/* p233 */\n#define DACDATA  0x3C9\t\t/* p233 */\n\n/* CRT Controller Registers (CRX) */\n#define START_ADDR_HI        0x0C /* p246 */\n#define START_ADDR_LO        0x0D /* p247 */\n#define VERT_SYNC_END        0x11 /* p249 */\n#define EXT_VERT_TOTAL       0x30 /* p257 */\n#define EXT_VERT_DISPLAY     0x31 /* p258 */\n#define EXT_VERT_SYNC_START  0x32 /* p259 */\n#define EXT_VERT_BLANK_START 0x33 /* p260 */\n#define EXT_HORIZ_TOTAL      0x35 /* p261 */\n#define EXT_HORIZ_BLANK      0x39 /* p261 */\n#define EXT_START_ADDR       0x40 /* p262 */\n#define EXT_START_ADDR_ENABLE    0x80 \n#define EXT_OFFSET           0x41 /* p263 */\n#define EXT_START_ADDR_HI    0x42 /* p263 */\n#define INTERLACE_CNTL       0x70 /* p264 */\n#define INTERLACE_ENABLE         0x80 \n#define INTERLACE_DISABLE        0x00 \n\n/* Miscellaneous Output Register \n */\n#define MSR_R          0x3CC\t/* p207 */\n#define MSR_W          0x3C2\t/* p207 */\n#define IO_ADDR_SELECT     0x01\n\n#define MDA_BASE       0x3B0\t/* p207 */\n#define CGA_BASE       0x3D0\t/* p207 */\n\n/* CR80 - IO Control, p264\n */\n#define IO_CTNL            0x80\n#define EXTENDED_ATTR_CNTL     0x02\n#define EXTENDED_CRTC_CNTL     0x01\n\n/* GR10 - Address mapping, p221\n */\n#define ADDRESS_MAPPING    0x10\n#define PAGE_TO_LOCAL_MEM_ENABLE 0x10\n#define GTT_MEM_MAP_ENABLE     0x08\n#define PACKED_MODE_ENABLE     0x04\n#define LINEAR_MODE_ENABLE     0x02\n#define PAGE_MAPPING_ENABLE    0x01\n\n#define HOTKEY_VBIOS_SWITCH_BLOCK\t0x80\n#define HOTKEY_SWITCH\t\t\t0x20\n#define HOTKEY_TOGGLE\t\t\t0x10\n\n/* Blitter control, p378\n */\n#define BITBLT_CNTL        0x7000c\n#define COLEXP_MODE            0x30\n#define COLEXP_8BPP            0x00\n#define COLEXP_16BPP           0x10\n#define COLEXP_24BPP           0x20\n#define COLEXP_RESERVED        0x30\n#define BITBLT_STATUS          0x01\n\n#define CHDECMISC\t0x10111\n#define DCC\t\t\t0x10200\n#define C0DRB0\t\t\t0x10200\n#define C0DRB1\t\t\t0x10202\n#define C0DRB2\t\t\t0x10204\n#define C0DRB3\t\t\t0x10206\n#define C0DRA01\t\t\t0x10208\n#define C0DRA23\t\t\t0x1020a\n#define C1DRB0\t\t\t0x10600\n#define C1DRB1\t\t\t0x10602\n#define C1DRB2\t\t\t0x10604\n#define C1DRB3\t\t\t0x10606\n#define C1DRA01\t\t\t0x10608\n#define C1DRA23\t\t\t0x1060a\n\n/* p375. \n */\n#define DISPLAY_CNTL       0x70008\n#define VGA_WRAP_MODE          0x02\n#define VGA_WRAP_AT_256KB      0x00\n#define VGA_NO_WRAP            0x02\n#define GUI_MODE               0x01\n#define STANDARD_VGA_MODE      0x00\n#define HIRES_MODE             0x01\n\n/* p375\n */\n#define PIXPIPE_CONFIG_0   0x70009\n#define DAC_8_BIT              0x80\n#define DAC_6_BIT              0x00\n#define HW_CURSOR_ENABLE       0x10\n#define EXTENDED_PALETTE       0x01\n\n/* p375\n */\n#define PIXPIPE_CONFIG_1   0x7000a\n#define DISPLAY_COLOR_MODE     0x0F\n#define DISPLAY_VGA_MODE       0x00\n#define DISPLAY_8BPP_MODE      0x02\n#define DISPLAY_15BPP_MODE     0x04\n#define DISPLAY_16BPP_MODE     0x05\n#define DISPLAY_24BPP_MODE     0x06\n#define DISPLAY_32BPP_MODE     0x07\n\n/* p375\n */\n#define PIXPIPE_CONFIG_2   0x7000b\n#define DISPLAY_GAMMA_ENABLE   0x08\n#define DISPLAY_GAMMA_DISABLE  0x00\n#define OVERLAY_GAMMA_ENABLE   0x04\n#define OVERLAY_GAMMA_DISABLE  0x00\n\n\n/* p380\n */\n#define DISPLAY_BASE       0x70020\n#define DISPLAY_BASE_MASK  0x03fffffc\n\n\n/* Cursor control registers, pp383-384\n */\n/* Desktop (845G, 865G) */\n#define CURSOR_CONTROL     0x70080\n#define CURSOR_ENABLE          0x80000000\n#define CURSOR_GAMMA_ENABLE    0x40000000\n#define CURSOR_STRIDE_MASK     0x30000000\n#define CURSOR_FORMAT_SHIFT    24\n#define CURSOR_FORMAT_MASK     (0x07 << CURSOR_FORMAT_SHIFT)\n#define CURSOR_FORMAT_2C       (0x00 << CURSOR_FORMAT_SHIFT)\n#define CURSOR_FORMAT_3C       (0x01 << CURSOR_FORMAT_SHIFT)\n#define CURSOR_FORMAT_4C       (0x02 << CURSOR_FORMAT_SHIFT)\n#define CURSOR_FORMAT_ARGB     (0x04 << CURSOR_FORMAT_SHIFT)\n#define CURSOR_FORMAT_XRGB     (0x05 << CURSOR_FORMAT_SHIFT)\n\n/* Mobile and i810 */\n#define CURSOR_A_CONTROL   CURSOR_CONTROL\n#define CURSOR_ORIGIN_SCREEN   0x00\t/* i810 only */\n#define CURSOR_ORIGIN_DISPLAY  0x1\t/* i810 only */\n#define CURSOR_MODE            0x27\n#define CURSOR_MODE_DISABLE    0x00\n#define CURSOR_MODE_32_4C_AX   0x01\t/* i810 only */\n#define CURSOR_MODE_64_3C      0x04\n#define CURSOR_MODE_64_4C_AX   0x05\n#define CURSOR_MODE_64_4C      0x06\n#define CURSOR_MODE_64_32B_AX  0x07\n#define CURSOR_MODE_64_ARGB_AX (0x20 | CURSOR_MODE_64_32B_AX)\n#define MCURSOR_PIPE_SELECT    (1 << 28)\n#define MCURSOR_PIPE_A         0x00\n#define MCURSOR_PIPE_B         (1 << 28)\n#define MCURSOR_GAMMA_ENABLE   (1 << 26)\n#define MCURSOR_MEM_TYPE_LOCAL (1 << 25)\n\n\n#define CURSOR_BASEADDR    0x70084\n#define CURSOR_A_BASE      CURSOR_BASEADDR\n#define CURSOR_BASEADDR_MASK 0x1FFFFF00\n#define CURSOR_A_POSITION  0x70088\n#define CURSOR_POS_SIGN        0x8000\n#define CURSOR_POS_MASK        0x007FF\n#define CURSOR_X_SHIFT\t       0\n#define CURSOR_Y_SHIFT         16\n#define CURSOR_X_LO        0x70088\n#define CURSOR_X_HI        0x70089\n#define CURSOR_X_POS           0x00\n#define CURSOR_X_NEG           0x80\n#define CURSOR_Y_LO        0x7008A\n#define CURSOR_Y_HI        0x7008B\n#define CURSOR_Y_POS           0x00\n#define CURSOR_Y_NEG           0x80\n\n#define CURSOR_A_PALETTE0  0x70090\n#define CURSOR_A_PALETTE1  0x70094\n#define CURSOR_A_PALETTE2  0x70098\n#define CURSOR_A_PALETTE3  0x7009C\n\n#define CURSOR_SIZE\t   0x700A0\n#define CURSOR_SIZE_MASK       0x3FF\n#define CURSOR_SIZE_HSHIFT     0\n#define CURSOR_SIZE_VSHIFT     12\n\n#define CURSOR_B_CONTROL   0x700C0\n#define CURSOR_B_BASE      0x700C4\n#define CURSOR_B_POSITION  0x700C8\n#define CURSOR_B_PALETTE0  0x700D0\n#define CURSOR_B_PALETTE1  0x700D4\n#define CURSOR_B_PALETTE2  0x700D8\n#define CURSOR_B_PALETTE3  0x700DC\n\n\n/* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm\n * not sure they refer to local (graphics) memory.\n *\n * These details are for the local memory control registers,\n * (pp301-310).  The test machines are not equiped with local memory,\n * so nothing is tested.  Only a single row seems to be supported.\n */\n#define DRAM_ROW_TYPE      0x3000\n#define DRAM_ROW_0             0x01\n#define DRAM_ROW_0_SDRAM       0x01\n#define DRAM_ROW_0_EMPTY       0x00\n#define DRAM_ROW_CNTL_LO   0x3001\n#define DRAM_PAGE_MODE_CTRL    0x10\n#define DRAM_RAS_TO_CAS_OVRIDE 0x08\n#define DRAM_CAS_LATENCY       0x04\n#define DRAM_RAS_TIMING        0x02\n#define DRAM_RAS_PRECHARGE     0x01\n#define DRAM_ROW_CNTL_HI   0x3002\n#define DRAM_REFRESH_RATE      0x18\n#define DRAM_REFRESH_DISABLE   0x00\n#define DRAM_REFRESH_60HZ      0x08\n#define DRAM_REFRESH_FAST_TEST 0x10\n#define DRAM_REFRESH_RESERVED  0x18\n#define DRAM_SMS               0x07\n#define DRAM_SMS_NORMAL        0x00\n#define DRAM_SMS_NOP_ENABLE    0x01\n#define DRAM_SMS_ABPCE         0x02\n#define DRAM_SMS_MRCE          0x03\n#define DRAM_SMS_CBRCE         0x04\n\n/* p307\n */\n#define DPMS_SYNC_SELECT   0x5002\n#define VSYNC_CNTL             0x08\n#define VSYNC_ON               0x00\n#define VSYNC_OFF              0x08\n#define HSYNC_CNTL             0x02\n#define HSYNC_ON               0x00\n#define HSYNC_OFF              0x02\n\n#define GPIOA\t\t\t0x5010\n#define GPIOB\t\t\t0x5014\n#define GPIOC\t\t\t0x5018\n#define GPIOD\t\t\t0x501c\n#define GPIOE\t\t\t0x5020\n#define GPIOF\t\t\t0x5024\n#define GPIOG\t\t\t0x5028\n#define GPIOH\t\t\t0x502c\n# define GPIO_CLOCK_DIR_MASK\t\t(1 << 0)\n# define GPIO_CLOCK_DIR_IN\t\t(0 << 1)\n# define GPIO_CLOCK_DIR_OUT\t\t(1 << 1)\n# define GPIO_CLOCK_VAL_MASK\t\t(1 << 2)\n# define GPIO_CLOCK_VAL_OUT\t\t(1 << 3)\n# define GPIO_CLOCK_VAL_IN\t\t(1 << 4)\n# define GPIO_CLOCK_PULLUP_DISABLE\t(1 << 5)\n# define GPIO_DATA_DIR_MASK\t\t(1 << 8)\n# define GPIO_DATA_DIR_IN\t\t(0 << 9)\n# define GPIO_DATA_DIR_OUT\t\t(1 << 9)\n# define GPIO_DATA_VAL_MASK\t\t(1 << 10)\n# define GPIO_DATA_VAL_OUT\t\t(1 << 11)\n# define GPIO_DATA_VAL_IN\t\t(1 << 12)\n# define GPIO_DATA_PULLUP_DISABLE\t(1 << 13)\n\n/* GMBus registers for hardware-assisted (non-bitbanging) I2C access */\n#define GMBUS0\t\t\t0x5100\n#define GMBUS1\t\t\t0x5104\n#define GMBUS2\t\t\t0x5108\n#define GMBUS3\t\t\t0x510c\n#define GMBUS4\t\t\t0x5110\n#define GMBUS5\t\t\t0x5120\n\n/* p317, 319\n */\n#define VCLK2_VCO_M        0x6008 /* treat as 16 bit? (includes msbs) */\n#define VCLK2_VCO_N        0x600a\n#define VCLK2_VCO_DIV_SEL  0x6012\n\n#define VCLK_DIVISOR_VGA0   0x6000\n#define VCLK_DIVISOR_VGA1   0x6004\n#define VCLK_POST_DIV\t    0x6010\n/** Selects a post divisor of 4 instead of 2. */\n# define VGA1_PD_P2_DIV_4\t(1 << 15)\n/** Overrides the p2 post divisor field */\n# define VGA1_PD_P1_DIV_2\t(1 << 13)\n# define VGA1_PD_P1_SHIFT\t8\n/** P1 value is 2 greater than this field */\n# define VGA1_PD_P1_MASK\t(0x1f << 8)\n/** Selects a post divisor of 4 instead of 2. */\n# define VGA0_PD_P2_DIV_4\t(1 << 7)\n/** Overrides the p2 post divisor field */\n# define VGA0_PD_P1_DIV_2\t(1 << 5)\n# define VGA0_PD_P1_SHIFT\t0\n/** P1 value is 2 greater than this field */\n# define VGA0_PD_P1_MASK\t(0x1f << 0)\n\n#define POST_DIV_SELECT        0x70\n#define POST_DIV_1             0x00\n#define POST_DIV_2             0x10\n#define POST_DIV_4             0x20\n#define POST_DIV_8             0x30\n#define POST_DIV_16            0x40\n#define POST_DIV_32            0x50\n#define VCO_LOOP_DIV_BY_4M     0x00\n#define VCO_LOOP_DIV_BY_16M    0x04\n\n\n/* Instruction Parser Mode Register \n *    - p281\n *    - 2 new bits.\n */\n#define INST_PM                  0x20c0\t\n#define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */\n#define SYNC_PACKET_FLUSH_ENABLE     0x10\n#define TWO_D_INST_DISABLE           0x08\n#define THREE_D_INST_DISABLE         0x04\n#define STATE_VAR_UPDATE_DISABLE     0x02\n#define PAL_STIP_DISABLE             0x01\n#define GEN6_GLOBAL_DEBUG_ENABLE     0x10\n\n\n#define MEMMODE                  0x20dc\n\n\n/* Instruction parser error register.  p279\n */\n#define IPEIR                  0x2088\n#define IPEHR                  0x208C\n\n#define INSTDONE                0x2090\n#define NOP_ID                   0x2094\n\n#define SCPD0                    0x209c\t/* debug */\n#define INST_PS                  0x20c4\n#define IPEIR_I965                  0x2064 /* i965 */\n#define IPEHR_I965                  0x2068 /* i965 */\n#define INSTDONE_I965              0x206c\n#define GEN6_INSTDONE_1\t\t0x206c\n#define INST_PS_I965                0x2070\n\n/* Current active ring head address: \n */\n#define ACTHD_I965                 0x2074\n#define ACTHD\t\t\t   0x20C8\n\n/* Current primary/secondary DMA fetch addresses:\n */\n#define DMA_FADD_P             0x2078\n#define DMA_FADD_S               0x20d4\n#define INSTDONE_1              0x207c\n#define GEN6_INSTDONE_2\t\t0x207c\n\n#define CACHE_MODE_0           0x2120\n#define CACHE_MODE_1           0x2124\n#define MI_MODE\t\t       0x209c\n#define MI_DISPLAY_POWER_DOWN  0x20e0\n#define MI_ARB_STATE           0x20e4\n#define MI_RDRET_STATE\t       0x20fc\n\n/* Start addresses for each of the primary rings:\n */\n#define PR0_STR                  0x20f0\n#define PR1_STR                  0x20f4\n#define PR2_STR                  0x20f8\n\n#define WIZ_CTL                0x7c00\n#define WIZ_CTL_SINGLE_SUBSPAN  (1<<6)\n#define WIZ_CTL_IGNORE_STALLS  (1<<5)\n\n#define SVG_WORK_CTL           0x7408\n\n#define TS_CTL                 0x7e00\n#define TS_MUX_ERR_CODE        (0<<8)\n#define TS_MUX_URB_0           (1<<8)\n#define TS_MUX_DISPATCH_ID_0   (10<<8)\n#define TS_MUX_ERR_CODE_VALID  (15<<8)\n#define TS_MUX_TID_0           (16<<8)\n#define TS_MUX_EUID_0          (18<<8)\n#define TS_MUX_FFID_0          (22<<8)\n#define TS_MUX_EOT             (26<<8)\n#define TS_MUX_SIDEBAND_0      (27<<8)\n#define TS_SNAP_ALL_CHILD      (1<<2)\n#define TS_SNAP_ALL_ROOT       (1<<1)\n#define TS_SNAP_ENABLE         (1<<0)\n\n#define TS_DEBUG_DATA          0x7e0c\n\n#define TD_CTL                 0x8000\n#define TD_CTL2                0x8004\n\n\n#define ECOSKPD 0x21d0\n#define EXCC    0x2028\n\n/* I965 debug regs:\n */\n#define IA_VERTICES_COUNT_QW   0x2310\n#define IA_PRIMITIVES_COUNT_QW 0x2318\n#define VS_INVOCATION_COUNT_QW 0x2320\n#define GS_INVOCATION_COUNT_QW 0x2328\n#define GS_PRIMITIVES_COUNT_QW 0x2330\n#define CL_INVOCATION_COUNT_QW 0x2338\n#define CL_PRIMITIVES_COUNT_QW 0x2340\n#define PS_INVOCATION_COUNT_QW 0x2348\n#define PS_DEPTH_COUNT_QW      0x2350\n#define TIMESTAMP_QW           0x2358\n#define CLKCMP_QW              0x2360\n\n\n\n\n\n\n/* General error reporting regs, p296\n */\n#define EIR               0x20B0\n#define EMR               0x20B4\n#define ESR               0x20B8\n# define ERR_VERTEX_MAX\t\t\t\t(1 << 5) /* lpt/cst */\n# define ERR_PGTBL_ERROR\t\t\t(1 << 4)\n# define ERR_DISPLAY_OVERLAY_UNDERRUN\t\t(1 << 3)\n# define ERR_MAIN_MEMORY_REFRESH\t\t(1 << 1)\n# define ERR_INSTRUCTION_ERROR\t\t\t(1 << 0)\n\n\n/* Interrupt Control Registers \n *   - new bits for i810\n *   - new register hwstam (mask)\n */\n#define HWS_PGA\t\t     0x2080\n#define PWRCTXA\t\t     0x2088 /* 965GM+ only */\n#define   PWRCTX_EN\t     (1<<0)\n#define HWSTAM               0x2098 /* p290 */\n#define IER                  0x20a0 /* p291 */\n#define IIR                  0x20a4 /* p292 */\n#define IMR                  0x20a8 /* p293 */\n#define ISR                  0x20ac /* p294 */\n#define HW_ERROR                 0x8000\n#define SYNC_STATUS_TOGGLE       0x1000\n#define DPY_0_FLIP_PENDING       0x0800\n#define DPY_1_FLIP_PENDING       0x0400\t/* not implemented on i810 */\n#define OVL_0_FLIP_PENDING       0x0200\n#define OVL_1_FLIP_PENDING       0x0100\t/* not implemented on i810 */\n#define DPY_0_VBLANK             0x0080\n#define DPY_0_EVENT              0x0040\n#define DPY_1_VBLANK             0x0020\t/* not implemented on i810 */\n#define DPY_1_EVENT              0x0010\t/* not implemented on i810 */\n#define HOST_PORT_EVENT          0x0008\t/*  */\n#define CAPTURE_EVENT            0x0004\t/*  */\n#define USER_DEFINED             0x0002\n#define BREAKPOINT               0x0001\n\n\n#define INTR_RESERVED            (0x6000 | \t\t\\\n\t\t\t\t  DPY_1_FLIP_PENDING |\t\\\n\t\t\t\t  OVL_1_FLIP_PENDING |\t\\\n\t\t\t\t  DPY_1_VBLANK |\t\\\n\t\t\t\t  DPY_1_EVENT |\t\t\\\n\t\t\t\t  HOST_PORT_EVENT |\t\\\n\t\t\t\t  CAPTURE_EVENT )\n\n/* FIFO Watermark and Burst Length Control Register \n *\n * - different offset and contents on i810 (p299) (fewer bits per field)\n * - some overlay fields added\n * - what does it all mean?\n */\n#define FWATER_BLC       0x20d8\n#define FWATER_BLC2\t 0x20dc\n#define MM_BURST_LENGTH     0x00700000\n#define MM_FIFO_WATERMARK   0x0001F000\n#define LM_BURST_LENGTH     0x00000700\n#define LM_FIFO_WATERMARK   0x0000001F\n\n\n/* Fence/Tiling ranges [0..7]\n */\n#define FENCE            0x2000\n#define FENCE_NR         8\n\n#define FENCE_NEW        0x3000\n#define FENCE_NEW_NR     16\n\n#define FENCE_LINEAR     0\n#define FENCE_XMAJOR\t 1\n#define FENCE_YMAJOR  \t 2\n\n#define I915G_FENCE_START_MASK\t0x0ff00000\n\n#define I830_FENCE_START_MASK\t0x07f80000\n\n#define FENCE_START_MASK    0x03F80000\n#define FENCE_X_MAJOR       0x00000000\n#define FENCE_Y_MAJOR       0x00001000\n#define FENCE_SIZE_MASK     0x00000700\n#define FENCE_SIZE_512K     0x00000000\n#define FENCE_SIZE_1M       0x00000100\n#define FENCE_SIZE_2M       0x00000200\n#define FENCE_SIZE_4M       0x00000300\n#define FENCE_SIZE_8M       0x00000400\n#define FENCE_SIZE_16M      0x00000500\n#define FENCE_SIZE_32M      0x00000600\n#define FENCE_SIZE_64M\t    0x00000700\n#define I915G_FENCE_SIZE_1M       0x00000000\n#define I915G_FENCE_SIZE_2M       0x00000100\n#define I915G_FENCE_SIZE_4M       0x00000200\n#define I915G_FENCE_SIZE_8M       0x00000300\n#define I915G_FENCE_SIZE_16M      0x00000400\n#define I915G_FENCE_SIZE_32M      0x00000500\n#define I915G_FENCE_SIZE_64M\t0x00000600\n#define I915G_FENCE_SIZE_128M\t0x00000700\n#define I965_FENCE_X_MAJOR\t0x00000000\n#define I965_FENCE_Y_MAJOR\t0x00000002\n#define FENCE_PITCH_1       0x00000000\n#define FENCE_PITCH_2       0x00000010\n#define FENCE_PITCH_4       0x00000020\n#define FENCE_PITCH_8       0x00000030\n#define FENCE_PITCH_16      0x00000040\n#define FENCE_PITCH_32      0x00000050\n#define FENCE_PITCH_64\t    0x00000060\n#define FENCE_VALID         0x00000001\n\n#define FENCE_REG_SANDYBRIDGE_0\t\t0x100000\n\n/* Registers to control page table, p274\n */\n#define PGETBL_CTL       0x2020\n#define PGETBL_ADDR_MASK    0xFFFFF000\n#define PGETBL_ENABLE_MASK  0x00000001\n#define PGETBL_ENABLED      0x00000001\n/** Added in 965G, this field has the actual size of the global GTT */\n#define PGETBL_SIZE_MASK    0x0000000e\n#define PGETBL_SIZE_512KB   (0 << 1)\n#define PGETBL_SIZE_256KB   (1 << 1)\n#define PGETBL_SIZE_128KB   (2 << 1)\n#define PGETBL_SIZE_1MB     (3 << 1)\n#define PGETBL_SIZE_2MB     (4 << 1)\n#define PGETBL_SIZE_1_5MB   (5 << 1)\n#define G33_PGETBL_SIZE_MASK\t\t(3 << 8)\n#define G33_PGETBL_SIZE_1M\t\t(1 << 8)\n#define G33_PGETBL_SIZE_2M\t\t(2 << 8)\n\n#define I830_PTE_BASE\t\t\t0x10000\n#define PTE_ADDRESS_MASK\t\t0xfffff000\n#define PTE_ADDRESS_MASK_HIGH\t\t0x000000f0 /* i915+ */\n#define PTE_MAPPING_TYPE_UNCACHED\t(0 << 1)\n#define PTE_MAPPING_TYPE_DCACHE\t\t(1 << 1) /* i830 only */\n#define PTE_MAPPING_TYPE_CACHED\t\t(3 << 1)\n#define PTE_MAPPING_TYPE_MASK\t\t(3 << 1)\n#define PTE_VALID\t\t\t(1 << 0)\n\n/** @defgroup PGE_ERR\n * @{\n */\n/** Page table debug register for i845 */\n#define PGE_ERR          0x2024\n#define PGE_ERR_ADDR_MASK   0xFFFFF000\n#define PGE_ERR_ID_MASK     0x00000038\n#define PGE_ERR_CAPTURE     0x00000000\n#define PGE_ERR_OVERLAY     0x00000008\n#define PGE_ERR_DISPLAY     0x00000010\n#define PGE_ERR_HOST        0x00000018\n#define PGE_ERR_RENDER      0x00000020\n#define PGE_ERR_BLITTER     0x00000028\n#define PGE_ERR_MAPPING     0x00000030\n#define PGE_ERR_CMD_PARSER  0x00000038\n#define PGE_ERR_TYPE_MASK   0x00000007\n#define PGE_ERR_INV_TABLE   0x00000000\n#define PGE_ERR_INV_PTE     0x00000001\n#define PGE_ERR_MIXED_TYPES 0x00000002\n#define PGE_ERR_PAGE_MISS   0x00000003\n#define PGE_ERR_ILLEGAL_TRX 0x00000004\n#define PGE_ERR_LOCAL_MEM   0x00000005\n#define PGE_ERR_TILED       0x00000006\n/** @} */\n\n/** @defgroup PGTBL_ER\n * @{\n */\n/** Page table debug register for i945 */\n# define PGTBL_ER\t0x2024\n# define PGTBL_ERR_MT_TILING\t\t\t(1 << 27)\n# define PGTBL_ERR_MT_GTT_PTE\t\t\t(1 << 26)\n# define PGTBL_ERR_LC_TILING\t\t\t(1 << 25)\n# define PGTBL_ERR_LC_GTT_PTE\t\t\t(1 << 24)\n# define PGTBL_ERR_BIN_VERTEXDATA_GTT_PTE\t(1 << 23)\n# define PGTBL_ERR_BIN_INSTRUCTION_GTT_PTE\t(1 << 22)\n# define PGTBL_ERR_CS_VERTEXDATA_GTT_PTE\t(1 << 21)\n# define PGTBL_ERR_CS_INSTRUCTION_GTT_PTE\t(1 << 20)\n# define PGTBL_ERR_CS_GTT\t\t(1 << 19)\n# define PGTBL_ERR_OVERLAY_TILING\t\t(1 << 18)\n# define PGTBL_ERR_OVERLAY_GTT_PTE\t\t(1 << 16)\n# define PGTBL_ERR_DISPC_TILING\t\t\t(1 << 14)\n# define PGTBL_ERR_DISPC_GTT_PTE\t\t(1 << 12)\n# define PGTBL_ERR_DISPB_TILING\t\t\t(1 << 10)\n# define PGTBL_ERR_DISPB_GTT_PTE\t\t(1 << 8)\n# define PGTBL_ERR_DISPA_TILING\t\t\t(1 << 6)\n# define PGTBL_ERR_DISPA_GTT_PTE\t\t(1 << 4)\n# define PGTBL_ERR_HOST_PTE_DATA\t\t(1 << 1)\n# define PGTBL_ERR_HOST_GTT_PTE\t\t\t(1 << 0)\n/** @} */\n\n/* Ring buffer registers, p277, overview p19\n */\n#define LP_RING     0x2030\n#define HP_RING     0x2040\n\n#define RING_TAIL      0x00\n#define TAIL_ADDR           0x000FFFF8\n#define I830_TAIL_MASK\t    0x001FFFF8\n\n#define RING_HEAD      0x04\n#define HEAD_WRAP_COUNT     0xFFE00000\n#define HEAD_WRAP_ONE       0x00200000\n#define HEAD_ADDR           0x001FFFFC\n#define I830_HEAD_MASK      0x001FFFFC\n\n#define RING_START     0x08\n#define START_ADDR          0x03FFFFF8\n#define I830_RING_START_MASK\t0xFFFFF000\n\n#define RING_LEN       0x0C\n#define RING_NR_PAGES       0x001FF000 \n#define I830_RING_NR_PAGES\t0x001FF000\n#define RING_REPORT_MASK    0x00000006\n#define RING_REPORT_64K     0x00000002\n#define RING_REPORT_128K    0x00000004\n#define RING_NO_REPORT      0x00000000\n#define RING_VALID_MASK     0x00000001\n#define RING_VALID          0x00000001\n#define RING_INVALID        0x00000000\n\n\n\n/* BitBlt Instructions\n *\n * There are many more masks & ranges yet to add.\n */\n#define BR00_BITBLT_CLIENT   0x40000000\n#define BR00_OP_COLOR_BLT    0x10000000\n#define BR00_OP_SRC_COPY_BLT 0x10C00000\n#define BR00_OP_FULL_BLT     0x11400000\n#define BR00_OP_MONO_SRC_BLT 0x11800000\n#define BR00_OP_MONO_SRC_COPY_BLT 0x11000000\n#define BR00_OP_MONO_PAT_BLT 0x11C00000\n#define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)\n#define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000\n\n\n#define BR00_TPCY_DISABLE    0x00000000\n#define BR00_TPCY_ENABLE     0x00000010\n\n#define BR00_TPCY_ROP        0x00000000\n#define BR00_TPCY_NO_ROP     0x00000020\n#define BR00_TPCY_EQ         0x00000000\n#define BR00_TPCY_NOT_EQ     0x00000040\n\n#define BR00_PAT_MSB_FIRST   0x00000000\t/* ? */\n\n#define BR00_PAT_VERT_ALIGN  0x000000e0\n\n#define BR00_LENGTH          0x0000000F\n\n#define BR09_DEST_ADDR       0x03FFFFFF\n\n#define BR11_SOURCE_PITCH    0x00003FFF\n\n#define BR12_SOURCE_ADDR     0x03FFFFFF\n\n#define BR13_SOLID_PATTERN   0x80000000\n#define BR13_RIGHT_TO_LEFT   0x40000000\n#define BR13_LEFT_TO_RIGHT   0x00000000\n#define BR13_MONO_TRANSPCY   0x20000000\n#define BR13_MONO_PATN_TRANS 0x10000000\n#define BR13_USE_DYN_DEPTH   0x04000000\n#define BR13_DYN_8BPP        0x00000000\n#define BR13_DYN_16BPP       0x01000000\n#define BR13_DYN_24BPP       0x02000000\n#define BR13_ROP_MASK        0x00FF0000\n#define BR13_DEST_PITCH      0x0000FFFF\n#define BR13_PITCH_SIGN_BIT  0x00008000\n\n#define BR14_DEST_HEIGHT     0xFFFF0000\n#define BR14_DEST_WIDTH      0x0000FFFF\n\n#define BR15_PATTERN_ADDR    0x03FFFFFF\n\n#define BR16_SOLID_PAT_COLOR 0x00FFFFFF\n#define BR16_BACKGND_PAT_CLR 0x00FFFFFF\n\n#define BR17_FGND_PAT_CLR    0x00FFFFFF\n\n#define BR18_SRC_BGND_CLR    0x00FFFFFF\n#define BR19_SRC_FGND_CLR    0x00FFFFFF\n\n\n/* Instruction parser instructions\n */\n\n#define INST_PARSER_CLIENT   0x00000000\n#define INST_OP_FLUSH        0x02000000\n#define INST_FLUSH_MAP_CACHE 0x00000001\n\n\n#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))\n\n\n/* Registers in the i810 host-pci bridge pci config space which affect\n * the i810 graphics operations.  \n */\n#define SMRAM_MISCC         0x70\n#define GMS                    0x000000c0\n#define GMS_DISABLE            0x00000000\n#define GMS_ENABLE_BARE        0x00000040\n#define GMS_ENABLE_512K        0x00000080\n#define GMS_ENABLE_1M          0x000000c0\n#define USMM                   0x00000030 \n#define USMM_DISABLE           0x00000000\n#define USMM_TSEG_ZERO         0x00000010\n#define USMM_TSEG_512K         0x00000020\n#define USMM_TSEG_1M           0x00000030  \n#define GFX_MEM_WIN_SIZE       0x00010000\n#define GFX_MEM_WIN_32M        0x00010000\n#define GFX_MEM_WIN_64M        0x00000000\n\n/* Overkill?  I don't know.  Need to figure out top of mem to make the\n * SMRAM calculations come out.  Linux seems to have problems\n * detecting it all on its own, so this seems a reasonable double\n * check to any user supplied 'mem=...' boot param.\n *\n * ... unfortunately this reg doesn't work according to spec on the\n * test hardware.\n */\n#define WHTCFG_PAMR_DRP      0x50\n#define SYS_DRAM_ROW_0_SHIFT    16\n#define SYS_DRAM_ROW_1_SHIFT    20\n#define DRAM_MASK           0x0f\n#define DRAM_VALUE_0        0\n#define DRAM_VALUE_1        8\n/* No 2 value defined */\n#define DRAM_VALUE_3        16\n#define DRAM_VALUE_4        16\n#define DRAM_VALUE_5        24\n#define DRAM_VALUE_6        32\n#define DRAM_VALUE_7        32\n#define DRAM_VALUE_8        48\n#define DRAM_VALUE_9        64\n#define DRAM_VALUE_A        64\n#define DRAM_VALUE_B        96\n#define DRAM_VALUE_C        128\n#define DRAM_VALUE_D        128\n#define DRAM_VALUE_E        192\n#define DRAM_VALUE_F        256\t/* nice one, geezer */\n#define LM_FREQ_MASK        0x10\n#define LM_FREQ_133         0x10\n#define LM_FREQ_100         0x00\n\n\n\n\n/* These are 3d state registers, but the state is invarient, so we let\n * the X server handle it:\n */\n\n\n\n/* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135\n */\n#define GFX_OP_COLOR_CHROMA_KEY  ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)\n#define CC1_UPDATE_KILL_WRITE    (1<<28)\n#define CC1_ENABLE_KILL_WRITE    (1<<27)\n#define CC1_DISABLE_KILL_WRITE    0\n#define CC1_UPDATE_COLOR_IDX     (1<<26)\n#define CC1_UPDATE_CHROMA_LOW    (1<<25)\n#define CC1_UPDATE_CHROMA_HI     (1<<24)\n#define CC1_CHROMA_LOW_MASK      ((1<<24)-1)\n#define CC2_COLOR_IDX_SHIFT      24\n#define CC2_COLOR_IDX_MASK       (0xff<<24)\n#define CC2_CHROMA_HI_MASK       ((1<<24)-1)\n\n\n#define GFX_CMD_CONTEXT_SEL      ((0<<29)|(0x5<<23))\n#define CS_UPDATE_LOAD           (1<<17)\n#define CS_UPDATE_USE            (1<<16)\n#define CS_UPDATE_LOAD           (1<<17)\n#define CS_LOAD_CTX0             0\n#define CS_LOAD_CTX1             (1<<8)\n#define CS_USE_CTX0              0\n#define CS_USE_CTX1              (1<<0)\n\n/* I810 LCD/TV registers */\n#define LCD_TV_HTOTAL\t0x60000\n#define LCD_TV_C\t0x60018\n#define LCD_TV_OVRACT   0x6001C\n\n#define LCD_TV_ENABLE (1 << 31)\n#define LCD_TV_VGAMOD (1 << 28)\n\n/* I830 CRTC registers */\n#define HTOTAL_A\t0x60000\n#define HBLANK_A\t0x60004\n#define HSYNC_A \t0x60008\n#define VTOTAL_A\t0x6000c\n#define VBLANK_A\t0x60010\n#define VSYNC_A \t0x60014\n#define PIPEASRC\t0x6001c\n#define BCLRPAT_A\t0x60020\n#define VSYNCSHIFT_A\t0x60028\n\n#define HTOTAL_B\t0x61000\n#define HBLANK_B\t0x61004\n#define HSYNC_B \t0x61008\n#define VTOTAL_B\t0x6100c\n#define VBLANK_B\t0x61010\n#define VSYNC_B \t0x61014\n#define PIPEBSRC\t0x6101c\n#define BCLRPAT_B\t0x61020\n#define VSYNCSHIFT_B\t0x61028\n\n#define HTOTAL_C\t0x62000\n#define HBLANK_C\t0x62004\n#define HSYNC_C \t0x62008\n#define VTOTAL_C\t0x6200c\n#define VBLANK_C\t0x62010\n#define VSYNC_C \t0x62014\n#define PIPECSRC\t0x6201c\n#define BCLRPAT_C\t0x62020\n#define VSYNCSHIFT_C\t0x62028\n\n#define HTOTAL_EDP\t0x6F000\n#define HBLANK_EDP\t0x6F004\n#define HSYNC_EDP\t0x6F008\n#define VTOTAL_EDP\t0x6F00c\n#define VBLANK_EDP\t0x6F010\n#define VSYNC_EDP\t0x6F014\n#define VSYNCSHIFT_EDP\t0x6F028\n\n#define PP_STATUS\t0x61200\n# define PP_ON\t\t\t\t\t(1 << 31)\n/**\n * Indicates that all dependencies of the panel are on:\n *\n * - PLL enabled\n * - pipe enabled\n * - LVDS/DVOB/DVOC on\n */\n# define PP_READY\t\t\t\t(1 << 30)\n# define PP_SEQUENCE_NONE\t\t\t(0 << 28)\n# define PP_SEQUENCE_ON\t\t\t\t(1 << 28)\n# define PP_SEQUENCE_OFF\t\t\t(2 << 28)\n# define PP_SEQUENCE_MASK\t\t\t0x30000000\n\n#define PP_CONTROL\t0x61204\n# define POWER_DOWN_ON_RESET\t\t\t(1 << 1)\n# define POWER_TARGET_ON\t\t\t(1 << 0)\n\n#define PP_ON_DELAYS\t0x61208\n#define PP_OFF_DELAYS\t0x6120c\n#define PP_DIVISOR\t0x61210\n\n#define PFIT_CONTROL\t0x61230\n# define PFIT_ENABLE\t\t\t\t(1 << 31)\n/* Pre-965 */\n# define VERT_INTERP_DISABLE\t\t\t(0 << 10)\n# define VERT_INTERP_BILINEAR\t\t\t(1 << 10)\n# define VERT_INTERP_MASK\t\t\t(3 << 10)\n# define VERT_AUTO_SCALE\t\t\t(1 << 9)\n# define HORIZ_INTERP_DISABLE\t\t\t(0 << 6)\n# define HORIZ_INTERP_BILINEAR\t\t\t(1 << 6)\n# define HORIZ_INTERP_MASK\t\t\t(3 << 6)\n# define HORIZ_AUTO_SCALE\t\t\t(1 << 5)\n# define PANEL_8TO6_DITHER_ENABLE\t\t(1 << 3)\n/* 965+ */\n# define PFIT_PIPE_MASK\t\t\t\t(3 << 29)\n# define PFIT_PIPE_SHIFT\t\t\t29\n# define PFIT_SCALING_MODE_MASK\t\t\t(7 << 26)\n#  define PFIT_SCALING_AUTO\t\t\t(0 << 26)\n#  define PFIT_SCALING_PROGRAMMED\t\t(1 << 26)\n#  define PFIT_SCALING_PILLAR\t\t\t(2 << 26)\n#  define PFIT_SCALING_LETTER\t\t\t(3 << 26)\n# define PFIT_FILTER_SELECT_MASK\t\t(3 << 24)\n#  define PFIT_FILTER_FUZZY\t\t\t(0 << 24)\n#  define PFIT_FILTER_CRISP\t\t\t(1 << 24)\n#  define PFIT_FILTER_MEDIAN\t\t\t(2 << 24)\n\n#define PFIT_PGM_RATIOS\t0x61234\n/* Pre-965 */\n# define PFIT_VERT_SCALE_SHIFT\t\t\t20\n# define PFIT_VERT_SCALE_MASK\t\t\t0xfff00000\n# define PFIT_HORIZ_SCALE_SHIFT\t\t\t4\n# define PFIT_HORIZ_SCALE_MASK\t\t\t0x0000fff0\n/* 965+ */\n# define PFIT_VERT_SCALE_SHIFT_965\t\t16\n# define PFIT_VERT_SCALE_MASK_965\t\t0x1fff0000\n# define PFIT_HORIZ_SCALE_SHIFT_965\t\t0\n# define PFIT_HORIZ_SCALE_MASK_965\t\t0x00001fff\n\n#define DPLL_A\t\t0x06014\n#define DPLL_B\t\t0x06018\n# define DPLL_VCO_ENABLE\t\t\t(1 << 31)\n# define DPLL_DVO_HIGH_SPEED\t\t\t(1 << 30)\n# define DPLL_SYNCLOCK_ENABLE\t\t\t(1 << 29)\n# define DPLL_VGA_MODE_DIS\t\t\t(1 << 28)\n# define DPLLB_MODE_DAC_SERIAL\t\t\t(1 << 26) /* i915 */\n# define DPLLB_MODE_LVDS\t\t\t(2 << 26) /* i915 */\n# define DPLL_MODE_MASK\t\t\t\t(3 << 26)\n# define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10\t(0 << 24) /* i915 */\n# define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5\t\t(1 << 24) /* i915 */\n# define DPLLB_LVDS_P2_CLOCK_DIV_14\t\t(0 << 24) /* i915 */\n# define DPLLB_LVDS_P2_CLOCK_DIV_7\t\t(1 << 24) /* i915 */\n# define DPLL_P2_CLOCK_DIV_MASK\t\t\t0x03000000 /* i915 */\n# define DPLL_FPA01_P1_POST_DIV_MASK\t\t0x00ff0000 /* i915 */\n# define DPLL_FPA01_P1_POST_DIV_MASK_IGD\t0x00ff8000 /* IGD */\n/**\n *  The i830 generation, in DAC/serial mode, defines p1 as two plus this\n * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.\n */\n# define DPLL_FPA01_P1_POST_DIV_MASK_I830\t0x001f0000\n/**\n * The i830 generation, in LVDS mode, defines P1 as the bit number set within\n * this field (only one bit may be set).\n */\n# define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS\t0x003f0000\n# define DPLL_FPA01_P1_POST_DIV_SHIFT\t\t16\n# define DPLL_FPA01_P1_POST_DIV_SHIFT_IGD\t15\n# define PLL_P2_DIVIDE_BY_4\t\t\t(1 << 23) /* i830, required in DVO non-gang */\n# define PLL_P1_DIVIDE_BY_TWO\t\t\t(1 << 21) /* i830 */\n# define PLL_REF_INPUT_DREFCLK\t\t\t(0 << 13)\n# define PLL_REF_INPUT_TVCLKINA\t\t\t(1 << 13) /* i830 */\n# define PLL_REF_INPUT_SUPER_SSC\t\t(1 << 13) /* Ironlake: 120M SSC */\n# define PLL_REF_INPUT_TVCLKINBC\t\t(2 << 13) /* SDVO TVCLKIN */\n# define PLLB_REF_INPUT_SPREADSPECTRUMIN\t(3 << 13)\n# define PLL_REF_INPUT_MASK\t\t\t(3 << 13)\n# define PLL_REF_INPUT_DMICLK\t\t\t(5 << 13) /* Ironlake: DMI refclk */\n# define PLL_LOAD_PULSE_PHASE_SHIFT\t\t9\n/*\n * Parallel to Serial Load Pulse phase selection.\n * Selects the phase for the 10X DPLL clock for the PCIe\n * digital display port. The range is 4 to 13; 10 or more\n * is just a flip delay. The default is 6\n */\n# define PLL_LOAD_PULSE_PHASE_MASK\t\t(0xf << PLL_LOAD_PULSE_PHASE_SHIFT)\n# define DISPLAY_RATE_SELECT_FPA1\t\t(1 << 8)\n/* Ironlake */\n# define PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT\t9\n# define PLL_REF_SDVO_HDMI_MULTIPLIER_MASK\t(7 << 9)\n# define PLL_REF_SDVO_HDMI_MULTIPLIER(x)\t(((x)-1)<< PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT)\n# define DPLL_FPA1_P1_POST_DIV_SHIFT\t\t0\n# define DPLL_FPA1_P1_POST_DIV_MASK\t\t0xff\n\n/**\n * SDVO multiplier for 945G/GM. Not used on 965.\n *\n * \\sa DPLL_MD_UDI_MULTIPLIER_MASK\n */\n# define SDVO_MULTIPLIER_MASK\t\t\t0x000000ff\n# define SDVO_MULTIPLIER_SHIFT_HIRES\t\t4\n# define SDVO_MULTIPLIER_SHIFT_VGA\t\t0\n\n/** @defgroup DPLL_MD\n * @{\n */\n/** Pipe A SDVO/UDI clock multiplier/divider register for G965. */\n#define DPLL_A_MD\t\t0x0601c\n/** Pipe B SDVO/UDI clock multiplier/divider register for G965. */\n#define DPLL_B_MD\t\t0x06020\n/**\n * UDI pixel divider, controlling how many pixels are stuffed into a packet.\n *\n * Value is pixels minus 1.  Must be set to 1 pixel for SDVO.\n */\n# define DPLL_MD_UDI_DIVIDER_MASK\t\t0x3f000000\n# define DPLL_MD_UDI_DIVIDER_SHIFT\t\t24\n/** UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */\n# define DPLL_MD_VGA_UDI_DIVIDER_MASK\t\t0x003f0000\n# define DPLL_MD_VGA_UDI_DIVIDER_SHIFT\t\t16\n/**\n * SDVO/UDI pixel multiplier.\n *\n * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus\n * clock rate is 10 times the DPLL clock.  At low resolution/refresh rate\n * modes, the bus rate would be below the limits, so SDVO allows for stuffing\n * dummy bytes in the datastream at an increased clock rate, with both sides of\n * the link knowing how many bytes are fill.\n *\n * So, for a mode with a dotclock of 65Mhz, we would want to double the clock\n * rate to 130Mhz to get a bus rate of 1.30Ghz.  The DPLL clock rate would be\n * set to 130Mhz, and the SDVO multiplier set to 2x in this register and\n * through an SDVO command.\n *\n * This register field has values of multiplication factor minus 1, with\n * a maximum multiplier of 5 for SDVO.\n */\n# define DPLL_MD_UDI_MULTIPLIER_MASK\t\t0x00003f00\n# define DPLL_MD_UDI_MULTIPLIER_SHIFT\t\t8\n/** SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK. \n * This best be set to the default value (3) or the CRT won't work. No,\n * I don't entirely understand what this does...\n */\n# define DPLL_MD_VGA_UDI_MULTIPLIER_MASK\t0x0000003f\n# define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT\t0\n/** @} */\n\n#define DPLL_TEST\t\t0x606c\n# define DPLLB_TEST_SDVO_DIV_1\t\t\t(0 << 22)\n# define DPLLB_TEST_SDVO_DIV_2\t\t\t(1 << 22)\n# define DPLLB_TEST_SDVO_DIV_4\t\t\t(2 << 22)\n# define DPLLB_TEST_SDVO_DIV_MASK\t\t(3 << 22)\n# define DPLLB_TEST_N_BYPASS\t\t\t(1 << 19)\n# define DPLLB_TEST_M_BYPASS\t\t\t(1 << 18)\n# define DPLLB_INPUT_BUFFER_ENABLE\t\t(1 << 16)\n# define DPLLA_TEST_N_BYPASS\t\t\t(1 << 3)\n# define DPLLA_TEST_M_BYPASS\t\t\t(1 << 2)\n# define DPLLA_INPUT_BUFFER_ENABLE\t\t(1 << 0)\n\n#define D_STATE\t\t\t0x6104\n#define DSPCLK_GATE_D\t\t0x6200\n# define DPUNIT_B_CLOCK_GATE_DISABLE\t\t(1 << 30) /* 965 */\n# define VSUNIT_CLOCK_GATE_DISABLE\t\t(1 << 29) /* 965 */\n# define VRHUNIT_CLOCK_GATE_DISABLE\t\t(1 << 28) /* 965 */\n# define VRDUNIT_CLOCK_GATE_DISABLE\t\t(1 << 27) /* 965 */\n# define AUDUNIT_CLOCK_GATE_DISABLE\t\t(1 << 26) /* 965 */\n# define DPUNIT_A_CLOCK_GATE_DISABLE\t\t(1 << 25) /* 965 */\n# define DPCUNIT_CLOCK_GATE_DISABLE\t\t(1 << 24) /* 965 */\n# define TVRUNIT_CLOCK_GATE_DISABLE\t\t(1 << 23) /* 915-945 */\n# define TVCUNIT_CLOCK_GATE_DISABLE\t\t(1 << 22) /* 915-945 */\n# define TVFUNIT_CLOCK_GATE_DISABLE\t\t(1 << 21) /* 915-945 */\n# define TVEUNIT_CLOCK_GATE_DISABLE\t\t(1 << 20) /* 915-945 */\n# define DVSUNIT_CLOCK_GATE_DISABLE\t\t(1 << 19) /* 915-945 */\n# define DSSUNIT_CLOCK_GATE_DISABLE\t\t(1 << 18) /* 915-945 */\n# define DDBUNIT_CLOCK_GATE_DISABLE\t\t(1 << 17) /* 915-945 */\n# define DPRUNIT_CLOCK_GATE_DISABLE\t\t(1 << 16) /* 915-945 */\n# define DPFUNIT_CLOCK_GATE_DISABLE\t\t(1 << 15) /* 915-945 */\n# define DPBMUNIT_CLOCK_GATE_DISABLE\t\t(1 << 14) /* 915-945 */\n# define DPLSUNIT_CLOCK_GATE_DISABLE\t\t(1 << 13) /* 915-945 */\n# define DPLUNIT_CLOCK_GATE_DISABLE\t\t(1 << 12) /* 915-945 */\n# define DPOUNIT_CLOCK_GATE_DISABLE\t\t(1 << 11)\n# define DPBUNIT_CLOCK_GATE_DISABLE\t\t(1 << 10)\n# define DCUNIT_CLOCK_GATE_DISABLE\t\t(1 << 9)\n# define DPUNIT_CLOCK_GATE_DISABLE\t\t(1 << 8)\n# define VRUNIT_CLOCK_GATE_DISABLE\t\t(1 << 7) /* 915+: reserved */\n# define OVHUNIT_CLOCK_GATE_DISABLE\t\t(1 << 6) /* 830-865 */\n# define DPIOUNIT_CLOCK_GATE_DISABLE\t\t(1 << 6) /* 915-945 */\n# define OVFUNIT_CLOCK_GATE_DISABLE\t\t(1 << 5)\n# define OVBUNIT_CLOCK_GATE_DISABLE\t\t(1 << 4)\n/**\n * This bit must be set on the 830 to prevent hangs when turning off the\n * overlay scaler.\n */\n# define OVRUNIT_CLOCK_GATE_DISABLE\t\t(1 << 3)\n# define OVCUNIT_CLOCK_GATE_DISABLE\t\t(1 << 2)\n# define OVUUNIT_CLOCK_GATE_DISABLE\t\t(1 << 1)\n# define ZVUNIT_CLOCK_GATE_DISABLE\t\t(1 << 0) /* 830 */\n# define OVLUNIT_CLOCK_GATE_DISABLE\t\t(1 << 0) /* 845,865 */\n\n#define RENCLK_GATE_D1\t\t0x6204\n# define BLITTER_CLOCK_GATE_DISABLE\t\t(1 << 13) /* 945GM only */\n# define MPEG_CLOCK_GATE_DISABLE\t\t(1 << 12) /* 945GM only */\n# define PC_FE_CLOCK_GATE_DISABLE\t\t(1 << 11)\n# define PC_BE_CLOCK_GATE_DISABLE\t\t(1 << 10)\n# define WINDOWER_CLOCK_GATE_DISABLE\t\t(1 << 9)\n# define INTERPOLATOR_CLOCK_GATE_DISABLE\t(1 << 8)\n# define COLOR_CALCULATOR_CLOCK_GATE_DISABLE\t(1 << 7)\n# define MOTION_COMP_CLOCK_GATE_DISABLE\t\t(1 << 6)\n# define MAG_CLOCK_GATE_DISABLE\t\t\t(1 << 5)\n/** This bit must be unset on 855,865 */\n# define MECI_CLOCK_GATE_DISABLE\t\t(1 << 4)\n# define DCMP_CLOCK_GATE_DISABLE\t\t(1 << 3)\n# define MEC_CLOCK_GATE_DISABLE\t\t\t(1 << 2)\n# define MECO_CLOCK_GATE_DISABLE\t\t(1 << 1)\n/** This bit must be set on 855,865. */\n# define SV_CLOCK_GATE_DISABLE\t\t\t(1 << 0)\n# define I915_MPEG_CLOCK_GATE_DISABLE\t\t(1 << 16)\n# define I915_VLD_IP_PR_CLOCK_GATE_DISABLE\t(1 << 15)\n# define I915_MOTION_COMP_CLOCK_GATE_DISABLE\t(1 << 14)\n# define I915_BD_BF_CLOCK_GATE_DISABLE\t\t(1 << 13)\n# define I915_SF_SE_CLOCK_GATE_DISABLE\t\t(1 << 12)\n# define I915_WM_CLOCK_GATE_DISABLE\t\t(1 << 11)\n# define I915_IZ_CLOCK_GATE_DISABLE\t\t(1 << 10)\n# define I915_PI_CLOCK_GATE_DISABLE\t\t(1 << 9)\n# define I915_DI_CLOCK_GATE_DISABLE\t\t(1 << 8)\n# define I915_SH_SV_CLOCK_GATE_DISABLE\t\t(1 << 7)\n# define I915_PL_DG_QC_FT_CLOCK_GATE_DISABLE\t(1 << 6)\n# define I915_SC_CLOCK_GATE_DISABLE\t\t(1 << 5)\n# define I915_FL_CLOCK_GATE_DISABLE\t\t(1 << 4)\n# define I915_DM_CLOCK_GATE_DISABLE\t\t(1 << 3)\n# define I915_PS_CLOCK_GATE_DISABLE\t\t(1 << 2)\n# define I915_CC_CLOCK_GATE_DISABLE\t\t(1 << 1)\n# define I915_BY_CLOCK_GATE_DISABLE\t\t(1 << 0)\n\n# define I965_RCZ_CLOCK_GATE_DISABLE\t\t(1 << 30)\n/** This bit must always be set on 965G/965GM */\n# define I965_RCC_CLOCK_GATE_DISABLE\t\t(1 << 29)\n# define I965_RCPB_CLOCK_GATE_DISABLE\t\t(1 << 28)\n# define I965_DAP_CLOCK_GATE_DISABLE\t\t(1 << 27)\n# define I965_ROC_CLOCK_GATE_DISABLE\t\t(1 << 26)\n# define I965_GW_CLOCK_GATE_DISABLE\t\t(1 << 25)\n# define I965_TD_CLOCK_GATE_DISABLE\t\t(1 << 24)\n/** This bit must always be set on 965G */\n# define I965_ISC_CLOCK_GATE_DISABLE\t\t(1 << 23)\n# define I965_IC_CLOCK_GATE_DISABLE\t\t(1 << 22)\n# define I965_EU_CLOCK_GATE_DISABLE\t\t(1 << 21)\n# define I965_IF_CLOCK_GATE_DISABLE\t\t(1 << 20)\n# define I965_TC_CLOCK_GATE_DISABLE\t\t(1 << 19)\n# define I965_SO_CLOCK_GATE_DISABLE\t\t(1 << 17)\n# define I965_FBC_CLOCK_GATE_DISABLE\t\t(1 << 16)\n# define I965_MARI_CLOCK_GATE_DISABLE\t\t(1 << 15)\n# define I965_MASF_CLOCK_GATE_DISABLE\t\t(1 << 14)\n# define I965_MAWB_CLOCK_GATE_DISABLE\t\t(1 << 13)\n# define I965_EM_CLOCK_GATE_DISABLE\t\t(1 << 12)\n# define I965_UC_CLOCK_GATE_DISABLE\t\t(1 << 11)\n# define I965_SI_CLOCK_GATE_DISABLE\t\t(1 << 6)\n# define I965_MT_CLOCK_GATE_DISABLE\t\t(1 << 5)\n# define I965_PL_CLOCK_GATE_DISABLE\t\t(1 << 4)\n# define I965_DG_CLOCK_GATE_DISABLE\t\t(1 << 3)\n# define I965_QC_CLOCK_GATE_DISABLE\t\t(1 << 2)\n# define I965_FT_CLOCK_GATE_DISABLE\t\t(1 << 1)\n# define I965_DM_CLOCK_GATE_DISABLE\t\t(1 << 0)\n\n#define RENCLK_GATE_D2\t\t0x6208\n#define VF_UNIT_CLOCK_GATE_DISABLE\t\t(1 << 9)\n#define GS_UNIT_CLOCK_GATE_DISABLE\t\t(1 << 7)\n#define CL_UNIT_CLOCK_GATE_DISABLE\t\t(1 << 6)\n#define RAMCLK_GATE_D\t\t0x6210\t\t/* CRL only */\n#define DEUC\t\t\t0x6214          /* CRL only */\n\n/*\n * This is a PCI config space register to manipulate backlight brightness\n * It is used when the BLM_LEGACY_MODE is turned on. When enabled, the first\n * byte of this config register sets brightness within the range from\n * 0 to 0xff\n */\n#define LEGACY_BACKLIGHT_BRIGHTNESS 0xf4\n\n#define BLC_PWM_CTL\t\t0x61254\n#define BACKLIGHT_MODULATION_FREQ_SHIFT\t\t(17)\n#define BACKLIGHT_MODULATION_FREQ_SHIFT2\t(16)\n/**\n * This is the most significant 15 bits of the number of backlight cycles in a\n * complete cycle of the modulated backlight control.\n *\n * The actual value is this field multiplied by two.\n */\n#define BACKLIGHT_MODULATION_FREQ_MASK\t\t(0x7fff << 17)\n#define BACKLIGHT_MODULATION_FREQ_MASK2\t\t(0xffff << 16)\n#define BLM_LEGACY_MODE\t\t\t\t(1 << 16)\n\n/**\n * This is the number of cycles out of the backlight modulation cycle for which\n * the backlight is on.\n *\n * This field must be no greater than the number of cycles in the complete\n * backlight modulation cycle.\n */\n#define BACKLIGHT_DUTY_CYCLE_SHIFT\t\t(0)\n#define BACKLIGHT_DUTY_CYCLE_MASK\t\t(0xffff)\n\n/* On 965+ backlight control is in another register */\n#define BLC_PWM_CTL2\t\t\t0x61250\n#define \tBLM_LEGACY_MODE2\t(1 << 30)\n\n#define BLM_CTL\t\t\t0x61260\n#define BLM_THRESHOLD_0\t\t0x61270\n#define BLM_THRESHOLD_1\t\t0x61274\n#define BLM_THRESHOLD_2\t\t0x61278\n#define BLM_THRESHOLD_3\t\t0x6127c\n#define BLM_THRESHOLD_4\t\t0x61280\n#define BLM_THRESHOLD_5\t\t0x61284\n\n#define BLM_ACCUMULATOR_0\t0x61290\n#define BLM_ACCUMULATOR_1\t0x61294\n#define BLM_ACCUMULATOR_2\t0x61298\n#define BLM_ACCUMULATOR_3\t0x6129c\n#define BLM_ACCUMULATOR_4\t0x612a0\n#define BLM_ACCUMULATOR_5\t0x612a4\n\n#define FPA0\t\t0x06040\n#define FPA1\t\t0x06044\n#define FPB0\t\t0x06048\n#define FPB1\t\t0x0604c\n# define FP_N_DIV_MASK\t\t\t\t0x003f0000\n# define FP_N_IGD_DIV_MASK\t\t\t0x00ff0000\n# define FP_N_DIV_SHIFT\t\t\t\t16\n# define FP_M1_DIV_MASK\t\t\t\t0x00003f00\n# define FP_M1_DIV_SHIFT\t\t\t8\n# define FP_M2_DIV_MASK\t\t\t\t0x0000003f\n# define FP_M2_IGD_DIV_MASK\t\t\t0x000000ff\n# define FP_M2_DIV_SHIFT\t\t\t0\n\n#define PORT_HOTPLUG_EN\t\t0x61110\n# define HDMIB_HOTPLUG_INT_EN\t\t\t(1 << 29)\n# define HDMIC_HOTPLUG_INT_EN\t\t\t(1 << 28)\n# define HDMID_HOTPLUG_INT_EN\t\t\t(1 << 27)\n# define SDVOB_HOTPLUG_INT_EN\t\t\t(1 << 26)\n# define SDVOC_HOTPLUG_INT_EN\t\t\t(1 << 25)\n# define TV_HOTPLUG_INT_EN\t\t\t(1 << 18)\n# define CRT_HOTPLUG_INT_EN\t\t\t(1 << 9)\n# define CRT_HOTPLUG_ACTIVATION_PERIOD_32\t(0 << 8)\n/* must use period 64 on GM45 according to docs */\n# define CRT_HOTPLUG_ACTIVATION_PERIOD_64\t(1 << 8)\n# define CRT_HOTPLUG_DAC_ON_TIME_2M\t\t(0 << 7)\n# define CRT_HOTPLUG_DAC_ON_TIME_4M\t\t(1 << 7)\n# define CRT_HOTPLUG_VOLTAGE_COMPARE_40\t\t(0 << 5)\n# define CRT_HOTPLUG_VOLTAGE_COMPARE_50\t\t(1 << 5)\n# define CRT_HOTPLUG_VOLTAGE_COMPARE_60\t\t(2 << 5)\n# define CRT_HOTPLUG_VOLTAGE_COMPARE_70\t\t(3 << 5)\n# define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK\t(3 << 5)\n# define CRT_HOTPLUG_DETECT_DELAY_1G\t\t(0 << 4)\n# define CRT_HOTPLUG_DETECT_DELAY_2G\t\t(1 << 4)\n# define CRT_HOTPLUG_FORCE_DETECT\t\t(1 << 3)\n# define CRT_HOTPLUG_DETECT_VOLTAGE_325MV\t(0 << 2)\n# define CRT_HOTPLUG_DETECT_VOLTAGE_475MV\t(1 << 2)\n# define CRT_HOTPLUG_MASK\t\t\t(0x3fc)\t/* Bits 9-2 */\n\n#define PORT_HOTPLUG_STAT\t0x61114\n# define HDMIB_HOTPLUG_INT_STATUS\t\t(1 << 29)\n# define HDMIC_HOTPLUG_INT_STATUS\t\t(1 << 28)\n# define HDMID_HOTPLUG_INT_STATUS\t\t(1 << 27)\n# define CRT_HOTPLUG_INT_STATUS\t\t\t(1 << 11)\n# define TV_HOTPLUG_INT_STATUS\t\t\t(1 << 10)\n# define CRT_HOTPLUG_MONITOR_MASK\t\t(3 << 8)\n# define CRT_HOTPLUG_MONITOR_COLOR\t\t(3 << 8)\n# define CRT_HOTPLUG_MONITOR_MONO\t\t(2 << 8)\n# define CRT_HOTPLUG_MONITOR_NONE\t\t(0 << 8)\n# define SDVOC_HOTPLUG_INT_STATUS\t\t(1 << 7)\n# define SDVOB_HOTPLUG_INT_STATUS\t\t(1 << 6)\n\n#define SDVOB\t\t\t0x61140\n#define SDVOC\t\t\t0x61160\n#define SDVO_ENABLE\t\t\t\t(1 << 31)\n#define SDVO_PIPE_B_SELECT\t\t\t(1 << 30)\n#define SDVO_STALL_SELECT\t\t\t(1 << 29)\n#define SDVO_INTERRUPT_ENABLE\t\t\t(1 << 26)\n/**\n * 915G/GM SDVO pixel multiplier.\n *\n * Programmed value is multiplier - 1, up to 5x.\n *\n * \\sa DPLL_MD_UDI_MULTIPLIER_MASK\n */\n#define SDVO_PORT_MULTIPLY_MASK\t\t\t(7 << 23)\n#define SDVO_PORT_MULTIPLY_SHIFT\t\t23\n#define SDVO_PHASE_SELECT_MASK\t\t\t(15 << 19)\n#define SDVO_PHASE_SELECT_DEFAULT\t\t(6 << 19)\n#define SDVO_CLOCK_OUTPUT_INVERT\t\t(1 << 18)\n#define SDVOC_GANG_MODE\t\t\t\t(1 << 16)\n#define SDVO_ENCODING_SDVO\t\t\t(0x0 << 10)\n#define SDVO_ENCODING_HDMI\t\t\t(0x2 << 10)\n/** Requird for HDMI operation */\n#define SDVO_NULL_PACKETS_DURING_VSYNC\t\t(1 << 9)\n#define SDVO_BORDER_ENABLE\t\t\t(1 << 7)\n#define SDVO_AUDIO_ENABLE\t\t\t(1 << 6)\n/** New with 965, default is to be set */\n#define SDVO_VSYNC_ACTIVE_HIGH\t\t\t(1 << 4)\n/** New with 965, default is to be set */\n#define SDVO_HSYNC_ACTIVE_HIGH\t\t\t(1 << 3)\n/** 915/945 only, read-only bit */\n#define SDVOB_PCIE_CONCURRENCY\t\t\t(1 << 3)\n#define SDVO_DETECTED\t\t\t\t(1 << 2)\n/* Bits to be preserved when writing */\n#define SDVOB_PRESERVE_MASK\t\t\t((1 << 17) | (1 << 16) | (1 << 14))\n#define SDVOC_PRESERVE_MASK\t\t\t(1 << 17)\n\n#define UDIB_SVB_SHB_CODES    \t\t0x61144\n#define UDIB_SHA_BLANK_CODES\t\t0x61148\n#define UDIB_START_END_FILL_CODES\t0x6114c\n\n\n#define SDVOUDI\t\t\t\t0x61150\n\n#define I830_HTOTAL_MASK \t0xfff0000\n#define I830_HACTIVE_MASK\t0x7ff\n\n#define I830_HBLANKEND_MASK\t0xfff0000\n#define I830_HBLANKSTART_MASK    0xfff\n\n#define I830_HSYNCEND_MASK\t0xfff0000\n#define I830_HSYNCSTART_MASK    0xfff\n\n#define I830_VTOTAL_MASK \t0xfff0000\n#define I830_VACTIVE_MASK\t0x7ff\n\n#define I830_VBLANKEND_MASK\t0xfff0000\n#define I830_VBLANKSTART_MASK    0xfff\n\n#define I830_VSYNCEND_MASK\t0xfff0000\n#define I830_VSYNCSTART_MASK    0xfff\n\n#define I830_PIPEA_HORZ_MASK\t0x7ff0000\n#define I830_PIPEA_VERT_MASK\t0x7ff\n\n#define ADPA\t\t\t0x61100\n#define ADPA_DAC_ENABLE \t(1<<31)\n#define ADPA_DAC_DISABLE\t0\n#define ADPA_PIPE_SELECT_MASK\t(1<<30)\n#define ADPA_PIPE_A_SELECT\t0\n#define ADPA_PIPE_B_SELECT\t(1<<30)\n#define ADPA_USE_VGA_HVPOLARITY (1<<15)\n#define ADPA_SETS_HVPOLARITY\t0\n#define ADPA_VSYNC_CNTL_DISABLE (1<<11)\n#define ADPA_VSYNC_CNTL_ENABLE\t0\n#define ADPA_HSYNC_CNTL_DISABLE (1<<10)\n#define ADPA_HSYNC_CNTL_ENABLE\t0\n#define ADPA_VSYNC_ACTIVE_HIGH\t(1<<4)\n#define ADPA_VSYNC_ACTIVE_LOW\t0\n#define ADPA_HSYNC_ACTIVE_HIGH\t(1<<3)\n#define ADPA_HSYNC_ACTIVE_LOW\t0\n\n#define PCH_DSP_CHICKEN1\t0x42000\n#define PCH_DSP_CHICKEN2\t0x42004\n#define PCH_DSP_CHICKEN3\t0x4200c\n#define PCH_DSPCLK_GATE_D\t0x42020\n#define PCH_DSPRAMCLK_GATE_D\t0x42024\n#define PCH_3DCGDIS0\t\t0x46020\n#define PCH_3DCGDIS1\t\t0x46024\n#define PCH_3DRAMCGDIS0\t\t0x46028\n#define SOUTH_DSPCLK_GATE_D\t0xc2020\n\n#define CPU_eDP_A\t\t0x64000\n#define PCH_DP_B\t\t0xe4100\n#define PCH_DP_C\t\t0xe4200\n#define PCH_DP_D\t\t0xe4300\n\n#define DVOA\t\t\t0x61120\n#define DVOB\t\t\t0x61140\n#define DVOC\t\t\t0x61160\n#define DVO_ENABLE\t\t\t(1 << 31)\n#define DVO_PIPE_B_SELECT\t\t(1 << 30)\n#define DVO_PIPE_STALL_UNUSED\t\t(0 << 28)\n#define DVO_PIPE_STALL\t\t\t(1 << 28)\n#define DVO_PIPE_STALL_TV\t\t(2 << 28)\n#define DVO_PIPE_STALL_MASK\t\t(3 << 28)\n#define DVO_USE_VGA_SYNC\t\t(1 << 15)\n#define DVO_DATA_ORDER_I740\t\t(0 << 14)\n#define DVO_DATA_ORDER_FP\t\t(1 << 14)\n#define DVO_VSYNC_DISABLE\t\t(1 << 11)\n#define DVO_HSYNC_DISABLE\t\t(1 << 10)\n#define DVO_VSYNC_TRISTATE\t\t(1 << 9)\n#define DVO_HSYNC_TRISTATE\t\t(1 << 8)\n#define DVO_BORDER_ENABLE\t\t(1 << 7)\n#define DVO_DATA_ORDER_GBRG\t\t(1 << 6)\n#define DVO_DATA_ORDER_RGGB\t\t(0 << 6)\n#define DVO_DATA_ORDER_GBRG_ERRATA\t(0 << 6)\n#define DVO_DATA_ORDER_RGGB_ERRATA\t(1 << 6)\n#define DVO_VSYNC_ACTIVE_HIGH\t\t(1 << 4)\n#define DVO_HSYNC_ACTIVE_HIGH\t\t(1 << 3)\n#define DVO_BLANK_ACTIVE_HIGH\t\t(1 << 2)\n#define DVO_OUTPUT_CSTATE_PIXELS\t(1 << 1)\t/* SDG only */\n#define DVO_OUTPUT_SOURCE_SIZE_PIXELS\t(1 << 0)\t/* SDG only */\n#define DVO_PRESERVE_MASK\t(0x7<<24)\n\n#define DVOA_SRCDIM\t\t0x61124\n#define DVOB_SRCDIM\t\t0x61144\n#define DVOC_SRCDIM\t\t0x61164\n#define DVO_SRCDIM_HORIZONTAL_SHIFT\t12\n#define DVO_SRCDIM_VERTICAL_SHIFT\t0\n\n/** @defgroup LVDS\n * @{\n */\n/**\n * This register controls the LVDS output enable, pipe selection, and data\n * format selection.\n *\n * All of the clock/data pairs are force powered down by power sequencing.\n */\n#define LVDS\t\t\t0x61180\n/**\n * Enables the LVDS port.  This bit must be set before DPLLs are enabled, as\n * the DPLL semantics change when the LVDS is assigned to that pipe.\n */\n# define LVDS_PORT_EN\t\t\t(1 << 31)\n/** Selects pipe B for LVDS data.  Must be set on pre-965. */\n# define LVDS_PIPEB_SELECT\t\t(1 << 30)\n\n/* on 965, dithering is enabled in this register, not PFIT_CONTROL */\n# define LVDS_DITHER_ENABLE\t\t(1 << 25)\n\n/*\n * Selects between .0 and .1 formats:\n *\n * 0 = 1x18.0, 2x18.0, 1x24.0 or 2x24.0\n * 1 = 1x24.1 or 2x24.1\n */\n# define LVDS_DATA_FORMAT_DOT_ONE\t(1 << 24)\n\n/* Using LE instead of HS on second channel control signal */\n# define LVDS_LE_CONTROL_ENABLE\t\t(1 << 23)\n\n/* Using LF instead of VS on second channel control signal */\n# define LVDS_LF_CONTROL_ENABLE\t\t(1 << 22)\n\n/* invert vsync signal polarity */\n# define LVDS_VSYNC_POLARITY_INVERT\t(1 << 21)\n\n/* invert hsync signal polarity */\n# define LVDS_HSYNC_POLARITY_INVERT\t(1 << 20)\n\n/* invert display enable signal polarity */\n# define LVDS_DE_POLARITY_INVERT\t(1 << 19)\n\n/*\n * Control signals for second channel, ignored in single channel modes\n */\n\n/* send DE, HS, VS on second channel */\n# define LVDS_SECOND_CHANNEL_DE_HS_VS\t(0 << 17)\n\n# define LVDS_SECOND_CHANNEL_RESERVED\t(1 << 17)\n\n/* Send zeros instead of DE, HS, VS on second channel */\n# define LVDS_SECOND_CHANNEL_ZEROS\t(2 << 17)\n\n/* Set DE=0, HS=LE, VS=LF on second channel */\n# define LVDS_SECOND_CHANNEL_HS_VS\t(3 << 17)\n\n/*\n * Send duplicate data for channel reserved bits, otherwise send zeros\n */\n# define LVDS_CHANNEL_DUP_RESERVED\t(1 << 16)\n\n/*\n * Enable border for unscaled (or aspect-scaled) display\n */\n# define LVDS_BORDER_ENABLE\t\t(1 << 15)\n\n/*\n * Tri-state the LVDS buffers when powered down, otherwise\n * they are set to 0V\n */\n# define LVDS_POWER_DOWN_TRI_STATE\t(1 << 10)\n\n/**\n * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per\n * pixel.\n */\n# define LVDS_A0A2_CLKA_POWER_MASK\t(3 << 8)\n# define LVDS_A0A2_CLKA_POWER_DOWN\t(0 << 8)\n# define LVDS_A0A2_CLKA_POWER_UP\t(3 << 8)\n/**\n * Controls the A3 data pair, which contains the additional LSBs for 24 bit\n * mode.  Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be\n * on.\n */\n# define LVDS_A3_POWER_MASK\t\t(3 << 6)\n# define LVDS_A3_POWER_DOWN\t\t(0 << 6)\n# define LVDS_A3_POWER_UP\t\t(3 << 6)\n/**\n * Controls the CLKB pair.  This should only be set when LVDS_B0B3_POWER_UP\n * is set.\n */\n# define LVDS_CLKB_POWER_MASK\t\t(3 << 4)\n# define LVDS_CLKB_POWER_DOWN\t\t(0 << 4)\n# define LVDS_CLKB_POWER_UP\t\t(3 << 4)\n\n/**\n * Controls the B0-B3 data pairs.  This must be set to match the DPLL p2\n * setting for whether we are in dual-channel mode.  The B3 pair will\n * additionally only be powered up when LVDS_A3_POWER_UP is set.\n */\n# define LVDS_B0B3_POWER_MASK\t\t(3 << 2)\n# define LVDS_B0B3_POWER_DOWN\t\t(0 << 2)\n# define LVDS_B0B3_POWER_UP\t\t(3 << 2)\n\n/** @} */\n\n#define DP_B\t\t\t0x64100\n#define DPB_AUX_CH_CTL\t\t0x64110\n#define DPB_AUX_CH_DATA1\t0x64114\n#define DPB_AUX_CH_DATA2\t0x64118\n#define DPB_AUX_CH_DATA3\t0x6411c\n#define DPB_AUX_CH_DATA4\t0x64120\n#define DPB_AUX_CH_DATA5\t0x64124\n\n#define DP_C\t\t\t0x64200\n#define DPC_AUX_CH_CTL\t\t0x64210\n#define DPC_AUX_CH_DATA1\t0x64214\n#define DPC_AUX_CH_DATA2\t0x64218\n#define DPC_AUX_CH_DATA3\t0x6421c\n#define DPC_AUX_CH_DATA4\t0x64220\n#define DPC_AUX_CH_DATA5\t0x64224\n\n#define DP_D\t\t\t0x64300\n#define DPD_AUX_CH_CTL\t\t0x64310\n#define DPD_AUX_CH_DATA1\t0x64314\n#define DPD_AUX_CH_DATA2\t0x64318\n#define DPD_AUX_CH_DATA3\t0x6431c\n#define DPD_AUX_CH_DATA4\t0x64320\n#define DPD_AUX_CH_DATA5\t0x64324\n\n/*\n * Two channel clock control. Turn this on if you need clkb for two channel mode\n * Overridden by global LVDS power sequencing\n */\n\n/* clkb off */\n# define LVDS_CLKB_POWER_DOWN\t\t(0 << 4)\n\n/* powered up, but clkb forced to 0 */\n# define LVDS_CLKB_POWER_PARTIAL\t(1 << 4)\n\n/* clock B running */\n# define LVDS_CLKB_POWER_UP\t\t(3 << 4)\n\n/*\n * Two channel mode B0-B2 control. Sets state when power is on.\n * Set to POWER_DOWN in single channel mode, other settings enable\n * two channel mode. The CLKB power control controls whether that clock\n * is enabled during two channel mode.\n *\n */\n/* Everything is off, including B3 and CLKB */\n# define LVDS_B_POWER_DOWN\t\t(0 << 2)\n\n/* B0, B1, B2 and data lines forced to 0. timing is active */\n# define LVDS_B_POWER_PARTIAL\t\t(1 << 2)\n\n/* data lines active (both timing and colour) */\n# define LVDS_B_POWER_UP\t\t(3 << 2)\n\n/** @defgroup TV_CTL\n * @{\n */\n#define TV_CTL\t\t\t0x68000\n/** Enables the TV encoder */\n# define TV_ENC_ENABLE\t\t\t(1 << 31)\n/** Sources the TV encoder input from pipe B instead of A. */\n# define TV_ENC_PIPEB_SELECT\t\t(1 << 30)\n/** Outputs composite video (DAC A only) */\n# define TV_ENC_OUTPUT_COMPOSITE\t(0 << 28)\n/** Outputs SVideo video (DAC B/C) */\n# define TV_ENC_OUTPUT_SVIDEO\t\t(1 << 28)\n/** Outputs Component video (DAC A/B/C) */\n# define TV_ENC_OUTPUT_COMPONENT\t(2 << 28)\n/** Outputs Composite and SVideo (DAC A/B/C) */\n# define TV_ENC_OUTPUT_SVIDEO_COMPOSITE\t(3 << 28)\n# define TV_TRILEVEL_SYNC\t\t(1 << 21)\n/** Enables slow sync generation (945GM only) */\n# define TV_SLOW_SYNC\t\t\t(1 << 20)\n/** Selects 4x oversampling for 480i and 576p */\n# define TV_OVERSAMPLE_4X\t\t(0 << 18)\n/** Selects 2x oversampling for 720p and 1080i */\n# define TV_OVERSAMPLE_2X\t\t(1 << 18)\n/** Selects no oversampling for 1080p */\n# define TV_OVERSAMPLE_NONE\t\t(2 << 18)\n/** Selects 8x oversampling */\n# define TV_OVERSAMPLE_8X\t\t(3 << 18)\n/** Selects progressive mode rather than interlaced */\n# define TV_PROGRESSIVE\t\t\t(1 << 17)\n/** Sets the colorburst to PAL mode.  Required for non-M PAL modes. */\n# define TV_PAL_BURST\t\t\t(1 << 16)\n/** Field for setting delay of Y compared to C */\n# define TV_YC_SKEW_MASK\t\t(7 << 12)\n/** Enables a fix for 480p/576p standard definition modes on the 915GM only */\n# define TV_ENC_SDP_FIX\t\t\t(1 << 11)\n/**\n * Enables a fix for the 915GM only.\n *\n * Not sure what it does.\n */\n# define TV_ENC_C0_FIX\t\t\t(1 << 10)\n/** Bits that must be preserved by software */\n# define TV_CTL_SAVE\t\t\t((1 << 11) | (3 << 9) | (7 << 6) | 0xf)\n# define TV_FUSE_STATE_MASK\t\t(3 << 4)\n/** Read-only state that reports all features enabled */\n# define TV_FUSE_STATE_ENABLED\t\t(0 << 4)\n/** Read-only state that reports that Macrovision is disabled in hardware*/\n# define TV_FUSE_STATE_NO_MACROVISION\t(1 << 4)\n/** Read-only state that reports that TV-out is disabled in hardware. */\n# define TV_FUSE_STATE_DISABLED\t\t(2 << 4)\n/** Normal operation */\n# define TV_TEST_MODE_NORMAL\t\t(0 << 0)\n/** Encoder test pattern 1 - combo pattern */\n# define TV_TEST_MODE_PATTERN_1\t\t(1 << 0)\n/** Encoder test pattern 2 - full screen vertical 75% color bars */\n# define TV_TEST_MODE_PATTERN_2\t\t(2 << 0)\n/** Encoder test pattern 3 - full screen horizontal 75% color bars */\n# define TV_TEST_MODE_PATTERN_3\t\t(3 << 0)\n/** Encoder test pattern 4 - random noise */\n# define TV_TEST_MODE_PATTERN_4\t\t(4 << 0)\n/** Encoder test pattern 5 - linear color ramps */\n# define TV_TEST_MODE_PATTERN_5\t\t(5 << 0)\n/**\n * This test mode forces the DACs to 50% of full output.\n *\n * This is used for load detection in combination with TVDAC_SENSE_MASK\n */\n# define TV_TEST_MODE_MONITOR_DETECT\t(7 << 0)\n# define TV_TEST_MODE_MASK\t\t(7 << 0)\n/** @} */\n\n/** @defgroup TV_DAC\n * @{\n */\n#define TV_DAC\t\t\t0x68004\n/**\n * Reports that DAC state change logic has reported change (RO).\n *\n * This gets cleared when TV_DAC_STATE_EN is cleared\n*/\n# define TVDAC_STATE_CHG\t\t(1 << 31)\n# define TVDAC_SENSE_MASK\t\t(7 << 28)\n/** Reports that DAC A voltage is above the detect threshold */\n# define TVDAC_A_SENSE\t\t\t(1 << 30)\n/** Reports that DAC B voltage is above the detect threshold */\n# define TVDAC_B_SENSE\t\t\t(1 << 29)\n/** Reports that DAC C voltage is above the detect threshold */\n# define TVDAC_C_SENSE\t\t\t(1 << 28)\n/**\n * Enables DAC state detection logic, for load-based TV detection.\n *\n * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set\n * to off, for load detection to work.\n */\n# define TVDAC_STATE_CHG_EN\t\t(1 << 27)\n/** Sets the DAC A sense value to high */\n# define TVDAC_A_SENSE_CTL\t\t(1 << 26)\n/** Sets the DAC B sense value to high */\n# define TVDAC_B_SENSE_CTL\t\t(1 << 25)\n/** Sets the DAC C sense value to high */\n# define TVDAC_C_SENSE_CTL\t\t(1 << 24)\n/** Overrides the ENC_ENABLE and DAC voltage levels */\n# define DAC_CTL_OVERRIDE\t\t(1 << 7)\n/** Sets the slew rate.  Must be preserved in software */\n# define ENC_TVDAC_SLEW_FAST\t\t(1 << 6)\n# define DAC_A_1_3_V\t\t\t(0 << 4)\n# define DAC_A_1_1_V\t\t\t(1 << 4)\n# define DAC_A_0_7_V\t\t\t(2 << 4)\n# define DAC_A_OFF\t\t\t(3 << 4)\n# define DAC_B_1_3_V\t\t\t(0 << 2)\n# define DAC_B_1_1_V\t\t\t(1 << 2)\n# define DAC_B_0_7_V\t\t\t(2 << 2)\n# define DAC_B_OFF\t\t\t(3 << 2)\n# define DAC_C_1_3_V\t\t\t(0 << 0)\n# define DAC_C_1_1_V\t\t\t(1 << 0)\n# define DAC_C_0_7_V\t\t\t(2 << 0)\n# define DAC_C_OFF\t\t\t(3 << 0)\n/** @} */\n\n/**\n * CSC coefficients are stored in a floating point format with 9 bits of\n * mantissa and 2 or 3 bits of exponent.  The exponent is represented as 2**-n,\n * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with\n * -1 (0x3) being the only legal negative value.\n */\n#define TV_CSC_Y\t\t0x68010\n# define TV_RY_MASK\t\t\t0x07ff0000\n# define TV_RY_SHIFT\t\t\t16\n# define TV_GY_MASK\t\t\t0x00000fff\n# define TV_GY_SHIFT\t\t\t0\n\n#define TV_CSC_Y2\t\t0x68014\n# define TV_BY_MASK\t\t\t0x07ff0000\n# define TV_BY_SHIFT\t\t\t16\n/**\n * Y attenuation for component video.\n *\n * Stored in 1.9 fixed point.\n */\n# define TV_AY_MASK\t\t\t0x000003ff\n# define TV_AY_SHIFT\t\t\t0\n\n#define TV_CSC_U\t\t0x68018\n# define TV_RU_MASK\t\t\t0x07ff0000\n# define TV_RU_SHIFT\t\t\t16\n# define TV_GU_MASK\t\t\t0x000007ff\n# define TV_GU_SHIFT\t\t\t0\n\n#define TV_CSC_U2\t\t0x6801c\n# define TV_BU_MASK\t\t\t0x07ff0000\n# define TV_BU_SHIFT\t\t\t16\n/**\n * U attenuation for component video.\n *\n * Stored in 1.9 fixed point.\n */\n# define TV_AU_MASK\t\t\t0x000003ff\n# define TV_AU_SHIFT\t\t\t0\n\n#define TV_CSC_V\t\t0x68020\n# define TV_RV_MASK\t\t\t0x0fff0000\n# define TV_RV_SHIFT\t\t\t16\n# define TV_GV_MASK\t\t\t0x000007ff\n# define TV_GV_SHIFT\t\t\t0\n\n#define TV_CSC_V2\t\t0x68024\n# define TV_BV_MASK\t\t\t0x07ff0000\n# define TV_BV_SHIFT\t\t\t16\n/**\n * V attenuation for component video.\n *\n * Stored in 1.9 fixed point.\n */\n# define TV_AV_MASK\t\t\t0x000007ff\n# define TV_AV_SHIFT\t\t\t0\n\n/** @defgroup TV_CSC_KNOBS\n * @{\n */\n#define TV_CLR_KNOBS\t\t0x68028\n/** 2s-complement brightness adjustment */\n# define TV_BRIGHTNESS_MASK\t\t0xff000000\n# define TV_BRIGHTNESS_SHIFT\t\t24\n/** Contrast adjustment, as a 2.6 unsigned floating point number */\n# define TV_CONTRAST_MASK\t\t0x00ff0000\n# define TV_CONTRAST_SHIFT\t\t16\n/** Saturation adjustment, as a 2.6 unsigned floating point number */\n# define TV_SATURATION_MASK\t\t0x0000ff00\n# define TV_SATURATION_SHIFT\t\t8\n/** Hue adjustment, as an integer phase angle in degrees */\n# define TV_HUE_MASK\t\t\t0x000000ff\n# define TV_HUE_SHIFT\t\t\t0\n/** @} */\n\n/** @defgroup TV_CLR_LEVEL\n * @{\n */\n#define TV_CLR_LEVEL\t\t0x6802c\n/** Controls the DAC level for black */\n# define TV_BLACK_LEVEL_MASK\t\t0x01ff0000\n# define TV_BLACK_LEVEL_SHIFT\t\t16\n/** Controls the DAC level for blanking */\n# define TV_BLANK_LEVEL_MASK\t\t0x000001ff\n# define TV_BLANK_LEVEL_SHIFT\t\t0\n/* @} */\n\n/** @defgroup TV_H_CTL_1\n * @{\n */\n#define TV_H_CTL_1\t\t0x68030\n/** Number of pixels in the hsync. */\n# define TV_HSYNC_END_MASK\t\t0x1fff0000\n# define TV_HSYNC_END_SHIFT\t\t16\n/** Total number of pixels minus one in the line (display and blanking). */\n# define TV_HTOTAL_MASK\t\t\t0x00001fff\n# define TV_HTOTAL_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_H_CTL_2\n * @{\n */\n#define TV_H_CTL_2\t\t0x68034\n/** Enables the colorburst (needed for non-component color) */\n# define TV_BURST_ENA\t\t\t(1 << 31)\n/** Offset of the colorburst from the start of hsync, in pixels minus one. */\n# define TV_HBURST_START_SHIFT\t\t16\n# define TV_HBURST_START_MASK\t\t0x1fff0000\n/** Length of the colorburst */\n# define TV_HBURST_LEN_SHIFT\t\t0\n# define TV_HBURST_LEN_MASK\t\t0x0001fff\n/** @} */\n\n/** @defgroup TV_H_CTL_3\n * @{\n */\n#define TV_H_CTL_3\t\t0x68038\n/** End of hblank, measured in pixels minus one from start of hsync */\n# define TV_HBLANK_END_SHIFT\t\t16\n# define TV_HBLANK_END_MASK\t\t0x1fff0000\n/** Start of hblank, measured in pixels minus one from start of hsync */\n# define TV_HBLANK_START_SHIFT\t\t0\n# define TV_HBLANK_START_MASK\t\t0x0001fff\n/** @} */\n\n/** @defgroup TV_V_CTL_1\n * @{\n */\n#define TV_V_CTL_1\t\t0x6803c\n/** XXX */\n# define TV_NBR_END_SHIFT\t\t16\n# define TV_NBR_END_MASK\t\t0x07ff0000\n/** XXX */\n# define TV_VI_END_F1_SHIFT\t\t8\n# define TV_VI_END_F1_MASK\t\t0x00003f00\n/** XXX */\n# define TV_VI_END_F2_SHIFT\t\t0\n# define TV_VI_END_F2_MASK\t\t0x0000003f\n/** @} */\n\n/** @defgroup TV_V_CTL_2\n * @{\n */\n#define TV_V_CTL_2\t\t0x68040\n/** Length of vsync, in half lines */\n# define TV_VSYNC_LEN_MASK\t\t0x07ff0000\n# define TV_VSYNC_LEN_SHIFT\t\t16\n/** Offset of the start of vsync in field 1, measured in one less than the\n * number of half lines.\n */\n# define TV_VSYNC_START_F1_MASK\t\t0x00007f00\n# define TV_VSYNC_START_F1_SHIFT\t8\n/**\n * Offset of the start of vsync in field 2, measured in one less than the\n * number of half lines.\n */\n# define TV_VSYNC_START_F2_MASK\t\t0x0000007f\n# define TV_VSYNC_START_F2_SHIFT\t0\n/** @} */\n\n/** @defgroup TV_V_CTL_3\n * @{\n */\n#define TV_V_CTL_3\t\t0x68044\n/** Enables generation of the equalization signal */\n# define TV_EQUAL_ENA\t\t\t(1 << 31)\n/** Length of vsync, in half lines */\n# define TV_VEQ_LEN_MASK\t\t0x007f0000\n# define TV_VEQ_LEN_SHIFT\t\t16\n/** Offset of the start of equalization in field 1, measured in one less than\n * the number of half lines.\n */\n# define TV_VEQ_START_F1_MASK\t\t0x0007f00\n# define TV_VEQ_START_F1_SHIFT\t\t8\n/**\n * Offset of the start of equalization in field 2, measured in one less than\n * the number of half lines.\n */\n# define TV_VEQ_START_F2_MASK\t\t0x000007f\n# define TV_VEQ_START_F2_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_V_CTL_4\n * @{\n */\n#define TV_V_CTL_4\t\t0x68048\n/**\n * Offset to start of vertical colorburst, measured in one less than the\n * number of lines from vertical start.\n */\n# define TV_VBURST_START_F1_MASK\t0x003f0000\n# define TV_VBURST_START_F1_SHIFT\t16\n/**\n * Offset to the end of vertical colorburst, measured in one less than the\n * number of lines from the start of NBR.\n */\n# define TV_VBURST_END_F1_MASK\t\t0x000000ff\n# define TV_VBURST_END_F1_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_V_CTL_5\n * @{\n */\n#define TV_V_CTL_5\t\t0x6804c\n/**\n * Offset to start of vertical colorburst, measured in one less than the\n * number of lines from vertical start.\n */\n# define TV_VBURST_START_F2_MASK\t0x003f0000\n# define TV_VBURST_START_F2_SHIFT\t16\n/**\n * Offset to the end of vertical colorburst, measured in one less than the\n * number of lines from the start of NBR.\n */\n# define TV_VBURST_END_F2_MASK\t\t0x000000ff\n# define TV_VBURST_END_F2_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_V_CTL_6\n * @{\n */\n#define TV_V_CTL_6\t\t0x68050\n/**\n * Offset to start of vertical colorburst, measured in one less than the\n * number of lines from vertical start.\n */\n# define TV_VBURST_START_F3_MASK\t0x003f0000\n# define TV_VBURST_START_F3_SHIFT\t16\n/**\n * Offset to the end of vertical colorburst, measured in one less than the\n * number of lines from the start of NBR.\n */\n# define TV_VBURST_END_F3_MASK\t\t0x000000ff\n# define TV_VBURST_END_F3_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_V_CTL_7\n * @{\n */\n#define TV_V_CTL_7\t\t0x68054\n/**\n * Offset to start of vertical colorburst, measured in one less than the\n * number of lines from vertical start.\n */\n# define TV_VBURST_START_F4_MASK\t0x003f0000\n# define TV_VBURST_START_F4_SHIFT\t16\n/**\n * Offset to the end of vertical colorburst, measured in one less than the\n * number of lines from the start of NBR.\n */\n# define TV_VBURST_END_F4_MASK\t\t0x000000ff\n# define TV_VBURST_END_F4_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_SC_CTL_1\n * @{\n */\n#define TV_SC_CTL_1\t\t0x68060\n/** Turns on the first subcarrier phase generation DDA */\n# define TV_SC_DDA1_EN\t\t\t(1 << 31)\n/** Turns on the first subcarrier phase generation DDA */\n# define TV_SC_DDA2_EN\t\t\t(1 << 30)\n/** Turns on the first subcarrier phase generation DDA */\n# define TV_SC_DDA3_EN\t\t\t(1 << 29)\n/** Sets the subcarrier DDA to reset frequency every other field */\n# define TV_SC_RESET_EVERY_2\t\t(0 << 24)\n/** Sets the subcarrier DDA to reset frequency every fourth field */\n# define TV_SC_RESET_EVERY_4\t\t(1 << 24)\n/** Sets the subcarrier DDA to reset frequency every eighth field */\n# define TV_SC_RESET_EVERY_8\t\t(2 << 24)\n/** Sets the subcarrier DDA to never reset the frequency */\n# define TV_SC_RESET_NEVER\t\t(3 << 24)\n/** Sets the peak amplitude of the colorburst.*/\n# define TV_BURST_LEVEL_MASK\t\t0x00ff0000\n# define TV_BURST_LEVEL_SHIFT\t\t16\n/** Sets the increment of the first subcarrier phase generation DDA */\n# define TV_SCDDA1_INC_MASK\t\t0x00000fff\n# define TV_SCDDA1_INC_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_SC_CTL_2\n * @{\n */\n#define TV_SC_CTL_2\t\t0x68064\n/** Sets the rollover for the second subcarrier phase generation DDA */\n# define TV_SCDDA2_SIZE_MASK\t\t0x7fff0000\n# define TV_SCDDA2_SIZE_SHIFT\t\t16\n/** Sets the increent of the second subcarrier phase generation DDA */\n# define TV_SCDDA2_INC_MASK\t\t0x00007fff\n# define TV_SCDDA2_INC_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_SC_CTL_3\n * @{\n */\n#define TV_SC_CTL_3\t\t0x68068\n/** Sets the rollover for the third subcarrier phase generation DDA */\n# define TV_SCDDA3_SIZE_MASK\t\t0x7fff0000\n# define TV_SCDDA3_SIZE_SHIFT\t\t16\n/** Sets the increent of the third subcarrier phase generation DDA */\n# define TV_SCDDA3_INC_MASK\t\t0x00007fff\n# define TV_SCDDA3_INC_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_WIN_POS\n * @{\n */\n#define TV_WIN_POS\t\t0x68070\n/** X coordinate of the display from the start of horizontal active */\n# define TV_XPOS_MASK\t\t\t0x1fff0000\n# define TV_XPOS_SHIFT\t\t\t16\n/** Y coordinate of the display from the start of vertical active (NBR) */\n# define TV_YPOS_MASK\t\t\t0x00000fff\n# define TV_YPOS_SHIFT\t\t\t0\n/** @} */\n\n/** @defgroup TV_WIN_SIZE\n * @{\n */\n#define TV_WIN_SIZE\t\t0x68074\n/** Horizontal size of the display window, measured in pixels*/\n# define TV_XSIZE_MASK\t\t\t0x1fff0000\n# define TV_XSIZE_SHIFT\t\t\t16\n/**\n * Vertical size of the display window, measured in pixels.\n *\n * Must be even for interlaced modes.\n */\n# define TV_YSIZE_MASK\t\t\t0x00000fff\n# define TV_YSIZE_SHIFT\t\t\t0\n/** @} */\n\n/** @defgroup TV_FILTER_CTL_1\n * @{\n */\n#define TV_FILTER_CTL_1\t\t0x68080\n/**\n * Enables automatic scaling calculation.\n *\n * If set, the rest of the registers are ignored, and the calculated values can\n * be read back from the register.\n */\n# define TV_AUTO_SCALE\t\t\t(1 << 31)\n/**\n * Disables the vertical filter.\n *\n * This is required on modes more than 1024 pixels wide */\n# define TV_V_FILTER_BYPASS\t\t(1 << 29)\n/** Enables adaptive vertical filtering */\n# define TV_VADAPT\t\t\t(1 << 28)\n# define TV_VADAPT_MODE_MASK\t\t(3 << 26)\n/** Selects the least adaptive vertical filtering mode */\n# define TV_VADAPT_MODE_LEAST\t\t(0 << 26)\n/** Selects the moderately adaptive vertical filtering mode */\n# define TV_VADAPT_MODE_MODERATE\t(1 << 26)\n/** Selects the most adaptive vertical filtering mode */\n# define TV_VADAPT_MODE_MOST\t\t(3 << 26)\n/**\n * Sets the horizontal scaling factor.\n *\n * This should be the fractional part of the horizontal scaling factor divided\n * by the oversampling rate.  TV_HSCALE should be less than 1, and set to:\n *\n * (src width - 1) / ((oversample * dest width) - 1)\n */\n# define TV_HSCALE_FRAC_MASK\t\t0x00003fff\n# define TV_HSCALE_FRAC_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_FILTER_CTL_2\n * @{\n */\n#define TV_FILTER_CTL_2\t\t0x68084\n/**\n * Sets the integer part of the 3.15 fixed-point vertical scaling factor.\n *\n * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)\n */\n# define TV_VSCALE_INT_MASK\t\t0x00038000\n# define TV_VSCALE_INT_SHIFT\t\t15\n/**\n * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.\n *\n * \\sa TV_VSCALE_INT_MASK\n */\n# define TV_VSCALE_FRAC_MASK\t\t0x00007fff\n# define TV_VSCALE_FRAC_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_FILTER_CTL_3\n * @{\n */\n#define TV_FILTER_CTL_3\t\t0x68088\n/**\n * Sets the integer part of the 3.15 fixed-point vertical scaling factor.\n *\n * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))\n *\n * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.\n */\n# define TV_VSCALE_IP_INT_MASK\t\t0x00038000\n# define TV_VSCALE_IP_INT_SHIFT\t\t15\n/**\n * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.\n *\n * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.\n *\n * \\sa TV_VSCALE_IP_INT_MASK\n */\n# define TV_VSCALE_IP_FRAC_MASK\t\t0x00007fff\n# define TV_VSCALE_IP_FRAC_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_CC_CONTROL\n * @{\n */\n#define TV_CC_CONTROL\t\t0x68090\n# define TV_CC_ENABLE\t\t\t(1 << 31)\n/**\n * Specifies which field to send the CC data in.\n *\n * CC data is usually sent in field 0.\n */\n# define TV_CC_FID_MASK\t\t\t(1 << 27)\n# define TV_CC_FID_SHIFT\t\t27\n/** Sets the horizontal position of the CC data.  Usually 135. */\n# define TV_CC_HOFF_MASK\t\t0x03ff0000\n# define TV_CC_HOFF_SHIFT\t\t16\n/** Sets the vertical position of the CC data.  Usually 21 */\n# define TV_CC_LINE_MASK\t\t0x0000003f\n# define TV_CC_LINE_SHIFT\t\t0\n/** @} */\n\n/** @defgroup TV_CC_DATA\n * @{\n */\n#define TV_CC_DATA\t\t0x68094\n# define TV_CC_RDY\t\t\t(1 << 31)\n/** Second word of CC data to be transmitted. */\n# define TV_CC_DATA_2_MASK\t\t0x007f0000\n# define TV_CC_DATA_2_SHIFT\t\t16\n/** First word of CC data to be transmitted. */\n# define TV_CC_DATA_1_MASK\t\t0x0000007f\n# define TV_CC_DATA_1_SHIFT\t\t0\n/** @}\n */\n\n/** @{ */\n#define TV_H_LUMA_0\t\t0x68100\n#define TV_H_LUMA_59\t\t0x681ec\n#define TV_H_CHROMA_0\t\t0x68200\n#define TV_H_CHROMA_59\t\t0x682ec\n#define TV_V_LUMA_0\t\t0x68300\n#define TV_V_LUMA_42\t\t0x683a8\n#define TV_V_CHROMA_0\t\t0x68400\n#define TV_V_CHROMA_42\t\t0x684a8\n/** @} */\n\n#define PIPEA_DSL\t\t0x70000\n\n#define PIPEACONF 0x70008\n#define PIPEACONF_ENABLE\t(1<<31)\n#define PIPEACONF_DISABLE\t0\n#define PIPEACONF_DOUBLE_WIDE\t(1<<30)\n#define I965_PIPECONF_ACTIVE\t(1<<30)\n#define PIPEACONF_SINGLE_WIDE\t0\n#define PIPEACONF_PIPE_UNLOCKED 0\n#define PIPEACONF_PIPE_LOCKED\t(1<<25)\n#define PIPEACONF_PALETTE\t0\n#define PIPEACONF_GAMMA \t(1<<24)\n#define PIPECONF_FORCE_BORDER\t(1<<25)\n#define PIPECONF_PROGRESSIVE\t(0 << 21)\n#define PIPECONF_INTERLACE_W_FIELD_INDICATION\t(6 << 21)\n#define PIPECONF_INTERLACE_FIELD_0_ONLY\t\t(7 << 21)\n/* ironlake: gamma */\n#define PIPECONF_PALETTE_8BIT\t(0<<24)\n#define PIPECONF_PALETTE_10BIT\t(1<<24)\n#define PIPECONF_PALETTE_12BIT\t(2<<24)\n#define PIPECONF_FORCE_BORDER\t(1<<25)\n#define PIPECONF_PROGRESSIVE\t(0 << 21)\n#define PIPECONF_INTERLACE_W_FIELD_INDICATION\t(6 << 21)\n#define PIPECONF_INTERLACE_FIELD_0_ONLY\t\t(7 << 21)\n/* ironlake */\n#define PIPECONF_MSA_TIMING_DELAY\t(0<<18) /* for eDP */\n#define PIPECONF_NO_DYNAMIC_RATE_CHANGE\t(0 << 16)\n#define PIPECONF_NO_ROTATION\t\t(0<<14)\n#define PIPECONF_FULL_COLOR_RANGE\t(0<<13)\n#define PIPECONF_CE_COLOR_RANGE\t\t(1<<13)\n#define PIPECONF_COLOR_SPACE_RGB\t(0<<11)\n#define PIPECONF_COLOR_SPACE_YUV601\t(1<<11)\n#define PIPECONF_COLOR_SPACE_YUV709\t(2<<11)\n#define PIPECONF_CONNECT_DEFAULT\t(0<<9)\n#define PIPECONF_8BPP\t\t\t(0<<5)\n#define PIPECONF_10BPP\t\t\t(1<<5)\n#define PIPECONF_6BPP\t\t\t(2<<5)\n#define PIPECONF_12BPP\t\t\t(3<<5)\n#define PIPECONF_ENABLE_DITHER\t\t(1<<4)\n#define PIPECONF_DITHER_SPATIAL\t\t(0<<2)\n#define PIPECONF_DITHER_ST1\t\t(1<<2)\n#define PIPECONF_DITHER_ST2\t\t(2<<2)\n#define PIPECONF_DITHER_TEMPORAL\t(3<<2)\n\n#define PIPEAGCMAXRED\t\t0x70010\n#define PIPEAGCMAXGREEN\t\t0x70014\n#define PIPEAGCMAXBLUE\t\t0x70018\n#define PIPEASTAT\t\t0x70024\n# define FIFO_UNDERRUN\t\t(1 << 31)\n# define CRC_ERROR_ENABLE\t(1 << 29)\n# define CRC_DONE_ENABLE\t(1 << 28)\n# define GMBUS_EVENT_ENABLE\t(1 << 27)\n# define VSYNC_INT_ENABLE\t(1 << 25)\n# define DLINE_COMPARE_ENABLE\t(1 << 24)\n# define DPST_EVENT_ENABLE\t(1 << 23)\n# define LBLC_EVENT_ENABLE\t(1 << 22)\n# define OFIELD_INT_ENABLE\t(1 << 21)\n# define EFIELD_INT_ENABLE\t(1 << 20)\n# define SVBLANK_INT_ENABLE\t(1 << 18)\n# define VBLANK_INT_ENABLE\t(1 << 17)\n# define OREG_UPDATE_ENABLE\t(1 << 16)\n# define CRC_ERROR_INT_STATUS\t(1 << 13)\n# define CRC_DONE_INT_STATUS\t(1 << 12)\n# define GMBUS_INT_STATUS\t(1 << 11)\n# define VSYNC_INT_STATUS\t(1 << 9)\n# define DLINE_COMPARE_STATUS\t(1 << 8)\n# define DPST_EVENT_STATUS\t(1 << 7)\n# define LBLC_EVENT_STATUS\t(1 << 6)\n# define OFIELD_INT_STATUS\t(1 << 5)\n# define EFIELD_INT_STATUS\t(1 << 4)\n# define SVBLANK_INT_STATUS\t(1 << 2)\n# define VBLANK_INT_STATUS\t(1 << 1)\n# define OREG_UPDATE_STATUS\t(1 << 0)\n\t\t\t\t \n#define FW_BLC\t\t0x020d8\n#define FW_BLC2\t\t0x020dc\n#define FW_BLC_SELF\t0x020e0 /* 915+ only */\n\n#define DSPARB\t\t\t0x70030\n#define   DSPARB_CSTART_SHIFT\t7\n#define   DSPARB_BSTART_SHIFT\t0\n#define   DSPARB_BEND_SHIFT\t9 /* on 855 */\n#define   DSPARB_AEND_SHIFT\t0\n#define DSPFW1\t\t\t0x70034\n#define DSPFW2\t\t\t0x70038\n#define DSPFW3\t\t\t0x7003c\n/*\n * The two pipe frame counter registers are not synchronized, so\n * reading a stable value is somewhat tricky. The following code \n * should work:\n *\n *  do {\n *    high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT;\n *    low1 =  ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >> PIPE_FRAME_LOW_SHIFT);\n *    high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >> PIPE_FRAME_HIGH_SHIFT);\n *  } while (high1 != high2);\n *  frame = (high1 << 8) | low1;\n */\n#define PIPEAFRAMEHIGH\t\t0x70040\n#define PIPE_FRAME_HIGH_MASK\t0x0000ffff\n#define PIPE_FRAME_HIGH_SHIFT\t0\n#define PIPEAFRAMEPIXEL\t\t0x70044\n#define PIPE_FRAME_LOW_MASK\t0xff000000\n#define PIPE_FRAME_LOW_SHIFT\t24\n/*\n * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register\n * and is 24 bits wide.\n */\n#define PIPE_PIXEL_MASK\t\t0x00ffffff\n#define PIPE_PIXEL_SHIFT\t0\n\n/*\n * Computing GMCH M and N values.\n *\n * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes\n *\n * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)\n *\n * The GMCH value is used internally\n */\n#define PIPEA_GMCH_DATA_M\t0x70050\n\n/* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */\n#define PIPE_GMCH_DATA_M_TU_SIZE_MASK\t(0x3f << 25)\n#define PIPE_GMCH_DATA_M_TU_SIZE_SHIFT\t25\n\n#define PIPE_GMCH_DATA_M_MASK\t\t(0xffffff)\n\n#define PIPEA_GMCH_DATA_N\t0x70054\n#define PIPE_GMCH_DATA_N_MASK\t\t(0xffffff)\n\n/*\n * Computing Link M and N values.\n *\n * Link M / N = pixel_clock / ls_clk\n *\n * (the DP spec calls pixel_clock the 'strm_clk')\n *\n * The Link value is transmitted in the Main Stream\n * Attributes and VB-ID.\n */\n\n#define PIPEA_DP_LINK_M\t\t0x70060\n#define PIPEA_DP_LINK_M_MASK\t(0xffffff)\n\n#define PIPEA_DP_LINK_N\t\t0x70064\n#define PIPEA_DP_LINK_N_MASK\t(0xffffff)\n\n#define PIPEB_DSL\t\t0x71000\n\n#define PIPEBCONF \t\t0x71008\n\n#define PIPEBGCMAXRED\t\t0x71010\n#define PIPEBGCMAXGREEN\t\t0x71014\n#define PIPEBGCMAXBLUE\t\t0x71018\n#define PIPEBSTAT\t\t0x71024\n#define PIPEBFRAMEHIGH\t\t0x71040\n#define PIPEBFRAMEPIXEL\t\t0x71044\n\n#define PIPEB_GMCH_DATA_M\t0x71050\n#define PIPEB_GMCH_DATA_N\t0x71054\n#define PIPEB_DP_LINK_M\t\t0x71060\n#define PIPEB_DP_LINK_N\t\t0x71064\n\n#define PIPECCONF \t\t0x72008\n\n#define PIPECGCMAXRED\t\t0x72010\n#define PIPECGCMAXGREEN\t\t0x72014\n#define PIPECGCMAXBLUE\t\t0x72018\n#define PIPECSTAT\t\t0x72024\n#define PIPECFRAMEHIGH\t\t0x72040\n#define PIPECFRAMEPIXEL\t\t0x72044\n\n#define PIPEC_GMCH_DATA_M\t0x72050\n#define PIPEC_GMCH_DATA_N\t0x72054\n#define PIPEC_DP_LINK_M\t\t0x72060\n#define PIPEC_DP_LINK_N\t\t0x72064\n\n#define PIPEEDPCONF\t\t0x7F008\n\n#define DSPACNTR\t\t0x70180\n#define DSPBCNTR\t\t0x71180\n#define DSPCCNTR\t\t0x72180\n#define DISPLAY_PLANE_ENABLE \t\t\t(1<<31)\n#define DISPLAY_PLANE_DISABLE\t\t\t0\n#define DISPLAY_PLANE_TILED\t\t\t(1<<10)\n#define DISPPLANE_GAMMA_ENABLE\t\t\t(1<<30)\n#define DISPPLANE_GAMMA_DISABLE\t\t\t0\n#define DISPPLANE_PIXFORMAT_MASK\t\t(0xf<<26)\n#define DISPPLANE_8BPP\t\t\t\t(0x2<<26)\n#define DISPPLANE_15_16BPP\t\t\t(0x4<<26)\n#define DISPPLANE_16BPP\t\t\t\t(0x5<<26)\n#define DISPPLANE_32BPP_NO_ALPHA \t\t(0x6<<26)\n#define DISPPLANE_32BPP\t\t\t\t(0x7<<26)\n#define DISPPLANE_STEREO_ENABLE\t\t\t(1<<25)\n#define DISPPLANE_STEREO_DISABLE\t\t0\n#define DISPPLANE_SEL_PIPE_MASK\t\t\t(1<<24)\n#define DISPPLANE_SEL_PIPE_A\t\t\t0\n#define DISPPLANE_SEL_PIPE_B\t\t\t(1<<24)\n#define DISPPLANE_SRC_KEY_ENABLE\t\t(1<<22)\n#define DISPPLANE_SRC_KEY_DISABLE\t\t0\n#define DISPPLANE_LINE_DOUBLE\t\t\t(1<<20)\n#define DISPPLANE_NO_LINE_DOUBLE\t\t0\n#define DISPPLANE_STEREO_POLARITY_FIRST\t\t0\n#define DISPPLANE_STEREO_POLARITY_SECOND\t(1<<18)\n/* plane B only */\n#define DISPPLANE_ALPHA_TRANS_ENABLE\t\t(1<<15)\n#define DISPPLANE_ALPHA_TRANS_DISABLE\t\t0\n#define DISPPLANE_SPRITE_ABOVE_DISPLAYA\t\t0\n#define DISPPLANE_SPRITE_ABOVE_OVERLAY\t\t(1)\n\n#define DSPABASE\t\t0x70184\n#define DSPASTRIDE\t\t0x70188\n\n#define DSPBBASE\t\t0x71184\n#define DSPBADDR\t\tDSPBBASE\n#define DSPBSTRIDE\t\t0x71188\n\n#define DSPCBASE\t\t0x72184\n#define DSPCADDR\t\tDSPCBASE\n#define DSPCSTRIDE\t\t0x72188\n\n#define DSPAKEYVAL\t\t0x70194\n#define DSPAKEYMASK\t\t0x70198\n\n#define DSPAPOS\t\t\t0x7018C /* reserved */\n#define DSPASIZE\t\t0x70190\n#define DSPBPOS\t\t\t0x7118C\n#define DSPBSIZE\t\t0x71190\n\n#define DSPASURF\t\t0x7019C\n#define DSPATILEOFF\t\t0x701A4\n\n#define DSPBSURF\t\t0x7119C\n#define DSPBTILEOFF\t\t0x711A4\n\n#define DSPCSURF\t\t0x7219C\n#define DSPCTILEOFF\t\t0x721A4\n\n#define VGACNTRL\t\t0x71400\n# define VGA_DISP_DISABLE\t\t\t(1 << 31)\n# define VGA_2X_MODE\t\t\t\t(1 << 30)\n# define VGA_PIPE_B_SELECT\t\t\t(1 << 29)\n\n/* Various masks for reserved bits, etc. */\n#define I830_FWATER1_MASK        (~((1<<11)|(1<<10)|(1<<9)|      \\\n        (1<<8)|(1<<26)|(1<<25)|(1<<24)|(1<<5)|(1<<4)|(1<<3)|    \\\n        (1<<2)|(1<<1)|1|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16)))\n#define I830_FWATER2_MASK ~(0)\n\n#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)\n#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)\n#define VGA0_N_DIVISOR_MASK     ((1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))\n#define VGA0_M1_DIVISOR_MASK    ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))\n#define VGA0_M2_DIVISOR_MASK    ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)\n#define VGA0_M1M2N_RESERVED\t~(VGA0_N_DIVISOR_MASK|VGA0_M1_DIVISOR_MASK|VGA0_M2_DIVISOR_MASK)\n#define VGA0_POSTDIV_MASK       ((1<<7)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)\n#define VGA1_POSTDIV_MASK       ((1<<15)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8))\n#define VGA_POSTDIV_RESERVED\t~(VGA0_POSTDIV_MASK|VGA1_POSTDIV_MASK|(1<<7)|(1<<15))\n#define DPLLA_POSTDIV_MASK ((1<<23)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))\n#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)\n#define ADPA_RESERVED\t((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))\n#define SUPER_WORD              32\n#define BURST_A_MASK    ((1<<11)|(1<<10)|(1<<9)|(1<<8))\n#define BURST_B_MASK    ((1<<26)|(1<<25)|(1<<24))\n#define WATER_A_MASK    ((1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|1)\n#define WATER_B_MASK    ((1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16))\n#define WATER_RESERVED\t((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))\n#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)\n#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)\n#define DSPACNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0xffff)\n#define DSPBCNTR_RESERVED ((1<<23)|(1<<19)|(1<<17)|(1<<16)|0x7ffe)\n\n#define I830_GMCH_CTRL\t\t0x52\n\n#define I830_GMCH_ENABLED\t0x4\n#define I830_GMCH_MEM_MASK\t0x1\n#define I830_GMCH_MEM_64M\t0x1\n#define I830_GMCH_MEM_128M\t0\n\n#define I830_GMCH_GMS_MASK\t\t\t0x70\n#define I830_GMCH_GMS_DISABLED\t\t\t0x00\n#define I830_GMCH_GMS_LOCAL\t\t\t0x10\n#define I830_GMCH_GMS_STOLEN_512\t\t0x20\n#define I830_GMCH_GMS_STOLEN_1024\t\t0x30\n#define I830_GMCH_GMS_STOLEN_8192\t\t0x40\n\n#define I830_RDRAM_CHANNEL_TYPE\t\t0x03010\n#define I830_RDRAM_ND(x)\t\t\t(((x) & 0x20) >> 5)\n#define I830_RDRAM_DDT(x)\t\t\t(((x) & 0x18) >> 3)\n\n#define I855_GMCH_GMS_MASK\t\t\t(0xF << 4)\n#define I855_GMCH_GMS_DISABLED\t\t\t0x00\n#define I855_GMCH_GMS_STOLEN_1M\t\t\t(0x1 << 4)\n#define I855_GMCH_GMS_STOLEN_4M\t\t\t(0x2 << 4)\n#define I855_GMCH_GMS_STOLEN_8M\t\t\t(0x3 << 4)\n#define I855_GMCH_GMS_STOLEN_16M\t\t(0x4 << 4)\n#define I855_GMCH_GMS_STOLEN_32M\t\t(0x5 << 4)\n#define I915G_GMCH_GMS_STOLEN_48M\t\t(0x6 << 4)\n#define I915G_GMCH_GMS_STOLEN_64M\t\t(0x7 << 4)\n#define G33_GMCH_GMS_STOLEN_128M\t\t(0x8 << 4)\n#define G33_GMCH_GMS_STOLEN_256M\t\t(0x9 << 4)\n#define INTEL_GMCH_GMS_STOLEN_96M\t\t(0xa << 4)\n#define INTEL_GMCH_GMS_STOLEN_160M\t\t(0xb << 4)\n#define INTEL_GMCH_GMS_STOLEN_224M\t\t(0xc << 4)\n#define INTEL_GMCH_GMS_STOLEN_352M\t\t(0xd << 4)\n\n\n#define I85X_CAPID\t\t\t0x44\n#define I85X_VARIANT_MASK\t\t\t0x7\n#define I85X_VARIANT_SHIFT\t\t\t5\n#define I855_GME\t\t\t\t0x0\n#define I855_GM\t\t\t\t\t0x4\n#define I852_GME\t\t\t\t0x2\n#define I852_GM\t\t\t\t\t0x5\n\n#define I915_GCFGC\t\t\t0xf0\n#define I915_LOW_FREQUENCY_ENABLE\t\t(1 << 7)\n#define I915_DISPLAY_CLOCK_190_200_MHZ\t\t(0 << 4)\n#define I915_DISPLAY_CLOCK_333_MHZ\t\t(4 << 4)\n#define I915_DISPLAY_CLOCK_MASK\t\t\t(7 << 4)\n\n#define I855_HPLLCC\t\t\t0xc0\n#define I855_CLOCK_CONTROL_MASK\t\t\t(3 << 0)\n#define I855_CLOCK_133_200\t\t\t(0 << 0)\n#define I855_CLOCK_100_200\t\t\t(1 << 0)\n#define I855_CLOCK_100_133\t\t\t(2 << 0)\n#define I855_CLOCK_166_250\t\t\t(3 << 0)\n\n/* BLT commands */\n#define COLOR_BLT_CMD\t\t((2<<29)|(0x40<<22)|(0x3))\n#define COLOR_BLT_WRITE_ALPHA\t(1<<21)\n#define COLOR_BLT_WRITE_RGB\t(1<<20)\n\n#define XY_COLOR_BLT_CMD_NOLEN\t\t((2<<29)|(0x50<<22))\n#define XY_COLOR_BLT_WRITE_ALPHA\t(1<<21)\n#define XY_COLOR_BLT_WRITE_RGB\t\t(1<<20)\n#define XY_COLOR_BLT_TILED\t\t(1<<11)\n\n#define XY_SETUP_CLIP_BLT_CMD\t\t((2<<29)|(3<<22)|1)\n\n#define XY_SRC_COPY_BLT_CMD\t\t((2<<29)|(0x53<<22))\n#define XY_SRC_COPY_BLT_WRITE_ALPHA\t(1<<21)\n#define XY_SRC_COPY_BLT_WRITE_RGB\t(1<<20)\n#define XY_SRC_COPY_BLT_SRC_TILED\t(1<<15)\n#define XY_SRC_COPY_BLT_DST_TILED\t(1<<11)\n\n#define SRC_COPY_BLT_CMD\t\t((2<<29)|(0x43<<22)|0x4)\n#define SRC_COPY_BLT_WRITE_ALPHA\t(1<<21)\n#define SRC_COPY_BLT_WRITE_RGB\t\t(1<<20)\n\n#define XY_PAT_BLT_IMMEDIATE\t\t((2<<29)|(0x72<<22))\n\n#define XY_MONO_PAT_BLT_CMD\t\t((0x2<<29)|(0x52<<22)|0x7)\n#define XY_MONO_PAT_VERT_SEED\t\t((1<<10)|(1<<9)|(1<<8))\n#define XY_MONO_PAT_HORT_SEED\t\t((1<<14)|(1<<13)|(1<<12))\n#define XY_MONO_PAT_BLT_WRITE_ALPHA\t(1<<21)\n#define XY_MONO_PAT_BLT_WRITE_RGB\t(1<<20)\n\n#define XY_MONO_SRC_BLT_CMD\t\t((0x2<<29)|(0x54<<22)|(0x6))\n#define XY_MONO_SRC_BLT_WRITE_ALPHA\t(1<<21)\n#define XY_MONO_SRC_BLT_WRITE_RGB\t(1<<20)\n\n#define MI_STORE_DWORD_IMM\t\t((0x20<<23)|2)\n#define   MI_MEM_VIRTUAL\t(1 << 22) /* 965+ only */\n\n#define MI_SET_CONTEXT\t\t\t(0x18<<23)\n#define CTXT_NO_RESTORE\t\t\t(1)\n#define CTXT_PALETTE_SAVE_DISABLE\t(1<<3)\n#define CTXT_PALETTE_RESTORE_DISABLE\t(1<<2)\n\n/* Dword 0 */\n#define MI_VERTEX_BUFFER\t\t(0x17<<23)\n#define MI_VERTEX_BUFFER_IDX(x)\t\t(x<<20)\n#define MI_VERTEX_BUFFER_PITCH(x)\t(x<<13)\n#define MI_VERTEX_BUFFER_WIDTH(x)\t(x<<6)\n/* Dword 1 */\n#define MI_VERTEX_BUFFER_DISABLE\t(1)\n\n/* Overlay Flip */\n#define MI_OVERLAY_FLIP\t\t\t(0x11<<23)\n#define MI_OVERLAY_FLIP_CONTINUE\t(0<<21)\n#define MI_OVERLAY_FLIP_ON\t\t(1<<21)\n#define MI_OVERLAY_FLIP_OFF\t\t(2<<21)\n\n/* Wait for Events */\n#define MI_WAIT_FOR_EVENT\t\t(0x03<<23)\n#define MI_WAIT_FOR_PIPEB_SVBLANK\t(1<<18)\n#define MI_WAIT_FOR_PIPEA_SVBLANK\t(1<<17)\n#define MI_WAIT_FOR_OVERLAY_FLIP\t(1<<16)\n#define MI_WAIT_FOR_PIPEB_VBLANK\t(1<<7)\n#define MI_WAIT_FOR_PIPEA_VBLANK\t(1<<3)\n#define MI_WAIT_FOR_PIPEB_SCAN_LINE_WINDOW\t(1<<5)\n#define MI_WAIT_FOR_PIPEA_SCAN_LINE_WINDOW\t(1<<1)\n\n#define MI_LOAD_SCAN_LINES_INCL\t\t(0x12<<23)\n\n/* Flush */\n#define MI_FLUSH\t\t\t(0x04<<23)\n#define MI_WRITE_DIRTY_STATE\t\t(1<<4)\n#define MI_END_SCENE\t\t\t(1<<3)\n#define MI_GLOBAL_SNAPSHOT_COUNT_RESET\t(1<<3)\n#define MI_INHIBIT_RENDER_CACHE_FLUSH\t(1<<2)\n#define MI_STATE_INSTRUCTION_CACHE_FLUSH (1<<1)\n#define MI_INVALIDATE_MAP_CACHE\t\t(1<<0)\n/* broadwater flush bits */\n#define BRW_MI_GLOBAL_SNAPSHOT_RESET   (1 << 3)\n\n/* Noop */\n#define MI_NOOP\t\t\t\t0x00\n#define MI_NOOP_WRITE_ID\t\t(1<<22)\n#define MI_NOOP_ID_MASK\t\t\t(1<<22 - 1)\n\n#define STATE3D_COLOR_FACTOR\t((0x3<<29)|(0x1d<<24)|(0x01<<16))\n\n/* Batch */\n#define MI_BATCH_BUFFER\t\t((0x30 << 23) | 1)\n#define MI_BATCH_BUFFER_START\t(0x31 << 23)\n#define MI_BATCH_BUFFER_END\t(0xA << 23)\n#define MI_BATCH_NON_SECURE\t\t(1)\n#define MI_BATCH_NON_SECURE_I965\t(1 << 8)\n\n#define MAX_DISPLAY_PIPES\t2\n\ntypedef enum {\n   CrtIndex = 0,\n   TvIndex,\n   DfpIndex,\n   LfpIndex,\n   Crt2Index,\n   Tv2Index,\n   Dfp2Index,\n   Lfp2Index,\n   NumDisplayTypes\n} DisplayType;\n\n/* What's connected to the pipes (as reported by the BIOS) */\n#define PIPE_ACTIVE_MASK\t\t0xff\n#define PIPE_CRT_ACTIVE\t\t\t(1 << CrtIndex)\n#define PIPE_TV_ACTIVE\t\t\t(1 << TvIndex)\n#define PIPE_DFP_ACTIVE\t\t\t(1 << DfpIndex)\n#define PIPE_LCD_ACTIVE\t\t\t(1 << LfpIndex)\n#define PIPE_CRT2_ACTIVE\t\t(1 << Crt2Index)\n#define PIPE_TV2_ACTIVE\t\t\t(1 << Tv2Index)\n#define PIPE_DFP2_ACTIVE\t\t(1 << Dfp2Index)\n#define PIPE_LCD2_ACTIVE\t\t(1 << Lfp2Index)\n\n#define PIPE_SIZED_DISP_MASK\t\t(PIPE_DFP_ACTIVE |\t\\\n\t\t\t\t\t PIPE_LCD_ACTIVE |\t\\\n\t\t\t\t\t PIPE_DFP2_ACTIVE)\n\n#define PIPE_A_SHIFT\t\t\t0\n#define PIPE_B_SHIFT\t\t\t8\n#define PIPE_SHIFT(n)\t\t\t((n) == 0 ? \\\n\t\t\t\t\t PIPE_A_SHIFT : PIPE_B_SHIFT)\n\n/*\n * Some BIOS scratch area registers.  The 845 (and 830?) store the amount\n * of video memory available to the BIOS in SWF1.\n */\n\n#define SWF0\t\t\t0x71410\n#define SWF1\t\t\t0x71414\n#define SWF2\t\t\t0x71418\n#define SWF3\t\t\t0x7141c\n#define SWF4\t\t\t0x71420\n#define SWF5\t\t\t0x71424\n#define SWF6\t\t\t0x71428\n\n/*\n * 855 scratch registers.\n */\n#define SWF00\t\t\t0x70410\n#define SWF01\t\t\t0x70414\n#define SWF02\t\t\t0x70418\n#define SWF03\t\t\t0x7041c\n#define SWF04\t\t\t0x70420\n#define SWF05\t\t\t0x70424\n#define SWF06\t\t\t0x70428\n\n#define SWF10\t\t\tSWF0\n#define SWF11\t\t\tSWF1\n#define SWF12\t\t\tSWF2\n#define SWF13\t\t\tSWF3\n#define SWF14\t\t\tSWF4\n#define SWF15\t\t\tSWF5\n#define SWF16\t\t\tSWF6\n\n#define SWF30\t\t\t0x72414\n#define SWF31\t\t\t0x72418\n#define SWF32\t\t\t0x7241c\n\n/*\n * Overlay registers.  These are overlay registers accessed via MMIO.\n * Those loaded via the overlay register page are defined in i830_video.c.\n */\n#define OVADD\t\t\t0x30000\n\n#define DOVSTA\t\t\t0x30008\n#define OC_BUF\t\t\t(0x3<<20)\n\n#define OGAMC5\t\t\t0x30010\n#define OGAMC4\t\t\t0x30014\n#define OGAMC3\t\t\t0x30018\n#define OGAMC2\t\t\t0x3001c\n#define OGAMC1\t\t\t0x30020\n#define OGAMC0\t\t\t0x30024\n\n\n/*\n * Palette registers\n */\n#define PALETTE_A\t\t0x0a000\n#define PALETTE_B\t\t0x0a800\n\n/* Framebuffer compression */\n#define FBC_CFB_BASE\t\t0x03200 /* 4k page aligned */\n#define FBC_LL_BASE\t\t0x03204 /* 4k page aligned */\n#define FBC_CONTROL\t\t0x03208\n#define   FBC_CTL_EN\t\t(1<<31)\n#define   FBC_CTL_PERIODIC\t(1<<30)\n#define   FBC_CTL_INTERVAL_SHIFT (16)\n#define   FBC_CTL_UNCOMPRESSIBLE (1<<14)\n#define   FBC_CTL_STRIDE_SHIFT\t(5)\n#define   FBC_CTL_FENCENO\t(1<<0)\n#define FBC_COMMAND\t\t0x0320c\n#define   FBC_CMD_COMPRESS\t(1<<0)\n#define FBC_STATUS\t\t0x03210\n#define   FBC_STAT_COMPRESSING\t(1<<31)\n#define   FBC_STAT_COMPRESSED\t(1<<30)\n#define   FBC_STAT_MODIFIED\t(1<<29)\n#define   FBC_STAT_CURRENT_LINE\t(1<<0)\n#define FBC_CONTROL2\t\t0x03214\n#define   FBC_CTL_FENCE_DBL\t(0<<4)\n#define   FBC_CTL_IDLE_IMM\t(0<<2)\n#define   FBC_CTL_IDLE_FULL\t(1<<2)\n#define   FBC_CTL_IDLE_LINE\t(2<<2)\n#define   FBC_CTL_IDLE_DEBUG\t(3<<2)\n#define   FBC_CTL_CPU_FENCE\t(1<<1)\n#define   FBC_CTL_PLANEA\t(0<<0)\n#define   FBC_CTL_PLANEB\t(1<<0)\n#define FBC_FENCE_OFF\t\t0x0321b\n#define FBC_MOD_NUM\t\t0x03220\n#define FBC_TAG_DEBUG\t\t0x03300\n\n#define FBC_LL_SIZE\t\t(1536)\n#define FBC_LL_PAD\t\t(32)\n\n/* Framebuffer compression version 2 */\n#define DPFC_CB_BASE\t\t0x3200\n#define DPFC_CONTROL\t\t0x3208\n#define   DPFC_CTL_EN\t\t(1<<31)\n#define   DPFC_CTL_PLANEA\t(0<<30)\n#define   DPFC_CTL_PLANEB\t(1<<30)\n#define   DPFC_CTL_FENCE_EN\t(1<<29)\n#define   DPFC_CTL_LIMIT_1X\t(0<<6)\n#define   DPFC_CTL_LIMIT_2X\t(1<<6)\n#define   DPFC_CTL_LIMIT_4X\t(2<<6)\n#define DPFC_RECOMP_CTL\t\t0x320c\n#define   DPFC_RECOMP_STALL_EN\t(1<<27)\n#define   DPFC_RECOMP_STALL_WM_SHIFT (16)\n#define   DPFC_RECOMP_STALL_WM_MASK (0x07ff0000)\n#define   DPFC_RECOMP_TIMER_COUNT_SHIFT (0)\n#define   DPFC_RECOMP_TIMER_COUNT_MASK (0x0000003f)\n#define DPFC_STATUS\t\t0x3210\n#define   DPFC_INVAL_SEG_SHIFT  (16)\n#define   DPFC_INVAL_SEG_MASK\t(0x07ff0000)\n#define   DPFC_COMP_SEG_SHIFT\t(0)\n#define   DPFC_COMP_SEG_MASK\t(0x000003ff)\n#define DPFC_STATUS2\t\t0x3214\n#define DPFC_FENCE_YOFF\t\t0x3218\n\n#define PEG_BAND_GAP_DATA\t0x14d68\n\n#define MCHBAR_RENDER_STANDBY\t0x111B8\n#define RENDER_STANDBY_ENABLE\t(1 << 30)\n\n\n/* Ironlake */\n\n/* warmup time in us */\n#define WARMUP_PCH_REF_CLK_SSC_MOD\t1\n#define WARMUP_PCH_FDI_RECEIVER_PLL\t25\n#define WARMUP_PCH_DPLL\t\t\t50\n#define WARMUP_CPU_DP_PLL\t\t20\n#define WARMUP_CPU_FDI_TRANSMITTER_PLL\t10\n#define WARMUP_DMI_LATENCY\t\t20\n#define FDI_TRAIN_PATTERN_1_TIME\t0.5\n#define FDI_TRAIN_PATTERN_2_TIME\t1.5\n#define FDI_ONE_IDLE_PATTERN_TIME\t31\n\n#define CPU_VGACNTRL\t\t0x41000\n\n#define DIGITAL_PORT_HOTPLUG_CNTRL\t0x44030\n#define  DIGITAL_PORTA_HOTPLUG_ENABLE\t\t(1 << 4)\n#define  DIGITAL_PORTA_SHORT_PULSE_2MS\t\t(0 << 2)\n#define  DIGITAL_PORTA_SHORT_PULSE_4_5MS\t(1 << 2)\n#define  DIGITAL_PORTA_SHORT_PULSE_6MS\t\t(2 << 2)\n#define  DIGITAL_PORTA_SHORT_PULSE_100MS\t(3 << 2)\n#define  DIGITAL_PORTA_NO_DETECT\t\t(0 << 0)\n#define  DIGITAL_PORTA_LONG_PULSE_DETECT_MASK\t(1 << 1)\n#define  DIGITAL_PORTA_SHORT_PULSE_DETECT_MASK\t(1 << 0)\n\n/* refresh rate hardware control */\n#define RR_HW_CTL\t0x45300\n#define  RR_HW_LOW_POWER_FRAMES_MASK\t0xff\n#define  RR_HW_HIGH_POWER_FRAMES_MASK\t0xff00\n\n#define FDI_PLL_BIOS_0\t\t\t0x46000\n#define FDI_PLL_BIOS_1\t\t\t0x46004\n#define FDI_PLL_BIOS_2\t\t\t0x46008\n#define DISPLAY_PORT_PLL_BIOS_0\t\t0x4600c\n#define DISPLAY_PORT_PLL_BIOS_1\t\t0x46010\n#define DISPLAY_PORT_PLL_BIOS_2\t\t0x46014\n\n#define FDI_PLL_FREQ_CTL\t0x46030\n#define  FDI_PLL_FREQ_CHANGE_REQUEST\t(1<<24)\n#define  FDI_PLL_FREQ_LOCK_LIMIT_MASK\t0xfff00\n#define  FDI_PLL_FREQ_DISABLE_COUNT_LIMIT_MASK\t0xff\n\n#define PIPEA_DATA_M1\t\t0x60030\n#define  TU_SIZE(x)\t\t(((x)-1) << 25) /* default size 64 */\n#define  TU_SIZE_MASK\t\t0x7e000000\n#define  PIPEA_DATA_M1_OFFSET\t0\n#define PIPEA_DATA_N1\t\t0x60034\n#define  PIPEA_DATA_N1_OFFSET\t0\n\n#define PIPEA_DATA_M2\t\t0x60038\n#define  PIPEA_DATA_M2_OFFSET\t0\n#define PIPEA_DATA_N2\t\t0x6003c\n#define  PIPEA_DATA_N2_OFFSET\t0\n\n#define PIPEA_LINK_M1\t\t0x60040\n#define  PIPEA_LINK_M1_OFFSET\t0\n#define PIPEA_LINK_N1\t\t0x60044\n#define  PIPEA_LINK_N1_OFFSET\t0\n\n#define PIPEA_LINK_M2\t\t0x60048\n#define  PIPEA_LINK_M2_OFFSET\t0\n#define PIPEA_LINK_N2\t\t0x6004c\n#define  PIPEA_LINK_N2_OFFSET\t0\n\n/* PIPEB timing regs are same start from 0x61000 */\n\n#define PIPEB_DATA_M1\t\t0x61030\n#define PIPEB_DATA_N1\t\t0x61034\n\n#define PIPEB_DATA_M2\t\t0x61038\n#define PIPEB_DATA_N2\t\t0x6103c\n\n#define PIPEB_LINK_M1\t\t0x61040\n#define PIPEB_LINK_N1\t\t0x61044\n\n#define PIPEB_LINK_M2\t\t0x61048\n#define PIPEB_LINK_N2\t\t0x6104c\n\n/* PIPEC timing regs */\n\n#define PIPEC_DATA_M1\t\t0x62030\n#define PIPEC_DATA_N1\t\t0x62034\n\n#define PIPEC_DATA_M2\t\t0x62038\n#define PIPEC_DATA_N2\t\t0x6203c\n\n#define PIPEC_LINK_M1\t\t0x62040\n#define PIPEC_LINK_N1\t\t0x62044\n\n#define PIPEC_LINK_M2\t\t0x62048\n#define PIPEC_LINK_N2\t\t0x6204c\n\n#define PIPEEDP_DATA_M1\t\t0x6F030\n#define PIPEEDP_DATA_N1\t\t0x6F034\n\n#define PIPEEDP_LINK_M1\t\t0x6F040\n#define PIPEEDP_LINK_N1\t\t0x6F044\n\n/* PIPECONF for pipe A/B addr is same */\n\n/* cusor A is only connected to pipe A,\n   cursor B is connected to pipe B. Otherwise no change. */\n\n/* Plane A/B, DSPACNTR/DSPBCNTR addr not changed */\n\n/* CPU panel fitter */\n#define PFA_CTL_1\t\t0x68080\n#define PFB_CTL_1\t\t0x68880\n#define PFC_CTL_1\t\t0x69080\n#define  PF_ENABLE\t\t(1<<31)\n#define PFA_CTL_2\t\t0x68084\n#define PFB_CTL_2\t\t0x68884\n#define PFC_CTL_2\t\t0x69084\n#define PFA_CTL_3\t\t0x68088\n#define PFB_CTL_3\t\t0x68888\n#define PFC_CTL_3\t\t0x69088\n#define PFA_CTL_4\t\t0x68090\n#define PFB_CTL_4\t\t0x68890\n#define PFC_CTL_4\t\t0x69090\n\n#define PFA_WIN_POS\t\t0x68070\n#define PFB_WIN_POS\t\t0x68870\n#define PFC_WIN_POS\t\t0x69070\n#define PFA_WIN_SIZE\t\t0x68074\n#define PFB_WIN_SIZE\t\t0x68874\n#define PFC_WIN_SIZE\t\t0x69074\n\n/* legacy palette */\n#define LGC_PALETTE_A\t\t0x4a000\n#define LGC_PALETTE_B\t\t0x4a800\n\n/* interrupts */\n#define DE_MASTER_IRQ_CONTROL\t(1 << 31)\n#define DE_SPRITEB_FLIP_DONE\t(1 << 29)\n#define DE_SPRITEA_FLIP_DONE\t(1 << 28)\n#define DE_PLANEB_FLIP_DONE\t(1 << 27)\n#define DE_PLANEA_FLIP_DONE\t(1 << 26)\n#define DE_PCU_EVENT\t\t(1 << 25)\n#define DE_GTT_FAULT\t\t(1 << 24)\n#define DE_POISON\t\t(1 << 23)\n#define DE_PERFORM_COUNTER\t(1 << 22)\n#define DE_PCH_EVENT\t\t(1 << 21)\n#define DE_AUX_CHANNEL_A\t(1 << 20)\n#define DE_DP_A_HOTPLUG\t\t(1 << 19)\n#define DE_GSE\t\t\t(1 << 18)\n#define DE_PIPEB_VBLANK\t\t(1 << 15)\n#define DE_PIPEB_EVEN_FIELD\t(1 << 14)\n#define DE_PIPEB_ODD_FIELD\t(1 << 13)\n#define DE_PIPEB_LINE_COMPARE\t(1 << 12)\n#define DE_PIPEB_VSYNC\t\t(1 << 11)\n#define DE_PIPEB_FIFO_UNDERRUN\t(1 << 8)\n#define DE_PIPEA_VBLANK\t\t(1 << 7)\n#define DE_PIPEA_EVEN_FIELD\t(1 << 6)\n#define DE_PIPEA_ODD_FIELD\t(1 << 5)\n#define DE_PIPEA_LINE_COMPARE\t(1 << 4)\n#define DE_PIPEA_VSYNC\t\t(1 << 3)\n#define DE_PIPEA_FIFO_UNDERRUN\t(1 << 0)\n\n#define DEISR\t0x44000\n#define DEIMR\t0x44004\n#define DEIIR\t0x44008\n#define DEIER\t0x4400c\n\n/* GT interrupt */\n#define GT_SYNC_STATUS\t\t(1 << 2)\n#define GT_USER_INTERRUPT\t(1 << 0)\n\n#define GTISR\t0x44010\n#define GTIMR\t0x44014\n#define GTIIR\t0x44018\n#define GTIER\t0x4401c\n\n/* PCH */\n\n/* south display engine interrupt */\n#define SDE_CRT_HOTPLUG\t\t(1 << 11)\n#define SDE_PORTD_HOTPLUG\t(1 << 10)\n#define SDE_PORTC_HOTPLUG\t(1 << 9)\n#define SDE_PORTB_HOTPLUG\t(1 << 8)\n#define SDE_SDVOB_HOTPLUG\t(1 << 6)\n\n#define SDEISR\t0xc4000\n#define SDEIMR\t0xc4004\n#define SDEIIR\t0xc4008\n#define SDEIER\t0xc400c\n\n/* digital port hotplug */\n#define PCH_PORT_HOTPLUG\t0xc4030\n#define PORTD_HOTPLUG_ENABLE\t\t(1 << 20)\n#define PORTD_PULSE_DURATION_2ms\t(0)\n#define PORTD_PULSE_DURATION_4_5ms\t(1 << 18)\n#define PORTD_PULSE_DURATION_6ms\t(2 << 18)\n#define PORTD_PULSE_DURATION_100ms\t(3 << 18)\n#define PORTD_HOTPLUG_NO_DETECT\t\t(0)\n#define PORTD_HOTPLUG_SHORT_DETECT\t(1 << 16)\n#define PORTD_HOTPLUG_LONG_DETECT\t(1 << 17)\n#define PORTC_HOTPLUG_ENABLE\t\t(1 << 12)\n#define PORTC_PULSE_DURATION_2ms\t(0)\n#define PORTC_PULSE_DURATION_4_5ms\t(1 << 10)\n#define PORTC_PULSE_DURATION_6ms\t(2 << 10)\n#define PORTC_PULSE_DURATION_100ms\t(3 << 10)\n#define PORTC_HOTPLUG_NO_DETECT\t\t(0)\n#define PORTC_HOTPLUG_SHORT_DETECT\t(1 << 8)\n#define PORTC_HOTPLUG_LONG_DETECT\t(1 << 9)\n#define PORTB_HOTPLUG_ENABLE\t\t(1 << 4)\n#define PORTB_PULSE_DURATION_2ms\t(0)\n#define PORTB_PULSE_DURATION_4_5ms\t(1 << 2)\n#define PORTB_PULSE_DURATION_6ms\t(2 << 2)\n#define PORTB_PULSE_DURATION_100ms\t(3 << 2)\n#define PORTB_HOTPLUG_NO_DETECT\t\t(0)\n#define PORTB_HOTPLUG_SHORT_DETECT\t(1 << 0)\n#define PORTB_HOTPLUG_LONG_DETECT\t(1 << 1)\n\n#define PCH_GPIOA\t\t0xc5010\n#define PCH_GPIOB\t\t0xc5014\n#define PCH_GPIOC\t\t0xc5018\n#define PCH_GPIOD\t\t0xc501c\n#define PCH_GPIOE\t\t0xc5020\n#define PCH_GPIOF\t\t0xc5024\n#define PCH_GMBUS0\t\t0xc5100\n#define PCH_GMBUS1\t\t0xc5104\n#define PCH_GMBUS2\t\t0xc5108\n#define PCH_GMBUS3\t\t0xc510c\n#define PCH_GMBUS4\t\t0xc5110\n#define PCH_GMBUS5\t\t0xc5120\n\n#define PCH_DPLL_A\t\t0xc6014\n#define PCH_DPLL_B\t\t0xc6018\n\n#define PCH_FPA0\t\t0xc6040\n#define PCH_FPA1\t\t0xc6044\n#define PCH_FPB0\t\t0xc6048\n#define PCH_FPB1\t\t0xc604c\n\n#define PCH_DPLL_TEST\t\t0xc606c\n\n#define PCH_DREF_CONTROL\t0xC6200\n#define  DREF_CONTROL_MASK\t0x7fc3\n#define  DREF_CPU_SOURCE_OUTPUT_DISABLE\t\t(0<<13)\n#define  DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD\t(2<<13)\n#define  DREF_CPU_SOURCE_OUTPUT_NONSPREAD\t(3<<13)\n#define  DREF_SSC_SOURCE_DISABLE\t\t(0<<11)\n#define  DREF_SSC_SOURCE_ENABLE\t\t\t(2<<11)\n#define  DREF_NONSPREAD_SOURCE_DISABLE\t\t(0<<9)\n#define  DREF_NONSPREAD_SOURCE_ENABLE\t\t(2<<9)\n#define  DREF_SUPERSPREAD_SOURCE_DISABLE\t(0<<7)\n#define  DREF_SUPERSPREAD_SOURCE_ENABLE\t\t(2<<7)\n#define  DREF_SSC4_DOWNSPREAD\t\t\t(0<<6)\n#define  DREF_SSC4_CENTERSPREAD\t\t\t(1<<6)\n#define  DREF_SSC1_DISABLE\t\t\t(0<<1)\n#define  DREF_SSC1_ENABLE\t\t\t(1<<1)\n#define  DREF_SSC4_DISABLE\t\t\t(0)\n#define  DREF_SSC4_ENABLE\t\t\t(1)\n\n#define PCH_RAWCLK_FREQ\t\t0xc6204\n#define  FDL_TP1_TIMER_SHIFT\t12\n#define  FDL_TP1_TIMER_MASK\t(3<<12)\n#define  FDL_TP2_TIMER_SHIFT\t10\n#define  FDL_TP2_TIMER_MASK\t(3<<10)\n#define  RAWCLK_FREQ_MASK\t0x3ff\n\n#define PCH_DPLL_TMR_CFG\t0xc6208\n\n#define PCH_SSC4_PARMS\t\t0xc6210\n#define PCH_SSC4_AUX_PARMS\t0xc6214\n\n/* CPT */\n#define PCH_DPLL_ANALOG_CTL\t0xc6300\n\n#define PCH_DPLL_SEL            0xc7000\n#define  TRANSA_DPLL_ENABLE     (1<<3)\n#define  TRANSA_DPLLA_SEL\t(0)\n#define  TRANSA_DPLLB_SEL\t(1<<0)\n#define  TRANSB_DPLL_ENABLE     (1<<7)\n#define  TRANSB_DPLLA_SEL\t(0<<4)\n#define  TRANSB_DPLLB_SEL\t(1<<4)\n#define  TRANSC_DPLL_ENABLE     (1<<11)\n#define  TRANSC_DPLLA_SEL\t(0<<8)\n#define  TRANSC_DPLLB_SEL\t(1<<8)\n\n/* transcoder */\n#define TRANS_HTOTAL_A\t\t0xe0000\n#define TRANS_HBLANK_A\t\t0xe0004\n#define TRANS_HSYNC_A\t\t0xe0008\n#define TRANS_VTOTAL_A\t\t0xe000c\n#define TRANS_VBLANK_A\t\t0xe0010\n#define TRANS_VSYNC_A\t\t0xe0014\n#define TRANS_VSYNCSHIFT_A\t0xe0028\n#define TRANS_HTOTAL_A\t\t0xe0000\n#define  TRANS_HTOTAL_SHIFT\t16\n#define  TRANS_HACTIVE_SHIFT\t0\n#define TRANS_HBLANK_A\t\t0xe0004\n#define  TRANS_HBLANK_END_SHIFT\t16\n#define  TRANS_HBLANK_START_SHIFT 0\n#define TRANS_HSYNC_A\t\t0xe0008\n#define  TRANS_HSYNC_END_SHIFT\t16\n#define  TRANS_HSYNC_START_SHIFT 0\n#define TRANS_VTOTAL_A\t\t0xe000c\n#define  TRANS_VTOTAL_SHIFT\t16\n#define  TRANS_VACTIVE_SHIFT\t0\n#define TRANS_VBLANK_A\t\t0xe0010\n#define  TRANS_VBLANK_END_SHIFT\t16\n#define  TRANS_VBLANK_START_SHIFT 0\n#define TRANS_VSYNC_A\t\t0xe0014\n#define  TRANS_VSYNC_END_SHIFT\t16\n#define  TRANS_VSYNC_START_SHIFT 0\n#define TRANS_VSYNCSHIFT_A\t0xe0028\n\n#define TRANSA_DATA_M1\t\t0xe0030\n#define TRANSA_DATA_N1\t\t0xe0034\n#define TRANSA_DATA_M2\t\t0xe0038\n#define TRANSA_DATA_N2\t\t0xe003c\n#define TRANSA_DP_LINK_M1\t0xe0040\n#define TRANSA_DP_LINK_N1\t0xe0044\n#define TRANSA_DP_LINK_M2\t0xe0048\n#define TRANSA_DP_LINK_N2\t0xe004c\n\n#define TRANS_HTOTAL_B\t\t0xe1000\n#define TRANS_HBLANK_B\t\t0xe1004\n#define TRANS_HSYNC_B\t\t0xe1008\n#define TRANS_VTOTAL_B\t\t0xe100c\n#define TRANS_VBLANK_B\t\t0xe1010\n#define TRANS_VSYNC_B\t\t0xe1014\n#define TRANS_VSYNCSHIFT_B\t0xe1028\n\n#define TRANSB_DATA_M1\t\t0xe1030\n#define TRANSB_DATA_N1\t\t0xe1034\n#define TRANSB_DATA_M2\t\t0xe1038\n#define TRANSB_DATA_N2\t\t0xe103c\n#define TRANSB_DP_LINK_M1\t0xe1040\n#define TRANSB_DP_LINK_N1\t0xe1044\n#define TRANSB_DP_LINK_M2\t0xe1048\n#define TRANSB_DP_LINK_N2\t0xe104c\n\n#define TRANS_HTOTAL_C\t\t0xe2000\n#define TRANS_HBLANK_C\t\t0xe2004\n#define TRANS_HSYNC_C\t\t0xe2008\n#define TRANS_VTOTAL_C\t\t0xe200c\n#define TRANS_VBLANK_C\t\t0xe2010\n#define TRANS_VSYNC_C\t\t0xe2014\n#define TRANS_VSYNCSHIFT_C\t0xe2028\n\n#define TRANSC_DATA_M1\t\t0xe2030\n#define TRANSC_DATA_N1\t\t0xe2034\n#define TRANSC_DATA_M2\t\t0xe2038\n#define TRANSC_DATA_N2\t\t0xe203c\n#define TRANSC_DP_LINK_M1\t0xe2040\n#define TRANSC_DP_LINK_N1\t0xe2044\n#define TRANSC_DP_LINK_M2\t0xe2048\n#define TRANSC_DP_LINK_N2\t0xe204c\n\n#define TRANSACONF\t\t0xf0008\n#define TRANSBCONF\t\t0xf1008\n#define TRANSCCONF\t\t0xf2008\n#define  TRANS_DISABLE\t\t(0<<31)\n#define  TRANS_ENABLE\t\t(1<<31)\n#define  TRANS_STATE_MASK\t(1<<30)\n#define  TRANS_STATE_DISABLE\t(0<<30)\n#define  TRANS_STATE_ENABLE\t(1<<30)\n#define  TRANS_FSYNC_DELAY_HB1\t(0<<27)\n#define  TRANS_FSYNC_DELAY_HB2\t(1<<27)\n#define  TRANS_FSYNC_DELAY_HB3\t(2<<27)\n#define  TRANS_FSYNC_DELAY_HB4\t(3<<27)\n#define  TRANS_DP_AUDIO_ONLY\t(1<<26)\n#define  TRANS_DP_VIDEO_AUDIO\t(0<<26)\n#define  TRANS_PROGRESSIVE\t(0<<21)\n#define  TRANS_8BPC\t\t(0<<5)\n#define  TRANS_10BPC\t\t(1<<5)\n#define  TRANS_6BPC\t\t(2<<5)\n#define  TRANS_12BPC\t\t(3<<5)\n\n#define FDI_RXA_CHICKEN\t\t0xc200c\n#define FDI_RXB_CHICKEN\t\t0xc2010\n#define  FDI_RX_PHASE_SYNC_POINTER_ENABLE\t(1)\n\n/* CPU: FDI_TX */\n#define FDI_TXA_CTL\t\t0x60100\n#define FDI_TXB_CTL\t\t0x61100\n#define FDI_TXC_CTL\t\t0x62100\n#define  FDI_TX_DISABLE\t\t(0<<31)\n#define  FDI_TX_ENABLE\t\t(1<<31)\n#define  FDI_LINK_TRAIN_PATTERN_1\t(0<<28)\n#define  FDI_LINK_TRAIN_PATTERN_2\t(1<<28)\n#define  FDI_LINK_TRAIN_PATTERN_IDLE\t(2<<28)\n#define  FDI_LINK_TRAIN_NONE\t\t(3<<28)\n#define  FDI_LINK_TRAIN_VOLTAGE_0_4V\t(0<<25)\n#define  FDI_LINK_TRAIN_VOLTAGE_0_6V\t(1<<25)\n#define  FDI_LINK_TRAIN_VOLTAGE_0_8V\t(2<<25)\n#define  FDI_LINK_TRAIN_VOLTAGE_1_2V\t(3<<25)\n#define  FDI_LINK_TRAIN_PRE_EMPHASIS_NONE (0<<22)\n#define  FDI_LINK_TRAIN_PRE_EMPHASIS_1_5X (1<<22)\n#define  FDI_LINK_TRAIN_PRE_EMPHASIS_2X\t  (2<<22)\n#define  FDI_LINK_TRAIN_PRE_EMPHASIS_3X\t  (3<<22)\n/* ILK always use 400mV 0dB for voltage swing and pre-emphasis level.\n   SNB has different settings. */\n/* SNB A-stepping */\n#define  FDI_LINK_TRAIN_400MV_0DB_SNB_A\t\t(0x38<<22)\n#define  FDI_LINK_TRAIN_400MV_6DB_SNB_A\t\t(0x02<<22)\n#define  FDI_LINK_TRAIN_600MV_3_5DB_SNB_A\t(0x01<<22)\n#define  FDI_LINK_TRAIN_800MV_0DB_SNB_A\t\t(0x0<<22)\n/* SNB B-stepping */\n#define  FDI_LINK_TRAIN_400MV_0DB_SNB_B\t\t(0x0<<22)\n#define  FDI_LINK_TRAIN_400MV_6DB_SNB_B\t\t(0x3a<<22)\n#define  FDI_LINK_TRAIN_600MV_3_5DB_SNB_B\t(0x39<<22)\n#define  FDI_LINK_TRAIN_800MV_0DB_SNB_B\t\t(0x38<<22)\n#define  FDI_LINK_TRAIN_VOL_EMP_MASK\t\t(0x3f<<22)\n#define  FDI_DP_PORT_WIDTH_X1\t\t(0<<19)\n#define  FDI_DP_PORT_WIDTH_X2\t\t(1<<19)\n#define  FDI_DP_PORT_WIDTH_X3\t\t(2<<19)\n#define  FDI_DP_PORT_WIDTH_X4\t\t(3<<19)\n#define  FDI_TX_ENHANCE_FRAME_ENABLE\t(1<<18)\n/* Ironlake: hardwired to 1 */\n#define  FDI_TX_PLL_ENABLE\t\t(1<<14)\n/* both Tx and Rx */\n#define  FDI_SCRAMBLING_ENABLE\t\t(0<<7)\n#define  FDI_SCRAMBLING_DISABLE\t\t(1<<7)\n\n/* Additional cpu TX control regs, from ivb bspec */\n#define DPAFE_BMFUNC\t\t0x6c024\n#define DPAFE_DL_IREFCAL0\t0x6c02c\n#define DPAFE_DL_IREFCAL1\t0x6c030\n#define DPAFE_DP_IREFCAL\t0x6c034\n\n/* FDI_RX, FDI_X is hard-wired to Transcoder_X */\n#define FDI_RXA_CTL\t\t0xf000c\n#define FDI_RXB_CTL\t\t0xf100c\n#define FDI_RXC_CTL\t\t0xf200c\n#define  FDI_RX_ENABLE\t\t(1<<31)\n#define  FDI_RX_DISABLE\t\t(0<<31)\n/* train, dp width same as FDI_TX */\n#define  FDI_DP_PORT_WIDTH_X8\t\t(7<<19)\n#define  FDI_8BPC\t\t\t(0<<16)\n#define  FDI_10BPC\t\t\t(1<<16)\n#define  FDI_6BPC\t\t\t(2<<16)\n#define  FDI_12BPC\t\t\t(3<<16)\n#define  FDI_LINK_REVERSE_OVERWRITE\t(1<<15)\n#define  FDI_DMI_LINK_REVERSE_MASK\t(1<<14)\n#define  FDI_RX_PLL_ENABLE\t\t(1<<13)\n#define  FDI_FS_ERR_CORRECT_ENABLE\t(1<<11)\n#define  FDI_FE_ERR_CORRECT_ENABLE\t(1<<10)\n#define  FDI_FS_ERR_REPORT_ENABLE\t(1<<9)\n#define  FDI_FE_ERR_REPORT_ENABLE\t(1<<8)\n#define  FDI_RX_ENHANCE_FRAME_ENABLE\t(1<<6)\n#define  FDI_SEL_RAWCLK\t\t\t(0<<4)\n#define  FDI_SEL_PCDCLK\t\t\t(1<<4)\n/* CPT */\n#define  FDI_AUTO_TRAINING\t\t\t(1<<10)\n#define  FDI_LINK_TRAIN_PATTERN_1_CPT\t\t(0<<8)\n#define  FDI_LINK_TRAIN_PATTERN_2_CPT\t\t(1<<8)\n#define  FDI_LINK_TRAIN_PATTERN_IDLE_CPT\t(2<<8)\n#define  FDI_LINK_TRAIN_NORMAL_CPT\t\t(3<<8)\n#define  FDI_LINK_TRAIN_PATTERN_MASK_CPT\t(3<<8)\n\n#define FDI_RXA_MISC\t\t0xf0010\n#define FDI_RXB_MISC\t\t0xf1010\n#define FDI_RXC_MISC\t\t0xf2010\n#define FDI_RXA_TUSIZE1\t\t0xf0030\n#define FDI_RXA_TUSIZE2\t\t0xf0038\n#define FDI_RXB_TUSIZE1\t\t0xf1030\n#define FDI_RXB_TUSIZE2\t\t0xf1038\n#define FDI_RXC_TUSIZE1\t\t0xf2030\n#define FDI_RXC_TUSIZE2\t\t0xf2038\n\n/* FDI_RX interrupt register format */\n#define FDI_RX_INTER_LANE_ALIGN\t\t(1<<10)\n#define FDI_RX_SYMBOL_LOCK\t\t(1<<9) /* train 2 */\n#define FDI_RX_BIT_LOCK\t\t\t(1<<8) /* train 1 */\n#define FDI_RX_TRAIN_PATTERN_2_FAIL\t(1<<7)\n#define FDI_RX_FS_CODE_ERR\t\t(1<<6)\n#define FDI_RX_FE_CODE_ERR\t\t(1<<5)\n#define FDI_RX_SYMBOL_ERR_RATE_ABOVE\t(1<<4)\n#define FDI_RX_HDCP_LINK_FAIL\t\t(1<<3)\n#define FDI_RX_PIXEL_FIFO_OVERFLOW\t(1<<2)\n#define FDI_RX_CROSS_CLOCK_OVERFLOW\t(1<<1)\n#define FDI_RX_SYMBOL_QUEUE_OVERFLOW\t(1<<0)\n\n#define FDI_RXA_IIR\t\t0xf0014\n#define FDI_RXA_IMR\t\t0xf0018\n#define FDI_RXB_IIR\t\t0xf1014\n#define FDI_RXB_IMR\t\t0xf1018\n\n#define FDI_PLL_CTL_1\t\t0xfe000\n#define FDI_PLL_CTL_2\t\t0xfe004\n\n/* CRT */\n#define PCH_ADPA\t\t0xe1100\n#define  ADPA_TRANS_SELECT_MASK\t(1<<30)\n#define  ADPA_TRANS_A_SELECT\t0\n#define  ADPA_TRANS_B_SELECT\t(1<<30)\n/* HPD is here */\n#define  ADPA_CRT_HOTPLUG_MASK\t0x03ff0000 /* bit 25-16 */\n#define\t ADPA_CRT_HOTPLUG_MONITOR_NONE\t(0<<24)\n#define  ADPA_CRT_HOTPLUG_MONITOR_MASK\t(3<<24)\n#define  ADPA_CRT_HOTPLUG_MONITOR_COLOR\t(3<<24)\n#define  ADPA_CRT_HOTPLUG_MONITOR_MONO\t(2<<24)\n#define  ADPA_CRT_HOTPLUG_ENABLE\t(1<<23)\n#define  ADPA_CRT_HOTPLUG_PERIOD_64\t(0<<22)\n#define  ADPA_CRT_HOTPLUG_PERIOD_128\t(1<<22)\n#define  ADPA_CRT_HOTPLUG_WARMUP_5MS\t(0<<21)\n#define  ADPA_CRT_HOTPLUG_WARMUP_10MS\t(1<<21)\n#define  ADPA_CRT_HOTPLUG_SAMPLE_2S\t(0<<20)\n#define  ADPA_CRT_HOTPLUG_SAMPLE_4S\t(1<<20)\n#define  ADPA_CRT_HOTPLUG_VOLTAGE_40\t(0<<18)\n#define  ADPA_CRT_HOTPLUG_VOLTAGE_50\t(1<<18)\n#define  ADPA_CRT_HOTPLUG_VOLTAGE_60\t(2<<18)\n#define  ADPA_CRT_HOTPLUG_VOLTAGE_70\t(3<<18)\n#define  ADPA_CRT_HOTPLUG_VOLREF_325MV\t(0<<17)\n#define  ADPA_CRT_HOTPLUG_VOLREF_475MV\t(1<<17)\n#define  ADPA_CRT_HOTPLUG_FORCE_TRIGGER\t(1<<16)\n/* polarity control not changed */\n\n/* or SDVOB */\n#define HDMIB\t0xe1140\n#define  PORT_ENABLE\t(1 << 31)\n#define  TRANSCODER_A\t(0)\n#define  TRANSCODER_B\t(1 << 30)\n#define  COLOR_FORMAT_8bpc\t(0)\n#define  COLOR_FORMAT_12bpc\t(3 << 26)\n#define  SDVOB_HOTPLUG_ENABLE\t(1 << 23)\n#define  SDVO_ENCODING\t\t(0)\n#define  TMDS_ENCODING\t\t(2 << 10)\n#define  NULL_PACKET_VSYNC_ENABLE\t(1 << 9)\n#define  SDVOB_BORDER_ENABLE\t(1 << 7)\n#define  AUDIO_ENABLE\t\t(1 << 6)\n#define  VSYNC_ACTIVE_HIGH\t(1 << 4)\n#define  HSYNC_ACTIVE_HIGH\t(1 << 3)\n#define  PORT_DETECTED\t\t(1 << 2)\n\n#define HDMIC\t0xe1150\n#define HDMID\t0xe1160\n#define PCH_LVDS\t\t0xe1180\n\n/* Since IVB, the old _CTL2 is now _CTL and the old _CTL is now _DATA. */\n#define BLC_PWM_CPU_CTL2        0x48250\n#define BLC_PWM2_CPU_CTL2       0x48350\n#define  PWM_ENABLE             (1 << 31)\n#define  PWM_PIPE_A             (0 << 29)\n#define  PWM_PIPE_B             (1 << 29)\n#define BLC_PWM_CPU_CTL         0x48254\n#define BLC_PWM2_CPU_CTL        0x48354\n#define BLC_MISC_CTL            0x48360\n\n#define UTIL_PIN_CTL            0x48400\n\n#define BLC_PWM_PCH_CTL1        0xc8250\n#define  PWM_PCH_ENABLE         (1 << 31)\n#define  PWM_POLARITY_ACTIVE_LOW        (1 << 29)\n#define  PWM_POLARITY_ACTIVE_HIGH       (0 << 29)\n#define  PWM_POLARITY_ACTIVE_LOW2       (1 << 28)\n#define  PWM_POLARITY_ACTIVE_HIGH2      (0 << 28)\n\n#define BLC_PWM_PCH_CTL2        0xc8254\n\n#define PCH_PP_STATUS           0xc7200\n#define PCH_PP_CONTROL          0xc7204\n#define  EDP_FORCE_VDD          (1 << 3)\n#define  EDP_BLC_ENABLE         (1 << 2)\n#define  PANEL_POWER_RESET      (1 << 1)\n#define  PANEL_POWER_OFF        (0 << 0)\n#define  PANEL_POWER_ON         (1 << 0)\n#define PCH_PP_ON_DELAYS        0xc7208\n#define  EDP_PANEL              (1 << 30)\n#define PCH_PP_OFF_DELAYS       0xc720c\n#define PCH_PP_DIVISOR          0xc7210\n\n#define AUD_CONFIG              0x62000\n#define AUD_DEBUG               0x62010\n#define AUD_VID_DID             0x62020\n#define AUD_RID                 0x62024\n#define AUD_SUBN_CNT            0x62028\n#define AUD_FUNC_GRP            0x62040\n#define AUD_SUBN_CNT2           0x62044\n#define AUD_GRP_CAP             0x62048\n#define AUD_PWRST               0x6204c\n#define AUD_SUPPWR              0x62050\n#define AUD_SID                 0x62054\n#define AUD_OUT_CWCAP           0x62070\n#define AUD_OUT_PCMSIZE         0x62074\n#define AUD_OUT_STR             0x62078\n#define AUD_OUT_DIG_CNVT        0x6207c\n#define AUD_OUT_CH_STR          0x62080\n#define AUD_OUT_STR_DESC        0x62084\n#define AUD_PINW_CAP            0x620a0\n#define AUD_PIN_CAP             0x620a4\n#define AUD_PINW_CONNLNG        0x620a8\n#define AUD_PINW_CONNLST        0x620ac\n#define AUD_PINW_CNTR           0x620b0\n#define AUD_PINW_UNSOLRESP      0x620b8\n#define AUD_CNTL_ST             0x620b4\n#define AUD_PINW_CONFIG         0x620bc\n#define AUD_HDMIW_STATUS        0x620d4\n#define AUD_HDMIW_HDMIEDID      0x6210c\n#define AUD_HDMIW_INFOFR        0x62118\n#define AUD_CONV_CHCNT          0x62120\n#define AUD_CTS_ENABLE          0x62128\n\n#define VIDEO_DIP_CTL           0x61170\n#define VIDEO_DIP_DATA          0x61178\n\n/* CPT */\n#define TRANS_DP_CTL_A\t\t0xe0300\n#define TRANS_DP_CTL_B\t\t0xe1300\n#define TRANS_DP_CTL_C\t\t0xe2300\n#define  TRANS_DP_OUTPUT_ENABLE (1<<31)\n#define  TRANS_DP_PORT_SEL_B    (0<<29)\n#define  TRANS_DP_PORT_SEL_C    (1<<29)\n#define  TRANS_DP_PORT_SEL_D    (2<<29)\n#define  TRANS_DP_PORT_SEL_MASK (3<<29)\n#define  TRANS_DP_AUDIO_ONLY    (1<<26)\n#define  TRANS_DP_ENH_FRAMING   (1<<18)\n#define  TRANS_DP_8BPC          (0<<9)\n#define  TRANS_DP_10BPC         (1<<9)\n#define  TRANS_DP_6BPC          (2<<9)\n#define  TRANS_DP_12BPC         (3<<9)\n#define  TRANS_DP_VSYNC_ACTIVE_HIGH     (1<<4)\n#define  TRANS_DP_VSYNC_ACTIVE_LOW      0\n#define  TRANS_DP_HSYNC_ACTIVE_HIGH     (1<<3)\n#define  TRANS_DP_HSYNC_ACTIVE_LOW      0\n\n/* Debug regs */\n#define GEN6_TD_CTL\t\t0x7000 /* <= GEN5 was at 0x8000 */\n#define GEN6_TD_CTL_FORCE_TD_BKPT (1<<4)\n\n/* Port debugging\n */\n\n#define PORT_DBG                    0x42308\n#define  PORT_DBG_DRRS_HW_STATE_OFF     (0<<30)\n#define  PORT_DBG_DRRS_HW_STATE_LOW     (1<<30)\n#define  PORT_DBG_DRRS_HW_STATE_HIGH    (2<<30)\n\n/* RC6 residence counters\n */\n#define RC6_RESIDENCY_TIME          0x138108\n#define RC6p_RESIDENCY_TIME         0x13810C\n#define RC6pp_RESIDENCY_TIME        0x138110\n\n#define GEN6_RPNSWREQ\t\t\t\t0xA008\n#define GEN6_RC_VIDEO_FREQ\t\t\t0xA00C\n#define GEN6_RC_CONTROL\t\t\t\t0xA090\n#define GEN6_RP_DOWN_TIMEOUT\t\t\t0xA010\n#define GEN6_RP_INTERRUPT_LIMITS\t\t0xA014\n#define GEN6_RPSTAT1\t\t\t\t0xA01C\n#define GEN6_RP_CONTROL\t\t\t\t0xA024\n#define GEN6_RP_UP_THRESHOLD\t\t\t0xA02C\n#define GEN6_RP_DOWN_THRESHOLD\t\t\t0xA030\n#define GEN6_RP_CUR_UP_EI\t\t\t0xA050\n#define GEN6_RP_CUR_UP\t\t\t\t0xA054\n#define GEN6_RP_PREV_UP\t\t\t\t0xA058\n#define GEN6_RP_CUR_DOWN_EI\t\t\t0xA05C\n#define GEN6_RP_CUR_DOWN\t\t\t0xA060\n#define GEN6_RP_PREV_DOWN\t\t\t0xA064\n#define GEN6_RP_UP_EI\t\t\t\t0xA068\n#define GEN6_RP_DOWN_EI\t\t\t\t0xA06C\n#define GEN6_RP_IDLE_HYSTERSIS\t\t\t0xA070\n#define GEN6_RC_STATE\t\t\t\t0xA094\n#define GEN6_RC1_WAKE_RATE_LIMIT\t\t0xA098\n#define GEN6_RC6_WAKE_RATE_LIMIT\t\t0xA09C\n#define GEN6_RC6pp_WAKE_RATE_LIMIT\t\t0xA0A0\n#define GEN6_RC_EVALUATION_INTERVAL\t\t0xA0A8\n#define GEN6_RC_IDLE_HYSTERSIS\t\t\t0xA0AC\n#define GEN6_RC_SLEEP\t\t\t\t0xA0B0\n#define GEN6_RC1e_THRESHOLD\t\t\t0xA0B4\n#define GEN6_RC6_THRESHOLD\t\t\t0xA0B8\n#define GEN6_RC6p_THRESHOLD\t\t\t0xA0BC\n#define GEN6_RC6pp_THRESHOLD\t\t\t0xA0C0\n#define GEN6_PMINTRMSK\t\t\t\t0xA168\n#define GEN6_RC_EVALUATION_INTERVAL\t\t0xA0A8\n#define GEN6_RC_IDLE_HYSTERSIS\t\t\t0xA0AC\n#define GEN6_PMIER\t\t\t\t0x4402C\n#define GEN6_PMIMR\t\t\t\t0x44024 /* rps_lock */\n#define GEN6_PMINTRMSK\t\t\t\t0xA168\n\n/* Haswell-related items */\n\n/* HSW Power Wells */\n#define HSW_PWR_WELL_CTL1\t\t\t0x45400\t\t/* BIOS */\n#define HSW_PWR_WELL_CTL2\t\t\t0x45404\t\t/* Driver */\n#define HSW_PWR_WELL_CTL3\t\t\t0x45408\t\t/* KVMR */\n#define HSW_PWR_WELL_CTL4\t\t\t0x4540C\t\t/* Debug */\n#define   HSW_PWR_WELL_ENABLE_REQUEST\t\t(1<<31)\n#define   HSW_PWR_WELL_STATE_ENABLED\t\t(1<<30)\n#define HSW_PWR_WELL_CTL5\t\t\t0x45410\n#define   HSW_PWR_WELL_ENABLE_SINGLE_STEP\t(1<<31)\n#define   HSW_PWR_WELL_PWR_GATE_OVERRIDE\t(1<<20)\n#define   HSW_PWR_WELL_FORCE_ON\t\t\t(1<<19)\n#define HSW_PWR_WELL_CTL6\t\t\t0x45414\n\n/* Per-pipe DDI Function Control */\n#define PIPE_DDI_FUNC_CTL_A\t\t0x60400\n#define PIPE_DDI_FUNC_CTL_B\t\t0x61400\n#define PIPE_DDI_FUNC_CTL_C\t\t0x62400\n#define PIPE_DDI_FUNC_CTL_EDP\t\t0x6F400\n#define DDI_FUNC_CTL(pipe) _PIPE(pipe, \\\n\t\t\t\t\tPIPE_DDI_FUNC_CTL_A, \\\n\t\t\t\t\tPIPE_DDI_FUNC_CTL_B)\n#define  PIPE_DDI_FUNC_ENABLE\t\t(1<<31)\n/* Those bits are ignored by pipe EDP since it can only connect to DDI A */\n#define  PIPE_DDI_PORT_MASK\t\t(0xf<<28)\n#define  PIPE_DDI_SELECT_PORT(x)\t((x)<<28)\n#define  PIPE_DDI_MODE_SELECT_HDMI\t(0<<24)\n#define  PIPE_DDI_MODE_SELECT_DVI\t(1<<24)\n#define  PIPE_DDI_MODE_SELECT_DP_SST\t(2<<24)\n#define  PIPE_DDI_MODE_SELECT_DP_MST\t(3<<24)\n#define  PIPE_DDI_MODE_SELECT_FDI\t(4<<24)\n#define  PIPE_DDI_BPC_8\t\t\t(0<<20)\n#define  PIPE_DDI_BPC_10\t\t(1<<20)\n#define  PIPE_DDI_BPC_6\t\t\t(2<<20)\n#define  PIPE_DDI_BPC_12\t\t(3<<20)\n#define  PIPE_DDI_BFI_ENABLE\t\t(1<<4)\n#define  PIPE_DDI_PORT_WIDTH_X1\t\t(0<<1)\n#define  PIPE_DDI_PORT_WIDTH_X2\t\t(1<<1)\n#define  PIPE_DDI_PORT_WIDTH_X4\t\t(3<<1)\n\n/* DisplayPort Transport Control */\n#define DP_TP_CTL_A\t\t\t\t0x64040\n#define DP_TP_CTL_B\t\t\t\t0x64140\n#define DP_TP_CTL_C\t\t\t\t0x64240\n#define DP_TP_CTL_D\t\t\t\t0x64340\n#define DP_TP_CTL_E\t\t\t\t0x64440\n#define  DP_TP_CTL_ENABLE\t\t\t(1<<31)\n#define  DP_TP_CTL_MODE_SST\t\t\t(0<<27)\n#define  DP_TP_CTL_MODE_MST\t\t\t(1<<27)\n#define  DP_TP_CTL_ENHANCED_FRAME_ENABLE\t(1<<18)\n#define  DP_TP_CTL_FDI_AUTOTRAIN\t\t(1<<15)\n#define  DP_TP_CTL_LINK_TRAIN_MASK\t\t(7<<8)\n#define  DP_TP_CTL_LINK_TRAIN_PAT1\t\t(0<<8)\n#define  DP_TP_CTL_LINK_TRAIN_PAT2\t\t(1<<8)\n#define  DP_TP_CTL_LINK_TRAIN_NORMAL\t\t(3<<8)\n\n/* DisplayPort Transport Status */\n#define DP_TP_STATUS_A\t\t\t0x64044\n#define DP_TP_STATUS_B\t\t\t0x64144\n#define DP_TP_STATUS_C\t\t\t0x64244\n#define DP_TP_STATUS_D\t\t\t0x64344\n#define DP_TP_STATUS_E\t\t\t0x64444\n#define  DP_TP_STATUS_AUTOTRAIN_DONE\t(1<<12)\n\n/* DDI Buffer Control */\n#define DDI_BUF_CTL_A\t\t\t0x64000\n#define DDI_BUF_CTL_B\t\t\t0x64100\n#define DDI_BUF_CTL_C\t\t\t0x64200\n#define DDI_BUF_CTL_D\t\t\t0x64300\n#define DDI_BUF_CTL_E\t\t\t0x64400\n#define  DDI_BUF_CTL_ENABLE\t\t(1<<31)\n#define  DDI_BUF_EMP_400MV_0DB_HSW\t(0<<24)   /* Sel0 */\n#define  DDI_BUF_EMP_400MV_3_5DB_HSW\t(1<<24)   /* Sel1 */\n#define  DDI_BUF_EMP_400MV_6DB_HSW\t(2<<24)   /* Sel2 */\n#define  DDI_BUF_EMP_400MV_9_5DB_HSW\t(3<<24)   /* Sel3 */\n#define  DDI_BUF_EMP_600MV_0DB_HSW\t(4<<24)   /* Sel4 */\n#define  DDI_BUF_EMP_600MV_3_5DB_HSW\t(5<<24)   /* Sel5 */\n#define  DDI_BUF_EMP_600MV_6DB_HSW\t(6<<24)   /* Sel6 */\n#define  DDI_BUF_EMP_800MV_0DB_HSW\t(7<<24)   /* Sel7 */\n#define  DDI_BUF_EMP_800MV_3_5DB_HSW\t(8<<24)   /* Sel8 */\n#define  DDI_BUF_EMP_MASK\t\t(0xf<<24)\n#define  DDI_BUF_IS_IDLE\t\t(1<<7)\n#define  DDI_PORT_WIDTH_X1\t\t(0<<1)\n#define  DDI_PORT_WIDTH_X2\t\t(1<<1)\n#define  DDI_PORT_WIDTH_X4\t\t(3<<1)\n#define  DDI_INIT_DISPLAY_DETECTED\t(1<<0)\n\n/* LPT PIXCLK_GATE */\n#define PIXCLK_GATE\t\t0xC6020\n#define  PIXCLK_GATE_UNGATE\t1<<0\n#define  PIXCLK_GATE_GATE\t0<<0\n\n/* SPLL */\n#define SPLL_CTL\t\t0x46020\n#define  SPLL_PLL_ENABLE\t(1<<31)\n#define  SPLL_PLL_SCC\t\t(1<<28)\n#define  SPLL_PLL_NON_SCC\t(2<<28)\n#define  SPLL_PLL_FREQ_810MHz\t(0<<26)\n#define  SPLL_PLL_FREQ_1350MHz\t(1<<26)\n\n/* WRPLL */\n#define WRPLL_CTL1\t\t\t0x46040\n#define WRPLL_CTL2\t\t\t0x46060\n#define  WRPLL_PLL_ENABLE\t\t(1<<31)\n#define  WRPLL_PLL_SELECT_SSC\t\t(0x01<<28)\n#define  WRPLL_PLL_SELECT_NON_SCC\t(0x02<<28)\n#define  WRPLL_PLL_SELECT_LCPLL_2700\t(0x03<<28)\n/* WRPLL divider programming */\n#define  WRPLL_DIVIDER_REFERENCE(x)\t((x)<<0)\n#define  WRPLL_DIVIDER_POST(x)\t\t((x)<<8)\n#define  WRPLL_DIVIDER_FEEDBACK(x)\t((x)<<16)\n\n/* Port clock selection */\n#define PORT_CLK_SEL_A\t\t\t0x46100\n#define PORT_CLK_SEL_B\t\t\t0x46104\n#define PORT_CLK_SEL_C\t\t\t0x46108\n#define PORT_CLK_SEL_D\t\t\t0x4610C\n#define PORT_CLK_SEL_E\t\t\t0x46110\n#define  PORT_CLK_SEL_LCPLL_2700\t(0<<29)\n#define  PORT_CLK_SEL_LCPLL_1350\t(1<<29)\n#define  PORT_CLK_SEL_LCPLL_810\t\t(2<<29)\n#define  PORT_CLK_SEL_SPLL\t\t(3<<29)\n#define  PORT_CLK_SEL_WRPLL1\t\t(4<<29)\n#define  PORT_CLK_SEL_WRPLL2\t\t(5<<29)\n\n/* Pipe clock selection */\n#define PIPE_CLK_SEL_A\t\t\t0x46140\n#define PIPE_CLK_SEL_B\t\t\t0x46144\n#define PIPE_CLK_SEL_C\t\t\t0x46148\n/* For each pipe, we need to select the corresponding port clock */\n#define  PIPE_CLK_SEL_DISABLED\t\t(0x0<<29)\n#define  PIPE_CLK_SEL_PORT(x)\t\t((x+1)<<29)\n\n/* LCPLL Control */\n#define LCPLL_CTL\t\t\t0x130040\n#define  LCPLL_PLL_DISABLE\t\t(1<<31)\n#define  LCPLL_PLL_LOCK\t\t\t(1<<30)\n#define  LCPLL_CD_CLOCK_DISABLE\t\t(1<<25)\n#define  LCPLL_CD2X_CLOCK_DISABLE\t(1<<23)\n\n/* Pipe WM_LINETIME - watermark line time */\n#define WM_PIPE_A\t\t\t0x45100\n#define WM_PIPE_B\t\t\t0x45104\n#define WM_PIPE_C\t\t\t0x45200\n#define WM_LP1\t\t\t\t0x45108\n#define WM_LP2\t\t\t\t0x4510C\n#define WM_LP3\t\t\t\t0x45110\n#define WM_LP1_SPR\t\t\t0x45120\n#define WM_LP2_SPR\t\t\t0x45124\n#define WM_LP3_SPR\t\t\t0x45128\n#define WM_MISC\t\t\t\t0x45260\n#define WM_SR_CNT\t\t\t0x45264\n#define WM_DBG\t\t\t\t0x45280\n#define PIPE_WM_LINETIME_A\t\t0x45270\n#define PIPE_WM_LINETIME_B\t\t0x45274\n#define PIPE_WM_LINETIME_C\t\t0x45278\n#define   PIPE_WM_LINETIME_MASK\t\t\t\t(0x1ff)\n#define   PIPE_WM_LINETIME_TIME(x)\t\t\t((x))\n#define   PIPE_WM_LINETIME_IPS_LINETIME_MASK\t\t(0x1ff<<16)\n#define   PIPE_WM_LINETIME_IPS_LINETIME(x)\t\t((x)<<16)\n\n/* SFUSE_STRAP */\n#define SFUSE_STRAP\t\t\t0xc2014\n#define  SFUSE_STRAP_DDIB_DETECTED\t(1<<2)\n#define  SFUSE_STRAP_DDIC_DETECTED\t(1<<1)\n#define  SFUSE_STRAP_DDID_DETECTED\t(1<<0)\n\n/* Valleyview related items */\n#define VLV_DISPLAY_BASE       0x180000\n\n/*\n * IOSF sideband\n */\n#define VLV_IOSF_DOORBELL_REQ\t\t\t(VLV_DISPLAY_BASE + 0x2100)\n#define   IOSF_DEVFN_SHIFT\t\t\t24\n#define   IOSF_OPCODE_SHIFT\t\t\t16\n#define   IOSF_PORT_SHIFT\t\t\t8\n#define   IOSF_BYTE_ENABLES_SHIFT\t\t4\n#define   IOSF_BAR_SHIFT\t\t\t1\n#define   IOSF_SB_BUSY\t\t\t\t(1<<0)\n#define   IOSF_PORT_BUNIT\t\t\t0x3\n#define   IOSF_PORT_PUNIT\t\t\t0x4\n#define   IOSF_PORT_NC\t\t\t\t0x11\n#define   IOSF_PORT_DPIO\t\t\t0x12\n#define   IOSF_PORT_DPIO_2\t\t\t0x1a\n#define   IOSF_PORT_GPIO_NC\t\t\t0x13\n#define   IOSF_PORT_CCK\t\t\t\t0x14\n#define   IOSF_PORT_CCU\t\t\t\t0xA9\n#define   IOSF_PORT_GPS_CORE\t\t\t0x48\n#define   IOSF_PORT_FLISDSI\t\t\t0x1B\n#define VLV_IOSF_DATA\t\t\t\t(VLV_DISPLAY_BASE + 0x2104)\n#define\tVLV_IOSF_ADDR\t\t\t\t(VLV_DISPLAY_BASE + 0x2108)\n\n/* Some Skylake test registers */\n#define TRANS_DDI_FUNC_CTL_EDP\t0x6f400\n#define TRANS_DDI_FUNC_CTL_A\t0x60400\n#define TRANS_DDI_FUNC_CTL_B\t0x61400\n#define TRANS_DDI_FUNC_CTL_C\t0x62400\n\n\n\n#endif /* _I810_REG_H */\n"
  },
  {
    "path": "README.md",
    "content": "AppleIntelInfo.kext\n===================\n\nWhat do I need to do?\n\nStep 1.) Download the project from Github and compile it with Xcode.\n\nStep 2.) Fix file ownership and permissions.\n\n``` sh\nsudo chown -R root:wheel AppleIntelInfo.kext\nsudo chmod -R 755 AppleIntelInfo.kext\n```\n\nStep 3.) Load AppleIntelInfo.kext?\n\n``` sh\nsudo kextload AppleIntelInfo.kext\n\nor with\n\nsudo kextutil AppleIntelInfo.kext \n```\nWarning: Do not copy the kext to: /System/Library/Extensions or /Library/Extensions and do not inject it with help of the boot loader!\n\nStep 4.) Unload AppleIntelInfo.kext?\n\n``` sh\nsudo kextunload AppleIntelInfo.kext\n```\n\nWhere can I find the output?\n\n\nThe output of AppleIntelInfo.kext can be found with\n``` sh\nsudo cat /tmp/AppleIntelInfo.dat\n```\n\nNote: This has changed in version 1.2 (data no longer added to /var/log/system.log)\n\nSettings\n--------\n\nThere are five (5) settings that you can change in AppleIntelInfo.kext/Contents/Info.plist:\n```\nlogCStates\nlogIGPU\nlogIPGStyle\nlogIntelRegs\nlogMSRs\n```\n\nAll set to YES by default.\n\nBugs\n----\n\nAll possible bugs (so called 'issues') should be filed at:\n\nhttps://github.com/Piker-Alpha/AppleIntelInfo/issues\n\nPlease do **not** use my blog for this. Thank you!\n"
  }
]