Subject: PCMCIA serial devices can now hot-swap
To: None <current-users@netbsd.org>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: current-users
Date: 11/18/1998 15:48:39
Hi folks...

I have just committed the changes necessary for PCMCIA serial devices
to hot-swap.  I have tested this w/ a PCMCIA modem card:

NetBSD 1.3I (ICKY) #163: Wed Nov 18 15:36:29 PST 1998
    thorpej@icky:/u1/netbsd/src/sys/arch/i386/compile/ICKY
cpu0: family 5 model 4 step 4
cpu0: Intel Pentium/MMX (586-class)
real mem  = 49938432
avail mem = 43950080
using 635 buffers containing 2600960 bytes of memory
mainbus0 (root)
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o enabled, memory enabled
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82437MX Mobile System Controller (MTSC) (rev. 0x02)
pcib0 at pci0 dev 1 function 0
pcib0: Intel 82371MX Mobile PCI I/O IDE Xcelerator (MPIIX) (rev. 0x03)
vga1 at pci0 dev 2 function 0: Chips and Technologies 65550 (rev. 0x45)
wsdisplay0 at vga1: console (80x25, vt100 emulation)
Texas Instruments PCI1130 (CardBus bridge, revision 0x04) at pci0 dev 3 function 0 not configured
Texas Instruments PCI1130 (CardBus bridge, revision 0x04) at pci0 dev 3 function 1 not configured
isa0 at pcib0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
com2 at isa0 port 0x3e8-0x3ef irq 5: ns16550a, working fifo
lpt0 at isa0 port 0x378-0x37b irq 7
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 channel 0 drive 0: <IBM-DTNA-22160>
wd0: drive supports 16-sector pio transfers, lba addressing
wd0: 2067MB, 4200 cyl, 16 head, 63 sec, 512 bytes/sect x 4233600 sectors
wd0: 32-bits data port
wd0: drive supports PIO mode 4, DMA mode 2
sb0 at isa0 port 0x220-0x237 irq 5 drq 1 drq2 5: dsp v4.13
midi0 at sb0: <SB MIDI UART>
audio0 at sb0
opl0 at sb0: model OPL3
midi1 at opl0: <Yamaha OPL3>
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
psm0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at psm0
pcppi0 at isa0 port 0x61
midi2 at pcppi0: <PC speaker>
spkr0 at pcppi0
sysbeep0 at pcppi0
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
pcic0 at isa0 port 0x3e0-0x3e1 iomem 0xd0000-0xd3fff irq 10
pcic0: controller 0 (Intel 82365SL Revision 1) has sockets A and B
pcmcia0 at pcic0 controller 0 socket 0
ne0 at pcmcia0 function 0 port 0x400-0x40f port 0x410-0x41f
ne0: Planet SmartCOM 2000 Ethernet
ne0: Ethernet address 00:00:e8:12:8e:0f
pcmcia1 at pcic0 controller 0 socket 1
com3 at pcmcia1 function 0 port 0x2e8-0x2ef: serial device: ns16550a, working fifo
apm0 at mainbus0: Power Management spec V1.1
apm0: battery life expectancy: 99%
apm0: A/C state: on
apm0: battery charge state: high
biomask 4040 netmask 4040 ttymask 54c2
Kernelized RAIDframe activated
wscons: wskbd0 glued to wsdisplay0 (console)
WARNING: old BSD partition ID!
boot device: wd0
root on wd0a dumps on wd0b
root file system type: ffs
pcmcia1: card irq 11
stray interrupt 11
com3 detached
com3 at pcmcia1 function 0 port 0x2e8-0x2ef: serial device: ns16550a, working fifo
pcmcia1: card irq 11
stray interrupt 11
com3 detached
com3 at pcmcia1 function 0 port 0x2e8-0x2ef: serial device: ns16550a, working fifo
com3 detached

Note that the second detach (the one which caused a stray interrupt) was
done while the device was open.  tip(1) correctly reported "lost carrier"
and exited when this occurred.

I've also made the changes for multi-port PCMCIA serial cards, but can't
test those first-hand at this time.

If you have any problems, please report them with send-pr(1).

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 940 5942