Date: Sun, 16 Jan 2000 14:02:31 +0900 From: Tatsumi Hosokawa <hosokawa@itc.keio.ac.jp> To: imp@village.org Cc: mobile@FreeBSD.ORG Subject: Re: Better solution of "devclass_alloc_unit: ed1 already exists" problem? Message-ID: <86vh4usj6g.wl@ringo.FromTo.Cc> In-Reply-To: In your message of "Sat, 15 Jan 2000 16:23:58 -0700" <200001152323.QAA01357@harmony.village.org> References: <861z7jt193.wl@ringo.FromTo.Cc> <867lhbt4rg.wl@ringo.FromTo.Cc> <864scft38i.wl@ringo.FromTo.Cc> <863drzt2xe.wl@ringo.FromTo.Cc> <200001152323.QAA01357@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
At Sat, 15 Jan 2000 16:23:58 -0700,
Warner Losh <imp@village.org> wrote:
> A better solution might be to have the system create the device and
> return it to pccardd so that it could pass it as an argument to the
> insert command, but even that has its problems.
I wrote a patch that performs like this.
How about it?
Index: sys/pccard/cardinfo.h
===================================================================
RCS file: /home/ncvs/src/sys/pccard/cardinfo.h,v
retrieving revision 1.15
diff -u -r1.15 cardinfo.h
--- sys/pccard/cardinfo.h 1999/12/29 04:54:58 1.15
+++ sys/pccard/cardinfo.h 2000/01/16 04:57:37
@@ -43,7 +43,7 @@
#define PIOCSMEM _IOW('P', 3, struct mem_desc) /* Set memory map */
#define PIOCGIO _IOWR('P', 4, struct io_desc) /* Get I/O map */
#define PIOCSIO _IOW('P', 5, struct io_desc) /* Set I/O map */
-#define PIOCSDRV _IOW('P', 6, struct dev_desc) /* Set driver */
+#define PIOCSDRV _IOWR('P', 6, struct dev_desc) /* Set driver */
#define PIOCRWFLAG _IOW('P', 7, int) /* Set flags for drv use */
#define PIOCRWMEM _IOWR('P', 8, unsigned long) /* Set mem for drv use */
#define PIOCSPOW _IOW('P', 9, struct power) /* Set power structure */
Index: sys/pccard/pccard.c
===================================================================
RCS file: /home/ncvs/src/sys/pccard/pccard.c,v
retrieving revision 1.103
diff -u -r1.103 pccard.c
--- sys/pccard/pccard.c 2000/01/13 06:32:33 1.103
+++ sys/pccard/pccard.c 2000/01/16 04:57:38
@@ -278,6 +278,8 @@
goto err;
}
err = device_probe_and_attach(child);
+ snprintf(desc->name, sizeof(desc->name), "%s",
+ device_get_nameunit(child));
err:
if (err)
device_delete_child(pccarddev, child);
Index: usr.sbin/pccard/pccardd/cardd.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pccard/pccardd/cardd.c,v
retrieving revision 1.42
diff -u -r1.42 cardd.c
--- usr.sbin/pccard/pccardd/cardd.c 1999/12/08 07:47:41 1.42
+++ usr.sbin/pccard/pccardd/cardd.c 2000/01/16 04:57:40
@@ -484,6 +484,7 @@
struct io_desc io;
struct dev_desc drv;
struct driver *drvp = sp->config->driver;
+ char *p;
char c;
off_t offs;
int rw_flags;
@@ -584,7 +585,6 @@
drv.iobase + sp->io.size - 1, drv.mem, drv.memsize,
sp->irq, drv.flags);
}
-
/*
* If the driver fails to be connected to the device,
* then it may mean that the driver did not recognise it.
@@ -594,6 +594,17 @@
logmsg("driver allocation failed for %s(%s): %s",
sp->card->manuf, sp->card->version, strerror(errno));
return (0);
+ }
+ drv.name[sizeof(drv.name) - 1] = '\0';
+ if (strncmp(drv.name, drvp->kernel, sizeof(drv.name))) {
+ drvp->kernel = newstr(drv.name);
+ p = drvp->kernel;
+ while (*p++)
+ if (*p >= '0' && *p <= '9') {
+ drvp->unit = atoi(p);
+ *p = '\0';
+ break;
+ }
}
return (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?86vh4usj6g.wl>
