From owner-freebsd-drivers@FreeBSD.ORG Mon Sep 16 02:04:38 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E8078811 for ; Mon, 16 Sep 2013 02:04:37 +0000 (UTC) (envelope-from lnrdpss@gmail.com) Received: from mail-vb0-x230.google.com (mail-vb0-x230.google.com [IPv6:2607:f8b0:400c:c02::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A81112347 for ; Mon, 16 Sep 2013 02:04:37 +0000 (UTC) Received: by mail-vb0-f48.google.com with SMTP id w16so2377956vbf.21 for ; Sun, 15 Sep 2013 19:04:36 -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=lN2yuo/a2aG9QfTshnU0m41yiqUd8zPyyWyhUrrVnM8=; b=wrxH5oAaAQ4TLQxTP2CpeDmZnN2Nm+EPOLStAohdomW9T8jSUVZbQnpPdyyBVY8Ydq yP4dmhDiM1dm8N//l6xpiMgZH73Zs+KYzzevfB0AVesD4qRr4WxsFdq731bPTuesR8qN s/XTMKBELfU1RKnniz9QuKCPy0/MQ1enuCwSHQUFnWZRgPWcoFXrKuZsvtXWMGN8i0rH hYFHEqKCwmhPFUcn/XF5cCXF0Ra9Oo8j4PmoS8e78+WZUFinv3VzOtakZfa8YvvL6dVX C/ACbybDFfX7bPyzSuYjcuDXzASZ5PsJoYfVSyO50zSbqKpMm351jV84A2V0qSOVBYAN tejQ== MIME-Version: 1.0 X-Received: by 10.52.110.98 with SMTP id hz2mr19916175vdb.1.1379297076657; Sun, 15 Sep 2013 19:04:36 -0700 (PDT) Received: by 10.221.17.130 with HTTP; Sun, 15 Sep 2013 19:04:36 -0700 (PDT) Date: Sun, 15 Sep 2013 22:04:36 -0400 Message-ID: Subject: ATA drivers From: Leonardo Passos To: freebsd-drivers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 02:04:38 -0000 Hi there, I am currently investigating drivers in FreeBSD, with a particular focus on ATA. However some doubts came up, and since I could not find my answers in existing documentation, I would like to clarify some points. In particular, I would like to verify whether my current understanding is correct. Suppose I want to implement a "foo" driver in two specific scenarios: Scenario 1) Support for an ATA bus "To support an ATA-based device, I needed a proper driver. The driver, in this case, is a driver for an ATA bus. My driver has to work with specific controllers, which must be checked in the probe function of the driver. Upon successful probe, the attach function is called, in which case my driver sets specific configurations that are dependent on the previously checked controller. In the end of the probe, method, I register the the new device (e.g., a hardisk) by calling ata_attach". Example driver: sys/powerpc/powermac/ata_macio.c Scenario2) Support for ATA on top of PCI "In this case, my driver stands for an ATA-controller that is plugged into the PCI bus. In such a case, my driver must use ATA_DECLARE_DRIVER(foo), instead of the DRIVER_MODULE macro (as it occurred in scenario 1). Further, I must declare a function foo_probe, as required by the ATA_DECLARE_DRIVER (see ata-pci.h). In the probe function, I verify whether the device (an ATA controller, not a disk) is supported, and if so, set its chipinit function pointer (this field is part of ata_pci_controller instance, gotten by calling device_get_softc on the newly identified controller). In the chipinit function, I set an attach function for that ATA controller (this is performed by setting the ch_attach field over the ata_pci_controller instance). The registered attach function will be called whenever new disks are attached to the bus of the added ATA controller. That function in turn, will set any configuration parameters and add a new disk into the system, by calling ata_pci_ch_attach". Example drivers: sys/dev/ata/chipsets/ata-amd.c sys/dev/ata/chipsets/ata-intel.c Is the workflow just described correct? Stated otherwise, when supporting ATA devices, should I only be concerned with implementing proper bus support, that in turn, will register its managed disks? In that sense, I, as a driver developer, do not need to concern about how IO is actually performed, as the driver infrastructure of the kernel will handle any attached disk once it is configured by a bus driver? Thanks, Leo. From owner-freebsd-drivers@FreeBSD.ORG Mon Sep 16 08:55:29 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CAC419B2; Mon, 16 Sep 2013 08:55:29 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pb0-x22d.google.com (mail-pb0-x22d.google.com [IPv6:2607:f8b0:400e:c01::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 97DC42887; Mon, 16 Sep 2013 08:55:29 +0000 (UTC) Received: by mail-pb0-f45.google.com with SMTP id mc17so3803106pbc.4 for ; Mon, 16 Sep 2013 01:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ATJpRYqJ9HCc7gG/ag+yLoygcdiRyXrwcTE+T2b5GJk=; b=QHCljZobtWDOGUuBq4Ze5orgEa8djNrOJIGFkHi4XTNO0rX00loiqvIxRE/P86aVRF R5KXjUNwwSN1HWTTkc70M+ljnFyeY7u6Wsf51x25rirwAMbkhP2vIOqbYYhtQIGMFwIp HDV4xc7WYZfwnrRUTvvXLspDeZnZkvwTO56wrOfUJoptLaxmciuHU7xMVjIMzMv5gWEA CtY5y9JKHKZ2iTrgP7sru1M4zDuVZPCQIF8sxiCm27W041Z26jRDz2tk2GJx28l6VMpl pihfSdndhFvlZYNUG1iD0d9L8JvLwWN9nYm9pU0PNLYyTd5TNGMzaU9+y87L2fN4TS8+ pP6A== X-Received: by 10.68.221.233 with SMTP id qh9mr27913501pbc.103.1379321729308; Mon, 16 Sep 2013 01:55:29 -0700 (PDT) Received: from pyunyh@gmail.com (lpe4.p59-icn.cdngp.net. [114.111.62.249]) by mx.google.com with ESMTPSA id oj6sm37093142pab.9.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Sep 2013 01:55:28 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Mon, 16 Sep 2013 17:55:21 +0900 From: Yonghyeon PYUN Date: Mon, 16 Sep 2013 17:55:21 +0900 To: John Baldwin Subject: Re: WOL with msk(4) driver Message-ID: <20130916085521.GB1411@michelle.cdnetworks.com> References: <201309131056.54507.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201309131056.54507.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: Zucchetti , freebsd-drivers@freebsd.org, yongari@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Sep 2013 08:55:29 -0000 On Fri, Sep 13, 2013 at 10:56:54AM -0400, John Baldwin wrote: > On Thursday, September 05, 2013 5:44:20 pm Zucchetti wrote: > > Hello Everybody, > > > > The FreeBSD Forum Administrator > > *DutchDaemon*told me today > > I should send an email here regarding this: > > > > http://forums.freebsd.org/showpost.php?p=231918&postcount=6 > > > > hope you will enjoy it. > Zucchetti, Thanks for your hard work! It seems msk_WOLMagic() needs more polishing. The change is big so it shall take more time for me to understand what it does. Given that there is no publicly available data sheet, verification shall be challenging but I'll let you know when I manage to review the change. Thanks. > yongari@FreeBSD.org maintains the msk(4) driver (or has done the most work on > it recently at least). I'm not sure he is on this list, but I do think he is > on net@ where most network driver questions are asked. I've cc'd him in case > he is interested in your patches. I believe he has worked on WOL for other > NICs. > > -- > John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Tue Sep 17 02:36:03 2013 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 06A705AF for ; Tue, 17 Sep 2013 02:36:03 +0000 (UTC) (envelope-from paul-a.patience@polymtl.ca) Received: from ironport2-out.teksavvy.com (ironport2-out.teksavvy.com [206.248.154.182]) by mx1.freebsd.org (Postfix) with ESMTP id C728322E4 for ; Tue, 17 Sep 2013 02:36:02 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjoIABK/CFFFpcPK/2dsb2JhbABErF0BikSEE4NZF3OCTBMccks/iAmgC6EijWFNglwDpliCaik X-IPAS-Result: AjoIABK/CFFFpcPK/2dsb2JhbABErF0BikSEE4NZF3OCTBMccks/iAmgC6EijWFNglwDpliCaik X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="28101897" Received: from 69-165-195-202.cable.teksavvy.com (HELO d530.9front) ([69.165.195.202]) by ironport2-out.teksavvy.com with ESMTP; 16 Sep 2013 22:31:09 -0400 Message-ID: Date: Mon, 16 Sep 2013 22:34:52 -0400 From: Paul A. Patience To: freebsd-drivers@freebsd.org Subject: nfe(4) driver bug MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Sep 2013 02:36:03 -0000 Hello, I was reading the nfe(4) driver and noticed a bug. rx_broadcast should in fact be tx_broadcast: @@ -3260,7 +3260,7 @@ if ((sc->nfe_flags & NFE_MIB_V3) != 0) { stats->tx_unicast += NFE_READ(sc, NFE_TX_UNICAST); stats->tx_multicast += NFE_READ(sc, NFE_TX_MULTICAST); - stats->rx_broadcast += NFE_READ(sc, NFE_TX_BROADCAST); + stats->tx_broadcast += NFE_READ(sc, NFE_TX_BROADCAST); } } -- pap From owner-freebsd-drivers@FreeBSD.ORG Tue Sep 17 02:56:09 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5354476C for ; Tue, 17 Sep 2013 02:56:09 +0000 (UTC) (envelope-from paul-a.patience@polymtl.ca) Received: from ironport2-out.teksavvy.com (ironport2-out.teksavvy.com [206.248.154.182]) by mx1.freebsd.org (Postfix) with ESMTP id 20B3423EC for ; Tue, 17 Sep 2013 02:56:08 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8RABK/CFFFpcPK/2dsb2JhbABEg0khi1udGAGKRIZpBAR7F3OCXxxySz+ICQyff6EijWFNglwDlymPL4JqKQ X-IPAS-Result: Av8RABK/CFFFpcPK/2dsb2JhbABEg0khi1udGAGKRIZpBAR7F3OCXxxySz+ICQyff6EijWFNglwDlymPL4JqKQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="28103064" Received: from 69-165-195-202.cable.teksavvy.com (HELO d530.9front) ([69.165.195.202]) by ironport2-out.teksavvy.com with ESMTP; 16 Sep 2013 22:52:23 -0400 Message-ID: <71d498d8f47a08782b57d3bbed2cfab6@yourdomain.dom> Date: Mon, 16 Sep 2013 22:56:07 -0400 From: Paul A. Patience To: freebsd-drivers@freebsd.org Subject: nfe(4) driver bug MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Sep 2013 02:56:09 -0000 Hello again, I didn't mention which file the bug was in. I looked at the latest version of: http://svnweb.freebsd.org/base/head/sys/dev/nfe/if_nfe.c?revision=254803&view=co -- pap