From owner-freebsd-hardware@FreeBSD.ORG Wed Apr 11 14:40:45 2007 Return-Path: X-Original-To: freebsd-hardware@freebsd.org Delivered-To: freebsd-hardware@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 367E916A406 for ; Wed, 11 Apr 2007 14:40:45 +0000 (UTC) (envelope-from alan@fromorbit.com) Received: from thing1.auspcmarket.com.au (mail.fromorbit.com [203.31.169.65]) by mx1.freebsd.org (Postfix) with ESMTP id F208B13C4C1 for ; Wed, 11 Apr 2007 14:40:44 +0000 (UTC) (envelope-from alan@fromorbit.com) Received: from [192.168.1.99] (c220-239-255-86.rivrw3.nsw.optusnet.com.au [220.239.255.86]) by thing1.auspcmarket.com.au (Postfix) with ESMTP id 32AC15C19; Thu, 12 Apr 2007 00:40:44 +1000 (EST) From: Alan Garfield To: John Baldwin In-Reply-To: <200704111032.02374.jhb@freebsd.org> References: <1175864703.4058.20.camel@hiro.auspc.com.au> <200704111032.02374.jhb@freebsd.org> Content-Type: text/plain Date: Thu, 12 Apr 2007 00:40:43 +1000 Message-Id: <1176302443.5057.17.camel@hiro.auspc.com.au> Mime-Version: 1.0 X-Mailer: Evolution 2.8.3 (2.8.3-2.fc6) Content-Transfer-Encoding: 7bit Cc: freebsd-hardware@freebsd.org Subject: Re: Porting a Linux ethernet driver to FreeBSD X-BeenThere: freebsd-hardware@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General discussion of FreeBSD hardware List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2007 14:40:45 -0000 On Wed, 2007-04-11 at 10:32 -0400, John Baldwin wrote: > I think de(4) is kind of simple if you ignore all the ifmedia handling stuff. > You basically need to alloc an ifnet, fill out if_init and if_start with routines > to bring up the interface and to drain the tx queue, and then pass it to > ether_ifattach(). When you get packets, you feed them to the stack by calling > ifp->if_input(). You will probably need to set if_mtu during attach to your > 256 byte MTU. And you should add an if_ioctl routine as well. Thanks John, I've been heavily looking at if_ed.c and if_de.c. I've got the basics worked out and the driver loading. But I'm struggling with getting the resources sorted out. I'd like to not hard-code the io ports and irq into the driver and instead get their details from the acpi bus, but I'm having trouble understanding how this is done. PnP, PCI and bus_* seem like magic to me! Thanks again, Alan.