From 78944e725974870c45b3612046d49764b0b5fbc6 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 2 Dec 1999 05:52:58 +0000 Subject: [PATCH] Implement pccardc power command. This allows one to power off individual slots at one's whim. Useful for turning the slots into card carrying cases, etc. Patch was originally from mihira-san in message to freebsd-mobile. He ported the code originally from PAO. Submitted by: MIHIRA Sanpei Yoshiro --- usr.sbin/pccard/pccardc/Makefile | 2 +- usr.sbin/pccard/pccardc/pccardc.8 | 17 +++++++++++++++++ usr.sbin/pccard/pccardc/pccardc.c | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pccard/pccardc/Makefile b/usr.sbin/pccard/pccardc/Makefile index 902ea18818e6..679b47d1a00d 100644 --- a/usr.sbin/pccard/pccardc/Makefile +++ b/usr.sbin/pccard/pccardc/Makefile @@ -4,7 +4,7 @@ # $FreeBSD$ # PROG= pccardc -SRCS= beep.c dumpcis.c enabler.c pccardc.c pccardmem.c printcis.c \ +SRCS= beep.c dumpcis.c enabler.c pccardc.c pccardmem.c power.c printcis.c \ rdattr.c rdmap.c rdreg.c readcis.c wrattr.c wrreg.c MAN8= pccardc.8 diff --git a/usr.sbin/pccard/pccardc/pccardc.8 b/usr.sbin/pccard/pccardc/pccardc.8 index 25662a47b9f2..a5714ca7e075 100644 --- a/usr.sbin/pccard/pccardc/pccardc.8 +++ b/usr.sbin/pccard/pccardc/pccardc.8 @@ -54,6 +54,8 @@ Device driver enabler Print command summary .It Pa pccardmem Allocate memory for pccard driver +.It Pa power +Power on/off slots .It Pa rdattr Read attribute memory .It Pa rdmap @@ -162,6 +164,21 @@ This subcommand corresponds to in .Xr rc.conf 5 . .It +.Nm power Ar slot 0|1 +.Pp +It turns ON/OFF a power supply of a card in the slot specified in +.Ar slot . +.Pp +.Bl -tag -width Ds +.It Ar 0 +turn OFF a power supply. If a card becomes unstable when it is removed at +activate state, +this can force it to turn into inactive state first and remove it safely. +.It Ar 1 +turn ON a power supply and into active state similar to a card insertion. +.El +.Pp +It .Nm rdattr Ar slot offs length .Pp Prints a hex dump diff --git a/usr.sbin/pccard/pccardc/pccardc.c b/usr.sbin/pccard/pccardc/pccardc.c index c162a2aaeace..743493b4e318 100644 --- a/usr.sbin/pccard/pccardc/pccardc.c +++ b/usr.sbin/pccard/pccardc/pccardc.c @@ -41,6 +41,7 @@ DECL(dumpcis_main); DECL(enabler_main); DECL(help_main); DECL(pccardmem_main); +DECL(power_main); DECL(rdattr_main); DECL(rdmap_main); DECL(rdreg_main); @@ -57,6 +58,7 @@ struct { { "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" },