[RFC] setting resources available to pcmcia

Dominik Brodowski linux at brodo.de
Thu Jun 12 22:02:39 BST 2003


OK, let's get to more serious stuff now: the way PCMCIA reserves
resources. Here are my suggestions - at first without code, but this
may change soon.

_Requirements_

1.) We need to deal with both static and window sockets -- and 
  only the latter is done correctly with current code. This is 
  something that Russell's mapstatic.c and mapwindow.c will take care
  of. However, I think this might be the second step   _after_ what I
  propose here.

2.) Setting the resources available for usage by windowed sockets
  needs to be done by userspace. It might be moved to early userspace
  once that gets usable.

3.) The ds.c subsystem may only start when all resources are 
  available for windowed sockets. Also, I'd prefer not to implement
  coldplugging from the beginning, so I'd like to add the reqirement
  that the ds.c subsystem may only start after userspace hotplugging
  has been started.

4.) Russell: are there any (different) requirements for the cardbus
  subsystem?

5.) Also, I want to keep a "compatibility code" which allows current
  userspace cardmgr's (3.2.3 or 3.2.4) to run.


_Suggestion_

PART I. WINDOWED SOCKETS

Note: once one of these three modes is started, you can't use another
mode unless you reboot.


a) compatibility mode

The resources are set by the existing ds.c ioctl
DS_ADJUST_RESOURCE_INFO. Once a different command is issued, we assume
all resources have been set, and disallow all further
DS_ADJUST_RESOURCE_INFO calls. From then on ds.c may do all sort of
stuff on its own, e.g. its own driver matching, binding, etc. 

Of course, an user which runs cardmgr and cardctl at the same time
while the resources are set might be able to break things. So print a
warning "you're using a version of cardmgr which might not be the best
suited for this business", and ask all power-users to use mode b) or c)
instead.


b) new mode [requires new userspace helper]

The resources are set by passing some arguments to sysfs files. To
even create the files neccessary to fill these arguments to the
kernel, another sysfs file will need to be echo'ed 1
(e.g. pcmcia_set_resources ); after all is done a command "echo 1 >
pcmcia_start" is issued [1 to pcmcia_stop will be called upon
shutdown], and then ds.c may start doing all sorts of wonderful stuff.


c) mixed mode

The new userspace helper described in b [or a simple shell script] is
run before cardmgr is started. cardmgr won't be able to meddle with
resources, but all was done earlier anyways.



PART II. MAP_STATIC SOCKETS

As we have no (working) compatibility stuff here, it gets easier:

a) new mode [requires shell script]

#!/bin/sh
echo 1 > /sys/..../pcmcia_set_resources
echo 1 > /sys/..../pcmcia_start


	Dominik



More information about the linux-pcmcia mailing list