[RFC] patches: sysfs-based client resource interface,
exporting of device information in sysfs and to hotplug
Dominik Brodowski
linux at dominikbrodowski.de
Wed Jan 12 15:01:12 EST 2005
With the re-worked PCMCIA IRQ handling update (thanks again for all the
feedback) on the way to the next -mm release, I'd like to discuss the next
patches I intend to submit after the big changes in Linus tree and the IRQ
handling update have rested a bit in -rc and -mm, respectively.
Oh, and please tell me especially if the _naming_ of some files and/or
hotplug values is suboptimal.
Thanks,
Dominik
sysfs-based resource database output
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-22-01-sysfs-resource-output
Add sysfs output to the non-static resource database. It'll reside in
/sys/class/pcmcia_socket/pcmcia_socket%n/available_resources_{io_mem}
and be of the format
"0x08%lx - 0x%08%lx\n"
drivers/pcmcia/rsrc_nonstatic.c | 105 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 105 insertions(+)
sysfs-based resource database input
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-22-02-sysfs-resource-input
Add a sysfs input method for the non-static socket resource database. It
works by writing
"+ 0x%[l]x - 0x%[l]x"
for adding resources, and by
"- 0x%[l]x - 0x%[l]x"
for removing resources to
/sys/class/pcmcia_socket/pcmcia_socket%n/available_resources_{io_mem}
drivers/pcmcia/rsrc_nonstatic.c | 69 ++++++++++++++++++++++++++++++++++++----
1 files changed, 63 insertions(+), 6 deletions(-)
mark resource setup as done
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-22-03-sysfs-resource-done
PCMCIA device registration should only happen if we're quite confident
there are resources available to at least map the CIS space -- else we can't
determine manfid/cardid, whether it is a multifunction card, etc. So,
add a flag to struct pcmcia_socket which denotes that -- and also whether
resources were added the "old" adjust_resource_info way. On static sockets,
it is activated upon registration, on non-static sockets, it is set upon an
echo'ing of anything into
/sys/class/pcmcia_socket/pcmcia_socket%n/device_possible_resources_setup_done
pcmcia_device_probe()
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-23-01-pcmcia-probe-driver
Move the probing of a device-driver pair (a.k.a. "attach") into
pcmcia_device_probe() conforming to the driver model.
drivers/pcmcia/ds.c | 72 +++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 55 insertions(+), 17 deletions(-)
pcmcia_device_remove()
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-23-02-pcmcia-remove-driver
Move the removal of a device from a driver (a.k.a. "detach") to
a driver-model conform pcmcia_device_remove() function which is called
within device_unregister().
drivers/pcmcia/ds.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
pcmcia_add_device()
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-23-03-pcmcia-device-add
Re-structure the adding of PCMCIA devices and the binding of devices
and drivers by cardmgr in bind_device: pcmcia_add_device() adds a new
PCMCIA device for a socket and a device function, if it hasn't been done
before.
drivers/pcmcia/ds.c | 160 ++++++++++++++++++++++++++++++++--------------------
include/pcmcia/ds.h | 3
2 files changed, 104 insertions(+), 59 deletions(-)
use match function
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-23-04-pcmcia-bus-match
Use bus_rescan_devices() and a pcmcia_bus_match() function to match
pcmcia devices and drivers based on cardmgr's wishes.
drivers/pcmcia/ds.c | 45 +++++++++++++++++++++++++++------------------
include/pcmcia/ds.h | 4 ++--
2 files changed, 29 insertions(+), 20 deletions(-)
add pcmcia devices without cardmgr's interaction
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-23-05-pcmcia-card-add
If it's a "static" socket or the non-static socket has all its resources
set up, there's no reason why the PCMCIA core can't detect and set up
pcmcia devices without cardmgr's interaction. Matching is still done in
userspace, though; and if the PCMCIA core misses something, cardmgr can
still add devices...
drivers/pcmcia/cs_internal.h | 1
drivers/pcmcia/ds.c | 86 +++++++++++++++++++++++++++++++++---------
drivers/pcmcia/socket_sysfs.c | 12 +++++
3 files changed, 80 insertions(+), 19 deletions(-)
determine device information
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-24-01-device-information
Determine some useful information about the device, namely
a) manufactor ID
b) card ID
c) function ID
d) product information strings
drivers/pcmcia/ds.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
include/pcmcia/ds.h | 12 +++++++++
2 files changed, 77 insertions(+)
export device information in sysfs
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-24-02-device-sysfs
Per-device sysfs output which reports up to four product ID strings,
manufactor ID, product ID and function ID.
drivers/pcmcia/ds.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+)
export device information to hotplug
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-24-03-hotplug
Export information to /sbin/hotplug for PCMCIA devices:
card_id, manf_id, func_id, bus_id (like pcmcia1.0) and
crc32-hashes of the prod_id strings.
Why not the prod_id strings themselves?
a) They may contain all sorts of strange and difficult to handle characters,
like " ".
b) It's impossible to pass multiple strings to userspace.
drivers/pcmcia/ds.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 84 insertions(+)
On top of all this I want to focus on kernel-based device<->driver matching (see
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-24-04-match
as a starting point, also of interest may be
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-24-06-match-fake-cis
and
http://www.kernel.org/pub/linux/kernel/people/brodo/patches/2.6.11-rc1/pcmcia-24-09-match-anonymus ).
More information about the linux-pcmcia
mailing list