Some NetBSD specific changes; also TODO, and import script, based
on bind2netbsd by Bernd Ernesti
This commit is contained in:
parent
c2f780fbfd
commit
5f8b869a3e
|
@ -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 (?)
|
|
@ -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
|
|
@ -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 @@ static int bootverbose = 1;
|
|||
#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.
|
||||
|
|
|
@ -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 @@ static int bootverbose = 1;
|
|||
#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 @@ static int locate_eeprom_address( bktr_ptr_t bktr) {
|
|||
|
||||
/*
|
||||
* 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 @@ probeCard( bktr_ptr_t bktr, int verbose, int unit )
|
|||
|
||||
|
||||
/* 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 @@ checkTuner:
|
|||
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 @@ checkTuner:
|
|||
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 @@ checkTuner:
|
|||
|
||||
|
||||
checkDBX:
|
||||
#if defined( OVERRIDE_DBX )
|
||||
bktr->card.dbx = OVERRIDE_DBX;
|
||||
#if defined( BKTR_OVERRIDE_DBX )
|
||||
bktr->card.dbx = BKTR_OVERRIDE_DBX;
|
||||
goto checkMSP;
|
||||
#endif
|
||||
/* Check for i2c devices */
|
||||
|
@ -1075,8 +1079,8 @@ checkMSP:
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined( OVERRIDE_MSP )
|
||||
bktr->card.msp3400c = OVERRIDE_MSP;
|
||||
#if defined( BKTR_OVERRIDE_MSP )
|
||||
bktr->card.msp3400c = BKTR_OVERRIDE_MSP;
|
||||
goto checkMSPEnd;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bktr_card.h,v 1.1.1.1 2000/05/07 00:16:18 wiz Exp $ */
|
||||
/* $NetBSD: bktr_card.h,v 1.2 2000/05/07 00:24:33 wiz Exp $ */
|
||||
|
||||
/* FreeBSD: src/sys/dev/bktr/bktr_card.h,v 1.2 1999/09/27 08:04:55 roger Exp */
|
||||
|
||||
|
@ -52,8 +52,8 @@
|
|||
/*
|
||||
* If probeCard() fails to detect the correct card on boot you can
|
||||
* override it by setting adding the following option to your kernel config
|
||||
* options OVERRIDE_CARD <card type>
|
||||
* eg options OVERRIDE CARD=1
|
||||
* options BKTR_OVERRIDE_CARD <card type>
|
||||
* eg options BKTR_OVERRIDE CARD=1
|
||||
*
|
||||
* or using the sysclt hw.bt848.card
|
||||
* eg sysctl -w hw.bt848.card=1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bktr_core.c,v 1.1.1.1 2000/05/07 00:16:18 wiz Exp $ */
|
||||
/* $NetBSD: bktr_core.c,v 1.2 2000/05/07 00:24:33 wiz Exp $ */
|
||||
|
||||
/* FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.106 2000/04/16 07:50:08 roger Exp */
|
||||
|
||||
|
@ -177,14 +177,13 @@ typedef unsigned int uintptr_t;
|
|||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
#include <sys/inttypes.h> /* uintptr_t */
|
||||
#include <dev/ic/ioctl_meteor.h>
|
||||
#include <dev/ic/ioctl_bt848.h> /* extensions to ioctl_meteor.h */
|
||||
#include <dev/bktr/bktr_reg.h>
|
||||
#include <dev/bktr/bktr_tuner.h>
|
||||
#include <dev/bktr/bktr_card.h>
|
||||
#include <dev/bktr/bktr_audio.h>
|
||||
#include <dev/bktr/bktr_core.h>
|
||||
#include <dev/bktr/bktr_os.h>
|
||||
#include <dev/ic/bt8xx.h>
|
||||
#include <dev/pci/bktr/bktr_reg.h>
|
||||
#include <dev/pci/bktr/bktr_tuner.h>
|
||||
#include <dev/pci/bktr/bktr_card.h>
|
||||
#include <dev/pci/bktr/bktr_audio.h>
|
||||
#include <dev/pci/bktr/bktr_core.h>
|
||||
#include <dev/pci/bktr/bktr_os.h>
|
||||
|
||||
static int bootverbose = 1;
|
||||
|
||||
|
@ -446,12 +445,16 @@ common_bktr_attach( bktr_ptr_t bktr, int unit, u_long pci_id, u_int rev )
|
|||
/***************************************/
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
/* allocate space for dma program */
|
||||
bktr->dma_prog = get_bktr_mem(bktr, &bktr->dm_prog, DMA_PROG_ALLOC);
|
||||
bktr->odd_dma_prog = get_bktr_mem(bktr, &bktr->dm_oprog, DMA_PROG_ALLOC)
|
||||
;
|
||||
/* allocte space for the VBI buffer */
|
||||
bktr->vbidata = get_bktr_mem(bktr, &bktr->dm_vbidata, VBI_DATA_SIZE);
|
||||
bktr->vbibuffer = get_bktr_mem(bktr, &bktr->dm_vbibuffer, VBI_BUFFER_SIZE);
|
||||
bktr->dma_prog = get_bktr_mem(bktr, &bktr->dm_prog,
|
||||
DMA_PROG_ALLOC);
|
||||
bktr->odd_dma_prog = get_bktr_mem(bktr, &bktr->dm_oprog,
|
||||
DMA_PROG_ALLOC);
|
||||
|
||||
/* allocate space for the VBI buffer */
|
||||
bktr->vbidata = get_bktr_mem(bktr, &bktr->dm_vbidata,
|
||||
VBI_DATA_SIZE);
|
||||
bktr->vbibuffer = get_bktr_mem(bktr, &bktr->dm_vbibuffer,
|
||||
VBI_BUFFER_SIZE);
|
||||
|
||||
/* allocate space for pixel buffer */
|
||||
if ( BROOKTREE_ALLOC )
|
||||
|
@ -2668,7 +2671,7 @@ rgb_vbi_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
|
|||
*dma_prog++ = 0;
|
||||
for(i = 0; i < vbilines; i++) {
|
||||
*dma_prog++ = OP_WRITE | OP_SOL | OP_EOL | vbisamples;
|
||||
*dma_prog++ = (u_long) vtophys(bktr->vbidata +
|
||||
*dma_prog++ = (u_long) vtophys((caddr_t)bktr->vbidata +
|
||||
(i * VBI_LINE_SIZE));
|
||||
}
|
||||
|
||||
|
@ -2719,7 +2722,7 @@ rgb_vbi_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace )
|
|||
*dma_prog++ = 0;
|
||||
for(i = 0; i < vbilines; i++) {
|
||||
*dma_prog++ = OP_WRITE | OP_SOL | OP_EOL | vbisamples;
|
||||
*dma_prog++ = (u_long) vtophys(bktr->vbidata +
|
||||
*dma_prog++ = (u_long) vtophys((caddr_t)bktr->vbidata +
|
||||
((i+MAX_VBI_LINES) * VBI_LINE_SIZE));
|
||||
}
|
||||
|
||||
|
@ -4121,7 +4124,7 @@ i2cProbe( bktr_ptr_t bktr, int addr )
|
|||
DELAY( BITD ); /* release clock */
|
||||
}
|
||||
else {
|
||||
OUTL(bktr, BKTR_I2C_DATA_CTL, 0 ;
|
||||
OUTL(bktr, BKTR_I2C_DATA_CTL, 0);
|
||||
DELAY( BITD ); /* assert LO data */
|
||||
OUTL(bktr, BKTR_I2C_DATA_CTL, 2);
|
||||
DELAY( BITD ); /* strobe clock */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bktr_os.c,v 1.1.1.1 2000/05/07 00:16:18 wiz Exp $ */
|
||||
/* $NetBSD: bktr_os.c,v 1.2 2000/05/07 00:24:34 wiz Exp $ */
|
||||
|
||||
/* FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.7 2000/04/16 07:50:09 roger Exp */
|
||||
|
||||
|
@ -109,18 +109,23 @@
|
|||
#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_tuner.h>
|
||||
#include <dev/pci/bktr/bktr_card.h>
|
||||
#include <dev/pci/bktr/bktr_audio.h>
|
||||
#include <dev/pci/bktr/bktr_core.h>
|
||||
#include <dev/pci/bktr/bktr_os.h>
|
||||
#else /* Traditional location for .h files */
|
||||
#include <machine/ioctl_meteor.h>
|
||||
#include <machine/ioctl_bt848.h> /* extensions to ioctl_meteor.h */
|
||||
#endif
|
||||
#include <dev/bktr/bktr_reg.h>
|
||||
#include <dev/bktr/bktr_tuner.h>
|
||||
#include <dev/bktr/bktr_card.h>
|
||||
#include <dev/bktr/bktr_audio.h>
|
||||
#include <dev/bktr/bktr_core.h>
|
||||
#include <dev/bktr/bktr_os.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if (NSMBUS > 0)
|
||||
|
@ -1223,7 +1228,6 @@ int bktr_poll( dev_t dev, int events, struct proc *p)
|
|||
/*****************************/
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
|
||||
|
||||
#define IPL_VIDEO IPL_BIO /* XXX */
|
||||
|
||||
static int bktr_intr(void *arg) { return common_bktr_intr(arg); }
|
||||
|
@ -1245,7 +1249,7 @@ int bktr_mmap __P((dev_t, vm_offset_t, int));
|
|||
vm_offset_t vm_page_alloc_contig(vm_offset_t, vm_offset_t,
|
||||
vm_offset_t, vm_offset_t);
|
||||
|
||||
#if defined(__BROKEN_INDIRECT_CONFIG) || defined(__OpenBSD__)
|
||||
#if defined(__OpenBSD__)
|
||||
static int bktr_probe __P((struct device *, void *, void *));
|
||||
#else
|
||||
static int bktr_probe __P((struct device *, struct cfdata *, void *));
|
||||
|
@ -1264,9 +1268,10 @@ struct cfdriver bktr_cd = {
|
|||
};
|
||||
#endif
|
||||
|
||||
int bktr_probe(parent, match, aux)
|
||||
struct device *parent;
|
||||
#if defined(__BROKEN_INDIRECT_CONFIG) || defined(__OpenBSD__)
|
||||
int
|
||||
bktr_probe(parent, match, aux)
|
||||
struct device *parent;
|
||||
#if defined(__OpenBSD__)
|
||||
void *match;
|
||||
#else
|
||||
struct cfdata *match;
|
||||
|
@ -1290,7 +1295,7 @@ int bktr_probe(parent, match, aux)
|
|||
* the attach routine.
|
||||
*/
|
||||
static void
|
||||
bktr_attach __P((struct device *parent, struct device *self, void *aux))
|
||||
bktr_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
bktr_ptr_t bktr;
|
||||
u_long latency;
|
||||
|
@ -1369,14 +1374,15 @@ bktr_attach __P((struct device *parent, struct device *self, void *aux))
|
|||
* map memory
|
||||
*/
|
||||
retval = pci_mapreg_map(pa, PCI_MAPREG_START,
|
||||
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
|
||||
&bktr->memt, &bktr->memh, &bktr->phys_base,
|
||||
&bktr->obmemsz);
|
||||
DPR(("pci_mapreg_map: memt %x, memh %x, base %x, size %x\n",
|
||||
bktr->memt, (u_int)bktr->memh,
|
||||
(u_int)bktr->phys_base, (u_int)bktr->obmemsz));
|
||||
PCI_MAPREG_TYPE_MEM
|
||||
| PCI_MAPREG_MEM_TYPE_32BIT, 0,
|
||||
&bktr->memt, &bktr->memh, NULL,
|
||||
&bktr->obmemsz);
|
||||
DPR(("pci_mapreg_map: memt %x, memh %x, size %x\n",
|
||||
bktr->memt, (u_int)bktr->memh, (u_int)bktr->obmemsz));
|
||||
if (retval) {
|
||||
printf("%s: couldn't map memory\n", bktr->bktr_dev.dv_xname);
|
||||
printf("%s: couldn't map memory\n",
|
||||
bktr->bktr_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1391,7 +1397,8 @@ bktr_attach __P((struct device *parent, struct device *self, void *aux))
|
|||
*/
|
||||
if (pci_intr_map(pa->pa_pc, pa->pa_intrtag, pa->pa_intrpin,
|
||||
pa->pa_intrline, &ih)) {
|
||||
printf("%s: couldn't map interrupt\n", bktr->bktr_dev.dv_xname);
|
||||
printf("%s: couldn't map interrupt\n",
|
||||
bktr->bktr_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
intrstr = pci_intr_string(pa->pa_pc, ih);
|
||||
|
@ -1399,11 +1406,11 @@ bktr_attach __P((struct device *parent, struct device *self, void *aux))
|
|||
bktr_intr, bktr);
|
||||
if (bktr->ih == NULL) {
|
||||
printf("%s: couldn't establish interrupt",
|
||||
bktr->bktr_dev.dv_xname);
|
||||
if (intrstr != NULL)
|
||||
printf(" at %s", intrstr);
|
||||
printf("\n");
|
||||
return;
|
||||
bktr->bktr_dev.dv_xname);
|
||||
if (intrstr != NULL)
|
||||
printf(" at %s", intrstr);
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
if (intrstr != NULL)
|
||||
printf("%s: interrupting at %s\n", bktr->bktr_dev.dv_xname,
|
||||
|
@ -1420,8 +1427,8 @@ bktr_attach __P((struct device *parent, struct device *self, void *aux))
|
|||
latency = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_LATENCY_TIMER);
|
||||
latency = (latency >> 8) & 0xff;
|
||||
|
||||
if ( !latency ) {
|
||||
if ( bootverbose ) {
|
||||
if (!latency) {
|
||||
if (bootverbose) {
|
||||
printf("%s: PCI bus latency was 0 changing to %d",
|
||||
bktr->bktr_dev.dv_xname,
|
||||
BROOKTREE_DEF_LATENCY_VALUE);
|
||||
|
@ -1432,17 +1439,18 @@ bktr_attach __P((struct device *parent, struct device *self, void *aux))
|
|||
}
|
||||
|
||||
|
||||
/* Enabled Bus Master and Memory Mapping */
|
||||
/* Enabled Bus Master
|
||||
XXX: check if all old DMA is stopped first (e.g. after warm
|
||||
boot) */
|
||||
fun = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
|
||||
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, fun | 2);
|
||||
fun = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
|
||||
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, fun | 4);
|
||||
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
|
||||
fun | PCI_COMMAND_MASTER_ENABLE);
|
||||
|
||||
/* read the pci id and determine the card type */
|
||||
fun = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_ID_REG);
|
||||
rev = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CLASS_REG) & 0x000000ff;
|
||||
|
||||
common_bktr_attach( bktr, unit, fun, rev );
|
||||
common_bktr_attach(bktr, unit, fun, rev);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1536,40 +1544,39 @@ free_bktr_mem(bktr, dmap, kva)
|
|||
#define TUNER_DEV 0x01
|
||||
#define VBI_DEV 0x02
|
||||
|
||||
#define UNIT(x) ((x) & 0x0f)
|
||||
#define FUNCTION(x) ((x >> 4) & 0x0f)
|
||||
#define UNIT(x) (minor((x) & 0x0f))
|
||||
#define FUNCTION(x) (minor((x >> 4) & 0x0f))
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int
|
||||
bktr_open( dev_t dev, int flags, int fmt, struct proc *p )
|
||||
bktr_open(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
{
|
||||
bktr_ptr_t bktr;
|
||||
int unit;
|
||||
|
||||
unit = UNIT( minor(dev) );
|
||||
unit = UNIT(dev);
|
||||
|
||||
/* unit out of range */
|
||||
if ((unit > bktr_cd.cd_ndevs) || (bktr_cd.cd_devs[unit] == NULL))
|
||||
return( ENXIO );
|
||||
return(ENXIO);
|
||||
|
||||
bktr = bktr_cd.cd_devs[unit];
|
||||
|
||||
|
||||
if (!(bktr->flags & METEOR_INITALIZED)) /* device not found */
|
||||
return( ENXIO );
|
||||
return(ENXIO);
|
||||
|
||||
switch ( FUNCTION( minor(dev) ) ) {
|
||||
switch (FUNCTION(dev)) {
|
||||
case VIDEO_DEV:
|
||||
return( video_open( bktr ) );
|
||||
return(video_open(bktr));
|
||||
case TUNER_DEV:
|
||||
return( tuner_open( bktr ) );
|
||||
return(tuner_open(bktr));
|
||||
case VBI_DEV:
|
||||
return( vbi_open( bktr ) );
|
||||
return(vbi_open(bktr));
|
||||
}
|
||||
|
||||
return( ENXIO );
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1577,56 +1584,48 @@ bktr_open( dev_t dev, int flags, int fmt, struct proc *p )
|
|||
*
|
||||
*/
|
||||
int
|
||||
bktr_close( dev_t dev, int flags, int fmt, struct proc *p )
|
||||
bktr_close(dev_t dev, int flags, int fmt, struct proc *p)
|
||||
{
|
||||
bktr_ptr_t bktr;
|
||||
int unit;
|
||||
|
||||
unit = UNIT( minor(dev) );
|
||||
|
||||
/* unit out of range */
|
||||
if ((unit > bktr_cd.cd_ndevs) || (bktr_cd.cd_devs[unit] == NULL))
|
||||
return( ENXIO );
|
||||
unit = UNIT(dev);
|
||||
|
||||
bktr = bktr_cd.cd_devs[unit];
|
||||
|
||||
switch ( FUNCTION( minor(dev) ) ) {
|
||||
switch (FUNCTION(dev)) {
|
||||
case VIDEO_DEV:
|
||||
return( video_close( bktr ) );
|
||||
return(video_close(bktr));
|
||||
case TUNER_DEV:
|
||||
return( tuner_close( bktr ) );
|
||||
return(tuner_close(bktr));
|
||||
case VBI_DEV:
|
||||
return( vbi_close( bktr ) );
|
||||
return(vbi_close(bktr));
|
||||
}
|
||||
|
||||
return( ENXIO );
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int
|
||||
bktr_read( dev_t dev, struct uio *uio, int ioflag )
|
||||
bktr_read(dev_t dev, struct uio *uio, int ioflag)
|
||||
{
|
||||
bktr_ptr_t bktr;
|
||||
int unit;
|
||||
|
||||
unit = UNIT(minor(dev));
|
||||
|
||||
/* unit out of range */
|
||||
if ((unit > bktr_cd.cd_ndevs) || (bktr_cd.cd_devs[unit] == NULL))
|
||||
return( ENXIO );
|
||||
unit = UNIT(dev);
|
||||
|
||||
bktr = bktr_cd.cd_devs[unit];
|
||||
|
||||
switch ( FUNCTION( minor(dev) ) ) {
|
||||
switch (FUNCTION(dev)) {
|
||||
case VIDEO_DEV:
|
||||
return( video_read( bktr, unit, dev, uio ) );
|
||||
return(video_read(bktr, unit, dev, uio));
|
||||
case VBI_DEV:
|
||||
return( vbi_read( bktr, uio, ioflag ) );
|
||||
return(vbi_read(bktr, uio, ioflag));
|
||||
}
|
||||
|
||||
return( ENXIO );
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1634,72 +1633,65 @@ bktr_read( dev_t dev, struct uio *uio, int ioflag )
|
|||
*
|
||||
*/
|
||||
int
|
||||
bktr_write( dev_t dev, struct uio *uio, int ioflag )
|
||||
bktr_write(dev_t dev, struct uio *uio, int ioflag)
|
||||
{
|
||||
/* operation not supported */
|
||||
return( EOPNOTSUPP );
|
||||
return(EOPNOTSUPP);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int
|
||||
bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr )
|
||||
bktr_ioctl(dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr)
|
||||
{
|
||||
bktr_ptr_t bktr;
|
||||
int unit;
|
||||
|
||||
unit = UNIT(minor(dev));
|
||||
|
||||
/* unit out of range */
|
||||
if ((unit > bktr_cd.cd_ndevs) || (bktr_cd.cd_devs[unit] == NULL))
|
||||
return( ENXIO );
|
||||
unit = UNIT(dev);
|
||||
|
||||
bktr = bktr_cd.cd_devs[unit];
|
||||
|
||||
if (bktr->bigbuf == 0) /* no frame buffer allocated (ioctl failed) */
|
||||
return( ENOMEM );
|
||||
return(ENOMEM);
|
||||
|
||||
switch ( FUNCTION( minor(dev) ) ) {
|
||||
switch (FUNCTION(dev)) {
|
||||
case VIDEO_DEV:
|
||||
return( video_ioctl( bktr, unit, cmd, arg, pr ) );
|
||||
return(video_ioctl(bktr, unit, cmd, arg, pr));
|
||||
case TUNER_DEV:
|
||||
return( tuner_ioctl( bktr, unit, cmd, arg, pr ) );
|
||||
return(tuner_ioctl(bktr, unit, cmd, arg, pr));
|
||||
}
|
||||
|
||||
return( ENXIO );
|
||||
return(ENXIO);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int
|
||||
bktr_mmap( dev_t dev, vm_offset_t offset, int nprot )
|
||||
bktr_mmap(dev_t dev, vm_offset_t offset, int nprot)
|
||||
{
|
||||
int unit;
|
||||
bktr_ptr_t bktr;
|
||||
|
||||
unit = UNIT(minor(dev));
|
||||
unit = UNIT(dev);
|
||||
|
||||
/* unit out of range */
|
||||
if ((unit > bktr_cd.cd_ndevs) || (bktr_cd.cd_devs[unit] == NULL))
|
||||
return( -1 );
|
||||
if (FUNCTION(minor(dev)) > 0)
|
||||
return( -1 );
|
||||
if (FUNCTION(dev) > 0) /* only allow mmap on /dev/bktr[n] */
|
||||
return(-1);
|
||||
|
||||
bktr = bktr_cd.cd_devs[unit];
|
||||
|
||||
if (offset < 0)
|
||||
return( -1 );
|
||||
if ((vaddr_t)offset < 0)
|
||||
return(-1);
|
||||
|
||||
if (offset >= bktr->alloc_pages * PAGE_SIZE)
|
||||
return( -1 );
|
||||
if ((vaddr_t)offset >= bktr->alloc_pages * PAGE_SIZE)
|
||||
return(-1);
|
||||
|
||||
#ifdef __NetBSD__
|
||||
return (bus_dmamem_mmap(bktr->dmat, bktr->dm_mem->dm_segs, 1,
|
||||
offset, nprot, BUS_DMA_WAITOK));
|
||||
(vaddr_t)offset, nprot, BUS_DMA_WAITOK));
|
||||
#else
|
||||
return( i386_btop(vtophys(bktr->bigbuf) + offset) );
|
||||
return(i386_btop(vtophys(bktr->bigbuf) + offset));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bktr_reg.h,v 1.1.1.1 2000/05/07 00:16:18 wiz Exp $ */
|
||||
/* $NetBSD: bktr_reg.h,v 1.2 2000/05/07 00:24:34 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* FreeBSD: src/sys/dev/bktr/bktr_reg.h,v 1.36 1999/10/28 13:58:17 roger Exp
|
||||
|
@ -442,7 +442,7 @@ typedef struct bktr_clip bktr_clip_t;
|
|||
* NetBSD >= 1.3H uses vaddr_t instead of vm_offset_t
|
||||
*/
|
||||
#if defined(__NetBSD__) && __NetBSD_Version__ >= 103080000
|
||||
typedef vaddr_t vm_offset_t;
|
||||
typedef void * vm_offset_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -469,11 +469,6 @@ struct bktr_softc {
|
|||
bus_dmamap_t dm_mem;
|
||||
bus_dmamap_t dm_vbidata;
|
||||
bus_dmamap_t dm_vbibuffer;
|
||||
#if __NetBSD_Version__ >= 103080000
|
||||
paddr_t phys_base; /* Bt848 register physical address */
|
||||
#else
|
||||
vm_offset_t phys_base; /* Bt848 register physical address */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bktr_tuner.c,v 1.1.1.1 2000/05/07 00:16:18 wiz Exp $ */
|
||||
/* $NetBSD: bktr_tuner.c,v 1.2 2000/05/07 00:24:34 wiz Exp $ */
|
||||
|
||||
/* FreeBSD: src/sys/dev/bktr/bktr_tuner.c,v 1.5 2000/01/24 14:00:21 roger Exp */
|
||||
|
||||
|
@ -58,25 +58,28 @@
|
|||
#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 .h file location */
|
||||
#include <dev/ic/ioctl_bt848.h>
|
||||
#include <dev/ic/bt8xx.h> /* NetBSD .h file location */
|
||||
#include <dev/pci/bktr/bktr_reg.h>
|
||||
#include <dev/pci/bktr/bktr_tuner.h>
|
||||
#include <dev/pci/bktr/bktr_card.h>
|
||||
#include <dev/pci/bktr/bktr_core.h>
|
||||
#else
|
||||
#include <machine/ioctl_meteor.h> /* Traditional .h file location */
|
||||
#include <machine/ioctl_bt848.h> /* extensions to ioctl_meteor.h */
|
||||
#endif
|
||||
#include <dev/bktr/bktr_reg.h>
|
||||
#include <dev/bktr/bktr_tuner.h>
|
||||
#include <dev/bktr/bktr_card.h>
|
||||
#include <dev/bktr/bktr_core.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue