Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Mar 2000 16:44:18 -0800 (PST)
From:      Richard Johnson <raj@cisco.com>
To:        freebsd-mobile@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG
Subject:   Small addition to pccard.conf syntax (ioaddr option)
Message-ID:  <14560.98.259388.61429@kitab.cisco.com>

next in thread | raw e-mail | index | archive | help
In booting, sleeping, and resuming my laptop using the Lucent wavelan
card at IETF I found that pccardd didn't always allocate the ioaddr
space correctly.  I had a modem card in slot 0 and the wavelan card in
slot 1.  When I initially boot, it allocates io space for the modem
card and then the wavelan card next.  With the following:

io	0x2f8-0x340

it allocates 0x2f8-0x300 for the modem and then 0x300-0x340 for the
wavelan.  This is fine.  After sleeping and resuming, however, pccardd 
allocates the io space for the wavelan card first, which puts it at
the wrong location in memory and the card can not init. correctly.

Looking at pccardd source I notice that it will allocate the correct
space if that was specified in the cis info on the card, but I don't
see that being specified for this card.  So, the card seems to need
specifically allocated 0x300-0x340 but it doesn't say so in the cis
information.  I see this same situation wrt to my Xircom modem card as 
well.

I finally just decided that it would be easiest to simply modify
pccardd to allow specifying the "ioaddr" location in the configuration 
file.  These diffs add the "ioaddr" keyword for card configuration
information like so:

card "Lucent Technologies" "WaveLAN/IEEE"
	config 0x1 "wi0" 10
	ioaddr	0x300
insert echo Cabletron RoamAbout inserted
	insert /etc/pccard_ether wi0
	remove echo Cabletron RoamAbout removed

This always allocates the correct io space and always works just fine.
These diffs are based on the version of pccardd which came with 3.1,
but I don't think it's changed that much.

It would be nice to have these changes, or something else giving this
same functionality, in future versions of pccardd.

(Or maybe there's a different way to force the iobase address?  I
haven't found it.)


diff -c orig_pccardd/cardd.c pccardd/cardd.c
*** orig_pccardd/cardd.c	Mon Mar 27 15:28:01 2000
--- pccardd/cardd.c	Mon Mar 27 15:25:45 2000
***************
*** 38,44 ****
  #include "cardd.h"
  
  static struct card_config *assign_driver(struct card *);
! static int		 assign_io(struct slot *);
  static int		 setup_slot(struct slot *);
  static void		 card_inserted(struct slot *);
  static void		 card_removed(struct slot *);
--- 38,44 ----
  #include "cardd.h"
  
  static struct card_config *assign_driver(struct card *);
! static int		 assign_io(struct slot *, struct card *);
  static int		 setup_slot(struct slot *);
  static void		 card_inserted(struct slot *);
  static void		 card_removed(struct slot *);
***************
*** 135,140 ****
--- 135,141 ----
  {
  	struct slotstate state;
  
+ 	logmsg("Slot change for card %s", sp->name);
  	if (ioctl(sp->fd, PIOCGSTATE, &state)) {
  		logerr("ioctl (PIOCGSTATE)");
  		return;
***************
*** 224,230 ****
  		read_ether(sp);
  	if ((sp->config = assign_driver(cp)) == NULL) 
  		return;
! 	if (assign_io(sp)) {
  		logmsg("Resource allocation failure for %s", sp->cis->manuf);
  		return;
  	}
--- 225,231 ----
  		read_ether(sp);
  	if ((sp->config = assign_driver(cp)) == NULL) 
  		return;
! 	if (assign_io(sp, cp)) {
  		logmsg("Resource allocation failure for %s", sp->cis->manuf);
  		return;
  	}
***************
*** 338,344 ****
   *	configuration index selected.
   */
  static int
! assign_io(struct slot *sp)
  {
  	struct cis *cis;
  	struct cis_config *cisconf, *defconf;
--- 339,345 ----
   *	configuration index selected.
   */
  static int
! assign_io(struct slot *sp, struct card *cd)
  {
  	struct cis *cis;
  	struct cis_config *cisconf, *defconf;
***************
*** 409,414 ****
--- 410,418 ----
  			 * decode gives the size.
  			 */
  			sp->io.size = 1 << cp->io_addr;
+ 
+ 		if (cd->ioaddr)
+ 			sp->io.addr = cd->ioaddr;
  
  		if (sp->io.addr == 0) {
  			int     i = bit_fns(io_avail, IOPORTS, sp->io.size);
diff -c orig_pccardd/file.c pccardd/file.c
*** orig_pccardd/file.c	Mon Mar 27 15:28:01 2000
--- pccardd/file.c	Mon Mar 27 15:26:17 2000
***************
*** 52,57 ****
--- 52,58 ----
  	"ether",		/* 9 */
  	"insert",		/* 10 */
  	"remove",		/* 11 */
+ 	"ioaddr",		/* 12 */
  	0
  };
  
***************
*** 66,71 ****
--- 67,73 ----
  #define KWD_ETHER		9
  #define KWD_INSERT		10
  #define KWD_REMOVE		11
+ #define KWD_IOADDR		12
  
  struct flags {
  	char   *name;
***************
*** 184,189 ****
--- 186,192 ----
  	cp->version = vers;
  	cp->reset_time = 50;
  	cp->next = cards;
+ 	cp->ioaddr = 0; /* init. */
  	cards = cp;
  	for (;;) {
  		switch (keyword(next_tok())) {
***************
*** 248,253 ****
--- 251,259 ----
  		case KWD_REMOVE:
  			/* remove */
  			addcmd(&cp->remove);
+ 			break;
+ 		case KWD_IOADDR:
+ 			cp->ioaddr = num_tok();
  			break;
  		default:
  			pusht = 1;


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14560.98.259388.61429>