From owner-freebsd-hackers@freebsd.org Sun Oct 27 22:30:00 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 C7D5B1597BE for ; Sun, 27 Oct 2019 22:30:00 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from mailhost.netlabit.sk (mailhost.netlabit.sk [84.245.65.72]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 471XbW54KQz4Dbm for ; Sun, 27 Oct 2019 22:29:59 +0000 (UTC) (envelope-from freebsd-hackers@dino.sk) Received: from zeta.dino.sk (fw3.dino.sk [84.245.95.254]) (AUTH: LOGIN milan) by mailhost.netlabit.sk with ESMTPA; Sun, 27 Oct 2019 23:29:56 +0100 id 00F406F7.5DB61A64.0000E77D Date: Sun, 27 Oct 2019 23:29:56 +0100 From: Milan Obuch To: Oliver Pinter Cc: freebsd-hackers@freebsd.org Subject: Re: UART driver as kld - how? Message-ID: <20191027232956.28b11772@zeta.dino.sk> In-Reply-To: References: <20191027214209.712d62ca@zeta.dino.sk> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i386-portbld-freebsd11.3) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 471XbW54KQz4Dbm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd-hackers@dino.sk designates 84.245.65.72 as permitted sender) smtp.mailfrom=freebsd-hackers@dino.sk X-Spamd-Result: default: False [-4.24 / 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)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dino.sk]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[72.65.245.84.list.dnswl.org : 127.0.10.0]; IP_SCORE(-2.94)[ip: (-8.23), ipnet: 84.245.64.0/18(-4.12), asn: 16160(-2.42), country: SK(0.08)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:16160, ipnet:84.245.64.0/18, country:SK]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2] 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: Sun, 27 Oct 2019 22:30:00 -0000 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? Regards, Milan