From nobody Tue Jan 23 17:45:48 2024 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 4TKDyh5mklz57mnc; Tue, 23 Jan 2024 17:45:48 +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 4TKDyh43nTz46rQ; Tue, 23 Jan 2024 17:45:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706031948; 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=MW7vGQfqJpA1bqy2tjg3YuhBx7dIVlRXsVROjL1FKBU=; b=yVUxlvhZYHBgAJoyWEo/WJKghjr2qG9XBbOv8h1sQFwH1wNLBSWIcoWi07Cd42ekXhRuMG Roy5FCmilD6WTbWkr9ZOh+PnplVGJW6hI5qh0ESrgnyR+pElhNICCxkE8Dud5YM1o5t+wn e9ik031jfcPWlipx2w5vwGLlEV+rr9DFkUBUAtCwA8cfxzRjBK9pvdfZaSXIBpamjwk8a/ US4/LLQcFgxtiUQRJ1tptaxqR1XoumfwtZ93dBzX7Ee7Uk2Xg9ZubylQMVOmK+ijPCp/MQ 6czXCNM2ZNCJt4iSWxX4B0PTUdA7vlsy0ZjOvMcrWjOsYLAFciCn7ZAN1OQEBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706031948; 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=MW7vGQfqJpA1bqy2tjg3YuhBx7dIVlRXsVROjL1FKBU=; b=eEa6w727oB12BPACz6NY+Vc6BSjlXnhNaT64899AfSuvvzBNfSxZskhvPp1rMRhrFk3CTH jVOCpRILZ/cZQe3EzIdYw9ftdeSvKbzg0WKCBAV+3z57v1Id3KeqPbNSt8kGVyU8IFYGnx 3OBQEy6AphypT+BzeqxBNzv9ustZuWO7dN3ebpcFkjOxFBMUlRrFuPxw0FtI2PjdACVz/W TdmuG59wF9TfKzmn6HMVXZK2+U3weIDpWDcZykiSUrQfJ6n0EFFnKYh3U8qJY7mHvmU05M oFxgnZIN+v/zH6VCvtny6miXxOkFtIpIvWqbLM33ABFepmvSHFgK69HgQLUrTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706031948; a=rsa-sha256; cv=none; b=kdtFkWDC2FFAwVQdMASKt1FpSVvj1Feqjnjp2PXk+Un5YstG9bFDXHJ+QFkfc+k2Raipfr Coi1S+cL9yyVQC03iUZud6OFo9bwWJ+yGI8iXMYWYsJB7iUIigjykFk4L429AYGmQHdTPi 5puZjfmswwZCjjM9bXaijDLSYWdpJGoy4Tloa69m8YJqOFWOy7cprbI/lFMSDfjkz5HGsz I7131PfVk8jC1LdM0zXt8tokbG/atLMTevZaisRgBjab7po/bQWN5t8+52gPSkf0043cBa L7nGT5EAtqDN05c3tCvrMJYkogF2HNQEm4D4zSTk3MB16cKG6sjJCZ/frYyIEw== 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 4TKDyh37p8zgNN; Tue, 23 Jan 2024 17:45:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40NHjmlo075516; Tue, 23 Jan 2024 17:45:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40NHjmjC075513; Tue, 23 Jan 2024 17:45:48 GMT (envelope-from git) Date: Tue, 23 Jan 2024 17:45:48 GMT Message-Id: <202401231745.40NHjmjC075513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 23e3b83ab61a - main - pcib: Add helper routines for [de]activating PCI_RES_BUS resources 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/main X-Git-Reftype: branch X-Git-Commit: 23e3b83ab61a440ccce20da7fbf1340d58db361c Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=23e3b83ab61a440ccce20da7fbf1340d58db361c commit 23e3b83ab61a440ccce20da7fbf1340d58db361c Author: John Baldwin AuthorDate: 2024-01-23 17:35:08 +0000 Commit: John Baldwin CommitDate: 2024-01-23 17:35:08 +0000 pcib: Add helper routines for [de]activating PCI_RES_BUS resources Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43427 --- sys/dev/pci/pci_subr.c | 32 ++++++++++++++++++++++++++++++++ sys/dev/pci/pcib_private.h | 4 ++++ 2 files changed, 36 insertions(+) diff --git a/sys/dev/pci/pci_subr.c b/sys/dev/pci/pci_subr.c index 71485875ebe3..d0f6c9500b17 100644 --- a/sys/dev/pci/pci_subr.c +++ b/sys/dev/pci/pci_subr.c @@ -379,6 +379,38 @@ pci_domain_release_bus(int domain, device_t dev, int rid, struct resource *r) #endif return (rman_release_resource(r)); } + +int +pci_domain_activate_bus(int domain, device_t dev, int rid, struct resource *r) +{ +#ifdef INVARIANTS + struct pci_domain *d; +#endif + + if (domain < 0 || domain > PCI_DOMAINMAX) + return (EINVAL); +#ifdef INVARIANTS + d = pci_find_domain(domain); + KASSERT(rman_is_region_manager(r, &d->pd_bus_rman), ("bad resource")); +#endif + return (rman_activate_resource(r)); +} + +int +pci_domain_deactivate_bus(int domain, device_t dev, int rid, struct resource *r) +{ +#ifdef INVARIANTS + struct pci_domain *d; +#endif + + if (domain < 0 || domain > PCI_DOMAINMAX) + return (EINVAL); +#ifdef INVARIANTS + d = pci_find_domain(domain); + KASSERT(rman_is_region_manager(r, &d->pd_bus_rman), ("bad resource")); +#endif + return (rman_deactivate_resource(r)); +} #endif /* PCI_RES_BUS */ #endif /* NEW_PCIB */ diff --git a/sys/dev/pci/pcib_private.h b/sys/dev/pci/pcib_private.h index cf689026a033..d8a354c0e498 100644 --- a/sys/dev/pci/pcib_private.h +++ b/sys/dev/pci/pcib_private.h @@ -160,6 +160,10 @@ int pci_domain_adjust_bus(int domain, device_t dev, struct resource *r, rman_res_t start, rman_res_t end); int pci_domain_release_bus(int domain, device_t dev, int rid, struct resource *r); +int pci_domain_activate_bus(int domain, device_t dev, int rid, + struct resource *r); +int pci_domain_deactivate_bus(int domain, device_t dev, int rid, + struct resource *r); struct resource *pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags);