1139749Simp/* sis_drv.h -- Private header for sis driver -*- linux-c -*- */
2139749Simp/*-
3119895Sanholt * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
4119895Sanholt * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
5119895Sanholt * All rights reserved.
6119895Sanholt *
7119895Sanholt * Permission is hereby granted, free of charge, to any person obtaining a
8119895Sanholt * copy of this software and associated documentation files (the "Software"),
9119895Sanholt * to deal in the Software without restriction, including without limitation
10119895Sanholt * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11119895Sanholt * and/or sell copies of the Software, and to permit persons to whom the
12119895Sanholt * Software is furnished to do so, subject to the following conditions:
13145132Sanholt *
14119895Sanholt * The above copyright notice and this permission notice (including the next
15119895Sanholt * paragraph) shall be included in all copies or substantial portions of the
16119895Sanholt * Software.
17145132Sanholt *
18119895Sanholt * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19119895Sanholt * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20119895Sanholt * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21119895Sanholt * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22119895Sanholt * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23119895Sanholt * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24119895Sanholt * DEALINGS IN THE SOFTWARE.
25145132Sanholt *
26119895Sanholt */
27119895Sanholt
28152909Sanholt#include <sys/cdefs.h>
29152909Sanholt__FBSDID("$FreeBSD$");
30152909Sanholt
31119895Sanholt#ifndef _SIS_DRV_H_
32119895Sanholt#define _SIS_DRV_H_
33119895Sanholt
34145132Sanholt/* General customization:
35145132Sanholt */
36145132Sanholt
37182080Srnoland#define DRIVER_AUTHOR		"SIS, Tungsten Graphics"
38145132Sanholt#define DRIVER_NAME		"sis"
39182080Srnoland#define DRIVER_DESC		"SIS 300/630/540 and XGI V3XE/V5/V8"
40182080Srnoland#define DRIVER_DATE		"20070626"
41145132Sanholt#define DRIVER_MAJOR		1
42182080Srnoland#define DRIVER_MINOR		3
43145132Sanholt#define DRIVER_PATCHLEVEL	0
44145132Sanholt
45182080Srnolandenum sis_family {
46182080Srnoland	SIS_OTHER = 0,
47182080Srnoland	SIS_CHIP_315 = 1,
48182080Srnoland};
49182080Srnoland
50182080Srnoland#if defined(__linux__)
51182080Srnoland#define SIS_HAVE_CORE_MM
52182080Srnoland#endif
53182080Srnoland
54182080Srnoland#ifdef SIS_HAVE_CORE_MM
55182080Srnoland#include "dev/drm/drm_sman.h"
56182080Srnoland
57182080Srnoland#define SIS_BASE (dev_priv->mmio)
58182080Srnoland#define SIS_READ(reg)	 DRM_READ32(SIS_BASE, reg);
59182080Srnoland#define SIS_WRITE(reg, val)   DRM_WRITE32(SIS_BASE, reg, val);
60182080Srnoland
61182080Srnolandtypedef struct drm_sis_private {
62182080Srnoland	drm_local_map_t *mmio;
63182080Srnoland	unsigned int idle_fault;
64182080Srnoland	struct drm_sman sman;
65182080Srnoland	unsigned int chipset;
66182080Srnoland	int vram_initialized;
67182080Srnoland	int agp_initialized;
68182080Srnoland	unsigned long vram_offset;
69182080Srnoland	unsigned long agp_offset;
70182080Srnoland} drm_sis_private_t;
71182080Srnoland
72182080Srnolandextern int sis_idle(struct drm_device *dev);
73182080Srnolandextern void sis_reclaim_buffers_locked(struct drm_device *dev,
74182080Srnoland				       struct drm_file *file_priv);
75182080Srnolandextern void sis_lastclose(struct drm_device *dev);
76182080Srnoland
77182080Srnoland#else
78119895Sanholt#include "dev/drm/sis_ds.h"
79119895Sanholt
80119895Sanholttypedef struct drm_sis_private {
81119895Sanholt	memHeap_t *AGPHeap;
82119895Sanholt	memHeap_t *FBHeap;
83119895Sanholt} drm_sis_private_t;
84119895Sanholt
85182080Srnolandextern int sis_init_context(struct drm_device * dev, int context);
86182080Srnolandextern int sis_final_context(struct drm_device * dev, int context);
87119895Sanholt
88182080Srnoland#endif
89182080Srnoland
90182080Srnolandextern struct drm_ioctl_desc sis_ioctls[];
91152909Sanholtextern int sis_max_ioctl;
92152909Sanholt
93119895Sanholt#endif
94