18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
38c2ecf20Sopenharmony_ci * All Rights Reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
68c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the
78c2ecf20Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
88c2ecf20Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
98c2ecf20Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
108c2ecf20Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
118c2ecf20Sopenharmony_ci * the following conditions:
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the
148c2ecf20Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
158c2ecf20Sopenharmony_ci * of the Software.
168c2ecf20Sopenharmony_ci *
178c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
188c2ecf20Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
198c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
208c2ecf20Sopenharmony_ci * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
218c2ecf20Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
228c2ecf20Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
238c2ecf20Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
248c2ecf20Sopenharmony_ci *
258c2ecf20Sopenharmony_ci */
268c2ecf20Sopenharmony_ci#ifndef _I915_DRM_H_
278c2ecf20Sopenharmony_ci#define _I915_DRM_H_
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#include <drm/i915_pciids.h>
308c2ecf20Sopenharmony_ci#include <uapi/drm/i915_drm.h>
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci/* For use by IPS driver */
338c2ecf20Sopenharmony_ciunsigned long i915_read_mch_val(void);
348c2ecf20Sopenharmony_cibool i915_gpu_raise(void);
358c2ecf20Sopenharmony_cibool i915_gpu_lower(void);
368c2ecf20Sopenharmony_cibool i915_gpu_busy(void);
378c2ecf20Sopenharmony_cibool i915_gpu_turbo_disable(void);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* Exported from arch/x86/kernel/early-quirks.c */
408c2ecf20Sopenharmony_ciextern struct resource intel_graphics_stolen_res;
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/*
438c2ecf20Sopenharmony_ci * The Bridge device's PCI config space has information about the
448c2ecf20Sopenharmony_ci * fb aperture size and the amount of pre-reserved memory.
458c2ecf20Sopenharmony_ci * This is all handled in the intel-gtt.ko module. i915.ko only
468c2ecf20Sopenharmony_ci * cares about the vga bit for the vga rbiter.
478c2ecf20Sopenharmony_ci */
488c2ecf20Sopenharmony_ci#define INTEL_GMCH_CTRL		0x52
498c2ecf20Sopenharmony_ci#define INTEL_GMCH_VGA_DISABLE  (1 << 1)
508c2ecf20Sopenharmony_ci#define SNB_GMCH_CTRL		0x50
518c2ecf20Sopenharmony_ci#define    SNB_GMCH_GGMS_SHIFT	8 /* GTT Graphics Memory Size */
528c2ecf20Sopenharmony_ci#define    SNB_GMCH_GGMS_MASK	0x3
538c2ecf20Sopenharmony_ci#define    SNB_GMCH_GMS_SHIFT   3 /* Graphics Mode Select */
548c2ecf20Sopenharmony_ci#define    SNB_GMCH_GMS_MASK    0x1f
558c2ecf20Sopenharmony_ci#define    BDW_GMCH_GGMS_SHIFT	6
568c2ecf20Sopenharmony_ci#define    BDW_GMCH_GGMS_MASK	0x3
578c2ecf20Sopenharmony_ci#define    BDW_GMCH_GMS_SHIFT   8
588c2ecf20Sopenharmony_ci#define    BDW_GMCH_GMS_MASK    0xff
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define I830_GMCH_CTRL			0x52
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define I830_GMCH_GMS_MASK		0x70
638c2ecf20Sopenharmony_ci#define I830_GMCH_GMS_LOCAL		0x10
648c2ecf20Sopenharmony_ci#define I830_GMCH_GMS_STOLEN_512	0x20
658c2ecf20Sopenharmony_ci#define I830_GMCH_GMS_STOLEN_1024	0x30
668c2ecf20Sopenharmony_ci#define I830_GMCH_GMS_STOLEN_8192	0x40
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define I855_GMCH_GMS_MASK		0xF0
698c2ecf20Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_0M		0x0
708c2ecf20Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_1M		(0x1 << 4)
718c2ecf20Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_4M		(0x2 << 4)
728c2ecf20Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_8M		(0x3 << 4)
738c2ecf20Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_16M	(0x4 << 4)
748c2ecf20Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_32M	(0x5 << 4)
758c2ecf20Sopenharmony_ci#define I915_GMCH_GMS_STOLEN_48M	(0x6 << 4)
768c2ecf20Sopenharmony_ci#define I915_GMCH_GMS_STOLEN_64M	(0x7 << 4)
778c2ecf20Sopenharmony_ci#define G33_GMCH_GMS_STOLEN_128M	(0x8 << 4)
788c2ecf20Sopenharmony_ci#define G33_GMCH_GMS_STOLEN_256M	(0x9 << 4)
798c2ecf20Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_96M	(0xa << 4)
808c2ecf20Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_160M	(0xb << 4)
818c2ecf20Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_224M	(0xc << 4)
828c2ecf20Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_352M	(0xd << 4)
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define I830_DRB3		0x63
858c2ecf20Sopenharmony_ci#define I85X_DRB3		0x43
868c2ecf20Sopenharmony_ci#define I865_TOUD		0xc4
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define I830_ESMRAMC		0x91
898c2ecf20Sopenharmony_ci#define I845_ESMRAMC		0x9e
908c2ecf20Sopenharmony_ci#define I85X_ESMRAMC		0x61
918c2ecf20Sopenharmony_ci#define    TSEG_ENABLE		(1 << 0)
928c2ecf20Sopenharmony_ci#define    I830_TSEG_SIZE_512K	(0 << 1)
938c2ecf20Sopenharmony_ci#define    I830_TSEG_SIZE_1M	(1 << 1)
948c2ecf20Sopenharmony_ci#define    I845_TSEG_SIZE_MASK	(3 << 1)
958c2ecf20Sopenharmony_ci#define    I845_TSEG_SIZE_512K	(2 << 1)
968c2ecf20Sopenharmony_ci#define    I845_TSEG_SIZE_1M	(3 << 1)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define INTEL_BSM		0x5c
998c2ecf20Sopenharmony_ci#define INTEL_GEN11_BSM_DW0	0xc0
1008c2ecf20Sopenharmony_ci#define INTEL_GEN11_BSM_DW1	0xc4
1018c2ecf20Sopenharmony_ci#define   INTEL_BSM_MASK	(-(1u << 20))
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#endif				/* _I915_DRM_H_ */
104