diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2007-06-11 08:10:23 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2007-06-11 08:10:23 +0000 |
commit | 9ce30b2fbc554957064fc6f7d62ff9968e656b58 (patch) | |
tree | 77a3f858ad90de047b47d702464f7f7ba5c61d5c /sys/dev/pci/bktr | |
parent | a08f36936d02ad0d6564a4d371996bdf3ecf85fc (diff) |
remove all FreeBSD/NetBSD specific code because we will
never use them and the code is much more readable now
ok jakemsr@
Diffstat (limited to 'sys/dev/pci/bktr')
-rw-r--r-- | sys/dev/pci/bktr/bktr_audio.c | 31 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_card.c | 31 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_core.c | 445 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_os.c | 768 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_os.h | 16 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_reg.h | 123 | ||||
-rw-r--r-- | sys/dev/pci/bktr/bktr_tuner.c | 31 |
7 files changed, 21 insertions, 1424 deletions
diff --git a/sys/dev/pci/bktr/bktr_audio.c b/sys/dev/pci/bktr/bktr_audio.c index 45678135a07..385433a3463 100644 --- a/sys/dev/pci/bktr/bktr_audio.c +++ b/sys/dev/pci/bktr/bktr_audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_audio.c,v 1.8 2006/12/21 02:44:55 krw Exp $ */ +/* $OpenBSD: bktr_audio.c,v 1.9 2007/06/11 08:10:22 robert Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_audio.c,v 1.8 2000/10/31 13:09:56 roger Exp $ */ /* * This is part of the Driver for Video Capture Cards (Frame grabbers) @@ -51,39 +51,14 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/vnode.h> - -#ifdef __FreeBSD__ - -#if (__FreeBSD_version < 500000) -#include <machine/clock.h> /* for DELAY */ -#endif - -#include <pci/pcivar.h> - -#if (__FreeBSD_version >=300000) -#include <machine/bus_memio.h> /* for bus space */ -#include <machine/bus.h> -#include <sys/bus.h> -#endif -#endif - -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/proc.h> -#include <dev/ic/bt8xx.h> /* NetBSD location of .h files */ + +#include <dev/ic/bt8xx.h> /* OpenBSD 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 */ -#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 --git a/sys/dev/pci/bktr/bktr_card.c b/sys/dev/pci/bktr/bktr_card.c index a3fc830814b..aa170f7052f 100644 --- a/sys/dev/pci/bktr/bktr_card.c +++ b/sys/dev/pci/bktr/bktr_card.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_card.c,v 1.14 2007/02/11 20:29:22 miod Exp $ */ +/* $OpenBSD: bktr_card.c,v 1.15 2007/06/11 08:10:22 robert Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_card.c,v 1.16 2000/10/31 13:09:56 roger Exp $ */ /* @@ -52,37 +52,12 @@ #include <sys/systm.h> #include <sys/vnode.h> -#ifdef __FreeBSD__ - -#if (__FreeBSD_version < 500000) -#include <machine/clock.h> /* for DELAY */ -#endif - -#include <pci/pcivar.h> - -#if (__FreeBSD_version >=300000) -#include <machine/bus_memio.h> /* for bus space */ -#include <machine/bus.h> -#include <sys/bus.h> -#endif -#endif - -#if defined(__NetBSD__) || defined(__OpenBSD__) -#include <dev/ic/bt8xx.h> /* NetBSD location for .h files */ +#include <dev/ic/bt8xx.h> /* OpenBSD 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 */ -#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 /* Include the PCI Vendor definitions */ #include <dev/pci/pcidevs.h> @@ -583,7 +558,7 @@ static int locate_eeprom_address( bktr_ptr_t bktr) { * number assigned to the company by the PCI Special Interest Group */ /* Following not confirmed with http://members.hyperlink.net.au/~chart, - so not added to NetBSD's pcidevs */ + so not added to OpenBSD's pcidevs */ #define PCI_VENDOR_LEADTEK_ALT 0x6606 /* this is swapped w/ prod id */ #define PCI_VENDOR_LEADTEK_ALT_2 0x6607 #define PCI_VENDOR_LEADTEK_ALT_3 0x107d diff --git a/sys/dev/pci/bktr/bktr_core.c b/sys/dev/pci/bktr/bktr_core.c index 23c4f680ebf..9afd9893bc6 100644 --- a/sys/dev/pci/bktr/bktr_core.c +++ b/sys/dev/pci/bktr/bktr_core.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_core.c,v 1.22 2007/03/24 16:01:21 art Exp $ */ +/* $OpenBSD: bktr_core.c,v 1.23 2007/06/11 08:10:22 robert Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp $ */ /* @@ -95,95 +95,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifdef __FreeBSD__ -#include "bktr.h" -#endif /* __FreeBSD__ */ - -#if ( \ - (defined(__FreeBSD__) && (NBKTR > 0)) \ - || (defined(__bsdi__)) \ - || (defined(__OpenBSD__)) \ - || (defined(__NetBSD__)) \ - ) - - -/*******************/ -/* *** FreeBSD *** */ -/*******************/ -#ifdef __FreeBSD__ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/signalvar.h> -#include <sys/vnode.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> - -#if (__FreeBSD_version >=400000) || (NSMBUS > 0) -#include <sys/bus.h> /* used by smbus and newbus */ -#endif - -#if (__FreeBSD_version < 500000) -#include <machine/clock.h> /* for DELAY */ -#endif - -#include <pci/pcivar.h> - -#if (__FreeBSD_version >=300000) -#include <machine/bus_memio.h> /* for bus space */ -#include <machine/bus.h> -#include <sys/bus.h> -#endif - -#include <machine/ioctl_meteor.h> -#include <machine/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_os.h> -#include <dev/bktr/bktr_core.h> -#if defined(BKTR_FREEBSD_MODULE) -#include <dev/bktr/bktr_mem.h> -#endif - -#if defined(BKTR_USE_FREEBSD_SMBUS) -#include <dev/bktr/bktr_i2c.h> -#include <dev/smbus/smbconf.h> -#include <dev/iicbus/iiconf.h> -#include "smbus_if.h" -#include "iicbus_if.h" -#endif - -const char * -bktr_name(bktr_ptr_t bktr) -{ - return bktr->bktr_xname; -} - - -#if (__FreeBSD__ == 2) -typedef unsigned int uintptr_t; -#endif -#endif /* __FreeBSD__ */ - - -/****************/ -/* *** BSDI *** */ -/****************/ -#ifdef __bsdi__ -#endif /* __bsdi__ */ - - -/**************************/ -/* *** OpenBSD/NetBSD *** */ -/**************************/ -#if defined(__NetBSD__) || defined(__OpenBSD__) - #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -191,15 +102,7 @@ typedef unsigned int uintptr_t; #include <sys/vnode.h> #include <sys/stdint.h> /* uintptr_t */ -#ifdef __NetBSD__ -#include <uvm/uvm_extern.h> -#endif - -#ifdef __OpenBSD__ #include <dev/rndvar.h> -typedef int intrmask_t; -#endif - #include <dev/ic/bt8xx.h> #include <dev/pci/bktr/bktr_reg.h> #include <dev/pci/bktr/bktr_tuner.h> @@ -208,6 +111,8 @@ typedef int intrmask_t; #include <dev/pci/bktr/bktr_core.h> #include <dev/pci/bktr/bktr_os.h> +typedef int intrmask_t; + static int bt848_format = -1; const char * @@ -216,9 +121,6 @@ bktr_name(bktr_ptr_t bktr) return (bktr->bktr_dev.dv_xname); } -#endif /* __NetBSD__ || __OpenBSD__ */ - - typedef u_char bool_t; @@ -448,7 +350,6 @@ static void remote_read(bktr_ptr_t bktr, struct bktr_remote *remote); int bktr_common_ioctl( bktr_ptr_t bktr, ioctl_cmd_t cmd, caddr_t arg ); -#if !defined(BKTR_USE_FREEBSD_SMBUS) /* * i2c primitives for low level control of i2c bus. Added for MSP34xx control */ @@ -456,9 +357,6 @@ static void i2c_start( bktr_ptr_t bktr); static void i2c_stop( bktr_ptr_t bktr); static int i2c_write_byte( bktr_ptr_t bktr, unsigned char data); static int i2c_read_byte( bktr_ptr_t bktr, unsigned char *data, int last ); -#endif - - /* * the common attach code, used by all OS versions. @@ -471,7 +369,6 @@ common_bktr_attach( bktr_ptr_t bktr, int unit, u_int pci_id, u_int rev ) /***************************************/ /* *** OS Specific memory routines *** */ /***************************************/ -#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, @@ -487,60 +384,11 @@ common_bktr_attach( bktr_ptr_t bktr, int unit, u_int pci_id, u_int rev ) buf = get_bktr_mem(bktr, &bktr->dm_mem, BROOKTREE_ALLOC); else buf = 0; -#endif - -#if defined(__FreeBSD__) || defined(__bsdi__) - int need_to_allocate_memory = 1; - -/* If this is a module, check if there is any currently saved contiguous memory */ -#if defined(BKTR_FREEBSD_MODULE) - if (bktr_has_stored_addresses(unit) == 1) { - /* recover the addresses */ - bktr->dma_prog = bktr_retrieve_address(unit, BKTR_MEM_DMA_PROG); - bktr->odd_dma_prog = bktr_retrieve_address(unit, BKTR_MEM_ODD_DMA_PROG); - bktr->vbidata = bktr_retrieve_address(unit, BKTR_MEM_VBIDATA); - bktr->vbibuffer = bktr_retrieve_address(unit, BKTR_MEM_VBIBUFFER); - buf = bktr_retrieve_address(unit, BKTR_MEM_BUF); - need_to_allocate_memory = 0; - } -#endif - - if (need_to_allocate_memory == 1) { - /* allocate space for dma program */ - bktr->dma_prog = get_bktr_mem(unit, DMA_PROG_ALLOC); - bktr->odd_dma_prog = get_bktr_mem(unit, DMA_PROG_ALLOC); - - /* allocte space for the VBI buffer */ - bktr->vbidata = get_bktr_mem(unit, VBI_DATA_SIZE); - bktr->vbibuffer = get_bktr_mem(unit, VBI_BUFFER_SIZE); - - /* allocate space for pixel buffer */ - if ( BROOKTREE_ALLOC ) - buf = get_bktr_mem(unit, BROOKTREE_ALLOC); - else - buf = 0; - } -#endif /* FreeBSD or BSDi */ - - -/* If this is a module, save the current contiguous memory */ -#if defined(BKTR_FREEBSD_MODULE) -bktr_store_address(unit, BKTR_MEM_DMA_PROG, bktr->dma_prog); -bktr_store_address(unit, BKTR_MEM_ODD_DMA_PROG, bktr->odd_dma_prog); -bktr_store_address(unit, BKTR_MEM_VBIDATA, bktr->vbidata); -bktr_store_address(unit, BKTR_MEM_VBIBUFFER, bktr->vbibuffer); -bktr_store_address(unit, BKTR_MEM_BUF, buf); -#endif - if ( bootverbose ) { printf("%s: buffer size %d, addr 0x%x\n", bktr_name(bktr), BROOKTREE_ALLOC, -#ifdef __FreeBSD__ - vtophys(buf)); -#else bktr->dm_prog->dm_segs->ds_addr); -#endif } if (buf != 0) { @@ -748,11 +596,7 @@ common_bktr_intr( void *arg ) } } -#ifdef __FreeBSD__ - OUTL(bktr, BKTR_RISC_STRT_ADD, vtophys(bktr->dma_prog)); -#else OUTL(bktr, BKTR_RISC_STRT_ADD, bktr->dm_prog->dm_segs->ds_addr); -#endif OUTW(bktr, BKTR_GPIO_DMA_CTL, FIFO_ENABLED); OUTW(bktr, BKTR_GPIO_DMA_CTL, bktr->capcontrol); @@ -763,9 +607,8 @@ common_bktr_intr( void *arg ) OUTB(bktr, BKTR_CAP_CTL, bktr->bktr_cap_ctl); -#ifdef __OpenBSD__ add_video_randomness(tdec_save); -#endif + return 1; } @@ -778,9 +621,7 @@ common_bktr_intr( void *arg ) bktr_status, dstatus, INL(bktr, BKTR_RISC_COUNT) ); */ -#ifdef __OpenBSD__ add_video_randomness(INL(bktr, BKTR_RISC_COUNT)); -#endif /* * Disable future interrupts if a capture mode is not selected. @@ -1714,7 +1555,6 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro /*****************************/ /* *** OS Dependant code *** */ /*****************************/ -#if defined(__NetBSD__) || defined(__OpenBSD__) bus_dmamap_t dmamap; buf = get_bktr_mem(bktr, &dmamap, @@ -1723,14 +1563,6 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro free_bktr_mem(bktr, bktr->dm_mem, bktr->bigbuf); bktr->dm_mem = dmamap; - -#else - buf = get_bktr_mem(unit, temp*PAGE_SIZE); - if (buf != 0) { - kmem_free(kernel_map, bktr->bigbuf, - (bktr->alloc_pages * PAGE_SIZE)); -#endif - bktr->bigbuf = buf; bktr->alloc_pages = temp; if (bootverbose) @@ -2742,11 +2574,7 @@ rgb_vbi_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) pitch = bktr->video.width; } else { -#ifdef __FreeBSD__ - target_buffer = (u_int) vtophys(bktr->bigbuf); -#else target_buffer = bktr->dm_mem->dm_segs->ds_addr; -#endif pitch = cols*Bpp; } @@ -2766,13 +2594,8 @@ rgb_vbi_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(0); for(i = 0; i < vbilines; i++) { *dma_prog++ = htole32(OP_WRITE | OP_SOL | OP_EOL | vbisamples); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys((caddr_t)bktr->vbidata + - (i * VBI_LINE_SIZE)); -#else *dma_prog++ = htole32(bktr->dm_vbidata->dm_segs->ds_addr + (i * VBI_LINE_SIZE)); -#endif } if ( (i_flag == 2/*Odd*/) || (i_flag==3) /*interlaced*/ ) { @@ -2816,13 +2639,8 @@ rgb_vbi_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(0); for(i = 0; i < vbilines; i++) { *dma_prog++ = htole32(OP_WRITE | OP_SOL | OP_EOL | vbisamples); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys((caddr_t)bktr->vbidata + - ((i+MAX_VBI_LINES) * VBI_LINE_SIZE)); -#else *dma_prog++ = htole32(bktr->dm_vbidata->dm_segs->ds_addr + ((i+MAX_VBI_LINES) * VBI_LINE_SIZE)); -#endif } /* store the video image */ @@ -2864,12 +2682,8 @@ rgb_vbi_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int )vtophys(loop_point) ; -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr + ((char *)loop_point - (char *)bktr->dma_prog)); -#endif *dma_prog++ = htole32(0); /* NULL WORD */ } @@ -2917,11 +2731,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) pitch = bktr->video.width; } else { -#ifdef __FreeBSD__ - target_buffer = (u_int) vtophys(bktr->bigbuf); -#else target_buffer = bktr->dm_mem->dm_segs->ds_addr; -#endif pitch = cols*Bpp; } @@ -2962,11 +2772,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 2: @@ -2975,23 +2781,16 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 3: /* sync vro */ *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRO); *dma_prog++ = htole32(0); /* NULL WORD */ + *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog = (u_int) vtophys(bktr->odd_dma_prog); -#else *dma_prog++ = htole32(bktr->dm_oprog->dm_segs->ds_addr); -#endif break; } @@ -3031,11 +2830,7 @@ rgb_prog( bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace ) *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRE); *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_ong ) vtophys(bktr->dma_prog) ; -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif *dma_prog++ = htole32(0); /* NULL WORD */ } @@ -3078,11 +2873,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, if (bktr->video.addr) target_buffer = bktr->video.addr; else -#ifdef __FreeBSD__ - target_buffer = vtophys(bktr->bigbuf); -#else target_buffer = bktr->dm_mem->dm_segs->ds_addr; -#endif buffer = target_buffer; @@ -3106,13 +2897,8 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, /* sync vre */ *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_VRE); *dma_prog++ = htole32(0); /* NULL WORD */ - *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 2: @@ -3120,11 +2906,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_VRO); *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 3: @@ -3132,11 +2914,7 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRO); *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog = (u_int) vtophys(bktr->odd_dma_prog); -#else *dma_prog++ = htole32(bktr->dm_oprog->dm_segs->ds_addr); -#endif break; } @@ -3163,18 +2941,10 @@ yuvpack_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRE); *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif *dma_prog++ = htole32(0); /* NULL WORD */ } @@ -3219,11 +2989,7 @@ yuv422_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace) if (bktr->video.addr) target_buffer = (u_int) bktr->video.addr; else -#ifdef __FreeBSD__ - target_buffer = (u_int) vtophys(bktr->bigbuf); -#else target_buffer = bktr->dm_mem->dm_segs->ds_addr; -#endif buffer = target_buffer; @@ -3250,11 +3016,7 @@ yuv422_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 2: @@ -3262,11 +3024,7 @@ yuv422_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 3: @@ -3274,11 +3032,7 @@ yuv422_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace) *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog = (u_int) vtophys(bktr->odd_dma_prog); -#else *dma_prog++ = htole32(bktr->dm_oprog->dm_segs->ds_addr); -#endif break; } @@ -3306,11 +3060,7 @@ yuv422_prog(bktr_ptr_t bktr, char i_flag, int cols, int rows, int interlace) *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRE); *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog) ; -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif *dma_prog++ = htole32(0); /* NULL WORD */ } @@ -3344,11 +3094,7 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag, if (bktr->video.addr) target_buffer = (u_int) bktr->video.addr; else -#ifdef __FreeBSD__ - target_buffer = (u_int) vtophys(bktr->bigbuf); -#else target_buffer = bktr->dm_mem->dm_segs->ds_addr; -#endif buffer = target_buffer; t1 = buffer; @@ -3378,11 +3124,7 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 2: @@ -3390,22 +3132,14 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int) vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif return; case 3: *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRO); *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog = (u_int) vtophys(bktr->odd_dma_prog); -#else *dma_prog++ = htole32(bktr->dm_oprog->dm_segs->ds_addr); -#endif break; } @@ -3437,11 +3171,7 @@ yuv12_prog( bktr_ptr_t bktr, char i_flag, *dma_prog++ = htole32(OP_SYNC | BKTR_GEN_IRQ | BKTR_RESYNC | BKTR_VRE); *dma_prog++ = htole32(0); /* NULL WORD */ *dma_prog++ = htole32(OP_JUMP); -#ifdef __FreeBSD__ - *dma_prog++ = (u_int )vtophys(bktr->dma_prog); -#else *dma_prog++ = htole32(bktr->dm_prog->dm_segs->ds_addr); -#endif *dma_prog++ = htole32(0); /* NULL WORD */ } @@ -3600,11 +3330,7 @@ build_dma_prog( bktr_ptr_t bktr, char i_flag ) break; } -#ifdef __FreeBSD__ - OUTL(bktr, BKTR_RISC_STRT_ADD, vtophys(bktr->dma_prog)); -#else OUTL(bktr, BKTR_RISC_STRT_ADD, bktr->dm_prog->dm_segs->ds_addr); -#endif rows = bktr->rows; cols = bktr->cols; @@ -3713,11 +3439,7 @@ start_capture( bktr_ptr_t bktr, unsigned type ) } -#ifdef __FreeBSD__ - OUTL(bktr, BKTR_RISC_STRT_ADD, vtophys(bktr->dma_prog)); -#else OUTL(bktr, BKTR_RISC_STRT_ADD, bktr->dm_prog->dm_segs->ds_addr); -#endif } @@ -3861,155 +3583,6 @@ static int oformat_meteor_to_bt( u_int format ) BT848_DATA_CTL_I2CSCL | \ BT848_DATA_CTL_I2CSDA) -/* Select between old i2c code and new iicbus / smbus code */ -#if defined(BKTR_USE_FREEBSD_SMBUS) - -/* - * The hardware interface is actually SMB commands - */ -int -i2cWrite( bktr_ptr_t bktr, int addr, int byte1, int byte2 ) -{ - char cmd; - - if (bktr->id == BROOKTREE_848 || - bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849A) - cmd = I2C_COMMAND; - else - cmd = I2C_COMMAND_878; - - if (byte2 != -1) { - if (smbus_writew(bktr->i2c_sc.smbus, addr, cmd, - (short)(((byte2 & 0xff) << 8) | (byte1 & 0xff)))) - return (-1); - } else { - if (smbus_writeb(bktr->i2c_sc.smbus, addr, cmd, - (char)(byte1 & 0xff))) - return (-1); - } - - /* return OK */ - return( 0 ); -} - -int -i2cRead( bktr_ptr_t bktr, int addr ) -{ - char result; - char cmd; - - if (bktr->id == BROOKTREE_848 || - bktr->id == BROOKTREE_848A || - bktr->id == BROOKTREE_849A) - cmd = I2C_COMMAND; - else - cmd = I2C_COMMAND_878; - - if (smbus_readb(bktr->i2c_sc.smbus, addr, cmd, &result)) - return (-1); - - return ((int)((unsigned char)result)); -} - -#define IICBUS(bktr) ((bktr)->i2c_sc.iicbus) - -/* The MSP34xx and DPL35xx Audio chip require i2c bus writes of up */ -/* to 5 bytes which the bt848 automated i2c bus controller cannot handle */ -/* Therefore we need low level control of the i2c bus hardware */ - -/* Write to the MSP or DPL registers */ -void -msp_dpl_write(bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr, unsigned int data) -{ - unsigned char addr_l, addr_h, data_h, data_l ; - - addr_h = (addr >>8) & 0xff; - addr_l = addr & 0xff; - data_h = (data >>8) & 0xff; - data_l = data & 0xff; - - iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */); - - iicbus_write_byte(IICBUS(bktr), dev, 0); - iicbus_write_byte(IICBUS(bktr), addr_h, 0); - iicbus_write_byte(IICBUS(bktr), addr_l, 0); - iicbus_write_byte(IICBUS(bktr), data_h, 0); - iicbus_write_byte(IICBUS(bktr), data_l, 0); - - iicbus_stop(IICBUS(bktr)); - - return; -} - -/* Read from the MSP or DPL registers */ -unsigned int -msp_dpl_read(bktr_ptr_t bktr, int i2c_addr, unsigned char dev, unsigned int addr) -{ - unsigned int data; - unsigned char addr_l, addr_h, dev_r; - int read; - u_char data_read[2]; - - addr_h = (addr >>8) & 0xff; - addr_l = addr & 0xff; - dev_r = dev+1; - - /* XXX errors ignored */ - iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */); - - iicbus_write_byte(IICBUS(bktr), dev_r, 0); - iicbus_write_byte(IICBUS(bktr), addr_h, 0); - iicbus_write_byte(IICBUS(bktr), addr_l, 0); - - iicbus_repeated_start(IICBUS(bktr), i2c_addr +1, 0 /* no timeout? */); - iicbus_read(IICBUS(bktr), data_read, 2, &read, IIC_LAST_READ, 0); - iicbus_stop(IICBUS(bktr)); - - data = (data_read[0]<<8) | data_read[1]; - - return (data); -} - -/* Reset the MSP or DPL chip */ -/* The user can block the reset (which is handy if you initialise the - * MSP and/or DPL audio in another operating system first (eg in Windows) - */ -void -msp_dpl_reset( bktr_ptr_t bktr, int i2c_addr ) -{ - -#ifndef BKTR_NO_MSP_RESET - /* put into reset mode */ - iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */); - iicbus_write_byte(IICBUS(bktr), 0x00, 0); - iicbus_write_byte(IICBUS(bktr), 0x80, 0); - iicbus_write_byte(IICBUS(bktr), 0x00, 0); - iicbus_stop(IICBUS(bktr)); - - /* put back to operational mode */ - iicbus_start(IICBUS(bktr), i2c_addr, 0 /* no timeout? */); - iicbus_write_byte(IICBUS(bktr), 0x00, 0); - iicbus_write_byte(IICBUS(bktr), 0x00, 0); - iicbus_write_byte(IICBUS(bktr), 0x00, 0); - iicbus_stop(IICBUS(bktr)); -#endif - return; -} - -static void remote_read(bktr_ptr_t bktr, struct bktr_remote *remote) { - int read; - - /* XXX errors ignored */ - iicbus_start(IICBUS(bktr), bktr->remote_control_addr, 0 /* no timeout? */); - iicbus_read(IICBUS(bktr), remote->data, 3, &read, IIC_LAST_READ, 0); - iicbus_stop(IICBUS(bktr)); - - return; -} - -#else /* defined(BKTR_USE_FREEBSD_SMBUS) */ - /* * Program the i2c bus directly */ @@ -4263,9 +3836,6 @@ static void remote_read(bktr_ptr_t bktr, struct bktr_remote *remote) { return; } -#endif /* defined(BKTR_USE_FREEBSD_SMBUS) */ - - #if defined( I2C_SOFTWARE_PROBE ) /* @@ -4333,8 +3903,3 @@ i2cProbe( bktr_ptr_t bktr, int addr ) #undef BITD #endif /* I2C_SOFTWARE_PROBE */ - - -#define ABSENT (-1) - -#endif /* FreeBSD, BSDI, NetBSD, OpenBSD */ diff --git a/sys/dev/pci/bktr/bktr_os.c b/sys/dev/pci/bktr/bktr_os.c index bcc96e16f9b..5d71c7c237b 100644 --- a/sys/dev/pci/bktr/bktr_os.c +++ b/sys/dev/pci/bktr/bktr_os.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_os.c,v 1.25 2007/02/11 20:29:22 miod Exp $ */ +/* $OpenBSD: bktr_os.c,v 1.26 2007/06/11 08:10:22 robert Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp $ */ /* @@ -48,91 +48,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ - -#ifdef __FreeBSD__ -#include "bktr.h" -#endif /* __FreeBSD__ */ - #define FIFO_RISC_DISABLED 0 #define ALL_INTS_DISABLED 0 - -/*******************/ -/* *** FreeBSD *** */ -/*******************/ -#ifdef __FreeBSD__ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/uio.h> -#include <sys/kernel.h> -#include <sys/signalvar.h> -#include <sys/mman.h> -#include <sys/poll.h> -#include <sys/selinfo.h> -#include <sys/vnode.h> - -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> - -#if (__FreeBSD_version >=400000) || (NSMBUS > 0) -#include <sys/bus.h> /* used by smbus and newbus */ -#endif - -#if (__FreeBSD_version >=300000) -#include <machine/bus_memio.h> /* used by bus space */ -#include <machine/bus.h> /* used by bus space and newbus */ -#include <sys/bus.h> -#endif - -#if (__FreeBSD_version >=400000) -#include <sys/rman.h> /* used by newbus */ -#include <machine/resource.h> /* used by newbus */ -#endif - -#if (__FreeBSD_version < 500000) -#include <machine/clock.h> /* for DELAY */ -#endif - -#include <pci/pcivar.h> -#include <pci/pcireg.h> - -#include <sys/sysctl.h> -int bt848_card = -1; -int bt848_tuner = -1; -int bt848_reverse_mute = -1; -int bt848_format = -1; -int bt848_slow_msp_audio = -1; - -SYSCTL_NODE(_hw, OID_AUTO, bt848, CTLFLAG_RW, 0, "Bt848 Driver mgmt"); -SYSCTL_INT(_hw_bt848, OID_AUTO, card, CTLFLAG_RW, &bt848_card, -1, ""); -SYSCTL_INT(_hw_bt848, OID_AUTO, tuner, CTLFLAG_RW, &bt848_tuner, -1, ""); -SYSCTL_INT(_hw_bt848, OID_AUTO, reverse_mute, CTLFLAG_RW, &bt848_reverse_mute, -1, ""); -SYSCTL_INT(_hw_bt848, OID_AUTO, format, CTLFLAG_RW, &bt848_format, -1, ""); -SYSCTL_INT(_hw_bt848, OID_AUTO, slow_msp_audio, CTLFLAG_RW, &bt848_slow_msp_audio, -1, ""); - -#if (__FreeBSD__ == 2) -#define PCIR_REVID PCI_CLASS_REG -#endif - -#endif /* end freebsd section */ - - - -/****************/ -/* *** BSDI *** */ -/****************/ -#ifdef __bsdi__ -#endif /* __bsdi__ */ - - -/**************************/ -/* *** OpenBSD/NetBSD *** */ -/**************************/ -#if defined(__NetBSD__) || defined(__OpenBSD__) - #include "radio.h" #include <sys/param.h> @@ -163,665 +81,14 @@ int bktr_debug = 1; #else #define DPR(x) #endif -#endif /* __NetBSD__ || __OpenBSD__ */ - -#if defined(__NetBSD__) || defined(__OpenBSD__) -#include <dev/ic/bt8xx.h> /* NetBSD location for .h files */ +#include <dev/ic/bt8xx.h> /* OpenBSD 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 */ -#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> -#if defined(BKTR_USE_FREEBSD_SMBUS) -#include <dev/bktr/bktr_i2c.h> -#endif -#endif - - - -/****************************/ -/* *** FreeBSD 4.x code *** */ -/****************************/ -#if (__FreeBSD_version >= 400000) - -static int bktr_probe( device_t dev ); -static int bktr_attach( device_t dev ); -static int bktr_detach( device_t dev ); -static int bktr_shutdown( device_t dev ); -static void bktr_intr(void *arg) { common_bktr_intr(arg); } - -static device_method_t bktr_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, bktr_probe), - DEVMETHOD(device_attach, bktr_attach), - DEVMETHOD(device_detach, bktr_detach), - DEVMETHOD(device_shutdown, bktr_shutdown), - - { 0, 0 } -}; - -static driver_t bktr_driver = { - "bktr", - bktr_methods, - sizeof(struct bktr_softc), -}; - -static devclass_t bktr_devclass; - -static d_open_t bktr_open; -static d_close_t bktr_close; -static d_read_t bktr_read; -static d_write_t bktr_write; -static d_ioctl_t bktr_ioctl; -static d_mmap_t bktr_mmap; -static d_poll_t bktr_poll; - -#define CDEV_MAJOR 92 -static struct cdevsw bktr_cdevsw = { - /* open */ bktr_open, - /* close */ bktr_close, - /* read */ bktr_read, - /* write */ bktr_write, - /* ioctl */ bktr_ioctl, - /* poll */ bktr_poll, - /* mmap */ bktr_mmap, - /* strategy */ nostrategy, - /* name */ "bktr", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* bmaj */ -1 -}; - -DRIVER_MODULE(bktr, pci, bktr_driver, bktr_devclass, 0, 0); -#if (__FreeBSD_version > 410000) -MODULE_DEPEND(bktr, bktr_mem, 1,1,1); -MODULE_VERSION(bktr, 1); -#endif - - -/* - * the boot time probe routine. - */ -static int -bktr_probe( device_t dev ) -{ - unsigned int type = pci_get_devid(dev); - unsigned int rev = pci_get_revid(dev); - - if (PCI_VENDOR(type) == PCI_VENDOR_BROOKTREE) - { - switch (PCI_PRODUCT(type)) { - case PCI_PRODUCT_BROOKTREE_BT848: - if (rev == 0x12) - device_set_desc(dev, "BrookTree 848A"); - else - device_set_desc(dev, "BrookTree 848"); - return 0; - case PCI_PRODUCT_BROOKTREE_BT849: - device_set_desc(dev, "BrookTree 849A"); - return 0; - case PCI_PRODUCT_BROOKTREE_BT878: - device_set_desc(dev, "BrookTree 878"); - return 0; - case PCI_PRODUCT_BROOKTREE_BT879: - device_set_desc(dev, "BrookTree 879"); - return 0; - } - } - - return ENXIO; -} - - -/* - * the attach routine. - */ -static int -bktr_attach( device_t dev ) -{ - u_int latency; - u_int fun; - u_int val; - unsigned int rev; - unsigned int unit; - int error = 0; -#ifdef BROOKTREE_IRQ - u_int old_irq, new_irq; -#endif - - struct bktr_softc *bktr = device_get_softc(dev); - - unit = device_get_unit(dev); - - /* build the device name for bktr_name() */ - snprintf(bktr->bktr_xname, sizeof(bktr->bktr_xname), "bktr%d",unit); - - /* - * Enable bus mastering and Memory Mapped device - */ - val = pci_read_config(dev, PCIR_COMMAND, 4); - val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); - pci_write_config(dev, PCIR_COMMAND, val, 4); - - /* - * Map control/status registers. - */ - bktr->mem_rid = PCIR_MAPS; - bktr->res_mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &bktr->mem_rid, - 0, ~0, 1, RF_ACTIVE); - - - if (!bktr->res_mem) { - device_printf(dev, "could not map memory\n"); - error = ENXIO; - goto fail; - } - bktr->memt = rman_get_bustag(bktr->res_mem); - bktr->memh = rman_get_bushandle(bktr->res_mem); - - - /* - * Disable the brooktree device - */ - OUTL(bktr, BKTR_INT_MASK, ALL_INTS_DISABLED); - OUTW(bktr, BKTR_GPIO_DMA_CTL, FIFO_RISC_DISABLED); - - -#ifdef BROOKTREE_IRQ /* from the configuration file */ - old_irq = pci_conf_read(tag, PCI_INTERRUPT_REG); - pci_conf_write(tag, PCI_INTERRUPT_REG, BROOKTREE_IRQ); - new_irq = pci_conf_read(tag, PCI_INTERRUPT_REG); - printf("bktr%d: attach: irq changed from %d to %d\n", - unit, (old_irq & 0xff), (new_irq & 0xff)); -#endif - - /* - * Allocate our interrupt. - */ - bktr->irq_rid = 0; - bktr->res_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &bktr->irq_rid, - 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); - if (bktr->res_irq == NULL) { - device_printf(dev, "could not map interrupt\n"); - error = ENXIO; - goto fail; - } - - error = bus_setup_intr(dev, bktr->res_irq, INTR_TYPE_TTY, - bktr_intr, bktr, &bktr->res_ih); - if (error) { - device_printf(dev, "could not setup irq\n"); - goto fail; - - } - - - /* Update the Device Control Register */ - /* on Bt878 and Bt879 cards */ - fun = pci_read_config( dev, 0x40, 2); - fun = fun | 1; /* Enable writes to the sub-system vendor ID */ - -#if defined( BKTR_430_FX_MODE ) - if (bootverbose) printf("Using 430 FX chipset compatibility mode\n"); - fun = fun | 2; /* Enable Intel 430 FX compatibility mode */ -#endif - -#if defined( BKTR_SIS_VIA_MODE ) - if (bootverbose) printf("Using SiS/VIA chipset compatibility mode\n"); - fun = fun | 4; /* Enable SiS/VIA compatibility mode (usefull for - OPTi chipset motherboards too */ -#endif - pci_write_config(dev, 0x40, fun, 2); - - - /* XXX call bt848_i2c dependent attach() routine */ -#if defined(BKTR_USE_FREEBSD_SMBUS) - if (bt848_i2c_attach(unit, bktr, &bktr->i2c_sc)) - printf("bktr%d: i2c_attach: can't attach\n", unit); -#endif - - -/* - * PCI latency timer. 32 is a good value for 4 bus mastering slots, if - * you have more than four, then 16 would probably be a better value. - */ -#ifndef BROOKTREE_DEF_LATENCY_VALUE -#define BROOKTREE_DEF_LATENCY_VALUE 10 -#endif - latency = pci_read_config(dev, PCI_LATENCY_TIMER, 4); - latency = (latency >> 8) & 0xff; - if ( bootverbose ) { - if (latency) - printf("brooktree%d: PCI bus latency is", unit); - else - printf("brooktree%d: PCI bus latency was 0 changing to", - unit); - } - if ( !latency ) { - latency = BROOKTREE_DEF_LATENCY_VALUE; - pci_write_config(dev, PCI_LATENCY_TIMER, latency<<8, 4); - } - if ( bootverbose ) { - printf(" %d.\n", (int) latency); - } - - /* read the pci device id and revision id */ - fun = pci_get_devid(dev); - rev = pci_get_revid(dev); - - /* call the common attach code */ - common_bktr_attach( bktr, unit, fun, rev ); - - /* make the device entries */ - bktr->bktrdev = make_dev(&bktr_cdevsw, unit, - 0, 0, 0444, "bktr%d", unit); - bktr->tunerdev= make_dev(&bktr_cdevsw, unit+16, - 0, 0, 0444, "tuner%d", unit); - bktr->vbidev = make_dev(&bktr_cdevsw, unit+32, - 0, 0, 0444, "vbi%d" , unit); - - - /* if this is unit 0 (/dev/bktr0, /dev/tuner0, /dev/vbi0) then make */ - /* alias entries to /dev/bktr /dev/tuner and /dev/vbi */ -#if (__FreeBSD_version >=500000) - if (unit == 0) { - bktr->bktrdev_alias = make_dev_alias(bktr->bktrdev, "bktr"); - bktr->tunerdev_alias= make_dev_alias(bktr->tunerdev, "tuner"); - bktr->vbidev_alias = make_dev_alias(bktr->vbidev, "vbi"); - } -#endif - - return 0; - -fail: - if (bktr->res_irq) - bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq); - if (bktr->res_mem) - bus_release_resource(dev, SYS_RES_IRQ, bktr->mem_rid, bktr->res_mem); - return error; - -} - -/* - * the detach routine. - */ -static int -bktr_detach( device_t dev ) -{ - unsigned int unit; - - struct bktr_softc *bktr = device_get_softc(dev); - - unit = device_get_unit(dev); - - /* Disable the brooktree device */ - OUTL(bktr, BKTR_INT_MASK, ALL_INTS_DISABLED); - OUTW(bktr, BKTR_GPIO_DMA_CTL, FIFO_RISC_DISABLED); - - /* Note: We do not free memory for RISC programs, grab buffer, vbi buffers */ - /* The memory is retained by the bktr_mem module so we can unload and */ - /* then reload the main bktr driver module */ - - /* Unregister the /dev/bktrN, tunerN and vbiN devices */ - destroy_dev(bktr->vbidev); - destroy_dev(bktr->tunerdev); - destroy_dev(bktr->bktrdev); - - /* If this is unit 0, then destroy the alias entries too */ -#if (__FreeBSD_version >=500000) - if (unit == 0) { - destroy_dev(bktr->vbidev_alias); - destroy_dev(bktr->tunerdev_alias); - destroy_dev(bktr->bktrdev_alias); - } -#endif - - /* - * Deallocate resources. - */ - bus_teardown_intr(dev, bktr->res_irq, bktr->res_ih); - bus_release_resource(dev, SYS_RES_IRQ, bktr->irq_rid, bktr->res_irq); - bus_release_resource(dev, SYS_RES_MEMORY, bktr->mem_rid, bktr->res_mem); - - return 0; -} - -/* - * the shutdown routine. - */ -static int -bktr_shutdown( device_t dev ) -{ - struct bktr_softc *bktr = device_get_softc(dev); - - /* Disable the brooktree device */ - OUTL(bktr, BKTR_INT_MASK, ALL_INTS_DISABLED); - OUTW(bktr, BKTR_GPIO_DMA_CTL, FIFO_RISC_DISABLED); - - return 0; -} - - -/* - * Special Memory Allocation - */ -vm_offset_t -get_bktr_mem( int unit, unsigned size ) -{ - vm_offset_t addr = 0; - - addr = vm_page_alloc_contig(size, 0, 0xffffffff, 1<<24); - if (addr == 0) - addr = vm_page_alloc_contig(size, 0, 0xffffffff, PAGE_SIZE); - if (addr == 0) { - printf("bktr%d: Unable to allocate %d bytes of memory.\n", - unit, size); - } - - return( addr ); -} - - -/*--------------------------------------------------------- -** -** BrookTree 848 character device driver routines -** -**--------------------------------------------------------- -*/ - -#define VIDEO_DEV 0x00 -#define TUNER_DEV 0x01 -#define VBI_DEV 0x02 - -#define UNIT(x) ((x) & 0x0f) -#define FUNCTION(x) (x >> 4) - -/* - * - */ -static int -bktr_open( dev_t dev, int flags, int fmt, struct proc *p ) -{ - bktr_ptr_t bktr; - int unit; - int result; - - unit = UNIT( minor(dev) ); - - /* Get the device data */ - bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); - if (bktr == NULL) { - /* the device is no longer valid/functioning */ - return (ENXIO); - } - - if (!(bktr->flags & METEOR_INITALIZED)) /* device not found */ - return( ENXIO ); - - /* Record that the device is now busy */ - device_busy(devclass_get_device(bktr_devclass, unit)); - - - if (bt848_card != -1) { - if ((bt848_card >> 8 == unit ) && - ( (bt848_card & 0xff) < Bt848_MAX_CARD )) { - if ( bktr->bt848_card != (bt848_card & 0xff) ) { - bktr->bt848_card = (bt848_card & 0xff); - probeCard(bktr, FALSE, unit); - } - } - } - - if (bt848_tuner != -1) { - if ((bt848_tuner >> 8 == unit ) && - ( (bt848_tuner & 0xff) < Bt848_MAX_TUNER )) { - if ( bktr->bt848_tuner != (bt848_tuner & 0xff) ) { - bktr->bt848_tuner = (bt848_tuner & 0xff); - probeCard(bktr, FALSE, unit); - } - } - } - - if (bt848_reverse_mute != -1) { - if ((bt848_reverse_mute >> 8) == unit ) { - bktr->reverse_mute = bt848_reverse_mute & 0xff; - } - } - - if (bt848_slow_msp_audio != -1) { - if ((bt848_slow_msp_audio >> 8) == unit ) { - bktr->slow_msp_audio = (bt848_slow_msp_audio & 0xff); - } - } - - switch ( FUNCTION( minor(dev) ) ) { - case VIDEO_DEV: - result = video_open( bktr ); - break; - case TUNER_DEV: - result = tuner_open( bktr ); - break; - case VBI_DEV: - result = vbi_open( bktr ); - break; - default: - result = ENXIO; - break; - } - - /* If there was an error opening the device, undo the busy status */ - if (result != 0) - device_unbusy(devclass_get_device(bktr_devclass, unit)); - return( result ); -} - - -/* - * - */ -static int -bktr_close( dev_t dev, int flags, int fmt, struct proc *p ) -{ - bktr_ptr_t bktr; - int unit; - int result; - - unit = UNIT( minor(dev) ); - - /* Get the device data */ - bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); - if (bktr == NULL) { - /* the device is no longer valid/functioning */ - return (ENXIO); - } - - switch ( FUNCTION( minor(dev) ) ) { - case VIDEO_DEV: - result = video_close( bktr ); - break; - case TUNER_DEV: - result = tuner_close( bktr ); - break; - case VBI_DEV: - result = vbi_close( bktr ); - break; - default: - return (ENXIO); - break; - } - - device_unbusy(devclass_get_device(bktr_devclass, unit)); - return( result ); -} - - -/* - * - */ -static int -bktr_read( dev_t dev, struct uio *uio, int ioflag ) -{ - bktr_ptr_t bktr; - int unit; - - unit = UNIT(minor(dev)); - - /* Get the device data */ - bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); - if (bktr == NULL) { - /* the device is no longer valid/functioning */ - return (ENXIO); - } - - switch ( FUNCTION( minor(dev) ) ) { - case VIDEO_DEV: - return( video_read( bktr, unit, dev, uio ) ); - case VBI_DEV: - return( vbi_read( bktr, uio, ioflag ) ); - } - return( ENXIO ); -} - - -/* - * - */ -static int -bktr_write( dev_t dev, struct uio *uio, int ioflag ) -{ - return( EINVAL ); /* XXX or ENXIO ? */ -} - - -/* - * - */ -static int -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)); - - /* Get the device data */ - bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); - if (bktr == NULL) { - /* the device is no longer valid/functioning */ - return (ENXIO); - } - - if (bktr->bigbuf == 0) /* no frame buffer allocated (ioctl failed) */ - return( ENOMEM ); - - switch ( FUNCTION( minor(dev) ) ) { - case VIDEO_DEV: - return( video_ioctl( bktr, unit, cmd, arg, pr ) ); - case TUNER_DEV: - return( tuner_ioctl( bktr, unit, cmd, arg, pr ) ); - } - - return( ENXIO ); -} - - -/* - * - */ -static int -bktr_mmap( dev_t dev, vm_offset_t offset, int nprot ) -{ - int unit; - bktr_ptr_t bktr; - - unit = UNIT(minor(dev)); - - if (FUNCTION(minor(dev)) > 0) /* only allow mmap on /dev/bktr[n] */ - return( -1 ); - - /* Get the device data */ - bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); - if (bktr == NULL) { - /* the device is no longer valid/functioning */ - return (ENXIO); - } - - if (nprot & PROT_EXEC) - return( -1 ); - - if (offset < 0) - return( -1 ); - - if (offset >= bktr->alloc_pages * PAGE_SIZE) - return( -1 ); - - return( atop(vtophys(bktr->bigbuf) + offset) ); -} - -static int -bktr_poll( dev_t dev, int events, struct proc *p) -{ - int unit; - bktr_ptr_t bktr; - int revents = 0; - DECLARE_INTR_MASK(s); - - unit = UNIT(minor(dev)); - - /* Get the device data */ - bktr = (struct bktr_softc*)devclass_get_softc(bktr_devclass, unit); - if (bktr == NULL) { - /* the device is no longer valid/functioning */ - return (ENXIO); - } - - DISABLE_INTR(s); - - if (events & (POLLIN | POLLRDNORM)) { - - switch ( FUNCTION( minor(dev) ) ) { - case VBI_DEV: - if(bktr->vbisize == 0) - selrecord(p, &bktr->vbi_select); - else - revents |= events & (POLLIN | POLLRDNORM); - break; - } - } - - ENABLE_INTR(s); - - return (revents); -} - -#endif /* FreeBSD 4.x specific kernel interface routines */ - - -/*****************/ -/* *** BSDI *** */ -/*****************/ - -#if defined(__bsdi__) -#endif /* __bsdi__ BSDI specific kernel interface routines */ - - -/*****************************/ -/* *** OpenBSD / NetBSD *** */ -/*****************************/ -#if defined(__NetBSD__) || defined(__OpenBSD__) #define IPL_VIDEO IPL_BIO /* XXX */ @@ -834,36 +101,23 @@ static int bktr_intr(void *arg) { return common_bktr_intr(arg); } #define bktr_ioctl bktrioctl #define bktr_mmap bktrmmap -#ifdef __OpenBSD__ int bktr_open(dev_t, int, int, struct proc *); int bktr_close(dev_t, int, int, struct proc *); int bktr_read(dev_t, struct uio *, int); int bktr_write(dev_t, struct uio *, int); int bktr_ioctl(dev_t, ioctl_cmd_t, caddr_t, int, struct proc *); paddr_t bktr_mmap(dev_t, off_t, int); -#endif -#if defined(__OpenBSD__) static int bktr_probe(struct device *, void *, void *); -#else -vm_offset_t vm_page_alloc_contig(vm_offset_t, vm_offset_t, - vm_offset_t, vm_offset_t); - -static int bktr_probe(struct device *, struct cfdata *, void *); -#endif static void bktr_attach(struct device *, struct device *, void *); struct cfattach bktr_ca = { sizeof(struct bktr_softc), bktr_probe, bktr_attach }; -#if defined(__NetBSD__) -extern struct cfdriver bktr_cd; -#else struct cfdriver bktr_cd = { NULL, "bktr", DV_DULL }; -#endif #if NRADIO > 0 /* for radio(4) */ @@ -882,11 +136,7 @@ struct radio_hw_if bktr_hw_if = { int bktr_probe(parent, match, aux) struct device *parent; -#if defined(__OpenBSD__) void *match; -#else - struct cfdata *match; -#endif void *aux; { struct pci_attach_args *pa = aux; @@ -931,9 +181,7 @@ bktr_attach(struct device *parent, struct device *self, void *aux) fun | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE); -#ifndef __OpenBSD__ printf("\n"); -#endif /* * map memory @@ -963,13 +211,8 @@ bktr_attach(struct device *parent, struct device *self, void *aux) return; } intrstr = pci_intr_string(pa->pa_pc, ih); -#ifdef __OpenBSD__ bktr->ih = pci_intr_establish(pa->pa_pc, ih, IPL_VIDEO, bktr_intr, bktr, bktr->bktr_dev.dv_xname); -#else - bktr->ih = pci_intr_establish(pa->pa_pc, ih, IPL_VIDEO, - bktr_intr, bktr); -#endif if (bktr->ih == NULL) { printf("%s: couldn't establish interrupt", bktr_name(bktr)); @@ -979,12 +222,7 @@ bktr_attach(struct device *parent, struct device *self, void *aux) return; } if (intrstr != NULL) -#ifdef __NetBSD__ - printf("%s: interrupting at %s\n", bktr_name(bktr), - intrstr); -#else printf(": %s\n", intrstr); -#endif /* * PCI latency timer. 32 is a good value for 4 bus mastering slots, if @@ -1350,5 +588,3 @@ bktr_get_info(void *v, struct radio_info *ri) return (0); } #endif /* NRADIO */ - -#endif /* __NetBSD__ || __OpenBSD__ */ diff --git a/sys/dev/pci/bktr/bktr_os.h b/sys/dev/pci/bktr/bktr_os.h index 20a38767db3..b24ed632598 100644 --- a/sys/dev/pci/bktr/bktr_os.h +++ b/sys/dev/pci/bktr/bktr_os.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_os.h,v 1.2 2003/01/15 06:30:35 art Exp $ */ +/* $OpenBSD: bktr_os.h,v 1.3 2007/06/11 08:10:22 robert Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_os.h,v 1.4 2000/04/16 07:56:58 roger Exp $ */ /* @@ -48,26 +48,12 @@ /******************************/ /* *** Memory Allocation *** */ /******************************/ -#if (defined(__FreeBSD__) || defined(__bsdi__)) -vm_offset_t get_bktr_mem( int unit, unsigned size ); -#endif - -#if (defined(__NetBSD__) || defined(__OpenBSD__)) vaddr_t get_bktr_mem(bktr_ptr_t, bus_dmamap_t *, unsigned size); void free_bktr_mem(bktr_ptr_t, bus_dmamap_t, vaddr_t); -#endif /************************************/ /* *** Interrupt Enable/Disable *** */ /************************************/ -#if defined(__FreeBSD__) || defined(__OpenBSD__) #define DECLARE_INTR_MASK(s) intrmask_t s #define DISABLE_INTR(s) s=spltty() #define ENABLE_INTR(s) splx(s) -#else -#define DECLARE_INTR_MASK(s) /* no need to declare 's' */ -#define DISABLE_INTR(s) disable_intr() -#define ENABLE_INTR(s) enable_intr() -#endif - - diff --git a/sys/dev/pci/bktr/bktr_reg.h b/sys/dev/pci/bktr/bktr_reg.h index 2232ef1f59b..d403ba41eee 100644 --- a/sys/dev/pci/bktr/bktr_reg.h +++ b/sys/dev/pci/bktr/bktr_reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_reg.h,v 1.9 2006/02/05 23:52:58 jakemsr Exp $ */ +/* $OpenBSD: bktr_reg.h,v 1.10 2007/06/11 08:10:22 robert Exp $ */ /* * $FreeBSD: src/sys/dev/bktr/bktr_reg.h,v 1.42 2000/10/31 13:09:56 roger Exp $ * @@ -35,34 +35,21 @@ * */ -#ifdef __FreeBSD__ -# if (__FreeBSD_version >= 310000) -# include "smbus.h" -# else -# define NSMBUS 0 /* FreeBSD before 3.1 does not have SMBUS */ -# endif -# if (NSMBUS > 0) -# define BKTR_USE_FREEBSD_SMBUS -# endif -#endif - -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <machine/bus.h> /* struct device */ #include <sys/device.h> #include <sys/selinfo.h> /* struct selinfo */ -# ifdef DEBUG + +#ifdef DEBUG # define bootverbose 1 -# else +#else # define bootverbose 0 -# endif #endif /* * The kernel options for the driver now all begin with BKTR. - * Support the older kernel options on FreeBSD and OpenBSD. + * Support the older kernel options on OpenBSD. * */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(BROOKTREE_ALLOC_PAGES) #define BKTR_ALLOC_PAGES BROOKTREE_ALLOC_PAGES #endif @@ -87,9 +74,6 @@ #define BKTR_OVERRIDE_MSP OVERRIDE_MSP #endif -#endif - - #ifndef PCI_LATENCY_TIMER #define PCI_LATENCY_TIMER 0x0c /* pci timer register */ #endif @@ -97,20 +81,7 @@ /* * Definitions for the Brooktree 848/878 video capture to pci interface. */ -#ifndef __NetBSD__ -#ifdef __OpenBSD__ #include <dev/pci/pcivar.h> -#else -#define PCI_VENDOR_SHIFT 0 -#define PCI_VENDOR_MASK 0xffff -#define PCI_VENDOR(id) \ - (((id) >> PCI_VENDOR_SHIFT) & PCI_VENDOR_MASK) - -#define PCI_PRODUCT_SHIFT 16 -#define PCI_PRODUCT_MASK 0xffff -#define PCI_PRODUCT(id) \ - (((id) >> PCI_PRODUCT_SHIFT) & PCI_PRODUCT_MASK) -#endif /* PCI vendor ID */ #define PCI_VENDOR_BROOKTREE 0x109e /* Brooktree */ @@ -119,7 +90,6 @@ #define PCI_PRODUCT_BROOKTREE_BT849 0x0351 /* Bt849 Video Capture */ #define PCI_PRODUCT_BROOKTREE_BT878 0x036e /* Bt878 Video Capture */ #define PCI_PRODUCT_BROOKTREE_BT879 0x036f /* Bt879 Video Capture */ -#endif #define BROOKTREE_848 1 #define BROOKTREE_848A 2 @@ -468,14 +438,6 @@ struct format_params { int vbi_num_lines, vbi_num_samples; }; -#if defined(BKTR_USE_FREEBSD_SMBUS) -struct bktr_i2c_softc { - device_t iicbus; - device_t smbus; -}; -#endif - - /* Bt848/878 register access * The registers can either be access via a memory mapped structure * or accessed via bus_space. @@ -483,7 +445,6 @@ struct bktr_i2c_softc { * memory mapped structure method only works on 32 bit processors * with the right type of endianness. */ -#if defined(__NetBSD__) || defined(__OpenBSD__) || ( defined(__FreeBSD__) && (__FreeBSD_version >=300000) ) #define INB(sc,o) (({ \ u_int8_t __v; \ __v = bus_space_read_1((sc)->memt, (sc)->memh, (o)); \ @@ -520,15 +481,6 @@ struct bktr_i2c_softc { bus_space_barrier((sc)->memt, (sc)->memh, (o), 4, \ BUS_SPACE_BARRIER_WRITE); \ } while (0) -#else -#define INB(bktr,offset) *(volatile unsigned char *)((int)((bktr)->memh)+(offset)) -#define INW(bktr,offset) *(volatile unsigned short *)((int)((bktr)->memh)+(offset)) -#define INL(bktr,offset) *(volatile unsigned int *)((int)((bktr)->memh)+(offset)) -#define OUTB(bktr,offset,value) *(volatile unsigned char *)((int)((bktr)->memh)+(offset)) = (value) -#define OUTW(bktr,offset,value) *(volatile unsigned short *)((int)((bktr)->memh)+(offset)) = (value) -#define OUTL(bktr,offset,value) *(volatile unsigned int *)((int)((bktr)->memh)+(offset)) = (value) -#endif - typedef struct bktr_clip bktr_clip_t; @@ -536,15 +488,6 @@ typedef struct bktr_clip bktr_clip_t; * BrookTree 848 info structure, one per bt848 card installed. */ struct bktr_softc { - -#if defined (__bsdi__) - struct device bktr_dev; /* base device */ - struct isadev bktr_id; /* ISA device */ - struct intrhand bktr_ih; /* interrupt vectoring */ - #define pcici_t pci_devaddr_t -#endif - -#if defined(__NetBSD__) || defined(__OpenBSD__) struct device bktr_dev; /* base device */ bus_dma_tag_t dmat; /* DMA tag */ bus_space_tag_t memt; @@ -556,53 +499,12 @@ struct bktr_softc { bus_dmamap_t dm_mem; bus_dmamap_t dm_vbidata; bus_dmamap_t dm_vbibuffer; -#endif - -#if defined (__FreeBSD__) - #if (__FreeBSD_version < 400000) - vm_offset_t phys_base; /* 2.x Bt848 register physical address */ - pcici_t tag; /* 2.x PCI tag, for doing PCI commands */ - #endif - #if (__FreeBSD_version >= 400000) - int mem_rid; /* 4.x resource id */ - struct resource *res_mem; /* 4.x resource descriptor for registers */ - int irq_rid; /* 4.x resource id */ - struct resource *res_irq; /* 4.x resource descriptor for interrupt */ - void *res_ih; /* 4.x newbus interrupt handler cookie */ - dev_t bktrdev; /* 4.x device entry for /dev/bktrN */ - dev_t tunerdev; /* 4.x device entry for /dev/tunerN */ - dev_t vbidev; /* 4.x device entry for /dev/vbiN */ - dev_t bktrdev_alias; /* alias /dev/bktr to /dev/bktr0 */ - dev_t tunerdev_alias; /* alias /dev/tuner to /dev/tuner0 */ - dev_t vbidev_alias; /* alias /dev/vbi to /dev/vbi0 */ - #endif - #if (__FreeBSD_version >= 310000) - bus_space_tag_t memt; /* Bus space register access functions */ - bus_space_handle_t memh; /* Bus space register access functions */ - bus_size_t obmemsz;/* Size of card (bytes) */ - #endif - #if (NSMBUS > 0) - struct bktr_i2c_softc i2c_sc; /* bt848_i2c device */ - #endif - char bktr_xname[7]; /* device name and unit number */ -#endif - - /* The following definitions are for the contiguous memory */ -#if defined(__NetBSD__) || defined(__OpenBSD__) vaddr_t bigbuf; /* buffer that holds the captured image */ vaddr_t vbidata; /* RISC program puts VBI data from the current frame here */ vaddr_t vbibuffer; /* Circular buffer holding VBI data for the user */ vaddr_t dma_prog; /* RISC prog for single and/or even field capture*/ vaddr_t odd_dma_prog; /* RISC program for Odd field capture */ -#else - vm_offset_t bigbuf; /* buffer that holds the captured image */ - vm_offset_t vbidata; /* RISC program puts VBI data from the current frame here */ - vm_offset_t vbibuffer; /* Circular buffer holding VBI data for the user */ - vm_offset_t dma_prog; /* RISC prog for single and/or even field capture*/ - vm_offset_t odd_dma_prog;/* RISC program for Odd field capture */ -#endif - /* the following definitions are common over all platforms */ int alloc_pages; /* number of pages in bigbuf */ @@ -746,19 +648,4 @@ struct bt848_card_sig { /***********************************************************/ /* ioctl_cmd_t int on old versions, u_long on new versions */ /***********************************************************/ - -#if (__FreeBSD__ == 2) -typedef int ioctl_cmd_t; -#endif - -#if defined(__FreeBSD__) -#if (__FreeBSD_version >= 300000) typedef u_long ioctl_cmd_t; -#endif -#endif - -#if defined(__NetBSD__) || defined(__OpenBSD__) -typedef u_long ioctl_cmd_t; -#endif - - diff --git a/sys/dev/pci/bktr/bktr_tuner.c b/sys/dev/pci/bktr/bktr_tuner.c index efbbea235e9..b3d307823ff 100644 --- a/sys/dev/pci/bktr/bktr_tuner.c +++ b/sys/dev/pci/bktr/bktr_tuner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bktr_tuner.c,v 1.5 2007/01/08 08:29:37 pedro Exp $ */ +/* $OpenBSD: bktr_tuner.c,v 1.6 2007/06/11 08:10:22 robert Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_tuner.c,v 1.9 2000/10/19 07:33:28 roger Exp $ */ /* @@ -50,40 +50,13 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/vnode.h> -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/proc.h> -#endif - -#ifdef __FreeBSD__ -#include <pci/pcivar.h> - -#if (__FreeBSD_version < 500000) -#include <machine/clock.h> /* for DELAY */ -#endif - -#if (__FreeBSD_version >=300000) -#include <machine/bus_memio.h> /* for bus space */ -#include <machine/bus.h> -#include <sys/bus.h> -#endif -#endif -#if defined(__NetBSD__) || defined(__OpenBSD__) -#include <dev/ic/bt8xx.h> /* NetBSD .h file location */ +#include <dev/ic/bt8xx.h> /* OpenBSD .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 */ -#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 - - #if defined( TUNER_AFC ) #define AFC_DELAY 10000 /* 10 millisend delay */ |