From patchwork Tue Jan 7 17:33:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilia Mirkin X-Patchwork-Id: 3449301 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4964DC02DC for ; Tue, 7 Jan 2014 17:34:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 190842012D for ; Tue, 7 Jan 2014 17:34:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6FD3020125 for ; Tue, 7 Jan 2014 17:34:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6094FAA2D; Tue, 7 Jan 2014 09:34:06 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qe0-f46.google.com (mail-qe0-f46.google.com [209.85.128.46]) by gabe.freedesktop.org (Postfix) with ESMTP id 347A3FAA2D for ; Tue, 7 Jan 2014 09:34:05 -0800 (PST) Received: by mail-qe0-f46.google.com with SMTP id a11so661489qen.33 for ; Tue, 07 Jan 2014 09:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=88ainVlmEKXwqtxnooSdfhx1EOVyZkB6pCysn1kSH+M=; b=eaziuKI4l247Vb7FwBaDg2+jOZQLQlxtCKmfrtUinCJJMeEc/jRAX2My0ZI7qfqaxi J5s7UBQtjyKj3pVIDG22dXeyvPU6BxxTNWL5qcfw2JjmCrbC05k4avKEEEW48St2ML50 LSNZpJBmPeFxLgVtejB1L25X7b3hwhGOtnEEXJQr2He2DXvGMNVO3h6LLqOaB+cw6ijP ZdRu2nuov7Q7blztqJPrZtycRQzo/Xx31Q8y0fo0rUXnYoyRZsKDvJ0DRUiX3M06d19J upYxW7xK5Snd94sfW4YUcMmwWy9a2sOOAHgXPay010jZPOf2g5Jmfhf30+V5JUwJPFR/ 9sCQ== X-Received: by 10.49.39.165 with SMTP id q5mr200404076qek.48.1389116044660; Tue, 07 Jan 2014 09:34:04 -0800 (PST) Received: from localhost.localdomain (cpe-74-71-29-187.nyc.res.rr.com. [74.71.29.187]) by mx.google.com with ESMTPSA id fc16sm112137476qeb.3.2014.01.07.09.34.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2014 09:34:04 -0800 (PST) From: Ilia Mirkin To: Ben Skeggs Subject: [PATCH] drm/nouveau/bios: fix offset calculation for BMPv1 bioses Date: Tue, 7 Jan 2014 12:33:59 -0500 Message-Id: <1389116039-20361-1-git-send-email-imirkin@alum.mit.edu> X-Mailer: git-send-email 1.8.3.2 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 The only BIOS on record that needs the 14 offset has a bios major version 2 but BMP version 1.01. Another bunch of BIOSes that need the 18 offset have BMP version 2.01 or 5.01 or higher. So instead of looking at the bios major version, look at the BMP version. BIOSes with BMP version 0 do not contain a detectable script, so always return 0 for them. See https://bugs.freedesktop.org/show_bug.cgi?id=68835 Reported-by: Mauro Molinari Signed-off-by: Ilia Mirkin --- Unfortunately the bug reporter doesn't really know how to compile kernels and my bet is that the system his NV04 is in isn't exactly top-of-the-line, so a kernel compile would take forever. I've made similar changes in nvbios, and it seems to now handle every nv04/nv05 bios in our repo, in addition to Mauro's, so I think these changes should be safe-ish. However I'm not tagging for stable yet, in case things don't pan out the way I expected. If Mauro tests a kernel with this and all's well, then I'll send a separate request to stable-ify this patch. I'm betting that some old code used to check the bmp_version_major against 2, but that got changed to bios major in one of the rewrites, although I didn't go digging. drivers/gpu/drm/nouveau/core/subdev/bios/init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c index 9f5b81e..df1b1b4 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c @@ -365,13 +365,13 @@ static u16 init_script(struct nouveau_bios *bios, int index) { struct nvbios_init init = { .bios = bios }; - u16 data; + u16 bmp_ver = bmp_version(bios), data; - if (bmp_version(bios) && bmp_version(bios) < 0x0510) { - if (index > 1) + if (bmp_ver && bmp_ver < 0x0510) { + if (index > 1 || bmp_ver < 0x0100) return 0x0000; - data = bios->bmp_offset + (bios->version.major < 2 ? 14 : 18); + data = bios->bmp_offset + (bmp_ver < 0x0200 ? 14 : 18); return nv_ro16(bios, data + (index * 2)); }