Subject: Getting PCMCIA working with Contura (two pcic')
To: None <port-i386@NetBSD.ORG>
From: Roy Sutton <rsutton@zabriskie.EECS.Berkeley.EDU>
List: port-i386
Date: 01/31/1996 01:47:21
A while back I posted an artical:

  > From owner-port-i386@NetBSD.ORG Fri Dec 15 10:09:01 1995
  > Subject: PCMCIA and 1.1: Issues, questions, and direction
  >
  > In attempt to incorporate PCMCIA support for my Compaq 
  > Contura 410C, I've applied the patches for PCMCIA support,
  > originally done by Stefan Grefen, and modified for 1.1
  > by John Kohl found at ftp://sipb.mit.edu/pub/netbsd/ .
  > I wish to support my Megahertz XJ2144 and 3COM 3C589B.
  
The XJ2144 and 3C589B now work fine after some fiddling.
Thanks Stefan, John, etal...

To get the code up and running on the Contura, I had to:

  1) incorporated definitions for ID type 0x84 into the 
     driver for the two VL82C146 on the Contura. Adding
     to pcmcia_pcic.c and i82365reg.h...

  2) Modify pcmcia_pcic.c to set the slot_id depending on the
     pcic unit passed by the config file. Without this,
     the offset for the base address of pcicN (N>0) is not set 
     properly. Move the notyet #ifdef in pcmcia.c...

  3) Modify pcmcia_pcic.c in two places so that when a config file
     flag indicates one slot for a given PCIC, it only attempts
     to work with one slot rather than two.

  4) For some reason I have to place two pcmciabus in
     the config file. The probe of the first bus fails,
     but the second one succeeds... Since it works, I didn't
     spend too much time tying to figure this one out.

  5) I didn't modify the machine independent code, so it stil
     attempts to check all N slots where N = (num_bus * num_pcic * 2),
     Fixing it to not check un-used hardware slots requires a radical
     change!

Here is the relavent Config stuff: ------------------------------------

   #
   # pcic flags : Bit[0] = number of slots supported [0 = 2, 1 = 1]
   #
   pcic0   at isa? port 0x3E0 flags 1      # PCMCIA begin
   pcic1   at isa? port 0x3E4 flags 1
   
   pcmciabus0 at isa? iomem 0xd4000 iosiz 4096
   pcmciabus1 at isa? iomem 0xd4000 iosiz 4096
   
   com1    at pcmciabus? port 0x2f8 irq 3  # pcmcia serial port
   ep0     at pcmciabus? port 0x380 irq 5  # pcmcia 3C589 ethernet card
   ed0     at pcmciabus? port 0x300 irq 10 #

Here a sample boot log (no relavent stuff deleted): -------------------

   : NetBSD 1.1 (JOSHUA) #0: Sun Jan  7 18:51:31 PST 1996
   : CPU: i486DX (GenuineIntel 486-class CPU)
   : real mem  = 12189696
   : avail mem = 10035200
   : using 174 buffers containing 712704 bytes of memory
   : isa0 (root)
   : npx0 at isa0 port 0xf0-0xff: using exception 16
   : pcprobe: reset error 1
   : pc0 at isa0 port 0x60-0x6f irq 1: color
   : pcic0 at isa0 port 0x3e0-0x3e1: VL82146 (82365sl clone) Rev. 6 slots 0-1 (f86afa3c f86afab8)
   : pcic1 at isa0 port 0x3e4-0x3e5: VL82146 (82365sl clone) Rev. 6 slots 2-3 (f86af83c f86af8b8)
   : pcmcia0 at isa0 iomem 0xd4000-0xd4fff
   : pcic0 slot 0:f81f8bfc f81f8dfc
   : failed to get cis info 19
   : pcic0 slot 1:f81f8bfc f81f8dfc
   : failed to get cis info 19
   : pcic1 slot 0:f81f8bfc f81f8dfc
   : failed to get cis info 19
   : pcic1 slot 1:f81f8bfc f81f8dfc
   : failed to get cis info 19
   : pcmcia1 at isa0 iomem 0xd4000-0xd4fff
   : pcic0 slot 0: <MEGAHERTZ, XJ2144, A5, PCMCIA MODEM>
   : com1 at pcmcia1 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
   : pcic0 slot 1:f81f8bfc f81f8dfc
   : failed to get cis info 19
   : pcic1 slot 0: <3Com Corporation, 3C589, TP/BNC LAN Card Ver. 2a, 000002>
   : ep0 at pcmcia1 port 0x380-0x38f irq 5: aui/bnc/utp address 00:20:af:f7:50:b3
   : pcic1 slot 1:f81f8bfc f81f8dfc
   : failed to get cis info 19

Here are the diffs of my changes. I only had to make changes to --------
i82365reg.h, pcmcia_pcic.c, and pcmcia.c.

Diffs: sys/dev/ic/i82365reg.h

--- start sys/dev/ic/i82365reg.h ---
107,108c107,108
< #define PCIC_INTEL1	0x83	/* Intel 82365SL Rev. 1; Both Memory and I/O */
< #define PCIC_IBM1	0x88	/* IBM PCIC clone; Both Memory and I/O */
---
> #define PCIC_INTEL1	0x83 	/* Intel 82365SL Rev. 1; Both Memory and I/O */
> #define PCIC_IBM1	0x88 	/* IBM PCIC clone; Both Memory and I/O */
109a110,111
> #define PCIC_146FC6	0x84	/* VL82C146FC6; Both Memory and I/O */
> #define PCIC_146FC7	0x85	/* VL82C146FC7; Both Memory and I/O */
212a215,216
> #define PCMICA_CHIP_146FC6    5
> #define PCMICA_CHIP_146FC7    6
--- end sys/dev/ic/i82365reg.h ---


Diffs: sys/dev/isa/pcmcia_pcic.c

--- start sys/dev/isa/pcmcia_pcic.c ---
79a80,82
> 	u_char		sc_hwflags;	/* flags from config */
> #define PCIC_ONESLOT	0x01		/* pcic supports only one slot */
> 	int		slots_active;	/* number of slots in use by pcic */
164a168
> 
169c173,176
< 	pcic->slot_id = 0; /* XXX */
---
> 	pcic->sc_hwflags = cf->cf_flags;
> 	pcic->slots_active = 2 - (int)(pcic->sc_hwflags & PCIC_ONESLOT);
> 	pcic->slot_id = pcic->sc_dev.dv_unit;
> 
187a195,200
> 		goto ok;
> 	case PCIC_146FC6:
> 		pcic->chip_inf = PCMICA_CHIP_146FC6;
> 		goto ok;
> 	case PCIC_146FC7:
> 		pcic->chip_inf = PCMICA_CHIP_146FC7;
229c242,244
< 	"IBM 82365sl clone Rev. 2"};
---
> 		"IBM 82365sl clone Rev. 2",
> 		"VL82146 (82365sl clone) Rev. 6",
> 	"VL82146 (82365sl clone) Rev. 7" };
239c254
< 	for (i = 0; i < 2; i++) {
---
>         for (i = 0; i < pcic->slots_active; i++) {
283c298,299
< 	for (i = 0; i < 2; i++) {
---
> 
>         for (i = 0; i < pcic->slots_active; i++) {
--- end sys/dev/isa/pcmcia_pcic.c ---


Diffs: sys/dev/pcmcia/pcmcia.c

--- start sys/dev/pcmcia/pcmcia.c ---
69d68
< #ifdef notyet
70a70
> #ifdef notyet
78d77
< #ifdef notyet
79a79
> #ifdef notyet
--- end sys/dev/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