pccard not working on 4.0-RELEASE

2000-03-15 Thread Blaz Zupan

In accordance with Murphy's law, 4.0-RELEASE seems to have broken pccard
support for me. I have a WaveLAN wireless LAN card and use the optional
ISA-to-pccard bridge. On a two week old -current, it was working just
fine, displaying the following:

pcic: polling mode
pcic: polling mode
pcic0: Vadem 469 at port 0x3e0 iomem 0xd on isa0
pccard0: PC Card bus -- kludge version on pcic0
pccard1: PC Card bus -- kludge version on pcic0

My kernel config file says:

device  pcic0   at isa? port 0x3e0 iomem 0xd
device  wi

Notice that I don't specify an irq for pcic0, because I am really short of
them. So pcic is run in polling mode. I also tried specifying an irq with
exactly the same result.

With a 4.0-RELEASE kernel it does not work, pcic0 is simply not found and
absolutely no message is being displayed. Applying the below patch which
effectively backs out revision 1.89 of sys/pccard/pcic.c makes the card
work again. It is very unfortunate that it is too late to fix this :(


Blaz Zupan, [EMAIL PROTECTED], http://home.amis.net/blaz/
Medinet d.o.o., Linhartova 21, 2000 Maribor, Slovenia

Index: pcic.c
===
RCS file: /ftp/pub/FreeBSD/development/FreeBSD-CVS/src/sys/pccard/pcic.c,v
retrieving revision 1.89
retrieving revision 1.88
diff -u -r1.89 -r1.88
--- pcic.c  2000/03/10 05:43:28 1.89
+++ pcic.c  2000/02/21 06:56:29 1.88
@@ -27,7 +27,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/pccard/pcic.c,v 1.89 2000/03/10 05:43:28 imp Exp $
+ * $FreeBSD: src/sys/pccard/pcic.c,v 1.88 2000/02/21 06:56:29 imp Exp $
  */
 
 #include sys/param.h
@@ -44,10 +44,6 @@
 #include pccard/slot.h
 #include pccard/pcic.h
 
-/* Get pnp IDs */
-#include isa/isavar.h
-#include dev/pcic/i82365reg.h
-
 /*
  * Prototypes for interrupt handler.
  */
@@ -80,20 +76,9 @@
u_char  *regs;  /* Pointer to regs in mem */
 } pcic_slots[PCIC_MAX_SLOTS];
 
+static int pcic_irq;
 static struct slot_ctrl cinfo;
 
-static struct isa_pnp_id pcic_ids[] = {
-   {PCIC_PNP_82365,NULL},  /* PNP0E00 */
-   {PCIC_PNP_CL_PD6720,NULL},  /* PNP0E01 */
-   {PCIC_PNP_VLSI_82C146,  NULL},  /* PNP0E02 */
-   {PCIC_PNP_82365_CARDBUS,NULL},  /* PNP0E03 */
-   {0}
-};
-
-static int validunits = 0;
-
-#define GET_UNIT(d)*(int *)device_get_softc(d)
-#define SET_UNIT(d,u)  *(int *)device_get_softc(d) = (u)
 
 /*
  * Internal inline functions for accessing the PCIC.
@@ -279,16 +264,16 @@
struct slot *slt;
struct pcic_slot *sp;
unsigned char c;
+   void *ih;
char *name;
+   int i;
int error;
-   struct resource *r;
+   struct resource *res = 0;
int rid;
static int maybe_vlsi = 0;
 
-   /* Check isapnp ids */
-   error = ISA_PNP_PROBE(device_get_parent(dev), dev, pcic_ids);
-   if (error == ENXIO)
-   return (ENXIO);
+   if (device_get_unit(dev) != 0)
+   return ENXIO;
 
/*
 *  Initialise controller information structure.
@@ -304,26 +289,22 @@
cinfo.maxmem = PCIC_MEM_WIN;
cinfo.maxio = PCIC_IO_WIN;
 
-   if (bus_get_resource_start(dev, SYS_RES_IOPORT, 0) == 0)
-   bus_set_resource(dev, SYS_RES_IOPORT, 0, PCIC_INDEX0, 2);
-   rid = 0;
-   r = bus_alloc_resource(dev, SYS_RES_IOPORT, rid, 0, ~0, 1, RF_ACTIVE);
-   if (!r) {
-   if (bootverbose)
-   device_printf(dev, "Cannot get I/O range\n");
-   return ENOMEM;
-   }
-
-   sp = pcic_slots[validunits * PCIC_CARD_SLOTS];
-   for (slotnum = 0; slotnum  PCIC_CARD_SLOTS; slotnum++, sp++) {
+   sp = pcic_slots;
+   for (slotnum = 0; slotnum  PCIC_MAX_SLOTS; slotnum++, sp++) {
/*
 *  Initialise the PCIC slot table.
 */
sp-getb = getb1;
sp-putb = putb1;
-   sp-index = rman_get_start(r);
-   sp-data = sp-index + 1;
-   sp-offset = slotnum * PCIC_SLOT_SIZE;
+   if (slotnum  4) {
+   sp-index = PCIC_INDEX_0;
+   sp-data = PCIC_DATA_0;
+   sp-offset = slotnum * PCIC_SLOT_SIZE;
+   } else {
+   sp-index = PCIC_INDEX_1;
+   sp-data = PCIC_DATA_1;
+   sp-offset = (slotnum - 4) * PCIC_SLOT_SIZE;
+   }
/* 
 * XXX - Screwed up slot 1 on the VLSI chips.  According to
 * the Linux PCMCIA code from David Hinds, working chipsets
@@ -463,13 +444,47 @@
 *  Allocate a slot and initialise the data 

Re: pccard not working on 4.0-RELEASE

2000-03-15 Thread Blaz Zupan

 : pcic0: Vadem 469 at port 0x3e0 iomem 0xd on isa0
 This is a slight lie.
 You might want to try this at 0x3e2.  It is worth a shot.

Bingo, it works! Now I'm wondering, GENERIC says:

device  pcic0   at isa? irq 10 port 0x3e0 iomem 0xd
device  pcic1   at isa? irq 11 port 0x3e2 iomem 0xd4000 disable

Neither seems quite correct for my situation, where I use

device  pcic0   at isa? port 0x3e2 iomem 0xd

Is there a standard for this and are the above addresses just
backwards? I'll do another test with just

device  pcic0   at isa?

as specified in LINT.

Blaz Zupan, [EMAIL PROTECTED], http://home.amis.net/blaz/
Medinet d.o.o., Linhartova 21, 2000 Maribor, Slovenia



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pccard not working on 4.0-RELEASE

2000-03-15 Thread Warner Losh

In message [EMAIL PROTECTED] Blaz Zupan 
writes:
:  : pcic0: Vadem 469 at port 0x3e0 iomem 0xd on isa0
:  This is a slight lie.
:  You might want to try this at 0x3e2.  It is worth a shot.
: 
: Bingo, it works! Now I'm wondering, GENERIC says:
: 
: device  pcic0   at isa? irq 10 port 0x3e0 iomem 0xd
: device  pcic1   at isa? irq 11 port 0x3e2 iomem 0xd4000 disable
: 
: Neither seems quite correct for my situation, where I use
: 
: devicepcic0   at isa? port 0x3e2 iomem 0xd
: 
: Is there a standard for this and are the above addresses just
: backwards? I'll do another test with just
: 
: devicepcic0   at isa?
: 
: as specified in LINT.

The old code wouldn't even look at the second pcic entry.  It will
just blindly probe at both 3e0 and 3e2 and claim that it was really at
3e0.  It would try to share interupts between these two entries and
would generally not work at all on systems that had multiple pcic
cards in them (I have about 6 different pcic isa cards that play
better together now than before, but still not to the level I'd call
working).

I did have some code in place to try to search out the pcic devices,
but it made it impossible to specify the management irq for those
devices so I've never committed it.

Warner



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pccard not working on 4.0-RELEASE

2000-03-15 Thread Blaz Zupan

 The old code wouldn't even look at the second pcic entry.  It will
 just blindly probe at both 3e0 and 3e2 and claim that it was really at
 3e0.  It would try to share interupts between these two entries and
 would generally not work at all on systems that had multiple pcic
 cards in them (I have about 6 different pcic isa cards that play
 better together now than before, but still not to the level I'd call
 working).

I just tried the way it was specified in LINT:

device  pcic0   at isa?

It does not work. So the only way it works for me is:

device  pcic0   at isa? port 0x3e2 iomem 0xd

Great, I'm a happy camper again :)

 I did have some code in place to try to search out the pcic devices,
 but it made it impossible to specify the management irq for those
 devices so I've never committed it.

I'm wondering, why use the management irq at all? Is polling in this
situation really so bad? It really shouldn't matter much if the system
detects the card removal right away or half a second later, does it?

Blaz Zupan, [EMAIL PROTECTED], http://home.amis.net/blaz/
Medinet d.o.o., Linhartova 21, 2000 Maribor, Slovenia



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pccard not working on 4.0-RELEASE

2000-03-15 Thread Warner Losh

In message [EMAIL PROTECTED] Blaz Zupan writes:
: Notice that I don't specify an irq for pcic0, because I am really short of
: them. So pcic is run in polling mode. I also tried specifying an irq with
: exactly the same result.

irqs shouldn't matter one way or the other.

: With a 4.0-RELEASE kernel it does not work, pcic0 is simply not found and
: absolutely no message is being displayed. Applying the below patch which
: effectively backs out revision 1.89 of sys/pccard/pcic.c makes the card
: work again. It is very unfortunate that it is too late to fix this :(

Yes.  I was nervous about adding PnP support this late in the game,
but jordan said go for it.

I'm curious, if you try to add options PNPBIOS to your kernel, does
that fix this problem?

Warner


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: pccard not working on 4.0-RELEASE

2000-03-15 Thread Warner Losh

In message [EMAIL PROTECTED] Blaz Zupan 
writes:
: I'm wondering, why use the management irq at all? Is polling in this
: situation really so bad? It really shouldn't matter much if the system
: detects the card removal right away or half a second later, does it?

For the install disk, it likely doesn't make sense to use the
management irq.  For most people, polling is sufficient.  The
management IRQ reduces the window where you can hang the machine due
to the driver talking to hardware that is now sitting in the user's
hands...

Warner


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message