From nobody Fri Feb 17 23:45:03 2023 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 4PJT275FYYz3rxdj; Fri, 17 Feb 2023 23:45:03 +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 4PJT273kf6z3HfF; Fri, 17 Feb 2023 23:45:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676677503; 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=jfWgQj1L3XeqpV6SKvUAFTDHftm855Ev0twZhH/jICM=; b=K6W7M4GTI9wtQTdMI/uFz0qR9Kx+v0sr6pbfVwvhkEMeNoKJIhrXUx6OGwWutCaVJXY/Hf wOF2XEMTP9tmUNWjjpbNc1y5JCmWFJX9JSbA1VPyd7q6CetIom05Ld++E4uwHERo+aTuWZ GPuDbQXLad4+9cbS9Wq4GqAfSlbeCrEJMrPM7o52dnnl/qq8RenVo2cptFrXj3faWVaiZo lPhf2QiSnbibpz9D7mU5ZQXh/TbEzyujdaDnQzlprrBAeYIESrbdnrC3bxOlrxCxvenGkW 3oi/X7pffeClB1DSrTKsBrOaLdUhsrvYTB0YcdXpXufNeyBaAiujak7OEYlPHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676677503; 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=jfWgQj1L3XeqpV6SKvUAFTDHftm855Ev0twZhH/jICM=; b=ulrhfpwrDy6vDVkcyDLBFzNR/R3fphepvbhex63dTs6kb+qQDFhM7lpTfgEMbEqB6fad3H bcosLVVDfn2rAnJA1iFs74gWXcX6tazTuXNJDBpZa3S7RHzhyw9neh8PTc9FCs2ZLcGDV+ F4QMdEBzq4+Y7eHD3o4nQ4iMG9FVBoAKPMahVGnxayCFtUcGZ38PtJy2cuS3knH+vXqZG6 wV2Hq7llVgCjVbgRaxcvC22Simf2Qnnuw2KTI13HSOF62xapQU5IhpL6pFJ6nX/Gel2LGx 97OKOs9LCYKdwxehND/XKRWhvxbXr3EeqK7mvLrr9JhpQUJYhTGpJbgilI1Z5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676677503; a=rsa-sha256; cv=none; b=evesJmcR9WOxrA64UjmUXgZwWGFHBLu4U1ukGJlB8tHbAYqNVPoRG4XZWBseBREnY0L9hC 5qhSCmLzMcHtA/ia1STyeX6eZAqPMOf+0rI34uLcgMibSM8oZbfPb0H+vhiBpvpi2ds7yN /WYx6k5LSm68ed8BJC5ERno/a0mgxNV6HpjQ2U9FkGQ6K+PYPYWIexnKiGx7KvrbeoMF76 ZtYcCpi81Pvs4MD3LiZxd69O3JCDTx3dinWE6lFd6WL4PgaGk8xahkw+9vG/kw4/aTOaCx 2egDGAHdUI0QGyUgT8nodGWx7nxrhLOsN/xydU3nyKNFaPo4xtMRdkPlX6jgTA== 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 4PJT272pzfz11fS; Fri, 17 Feb 2023 23:45:03 +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 31HNj3gl025372; Fri, 17 Feb 2023 23:45:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31HNj3Rp025371; Fri, 17 Feb 2023 23:45:03 GMT (envelope-from git) Date: Fri, 17 Feb 2023 23:45:03 GMT Message-Id: <202302172345.31HNj3Rp025371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 7b65e6f377ca - stable/13 - LinuxKPI: pci: add more functions 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: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7b65e6f377ca0005a986c59f1e31a0421d92660f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=7b65e6f377ca0005a986c59f1e31a0421d92660f commit 7b65e6f377ca0005a986c59f1e31a0421d92660f Author: Bjoern A. Zeeb AuthorDate: 2023-01-28 15:02:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-02-17 23:42:16 +0000 LinuxKPI: pci: add more functions Add a dummy pci_assign_resource() and an implementation of pci_irq_vector() returning the irq for MSI-X, MSI, and legacy interrupt. Both are needed by wirless drivers. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38237 (cherry picked from commit fd1a2f3dfc0e8fb20d0d397d586000bb918aab47) --- sys/compat/linuxkpi/common/include/linux/pci.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 5fdfc3a46d8b..48bdabda9f21 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1706,4 +1706,30 @@ pci_wait_for_pending_transaction(struct pci_dev *pdev) return (0); } +static inline int +pci_assign_resource(struct pci_dev *pdev, int bar) +{ + + return (0); +} + +static inline int +pci_irq_vector(struct pci_dev *pdev, unsigned int vector) +{ + + if (!pdev->msix_enabled && !pdev->msi_enabled) { + if (vector != 0) + return (-EINVAL); + return (pdev->irq); + } + + if (pdev->msix_enabled || pdev->msi_enabled) { + if ((pdev->dev.irq_start + vector) >= pdev->dev.irq_end) + return (-EINVAL); + return (pdev->dev.irq_start + vector); + } + + return (-ENXIO); +} + #endif /* _LINUXKPI_LINUX_PCI_H_ */