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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF9B1C433F5 for ; Tue, 29 Mar 2022 17:01:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A691384049; Tue, 29 Mar 2022 19:00:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="IxZ8Gw6c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0AC6584042; Tue, 29 Mar 2022 18:59:45 +0200 (CEST) Received: from mail-wm1-x34a.google.com (mail-wm1-x34a.google.com [IPv6:2a00:1450:4864:20::34a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 55BA483FE4 for ; Tue, 29 Mar 2022 18:59:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=3-zpDYgYKBpY0I2KBB6EE6B4.2ECK-1EEJB8IJI.34DN.34@flex--ascull.bounces.google.com Received: by mail-wm1-x34a.google.com with SMTP id 4-20020a05600c274400b0038c8ab2e835so1491223wmw.1 for ; Tue, 29 Mar 2022 09:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=kV0OOsan8hGX3ipdxY8lZYPrfqSzSXAXnAiNskgoo1Y=; b=IxZ8Gw6c7jlP6WpIuK2EfQcdcf1HAmemeUYJGcuv5h9UbeY4BZtNp5SsrALOolYO47 2zLRTU/ND9b2mAFsCzsygWR9mPFFmE8SGleCvN9J2JfjSf4bxTjLuoANR7h8iAoNL3g5 qAoRlQTABdMAEQ5e1L9a5J6Y9VMPC+H/tnR5ZxuMIAn4xPgqShlRMxIcZnB1fhXL16yC 6jjm5ztfWmdHg6mOvz28i+TTTtgkPp4JPEQ49RQ7epGBWXDEaR8ClDpCkYMJT+MvSJT7 bRmRwFePLsmz49Sooa12avum6HIwnGpFEzHkOQn/9+huYdpkETHJVRlxs8IQ5GnTmW5M i1/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=kV0OOsan8hGX3ipdxY8lZYPrfqSzSXAXnAiNskgoo1Y=; b=O4VRheGXs85sv4tBilv9Bc9DqR+JJjVx99dCtmpvwBk3ASUFvzH8PbNj9DhLz8YDUJ sERUqZuZGes1HYf4kNiahQsnS0ecGM+Hy/gjvTk6BPuNArgG/ZnEXYA2sX9NHbd8xZgI bnv9u1BzMpV3Ea5Q2kbBp+9TLP9w93e7J3zD53wk4zZ9u0CEoMBbHAajwEqv12tJ5W4A tvFdNpDqog0J+zGmRx5LJ8bYjX2vl4KXDxfPPoA8sBK2GGLsoAZlgZgvfNW4ok5NdfHZ DIb7AV9HlroTnQs/QYjH7hZB4VULAK+FUWG/MSKGaWI5imSEBM2IK6aiMJcOayt2SCCF RDYA== X-Gm-Message-State: AOAM5306h2g8njzj2SdxIjOULt+xLmeqk0392ZIkviSpQ1UYEbGtkDIa 5ClKRgbC7JBhQKJ4avo1rDHKCCE4qBlsxE8SLgB3uAbRNZ60J+a6g2n8sTT78wbSqO+4CDoDnVv CXj5vNSQ6GoKIW1T/MpHKtJLQo/aU+c9JoW1sTrxxc7ZqOTwLrFC3hXL7740= X-Google-Smtp-Source: ABdhPJxgLEGvcOl1SiHJhau1suju4KFxDTGYRFRCKfz0ygeYIjAVGVQvjre2VzPG06eTjN/Vj/nY91G/dJU= X-Received: from ascull.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1510]) (user=ascull job=sendgmr) by 2002:a05:600c:3c89:b0:37f:aacb:cac7 with SMTP id bg9-20020a05600c3c8900b0037faacbcac7mr178186wmb.1.1648573179394; Tue, 29 Mar 2022 09:59:39 -0700 (PDT) Date: Tue, 29 Mar 2022 16:58:51 +0000 In-Reply-To: <20220329165900.1139885-1-ascull@google.com> Message-Id: <20220329165900.1139885-10-ascull@google.com> Mime-Version: 1.0 References: <20220329165900.1139885-1-ascull@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH v2 09/18] pci: Add config for Enhanced Allocation From: Andrew Scull To: u-boot@lists.denx.de Cc: sjg@chromium.org, bmeng.cn@gmail.com, adelva@google.com, keirf@google.com, ptosi@google.com, Andrew Scull Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Add a config to control whether Enhanced Allocation is supported by the driver. Signed-off-by: Andrew Scull --- drivers/pci/Kconfig | 7 +++++++ drivers/pci/pci-uclass.c | 25 +++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 47cd074aa1..fd2203420c 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -67,6 +67,13 @@ config PCI_SRIOV if available on a PCI Physical Function device and probe for applicable drivers. +config PCI_ENHANCED_ALLOCATION + bool "Enable support for Enhanced Allocation of resources" + default y + help + Enable support for Enhanced Allocation which can be used by supported + devices in place of traditional BARS for allocation of resources. + config PCI_ARID bool "Enable Alternate Routing-ID support for PCI" help diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 8bbeb62f2e..719656eb3a 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -645,7 +645,11 @@ int dm_pci_hose_probe_bus(struct udevice *bus) return log_msg_ret("probe", -EINVAL); } - ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA); + if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION)) + ea_pos = dm_pci_find_capability(bus, PCI_CAP_ID_EA); + else + ea_pos = 0; + if (ea_pos) { dm_pci_read_config8(bus, ea_pos + sizeof(u32) + sizeof(u8), ®); @@ -1600,15 +1604,16 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, unsigned long flags) udev = pdata->pfdev; } - /* - * if the function supports Enhanced Allocation use that instead of - * BARs - * Incase of virtual functions, pdata will help read VF BEI - * and EA entry size. - */ - ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA); - if (ea_off) - return dm_pci_map_ea_bar(udev, bar, ea_off, pdata); + if (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION)) { + /* + * If the function supports Enhanced Allocation use that + * instead of BARs. Incase of virtual functions, pdata will + * help read VF BEI and EA entry size. + */ + ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA); + if (ea_off) + return dm_pci_map_ea_bar(udev, bar, ea_off, pdata); + } /* read BAR address */ dm_pci_read_config32(udev, bar, &bar_response); -- 2.35.1.1021.g381101b075-goog