Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Mar 2005 08:45:28 +0100
From:      Martin Husemann <martin@duskware.de>
To:        Jeremy Gale <jgale.work@gmail.com>
Cc:        freebsd-isdn@freebsd.org
Subject:   Re: Multiple Port Passive ISDN Card
Message-ID:  <20050304074528.GB29761@drowsy.duskware.de>
In-Reply-To: <1a4ba29305030315476c92b656@mail.gmail.com>
References:  <1a4ba29305030315476c92b656@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 ;-)


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050304074528.GB29761>