On Wednesday 11 April 2007 10:40, Alan Garfield wrote: > 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!
Ok. If this is an ACPI device, you can get the resources at rids 0...N. rid 0 of SYS_RES_MEMORY will be the first memory resource returned by _CRS, rid 1 will be the second, etc. Thus, for example, suppose you have a device with 3 resources: a memory resource, an I/O port resource, and then another memory resource. The first resource would be SYS_RES_MEMORY rid 0, the second resource would be SYS_RES_IOPORT rid 0, and the last resource would be SYS_RES_MEMORY rid 1. -- John Baldwin _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hardware To unsubscribe, send any mail to "[EMAIL PROTECTED]"
