From owner-freebsd-drivers@FreeBSD.ORG Mon Mar 9 17:24:21 2015 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B625BB40 for ; Mon, 9 Mar 2015 17:24:21 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (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 8E9AAA90 for ; Mon, 9 Mar 2015 17:24:21 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7FA6EB953; Mon, 9 Mar 2015 13:24:20 -0400 (EDT) From: John Baldwin To: freebsd-drivers@freebsd.org Subject: Re: load a driver during autoconfiguration Date: Mon, 09 Mar 2015 12:01:43 -0400 Message-ID: <5070289.9Ox4kP5ZdP@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Mar 2015 13:24:20 -0400 (EDT) Cc: =?ISO-8859-1?Q?Mat=EDas?= Perret Cantoni X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2015 17:24:21 -0000 On Friday, March 06, 2015 04:15:22 PM Mat=EDas Perret Cantoni wrote: > Hello! >=20 > I just wrote a simple newbus driver that works just fine when I load = it > manually with kldload(8). >=20 > Now I'd like the system to load it automatically at boot time. I've a= lready > added the corresponding node on the dts file. >=20 > So my questions are: >=20 > Can I just place the driver under some directory so that the system c= an > probe it during auto-configuration? >=20 > Or do I need to re-compile the whole kernel for this? In that case wh= ere > should I place my sources before compiling? One option is to always load the driver using an entry in loader.conf o= r in=20 the kld_list variable in /etc/rc.conf. Another option to do on-demand = loading=20 is to write a custom devd handler. You can find some examples in=20 /etc/devd/usb.conf (note that that file is auto-generated). I'm not su= re what=20 is output for a nomatch entry for an fdt bus. For devices that appear = at=20 runtime you can run 'cat /var/run/devd.pipe' in a window to see event d= etails=20 to use to write your match rule. However, for boot time events I think= you=20 will need to resort to looking at the code to decipher what variables a= re=20 passed that you want to match on. --=20 John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Mon Mar 9 18:03:25 2015 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6CD91841 for ; Mon, 9 Mar 2015 18:03:25 +0000 (UTC) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 387FFF48 for ; Mon, 9 Mar 2015 18:03:24 +0000 (UTC) Received: by pabli10 with SMTP id li10so74420101pab.13 for ; Mon, 09 Mar 2015 11:03:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=sp5K5x+DpJPpj5LQzdGbrAgWXLPzEbBeWKy6eRAyjus=; b=VEbhIBc1u557e7rjdlyZMg7Crg+V9ndAkhX8XqtGNVhcOSNiEepTK14hulFS0pzAV6 2vfgNgxSslzMFo5T6ByIxRti8AzNKt5/Teb++blkPOBmZh6SPL9QsrOBO55xohlBKWBV KI9Ljq/0bqHpXi7U4wm9Mgammhp8Q6WddAbFe9mheZXZToNu/Omd01ozMvDmJSVZxuJK fup6PayrKSnk2FUoiR0kU+ptG3WvoWvvRzL2NTcscFwygvoGia5Qsd+8d1Z5GulFNfBn 9qgFGf+50JZNNGiqdzMgAM3Ng1lqFsVFeWj7tfZ7rEnEFo5lghxtEGIaMZtbP/nASw7h iMnw== X-Gm-Message-State: ALoCoQnJY1EPpK4nu+wCAmCfouex1mjFf9NCMvhwsXkq253cEYqg3T+foduYTvSW5RiePykJHijl X-Received: by 10.70.128.49 with SMTP id nl17mr55938440pdb.67.1425924197240; Mon, 09 Mar 2015 11:03:17 -0700 (PDT) Received: from [10.64.24.161] ([69.53.236.236]) by mx.google.com with ESMTPSA id rw10sm20377245pab.39.2015.03.09.11.03.14 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Mar 2015 11:03:15 -0700 (PDT) Sender: Warner Losh Subject: Re: load a driver during autoconfiguration Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: multipart/signed; boundary="Apple-Mail=_86A5D71C-E4AE-4449-A355-38CCA7790DFF"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5b5 From: Warner Losh In-Reply-To: <5070289.9Ox4kP5ZdP@ralph.baldwin.cx> Date: Mon, 9 Mar 2015 12:03:13 -0600 Message-Id: <21B44158-07C3-47AE-8132-BE5F2B408697@bsdimp.com> References: <5070289.9Ox4kP5ZdP@ralph.baldwin.cx> To: John Baldwin X-Mailer: Apple Mail (2.2070.6) Cc: freebsd-drivers@freebsd.org, =?utf-8?Q?Mat=C3=ADas_Perret_Cantoni?= X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2015 18:03:25 -0000 --Apple-Mail=_86A5D71C-E4AE-4449-A355-38CCA7790DFF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 > On Mar 9, 2015, at 10:01 AM, John Baldwin wrote: >=20 > On Friday, March 06, 2015 04:15:22 PM Mat=EDas Perret Cantoni wrote: >> Hello! >>=20 >> I just wrote a simple newbus driver that works just fine when I load = it >> manually with kldload(8). >>=20 >> Now I'd like the system to load it automatically at boot time. I've = already >> added the corresponding node on the dts file. >>=20 >> So my questions are: >>=20 >> Can I just place the driver under some directory so that the system = can >> probe it during auto-configuration? >>=20 >> Or do I need to re-compile the whole kernel for this? In that case = where >> should I place my sources before compiling? >=20 > One option is to always load the driver using an entry in loader.conf = or in > the kld_list variable in /etc/rc.conf. Another option to do on-demand = loading > is to write a custom devd handler. You can find some examples in > /etc/devd/usb.conf (note that that file is auto-generated). I'm not = sure what > is output for a nomatch entry for an fdt bus. For devices that appear = at > runtime you can run 'cat /var/run/devd.pipe' in a window to see event = details > to use to write your match rule. However, for boot time events I = think you > will need to resort to looking at the code to decipher what variables = are > passed that you want to match on. devinfo -v will tell you the pnp info, which is what you=92ll need to = match the device. This will load the driver after boot. It=92s almost always = easier, however, to just add the driver to your /boot/loader.conf file. Sometime before BSDcan this year, there will be the option to = automatically load drivers based on PNP information from the parent bus coupled with the = tables compiled into the .ko files, but that=92s not possible today. Warner --Apple-Mail=_86A5D71C-E4AE-4449-A355-38CCA7790DFF Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJU/eBhAAoJEGwc0Sh9sBEAz2MQAKl+uqfOAgW33UU1aU1SUHAq BWRekPCqXJS74DYj2PC2Vs6QfJxqS1RqeEWysErGhS8XW+t+yuVqi2QTTIc1DErB 8e0UiTBItxMBRWBj6nS6qq+ulCmvnJWiIvL3R/r303pu2qXH5elNWm/j/G8/FlUC +WphHb86oPlbMRBhW8TVJcQ52fNPYtHQcwTmDLgu6T/L+Umty7vu0XJyUiod760m LsorjwzbxX/DJ8VcT/CJg6h9e3MjxfQTEEb8s3y47nvZp7mpUxDeS+7xJTKoiQ1e 6rhDRIAKcE9ScyVRNt2RqIE7fz4El3Wj7smJSORSAlIvEetzEfzpl9xAdibhfy08 W4QJhDQyAJtwR+kvbeNS8fgB54REexG1Di5qMM9ngT9g8Y3bzxCLCkYw3216HerL X2+aWBVOBjuk78hFSDIvZ665jzbj6wi7RWwczYnqetkB3mbp5YIQ11+imTGcxGkq kN2UZgTS4maD4C5hoj71exyyC+jw9pb87kaBNqDqsEpq1UIojlu1pS5xB+mQ7cXL NB0H/W9eJPMo/vpJoC2/kVZs0BL75L4i3bHl9bOhCeduAEfmgaSdj3EyYuyW67sr BrI6oj2b0qJVAW0XX7gf4YbYZw2q+Znc30/SwIEGcOJK2IAe/48dkiRyBct9tP2D Zg4W4tmM3inKIvrSKVJL =gcoj -----END PGP SIGNATURE----- --Apple-Mail=_86A5D71C-E4AE-4449-A355-38CCA7790DFF-- From owner-freebsd-drivers@FreeBSD.ORG Thu Mar 12 21:52:26 2015 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B3D36A9D for ; Thu, 12 Mar 2015 21:52:26 +0000 (UTC) Received: from mail-qc0-x233.google.com (mail-qc0-x233.google.com [IPv6:2607:f8b0:400d:c01::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CE85A0 for ; Thu, 12 Mar 2015 21:52:26 +0000 (UTC) Received: by qcwr17 with SMTP id r17so22192831qcw.11 for ; Thu, 12 Mar 2015 14:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=E5qz+KB6NQ9awGgxpzNimoByEMTEKmLJ0dmFWPIC6qU=; b=jP7Bzjt6BzBpVieB68uFG4n8bJnF/yY5AjYBKpHAjUx336bt/zAMNfMJaBTk0mMfyE G5ge37sHzJFlTH7VKxW4godoQ9Z1/MbpwIMDVxCS9imdGqmPIIIpFgy2r+sr34nN2P1r gFVZ6ELEBavBprrV28/dqXoDYijk3KglMwXslh+/tkAqm0zNucrV28sWZsywIcrq/nYM as4/ONn7yMjwZL6e/B3aGhcUltUQh3xGimpI7gumMudxCOY/nyvncn7sDYpP4g/r5q9H 3ckKli0LK/4E8gOkgqFrhCiXwnO760t4JVQZnwuqhURfPMeJW0juyiF9c35F7OAM3IBl ayOw== MIME-Version: 1.0 X-Received: by 10.55.20.213 with SMTP id 82mr68096432qku.46.1426197145609; Thu, 12 Mar 2015 14:52:25 -0700 (PDT) Received: by 10.140.37.82 with HTTP; Thu, 12 Mar 2015 14:52:25 -0700 (PDT) Date: Thu, 12 Mar 2015 18:52:25 -0300 Message-ID: Subject: general question on interrupts handling From: =?UTF-8?Q?Mat=C3=ADas_Perret_Cantoni?= To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Mar 2015 21:52:26 -0000 Hi! I'm writing my first interrupt handling routine of a newbus driver and I'm not sure what things should I take care of in my ISR and what things the system will take care. I'm working on a Xilinx Zynq-7000 platform. I'm generating a Shared Peripheral Interrupt from the FPGA. For example... ... do I have to disable interrupts upon entering my ISR and enable them again before returning, o FreeBSD does it for me? ... do I have to clear the GIC interrupt status of my interrupt or the systems does it automatically when my routine returns? Please excuse me if this is too general or silly. If you can point me any documentation or sources to read, It'd be great. Regards, Matias.-