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.
This commit is contained in:
Warner Losh 1999-08-01 18:12:51 +00:00
parent 673b7bf483
commit 0226bd1a3e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=49352
3 changed files with 29 additions and 9 deletions

View File

@ -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;

View File

@ -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.
*/

View File

@ -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
*/