Subject: Re: A TODO list for cardbus/ PCMCIA support.
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Jun-ichiro itojun Hagino <itojun@itojun.org>
List: tech-kern
Date: 06/17/1999 12:55:05
>4.  Real support for hotswap, power on/off, etc.

	I have been working on "wildboar" pcmcia support code (this is
	included in BSDI since 3.0, and there has been NetBSD port around)
	and from my experience, I would like to see the following events
	to happen for pcmcia probe/attach.
	This should enable us to use pcmcia cards which are not inserted at
	the boot time.
	- probe/attach routines to attach driver stub, regardless of actual
	  hardware in the slot.  no hardware initiialization is made here.
	- attach routine registers callback routine to pcmcia service.
		maybe 2 functions, xx_dyn_attach and xx_dyn_detach.
	- xx_dyn_attach will be called on card insertion or slot powerup,
	  so that we can actually "attach" the card.
	- xx_dyn_detach will be called on card removal or slot powerdown,
	  so that we can actually "detach" the card (NOTE: driver will not be
	  detached).

	Basically xx_dyn_{attach,detach} implements special case of dynamic
	device driver configuration logic.  Other way to address this is to
	move to completely dynamic driver configuration (new driver can be
	attached whenever necessary).  My proposal above takes intermediate
	way (not too dynamic, not too static).  There are programs that assume
	that # of drivers are fixed at bootstrap time, so it would be safer
	to do the above.

	I prefer xx_dyn_{attach,detach} to be kicked by kernel as we have
	kernel thread watching the slots.

	There are several issues, like how to handle wildcard configuration
	line like:
		ne* at pcmcia? function?
	without looking into real pcmcia cards.
	- pcic must be clever enough to instantiate pcmcia drivers according
	  to the number of slots, and ne driver according to the number of
	  slots
	- pcmcom needs some twist, maybe.
	- we may want to do something more complex:
		- attach explicit unit # (ne0 or ne1) like the above steps
		- attach wildcard (ne*) dynamically at card insertion time,
	Also, it would be better if we can decouple leaf drivers (ne) and
	slots (pcmcia).  IMHO network cards should be recognized by mac
	address, not by the slot in which the card is inserted.

	Pls let me know your opinions on this.

itojun


--- BSDI boot messages.  it attaches pcmcia drivers even if it sees no pcmcia
	card is inserted.
BSDI BSD/OS 3.1 Kernel #174: Mon Jun 14 03:50:31 JST 1999
    itojun@cardamom.itojun.org:/usr/home/itojun/hyd/sys/compile/TURMERIC.v6
cpu = Pentium (about 150 MHz) model 2, stepping 12, type 0, features 1bf
delay multiplier 3830
real mem = 58720256 (56.00 MB)
avail mem = 55603200 (53.03 MB)
buffer cache = 5705728 (5.44 MB)
apm: installing PM-BIOS interface
apm: power stat: ac status on-line  battery status high (100 %)
apm: power management enable OK (0xffff)
apm: conn. vers. 1.1, engaging power management OK
isa0 (root)
pccons0 at isa0 iobase 0x60 irq 1: color, 8 screens
pcaux0 at isa0 iobase 0x60 irq 12
kms0 at isa0: keyboard mouse
pcic0 at isa0 iobase 0x3e0 irq 11: Cirrus PD6720
polling: 0  shared_irq: ffff(0) irqno: 11
polling: 0  shared_irq: ffff(0) irqno: 11
pcic1: controller only supports I/O
pcic1: controller only supports I/O
com0 at isa0 iobase 0x3f8 irq 4: buffered (16550AF)
com1 at isa0 iobase 0x2f8 irq 3: buffered (16550AF)
com2 at pcmcia0: PCCARD serial port
com3 at pcmcia0: PCCARD serial port
lp0 at isa0 iobase 0x378 irq 7
fdc0 at isa0 iobase 0x3f0 irq 6 drq 2: floppy controller
fd0 at fdc0 slave 0: 1.44M HD 3.5 floppy
wdc0 at isa0 iobase 0x1f0 irq 14: disk controller
wd0 at wdc0 drive 0
wdc1 at pcmcia0: PCCARD IDE disk controller
wdc2 at pcmcia0: PCCARD IDE disk controller
npx0 at isa0 iobase 0xf0: math coprocessor
vga0 at isa0 iobase 0x3c0 maddr 0xa0000-0xaffff: VGA graphics
sa0 at pcmcia0
ne0 at pcmcia0: PCCARD ethernet (NE2000)
ne1 at pcmcia0: PCCARD ethernet (NE2000)
WARNING: conflict at irq 5
sb0 at isa0 iobase 0x220 irq 5 drq 1 <SoundBlaster Pro 3.1>
opl0 at isa0 iobase 0x388 <Yamaha OPL-3 FM>
ef0 at pcmcia0: PCCARD EtherLink III (3C589)
ef0: interfaces: 10BASE-T (TP), 10BASE2 (BNC)
ef1 at pcmcia0: PCCARD EtherLink III (3C589)
ef1: interfaces: 10BASE-T (TP), 10BASE2 (BNC)
cce0 at pcmcia0: PCCARD ethernet (MB86960)
cce1 at pcmcia0: PCCARD ethernet (MB86960)
wl0 at pcmcia0: PCCARD ethernet (WaveLAN)
wl1 at pcmcia0: PCCARD ethernet (WaveLAN)
mz0 at pcmcia0: PCCARD ethernet (SMC91C92)
mz1 at pcmcia0: PCCARD ethernet (SMC91C92)
fvc0 at pcmcia0: PCCARD video capture
fvc1 at pcmcia0: PCCARD video capture
mc0 at pcmcia0: PCCARD SRAM
mc1 at pcmcia0: PCCARD SRAM
cnw0 at pcmcia0: PCCARD Netwave AirSurfer
cnw1 at pcmcia0: PCCARD Netwave AirSurfer
ux0 at pcmcia0: IEEE802.11 wireless network adapter (Am79C930)
ux1 at pcmcia0: IEEE802.11 wireless network adapter (Am79C930)
pe0 at isa0/lp0: Pocket Ethernet-2
IPsec: Initialized Security Assocciation Processing.
Warning: /: filesystem not clean
Accounting suspended
performing DAD for fe80:0001::02e0:98ff:fe00:30a3(ne0)
DAD success for fe80:0001::02e0:98ff:fe00:30a3(ne0)
performing DAD for 3ffe:0507:0001:0001:02e0:98ff:fe00:30a3(ne0)
performing DAD for 3ffe:0501:0410:0:02e0:98ff:fe00:30a3(ne0)
DAD success for 3ffe:0501:0410:0:02e0:98ff:fe00:30a3(ne0)
DAD success for 3ffe:0507:0001:0001:02e0:98ff:fe00:30a3(ne0)