Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Oct 1997 13:15:15 -0700
From:      "Fred L. Templin" <templin@erg.sri.com>
To:        freebsd-current@freebsd.org, freebsd-hackers@freebsd.org, freebsd-mobile@freebsd.org
Cc:        templin@erg.sri.com
Subject:   pccard driver questions (FreeBSD 2.2.2-RELEASE + PAO-970616)
Message-ID:  <199710102015.NAA01520@grayling.erg.sri.com>

next in thread | raw e-mail | index | archive | help
Hi,

I'm using FreeBSD 2.2.2-RELEASE with PAO-970616, and I'm writing a
new device driver for a PCMCIA card which is not currently supported in
either of these packages. The card is strictly a memory-mapped device,
and has no I/O mapping or interrupt capability. The card is programmed
by writing command(s) and data into the card's common memory space, then
setting a bit in the function configuration registers in attribute memory
space to tell the card to begin, then polling another bit in the registers
to ascertain when the card is done executing the command(s).

So, in short, I need to be able to use 'uiomove()' to copy data/commands
into/out of the card's common memory space from an application using the
open, close read, write, and ioctl semantics and I need to be able to switch
between attribute memory space and ccommon memory space. But, in order to do
this I need to manipulate the per-slot window mappings which get set up when
the card is found by pccardd and which are managed by the slot controller
code in sys/pccard/{pccard,pcic}.c  and my fear is that by doing so I would
risk a system crash if a pccard event caused the slot controller code to
yank it's resource allocations out from under my driver while it was
accessing them.

The only other driver I've seen in the FreeBSD source pool which seems
to want to play with 'uiomove()' and window mappings like this is
sys/i386/isa/scc.c, but the driver is rife with comments of the form:
"bad things will happen if you pull the card out while the system is
running" which makes me nervous about following their model. So my first
question is - how can I write a driver for a memory-mapped PCMCIA card
which can disassociate itself from the slot controller driver when the
device is probed, yet still allow me to manipulate the per-slot window
mappings?

My second question has to do with the way slot controller chips are
probed. From looking at 'pcic_probe()' in sys/pccard/pcic.c, it looks
for all the world to me that only a single slot controller chip is
supported (i.e., there are no unit numbers, and there is only one
statically-allocated "slot_ctrl" struct). Is it true that FreeBSD
currently only supports one slot controller chip (which controls two
slots), or am I missing something? (I'm hoping the folks working on
-current might have some knowledge on this...)

Thanks much,

Fred
templin@erg.sri.com



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