1139749Simp/*-
274533Scokane * Copyright (c) 2000-2001 by Coleman Kane <cokane@FreeBSD.org>
361931Scokane * All rights reserved.
461931Scokane *
561931Scokane * Redistribution and use in source and binary forms, with or without
661931Scokane * modification, are permitted provided that the following conditions
761931Scokane * are met:
861931Scokane * 1. Redistributions of source code must retain the above copyright
961931Scokane *    notice, this list of conditions and the following disclaimer.
1061931Scokane * 2. Redistributions in binary form must reproduce the above copyright
1161931Scokane *    notice, this list of conditions and the following disclaimer in the
1261931Scokane *    documentation and/or other materials provided with the distribution.
1361931Scokane * 3. All advertising materials mentioning features or use of this software
1461931Scokane *    must display the following acknowledgement:
1561931Scokane *      This product includes software developed by Gardner Buchanan.
1661931Scokane * 4. The name of Gardner Buchanan may not be used to endorse or promote
1761931Scokane *    products derived from this software without specific prior written
1861931Scokane *    permission.
1961931Scokane *
2061931Scokane * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2161931Scokane * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2261931Scokane * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2361931Scokane * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2461931Scokane * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2561931Scokane * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2661931Scokane * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2761931Scokane * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2861931Scokane * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2961931Scokane * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3061931Scokane *
3161931Scokane *   $FreeBSD$
3261931Scokane */
3361931Scokane
3461911Scokane/* tdfx_vars.h -- constants and structs used in the tdfx driver
3574533Scokane	Copyright (C) 2000-2001 by Coleman Kane <cokane@FreeBSD.org>
3661911Scokane*/
3761911Scokane#ifndef	TDFX_VARS_H
3861911Scokane#define	TDFX_VARS_H
3961911Scokane
4061911Scokane#include <sys/memrange.h>
4161931Scokane#include <sys/param.h>
4261931Scokane#include <sys/bus.h>
4361931Scokane#include <sys/cdefs.h>
4461911Scokane
4561911Scokane#define  PCI_DEVICE_ALLIANCE_AT3D	0x643d1142
4674533Scokane#define	PCI_DEVICE_3DFX_VOODOO1		0x0001121a
4761911Scokane#define	PCI_DEVICE_3DFX_VOODOO2		0x0002121a
4861911Scokane#define	PCI_DEVICE_3DFX_BANSHEE		0x0003121a
4961911Scokane#define	PCI_DEVICE_3DFX_VOODOO3		0x0005121a
5061911Scokane
5165146Scokane#define PCI_VENDOR_ID_FREEBSD      0x0
5265146Scokane#define PCI_DEVICE_ID_FREEBSD      0x2
5365146Scokane#define PCI_COMMAND_FREEBSD        0x4
5465146Scokane#define PCI_REVISION_ID_FREEBSD    0x8
5561911Scokane#define PCI_BASE_ADDRESS_0_FREEBSD 0x10
5665146Scokane#define PCI_BASE_ADDRESS_1_FREEBSD 0x14
5765146Scokane#define PCI_PRIBUS_FREEBSD         0x18
5865146Scokane#define PCI_IOBASE_0_FREEBSD       0x2c
5965146Scokane#define PCI_IOLIMIT_0_FREEBSD      0x30
6065146Scokane#define SST1_PCI_SPECIAL1_FREEBSD  0x40
6165146Scokane#define SST1_PCI_SPECIAL2_FREEBSD  0x44
6265146Scokane#define SST1_PCI_SPECIAL3_FREEBSD  0x48
6365146Scokane#define SST1_PCI_SPECIAL4_FREEBSD  0x54
6461911Scokane
6561911Scokane#define VGA_INPUT_STATUS_1C 0x3DA
6661911Scokane#define VGA_MISC_OUTPUT_READ 0x3cc
6761911Scokane#define VGA_MISC_OUTPUT_WRITE 0x3c2
6861911Scokane#define SC_INDEX 0x3c4
6961911Scokane#define SC_DATA  0x3c5
7061911Scokane
7161911Scokane#define PCI_MAP_REG_START 0x10
7261911Scokane#define UNIT(m)	(m & 0xf)
7361911Scokane
7461911Scokane/* IOCTL Calls */
7561911Scokane#define	TDFX_IOC_TYPE_PIO		0
7661911Scokane#define	TDFX_IOC_TYPE_QUERY	'3'
7761911Scokane#define	TDFX_IOC_QRY_BOARDS	2
7861911Scokane#define	TDFX_IOC_QRY_FETCH	3
7961911Scokane#define	TDFX_IOC_QRY_UPDATE	4
8061911Scokane
8161911Scokanestruct tdfx_softc {
8261911Scokane	int cardno;
8363488Scokane	vm_offset_t addr, addr2;
8463488Scokane	struct resource *memrange, *memrange2, *piorange;
8563488Scokane	int memrid, memrid2, piorid;
8661911Scokane	long range;
8761911Scokane	int vendor;
8861911Scokane	int type;
8963488Scokane	int addr0, addr1;
9065146Scokane	short pio0, pio0max;
9161911Scokane	unsigned char bus;
9261911Scokane	unsigned char dv;
9361911Scokane	struct file *curFile;
9461911Scokane	device_t dev;
95130585Sphk	struct cdev *devt;
9661911Scokane	struct mem_range_desc mrdesc;
9761911Scokane	int busy;
9861911Scokane};
9961911Scokane
10061911Scokanestruct tdfx_pio_data {
10161911Scokane	short port;
10261911Scokane	short size;
10361911Scokane	int device;
10461911Scokane	void *value;
10561911Scokane};
10661911Scokane
10761911Scokane#endif /* TDFX_VARS_H */
108