From: Paulo Zanoni Date: Fri, 1 Mar 2013 16:30:46 +0000 (-0300) Subject: lib: detect PCH_LPT and PCH_NONE X-Git-Tag: intel-gpu-tools-1.4~460 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29abdb96dca554858b86e6fe3c1e69ea4aecc521;p=platform%2Fupstream%2Fintel-gpu-tools.git lib: detect PCH_LPT and PCH_NONE So we don't assign PCH_IBX to anything that's not PCH_CPT nor PCH_LPT. Signed-off-by: Paulo Zanoni --- diff --git a/lib/intel_gpu_tools.h b/lib/intel_gpu_tools.h index 245d1de..ced84c8 100644 --- a/lib/intel_gpu_tools.h +++ b/lib/intel_gpu_tools.h @@ -92,13 +92,17 @@ uint64_t intel_get_total_swap_mb(void); void intel_map_file(char *); enum pch_type { + PCH_NONE, PCH_IBX, PCH_CPT, + PCH_LPT, }; extern enum pch_type pch; void intel_check_pch(void); +#define HAS_IBX (pch == PCH_IBX) #define HAS_CPT (pch == PCH_CPT) +#define HAS_LPT (pch == PCH_LPT) #endif /* INTEL_GPU_TOOLS_H */ diff --git a/lib/intel_pci.c b/lib/intel_pci.c index 704c87a..e60e0d3 100644 --- a/lib/intel_pci.c +++ b/lib/intel_pci.c @@ -100,9 +100,24 @@ intel_check_pch(void) if (pch_dev == NULL) return; - if (pch_dev->vendor_id == 0x8086 && - (((pch_dev->device_id & 0xff00) == 0x1c00) || - (pch_dev->device_id & 0xff00) == 0x1e00)) + if (pch_dev->vendor_id != 0x8086) + return; + + switch (pch_dev->device_id & 0xff00) { + case 0x3b00: + pch = PCH_IBX; + break; + case 0x1c00: + case 0x1e00: pch = PCH_CPT; + break; + case 0x8c00: + case 0x9c00: + pch = PCH_LPT; + break; + default: + pch = PCH_NONE; + return; + } }