diff options
Diffstat (limited to 'usr.sbin/pccard/pccardc')
-rw-r--r-- | usr.sbin/pccard/pccardc/dumpcis.c | 29 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardc/enabler.c | 8 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardc/pccardmem.c | 1 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardc/printcis.c | 22 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardc/rdmap.c | 77 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardc/rdreg.c | 32 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardc/wrattr.c | 4 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardc/wrreg.c | 4 |
8 files changed, 108 insertions, 69 deletions
diff --git a/usr.sbin/pccard/pccardc/dumpcis.c b/usr.sbin/pccard/pccardc/dumpcis.c index eacf73a..51ce026 100644 --- a/usr.sbin/pccard/pccardc/dumpcis.c +++ b/usr.sbin/pccard/pccardc/dumpcis.c @@ -1,6 +1,10 @@ +/* + * $Id$ + */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> +#include <fcntl.h> #include <string.h> #include <sys/ioctl.h> @@ -10,19 +14,11 @@ int nocards; -int -dumpcis_main(int argc, char **argv) -{ -int node; - - for (node = 0; node < 8; node++) - scan(node); - printf("%d slots found\n", nocards); -} +void scan(slot) int slot; { -int fd, i; +int fd; char name[64]; struct cis *cp; struct slotstate st; @@ -45,6 +41,8 @@ struct slotstate st; } } } + +void dump(p, sz) unsigned char *p; int sz; @@ -77,3 +75,14 @@ void *p; } return(p); } + +int +dumpcis_main(int argc, char **argv) +{ +int node; + + for (node = 0; node < 8; node++) + scan(node); + printf("%d slots found\n", nocards); + return 0; +} diff --git a/usr.sbin/pccard/pccardc/enabler.c b/usr.sbin/pccard/pccardc/enabler.c index c96b853..56f1730 100644 --- a/usr.sbin/pccard/pccardc/enabler.c +++ b/usr.sbin/pccard/pccardc/enabler.c @@ -7,6 +7,7 @@ #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <fcntl.h> #include <sys/ioctl.h> #include <pccard/card.h> @@ -22,7 +23,7 @@ char *argv[]; struct drv_desc drv; struct mem_desc mem; struct io_desc io; -int fd, err, slot, i, card_addr; +int fd, slot, i, card_addr; char name[32]; char *p; @@ -50,7 +51,7 @@ char *p; usage("Memory argument error"); if (sscanf(argv[1], "%x", &card_addr)!=1) usage("Bad card address"); - if (sscanf(argv[2], "%x", &drv.mem)!=1) + if (sscanf(argv[2], "%lx", &drv.mem)!=1) usage("Bad memory address"); if (sscanf(argv[3], "%d", &i)!=1) usage("Bad memory size"); @@ -80,7 +81,7 @@ char *p; } if (argc) usage("no parameter for argument"); - printf("drv %s%d, mem 0x%x, size %d, io %d, irq 0x%x, flags 0x%x\n", + printf("drv %s%d, mem 0x%lx, size %d, io %d, irq 0x%x, flags 0x%x\n", drv.name, drv.unit, drv.mem, drv.memsize, drv.iobase, drv.irqmask, drv.flags); sprintf(name, "/dev/card%d", slot); @@ -121,6 +122,7 @@ char *p; if (ioctl(fd, PIOCSDRV, &drv)) perror("set driver"); close(fd); + return 0; } /* * usage - print usage and exit diff --git a/usr.sbin/pccard/pccardc/pccardmem.c b/usr.sbin/pccard/pccardc/pccardmem.c index 3c75f13..9ab239c 100644 --- a/usr.sbin/pccard/pccardc/pccardmem.c +++ b/usr.sbin/pccard/pccardc/pccardmem.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/ioctl.h> diff --git a/usr.sbin/pccard/pccardc/printcis.c b/usr.sbin/pccard/pccardc/printcis.c index 2ee3ca0..4d2cd95 100644 --- a/usr.sbin/pccard/pccardc/printcis.c +++ b/usr.sbin/pccard/pccardc/printcis.c @@ -12,8 +12,14 @@ #include "readcis.h" -int dump_pwr_desc(unsigned char *); -void print_ext_speed(unsigned char, int); +int dump_pwr_desc(unsigned char *); +void print_ext_speed(unsigned char, int); +void dump_device_desc(unsigned char *p, int len, char *type); +void dump_info_v1(unsigned char *p, int len); +void dump_config_map(struct tuple *tp); +void dump_cis_config(struct tuple *tp); +void dump_other_cond(unsigned char *p); +void dump_func_ext(unsigned char *p, int len); void dumpcis(struct cis *cp) @@ -152,6 +158,7 @@ unsigned char *p; /* * Dump configuration map tuple. */ +void dump_config_map(struct tuple *tp) { unsigned char *p, x; @@ -168,7 +175,7 @@ union { p = tp->data + 2; for (i = 0 ; i < rlen; i++) u.b[i] = *p++; - printf("\tReg len = %d, config register addr = 0x%x, last config = 0x%x\n", + printf("\tReg len = %d, config register addr = 0x%lx, last config = 0x%x\n", rlen, u.l, tp->data[1]); if (mlen) printf("\tRegisters: "); @@ -183,15 +190,12 @@ union { /* * Dump a config entry. */ +void dump_cis_config(struct tuple *tp) { unsigned char *p, feat; int i, j; char c; -union { - unsigned long l; - unsigned char b[4]; - }u; p = tp->data; printf("\tConfig index = 0x%x%s\n", *p & 0x3F, @@ -501,6 +505,7 @@ union { /* * dump_other_cond - Dump other conditions. */ +void dump_other_cond(unsigned char *p) { if (p[0]) @@ -566,6 +571,7 @@ static char *mant[] = return(len); } +void dump_device_desc(unsigned char *p, int len, char *type) { static char *un_name[] = @@ -617,6 +623,7 @@ int count = 0; /* * Print version info */ +void dump_info_v1(unsigned char *p, int len) { printf("\tVersion = %d.%d", p[0], p[1]); @@ -635,6 +642,7 @@ dump_info_v1(unsigned char *p, int len) /* * dump functional extension tuple. */ +void dump_func_ext(unsigned char *p, int len) { if (len == 0) diff --git a/usr.sbin/pccard/pccardc/rdmap.c b/usr.sbin/pccard/pccardc/rdmap.c index bfcce1f..77ff3c7 100644 --- a/usr.sbin/pccard/pccardc/rdmap.c +++ b/usr.sbin/pccard/pccardc/rdmap.c @@ -2,28 +2,49 @@ #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <fcntl.h> #include <sys/ioctl.h> #include <pccard/card.h> #include <pccard/cis.h> -int -rdmap_main(argc, argv) -int argc; -char *argv[]; +void +dump_io(fd, nio) +int fd, nio; { -int node, mask; -struct card *cp; +struct io_desc io; +int i; - for (node = 0; node < 8; node++) - scan(node); - exit(0); + for (i = 0; i < nio; i++) + { + io.window = i; + ioctl(fd, PIOCGIO, &io); +printf("I/O %d: flags 0x%03x port 0x%3x size %d bytes\n", + io.window, io.flags, io.start, io.size); + } +} + +void +dump_mem(fd, nmem) +int fd, nmem; +{ +struct mem_desc mem; +int i; + + for (i = 0; i < nmem; i++) + { + mem.window = i; + ioctl(fd, PIOCGMEM, &mem); +printf("Mem %d: flags 0x%03x host %p card %04lx size %d bytes\n", + mem.window, mem.flags, mem.start, mem.card, mem.size); + } } -static scan(slot) + +static void +scan(slot) int slot; { -int fd, mask; -char blk[1024]; +int fd; char name[64]; struct slotstate st; @@ -41,31 +62,15 @@ struct slotstate st; } close(fd); } -dump_mem(fd, nmem) -int fd, nmem; -{ -struct mem_desc mem; -int i; - for (i = 0; i < nmem; i++) - { - mem.window = i; - ioctl(fd, PIOCGMEM, &mem); -printf("Mem %d: flags 0x%03x host 0x%6x card %04x size %d bytes\n", - mem.window, mem.flags, mem.start, mem.card, mem.size); - } -} -dump_io(fd, nio) -int fd, nio; +int +rdmap_main(argc, argv) +int argc; +char *argv[]; { -struct io_desc io; -int i; +int node; - for (i = 0; i < nio; i++) - { - io.window = i; - ioctl(fd, PIOCGIO, &io); -printf("I/O %d: flags 0x%03x port 0x%3x size %d bytes\n", - io.window, io.flags, io.start, io.size); - } + for (node = 0; node < 8; node++) + scan(node); + exit(0); } diff --git a/usr.sbin/pccard/pccardc/rdreg.c b/usr.sbin/pccard/pccardc/rdreg.c index c278ae5..8bf0ccd 100644 --- a/usr.sbin/pccard/pccardc/rdreg.c +++ b/usr.sbin/pccard/pccardc/rdreg.c @@ -1,21 +1,12 @@ #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/ioctl.h> #include <pccard/card.h> -int -rdreg_main(argc, argv) -int argc; -char *argv[]; -{ - if (argc != 2) - { - dumpslot(0); - dumpslot(1); - } - else - dumpslot(atoi(argv[1])); -} +void dumpslot(sl) int sl; { @@ -46,3 +37,18 @@ struct pcic_reg r; } close(fd); } +int +rdreg_main(argc, argv) +int argc; +char *argv[]; +{ + if (argc != 2) + { + dumpslot(0); + dumpslot(1); + } + else + dumpslot(atoi(argv[1])); + return 0; +} + diff --git a/usr.sbin/pccard/pccardc/wrattr.c b/usr.sbin/pccard/pccardc/wrattr.c index d8e980f..5974119 100644 --- a/usr.sbin/pccard/pccardc/wrattr.c +++ b/usr.sbin/pccard/pccardc/wrattr.c @@ -1,4 +1,7 @@ #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/ioctl.h> @@ -43,4 +46,5 @@ off_t offs; lseek(fd, offs, SEEK_SET); if (write(fd, &c, 1) != 1) perror(name); + return 0; } diff --git a/usr.sbin/pccard/pccardc/wrreg.c b/usr.sbin/pccard/pccardc/wrreg.c index 88a54ba..42bdd7d 100644 --- a/usr.sbin/pccard/pccardc/wrreg.c +++ b/usr.sbin/pccard/pccardc/wrreg.c @@ -1,4 +1,7 @@ #include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/ioctl.h> @@ -36,4 +39,5 @@ struct pcic_reg r; r.value = value; if (ioctl(fd, PIOCSREG, &r)) perror("ioctl"); + return 0; } |