Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jul 1999 16:27:30 +0100
From:      Scott Mitchell <s.mitchell@computer.org>
To:        Poul-Henning Kamp <phk@FreeBSD.ORG>, freebsd-xircom@lovett.com
Cc:        hackers@FreeBSD.ORG, mobile@FreeBSD.ORG, "David O'Brien" <obrien@FreeBSD.ORG>
Subject:   Reading CIS from kernel?
Message-ID:  <19990710162730.60563@goatsucker.org>

next in thread | raw e-mail | index | archive | help
Hi all,

The Xircom ethernet driver needs to read/write PCCARD attribute memory from 
its probe routine, in order to identify the type of card and to beat
brain-damaged CEM56 cards into shape :-)  Currently this is done by way of
'fake' calls to read() and write() on the appropriate /dev/cardXX device.
However, if we look at the version of the driver that David O'Brien has
kindly committed to the repository
(http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/pccard/if_xe.c)
we see:

===================================================================
RCS file: /home/ncvs/src/sys/dev/pccard/if_xe.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -p -u -r1.2 -r1.3
--- src/sys/dev/pccard/if_xe.c  1999/05/14 04:18:24     1.2
+++ /home/ncvs/src/sys/dev/pccard/if_xe.c       1999/05/31 11:24:51     1.3
@@ -352,7 +352,11 @@ xe_memwrite(struct pccard_devinfo *devi,
   uios.uio_rw = UIO_WRITE;
   uios.uio_procp = 0;
 
+#if 0 /* THIS IS BOGUS */
   return cdevsw[CARD_MAJOR]->d_write(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
+#else
+  return (-1);
+#endif
 }
 
 
@@ -373,7 +377,11 @@ xe_memread(struct pccard_devinfo *devi, 
   uios.uio_rw = UIO_READ;
   uios.uio_procp = 0;
 
+#if 0 /* THIS IS BOGUS */
   return cdevsw[CARD_MAJOR]->d_read(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
+#else
+  return (-1);
+#endif
 }

Now I'll grant you that it probably *is* bogus, but when I first started
writing the driver it was the least ugly solution proposed.

So, since I can't do it that way anymore, are there any suggestions for an
'approved' way of reading/writing PCCARD attribute memory from inside the
kernel?  If it's just the use of cdevsw[] that's problematic, then making
crdread() and crdwrite() (in /sys/pccard/pccard.c) non-static and calling
them directly from the driver code would be an easy workaround.
Alternatively, I could export pccard_mem and pccard_kmem from the same file 
and do the reads and writes myself, but that seems a bit dangerous.

Any other approach would seem to involve duplicating more of the PCCARD
code than I care to, expecially considering that it's all being redone in
the newbus-ification of -CURRENT.

I'd appreciate some advice from the powers-that-be as to what will and
won't get stomped on here, as both David and I would like to see a
*working* version of this code in the tree...

Cheers,

	Scott

-- 
===========================================================================
Scott Mitchell          | PGP Key ID | "Eagles may soar, but weasels
London, England         | 0x54B171B9 |  don't get sucked into jet engines"
s.mitchell@computer.org | 0xAA775B8B |      -- Anon


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?19990710162730.60563>