From nobody Wed Jan 03 22:02:44 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 4T53cN5gvtz56nqK; Wed, 3 Jan 2024 22:02:44 +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 4T53cN42NNz4YT5; Wed, 3 Jan 2024 22:02:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704319364; 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=nQEax8zVElTc6tSJAqdTOIOhZHhc1c286f0eIEgURwE=; b=xxyJvRXKqFRTYMyMNvoEzuDRF9rsf7WbRVMuxG0z7MrJEVqAAqeW3FifyvLuQkvE7AUVNb EUmaPbwIECiSvKIUTDD0xDroUi7lZgSpJX+rjaMQx/S18JRKjrtk/F0efrJa3PGcreXmep Ptc5Uw+O/hTvld78+xkHD/PaqEHlfBJwGk3l4PnpJVyX/76R5DCRyZNd9JwRtLOAp3dPaT 8k29iKLZGDlUpl/jiiyVWHdOv9LazhQwS0ukvpZEaRFLBAc0sXKn0WWBa66nw5cAQigmM6 MZEQJLqsq+D2Mr5/JAzGJsh9s0214D1dDquvlclksK1pucJwIsf5Qbg8yAMuag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704319364; 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=nQEax8zVElTc6tSJAqdTOIOhZHhc1c286f0eIEgURwE=; b=Ego9SrH9whylWv1E21PA6U95Bkd+zjCLWCo7XBae5Afcj5kis1/whHj01GbG5wHqsSMDXM b3omJDn5fltAn90CloWPxTPizoY3Ea3Om/lviKp0XrP4DlnrNSpQSSr488Q9/IItNoFsM1 m8c657TxSKmXL+KJDv2R9JzgL5Sne6YlzJPokbm0vpyPHlcXc+BsC8Xyx4x+urbMoPQzJW uNdRaycPB4MX/wBc1F8ajBQ3a6pc8XvvbqCVXzyLfQqdRCxBzWXVzp8kr0sVnF6+ydSkOv Gm+aNB1xYWKfn555y3gMUBfRGuQe9RRyo30wHqBOgE8WsYEh0fSY0vMHzQBNng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704319364; a=rsa-sha256; cv=none; b=VgAzkTb8RAIdLT/MjWjClTfpbxLWhoei19Bhw1QX4sm0WdyO5yJvz9ISMPIC9OuZxzZaV/ R5WdJog+4X+/klDg1Q3pKdvZXskiiziXcLNXrYDl7nfl1K/QBeolQl2ZU53bZfxJinaRqY kkARQLETVbb+P6VfFJKt5gtfrQH5YxtMG3e2QqBCeKeq17HafaFjcrpQBbQx2j1sJ6JSei mx4G7a0xSlWA2CAfmaSX3GxsBsUxEsv7EvBe5Suq5des+U5Y3op09eNyEMSYSM50jvvoqG /UiehD7tYa27ZjO4hYizO9MqF89j3VOSVqtamvTsTM8IKAFJoixLMdoRTuvp+Q== 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 4T53cN32FSz12qm; Wed, 3 Jan 2024 22:02:44 +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 403M2iMa072584; Wed, 3 Jan 2024 22:02:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 403M2ifQ072581; Wed, 3 Jan 2024 22:02:44 GMT (envelope-from git) Date: Wed, 3 Jan 2024 22:02:44 GMT Message-Id: <202401032202.403M2ifQ072581@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: 0c7aa9afb163 - stable/14 - new-bus: Add comments for resource_*_map_request* 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/14 X-Git-Reftype: branch X-Git-Commit: 0c7aa9afb1633f1fc068dc043732c18e18facb2a Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0c7aa9afb1633f1fc068dc043732c18e18facb2a commit 0c7aa9afb1633f1fc068dc043732c18e18facb2a Author: John Baldwin AuthorDate: 2023-11-24 18:33:57 +0000 Commit: John Baldwin CommitDate: 2024-01-03 20:47:18 +0000 new-bus: Add comments for resource_*_map_request* Requested by: mhorne (cherry picked from commit 46971d38de334a9418e2b66b37cea7d051b6731a) --- sys/kern/subr_bus.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 4c44c264a5c0..4d21382f2de7 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2707,6 +2707,15 @@ device_set_unit(device_t dev, int unit) * Some useful method implementations to make life easier for bus drivers. */ +/** + * @brief Initialize a resource mapping request + * + * This is the internal implementation of the public API + * resource_init_map_request. Callers may be using a different layout + * of struct resource_map_request than the kernel, so callers pass in + * the size of the structure they are using to identify the structure + * layout. + */ void resource_init_map_request_impl(struct resource_map_request *args, size_t sz) { @@ -2715,6 +2724,18 @@ resource_init_map_request_impl(struct resource_map_request *args, size_t sz) args->memattr = VM_MEMATTR_DEVICE; } +/** + * @brief Validate a resource mapping request + * + * Translate a device driver's mapping request (@p in) to a struct + * resource_map_request using the current structure layout (@p out). + * In addition, validate the offset and length from the mapping + * request against the bounds of the resource @p r. If the offset or + * length are invalid, fail with EINVAL. If the offset and length are + * valid, the absolute starting address of the requested mapping is + * returned in @p startp and the length of the requested mapping is + * returned in @p lengthp. + */ int resource_validate_map_request(struct resource *r, struct resource_map_request *in, struct resource_map_request *out,