From patchwork Fri Jun 17 13:38:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Cvek X-Patchwork-Id: 582850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63BDFC433EF for ; Fri, 17 Jun 2022 13:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380506AbiFQNix (ORCPT ); Fri, 17 Jun 2022 09:38:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232686AbiFQNix (ORCPT ); Fri, 17 Jun 2022 09:38:53 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA26B480 for ; Fri, 17 Jun 2022 06:38:52 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id h23so8814073ejj.12 for ; Fri, 17 Jun 2022 06:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject :content-language:to:cc:content-transfer-encoding; bh=9+5JSfR5emIIXIQSkqObw0oPOeBn2kv6o6GBkTBXMVU=; b=cZaQ9dbLocF/ekU7EzslSnuavirg8HxSEt1aH7adBb8EKkz8xMfyvD3qkNGN4NUO43 JD/0XQ4ghbyi/nh0t37j3RX5DYxtgAENVaKJYXyul6KmJtXkiDNBjoUuBkJFugpqlF19 ltvo1Odyl1CiVwP9sS+m0lifv9tBVXuoP8gdGhMw/OUh+XeztFWaCFS8pgoo6MTItSXu 4ARQHhDk4Ww4RhZX6knotm2tCuY5iPz06Xz5mT9U3QoIHc0fldPWdsVC95ZSfHQCWNmg LJWzQkSwxOb0bOsea+i3tc8geiYiedwwhLL6VRbU+6qZUSbikIXbhLSjLpz61HDgkhgU MnSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:content-language:to:cc:content-transfer-encoding; bh=9+5JSfR5emIIXIQSkqObw0oPOeBn2kv6o6GBkTBXMVU=; b=kEF9cExkj4g3Oq5a2LFNWRJyPtYW8hIVXB8QoZI/KGrRNFgm65FpYvmC4NQ0CoQeft QAxUb/YmsEMj5QkukRorIMY+RqWDlarSYFmQ22LZNGb1OLdKTo5+Yw2xpKdLxQRAWXos fme1HlnWDWU8nfIz6mwklwPsi8pyM4Upui1Ubz1bkXbTT8pdq6gTlqOKBbfwpq1yan0O Uxg0hhIlVXQ7mWKbpYSBl5scHd9dGoZ6F4m9LtEqWJva/wnnclwzrAOSCqKuhuE96axG kf/pNQQL2xxLiF5tt499q+e6T9AblTE4iKkir3J+f1BVyBIAndljlSC+0sZVchzHrx4b 1wnQ== X-Gm-Message-State: AJIora84ExoNg87dvWu6HY2TgZN/adjUxOTtCQFtEmmKp90gNC7D6c1O UyWgUx2GHE6iTJAG/rbIa8CZv/d+JFxd6A== X-Google-Smtp-Source: AGRyM1u82aGIFGlhexIqLi4cNYiXgipnw/L536RFQzHfU5ZaOOusmJJbcELQwNbjlArMdEvJwfUBvQ== X-Received: by 2002:a17:907:7f1d:b0:71d:ea75:e533 with SMTP id qf29-20020a1709077f1d00b0071dea75e533mr1872187ejc.78.1655473130745; Fri, 17 Jun 2022 06:38:50 -0700 (PDT) Received: from ?IPV6:2001:1ae9:1e8:b200:ae52:b385:81fe:eeab? (2001-1ae9-1e8-b200-ae52-b385-81fe-eeab.ip6.tmcz.cz. [2001:1ae9:1e8:b200:ae52:b385:81fe:eeab]) by smtp.gmail.com with ESMTPSA id g17-20020a170906539100b0070587f81bcfsm2242995ejo.19.2022.06.17.06.38.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jun 2022 06:38:49 -0700 (PDT) Message-ID: <2a722588-e41d-75f7-dad6-944b2b1daa4a@gmail.com> Date: Fri, 17 Jun 2022 15:38:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 From: Petr Cvek Subject: [PATCH 1/2] video: fbdev: intelfb: Use aperture size from pci_resource_len Content-Language: en-US To: mbroemme@libmpq.org Cc: linux-fbdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Aperture size for i9x5 variants is determined from PCI base address. if (pci_resource_start(pdev, 2) & 0x08000000) *aperture_size = MB(128); ... This condition is incorrect as 128 MiB address can have the address set as 0x?8000000 or 0x?0000000. Also the code can be simplified to just use pci_resource_len(). The true settings of the aperture size is in the MSAC register, which could be used instead. However the value is used only as an info message, so it doesn't matter. Signed-off-by: Petr Cvek --- drivers/video/fbdev/intelfb/intelfbhw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/intelfb/intelfbhw.c b/drivers/video/fbdev/intelfb/intelfbhw.c index 57aff7450bce..2086e06532ee 100644 --- a/drivers/video/fbdev/intelfb/intelfbhw.c +++ b/drivers/video/fbdev/intelfb/intelfbhw.c @@ -201,13 +201,11 @@ int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size, case PCI_DEVICE_ID_INTEL_945GME: case PCI_DEVICE_ID_INTEL_965G: case PCI_DEVICE_ID_INTEL_965GM: - /* 915, 945 and 965 chipsets support a 256MB aperture. - Aperture size is determined by inspected the - base address of the aperture. */ - if (pci_resource_start(pdev, 2) & 0x08000000) - *aperture_size = MB(128); - else - *aperture_size = MB(256); + /* + * 915, 945 and 965 chipsets support 64MB, 128MB or 256MB + * aperture. Determine size from PCI resource length. + */ + *aperture_size = pci_resource_len(pdev, 2); break; default: if ((tmp & INTEL_GMCH_MEM_MASK) == INTEL_GMCH_MEM_64M) From patchwork Fri Jun 17 13:38:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Cvek X-Patchwork-Id: 582667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D858C43334 for ; Fri, 17 Jun 2022 13:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381797AbiFQNi7 (ORCPT ); Fri, 17 Jun 2022 09:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232686AbiFQNi7 (ORCPT ); Fri, 17 Jun 2022 09:38:59 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74B953AA5F for ; Fri, 17 Jun 2022 06:38:58 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id h23so8814073ejj.12 for ; Fri, 17 Jun 2022 06:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject :content-language:to:cc:content-transfer-encoding; bh=rQa54VziDbteL5e9vC9SJcq6ksiroOhA3qMTYfrdk50=; b=n0Qv+mgDs53uk0j8nFq6LX/6FvQgGvXWCVyjPZyJ1ZxZLIH2BV3SZCfTPMIGX8KF+X sb7EgT9VD/JOyqL1NKOtOaJ0E/qPIHepJCbgri3xbYUvc3hxUnREzk98WsXIGpox2ALj CHks9JJH5Soi9htXwDFiucagxs+x39ltq4Fzmb+Tsxe1MG3E///nuBXzOwv/T8AbLMBm GLW2sQeQMkUV/UwOKJvh/HUGkBWlpFZCm028uHgqw0MnqJqLDulm0qQ1o3wkaBrGlUIQ e49kQE82BYH5PowU/gRtZ5Pik+K2VlOeT+J5OMiW38JPB7FLymoafMLH/RXdl4CatKxC zTRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:content-language:to:cc:content-transfer-encoding; bh=rQa54VziDbteL5e9vC9SJcq6ksiroOhA3qMTYfrdk50=; b=3eYVR3lHQyP8SONBnBhOQOleOX6F99VnrNcFZULmwgSzRJyEAs6irqldv5Rhdkk7I6 wkOdkKai43ejUqwSJimQ7H8T51wMdMiIB4eVOv4juSOP2ExrG0ave7oNNnZ9c2HQYDIT dQfrxy5ra5xAa6UtQ8mDLT7HLKzZM4k6bpxDo2LBxh+2QM7OjbnCwS9wvmRQeA4CZLzE Si/l/T5i9dq6qmvf3Nm/CYwLUjqWJUg8r2H72wSlk9wHcC5WrakSduU3n2UODTOf4lDY g/2p5PijNitE+HGtcPQjxQ+FdgS3PyFMXiRaPOmrdrF0ljTnkU8tAABiwYgY4CM8QajS 7sGw== X-Gm-Message-State: AJIora/9wtNJ8gjetVZMb7bpXyOog/23YtVvV+t2nzSULEJyZHnXYwVW 1KrGstPewnNTYv42a4dBr1c= X-Google-Smtp-Source: AGRyM1tme/7RZoqiG8ELA1aUILmG4kAHsn/WWGJenDyuo6/nAyXTslv/LoS9dRZO+aO71AS+kxB8+Q== X-Received: by 2002:a17:906:519b:b0:711:fb34:16f4 with SMTP id y27-20020a170906519b00b00711fb3416f4mr9654394ejk.275.1655473138040; Fri, 17 Jun 2022 06:38:58 -0700 (PDT) Received: from ?IPV6:2001:1ae9:1e8:b200:ae52:b385:81fe:eeab? (2001-1ae9-1e8-b200-ae52-b385-81fe-eeab.ip6.tmcz.cz. [2001:1ae9:1e8:b200:ae52:b385:81fe:eeab]) by smtp.gmail.com with ESMTPSA id y24-20020a056402135800b0042dce73168csm3741211edw.13.2022.06.17.06.38.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jun 2022 06:38:57 -0700 (PDT) Message-ID: Date: Fri, 17 Jun 2022 15:38:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 From: Petr Cvek Subject: [PATCH 2/2] video: fbdev: intelfb: Initialize value of stolen size Content-Language: en-US To: mbroemme@libmpq.org Cc: linux-fbdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Variable stolen_size can be left uninitialized in a code path with INTEL_855_GMCH_GMS_DISABLED. Fix this by initializing the variable to 0. Also fix indentation of function arguments. Signed-off-by: Petr Cvek --- drivers/video/fbdev/intelfb/intelfbdrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c index a9579964eaba..5647fca8c49a 100644 --- a/drivers/video/fbdev/intelfb/intelfbdrv.c +++ b/drivers/video/fbdev/intelfb/intelfbdrv.c @@ -472,7 +472,7 @@ static int intelfb_pci_register(struct pci_dev *pdev, struct fb_info *info; struct intelfb_info *dinfo; int i, err, dvo; - int aperture_size, stolen_size; + int aperture_size, stolen_size = 0; struct agp_kern_info gtt_info; int agp_memtype; const char *s; @@ -571,7 +571,7 @@ static int intelfb_pci_register(struct pci_dev *pdev, return -ENODEV; } - if (intelfbhw_get_memory(pdev, &aperture_size,&stolen_size)) { + if (intelfbhw_get_memory(pdev, &aperture_size, &stolen_size)) { cleanup(dinfo); return -ENODEV; }