Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/bktr Some NetBSD specific changes; also TODO, an...



details:   https://anonhg.NetBSD.org/src/rev/3406b80da3e9
branches:  trunk
changeset: 485831:3406b80da3e9
user:      wiz <wiz%NetBSD.org@localhost>
date:      Sun May 07 00:24:33 2000 +0000

description:
Some NetBSD specific changes; also TODO, and import script, based
on bind2netbsd by Bernd Ernesti

diffstat:

 sys/dev/pci/bktr/TODO         |   17 ++++
 sys/dev/pci/bktr/bktr2netbsd  |  129 +++++++++++++++++++++++++++++++
 sys/dev/pci/bktr/bktr_audio.c |   15 ++-
 sys/dev/pci/bktr/bktr_card.c  |   40 +++++----
 sys/dev/pci/bktr/bktr_card.h  |    6 +-
 sys/dev/pci/bktr/bktr_core.c  |   39 +++++----
 sys/dev/pci/bktr/bktr_os.c    |  172 ++++++++++++++++++++---------------------
 sys/dev/pci/bktr/bktr_reg.h   |    9 +-
 sys/dev/pci/bktr/bktr_tuner.c |   13 +-
 9 files changed, 293 insertions(+), 147 deletions(-)

diffs (truncated from 868 to 300 lines):

diff -r 1e05268b7e41 -r 3406b80da3e9 sys/dev/pci/bktr/TODO
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/bktr/TODO     Sun May 07 00:24:33 2000 +0000
@@ -0,0 +1,17 @@
+Things to do for the bktr driver, in no special order:
+
+o check for a possibility to replace remaining vtophys()
+o clean up whitespace before and after braces ("( " -> "(")
+o clean up bt8xx.h
+o replace vm_offset_t (still any left?)
+o not tested on anything but i386 -- alpha/macppc probably will have
+  some issues.
+o use NetBSD's own i2c-functions
+o look for cause of warning (without consequence, as far as I can
+  tell): 
+  bktr0: ioctl: tsleep error 35 200001c
+o split up contents of bktr directory to better places? (also fix
+  bktr2netbsd in that case)
+o use NetBSD PCI listings for recognition of cards.
+o write man page
+o remove #ifdef FreeBSD/OpenBSD code (?)
\ No newline at end of file
diff -r 1e05268b7e41 -r 3406b80da3e9 sys/dev/pci/bktr/bktr2netbsd
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/bktr/bktr2netbsd      Sun May 07 00:24:33 2000 +0000
@@ -0,0 +1,129 @@
+#! /bin/sh
+#
+#      $NetBSD: bktr2netbsd,v 1.1 2000/05/07 00:24:33 wiz Exp $
+#
+# Copyright (c) 2000 The NetBSD Foundation, Inc.
+# 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. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#      This product includes software developed by the NetBSD
+#      Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+#    contributors may be used to endorse or promote products derived
+#    from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``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 FOUNDATION OR CONTRIBUTORS
+# 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.
+#
+# bktr2netbsd:  convert a bktr source directory tree into a
+# netbsd bktr source tree, under sys/dev/pci/bktr
+# based on bind2netbsd by Bernd Ernesti
+
+if [ $# -ne 2 ]; then echo "bktr2netbsd src dest"; exit 1; fi
+
+r=$1
+d=$2/sys/dev/pci/bktr
+
+case "$d" in
+       /*)
+               ;;
+       *)
+               d=`/bin/pwd`/$d
+               ;;
+esac
+
+case "$r" in
+       /*)
+               ;;
+       *)
+               r=`/bin/pwd`/$r
+               ;;
+esac
+
+echo preparing directory $d
+rm -rf $d
+mkdir -p $d
+
+### Copy the files
+echo copying $r to $d
+cd $r
+pax -rw * $d
+
+echo removing unneeded files
+
+### Remove unneeded files
+cd $d
+rm CHANGELOG.TXT README.* bktr_i2c.[ch]
+
+### Remove the $'s around RCS tags
+find $d -type f -print | xargs egrep -l '\$(Id|Created|Header|FreeBSD)' | while read f; do
+       sed -e 's/\$\(Id.*\) \$/\1/' \
+           -e 's/\$\(Created.*\) \$/\1/' \
+           -e 's/\$\(FreeBSD.*\) \$/\1/' \
+           -e 's/\$\(Header.*\) \$/\1/' \
+           < $f > /tmp/bktr1f$$ && mv /tmp/bktr1f$$ $f && \
+       echo removed \$RCS tag from $f
+done
+
+### create bt8xx.h from ioctl_meteor.h and ioctl_bt848.h
+echo merging ioctl_meteor.h and ioctl_bt848.h to bt8xx.h
+echo "/* This file is merged from ioctl_meteor.h and ioctl_bt848.h from FreeBSD. */" > bt8xx.h
+echo "/* The copyright below only applies to the ioctl_meteor.h part of this file. */" >> bt8xx.h
+cat ioctl_meteor.h ioctl_bt848.h | grep -v _MACHINE_IOCTL_METEOR_H_ | \
+       grep -v _MACHINE_IOCTL_BT848_H >> bt8xx.h
+rm ioctl_meteor.h ioctl_bt848.h
+
+### Add our NetBSD RCS Id
+find $d -name '*.[chly]' -print | while read c; do
+       sed 1q < $c | grep -q '\$NetBSD' || (
+echo "/*       \$NetBSD\$      */" >/tmp/bktr3n$$
+echo "" >>/tmp/bktr3n$$
+cat $c  >> /tmp/bktr3n$$
+mv /tmp/bktr3n$$ $c && echo added NetBSD RCS tag to $c
+       )
+done
+
+echo done
+
+### move bt8xx.h to correct place
+echo moving bt8xx.h to dev/ic
+mkdir -p $d/../../ic
+mv bt8xx.h $d/../../ic
+
+### Clean up any CVS directories that might be around.
+echo "cleaning up CVS residue."
+(
+       cd $d
+       find . -type d -name "CVS" -print | xargs rm -r
+)
+echo done
+
+### Fixing file and directory permissions.
+echo "Fixing file/directory permissions."
+(
+       cd $d
+       find . -type f -print | xargs chmod u+rw,go+r
+       find . -type d -print | xargs chmod u+rwx,go+rx
+)
+echo done
+
+echo Do not forget to also import bt8xx.h in dev/ic!
+exit 0
diff -r 1e05268b7e41 -r 3406b80da3e9 sys/dev/pci/bktr/bktr_audio.c
--- a/sys/dev/pci/bktr/bktr_audio.c     Sun May 07 00:17:13 2000 +0000
+++ b/sys/dev/pci/bktr/bktr_audio.c     Sun May 07 00:24:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bktr_audio.c,v 1.1.1.1 2000/05/07 00:16:17 wiz Exp $   */
+/*     $NetBSD: bktr_audio.c,v 1.2 2000/05/07 00:24:33 wiz Exp $       */
 
 /* FreeBSD: src/sys/dev/bktr/bktr_audio.c,v 1.2 1999/10/28 13:58:14 roger Exp */
 /*
@@ -60,27 +60,30 @@
 #ifdef __FreeBSD__
 #include <machine/clock.h>             /* for DELAY */
 #include <pci/pcivar.h>
-#endif
 
 #if (__FreeBSD_version >=300000)
 #include <machine/bus_memio.h>         /* for bus space */
 #include <machine/bus.h>
 #include <sys/bus.h>
 #endif
+#endif
 
 #ifdef __NetBSD__
-#include <dev/ic/ioctl_meteor.h>       /* NetBSD location of .h files */
-#include <dev/ic/ioctl_bt848.h>
+#include <dev/ic/bt8xx.h>      /* NetBSD location of .h files */
+#include <dev/pci/bktr/bktr_reg.h>
+#include <dev/pci/bktr/bktr_core.h>
+#include <dev/pci/bktr/bktr_tuner.h>
+#include <dev/pci/bktr/bktr_card.h>
+#include <dev/pci/bktr/bktr_audio.h>
 #else
 #include <machine/ioctl_meteor.h>      /* Traditional location of .h files */
 #include <machine/ioctl_bt848.h>        /* extensions to ioctl_meteor.h */
-#endif
 #include <dev/bktr/bktr_reg.h>
 #include <dev/bktr/bktr_core.h>
 #include <dev/bktr/bktr_tuner.h>
 #include <dev/bktr/bktr_card.h>
 #include <dev/bktr/bktr_audio.h>
-
+#endif
 
 /*
  * Prototypes for the GV_BCTV specific functions.
diff -r 1e05268b7e41 -r 3406b80da3e9 sys/dev/pci/bktr/bktr_card.c
--- a/sys/dev/pci/bktr/bktr_card.c      Sun May 07 00:17:13 2000 +0000
+++ b/sys/dev/pci/bktr/bktr_card.c      Sun May 07 00:24:33 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bktr_card.c,v 1.1.1.1 2000/05/07 00:16:18 wiz Exp $    */
+/*     $NetBSD: bktr_card.c,v 1.2 2000/05/07 00:24:33 wiz Exp $        */
 
 /* FreeBSD: src/sys/dev/bktr/bktr_card.c,v 1.9 2000/02/12 08:49:21 peter Exp */
 
@@ -58,26 +58,30 @@
 #ifdef __FreeBSD__
 #include <machine/clock.h>      /* for DELAY */
 #include <pci/pcivar.h>
-#endif
 
 #if (__FreeBSD_version >=300000)
 #include <machine/bus_memio.h> /* for bus space */
 #include <machine/bus.h>
 #include <sys/bus.h>
 #endif
+#endif
 
 #ifdef __NetBSD__
-#include <dev/ic/ioctl_meteor.h>       /* NetBSD location for .h files */
-#include <dev/ic/ioctl_bt848.h>
+#include <dev/ic/bt8xx.h>      /* NetBSD location for .h files */
+#include <dev/pci/bktr/bktr_reg.h>
+#include <dev/pci/bktr/bktr_core.h>
+#include <dev/pci/bktr/bktr_tuner.h>
+#include <dev/pci/bktr/bktr_card.h>
+#include <dev/pci/bktr/bktr_audio.h>
 #else
 #include <machine/ioctl_meteor.h>      /* Traditional location for .h files */
 #include <machine/ioctl_bt848.h>        /* extensions to ioctl_meteor.h */
-#endif
 #include <dev/bktr/bktr_reg.h>
 #include <dev/bktr/bktr_core.h>
 #include <dev/bktr/bktr_tuner.h>
 #include <dev/bktr/bktr_card.h>
 #include <dev/bktr/bktr_audio.h>
+#endif
 
 #ifdef __NetBSD__
 static int bootverbose = 1;
@@ -112,7 +116,7 @@
 #define PFC8582_WADDR           0xa0
 #define PFC8582_RADDR          0xa1
 
-#if BROOKTREE_SYSTEM_DEFAULT == BROOKTREE_PAL
+#if BKTR_SYSTEM_DEFAULT == BROOKTREE_PAL
 #define DEFAULT_TUNER   PHILIPS_PALI
 #else
 #define DEFAULT_TUNER   PHILIPS_NTSC
@@ -476,9 +480,9 @@
 
 /*
  * determine the card brand/model
- * OVERRIDE_CARD, OVERRIDE_TUNER, OVERRIDE_DBX and OVERRIDE_MSP
- * can be used to select a specific device, regardless of the
- * autodetection and i2c device checks.
+ * BKTR_OVERRIDE_CARD, BKTR_OVERRIDE_TUNER, BKTR_OVERRIDE_DBX and
+ * BKTR_OVERRIDE_MSP can be used to select a specific device,
+ * regardless of the autodetection and i2c device checks.
  *
  * The scheme used for probing cards faces these problems:
  *  It is impossible to work out which type of tuner is actually fitted,
@@ -564,8 +568,8 @@
 
 
        /* Check for a user specified override on the card selection */
-#if defined( OVERRIDE_CARD )
-       bktr->card = cards[ (card = OVERRIDE_CARD) ];
+#if defined( BKTR_OVERRIDE_CARD )
+       bktr->card = cards[ (card = BKTR_OVERRIDE_CARD) ];
        goto checkEEPROM;
 #endif
        if (bktr->bt848_card != -1 ) {
@@ -785,8 +789,8 @@
                goto checkDBX;
        }
 
-#if defined( OVERRIDE_TUNER )
-       select_tuner( bktr, OVERRIDE_TUNER );
+#if defined( BKTR_OVERRIDE_TUNER )
+       select_tuner( bktr, BKTR_OVERRIDE_TUNER );
        goto checkDBX;
 #endif
        if (bktr->bt848_tuner != -1 ) {
@@ -1002,7 +1006,7 @@
            break;
 
        case CARD_LEADTEK:
-#if BROOKTREE_SYSTEM_DEFAULT == BROOKTREE_PAL
+#if BKTR_SYSTEM_DEFAULT == BROOKTREE_PAL
            select_tuner( bktr, PHILIPS_FR1216_PAL );
 #else
            select_tuner( bktr, PHILIPS_FR1236_NTSC );
@@ -1037,8 +1041,8 @@
 
 



Home | Main Index | Thread Index | Old Index