From nobody Thu Nov 23 16:07:59 2023 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 4Sbjgz2LTFz51nGW; Thu, 23 Nov 2023 16:07:59 +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 4Sbjgz1l40z4Q37; Thu, 23 Nov 2023 16:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700755679; 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=2f/qWoJr9HQdYmWOC8Tl3f99RDl5ZhN2RcXdZ3O7Duc=; b=wIb4uj0RMS0b20zD8vDmMoXtYsERntPvKZQHW6NTBlVyF5DQvPwpzkSRmcxIIbYPn5f8oV KO7c6XKlBNCvT83uB6Rrmfx77ALMM8rGILoKh8lPGlTAEVFLZglPYBQBfYn5ftTNnPcwZp gNCcvQ/U6n7O6QErQtZLJ42Tt3LPTHKG48aOOEOaBzoAb0GoOQmNDUDj3FS9bg1r4c/hi+ rmUg0uDIn/DjP+lLT8USr94Ucy9LEj5D0AkbpmrDeiIt62lFhMCsxaZs1cAL2zsCLR4wiK A+2bbP1anS89iBemt/O+En7tF2YVDpPhN1fYEplj6KVV4EdiYZ0n0Ofrnz33sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700755679; 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=2f/qWoJr9HQdYmWOC8Tl3f99RDl5ZhN2RcXdZ3O7Duc=; b=tjPTBMmVCXuNhHcysXbFpXvrVoc93Gqv1yjbj9B6kjegEzNQypv+opKA5NtaHFEkZSQKBm peCytjDaNI8blmqanXgfCHd7NF9CJkVY/J9Bq2t8FmJapRtp/F6W/6+IpirT947qHqtuB5 S2e0mGSF0OylMrNKfK14DBfTG2g/cGFObufFZknromo0bz9yroOqZNVElpy2KLLHgVw+xB /c+DYSWrcmiPgsrSydoRtCfsQbIljhLFYuBcazmhW1g29BGW1sM6tvSSVIuqRAfHx6DxZm HVhJr61RUK1PQ7CqapowqcpMXHhUKWd+KugFWyeQl8YQ2lwy+5hzOUjHve/3ww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700755679; a=rsa-sha256; cv=none; b=Cn8PDN9KsvaT6zXWWGwJA9rdTWT0gqmk/uDG2ifTbKkPinVwCetiFTGKjADpFSLVVOiW// bL09ZQk8mElegiF9FsQpPZFa1aWzm+rxQwizfAS0HqMoQL4H825E3uzm+7mo4+j5ilthU1 OQEBHU81fOlSNQKEgjIsE6nZ2yhHaUr9npIDwoQgK7flgI9yWFk8Reksv4L8duS01tCZlq EcoOFf9TW4bsDj+Khe+WE7v+g8oDlCFyY6KIdctxOP/s2hiDwZrjrjGr9K0fBetn/F/sGA 1//jLYfF8yVtMiDt6fTgQ6lv25wL6pI3Hru9kwRrOLz3dorAv9t2dRW2qf8V+g== 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 4Sbjgz0qxYz17HG; Thu, 23 Nov 2023 16:07:59 +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 3ANG7xIg007477; Thu, 23 Nov 2023 16:07:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ANG7x8w007474; Thu, 23 Nov 2023 16:07:59 GMT (envelope-from git) Date: Thu, 23 Nov 2023 16:07:59 GMT Message-Id: <202311231607.3ANG7x8w007474@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 41e26e8288f1 - main - powerpc: better handling of shutdown flags List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 41e26e8288f1743c8584e5f9c461d36dce1cccc6 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=41e26e8288f1743c8584e5f9c461d36dce1cccc6 commit 41e26e8288f1743c8584e5f9c461d36dce1cccc6 Author: Mitchell Horne AuthorDate: 2023-11-23 15:25:05 +0000 Commit: Mitchell Horne CommitDate: 2023-11-23 16:07:42 +0000 powerpc: better handling of shutdown flags RB_HALT does not mean poweroff, RB_POWEROFF does. Reviewed by: jhibbits MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42339 --- sys/powerpc/powermac/cuda.c | 8 +++++++- sys/powerpc/powermac/pmu.c | 6 ++++-- sys/powerpc/powermac/smu.c | 6 ++++-- sys/powerpc/powernv/opal_dev.c | 6 ++++-- sys/powerpc/pseries/rtas_dev.c | 4 ++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/sys/powerpc/powermac/cuda.c b/sys/powerpc/powermac/cuda.c index 974ad585b543..97f60f269559 100644 --- a/sys/powerpc/powermac/cuda.c +++ b/sys/powerpc/powermac/cuda.c @@ -748,7 +748,13 @@ cuda_shutdown(void *xsc, int howto) struct cuda_softc *sc = xsc; uint8_t cmd[] = {CUDA_PSEUDO, 0}; - cmd[1] = (howto & RB_HALT) ? CMD_POWEROFF : CMD_RESET; + if ((howto & RB_POWEROFF) != 0) + cmd[1] = CMD_POWEROFF; + else if ((howto & RB_HALT) == 0) + cmd[1] = CMD_RESET; + else + return; + cuda_poll(sc->sc_dev); cuda_send(sc, 1, 2, cmd); diff --git a/sys/powerpc/powermac/pmu.c b/sys/powerpc/powermac/pmu.c index 67ef57bf6be8..f9d9d4d40c72 100644 --- a/sys/powerpc/powermac/pmu.c +++ b/sys/powerpc/powermac/pmu.c @@ -812,10 +812,12 @@ pmu_shutdown(void *xsc, int howto) struct pmu_softc *sc = xsc; uint8_t cmd[] = {'M', 'A', 'T', 'T'}; - if (howto & RB_HALT) + if ((howto & RB_POWEROFF) != 0) pmu_send(sc, PMU_POWER_OFF, 4, cmd, 0, NULL); - else + else if ((howto & RB_HALT) == 0) pmu_send(sc, PMU_RESET_CPU, 0, NULL, 0, NULL); + else + return; for (;;); } diff --git a/sys/powerpc/powermac/smu.c b/sys/powerpc/powermac/smu.c index 5aed7b87d3c2..af00599e6b54 100644 --- a/sys/powerpc/powermac/smu.c +++ b/sys/powerpc/powermac/smu.c @@ -1317,10 +1317,12 @@ smu_shutdown(void *xdev, int howto) struct smu_cmd cmd; cmd.cmd = SMU_POWER; - if (howto & RB_HALT) + if ((howto & RB_POWEROFF) != 0) strcpy(cmd.data, "SHUTDOWN"); - else + else if ((howto & RB_HALT) == 0) strcpy(cmd.data, "RESTART"); + else + return; cmd.len = strlen(cmd.data); diff --git a/sys/powerpc/powernv/opal_dev.c b/sys/powerpc/powernv/opal_dev.c index edb8f6d435ad..ab1a1fbb731c 100644 --- a/sys/powerpc/powernv/opal_dev.c +++ b/sys/powerpc/powernv/opal_dev.c @@ -344,10 +344,12 @@ static void opal_shutdown(void *arg, int howto) { - if (howto & RB_HALT) + if ((howto & RB_POWEROFF) != 0) opal_call(OPAL_CEC_POWER_DOWN, 0 /* Normal power off */); - else + else if ((howto & RB_HALT) == 0) opal_call(OPAL_CEC_REBOOT); + else + return; opal_call(OPAL_RETURN_CPU); } diff --git a/sys/powerpc/pseries/rtas_dev.c b/sys/powerpc/pseries/rtas_dev.c index ef9522f5495d..f8198ef27417 100644 --- a/sys/powerpc/pseries/rtas_dev.c +++ b/sys/powerpc/pseries/rtas_dev.c @@ -155,13 +155,13 @@ rtas_shutdown(void *arg, int howto) { cell_t token, status; - if (howto & RB_HALT) { + if ((howto & RB_POWEROFF) != 0) { token = rtas_token_lookup("power-off"); if (token == -1) return; rtas_call_method(token, 2, 1, 0, 0, &status); - } else { + } else if ((howto & RB_HALT) == 0) { token = rtas_token_lookup("system-reboot"); if (token == -1) return;