Date: Wed, 23 Apr 2003 16:20:05 -0700 (PDT) From: "M. Warner Losh" <imp@bsdimp.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/51333: Pass missing CIS data into OLDCARD PCMCIA drivers Message-ID: <200304232320.h3NNK5Gd059690@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/51333; it has been noted by GNATS. From: "M. Warner Losh" <imp@bsdimp.com> To: freebsd-gnats-submit@FreeBSD.org Cc: scott+freebsd@fishballoon.org Subject: Re: kern/51333: Pass missing CIS data into OLDCARD PCMCIA drivers Date: Wed, 23 Apr 2003 17:14:39 -0600 (MDT) Well done on a patch that can almost be committed to the tree as is. However, there's one minor problem with it. Specifically, I've been trying to maintain binary compatibility for the ioctls listed in the cardinfo.h file. This patch changes the size of dev_desc, which breaks PIOSDRV. However, the attached patch should correct that issue. Comments? ==== //depot/user/imp/newcard/pccard/cardinfo.h#4 - /dell/imp/p4/newcard/src/sys/pccard/cardinfo.h ==== @@ -43,6 +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 PIOCSDRVOLD _IOWR('P', 6, struct dev_desc_old) /* 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 */ @@ -153,6 +154,22 @@ uint32_t product; /* Product ID */ uint32_t prodext; /* Product ID (extended) */ }; +struct dev_desc_old { + char name[16]; /* Driver name */ + int unit; /* Driver unit number */ + unsigned long mem; /* Memory address of driver */ + int memsize; /* Memory size (if used) */ + int iobase; /* base of I/O ports */ + int iosize; /* Length of I/O ports */ + int irqmask; /* Interrupt number(s) to allocate */ + int flags; /* Device flags */ + uint8_t misc[DEV_MISC_LEN]; /* For any random info */ + uint8_t manufstr[DEV_MAX_CIS_LEN]; + uint8_t versstr[DEV_MAX_CIS_LEN]; + uint32_t manufacturer; /* Manufacturer ID */ + uint32_t product; /* Product ID */ + uint32_t prodext; /* Product ID (extended) */ +}; #define DEV_DESC_HAS_SIZE 1 struct pcic_reg { ==== //depot/user/imp/newcard/pccard/pccard.c#12 - /dell/imp/p4/newcard/src/sys/pccard/pccard.c ==== @@ -478,6 +478,10 @@ int pwval; int s; struct slot *slt = PCCARD_DEV2SOFTC(dev); +#if __FreeBSD_version < 5000000 /* 4.x compatibility only. */ + struct dev_desc d; + struct dev_desc_old *odp; +#endif if (slt == 0 && cmd != PIOCRWMEM) return (ENXIO); @@ -608,6 +612,34 @@ else pccard_failure_beep(); return (err); +#if __FreeBSD_version < 5000000 /* 4.x compatibility only. */ + case PIOCSDRVOLD: + if (suser(td)) + return (EPERM); + odp = (struct dev_desc_old *) data; + strlcpy(d.name, odp->name, sizeof(d.name)); + d.unit = odp->unit; + d.mem = odp->mem; + d.memsize = odp->memsize; + d.iobase = odp->iobase; + d.iosize = odp->iosize; + d.irqmask = odp->irqmask; + d.flags = odp->flags; + memcpy(d.misc, odp->misc, sizeof(odp->misc)); + strlcpy(d.manufstr, odp->manufstr, sizeof(d.manufstr)); + strlcpy(d.versstr, odp->versstr, sizeof(d.versstr)); + *d.cis3str = '\0'; + *d.cis4str = '\0'; + d.manufacturer = odp->manufacturer; + d.product = odp->product; + d.prodext = odp->prodext; + err = allocate_driver(slt, &d); + if (!err) + pccard_success_beep(); + else + pccard_failure_beep(); + return (err); +#endif /* * Virtual removal/insertion */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304232320.h3NNK5Gd059690>