From nobody Thu Aug 25 17:32:02 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MD94z00WHz4b3FB; Thu, 25 Aug 2022 17:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MD94y5scCz3MY9; Thu, 25 Aug 2022 17:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661448722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yI3sYoI40Ggf6eRCD0eAR+bBiNsUjzn0qjoKemd0rKc=; b=T9Wo3WqiNlE0PLT6X7ttx2Z01oX356a+snQKh3I3kPNjRkAHJ2dLh/E82DIe5ZIMH1Fhvo dVL+cbahJwGT5kzrbSnnjL1ivkmV8in1E8IBgeQSESChDtynqs7VsINH014KPEyLmS3tZt kskrmU/dxCiM9+Njs7shZpwh0/Y0GMMhmEOMRMvwD4CPivSzeUeQDmPxB1N4kTp0LrD2KV CKegv4JNKfqePTEfuwr+BTDw43lSSUJXjqPhMnsWxIgYUVptLcanLZrDHjeMP82cGH8uKZ jTDwmOjeH3EYnE1iuZQ/1T77H3SiZpixeYr3Hx6JAyg6ik7SfoGO0s+R0pFGGQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MD94y4gCMzx6m; Thu, 25 Aug 2022 17:32:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27PHW2uE046417; Thu, 25 Aug 2022 17:32:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27PHW2WS046416; Thu, 25 Aug 2022 17:32:02 GMT (envelope-from git) Date: Thu, 25 Aug 2022 17:32:02 GMT Message-Id: <202208251732.27PHW2WS046416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: bb5b19a12c61 - stable/12 - pci: Add helper routines to iterate over a device's BARs. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bb5b19a12c611a8a53b24def420f98ab10c262fe Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661448722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yI3sYoI40Ggf6eRCD0eAR+bBiNsUjzn0qjoKemd0rKc=; b=GfzpbDxrS4KfPYrSxQo0AUZ9RVNUgFgclPLjvrdx9qXBXqI5zcm0XrAGdVs8tO9bCOzEdf 9C6AFy00fKkePc0+cELn38woZ4oKBSyFqo1eLnSxAU+aAHU9NT3/ZUyQkcoXc6XrZHMDGk 2Rb1XecAHflSuO7qaIZNnYChwBs5kH1hotfOLY5Qz+n5kmdEgw//zJ4hrX2qiIQo2BabrG LfdyxC/r12gvqSDz2d6oY3eoa9tM6VF3K8E5yZmYZQtvwiOsJ49wj4LLmUjjuwjZxp+Qjz PaGxGqFpmqO1rK7r89s+uuzFWSfalrBXU/uvsK9BHTbStesavkXaSnF1b0s37A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661448722; a=rsa-sha256; cv=none; b=j3c8yiH+y8rRMGh7cM2b8B28Vlyql2tYrxwA3Erci+mqoWuSlX9oaq44tBcj5HbEqQOtev SIorJDkvjfcgnoWoqvPN6MKXIB7kl8lw6EysgdjvkNerSxaIGFZqIcKh3yl0DjffLtfqYB F9OXvKb0YUwIA2Wsg0THxvodzMKAAlJxuFKNSRx3QcLwflWmxNxd55QVNTYN6swM5mvn5+ hYM9Cn7OWMsqcRVBkHCNbrfaJulrCN0vQYa9t2Wr4/VrTSOSyNfWpmhbztD52Cc7l8AA0X hYNijDgZAq8TPc4pCT8D3aLy0LyerGHAhFHB0/gBPm0I6rk7v9fhbLDqqG3wHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bb5b19a12c611a8a53b24def420f98ab10c262fe commit bb5b19a12c611a8a53b24def420f98ab10c262fe Author: John Baldwin AuthorDate: 2022-08-19 21:59:06 +0000 Commit: John Baldwin CommitDate: 2022-08-25 16:40:10 +0000 pci: Add helper routines to iterate over a device's BARs. Reviewed by: imp, markj, emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36237 (cherry picked from commit 16bedf532c022f2380b0bb2970a3a3ebc7ca0f36) --- sys/dev/pci/pci.c | 15 +++++++++++++++ sys/dev/pci/pcivar.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index e793c435189b..9a49d4ca9783 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -3120,6 +3120,21 @@ pci_find_bar(device_t dev, int reg) return (NULL); } +struct pci_map * +pci_first_bar(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + return (STAILQ_FIRST(&dinfo->cfg.maps)); +} + +struct pci_map * +pci_next_bar(struct pci_map *pm) +{ + return (STAILQ_NEXT(pm, pm_link)); +} + int pci_bar_enabled(device_t dev, struct pci_map *pm) { diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index b3126ad8dc51..0e1c5e3c8e36 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -705,6 +705,8 @@ extern struct devlist pci_devq; extern uint32_t pci_generation; struct pci_map *pci_find_bar(device_t dev, int reg); +struct pci_map *pci_first_bar(device_t dev); +struct pci_map *pci_next_bar(struct pci_map *pm); int pci_bar_enabled(device_t dev, struct pci_map *pm); struct pcicfg_vpd *pci_fetch_vpd_list(device_t dev);