From owner-svn-src-all@freebsd.org Mon Apr 27 23:43:04 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D74C2CA722; Mon, 27 Apr 2020 23:43:04 +0000 (UTC) (envelope-from imp@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1YN3hpsz3PCX; Mon, 27 Apr 2020 23:43:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A2181AD82; Mon, 27 Apr 2020 23:43:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RNh4a5075561; Mon, 27 Apr 2020 23:43:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNh425075560; Mon, 27 Apr 2020 23:43:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004272343.03RNh425075560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 27 Apr 2020 23:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360410 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 360410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:43:04 -0000 Author: imp Date: Mon Apr 27 23:43:04 2020 New Revision: 360410 URL: https://svnweb.freebsd.org/changeset/base/360410 Log: Add flags sysctl to ada Report the ada device flags like we do the da devices. No booleans have (yet) been converted, but iomapped and rotating are planned. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon Apr 27 23:39:32 2020 (r360409) +++ head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:04 2020 (r360410) @@ -111,6 +111,31 @@ typedef enum { ADA_FLAG_CAN_NCQ_TRIM = 0x00400000, /* CAN_TRIM also set */ ADA_FLAG_PIM_ATA_EXT = 0x00800000 } ada_flags; +#define ADA_FLAG_STRING \ + "\020" \ + "\002CAN_48BIT" \ + "\003CAN_FLUSHCACHE" \ + "\004CAN_NCQ" \ + "\005CAN_DMA" \ + "\006NEED_OTAG" \ + "\007WAS_OTAG" \ + "\010CAN_TRIM" \ + "\011OPEN" \ + "\012SCTX_INIT" \ + "\013CAN_CFA" \ + "\014CAN_POWERMGT" \ + "\015CAN_DMA48" \ + "\016CAN_LOG" \ + "\017CAN_IDLOG" \ + "\020CAN_SUPCAP" \ + "\021CAN_ZONE" \ + "\022CAN_WCACHE" \ + "\023CAN_RAHEAD" \ + "\024PROBED" \ + "\025ANNOUNCED" \ + "\026DIRTY" \ + "\027CAN_NCQ_TRIM" \ + "\030PIM_ATA_EXT" typedef enum { ADA_Q_NONE = 0x00, @@ -806,8 +831,9 @@ static periph_oninv_t adaoninvalidate; static periph_dtor_t adacleanup; static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); -static int adazonemodesysctl(SYSCTL_HANDLER_ARGS); +static int adaflagssysctl(SYSCTL_HANDLER_ARGS); static int adazonesupsysctl(SYSCTL_HANDLER_ARGS); +static int adazonesupsysctl(SYSCTL_HANDLER_ARGS); static void adasysctlinit(void *context, int pending); static int adagetattr(struct bio *bp); static void adasetflags(struct ada_softc *softc, @@ -1518,6 +1544,10 @@ adasysctlinit(void *context, int pending) SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "max_seq_zones", CTLFLAG_RD, &softc->max_seq_zones, "Maximum Number of Open Sequential Write Required Zones"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + softc, 0, adaflagssysctl, "A", + "Flags for drive"); #ifdef CAM_TEST_FAILURE /* @@ -1624,6 +1654,24 @@ adadeletemethodsysctl(SYSCTL_HANDLER_ARGS) return (0); } return (EINVAL); +} + +static int +adaflagssysctl(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sbuf; + struct ada_softc *softc = arg1; + int error; + + sbuf_new_for_sysctl(&sbuf, NULL, 0, req); + if (softc->flags != 0) + sbuf_printf(&sbuf, "0x%b", (unsigned)softc->flags, ADA_FLAG_STRING); + else + sbuf_printf(&sbuf, "0"); + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + + return (error); } static void