From patchwork Tue Oct 29 21:08:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suneel Garapati X-Patchwork-Id: 1186310 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LTSj625W"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 472kw269vRz9s7T for ; Wed, 30 Oct 2019 08:18:26 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 666C5C21C27; Tue, 29 Oct 2019 21:10:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id F2DD8C21DCA; Tue, 29 Oct 2019 21:08:55 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id ECDADC21DA2; Tue, 29 Oct 2019 21:08:45 +0000 (UTC) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by lists.denx.de (Postfix) with ESMTPS id 694D2C21BE5 for ; Tue, 29 Oct 2019 21:08:37 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id v19so10534000pfm.3 for ; Tue, 29 Oct 2019 14:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UB+P+vx5F6YUEO0fIiZY7XaXyzam0ajfGUSZPL/02PY=; b=LTSj625WoltSHRCv+aQboxnDEyLSJDyQul1OVM/QqMlKXkr9uJsPxIjCwXyZF2cCJr BvgGbhe0SZ5jY0o3HYsN26r9vDSfTIIZVcfMjA38idDYiyOO6xMfQTdRJl2EbGQu9jSb yO+EwoZHPw8Yl3z5mHxD4ujOj/hGXDfwh/fr6+eA4SeCuHmeqPbmAJTiODRWvhKl305I VuKSrofUuZXu+uQbpGJCc9dTFqai59mcYXSVKX28pP0bgz5m8DDebr9IcsJQQxXmFUGL NSxOcm3Pt/CWjr6LBU4QUoWwJ8ZBqiUCy+OD7IXBGhR7O+7ZysxC3mtixDJUyYEdAe+8 0+Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UB+P+vx5F6YUEO0fIiZY7XaXyzam0ajfGUSZPL/02PY=; b=BjGF7fbMthaMamykEZWN8SM1tdiXWzJ+LNdSXnnCKhVs61V75qSzZnxnFgGl0z7Y0U 0OnGkvQXyykBIYrY3+/wvVz3XzRdjdZhcdqR7nlR3baHPrrklN548AAhu1oQo+n8LRfE +Oa6Bj2as3UbxphFXx+c0+M5PyFeH3ZWPR07Mrhf+dRuJpPpX2qbxJnYXxyiZvXevFTk 0C5dn4dWxkggrPnwA9q2jfpGBOE5ENgee7ISCgj7ObUIzx6t0KMjZP2lVmvpHD71V84w e+TM4TVqedxlvZH4yTNMm2KPL+11MVaIwW52HD70Owt7ovJhq5WM7A+EwMT26sRxvUtD VYnQ== X-Gm-Message-State: APjAAAUvftBv/fW3cJQAS8AYizvRpjZZ7FNTae9B9RFnM695K4O3dGZ/ WkBNvmDsamVseQ3WjW6dnKL7gvcY X-Google-Smtp-Source: APXvYqwiiy/GGRtlKo00trEd8SsEAVh9jTGxsxBLVL20X4krHVpvRD+VZFdcvVZGgldg+cEx/cuoxA== X-Received: by 2002:a65:6085:: with SMTP id t5mr21557354pgu.450.1572383315872; Tue, 29 Oct 2019 14:08:35 -0700 (PDT) Received: from suneel.hsd1.ca.comcast.net ([2601:641:4000:c9c0:7044:5eef:7096:2413]) by smtp.gmail.com with ESMTPSA id q3sm131160pgj.54.2019.10.29.14.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 14:08:35 -0700 (PDT) From: Suneel Garapati To: u-boot Date: Tue, 29 Oct 2019 14:08:02 -0700 Message-Id: <20191029210821.1954-11-suneelglinux@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191029210821.1954-1-suneelglinux@gmail.com> References: <20191029210821.1954-1-suneelglinux@gmail.com> MIME-Version: 1.0 Cc: Tom Rini , Matthias Brugger , Joe Hershberger , Prasun Kapoor , Maen Suleiman , Chandrakala Chavva , Zi Shen Lim , Stefan Roese , Chris Packham Subject: [U-Boot] [RFC PATCH 10/29] drivers: pci-uclass: Add support for Alternate-RoutingID capability X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Suneel Garapati If ARI capability is found on device, use it to update next function number in bus scan and also helps to skip unnecessary bdf scans. Signed-off-by: Suneel Garapati Reviewed-by: Simon Glass --- drivers/pci/pci-uclass.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index f9823231b1..b02588b552 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -773,7 +773,7 @@ int pci_bind_bus_devices(struct udevice *bus) ulong header_type; pci_dev_t bdf, end; bool found_multi; - int ret; + int ret, ari_off; found_multi = false; end = PCI_BDF(bus->seq, PCI_MAX_PCI_DEVICES - 1, @@ -846,6 +846,22 @@ int pci_bind_bus_devices(struct udevice *bus) pplat->vendor = vendor; pplat->device = device; pplat->class = class; + + ari_off = dm_pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI); + if (ari_off) { + u16 ari_cap; + + /* Read Next Function number in ARI Cap Register */ + dm_pci_read_config16(dev, ari_off + 4, &ari_cap); + /* Update next scan on this function number, + * subtract 1 in BDF to satisfy loop increment. + */ + if (ari_cap & 0xff00) { + bdf = PCI_BDF(PCI_BUS(bdf), PCI_DEV(ari_cap), + PCI_FUNC(ari_cap)); + bdf = bdf - 0x100; + } + } } return 0;