From owner-freebsd-hackers@freebsd.org Mon Nov 4 15:43:21 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 029141A66E2 for ; Mon, 4 Nov 2019 15:43:21 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 476HBc4B2Bz3NXj for ; Mon, 4 Nov 2019 15:43:20 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572882198; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=Ll/AjyQ5GXLf3ideCqDRSHqprzkMRbsQ8LndfQddRNgeGWyRC4RKQ7yJhg6WM/jpGq+JHI6WZTTXA c6c386ALfsOpLGnPVtwIeVsncS1sX1pPsaRW3B67bmBjnNev6TWe0OveYS/tzrW4SxJvQoISnE0kO4 2cxGo/DEY5liJwH+JzRHgmIOiHo+Z6fpg3Ae6dxdVKyH2I8k/c6YMn/k0Mc0NU8YwWH9MoG0Mq9MQm NlipYGTYXa496iIXgmVyodw8CcNnNmheHrGfApRAwAT/QZJb5XPtDywFEElJCqx6gr2ZXKHu7/6y4e yVyG150WqF06gl5N9ZPF21Cjyfjxs4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=tWDrZ9Fm1fwL1eea3iPrJEXrvUNJa2X39uXqdpOod/Y=; b=vluOuBomKNJe5TqvbhVnCNQmQRdynH2pdNh17tapTm+GJMz5fyvBqAW3+J/q+o2WzFZB/InPZvY6l Ruzb1xhEeOvnCX0v+WaHg2LNPqWb9eYZR5t1Qc7xGWBe67Mywi2MHiqDEHIDy6Sq9MhuJ/MBN5u6JQ JLsbWxmAhfYKT3YLws/6JR+bfbQkR12GEs/YM0KK62W/1inhcnmAIzmjuiLMhd1FtSOFKTIBhuIJSA +PQ6jj6FTp8xspFW9TTUz2bv6dAwuUuzOIRhelfqtlpr/A/kODWYis08vqhRX+wR90fB7eFeCIdi1X JFkpFxOCbBgI5HiKq8ykVmsU7fOFPeg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=tWDrZ9Fm1fwL1eea3iPrJEXrvUNJa2X39uXqdpOod/Y=; b=JVPnoTWFIg0/2g/E41vCde+QTFuWMamDHY1hfSko/+5wh0tXi8qIgcf6kNU8xh97PXZXJr0tIYIsS t9zpOaU9Xr+BIW5BrERyVRM7fYANqEYSw5VOr00MAumNboMEw2VyititZuKogZq37RlryVMjS80jpU h4FmzGSYpZyl/ptwyXIvjM2HzPHxTJWmdF685vVapu/V+KNGpsEzDQQJhH+93rehyE0C7nBcmYzQnE yTY/OX+IeIA01uZUGfIlufOVoKfDirOQp3U4lYSWgLLyIq6CxL97GOEG1eKJ4EogWQJVPM1k1b2J8A kyqB1BksRCl9ssEUWmE6gWcBEW1oiwg== X-MHO-RoutePath: aGlwcGll X-MHO-User: d089d54b-ff19-11e9-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id d089d54b-ff19-11e9-829e-79a40d15cccd; Mon, 04 Nov 2019 15:43:17 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xA4FhEvc088411; Mon, 4 Nov 2019 08:43:14 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: UART driver as kld - how? From: Ian Lepore To: Warner Losh , Milan Obuch Cc: "freebsd-hackers@freebsd.org" Date: Mon, 04 Nov 2019 08:43:14 -0700 In-Reply-To: References: <20191027214209.712d62ca@zeta.dino.sk> <20191027232956.28b11772@zeta.dino.sk> <20191028191005.GA89835@bluezbox.com> <20191028201952.20a92307@zeta.dino.sk> <20191102214100.500ba493@zeta.dino.sk> <20191103042321.GA49790@bluezbox.com> <20191103130118.36fa6eec@zeta.dino.sk> <20191104122816.63647120@zeta.dino.sk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 476HBc4B2Bz3NXj X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.99 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] 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, 04 Nov 2019 15:43:21 -0000 On Mon, 2019-11-04 at 08:32 -0700, Warner Losh wrote: > On Mon, Nov 4, 2019 at 4:35 AM Milan Obuch wrote: > > > On Sun, 3 Nov 2019 13:01:18 +0100 > > Milan Obuch wrote: > > > > > On Sat, 2 Nov 2019 21:23:21 -0700 > > > Oleksandr Tymoshenko wrote: > > > > > > > Milan Obuch (freebsd-hackers@dino.sk) wrote: > > > > [...] > > > Back to testing... probe function now does work, so I am going to > > > analyze what should be done in attach... and why I am getting now > > > panic... I'll write again when I find another obstacle I do not > > > understand or I have working driver, whatever comes first :) > > > > > > > Now I am getting further... attach works now, device nodes expected are > > being created, but there are some warnings mentioning locks on detach. > > Also, my hardware design currently does not use interrupts. Do we have > > any example of uart device being polled? > > > > All UARTS have interrupts. It's the nature of UARTS. At least that's the > nature of the model that uart(4) uses: there's a number of conditions that > we notice from time to time and make a note in the ipend mask so that we > can call uart specific code later to deal with that condition. Your system > may not connect those uart signals to a system interrupt, but the internal > model is the same. > > I'd just use callouts to poll. Then call what would be the interrupt > routines from there. Since we have a separation between noting a condition > and processing it, that should work well. However, I'd also expect issues > at higher data rates unless you have very deep FIFOs and some kind of > hardware-assist for flow control. > Polling support is built into uart(4) already. Just set debug.uart_force_poll=1 in loader.conf or via sysctl. You can also set debug.uart_poll_freq (default is 50hz). -- Ian