From patchwork Tue Jun 30 18:28:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6697961 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C9260C05AC for ; Tue, 30 Jun 2015 18:29:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CEE6A205CA for ; Tue, 30 Jun 2015 18:29:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BEBFC2038E for ; Tue, 30 Jun 2015 18:29:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 51F0C6EA19; Tue, 30 Jun 2015 11:29:06 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 2FCC06EA19 for ; Tue, 30 Jun 2015 11:29:05 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 30 Jun 2015 11:29:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,379,1432623600"; d="scan'208";a="737894668" Received: from amunshi-mobl4.amr.corp.intel.com (HELO strange.amr.corp.intel.com) ([10.254.100.153]) by fmsmga001.fm.intel.com with ESMTP; 30 Jun 2015 11:29:03 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Tue, 30 Jun 2015 19:28:55 +0100 Message-Id: <1435688939-26523-3-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1435688939-26523-1-git-send-email-damien.lespiau@intel.com> References: <1435688939-26523-1-git-send-email-damien.lespiau@intel.com> Subject: [Intel-gfx] [PATCH 2/6] drm/i915/skl: Store and print the DMC firmware version we load 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.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 That can be handy later on to tell which DMC firmware version the user has, by just looking at the dmesg or a debugfs file. Signed-off-by: Damien Lespiau --- drivers/gpu/drm/i915/i915_debugfs.c | 7 +++++++ drivers/gpu/drm/i915/i915_drv.h | 5 +++++ drivers/gpu/drm/i915/intel_csr.c | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index df35448..5dad2ac 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2604,6 +2604,7 @@ static int i915_dmc_info(struct seq_file *m, void *unused) struct drm_info_node *node = m->private; struct drm_device *dev = node->minor->dev; struct drm_i915_private *dev_priv = dev->dev_private; + struct intel_csr *csr = &dev_priv->csr; static const char *csr_state_str[] = { "unknown", "loaded", "error" }; enum csr_state csr_state; @@ -2616,6 +2617,12 @@ static int i915_dmc_info(struct seq_file *m, void *unused) csr_state = intel_csr_load_status_get(dev_priv); seq_printf(m, "status: %s\n", csr_state_str[csr_state]); + if (csr_state != FW_LOADED) + return 0; + + seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version), + CSR_VERSION_MINOR(csr->version)); + return 0; } diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 051298e..e15cb56 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -730,6 +730,10 @@ struct intel_uncore { #define for_each_fw_domain(domain__, dev_priv__, i__) \ for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__) +#define CSR_VERSION(major, minor) ((major) << 16 | (minor)) +#define CSR_VERSION_MAJOR(version) ((version) >> 16) +#define CSR_VERSION_MINOR(version) ((version) & 0xffff) + enum csr_state { FW_UNINITIALIZED = 0, FW_LOADED, @@ -740,6 +744,7 @@ struct intel_csr { const char *fw_path; __be32 *dmc_payload; uint32_t dmc_fw_size; + uint32_t version; uint32_t mmio_count; uint32_t mmioaddr[8]; uint32_t mmiodata[8]; diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c index 6d8a7bf..f83a2bf 100644 --- a/drivers/gpu/drm/i915/intel_csr.c +++ b/drivers/gpu/drm/i915/intel_csr.c @@ -300,6 +300,9 @@ static void finish_csr_load(const struct firmware *fw, void *context) (css_header->header_len * 4)); goto out; } + + csr->version = css_header->version; + readcount += sizeof(struct intel_css_header); /* Extract Package Header information*/ @@ -389,7 +392,10 @@ static void finish_csr_load(const struct firmware *fw, void *context) intel_csr_load_program(dev); fw_loaded = true; - DRM_DEBUG_KMS("Finished loading %s\n", dev_priv->csr.fw_path); + DRM_DEBUG_KMS("Finished loading %s (v%d.%d)\n", dev_priv->csr.fw_path, + CSR_VERSION_MAJOR(csr->version), + CSR_VERSION_MINOR(csr->version)); + out: if (fw_loaded) intel_runtime_pm_put(dev_priv);