Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-12 Thread Brian Feldman
On Sat, 13 Feb 1999, Jun Kuriyama wrote:

> Nate Williams wrote:
> > The changes to pccardd to support the new 'inactive' flag are still
> > missing.  We can power the slot on/off, but pccardd is unaware of these
> > changes.  Doesn't it need to be aware of the new 'power' state?
> 
>   Hmm.  I looked pccard in PAO but it is complex in state treatment.  I
> should make this more clearer.
> I'll continue to check PAO code so I will return this area after I check
> other area of PAO.  At this time, I'll commit "beep" feature only.
> 
> > Right.  Last I looked at PAO the pccard code had modifications all over
> > the kernel.
> 
> I think so, too. :-)

Pardon my naivite, but why iswas PAO not part of FreeBSD itself?

> 
> 
> -- 
> Jun Kuriyama // kuriy...@sky.rim.or.jp
> // kuriy...@freebsd.org
> 
> To Unsubscribe: send mail to majord...@freebsd.org
> with "unsubscribe freebsd-current" in the body of the message
> 

 Brian Feldman_ __  ___ ___ ___  
 gr...@unixhelp.org   _ __ ___ | _ ) __|   \ 
 http://www.freebsd.org/ _ __ ___  | _ \__ \ |) |
 FreeBSD: The Power to Serve!  _ __ ___  _ |___/___/___/ 


To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message


Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-12 Thread Jun Kuriyama
Nate Williams wrote:
> The changes to pccardd to support the new 'inactive' flag are still
> missing.  We can power the slot on/off, but pccardd is unaware of these
> changes.  Doesn't it need to be aware of the new 'power' state?

  Hmm.  I looked pccard in PAO but it is complex in state treatment.  I
should make this more clearer.
I'll continue to check PAO code so I will return this area after I check
other area of PAO.  At this time, I'll commit "beep" feature only.

> Right.  Last I looked at PAO the pccard code had modifications all over
> the kernel.

I think so, too. :-)


-- 
Jun Kuriyama // kuriy...@sky.rim.or.jp
// kuriy...@freebsd.org

To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message


Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-08 Thread Nate Williams
> Nate Williams wrote:
> > The patch implementing these changes are adequate in the kernel, but are
> > incomplete.
> 
> Yes, I should have attached patch for usr.sbin/pccard/* too.

The changes to pccardd to support the new 'inactive' flag are still
missing.  We can power the slot on/off, but pccardd is unaware of these
changes.  Doesn't it need to be aware of the new 'power' state?


Nate
> > ps. I like the new 'beep' ioctl better than the original implementation
> > in PAO.
> 
> Thanks.  But I've changed only a little from PAO implementation.  I like
> PAO's melodious beep sound (that isn't included in this patch), what you
> said is this?

Right.  Last I looked at PAO the pccard code had modifications all over
the kernel.


Nate

To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message


Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-08 Thread Jun Kuriyama
Thank you for your comment.

Nate Williams wrote:
> The patch implementing these changes are adequate in the kernel, but are
> incomplete.

Yes, I should have attached patch for usr.sbin/pccard/* too.

> What about the changes to usr.sbin/pccard/*?  With regard
> to the power-on modifications, it is necessary to see these changes for
> insertion/removal as well as suspend/resume, not to mention the
> documentation changes.

Hmmm, I'm planning to change pccardc like below.  Only functional
additions.  Could you point out where we should modify with these
changes?

> ps. I like the new 'beep' ioctl better than the original implementation
> in PAO.

Thanks.  But I've changed only a little from PAO implementation.  I like
PAO's melodious beep sound (that isn't included in this patch), what you
said is this?

# Of course, I think that is not "must needed" feature. :-)

-- 
Jun Kuriyama // kuriy...@sky.rim.or.jp
// kuriy...@freebsd.orgIndex: pccardc/Makefile
===
RCS file: /home/ncvs/src/usr.sbin/pccard/pccardc/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile1998/02/26 14:36:00 1.7
+++ Makefile1999/02/08 11:50:25
@@ -5,7 +5,7 @@
 #
 PROG=  pccardc
 NOMAN= noman
-SRCS=  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
 
 CFLAGS+=   -I${.CURDIR}/../pccardd
Index: pccardc/beep.c
===
RCS file: beep.c
diff -N beep.c
--- /dev/null   Mon Feb  8 20:41:26 1999
+++ beep.c  Mon Feb  8 20:49:00 1999
@@ -0,0 +1,77 @@
+/*
+ * 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[] =
+   "$Id$";
+#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;
+   charname[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;
+}
Index: pccardc/pccardc.c
===
RCS file: /home/ncvs/src/usr.sbin/pccard/pccardc/pccardc.c,v
retrieving revision 1.7
diff -u -r1.7 pccardc.c
--- pccardc.c   1998/02/26 14:36:01 1.7
+++ pccardc.c   1999/02/08 11:51:17
@@ -36,10 +36,12 @@
 typedef int (*main_t)(int, char **);
 
 #define DECL(foo) int foo(int, char**);
+DECL(beep_main);
 DECL(dumpcis_main);
 DECL(enabler_main);
 DECL(help_main);
 DECL(pccardmem_main);
+DECL(power_main);
 DECL(rdattr_main);
 DECL(rdmap_main);
 DECL(rdreg_main);
@@ -51,10 +53,12 @@
main_t  func;
char   *help;
 } subcommands[] = {
+   { "beep", beep_main, "Beep type

Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-08 Thread Jun Kuriyama
Thank you for your comment.

Mike Smith wrote:
> But this diagram worries me.  Does this explicitly disallow physical
> removal without a preceeding virtual removal?

No.  This is for card such as:

  o Some cards go unstable when it is removed from slot with power on.
But turning off the power of that card with this ioctl, this may
be going to remove safety.

> Just to be clear, I have no objections to that approach, but it's
> something that we would want to make very clear if we're going to make
> this change.

I don't think my sentence is clear explanation.  Feel free to make more
questions about it.  I'll try to explain it.  Thanks.


-- 
Jun Kuriyama // kuriy...@sky.rim.or.jp
// kuriy...@freebsd.org

To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message


Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-07 Thread Mike Smith
> This is a multi-part message in MIME format.
> --6331448DC47966073EBB6A88
> Content-Type: text/plain; charset=iso-2022-jp
> Content-Transfer-Encoding: 7bit
> 
> Jun Kuriyama wrote:
> > I'm planning to commit these changes into src/sys/pccard/.  This adds
> > two features.  These features are obtained from PAO.
> 
> Sorry, I forgot to add patch. :-)

These basically sound pretty good...

> + /*
> +  * Virtual removal/insertion
> +  * 
> +  * State of cards:
> +  *
> +  * insertionvirtual removal
> +  * (empty) > (filled) > (inactive)
> +  *   ^ ^   |  ^ | |
> +  *   | |   |  | | |
> +  *   | +---+  +-+ |
> +  *   |  removalvirtual insertion  |
> +  *   ||
> +  *   ++
> +  *removal
> +  *
> +  * -- hosokawa

But this diagram worries me.  Does this explicitly disallow physical 
removal without a preceeding virtual removal? 

Just to be clear, I have no objections to that approach, but it's 
something that we would want to make very clear if we're going to make 
this change.

-- 
\\  Sometimes you're ahead,   \\  Mike Smith
\\  sometimes you're behind.  \\  m...@smith.net.au
\\  The race is long, and in the  \\  msm...@freebsd.org
\\  end it's only with yourself.  \\  msm...@cdrom.com



To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message


Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-07 Thread Nate Williams
> I'm planning to commit these changes into src/sys/pccard/.  This adds
> two features.  These features are obtained from PAO.
> 
>   o PIOCSVIR
...
>   o PIOCSBEEP
...

The patch implementing these changes are adequate in the kernel, but are
incomplete.  What about the changes to usr.sbin/pccard/*?  With regard
to the power-on modifications, it is necessary to see these changes for
insertion/removal as well as suspend/resume, not to mention the
documentation changes.


Nate

ps. I like the new 'beep' ioctl better than the original implementation
in PAO.

To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message


Re: [Call for Review] new ioctl for src/sys/pccard/*

1999-02-07 Thread Jun Kuriyama
Jun Kuriyama wrote:
> I'm planning to commit these changes into src/sys/pccard/.  This adds
> two features.  These features are obtained from PAO.

Sorry, I forgot to add patch. :-)


-- 
Jun Kuriyama // kuriy...@sky.rim.or.jp
// kuriy...@freebsd.orgIndex: cardinfo.h
===
RCS file: /home/ncvs/src/sys/pccard/cardinfo.h,v
retrieving revision 1.10
diff -u -r1.10 cardinfo.h
--- cardinfo.h  1998/04/20 15:20:58 1.10
+++ cardinfo.h  1999/02/07 14:20:48
@@ -45,6 +45,8 @@
 #define PIOCRWFLAG _IOW('P', 7, int)   /* Set flags for drv use */
 #define PIOCRWMEM  _IOWR('P', 8, unsigned long) /* Set mem for drv use */
 #define PIOCSPOW   _IOW('P', 9, struct power) /* Set power structure */
+#define PIOCSVIR   _IOW('P', 10, int)  /* Virtual insert/remove */
+#define PIOCSBEEP  _IOW('P', 11, int)  /* Select Beep */
 /*
  * Debug codes.
  */
@@ -54,7 +56,7 @@
 /*
  * Slot states for PIOCGSTATE
  */
-enum cardstate { noslot, empty, suspend, filled };
+enum cardstate { noslot, empty, suspend, filled, inactive };
 
 /*
  * Descriptor structure for memory map.
Index: driver.h
===
RCS file: /home/ncvs/src/sys/pccard/driver.h,v
retrieving revision 1.6
diff -u -r1.6 driver.h
--- driver.h1999/01/19 00:18:25 1.6
+++ driver.h1999/02/07 14:20:48
@@ -23,6 +23,6 @@
 void   pccard_remove_beep __P((void));
 void   pccard_success_beep __P((void));
 void   pccard_failure_beep __P((void));
-void   pccard_beep_select __P((enum beepstate));
+intpccard_beep_select __P((enum beepstate));
 
 #endif /* !_PCCARD_DRIVER_H_ */
Index: pccard.c
===
RCS file: /home/ncvs/src/sys/pccard/pccard.c,v
retrieving revision 1.70
diff -u -r1.70 pccard.c
--- pccard.c1999/01/27 23:45:40 1.70
+++ pccard.c1999/02/07 14:20:48
@@ -897,6 +897,7 @@
struct mem_desc *mp;
struct io_desc *ip;
int s, err;
+   int pwval;
 
/* beep is disabled until the 1st call of crdioctl() */
pccard_beep_select(BEEP_ON);
@@ -1026,6 +1027,53 @@
else
pccard_failure_beep();
return err;
+   /*
+* Virtual removal/insertion
+* 
+* State of cards:
+*
+* insertionvirtual removal
+* (empty) > (filled) > (inactive)
+*   ^ ^   |  ^ | |
+*   | |   |  | | |
+*   | +---+  +-+ |
+*   |  removalvirtual insertion  |
+*   ||
+*   ++
+*removal
+*
+* -- hosokawa
+*/
+   case PIOCSVIR:
+   pwval = *(int *)data;
+   /* virtual removal */
+   if (!pwval) {
+   if (slt->state != filled) {
+   return EINVAL;
+   }
+   s = splhigh();
+   disable_slot(slt);
+   slt->state = inactive;
+   splx(s);
+   pccard_remove_beep();
+   selwakeup(&slt->selp);
+   }
+   /* virtual insertion */
+   else {
+   if (slt->state != inactive) {
+   return EINVAL;
+   }
+   slt->insert_seq = 1;
+   timeout(inserted, (void *)slt, hz/4);
+   pccard_insert_beep();
+   break;
+   }
+   break;
+   case PIOCSBEEP:
+   if (pccard_beep_select(*(int *)data)) {
+   return EINVAL;
+   }
+   break;
}
return(0);
 }
Index: pccard_beep.c
===
RCS file: /home/ncvs/src/sys/pccard/pccard_beep.c,v
retrieving revision 1.1
diff -u -r1.1 pccard_beep.c
--- pccard_beep.c   1997/10/26 06:06:48 1.1
+++ pccard_beep.c   1999/02/07 14:20:48
@@ -64,7 +64,11 @@
sysbeep(PCCARD_BEEP_PITCH2, PCCARD_BEEP_DURATION2);
 }
 
-void pccard_beep_select(enum beepstate state)
+int pccard_beep_select(enum beepstate state)
 {
-   allow_beep = state;
+   if (state == BEEP_ON || state == BEEP_OFF) {
+   allow_beep = state;
+   return 0;
+   }
+   return 1;
 }