From patchwork Thu Jan 29 11:16:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: meghanelogal X-Patchwork-Id: 5741681 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4952B9F398 for ; Thu, 29 Jan 2015 11:25:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8144020121 for ; Thu, 29 Jan 2015 11:25:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A07C020103 for ; Thu, 29 Jan 2015 11:25:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A3836E76E; Thu, 29 Jan 2015 03:25:36 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id B62B06E76E for ; Thu, 29 Jan 2015 03:25:34 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 29 Jan 2015 03:25:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,485,1418112000"; d="scan'208";a="669646889" Received: from meghanelogal-2012-client-platform.iind.intel.com ([10.223.161.112]) by fmsmga002.fm.intel.com with ESMTP; 29 Jan 2015 03:25:32 -0800 From: meghanelogal To: intel-gfx@lists.freedesktop.org Date: Thu, 29 Jan 2015 16:46:20 +0530 Message-Id: <1422530180-18573-1-git-send-email-megha.i.nelogal@intel.com> X-Mailer: git-send-email 1.7.9.5 Cc: manikandan.k.pillai@intel.com, meghanelogal , pratyush.dutta@intel.com Subject: [Intel-gfx] [PATCH] tools/intel_reg_read:Adding lib calls for CHT/VLV X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: meghanelogal Calling the library functions for reg read and write Signed-off-by: meghanelogal --- tools/intel_reg_read.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/tools/intel_reg_read.c b/tools/intel_reg_read.c index c550b02..bdff92c 100644 --- a/tools/intel_reg_read.c +++ b/tools/intel_reg_read.c @@ -48,13 +48,9 @@ static void bit_decode(uint32_t reg) static void dump_range(uint32_t start, uint32_t end) { - int i, reg = 0; - struct pci_device *dev = intel_get_pci_device(); - if (IS_CHERRYVIEW(dev->device_id) || IS_VALLEYVIEW(dev->device_id)) - reg = 0x180000; + int i; for (i = start; i < end; i += 4) - printf("0x%X : 0x%X\n", i, - *(volatile uint32_t *)((volatile char*)mmio + i + reg)); + printf("0x%X : 0x%X\n", i, intel_register_read(i+0x180000)); } static void usage(char *cmdname) @@ -76,7 +72,6 @@ int main(int argc, char** argv) int full_dump = 0; int decode_bits = 0; int dwords = 1; - while ((ch = getopt(argc, argv, "dfhc:")) != -1) { switch(ch) { case 'd': @@ -132,13 +127,7 @@ int main(int argc, char** argv) dump_range(reg, reg + (dwords * 4)); if (decode_bits) { - struct pci_device *dev = intel_get_pci_device(); - if (IS_CHERRYVIEW(dev->device_id) || - IS_VALLEYVIEW(dev->device_id)) { - reg += 0x180000; - bit_decode(*(volatile uint32_t *) - ((volatile char*)mmio + reg)); - } + bit_decode(intel_register_read(0x180000)); } } }