From owner-freebsd-isdn@FreeBSD.ORG Fri Mar 4 07:45:32 2005 Return-Path: Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9108216A4CE for ; Fri, 4 Mar 2005 07:45:32 +0000 (GMT) Received: from mail.duskware.de (mail.duskware.de [213.146.108.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B7E643D46 for ; Fri, 4 Mar 2005 07:45:31 +0000 (GMT) (envelope-from martin@duskware.de) Received: by mail.duskware.de (Postfix, from userid 205) id E54DA33A85; Fri, 4 Mar 2005 08:45:28 +0100 (CET) Date: Fri, 4 Mar 2005 08:45:28 +0100 From: Martin Husemann To: Jeremy Gale Message-ID: <20050304074528.GB29761@drowsy.duskware.de> References: <1a4ba29305030315476c92b656@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1a4ba29305030315476c92b656@mail.gmail.com> User-Agent: Mutt/1.4.2.1i cc: freebsd-isdn@freebsd.org Subject: Re: Multiple Port Passive ISDN Card X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2005 07:45:32 -0000 On Thu, Mar 03, 2005 at 04:47:40PM -0700, Jeremy Gale wrote: > If > things are significantly different on FreeBSD please let me know. They are, at exactly the level your questions are about. > The one problem I've isolated is the l1_token member in the > isdn_l3_driver struct. It is an opaque pointer passed around and back to you. Make the thing it points to contain everything you need. > It looks to me that for all passive cards, it > is used as a pointer to the l2_softc struct. Yes. Active cards don't need the l2/l3 software part, and passive cards don't need anything above layer 1 for themselfs, realy (besides some special notifications like "turn on link LED", which they get from layer 4). So if you do multiple BRIs, I would just attache multiple l2 instances with a l2_softc each. Easy. > For the incomplete daic driver, > the only multiple port card I am aware of, it is a pointer to the > structure for the specific port being used. The daic quad card is bit different. It does handle four l2/l3 stacks in firmware and you have to access all of them via a common shared memory area. As an active card it does not need a l2_softc, so instead of multiple l2_softcs it uses a minimal structure that identifies the internal "port number" and the shared daic_softc. In your case just fill the l2_softc with a common driver pointer and a different l1_token, where your "driver" functions have a way to find out the global softc for your card and the port specific data (whatever that is). Something like: struct my_port { struct my_softc *sc; bus_space_tag_t iot; bus_space_handle_t ioh; int port_number; /* if you realy need this, probably you don't */ }; struct my_softc { struct device sc_dev; ... struct my_port ports[NPORTS]; ... }; and then fill in ports[i].sc plus ioh/iot (maybe with bus_space_subregion etc) and use &sc->ports[i] as l1token when creating the l2_softc for port i. Martin P.S.: the daic driver is one I started a long time ago just because I have such a card - then ran out of time and never came back to it. It was usefull to make sure the internal interface work for active cards, and maybe someday I'll realy finish it ;-)