From owner-freebsd-mobile Fri Oct 10 13:16:06 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id NAA05214 for mobile-outgoing; Fri, 10 Oct 1997 13:16:06 -0700 (PDT) (envelope-from owner-freebsd-mobile) Received: from grayling.erg.sri.com (grayling.erg.sri.com [128.18.4.194]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id NAA05143; Fri, 10 Oct 1997 13:15:17 -0700 (PDT) (envelope-from templin@erg.sri.com) Received: by grayling.erg.sri.com (8.6.12/2.7davy) id NAA01520; Fri, 10 Oct 1997 13:15:15 -0700 Message-Id: <199710102015.NAA01520@grayling.erg.sri.com> Date: Fri, 10 Oct 1997 13:15:15 -0700 From: "Fred L. Templin" 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) Sender: owner-freebsd-mobile@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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