Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Dec 1995 20:08:41 GMT
From:      Rafael Pelayo <rpelayo@calypso.demon.co.uk>
To:        hackers@freebsd.org
Subject:   PSM identified in sysctl hardware table
Message-ID:  <199512032008.UAA00198@calypso>

next in thread | raw e-mail | index | archive | help
Here is a patch for the 2.1.0-RELEASE file /usr/src/sys/i386/isa/psm.c. It 
simply adds routines (poached from pcaudio.c) to create a device entry in the 
kernel sysctl hardware device table. Theres a load of copyright blurb relating
to my company (GSI Limited). This is only to protect us as we are looking
at releasing a distribution of the FreeBSD OS sometime in early to mid 1996.
The blurb is the basic BSD notice with the addition that the redistribution
is restricted to this code, and no code we may change in psm.c and not place
under the general redistribution. Does anybody have a problem with this ?

You may notice that I set the state to DC_UNKNOWN. As I didn't know if a mouse
should have a state I left it as this. 

I also noticed that there is no class for mice. Should we be adding one ? The
reason I say this is because we are looking at enhancing the XF86Config program
so that it can find all mice in the system and ask the user which one they
would like. If theres no mice class we will have to check the device names
against the devices we know to be mice. Unfortunatly if a new mouse driver
comes along with a new name, we are going to have to add it to the list (maybe
not such a big thing as XFree needs to know about the type of mouse to support
it anyway).

Rafael Pelayo
GSI Limited

####### DIFF FOLLOWING ########

*** psm.c	Sun Dec  3 16:35:41 1995
--- psm.c.new	Sun Dec  3 16:36:12 1995
***************
*** 45,50 ****
--- 45,85 ----
   *  - 24 October 1993
   */
  
+ /*
+ 
+                   MX is a registered trademark of GSI Limited 
+                    Portions Copyright 1995-1996 GSI Limited
+ 
+                               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. It is acknowledged that the software modifications implemented by GSI
+        Limited are simply for the furtherment of the FreeBSD and other BSD4.4
+        derived Operating systems.
+ 
+     2. Is is also acknowledged that GSI is only allowing free distribution 
+        of this module that contains this redistribution agreement as inserted
+        by a lawful representative of GSI Limited.
+ 
+     3. Redistributions of source code must retain the above copyright
+        notice, this list of conditions and the following disclaimer.
+ 
+     THIS SOFTWARE IS PROVIDED ``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 GSI Limited 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 "psm.h"
  
  #if NPSM > 0
***************
*** 58,63 ****
--- 93,99 ----
  #include <sys/file.h>
  #include <sys/proc.h>
  #include <sys/vnode.h>
+ #include <sys/devconf.h>
  #if 0
  #include <sys/syslog.h>		/* For debugging */
  #endif
***************
*** 125,130 ****
--- 161,201 ----
  
  #define AUX_PORT 0x60		/* AUX_PORT base (S.Yuen) */
  
+ /*
+ 
+   03-12-95 Rafael Pelayo (GSI Limited)
+   Setup the kernel device config structure for the kernel sysctl hardware
+   table (nabbed this and other parts from pcaudio.c.
+ 
+ */
+ 
+ static struct kern_devconf kdc_pca[NPSM] = { {
+         0, 0, 0,                /* filled in by dev_attach */
+         "psm", 0, { MDDT_ISA, 0 },
+         isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
+         &kdc_isa0,              /* parent */
+         0,                      /* parentdata */
+         DC_UNKNOWN,             /* not supported */
+         "PS/2 style mouse port" 
+ } };
+ 
+ /*
+ 
+   03-12-95 Rafael Pelayo (GSI Limited)
+   Function to register this device with the kernel sysctl hardware table
+ 
+ */
+ 
+ static inline void
+ psm_registerdev(struct isa_device *id)
+ {
+         if(id->id_unit)
+                 kdc_pca[id->id_unit] = kdc_pca[0];
+         kdc_pca[id->id_unit].kdc_unit = id->id_unit;
+         kdc_pca[id->id_unit].kdc_isa = id;
+         dev_attach(&kdc_pca[id->id_unit]);
+ }
+ 
  static void psm_write_dev(int inport, u_char value)
  {
  	psm_poll_status();
***************
*** 200,205 ****
--- 271,285 ----
  
  	/* Done */
  
+ /*
+ 
+   03-12-95 Rafael Pelayo (GSI Limited)
+   Now call the registerdev function for this device (psm of course) so that
+   the device appears in the kernel sysctl hardware table 
+ 
+ */
+ 
+         psm_registerdev(dvp);
  	return(0);
  }
  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512032008.UAA00198>