diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 993eb8a2e7ff..83a16f15f7c5 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -45,6 +45,7 @@ SUBDIR= ${_ac} \ diskinfo \ ${_dnssec-keygen} \ ${_dnssec-signzone} \ + dumpcis \ ${_editmap} \ ${_edquota} \ ${_eeprom} \ @@ -115,7 +116,6 @@ SUBDIR= ${_ac} \ ${_ntp} \ ${_nvram} \ ${_ofwdump} \ - pccard \ pciconf \ periodic \ ${_pkg_install} \ diff --git a/usr.sbin/pccard/dumpcis/Makefile b/usr.sbin/dumpcis/Makefile similarity index 56% rename from usr.sbin/pccard/dumpcis/Makefile rename to usr.sbin/dumpcis/Makefile index 795c05c05846..b68e2e48f33a 100644 --- a/usr.sbin/pccard/dumpcis/Makefile +++ b/usr.sbin/dumpcis/Makefile @@ -2,12 +2,8 @@ # # $FreeBSD$ -.PATH: ${.CURDIR}/../pccardd ${.CURDIR}/../pccardc - PROG= dumpcis MAN= dumpcis.8 SRCS= main.c dumpcis.c dumpcisfile.c readcis.c printcis.c -CFLAGS+= -I${.CURDIR}/../pccardd -I${.CURDIR}/../pccardc - .include diff --git a/usr.sbin/pccard/dumpcis/dumpcis.8 b/usr.sbin/dumpcis/dumpcis.8 similarity index 100% rename from usr.sbin/pccard/dumpcis/dumpcis.8 rename to usr.sbin/dumpcis/dumpcis.8 diff --git a/usr.sbin/pccard/pccardc/dumpcis.c b/usr.sbin/dumpcis/dumpcis.c similarity index 100% rename from usr.sbin/pccard/pccardc/dumpcis.c rename to usr.sbin/dumpcis/dumpcis.c diff --git a/usr.sbin/pccard/pccardc/dumpcisfile.c b/usr.sbin/dumpcis/dumpcisfile.c similarity index 100% rename from usr.sbin/pccard/pccardc/dumpcisfile.c rename to usr.sbin/dumpcis/dumpcisfile.c diff --git a/usr.sbin/pccard/dumpcis/main.c b/usr.sbin/dumpcis/main.c similarity index 100% rename from usr.sbin/pccard/dumpcis/main.c rename to usr.sbin/dumpcis/main.c diff --git a/usr.sbin/pccard/pccardc/printcis.c b/usr.sbin/dumpcis/printcis.c similarity index 100% rename from usr.sbin/pccard/pccardc/printcis.c rename to usr.sbin/dumpcis/printcis.c diff --git a/usr.sbin/pccard/pccardd/readcis.c b/usr.sbin/dumpcis/readcis.c similarity index 100% rename from usr.sbin/pccard/pccardd/readcis.c rename to usr.sbin/dumpcis/readcis.c diff --git a/usr.sbin/pccard/pccardd/readcis.h b/usr.sbin/dumpcis/readcis.h similarity index 100% rename from usr.sbin/pccard/pccardd/readcis.h rename to usr.sbin/dumpcis/readcis.h diff --git a/usr.sbin/pccard/Makefile b/usr.sbin/pccard/Makefile deleted file mode 100644 index 18bd019ff67d..000000000000 --- a/usr.sbin/pccard/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# Makefile for pccardc/pccardd. -# $FreeBSD$ - -SUBDIR= dumpcis - -.include diff --git a/usr.sbin/pccard/Makefile.inc b/usr.sbin/pccard/Makefile.inc deleted file mode 100644 index 265f86d1ed55..000000000000 --- a/usr.sbin/pccard/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc" diff --git a/usr.sbin/pccard/pccardc/Makefile b/usr.sbin/pccard/pccardc/Makefile deleted file mode 100644 index d0649a2dc42c..000000000000 --- a/usr.sbin/pccard/pccardc/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# pccardc Makefile -# -# $FreeBSD$ - -.PATH: ${.CURDIR}/../pccardd - -PROG= pccardc -MAN= pccardc.8 -SRCS= beep.c dumpcis.c dumpcisfile.c enabler.c pccardc.c pccardmem.c power.c \ - printcis.c rdattr.c rdmap.c rdreg.c readcis.c wrattr.c wrreg.c - -CFLAGS+= -I${.CURDIR}/../pccardd - -.include diff --git a/usr.sbin/pccard/pccardc/beep.c b/usr.sbin/pccard/pccardc/beep.c deleted file mode 100644 index be62c56238a7..000000000000 --- a/usr.sbin/pccard/pccardc/beep.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Code cleanup, bug-fix and extension - * by Tatsumi Hosokawa - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -int -beep_main(argc, argv) - int argc; - char *argv[]; -{ - int fd, newstat, valid = 1; - char name[64], *p; - - if (argc != 2) - valid = 0; - if (valid) { - for (p = argv[1]; *p; p++) { - if (!isdigit(*p)) { - valid = 0; - break; - } - } - } - if (!valid) - errx(1, "usage: %s beep newstat", argv[0]); - - sscanf(argv[1], "%d", &newstat); - sprintf(name, CARD_DEVICE, 0); - fd = open(name, O_RDWR); - if (fd < 0) - err(1, "%s", name); - if (ioctl(fd, PIOCSBEEP, &newstat) < 0) - err(1, "ioctl (PIOCSBEEP)"); - return 0; -} diff --git a/usr.sbin/pccard/pccardc/enabler.c b/usr.sbin/pccard/pccardc/enabler.c deleted file mode 100644 index 2793e33e60c1..000000000000 --- a/usr.sbin/pccard/pccardc/enabler.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -static void usage(char *); - -int -enabler_main(argc, argv) - int argc; - char *argv[]; -{ - struct dev_desc drv; - struct mem_desc mem; - struct io_desc io; - int fd, slot, i, card_addr; - char name[32]; - char *p; - - bzero(&drv, sizeof(drv)); - if (argc < 3) - usage("arg count"); - slot = atoi(argv[1]); - if (slot < 0 || slot >= MAXSLOT) - usage("illegal slot number"); - p = argv[2]; - while (*p && (*p < '0' || *p > '9')) - p++; - if (*p == 0) - usage("no unit on device name"); - drv.unit = atoi(p); - *p = 0; - strcpy(drv.name, argv[2]); - argv += 3; - argc -= 3; - while (argc > 1) { - if (strcmp(argv[0], "-m") == 0) { - if (argc < 4) - usage("memory argument error"); - if (sscanf(argv[1], "%x", &card_addr) != 1) - usage("bad card address"); - if (sscanf(argv[2], "%lx", &drv.mem) != 1) - usage("bad memory address"); - if (sscanf(argv[3], "%d", &i) != 1) - usage("bad memory size"); - drv.memsize = i * 1024; - argc -= 2; - argv += 2; - } else if (strcmp(argv[0], "-f") == 0) { - if (sscanf(argv[1], "%x", &drv.flags) != 1) - usage("bad driver flags"); - } else if (strcmp(argv[0], "-a") == 0) { - if (sscanf(argv[1], "%x", &drv.iobase) != 1) - usage("bad I/O address"); - } else if (strcmp(argv[0], "-i") == 0) { - if (sscanf(argv[1], "%d", &i) != 1 || i < 1 || i > 15) - usage("illegal IRQ"); - drv.irqmask = 1 << i; - } - argc -= 2; - argv += 2; - } - if (argc) - usage("no parameter for argument"); - printf("drv %s%d, mem 0x%lx, size %d, io 0x%x, irq 0x%x, flags 0x%x\n", - drv.name, drv.unit, drv.mem, drv.memsize, drv.iobase, - drv.irqmask, drv.flags); - sprintf(name, CARD_DEVICE, slot); - fd = open(name, O_RDWR); - if (fd < 0) - err(1, "%s", name); - - /* Map the memory and I/O contexts. */ - if (drv.mem) { - mem.window = 0; - mem.flags = MDF_ACTIVE | MDF_16BITS; - mem.start = (caddr_t)drv.mem; - mem.size = drv.memsize; - mem.card = card_addr; - if (ioctl(fd, PIOCSMEM, &mem)) - err(1, "set memory context"); - } - if (drv.iobase) { - io.window = 0; - io.flags = IODF_ACTIVE | IODF_CS16; - io.start = drv.iobase; - io.size = 32; /* Blah... */ - if (ioctl(fd, PIOCSIO, &io)) - err(1, "set I/O context"); - } - if (ioctl(fd, PIOCSDRV, &drv)) - warn("set driver"); - close(fd); - return 0; -} - -/* - * usage - print usage and exit - */ -void -usage(msg) - char *msg; -{ - fprintf(stderr, "enabler: %s\n", msg); - fprintf(stderr, -"usage: pccardc enabler slot driver [-m addr size] [-a iobase] [-i irq]\n"); - fprintf(stderr, -" -m card addr size : card address (hex), host address (hex) & size (Kb)\n"); - fprintf(stderr, -" -a iobase : I/O port address (hex)\n"); - fprintf(stderr, -" -i irq : interrupt request number (1-15)\n"); - fprintf(stderr, -" Example: enabler 0 ed0 -m 2000 d4000 16 -a 300 -i 3\n"); - exit(1); -} diff --git a/usr.sbin/pccard/pccardc/pccardc.8 b/usr.sbin/pccard/pccardc/pccardc.8 deleted file mode 100644 index e1e0925d4bb2..000000000000 --- a/usr.sbin/pccard/pccardc/pccardc.8 +++ /dev/null @@ -1,283 +0,0 @@ -.\" -.\" Copyright (c) 1998 Toshihiko ARAI -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" Translated to English by Hiroki Sato -.\" -.\" $FreeBSD$ -.\" -.Dd November 14, 1998 -.Dt PCCARDC 8 -.Os -.Sh NAME -.Nm pccardc -.Nd PC-CARD (PCMCIA) management and monitoring tool -.Sh SYNOPSIS -.Nm -.Ar subcommand -.Op Ar arg ... -.Sh DESCRIPTION -The -.Nm -utility controls PC-CARD slots and configures and displays information -about PCMCIA cards. -It understands the following subcommands: -.Pp -.Bl -tag -width dumpcisfile -compact -.It Ic beep -Set beep type -.It Ic dumpcis -Print card CIS(s) -.It Ic dumpcisfile -Print card CIS(s) from files -.It Ic enabler -Device driver enabler -.It Ic help -Print command summary -.It Ic pccardmem -Allocate memory for pccard driver -.It Ic power -Power on/off slots and leaves them disabled -.It Ic rdattr -Read attribute memory -.It Ic rdmap -Read pcic mappings -.It Ic rdreg -Read pcic register -.It Ic wrattr -Write byte to attribute memory -.It Ic wrreg -Write pcic register -.El -.Bl -enum -.It -.Ic beep Ar beep_mode -.Pp -Specifies the sound made upon card insertion or removal. -This subcommand corresponds to -.Va pccard_beep -in -.Xr rc.conf 5 . -Allowed values for -.Ar beep_mode -are: -.Pp -.Bl -tag -width Ds -compact -.It Li 0 -silent mode -.It Li 1 -simple beep mode -.It Li 2 -melody mode -.El -.It -.Ic dumpcis -.Op Ar slot -.Pp -Displays -.Em CIS -(Card Information Structure) tuple in EEPROM of a PC-CARD card. -.Ar Slot -specifies which slot to read. -When no option is supplied, it displays -the CIS of all of the available cards. -.It -.Ic dumpcisfile -.Ar -.Pp -Displays CIS(s) in the same format as -.Ic dumpcis , -but does so using -one or more files -as the input CIS data instead of physical PC-CARD cards. -.It -.Ic enabler Ar slot driver -.Op Fl m Ar card addr size -.Op Fl a Ar iobase -.Op Fl i Ar irq -.Pp -This is a "point enabler" which can be used to set -parameters manually to enable a card when -.Xr pccardd 8 -cannot allocate drivers to a PC-CARD card properly. -Specify a PC-CARD slot in -.Ar slot -and a device name (such as "ed0" or "sio2") in -.Ar driver , -along with some or all of the following options: -.Bl -tag -width Ds -.It Fl m Ar card addr size -maps the shared-memory window of the card to host address. -.Ar card -is the starting address of shared-memory (hex) in the card's address space, -.Ar addr -is the address (hex) to map the memory to in the computer's address space, and -.Ar size -is the size of memory window (kb). -.It Fl a Ar iobase -.Ar iobase -specifies the port number to be mapped to the I/O window (hex) -.It Fl i Ar irq -.Ar irq -specifies the IRQ (decimal from 1 to 15) the card will use for interrupts. -.El -.Pp -For example, -.Bd -literal - enabler 0 ed0 -m 2000 d4000 16 -a 300 -i 3 -.Ed -.Pp -assigns the card in slot zero to the first NE2000 ethernet card driver at -port 0x300 and IRQ 3, -mapping the 16KB memory region at 0x2000 in the card to 0xd4000. -.Pp -This allows use of some unrecognized cards with broken CIS tuples, -and is also useful for testing a card that has not yet reported. -However, beware that it frequently cannot recognize new cards properly. -.It -.Ic help -.Pp -Prints help for -.Nm . -.It -.Ic pccardmem Ar addr -.Pp -Specifies the host address range PC-CARD controller(PCIC) -will use to map cards to. -Because the PCIC needs a contiguous 16KB memory, and most machines -have other ROMs or devices at other places in the ISA I/O memory -address range, generally you can only use the following four addresses: -.Pp -.Bl -tag -width 0xd0000 -compact -.It Ar 0xd0000 -0xd0000-0xd3fff (default) -.It Ar 0xd4000 -0xd4000-0xd7fff -.It Ar 0xd8000 -0xd8000-0xdbfff -.It Ar 0xdc000 -0xdc000-0xdffff -.El -.Pp -You can use "DEFAULT" instead of 0xd0000. -This subcommand corresponds to -.Va pccard_mem -in -.Xr rc.conf 5 . -.It -.Ic power Ar slot power_mode -.Pp -Changes the state of the power supply of the card in the specified -.Ar slot : -.Pp -.Bl -tag -width Ds -.It Li 0 -Turn off a power supply. -If a card becomes unstable when it is removed at -activate state, -this can force it into inactive state first and remove it safely. -The slot will remain disabled until you eject the card with the system -running or reenable the card with another -.Ic pccardc power -power command. -The slot will even remain disabled when you suspend and resume the -computer. -.It Li 1 -Turn on a power supply and set it into active state -(the system treats the card as if it was just inserted). -.El -.Pp -.It -.Ic rdattr Ar slot offs length -.Pp -Prints a hex dump -.Ar length -bytes long of the EEPROM of the card in slot -.Ar slot -starting at -.Ar offs . -All parameters are in hex. -.It -.Ic rdmap -.Op Ar slot -.Pp -Displays where the four memory windows and two I/O windows of a PC-CARD slot -are mapped to on the host. -If -.Ar slot -is not supplied, it displays the information for all of slots in the system. -.It -.Ic rdreg -.Op Ar slot -.Pp -Displays the 64 registers of the card in -.Ar slot -(all slots by default). -.It -.Ic wrattr Ar slot offs value -.Pp -Writes a single byte to the card's EEPROM at -an offset address from the top specified in -.Ar offs -(hex), -with a value specified in -.Ar value -(hex). -This is preserved after the card is removed. -.It -.Ic wrreg Ar slot reg value -.Pp -Writes a register of a PC-CARD. -Specify a PC-CARD slot number in -.Ar slot , -a register number in -.Ar reg -(hex) and -a value in -.Ar value -(hex). -.El -.Sh FILES -.Bl -tag -width /etc/rc.conf -compact -.It Pa /etc/rc.conf -configuration file -.El -.Sh SEE ALSO -.Xr rc.conf 5 , -.Xr pccardd 8 -.Sh AUTHORS -.An -nosplit -The original version was written by -.An Andrew McRae Aq andrew@mega.com.au . -.An Tatsumi Hosokawa Aq hosokawa@mt.cs.keio.ac.jp -fixed bugs and added some features. -This man page was written by -.An Toshihiko ARAI Aq toshi@jp.FreeBSD.org . -.Sh BUGS -Be careful when using -.Ic enabler -and -.Ic wrattr . -Misuse can make the system unstable or damage the card. diff --git a/usr.sbin/pccard/pccardc/pccardc.c b/usr.sbin/pccard/pccardc/pccardc.c deleted file mode 100644 index c1f6eced7507..000000000000 --- a/usr.sbin/pccard/pccardc/pccardc.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include - -typedef int (*main_t)(int, char **); - -#define DECL(foo) int foo(int, char**) -DECL(beep_main); -DECL(dumpcis_main); -DECL(dumpcisfile_main); -DECL(enabler_main); -DECL(help_main); -DECL(pccardmem_main); -DECL(power_main); -DECL(rdattr_main); -DECL(rdmap_main); -DECL(rdreg_main); -DECL(wrattr_main); -DECL(wrreg_main); - -struct { - char *name; - main_t func; - char *help; -} subcommands[] = { - { "beep", beep_main, "Beep type" }, - { "dumpcis", dumpcis_main, "Prints CIS for all cards" }, - { "dumpcisfile", dumpcisfile_main, "Prints CIS from a file" }, - { "enabler", enabler_main, "Device driver enabler" }, - { "help", help_main, "Prints command summary" }, - { "pccardmem", pccardmem_main, "Allocate memory for pccard driver" }, - { "power", power_main, "Power on/off slots" }, - { "rdattr", rdattr_main, "Read attribute memory" }, - { "rdmap", rdmap_main, "Read pcic mappings" }, - { "rdreg", rdreg_main, "Read pcic register" }, - { "wrattr", wrattr_main, "Write byte to attribute memory" }, - { "wrreg", wrreg_main, "Write pcic register" }, - { 0, 0 } -}; - -int -main(int argc, char **argv) -{ - int i; - - for (i = 0; argc > 1 && subcommands[i].name; i++) { - if (!strcmp(argv[1], subcommands[i].name)) { - argv[1] = argv[0]; - return (*subcommands[i].func) (argc - 1, argv + 1); - } - } - if (argc > 1) - warnx("unknown subcommand"); - return help_main(argc, argv); -} - -int -help_main(int argc, char **argv) -{ - int i; - - fprintf(stderr, "usage: pccardc ...\n"); - fprintf(stderr, "subcommands:\n"); - for (i = 0; subcommands[i].name; i++) - fprintf(stderr, "\t%s\n\t\t%s\n", - subcommands[i].name, subcommands[i].help); - return 1; -} diff --git a/usr.sbin/pccard/pccardc/pccardmem.c b/usr.sbin/pccard/pccardc/pccardmem.c deleted file mode 100644 index 0b1d1764c16d..000000000000 --- a/usr.sbin/pccard/pccardc/pccardmem.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include - -#include - -static void -usage() -{ - fprintf(stderr, "usage: pccardc pccardmem [memory-address]\n"); - exit(1); -} - -int -pccardmem_main(argc, argv) - int argc; - char *argv[]; -{ - char name[64]; - int addr = 0; - int fd; - - if (argc > 2) - usage(); - sprintf(name, CARD_DEVICE, 0); - fd = open(name, O_RDONLY); - if (fd < 0) - err(1, "%s", name); - if (argc == 2) { - if (sscanf(argv[1], "%x", &addr) != 1) - errx(1, "arg error"); - } - if (ioctl(fd, PIOCRWMEM, &addr)) - err(1, "ioctl (PIOCRWMEM)"); - else - printf("PCCARD Memory address set to 0x%x\n", addr); - return 0; -} diff --git a/usr.sbin/pccard/pccardc/power.c b/usr.sbin/pccard/pccardc/power.c deleted file mode 100644 index 59d43a57436a..000000000000 --- a/usr.sbin/pccard/pccardc/power.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* $FreeBSD$ */ - -/* - * Code cleanup, bug-fix and extension - * by Tatsumi Hosokawa - */ - -#ifndef lint -static const char rcsid[] = - "PAO: power.c,v 1.3 1999/02/11 05:00:54 kuriyama Exp"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -int -power_main(argc, argv) - int argc; - char *argv[]; -{ - int fd, i, newstat, valid = 1; - char name[64], *p; - - if (argc != 3) - valid = 0; - for (i = 1; i <= 2; i++) { - if (valid) { - for (p = argv[i]; *p; p++) { - if (!isdigit(*p)) { - valid = 0; - break; - } - } - } - } - if (!valid) - errx(1, "usage: %s power slot newstat", argv[0]); - - sscanf(argv[2], "%d", &newstat); - sprintf(name, CARD_DEVICE, atoi(argv[1])); - fd = open(name, O_RDWR); - if (fd < 0) - err(1, "%s", name); - newstat = newstat ? 1 : 0; - if (ioctl(fd, PIOCSVIR, &newstat) < 0) - err(1, "ioctl (PIOCSVIR)"); - return 0; -} diff --git a/usr.sbin/pccard/pccardc/rdattr.c b/usr.sbin/pccard/pccardc/rdattr.c deleted file mode 100644 index 1f90c772636f..000000000000 --- a/usr.sbin/pccard/pccardc/rdattr.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include - -#include - -int -rdattr_main(argc, argv) - int argc; - char *argv[]; -{ - int i, reg, length; - char name[64]; - u_char *buf; - int fd; - off_t offs; - - if (argc != 4) - errx(1, "Usage: %s rdattr slot offs length", argv[0]); - - sprintf(name, CARD_DEVICE, atoi(argv[1])); - fd = open(name, O_RDONLY); - if (fd < 0) - err(1, "%s", name); - - reg = MDF_ATTR; - if (ioctl(fd, PIOCRWFLAG, ®)) - err(1, "ioctl (PIOCRWFLAG)"); - - if (sscanf(argv[2], "%x", ®) != 1 || - sscanf(argv[3], "%x", &length) != 1) - errx(1, "arg error"); - - offs = reg; - if ((buf = malloc(length)) == 0) - errx(1, "malloc failed"); - - lseek(fd, offs, SEEK_SET); - if (read(fd, buf, length) != length) - err(1, "%s", name); - - for (i = 0; i < length; i++) { - if (i % 16 == 0) { - printf("%04x: ", (int) offs + i); - } - printf("%02x ", buf[i]); - if (i % 16 == 15) { - printf("\n"); - } - } - if (i % 16 != 0) { - printf("\n"); - } - return 0; -} diff --git a/usr.sbin/pccard/pccardc/rdmap.c b/usr.sbin/pccard/pccardc/rdmap.c deleted file mode 100644 index 3ac81f930ca9..000000000000 --- a/usr.sbin/pccard/pccardc/rdmap.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -static void -dump_io(fd, nio) - int fd, nio; -{ - struct io_desc io; - int i; - - for (i = 0; i < nio; i++) { - io.window = i; - if (ioctl(fd, PIOCGIO, &io)) - err(1, "ioctl (PIOCGIO)"); - printf("I/O %d: flags 0x%03x port 0x%3x size %d bytes\n", - io.window, io.flags, io.start, io.size); - } -} - -static void -dump_mem(fd, nmem) - int fd, nmem; -{ - struct mem_desc mem; - int i; - - for (i = 0; i < nmem; i++) { - mem.window = i; - if (ioctl(fd, PIOCGMEM, &mem)) - err(1, "ioctl (PIOCGMEM)"); - 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 void -scan(slot) - int slot; -{ - int fd; - char name[64]; - struct slotstate st; - - sprintf(name, CARD_DEVICE, slot); - fd = open(name, O_RDONLY); - if (fd < 0) - return; - if (ioctl(fd, PIOCGSTATE, &st)) - err(1, "ioctl (PIOCGSTATE)"); -/* - if (st.state == filled) - */ - { - dump_mem(fd, st.maxmem); - dump_io(fd, st.maxio); - } - close(fd); -} - -int -rdmap_main(argc, argv) - int argc; - char *argv[]; -{ - int node; - - 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 deleted file mode 100644 index a3171487998a..000000000000 --- a/usr.sbin/pccard/pccardc/rdreg.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -void -dumpslot(sl) - int sl; -{ - char name[64]; - int fd; - struct pcic_reg r; - - sprintf(name, CARD_DEVICE, sl); - fd = open(name, O_RDONLY); - if (fd < 0) { - warn("%s", name); - return; - } - printf("Registers for slot %d\n", sl); - for (r.reg = 0; r.reg < 0x40; r.reg++) { - if (ioctl(fd, PIOCGREG, &r)) { - err(1, "ioctl (PIOCGREG)"); - break; - } - if ((r.reg % 16) == 0) - printf("%02x:", r.reg); - printf(" %02x", r.value); - if ((r.reg % 16) == 15) - printf("\n"); - } - 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 deleted file mode 100644 index cc3df8ecbee8..000000000000 --- a/usr.sbin/pccard/pccardc/wrattr.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -static void -usage() -{ - fprintf(stderr, "usage: pccardc wrattr slot offs value\n"); - exit(1); -} - -int -wrattr_main(argc, argv) - int argc; - char *argv[]; -{ - int reg, value; - char name[64], c; - int fd; - off_t offs; - - if (argc != 4) - usage(); - sprintf(name, CARD_DEVICE, atoi(argv[1])); - fd = open(name, O_RDWR); - if (fd < 0) - err(1, "%s", name); - - reg = MDF_ATTR; - if (ioctl(fd, PIOCRWFLAG, ®)) - err(1, "ioctl (PIOCRWFLAG)"); - - if (sscanf(argv[2], "%x", ®) != 1 || - sscanf(argv[3], "%x", &value) != 1) - errx(1, "arg error"); - - offs = reg; - c = value; - lseek(fd, offs, SEEK_SET); - if (write(fd, &c, 1) != 1) - err(1, "%s", name); - return 0; -} diff --git a/usr.sbin/pccard/pccardc/wrreg.c b/usr.sbin/pccard/pccardc/wrreg.c deleted file mode 100644 index 5fda2a72f24c..000000000000 --- a/usr.sbin/pccard/pccardc/wrreg.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1995 Andrew McRae. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -static void -usage() -{ - fprintf(stderr, "usage: pccardc wrreg slot reg value\n"); - exit(1); -} - -int -wrreg_main(argc, argv) - int argc; - char *argv[]; -{ - int reg, value; - char name[64]; - int fd; - struct pcic_reg r; - - if (argc != 4) - usage(); - sprintf(name, CARD_DEVICE, atoi(argv[1])); - fd = open(name, O_RDWR); - if (fd < 0) - err(1, "%s", name); - if (sscanf(argv[2], "%x", ®) != 1 || - sscanf(argv[3], "%x", &value) != 1) - errx(1, "arg error"); - r.reg = reg; - r.value = value; - if (ioctl(fd, PIOCSREG, &r)) - err(1, "ioctl (PIOCSREG)"); - return 0; -}