diff options
author | imp <imp@FreeBSD.org> | 2001-08-02 07:06:32 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2001-08-02 07:06:32 +0000 |
commit | 09aa99ee9b983560f256b152c7ceac0ddda97b9b (patch) | |
tree | 4ec4db0e8a8da4cb1f7d67c1688b0acf713629bf /usr.sbin | |
parent | 6572b693cf60b5b14339f124a7dbc7542356e481 (diff) | |
download | FreeBSD-src-09aa99ee9b983560f256b152c7ceac0ddda97b9b.zip FreeBSD-src-09aa99ee9b983560f256b152c7ceac0ddda97b9b.tar.gz |
Only try to allocated properly aligned I/O segments. This should stop
some of the config problems that we've been seeing (where wi0 tries to
allocate 0x138-0x198, for example).
Use err(1,"foo") rather than perror + exit while I'm here.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pccard/pccardd/cardd.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/usr.sbin/pccard/pccardd/cardd.c b/usr.sbin/pccard/pccardd/cardd.c index a5e5d75..09a51bc 100644 --- a/usr.sbin/pccard/pccardd/cardd.c +++ b/usr.sbin/pccard/pccardd/cardd.c @@ -33,6 +33,7 @@ static const char rcsid[] = #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <err.h> #include <errno.h> #include <fcntl.h> #include <ctype.h> @@ -534,10 +535,8 @@ assign_driver(struct slot *sp, struct card *cp) } res.min = i; res.max = i; - if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) { - perror("ioctl (PIOCSRESOURCE)"); - exit(1); - } + if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) + err(1, "ioctl (PIOCSRESOURCE)"); if (res.resource_addr == ~0ul) continue; conf->irq = res.resource_addr; @@ -550,10 +549,8 @@ assign_driver(struct slot *sp, struct card *cp) } } else { res.min = res.max = conf->irq; - if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) { - perror("ioctl (PIOCSRESOURCE)"); - exit(1); - } + if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) + err(1, "ioctl (PIOCSRESOURCE)"); if (res.resource_addr == ~0ul) { logmsg("Failed to verify IRQ for %s\n", cp->manuf); return (NULL); @@ -591,12 +588,10 @@ assign_card_index(struct slot *sp, struct cis * cis) res.size = cio->size; res.min = cio->addr; res.max = res.min + cio->size - 1; - if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) { - perror("ioctl (PIOCSRESOURCE)"); - exit(1); - } + if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) + err(1, "ioctl (PIOCSRESOURCE)"); if (res.resource_addr != cio->addr) - goto next; + goto next; for (i = cio->addr; i < cio->addr + cio->size - 1; i++) if (!bit_test(io_avail, i)) goto next; @@ -761,12 +756,12 @@ memskip: for (i = 0; i < IOPORTS; i++) { j = bit_fns(io_avail, IOPORTS, i, sio->size, sio->size); + if ((j & (sio->size - 1)) != 0) + continue; res.min = j; res.max = j + sio->size - 1; - if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) { - perror("ioctl (PIOCSRESOURCE)"); - exit(1); - } + if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0) + err(1, "ioctl (PIOCSRESOURCE)"); if (res.resource_addr == j) break; } |