From nobody Fri Oct 09 22:07:29 2026 X-Original-To: dev-commits-src-main@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 4j1gvj4JHNz6w8pm for ; Fri, 09 Oct 2026 22:07:29 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j1gvj3ZZlz4NH0 for ; Fri, 09 Oct 2026 22:07:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791583649; 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=+9blwSyi+mVScdpA6lYrRNZbhiy7onI5TDl0qCwQoNc=; b=ryc/iTDXW8ZE5rEZcxJCoqjiJhNBNfhLfPLl2x9lpFM+ng7EIifQdZifjGhxdmv3oZI+kb ojXuAqdCEYUpCVz2Sc/aJQq89ToikMC6OcyBsEP62G+ou8QorDN/qIi7dnKAsEKw4UzoNB evqIKFgLh/ePqpFbNNPEiWVXZbVS/JLeyU7GncEKFSX3c81yI/lweqEaCgG7bnRO14AkXZ oWmKKEsbZ5mdUDfMAC2pfKMXRHjt7toaVfe6BIeX5+V7Rwmd7okRFpWI02EBK5oTEJ9w3n 7Ab+YaiLdez7xWE34JG75UhG4QGgtOndz0dy4VUwrk+GjBQ+vpyP/ss0mZp2aA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791583649; b=N8job/Za3mKSXIU/CVs4SWY+XUjtlwtfR6V/cq7TeX/PbLLKGQEIL0cMb6f7OAw24BcRhI 2Bx7TtRu/aw/grxIN1h0yl5saUmn+NQnPoOV/NL54za02+VSjuaf5mzV3BDXVIdlpYiTrG mUw95rBdOa1QVimE+AuSPos4ETaU00p/GAs2sZu5j+ILCbrtX2EPqCPhXVf8xb5LMxwYfn KzgkTSPcIaqxwJjX6UBOmplOt3LGM12Dzrlwvji4HmzyCoc4NErE7kTgxJqihnPUgD4ORh UE1QKTQ7X9Ox52WBt8oyWVNeamFjWmHHw1uWWgeMVnuCs1me/6httD3q/4JpKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791583649; 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=+9blwSyi+mVScdpA6lYrRNZbhiy7onI5TDl0qCwQoNc=; b=j9FdO0et7t0bBOSJHdCFbpbRMgikzPL6qlp+gWJVa9h/iWVxqYCL6PFo1KJWoPBctLH9lB VIFRgDKHe7h7sTrad65M77R+CL29d7vLQX3hAC5NMe379BgI9ls/Rr1YiazPVNq1bi+u1H QvoHtRUfQ9kuBsgVvYrvesPm9cT5cMLsQmtLTW73+xNU7hwmGGSq6zoarA/NJ2opZbJDu+ SDaviVRb7Zw13w6hziLnRF6djS5pmQgWc4dPrraqWcoaVSUikBpg/a7I8IhSpJniB4j/g9 cg4wz/F3v752d1gbPn77sxe7lBTL5xPzz/IjZk93EEPFyZa4k678hMyTW6PGOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j1gvj2LsrzSZ5 for ; Fri, 09 Oct 2026 22:07:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f62b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 09 Oct 2026 22:07:29 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Aymeric Wibo Subject: git: 16d92e92ca12 - main - amdgpio: Suspend routine List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16d92e92ca12c9772d921346c34f1ef87998c662 Auto-Submitted: auto-generated Date: Fri, 09 Oct 2026 22:07:29 +0000 Message-Id: <6ac965a1.3f62b.7b0396b2@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=16d92e92ca12c9772d921346c34f1ef87998c662 commit 16d92e92ca12c9772d921346c34f1ef87998c662 Author: Aymeric Wibo AuthorDate: 2026-02-25 09:28:20 +0000 Commit: Aymeric Wibo CommitDate: 2026-10-09 22:07:02 +0000 amdgpio: Suspend routine Mask all interrupts when suspending and warn when there are unserviced interrupts which might block entry to S0i3. In the future we won't want to mask wake interrupts. Once we can actually make use of GPIO interrupts on x86, we'll also want to unmask relevant pins when resuming. Reviewed by: aokblast, avg Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51589 --- sys/dev/amdgpio/amdgpio.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/sys/dev/amdgpio/amdgpio.c b/sys/dev/amdgpio/amdgpio.c index 20589ff71b0b..5cfddfaa338e 100644 --- a/sys/dev/amdgpio/amdgpio.c +++ b/sys/dev/amdgpio/amdgpio.c @@ -536,11 +536,59 @@ amdgpio_detach(device_t dev) return (0); } +static int +amdgpio_suspend(device_t dev) +{ + struct amdgpio_softc *sc = device_get_softc(dev); + uint32_t reg; + size_t i; + int pin, off; + + AMDGPIO_LOCK(sc); + + for (i = 0; i < AMD_GPIO_PINS_EXPOSED; i++) { + pin = kernzp_pins[i].pin_num; + off = AMDGPIO_PIN_REGISTER(pin); + + reg = amdgpio_read_4(sc, off); + if ((reg & UNSERVICED_INTERRUPT_MASK) != 0) + device_printf(dev, "unserviced interrupt on pin %d!\n", + pin); + /* + * "Service" interrupt and mask. In the future we should only + * mask non-wake interrupts (see WAKE_CNTRL_OFF_S0I3 &c). + * + * (From BKDG) write 1 to interrupt & wake status registers to + * clear them. We can do this by just writing back to them. + */ + reg &= ~(1 << INTERRUPT_MASK_OFF); + reg &= ~(1 << INTERRUPT_ENABLE_OFF); + amdgpio_write_4(sc, off, reg); + } + + amdgpio_eoi_locked(sc); + AMDGPIO_UNLOCK(sc); + + return (0); +} + +static int +amdgpio_resume(device_t dev) +{ + /* + * XXX Will have to resume properly once we're actually able to use + * amdgpio for interrupts. + */ + return (0); +} + static device_method_t amdgpio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, amdgpio_probe), DEVMETHOD(device_attach, amdgpio_attach), DEVMETHOD(device_detach, amdgpio_detach), + DEVMETHOD(device_suspend, amdgpio_suspend), + DEVMETHOD(device_resume, amdgpio_resume), /* GPIO protocol */ DEVMETHOD(gpio_get_bus, amdgpio_get_bus),