Fix confusion about the return value from the internal MI probe routine.

Make the ISA probe actually (silently) fail if no card is found.

XXX - need to aquire the SBUS variant of this card some day or have
Jaromir find an MCA one.
This commit is contained in:
martin 2002-03-25 09:08:09 +00:00
parent 642b1a7163
commit 8a2d9422bd
2 changed files with 10 additions and 8 deletions

View File

@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: daic.c,v 1.8 2002/03/24 20:35:45 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: daic.c,v 1.9 2002/03/25 09:08:10 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -141,15 +141,15 @@ cardtypename(cardtype)
/*---------------------------------------------------------------------------*
* Probe for presence of device at given io space.
* Return: 0 no card identified
* 1 card found
* Return the card type (stupid ISA needs to know this in advance, to
* calculate the share memory size).
*---------------------------------------------------------------------------*/
int
daic_probe(bus, io)
bus_space_tag_t bus;
bus_space_handle_t io;
{
return (daic_reset(bus, io, 0, NULL) > 0);
return (daic_reset(bus, io, 0, NULL));
}
/*---------------------------------------------------------------------------*

View File

@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: daic_isa.c,v 1.5 2002/03/22 09:54:17 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: daic_isa.c,v 1.6 2002/03/25 09:08:09 martin Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@ -82,7 +82,7 @@ daic_isa_probe(parent, cf, aux)
struct isa_attach_args *ia = aux;
bus_space_tag_t memt = ia->ia_memt;
bus_space_handle_t memh;
int card;
int card, need_unmap = 0;
/* We need some controller memory to comunicate! */
if (ia->ia_iomem[0].ir_addr == 0 || ia->ia_iomem[0].ir_size == -1)
@ -97,6 +97,7 @@ daic_isa_probe(parent, cf, aux)
if (bus_space_map(memt, ia->ia_iomem[0].ir_addr, ia->ia_iomem[0].ir_size,
0, &memh))
goto bad;
need_unmap = 1;
/* MI check for card at this location */
card = daic_probe(memt, memh);
@ -109,8 +110,9 @@ daic_isa_probe(parent, cf, aux)
return 1;
bad:
/* unmap card RAM */
bus_space_unmap(memt, memh, DAIC_ISA_MEMSIZE);
/* unmap card RAM if already mapped */
if (need_unmap)
bus_space_unmap(memt, memh, DAIC_ISA_MEMSIZE);
return 0;
}