From owner-freebsd-hackers@freebsd.org Mon Oct 28 13:42:34 2019 Return-Path: Delivered-To: freebsd-hackers@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 E26BC1A3456 for ; Mon, 28 Oct 2019 13:42:34 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 471wrT6nqnz3yd8; Mon, 28 Oct 2019 13:42:33 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id P5HwivNtBUIS2P5HyitOSW; Mon, 28 Oct 2019 07:42:31 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=xqWC_Br6kY4A:10 a=XobE76Q3jBoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=XzyQun5W9-DtYkMxlXgA:9 a=QEXdDO2ut3YA:10 a=Fw41rLh8eLjZiEonq94A:9 a=vVFPoflkoZ-V0Vno:21 a=_W_S_7VecoQA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from [IPv6:2605:8d80:406:1c1b:cf0:5985:232f:3e87] (unknown [72.143.223.11]) by spqr.komquats.com (Postfix) with ESMTPSA id 716E388AB; Mon, 28 Oct 2019 06:42:27 -0700 (PDT) Date: Mon, 28 Oct 2019 06:41:57 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Subject: Re: How to prevent underclocking when running with 1 redundant power supply To: freebsd-hackers@freebsd.org, Craig Leres , FreeBSD Hackers From: Cy Schubert Message-ID: X-CMAE-Envelope: MS4wfK62L4UnxIQ4UhO+9wGsIKrhIDpdoSpWKC1XR92O23qQZDQ15+g3sQDiBoKcxqsChUy5t/Xt9jpo9JuY8t5dA8srBhLPjTVTOtx/FP4owhHgz4tMsfBn sS3dz9fpZZfg45ntQTpWq5p1HEF09DocnQ3FbEfkRCGaEdHM1hCvIj66ojbbxG/1ti5z4I++HtkEFJMNh6fVYqzwZSPBfddkWTmetGfxQPR20fE9QRUb0eg4 X-Rspamd-Queue-Id: 471wrT6nqnz3yd8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.13) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-4.49 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.39)[ip: (-6.47), ipnet: 64.59.128.0/20(-3.04), asn: 6327(-2.35), country: CA(-0.09)]; RCVD_IN_DNSWL_NONE(0.00)[13.134.59.64.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 13:42:34 -0000 On October 27, 2019 2:07:12 PM PDT, Craig Leres wrote= : >I have a nameserver running 11=2E3-RELEASE-p4=2E It has a Supermicro >X9SRi-F=20 >motherboard in a 1U chassis with redundant PWS-406P-1R power supplies=20 >(400W each)=2E > >Site power is out thanks to a PG&E "public safety power shutdown" and I > >find that the system is really unhappy=2E It looks like it is=20 >underclocking due to one power supply not being powered: > > # sysctl dev=2Ecpu=2E0=2Efreq_levels dev=2Ecpu=2E0=2Efreq > dev=2Ecpu=2E0=2Efreq_levels: 3001/80000 3000/80000 2900/75926 2700/69= 558=20 >2600/65698 2500/62669 2400/59709 2200/53206 2100/50412 2000/46962=20 >1800/41676 1700/38423 1600/35918 1500/33467 1300/28074 1200/25787 > dev=2Ecpu=2E0=2Efreq: 1200 > >I found powerd and tried this: > > powerd_enable=3D"YES" > powerd_flags=3D"-a max -b max -n max" > >which works=2E=2E=2E once it's started=2E Now I'm finding one system has = a=20 >difficult time booting because powerd is started so late in the boot=20 >process=2E > >Is there a sysctl I can put in loader=2Econf to disable this >underclocking=20 >behavior? > >Thanks! > > Craig >_______________________________________________ >freebsd-hackers@freebsd=2Eorg mailing list >https://lists=2Efreebsd=2Eorg/mailman/listinfo/freebsd-hackers >To unsubscribe, send any mail to >"freebsd-hackers-unsubscribe@freebsd=2Eorg" dev=2Ecpu=2E0=2Efreq can be set by hand (or script)=2E I suppose your BIOS automatically reduces the clock rate with one power su= pply connected=2E I assume that's a safety feature one might want to invest= igate before incurring possible undesired consequences=2E=20 --=20 Pardon the typos and autocorrect, small keyboard in use=2E=20 Cy Schubert FreeBSD UNIX: Web: https://www=2EFreeBSD=2Eorg The need of the many outweighs the greed of the few=2E Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E From owner-freebsd-hackers@freebsd.org Mon Oct 28 19:10:16 2019 Return-Path: Delivered-To: freebsd-hackers@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 611F615A861 for ; Mon, 28 Oct 2019 19:10:16 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47246b0cWnz4P2C for ; Mon, 28 Oct 2019 19:10:14 +0000 (UTC) (envelope-from gonzo@bluezbox.com) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92 (FreeBSD)) (envelope-from ) id 1iPAP0-000NPD-V6; Mon, 28 Oct 2019 12:10:08 -0700 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id x9SJA50F089969; Mon, 28 Oct 2019 12:10:05 -0700 (PDT) (envelope-from gonzo@bluezbox.com) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@bluezbox.com using -f Date: Mon, 28 Oct 2019 12:10:05 -0700 From: Oleksandr Tymoshenko To: Milan Obuch Cc: Oliver Pinter , freebsd-hackers@freebsd.org Subject: Re: UART driver as kld - how? Message-ID: <20191028191005.GA89835@bluezbox.com> References: <20191027214209.712d62ca@zeta.dino.sk> <20191027232956.28b11772@zeta.dino.sk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191027232956.28b11772@zeta.dino.sk> X-Operating-System: FreeBSD/11.2-RELEASE-p10 (amd64) User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Milan Obuch (freebsd-hackers@dino.sk) wrote: > On Sun, 27 Oct 2019 22:52:10 +0100 > Oliver Pinter wrote: > > > On Sunday, October 27, 2019, Milan Obuch List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 19:10:16 -0000 Milan Obuch (freebsd-hackers@dino.sk) wrote: > On Sun, 27 Oct 2019 22:52:10 +0100 > Oliver Pinter wrote: > > > On Sunday, October 27, 2019, Milan Obuch > > wrote: > > > > > Hi, > > > > > > I am trying to create a driver for Xilinx' AXI UART Lite IP core. I > > > can't find a way to do it as kld module. I started with > > > uart_dev_cdnc.c, but I can't see how it is hooked into the kernel - > > > or, better formulated, how can I created kld loadable module. As > > > Zynq has uart_dev_cdnc driver for its PS UART, all necessary files > > > are compiled into kernel, but how can I extend those modules tables > > > to work with new driver too? > > > > > > You can ask why I want it this way, if I can put this into kernel... > > > simply this would make development awkward - every change would mean > > > recompile everything (or at least relinking kernel) and reboot. With > > > kld, I can just rebuild the module, reinstall it, unload old/load > > > new version and test. Other thing is, for any IP core I must first > > > load hw design into PL part (FPGA bitstream, actually), there is > > > simply no device without this step performed. > > > > > > Did anybody already create something similar? Any help/hint/pointer > > > appreciated... > > > > > > https://github.com/freebsd/freebsd/tree/master/share/examples/kld > > > > Hi, > > my problem is somewhere else - I am able to build kld, load and unload > it, but in all uart_dev_xxxx.c files I saw there are no attach and > detach function, so there must be something more to do. On the other > side, uart_core.o is already present in kernel, but how should I make > it work with newly loaded module? uart_bus_fdt.o is linked in kernel > too, and there are attach and detach function, but how can my tables be > added in list for it? >From what I see in source code, UART drivers with FDT support are tied to the UART subsystem using UART_FDT_CLASS_AND_DEVICE macro, that adds compat data (list of compatible strings for the driver with pointer to respective uart_class instance) to uart_fdt_class_and_device_set dataset. This dataset is then traversed by uart_fdt_find_device in uart_fdt_probe function. You need: - Add FDT node to device tree, with unique compatible property value and "status" property set to "okay" - In you driver do something like: static struct ofw_compat_data compat_data[] = { {"xlnx,axilite", (uintptr_t)&uart_axilite_class}, {NULL, (uintptr_t)NULL}, }; UART_FDT_CLASS_AND_DEVICE(compat_data); xlnx,axilite in this case is just something I've just made up, you need to get the value from the vendor's DTS bindings documentation. -- gonzo