Questions about ioport-assignments

Dominik Brodowski linux at dominikbrodowski.net
Fri Jan 15 12:51:45 EST 2010


Hey,

On Thu, Jan 14, 2010 at 08:39:17PM +0900, Komuro wrote:
> Hi,
> 
> >- Is it just a buggy card if it works at 0x300 but not 0xc300
> >  (or is it maybe a problem with Linux assigning the io area)?
> >- Why is IOAddrLines forced to 16 (and thus alignment to 0x10000), but only
> >  if BasePort1 is 0?
> 
> Some pcmcia-card decodes only lower 10bits (0x0000-0x03FF).
> Such card does not work on higher ports (0x0400-0xFFFF)
> 
> So your card is not a buggy card.

Quick'n'Dirty patch -- or should we handle this generically, Komuro? Any way
to reliably detect these cards?

Best,
	Dominik

diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 776cad2..8f03bd0 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -89,6 +89,7 @@ INT_MODULE_PARM(delay_output,	0);	/* pause after xmit? */
 INT_MODULE_PARM(delay_time,	4);	/* in usec */
 INT_MODULE_PARM(use_shmem,	-1);	/* use shared memory? */
 INT_MODULE_PARM(full_duplex,	0);	/* full duplex? */
+INT_MODULE_PARM(lowport,	0);	/* full duplex? */
 
 /* Ugh!  Let the user hardwire the hardware address for queer cards */
 static int hw_addr[6] = { 0, /* ... */ };
@@ -497,11 +498,15 @@ static int try_io_port(struct pcmcia_device *link)
 	link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
 	link->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
     }
+    if (lowport && link->io.BasePort1 >= 0x0400)
+	    return -EINVAL;
     if (link->io.BasePort1 == 0) {
 	link->io.IOAddrLines = 16;
 	for (j = 0; j < 0x400; j += 0x20) {
 	    link->io.BasePort1 = j ^ 0x300;
 	    link->io.BasePort2 = (j ^ 0x300) + 0x10;
+	    if (lowport && link->io.BasePort1 >= 0x0400)
+		    continue;
 	    ret = pcmcia_request_io(link, &link->io);
 	    if (ret == 0)
 		    return ret;



More information about the linux-pcmcia mailing list