summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-08-01 18:12:51 +0000
committerimp <imp@FreeBSD.org>1999-08-01 18:12:51 +0000
commitfcdf2e3fd01acc88eaaedeba3ba84345bd8736e7 (patch)
tree4e73414eab3d82a1d31cda39876cbcc2d785a835
parent564b182ca1eb133700db2d233b675a6543944077 (diff)
downloadFreeBSD-src-fcdf2e3fd01acc88eaaedeba3ba84345bd8736e7.zip
FreeBSD-src-fcdf2e3fd01acc88eaaedeba3ba84345bd8736e7.tar.gz
o Add additional printfs for error cases when we can't attach the device.
o Add field to dev_desc for the size of the io port range. This isn't used yet in the committed sources, but will make the transition easier in the future. If you build this into your kernel, you will need to rebuild pccardd.
-rw-r--r--sys/pccard/cardinfo.h2
-rw-r--r--sys/pccard/pccard.c34
-rw-r--r--sys/pccard/pcic.c2
3 files changed, 29 insertions, 9 deletions
diff --git a/sys/pccard/cardinfo.h b/sys/pccard/cardinfo.h
index 045665a..ed11af8 100644
--- a/sys/pccard/cardinfo.h
+++ b/sys/pccard/cardinfo.h
@@ -101,10 +101,12 @@ struct dev_desc {
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 */
u_char misc[128]; /* For any random info */
};
+#define DEV_DESC_HAS_SIZE 1
struct pcic_reg {
unsigned char reg;
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 9ec75d7..c450951 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pccard.c,v 1.79 1999/05/30 16:53:28 phk Exp $
+ * $Id: pccard.c,v 1.80 1999/05/31 11:28:48 phk Exp $
*/
#include "opt_devfs.h"
@@ -578,23 +578,35 @@ allocate_driver(struct slot *slt, struct dev_desc *desc)
* but not running, then remove it. If it is running,
* then reject the request.
*/
- for (devi = slt->devices; devi; devi = devi->next)
+ for (devi = slt->devices; devi; devi = devi->next) {
if (devi->drv == drv && devi->isahd.id_unit == desc->unit) {
- if (devi->running)
+ if (devi->running) {
+ printf("pccard %s%d: still running\n",
+ devi->drv->name, desc->unit);
return(EBUSY);
+ }
remove_device(devi);
break;
}
+ }
/*
* If an interrupt mask has been given, then check it
* against the slot interrupt (if one has been allocated).
*/
if (desc->irqmask && drv->imask) {
- if ((slt->ctrl->irqs & desc->irqmask) == 0)
+ if ((slt->ctrl->irqs & desc->irqmask) == 0) {
+ printf("pccard: PIOCSDRV requested irq (mask 0x%x) is "
+ "not free (available mask 0x%x)\n", desc->irqmask,
+ slt->ctrl->irqs);
return(EINVAL);
+ }
if (slt->irq) {
- if (((1 << slt->irq) & desc->irqmask) == 0)
+ if (((1 << slt->irq) & desc->irqmask) == 0) {
+ printf("pccard: PIOSCDRIV irq %d not in "
+ "available mask 0x%x\n", slt->irq,
+ desc->irqmask);
return(EINVAL);
+ }
slt->irqref++;
irq = slt->irq;
} else {
@@ -606,8 +618,11 @@ allocate_driver(struct slot *slt, struct dev_desc *desc)
irq = pccard_alloc_intr(desc->irqmask,
slot_irq_handler, (int)slt,
drv->imask, slt->ctrl->imask);
- if (irq < 0)
+ if (irq < 0) {
+ printf("pccard_alloc_intr failed for irq %d\n",
+ irq);
return(EINVAL);
+ }
slt->irq = irq;
slt->irqref = 1;
slt->ctrl->mapirq(slt, slt->irq);
@@ -650,8 +665,11 @@ allocate_driver(struct slot *slt, struct dev_desc *desc)
* the error. We assume that when we free the device,
* it will also set 'running' to off.
*/
- if (err)
+ if (err) {
+ printf("pccard %s%d: Enable failed %d\n", devi->drv->name,
+ devi->isahd.id_unit, err);
remove_device(devi);
+ }
return(err);
}
@@ -926,7 +944,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
default:
if (slt->ctrl->ioctl)
return(slt->ctrl->ioctl(slt, cmd, data));
- return(EINVAL);
+ return(ENOTTY);
/*
* Get slot state.
*/
diff --git a/sys/pccard/pcic.c b/sys/pccard/pcic.c
index be08130..278c388 100644
--- a/sys/pccard/pcic.c
+++ b/sys/pccard/pcic.c
@@ -854,7 +854,7 @@ pcic_ioctl(struct slot *slt, int cmd, caddr_t data)
switch(cmd) {
default:
- return(EINVAL);
+ return(ENOTTY);
/*
* Get/set PCIC registers
*/
OpenPOWER on IntegriCloud