From mboxrd@z Thu Jan 1 00:00:00 1970 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 200ABC433F5 for ; Thu, 21 Apr 2022 16:14:53 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1A6CA83EF4; Thu, 21 Apr 2022 18:12:32 +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="NR0PNrft"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E8C4483EB3; Thu, 21 Apr 2022 18:12:03 +0200 (CEST) Received: from mail-wr1-x449.google.com (mail-wr1-x449.google.com [IPv6:2a00:1450:4864:20::449]) (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 8BF8383EB3 for ; Thu, 21 Apr 2022 18:11:59 +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=3ToJhYgYKBvETlVneeZhhZeX.Vhfn-Uhhmeblml.WXgq.WX@flex--ascull.bounces.google.com Received: by mail-wr1-x449.google.com with SMTP id j30-20020adfb31e000000b0020a9043abd7so1294503wrd.12 for ; Thu, 21 Apr 2022 09:11:59 -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=iTct0EKxABPQUs8iy9/gIW4PYM+3PQyPzPSI5rkPi/w=; b=NR0PNrftZXm0A8WvkBuhI4qj4BKwWKC+K21lJ+t4JaRicAv6KRP/ADujQ5GpbHdfjT e9fK7sPU9lK2TISXEcf6S/gFxe4oB52sxMNb4nd9gZYT3ITtWP/cya7f/LCV8h6pdw4X p+bnwhk+8wSJ736k+C/n2p+9g8Aub7G0xPlCUxVeSRzTZkRPk4nbbYdcZDXNU4qGk9lG +up9W+DzfLrY51r8iSOpmk5/FMKu7/rCJGR12WCQb9zJcdbn2mJH42ahNTxi65+LkJba zGoKyv+pvjEhHFMX72rS86D587y6Hrt4XNi9d1DY54DXrKhbXkYukerAQ+wIU22DSwjO 5sRA== 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=iTct0EKxABPQUs8iy9/gIW4PYM+3PQyPzPSI5rkPi/w=; b=Y0rMPjXTDkS8duiZf0YWx6iU1NUG1OGCFqXpgYJlhrgj0y+YsLor26w9nAvRR2fT7x Nw40oA4X7jNG1Iqe4kSpg4BWLJ2pQfoV+VtWwSuJZpmGBAz7vgZmD4w+QDCylKqX0TXq GPsBz+LeWLx1E7qb+YJl6IhOAvwoBWBC68kJZjfk6dPr+ZCpQ16n2TEP7vhZQFjj8PJl I8Ks2I1RtdM+O94m/TFUF5pEb5ZM87+/QFE1xhz707xjvgm+XTrz3FC4QyjKhhTYcx8p UnqjbZQ9c+SbBbwAoLrwM1vVobu0Vrh23x47BLfAFq/vXxApI008BOK/B8Jw14DnfKPQ 93xw== X-Gm-Message-State: AOAM533Cozd9MWkfDgLydreOWCsTEJj78YPUexxJyRSUTqQy8XvVLn2t n39gwUoyq730shVDJ7wUCPKHnZ88UtYpOSHQSjLZjiwKBSi7UZrvoUvVIkcpLpbynq+BRNvAc+O a1LO4mRnBKpr/XEP5DboWKX7P/FqDt9n+EZHiKbJT+7xsxAFaGFbovk0a/kU= X-Google-Smtp-Source: ABdhPJwXpIUfVO3+5ES+6K+kJuVRQkY+jcy438N2GHK30XXwDLZbWtvV8q2NJC9XaLkozmKN1633r2qYFyU= X-Received: from ascull.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1510]) (user=ascull job=sendgmr) by 2002:a05:600c:2108:b0:38e:b7b0:79bc with SMTP id u8-20020a05600c210800b0038eb7b079bcmr98409wml.33.1650557518932; Thu, 21 Apr 2022 09:11:58 -0700 (PDT) Date: Thu, 21 Apr 2022 16:11:16 +0000 In-Reply-To: <20220421161116.1202023-1-ascull@google.com> Message-Id: <20220421161116.1202023-19-ascull@google.com> Mime-Version: 1.0 References: <20220421161116.1202023-1-ascull@google.com> X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog Subject: [PATCH v3 18/18] pci: Add config for Enhanced Allocation From: Andrew Scull To: u-boot@lists.denx.de Cc: sjg@chromium.org, bmeng.cn@gmail.com, trini@konsulko.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 | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 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 bb53e6ba5f..970ee1adf1 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), ®); @@ -1579,7 +1583,11 @@ void *dm_pci_map_bar(struct udevice *dev, int bar, size_t offset, size_t len, * 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 (IS_ENABLED(CONFIG_PCI_ENHANCED_ALLOCATION)) + ea_off = dm_pci_find_capability(udev, PCI_CAP_ID_EA); + else + ea_off = 0; + if (ea_off) return dm_pci_map_ea_bar(udev, bar, offset, len, ea_off, pdata); -- 2.36.0.rc2.479.g8af0fa9b8e-goog