103b705cfSriastradh/*
203b705cfSriastradh * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
303b705cfSriastradh * All Rights Reserved.
403b705cfSriastradh * Copyright © 2010 Intel Corporation
503b705cfSriastradh *
603b705cfSriastradh * Permission is hereby granted, free of charge, to any person obtaining a
703b705cfSriastradh * copy of this software and associated documentation files (the "Software"),
803b705cfSriastradh * to deal in the Software without restriction, including without limitation
903b705cfSriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1003b705cfSriastradh * and/or sell copies of the Software, and to permit persons to whom the
1103b705cfSriastradh * Software is furnished to do so, subject to the following conditions:
1203b705cfSriastradh *
1303b705cfSriastradh * The above copyright notice and this permission notice (including the next
1403b705cfSriastradh * paragraph) shall be included in all copies or substantial portions of the
1503b705cfSriastradh * Software.
1603b705cfSriastradh *
1703b705cfSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1803b705cfSriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1903b705cfSriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
2003b705cfSriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2103b705cfSriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2203b705cfSriastradh * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2303b705cfSriastradh * SOFTWARE.
2403b705cfSriastradh *
2503b705cfSriastradh */
2603b705cfSriastradh
2703b705cfSriastradh#ifdef HAVE_CONFIG_H
2803b705cfSriastradh#include "config.h"
2903b705cfSriastradh#endif
3003b705cfSriastradh
3142542f5fSchristos#include <xorg-server.h>
3242542f5fSchristos#include <xorgVersion.h>
3342542f5fSchristos
3403b705cfSriastradh#include <xf86.h>
3503b705cfSriastradh#include <xf86Parser.h>
3603b705cfSriastradh
3703b705cfSriastradh#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,6,99,0,0)
3803b705cfSriastradh#include <xf86Resources.h>
3903b705cfSriastradh#endif
4003b705cfSriastradh
4103b705cfSriastradh#include "intel_driver.h"
4203b705cfSriastradh#include "intel_options.h"
4303b705cfSriastradh#include "legacy/legacy.h"
4403b705cfSriastradh#include "sna/sna_module.h"
4503b705cfSriastradh#include "uxa/uxa_module.h"
4603b705cfSriastradh
4703b705cfSriastradh#include "i915_pciids.h" /* copied from (kernel) include/drm/i915_pciids.h */
4803b705cfSriastradh
4903b705cfSriastradh#ifdef XSERVER_PLATFORM_BUS
5003b705cfSriastradh#include <xf86platformBus.h>
5103b705cfSriastradh#endif
5203b705cfSriastradh
5342542f5fSchristos#ifndef XF86_ALLOCATE_GPU_SCREEN
5442542f5fSchristos#define XF86_ALLOCATE_GPU_SCREEN 0
5542542f5fSchristos#endif
5642542f5fSchristos
5703b705cfSriastradhstatic const struct intel_device_info intel_generic_info = {
5803b705cfSriastradh	.gen = -1,
5903b705cfSriastradh};
6003b705cfSriastradh
6103b705cfSriastradhstatic const struct intel_device_info intel_i81x_info = {
6203b705cfSriastradh	.gen = 010,
6303b705cfSriastradh};
6403b705cfSriastradh
6503b705cfSriastradhstatic const struct intel_device_info intel_i830_info = {
6603b705cfSriastradh	.gen = 020,
6703b705cfSriastradh};
6803b705cfSriastradhstatic const struct intel_device_info intel_i845_info = {
6903b705cfSriastradh	.gen = 020,
7003b705cfSriastradh};
7103b705cfSriastradhstatic const struct intel_device_info intel_i855_info = {
7203b705cfSriastradh	.gen = 021,
7303b705cfSriastradh};
7403b705cfSriastradhstatic const struct intel_device_info intel_i865_info = {
7503b705cfSriastradh	.gen = 022,
7603b705cfSriastradh};
7703b705cfSriastradh
7803b705cfSriastradhstatic const struct intel_device_info intel_i915_info = {
7903b705cfSriastradh	.gen = 030,
8003b705cfSriastradh};
8103b705cfSriastradhstatic const struct intel_device_info intel_i945_info = {
8203b705cfSriastradh	.gen = 031,
8303b705cfSriastradh};
8403b705cfSriastradh
8503b705cfSriastradhstatic const struct intel_device_info intel_g33_info = {
8603b705cfSriastradh	.gen = 033,
8703b705cfSriastradh};
8803b705cfSriastradh
8903b705cfSriastradhstatic const struct intel_device_info intel_i965_info = {
9003b705cfSriastradh	.gen = 040,
9103b705cfSriastradh};
9203b705cfSriastradh
9303b705cfSriastradhstatic const struct intel_device_info intel_g4x_info = {
9403b705cfSriastradh	.gen = 045,
9503b705cfSriastradh};
9603b705cfSriastradh
9703b705cfSriastradhstatic const struct intel_device_info intel_ironlake_info = {
9803b705cfSriastradh	.gen = 050,
9903b705cfSriastradh};
10003b705cfSriastradh
10103b705cfSriastradhstatic const struct intel_device_info intel_sandybridge_info = {
10203b705cfSriastradh	.gen = 060,
10303b705cfSriastradh};
10403b705cfSriastradh
10503b705cfSriastradhstatic const struct intel_device_info intel_ivybridge_info = {
10603b705cfSriastradh	.gen = 070,
10703b705cfSriastradh};
10803b705cfSriastradh
10903b705cfSriastradhstatic const struct intel_device_info intel_valleyview_info = {
11003b705cfSriastradh	.gen = 071,
11103b705cfSriastradh};
11203b705cfSriastradh
11303b705cfSriastradhstatic const struct intel_device_info intel_haswell_info = {
11403b705cfSriastradh	.gen = 075,
11503b705cfSriastradh};
11603b705cfSriastradh
11742542f5fSchristosstatic const struct intel_device_info intel_broadwell_info = {
11842542f5fSchristos	.gen = 0100,
11942542f5fSchristos};
12042542f5fSchristos
12142542f5fSchristosstatic const struct intel_device_info intel_cherryview_info = {
12242542f5fSchristos	.gen = 0101,
12342542f5fSchristos};
12442542f5fSchristos
12513496ba1Ssnjstatic const struct intel_device_info intel_skylake_info = {
12613496ba1Ssnj	.gen = 0110,
12713496ba1Ssnj};
12813496ba1Ssnj
129fe8aea9eSmrgstatic const struct intel_device_info intel_broxton_info = {
130fe8aea9eSmrg	.gen = 0111,
131fe8aea9eSmrg};
132fe8aea9eSmrg
133fe8aea9eSmrgstatic const struct intel_device_info intel_kabylake_info = {
134fe8aea9eSmrg	.gen = 0112,
135fe8aea9eSmrg};
136fe8aea9eSmrg
137fe8aea9eSmrgstatic const struct intel_device_info intel_geminilake_info = {
138fe8aea9eSmrg	.gen = 0113,
139fe8aea9eSmrg};
140fe8aea9eSmrg
141fe8aea9eSmrgstatic const struct intel_device_info intel_coffeelake_info = {
142fe8aea9eSmrg	.gen = 0114,
143fe8aea9eSmrg};
14413496ba1Ssnj
14503b705cfSriastradhstatic const SymTabRec intel_chipsets[] = {
14603b705cfSriastradh	{PCI_CHIP_I810,				"i810"},
14703b705cfSriastradh	{PCI_CHIP_I810_DC100,			"i810-dc100"},
14803b705cfSriastradh	{PCI_CHIP_I810_E,			"i810e"},
14903b705cfSriastradh	{PCI_CHIP_I815,				"i815"},
15003b705cfSriastradh	{PCI_CHIP_I830_M,			"i830M"},
15103b705cfSriastradh	{PCI_CHIP_845_G,			"845G"},
15203b705cfSriastradh	{PCI_CHIP_I854,				"854"},
15303b705cfSriastradh	{PCI_CHIP_I855_GM,			"852GM/855GM"},
15403b705cfSriastradh	{PCI_CHIP_I865_G,			"865G"},
15503b705cfSriastradh	{PCI_CHIP_I915_G,			"915G"},
15603b705cfSriastradh	{PCI_CHIP_E7221_G,			"E7221 (i915)"},
15703b705cfSriastradh	{PCI_CHIP_I915_GM,			"915GM"},
15803b705cfSriastradh	{PCI_CHIP_I945_G,			"945G"},
15903b705cfSriastradh	{PCI_CHIP_I945_GM,			"945GM"},
16003b705cfSriastradh	{PCI_CHIP_I945_GME,			"945GME"},
16103b705cfSriastradh	{PCI_CHIP_PINEVIEW_M,			"Pineview GM"},
16203b705cfSriastradh	{PCI_CHIP_PINEVIEW_G,			"Pineview G"},
16303b705cfSriastradh	{PCI_CHIP_I965_G,			"965G"},
16403b705cfSriastradh	{PCI_CHIP_G35_G,			"G35"},
16503b705cfSriastradh	{PCI_CHIP_I965_Q,			"965Q"},
16603b705cfSriastradh	{PCI_CHIP_I946_GZ,			"946GZ"},
16703b705cfSriastradh	{PCI_CHIP_I965_GM,			"965GM"},
16803b705cfSriastradh	{PCI_CHIP_I965_GME,			"965GME/GLE"},
16903b705cfSriastradh	{PCI_CHIP_G33_G,			"G33"},
17003b705cfSriastradh	{PCI_CHIP_Q35_G,			"Q35"},
17103b705cfSriastradh	{PCI_CHIP_Q33_G,			"Q33"},
17203b705cfSriastradh	{PCI_CHIP_GM45_GM,			"GM45"},
17303b705cfSriastradh	{PCI_CHIP_G45_E_G,			"4 Series"},
17403b705cfSriastradh	{PCI_CHIP_G45_G,			"G45/G43"},
17503b705cfSriastradh	{PCI_CHIP_Q45_G,			"Q45/Q43"},
17603b705cfSriastradh	{PCI_CHIP_G41_G,			"G41"},
17703b705cfSriastradh	{PCI_CHIP_B43_G,			"B43"},
17803b705cfSriastradh	{PCI_CHIP_B43_G1,			"B43"},
17942542f5fSchristos
18042542f5fSchristos	{0, ""},
18142542f5fSchristos
18203b705cfSriastradh	{PCI_CHIP_IRONLAKE_D_G,			"HD Graphics"},
18303b705cfSriastradh	{PCI_CHIP_IRONLAKE_M_G,			"HD Graphics"},
18403b705cfSriastradh	{PCI_CHIP_SANDYBRIDGE_GT1,		"HD Graphics 2000" },
18503b705cfSriastradh	{PCI_CHIP_SANDYBRIDGE_GT2,		"HD Graphics 3000" },
18603b705cfSriastradh	{PCI_CHIP_SANDYBRIDGE_GT2_PLUS,		"HD Graphics 3000" },
18703b705cfSriastradh	{PCI_CHIP_SANDYBRIDGE_M_GT1,		"HD Graphics 2000" },
18803b705cfSriastradh	{PCI_CHIP_SANDYBRIDGE_M_GT2,		"HD Graphics 3000" },
18903b705cfSriastradh	{PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS,	"HD Graphics 3000" },
19003b705cfSriastradh	{PCI_CHIP_SANDYBRIDGE_S_GT,		"HD Graphics" },
19103b705cfSriastradh	{PCI_CHIP_IVYBRIDGE_M_GT1,		"HD Graphics 2500" },
19203b705cfSriastradh	{PCI_CHIP_IVYBRIDGE_M_GT2,		"HD Graphics 4000" },
19303b705cfSriastradh	{PCI_CHIP_IVYBRIDGE_D_GT1,		"HD Graphics 2500" },
19403b705cfSriastradh	{PCI_CHIP_IVYBRIDGE_D_GT2,		"HD Graphics 4000" },
19503b705cfSriastradh	{PCI_CHIP_IVYBRIDGE_S_GT1,		"HD Graphics" },
19603b705cfSriastradh	{PCI_CHIP_IVYBRIDGE_S_GT2,		"HD Graphics P4000" },
19703b705cfSriastradh	{PCI_CHIP_HASWELL_D_GT1,		"HD Graphics" },
19803b705cfSriastradh	{PCI_CHIP_HASWELL_D_GT2,		"HD Graphics 4600" },
19903b705cfSriastradh	{PCI_CHIP_HASWELL_D_GT3,		"HD Graphics 5000" }, /* ??? */
20003b705cfSriastradh	{PCI_CHIP_HASWELL_M_GT1,		"HD Graphics" },
20103b705cfSriastradh	{PCI_CHIP_HASWELL_M_GT2,		"HD Graphics 4600" },
20203b705cfSriastradh	{PCI_CHIP_HASWELL_M_GT3,		"HD Graphics 5000" }, /* ??? */
20303b705cfSriastradh	{PCI_CHIP_HASWELL_S_GT1,		"HD Graphics" },
20403b705cfSriastradh	{PCI_CHIP_HASWELL_S_GT2,		"HD Graphics P4600/P4700" },
20503b705cfSriastradh	{PCI_CHIP_HASWELL_S_GT3,		"HD Graphics 5000" }, /* ??? */
20603b705cfSriastradh	{PCI_CHIP_HASWELL_B_GT1,		"HD Graphics" }, /* ??? */
20703b705cfSriastradh	{PCI_CHIP_HASWELL_B_GT2,		"HD Graphics" }, /* ??? */
20803b705cfSriastradh	{PCI_CHIP_HASWELL_B_GT3,		"HD Graphics" }, /* ??? */
20903b705cfSriastradh	{PCI_CHIP_HASWELL_E_GT1,		"HD Graphics" },
21003b705cfSriastradh	{PCI_CHIP_HASWELL_E_GT2,		"HD Graphics" }, /* ??? */
21103b705cfSriastradh	{PCI_CHIP_HASWELL_E_GT3,		"HD Graphics" }, /* ??? */
21203b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_D_GT1,		"HD Graphics" }, /* ??? */
21303b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_D_GT2,		"HD Graphics" }, /* ??? */
21403b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_D_GT3,		"Iris(TM) Graphics 5100" },
21503b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_M_GT1,		"HD Graphics" },
21603b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_M_GT2,		"HD Graphics 4400" },
21703b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_M_GT3,		"HD Graphics 5000" },
21803b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_S_GT1,		"HD Graphics" }, /* ??? */
21903b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_S_GT2,		"HD Graphics" }, /* ??? */
22003b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_S_GT3,		"Iris(TM) Graphics 5100" },
22103b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_B_GT1,		"HD Graphics" }, /* ??? */
22203b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_B_GT2,		"HD Graphics" }, /* ??? */
22303b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_B_GT3,		"Iris(TM) Graphics 5100" },
22403b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_E_GT1,		"HD Graphics" },
22503b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_E_GT2,		"HD Graphics 4200" },
22603b705cfSriastradh	{PCI_CHIP_HASWELL_ULT_E_GT3,		"Iris(TM) Graphics 5100" },
22703b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_D_GT1,		"HD Graphics" }, /* ??? */
22803b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_D_GT2,		"HD Graphics 4600" },
22903b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_D_GT3,		"Iris(TM) Pro Graphics 5200" },
23003b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_M_GT1,		"HD Graphics" }, /* ??? */
23103b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_M_GT2,		"HD Graphics 4600" },
23203b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_M_GT3,		"Iris(TM) Pro Graphics 5200" },
23303b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_S_GT1,		"HD Graphics" }, /* ??? */
23403b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_S_GT2,		"HD Graphics" }, /* ??? */
23503b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_S_GT3,		"Iris(TM) Pro Graphics 5200" },
23603b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_B_GT1,		"HD Graphics" }, /* ??? */
23703b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_B_GT2,		"HD Graphics" }, /* ??? */
23803b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_B_GT3,		"Iris(TM) Pro Graphics 5200" },
23903b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_E_GT1,		"HD Graphics" }, /* ??? */
24003b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_E_GT2,		"HD Graphics" }, /* ??? */
24103b705cfSriastradh	{PCI_CHIP_HASWELL_CRW_E_GT3,		"Iris(TM) Pro Graphics 5200" },
24242542f5fSchristos
24342542f5fSchristos	/* Valleyview (Baytail) */
24442542f5fSchristos	{0x0f30, "HD Graphics"},
24542542f5fSchristos	{0x0f31, "HD Graphics"},
24642542f5fSchristos	{0x0f32, "HD Graphics"},
24742542f5fSchristos	{0x0f33, "HD Graphics"},
24842542f5fSchristos	{0x0155, "HD Graphics"},
24942542f5fSchristos	{0x0157, "HD Graphics"},
25042542f5fSchristos
25142542f5fSchristos	/* Broadwell Marketing names */
252fe8aea9eSmrg	{0x1602, "HD Graphics"},
253fe8aea9eSmrg	{0x1606, "HD Graphics"},
254fe8aea9eSmrg	{0x160B, "HD Graphics"},
255fe8aea9eSmrg	{0x160A, "HD Graphics"},
256fe8aea9eSmrg	{0x160D, "HD Graphics"},
257fe8aea9eSmrg	{0x160E, "HD Graphics"},
258fe8aea9eSmrg	{0x1612, "HD Graphics 5600"},
259fe8aea9eSmrg	{0x1616, "HD Graphics 5500"},
260fe8aea9eSmrg	{0x161B, "HD Graphics"},
261fe8aea9eSmrg	{0x161A, "HD Graphics"},
262fe8aea9eSmrg	{0x161D, "HD Graphics"},
263fe8aea9eSmrg	{0x161E, "HD Graphics 5300"},
264fe8aea9eSmrg	{0x1622, "Iris Pro Graphics 6200"},
265fe8aea9eSmrg	{0x1626, "HD Graphics 6000"},
266fe8aea9eSmrg	{0x162B, "Iris Graphics 6100"},
267fe8aea9eSmrg	{0x162A, "Iris Pro Graphics P6300"},
268fe8aea9eSmrg	{0x162D, "HD Graphics"},
269fe8aea9eSmrg	{0x162E, "HD Graphics"},
270fe8aea9eSmrg	{0x1632, "HD Graphics"},
271fe8aea9eSmrg	{0x1636, "HD Graphics"},
272fe8aea9eSmrg	{0x163B, "HD Graphics"},
273fe8aea9eSmrg	{0x163A, "HD Graphics"},
274fe8aea9eSmrg	{0x163D, "HD Graphics"},
275fe8aea9eSmrg	{0x163E, "HD Graphics"},
276fe8aea9eSmrg
277fe8aea9eSmrg	/* Cherryview (Cherrytrail/Braswell) */
278fe8aea9eSmrg	{0x22b0, "HD Graphics"},
279fe8aea9eSmrg	{0x22b1, "HD Graphics"},
280fe8aea9eSmrg	{0x22b2, "HD Graphics"},
281fe8aea9eSmrg	{0x22b3, "HD Graphics"},
282fe8aea9eSmrg
283fe8aea9eSmrg	/* Skylake */
284fe8aea9eSmrg	{0x1902, "HD Graphics 510"},
285fe8aea9eSmrg	{0x1906, "HD Graphics 510"},
286fe8aea9eSmrg	{0x190B, "HD Graphics 510"},
287fe8aea9eSmrg	{0x1912, "HD Graphics 530"},
288fe8aea9eSmrg	{0x1916, "HD Graphics 520"},
289fe8aea9eSmrg	{0x191B, "HD Graphics 530"},
290fe8aea9eSmrg	{0x191D, "HD Graphics P530"},
291fe8aea9eSmrg	{0x191E, "HD Graphics 515"},
292fe8aea9eSmrg	{0x1921, "HD Graphics 520"},
293fe8aea9eSmrg	{0x1926, "Iris Graphics 540"},
294fe8aea9eSmrg	{0x1927, "Iris Graphics 550"},
295fe8aea9eSmrg	{0x192B, "Iris Graphics 555"},
296fe8aea9eSmrg	{0x192D, "Iris Graphics P555"},
297fe8aea9eSmrg	{0x1932, "Iris Pro Graphics 580"},
298fe8aea9eSmrg	{0x193A, "Iris Pro Graphics P580"},
299fe8aea9eSmrg	{0x193B, "Iris Pro Graphics 580"},
300fe8aea9eSmrg	{0x193D, "Iris Pro Graphics P580"},
301fe8aea9eSmrg
302fe8aea9eSmrg	/* Broxton (Apollolake) */
303fe8aea9eSmrg	{0x5A84, "HD Graphics 505"},
304fe8aea9eSmrg	{0x5A85, "HD Graphics 500"},
305fe8aea9eSmrg
306fe8aea9eSmrg	/* Kabylake */
307fe8aea9eSmrg	{0x5916, "HD Graphics 620"},
308fe8aea9eSmrg	{0x591E, "HD Graphics 615"},
309fe8aea9eSmrg
310fe8aea9eSmrg	/*Coffeelake*/
311fe8aea9eSmrg	{0x3E90, "HD Graphics"},
312fe8aea9eSmrg	{0x3E93, "HD Graphics"},
313fe8aea9eSmrg	{0x3E99, "HD Graphics"},
314fe8aea9eSmrg	{0x3E91, "HD Graphics"},
315fe8aea9eSmrg	{0x3E92, "HD Graphics"},
316fe8aea9eSmrg	{0x3E96, "HD Graphics"},
317fe8aea9eSmrg	{0x3E9A, "HD Graphics"},
318fe8aea9eSmrg	{0x3E9B, "HD Graphics"},
319fe8aea9eSmrg	{0x3E94, "HD Graphics"},
320fe8aea9eSmrg	{0x3EA1, "HD Graphics"},
321fe8aea9eSmrg	{0x3EA4, "HD Graphics"},
322fe8aea9eSmrg	{0x3EA0, "HD Graphics"},
323fe8aea9eSmrg	{0x3EA3, "HD Graphics"},
324fe8aea9eSmrg	{0x3EA9, "HD Graphics"},
325fe8aea9eSmrg	{0x3EA2, "HD Graphics"},
326fe8aea9eSmrg	{0x3EA5, "HD Graphics"},
327fe8aea9eSmrg	{0x3EA6, "HD Graphics"},
328fe8aea9eSmrg	{0x3EA7, "HD Graphics"},
329fe8aea9eSmrg	{0x3EA8, "HD Graphics"},
33042542f5fSchristos
33142542f5fSchristos	/* When adding new identifiers, also update:
33242542f5fSchristos	 * 1. intel_identify()
33342542f5fSchristos	 * 2. man/intel.man
33442542f5fSchristos	 * 3. README
33542542f5fSchristos	 */
33642542f5fSchristos
33742542f5fSchristos	{-1, NULL} /* Sentinel */
33803b705cfSriastradh};
33903b705cfSriastradh
34003b705cfSriastradhstatic const struct pci_id_match intel_device_match[] = {
34142542f5fSchristos#if UMS
34203b705cfSriastradh	INTEL_VGA_DEVICE(PCI_CHIP_I810, &intel_i81x_info),
34303b705cfSriastradh	INTEL_VGA_DEVICE(PCI_CHIP_I810_DC100, &intel_i81x_info),
34403b705cfSriastradh	INTEL_VGA_DEVICE(PCI_CHIP_I810_E, &intel_i81x_info),
34503b705cfSriastradh	INTEL_VGA_DEVICE(PCI_CHIP_I815, &intel_i81x_info),
34603b705cfSriastradh#endif
34703b705cfSriastradh
34842542f5fSchristos#if KMS
34903b705cfSriastradh	INTEL_I830_IDS(&intel_i830_info),
35042542f5fSchristos	INTEL_I845G_IDS(&intel_i845_info),
35103b705cfSriastradh	INTEL_I85X_IDS(&intel_i855_info),
35203b705cfSriastradh	INTEL_I865G_IDS(&intel_i865_info),
35303b705cfSriastradh
35403b705cfSriastradh	INTEL_I915G_IDS(&intel_i915_info),
35503b705cfSriastradh	INTEL_I915GM_IDS(&intel_i915_info),
35603b705cfSriastradh	INTEL_I945G_IDS(&intel_i945_info),
35703b705cfSriastradh	INTEL_I945GM_IDS(&intel_i945_info),
35803b705cfSriastradh
35903b705cfSriastradh	INTEL_G33_IDS(&intel_g33_info),
36003b705cfSriastradh	INTEL_PINEVIEW_IDS(&intel_g33_info),
36103b705cfSriastradh
36203b705cfSriastradh	INTEL_I965G_IDS(&intel_i965_info),
36303b705cfSriastradh	INTEL_I965GM_IDS(&intel_i965_info),
36403b705cfSriastradh
36503b705cfSriastradh	INTEL_G45_IDS(&intel_g4x_info),
36603b705cfSriastradh	INTEL_GM45_IDS(&intel_g4x_info),
36703b705cfSriastradh
36803b705cfSriastradh	INTEL_IRONLAKE_D_IDS(&intel_ironlake_info),
36903b705cfSriastradh	INTEL_IRONLAKE_M_IDS(&intel_ironlake_info),
37003b705cfSriastradh
37103b705cfSriastradh	INTEL_SNB_D_IDS(&intel_sandybridge_info),
37203b705cfSriastradh	INTEL_SNB_M_IDS(&intel_sandybridge_info),
37303b705cfSriastradh
37403b705cfSriastradh	INTEL_IVB_D_IDS(&intel_ivybridge_info),
37503b705cfSriastradh	INTEL_IVB_M_IDS(&intel_ivybridge_info),
37603b705cfSriastradh
377fe8aea9eSmrg	INTEL_HSW_IDS(&intel_haswell_info),
378fe8aea9eSmrg	INTEL_VLV_IDS(&intel_valleyview_info),
379fe8aea9eSmrg	INTEL_BDW_IDS(&intel_broadwell_info),
38042542f5fSchristos	INTEL_CHV_IDS(&intel_cherryview_info),
38113496ba1Ssnj	INTEL_SKL_IDS(&intel_skylake_info),
382fe8aea9eSmrg	INTEL_BXT_IDS(&intel_broxton_info),
383fe8aea9eSmrg	INTEL_KBL_IDS(&intel_kabylake_info),
384fe8aea9eSmrg	INTEL_GLK_IDS(&intel_geminilake_info),
385fe8aea9eSmrg
386fe8aea9eSmrg	INTEL_CFL_IDS(&intel_coffeelake_info),
38713496ba1Ssnj
38803b705cfSriastradh	INTEL_VGA_DEVICE(PCI_MATCH_ANY, &intel_generic_info),
38903b705cfSriastradh#endif
39003b705cfSriastradh
39103b705cfSriastradh	{ 0, 0, 0 },
39203b705cfSriastradh};
39303b705cfSriastradh
39403b705cfSriastradhvoid
39513496ba1Ssnjintel_detect_chipset(ScrnInfoPtr scrn, struct intel_device *dev)
39603b705cfSriastradh{
39742542f5fSchristos	int devid;
39813496ba1Ssnj	const char *name = NULL;
39903b705cfSriastradh	int i;
40003b705cfSriastradh
40113496ba1Ssnj	if (dev == NULL) {
40213496ba1Ssnj		EntityInfoPtr ent;
40342542f5fSchristos		struct pci_device *pci;
40442542f5fSchristos
40513496ba1Ssnj		ent = xf86GetEntityInfo(scrn->entityList[0]);
40613496ba1Ssnj		if (ent->device->chipID >= 0) {
40713496ba1Ssnj			xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
40813496ba1Ssnj				   "ChipID override: 0x%04X\n",
40913496ba1Ssnj				   ent->device->chipID);
41013496ba1Ssnj			devid = ent->device->chipID;
41113496ba1Ssnj		} else {
41213496ba1Ssnj			pci = xf86GetPciInfoForEntity(ent->index);
41313496ba1Ssnj			if (pci)
41413496ba1Ssnj				devid = pci->device_id;
41513496ba1Ssnj			else
41613496ba1Ssnj				devid = ~0;
41713496ba1Ssnj		}
41813496ba1Ssnj	} else
41913496ba1Ssnj		devid = intel_get_device_id(dev);
42003b705cfSriastradh
42103b705cfSriastradh	for (i = 0; intel_chipsets[i].name != NULL; i++) {
42242542f5fSchristos		if (devid == intel_chipsets[i].token) {
42303b705cfSriastradh			name = intel_chipsets[i].name;
42403b705cfSriastradh			break;
42503b705cfSriastradh		}
42603b705cfSriastradh	}
42703b705cfSriastradh	if (name == NULL) {
42803b705cfSriastradh		int gen = 0;
42903b705cfSriastradh
43003b705cfSriastradh		for (i = 0; intel_device_match[i].device_id != 0; i++) {
43142542f5fSchristos			if (devid == intel_device_match[i].device_id) {
43203b705cfSriastradh				const struct intel_device_info *info = (void *)intel_device_match[i].match_data;
43303b705cfSriastradh				gen = info->gen >> 3;
43403b705cfSriastradh				break;
43503b705cfSriastradh			}
43603b705cfSriastradh		}
43703b705cfSriastradh
43842542f5fSchristos		if (gen) {
43913496ba1Ssnj			xf86DrvMsg(scrn->scrnIndex, X_PROBED,
44003b705cfSriastradh				   "gen%d engineering sample\n", gen);
44103b705cfSriastradh		} else {
44203b705cfSriastradh			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
44303b705cfSriastradh				   "Unknown chipset\n");
44403b705cfSriastradh		}
44542542f5fSchristos
44603b705cfSriastradh		name = "unknown";
44703b705cfSriastradh	} else {
44813496ba1Ssnj		xf86DrvMsg(scrn->scrnIndex, X_PROBED,
44903b705cfSriastradh			   "Integrated Graphics Chipset: Intel(R) %s\n",
45003b705cfSriastradh			   name);
45103b705cfSriastradh	}
45203b705cfSriastradh
45303b705cfSriastradh	scrn->chipset = (char *)name;
45403b705cfSriastradh}
45503b705cfSriastradh
45603b705cfSriastradh/*
45703b705cfSriastradh * intel_identify --
45803b705cfSriastradh *
45903b705cfSriastradh * Returns the string name for the driver based on the chipset.
46003b705cfSriastradh *
46103b705cfSriastradh */
46203b705cfSriastradhstatic void intel_identify(int flags)
46303b705cfSriastradh{
46403b705cfSriastradh	const SymTabRec *chipset;
46503b705cfSriastradh	const char *stack[64], **unique;
46603b705cfSriastradh	int i, j, size, len;
46703b705cfSriastradh
46803b705cfSriastradh	unique = stack;
46903b705cfSriastradh	size = sizeof(stack)/sizeof(stack[0]);
47003b705cfSriastradh	i = 0;
47103b705cfSriastradh
47203b705cfSriastradh	xf86Msg(X_INFO, INTEL_NAME ": Driver for Intel(R) Integrated Graphics Chipsets:\n\t");
47303b705cfSriastradh	len = 8;
47403b705cfSriastradh
47542542f5fSchristos	for (chipset = intel_chipsets; chipset->token; chipset++) {
47603b705cfSriastradh		for (j = i; --j >= 0;)
47703b705cfSriastradh			if (strcmp(unique[j], chipset->name) == 0)
47803b705cfSriastradh				break;
47903b705cfSriastradh		if (j < 0) {
48003b705cfSriastradh			int name_len = strlen(chipset->name);
48103b705cfSriastradh			if (i != 0) {
48203b705cfSriastradh				xf86ErrorF(",");
48303b705cfSriastradh				len++;
48403b705cfSriastradh				if (len + 2 + name_len < 78) {
48503b705cfSriastradh					xf86ErrorF(" ");
48603b705cfSriastradh					len++;
48703b705cfSriastradh				} else {
48803b705cfSriastradh					xf86ErrorF("\n\t");
48903b705cfSriastradh					len = 8;
49003b705cfSriastradh				}
49103b705cfSriastradh			}
49203b705cfSriastradh			xf86ErrorF("%s", chipset->name);
49303b705cfSriastradh			len += name_len;
49403b705cfSriastradh
49503b705cfSriastradh			if (i == size) {
49603b705cfSriastradh				const char **new_unique;
49703b705cfSriastradh
49803b705cfSriastradh				if (unique == stack)
49903b705cfSriastradh					new_unique = malloc(2*sizeof(*unique)*size);
50003b705cfSriastradh				else
50103b705cfSriastradh					new_unique = realloc(unique, 2*sizeof(*unique)*size);
50203b705cfSriastradh				if (new_unique != NULL) {
50303b705cfSriastradh					if (unique == stack)
50403b705cfSriastradh						memcpy(new_unique, stack,
50503b705cfSriastradh						       sizeof(stack));
50603b705cfSriastradh					unique = new_unique;
50703b705cfSriastradh					size *= 2;
50803b705cfSriastradh				}
50903b705cfSriastradh			}
51003b705cfSriastradh			if (i < size)
51103b705cfSriastradh				unique[i++] = chipset->name;
51203b705cfSriastradh		}
51303b705cfSriastradh	}
51403b705cfSriastradh	xf86ErrorF("\n");
51503b705cfSriastradh	if (unique != stack)
51603b705cfSriastradh		free(unique);
51742542f5fSchristos
518fe8aea9eSmrg	xf86Msg(X_INFO, INTEL_NAME ": Driver for Intel(R) HD Graphics\n");
519fe8aea9eSmrg	xf86Msg(X_INFO, INTEL_NAME ": Driver for Intel(R) Iris(TM) Graphics\n");
520fe8aea9eSmrg	xf86Msg(X_INFO, INTEL_NAME ": Driver for Intel(R) Iris(TM) Pro Graphics\n");
52103b705cfSriastradh}
52203b705cfSriastradh
52303b705cfSriastradhstatic Bool intel_driver_func(ScrnInfoPtr pScrn,
52403b705cfSriastradh			      xorgDriverFuncOp op,
52503b705cfSriastradh			      pointer ptr)
52603b705cfSriastradh{
52703b705cfSriastradh	xorgHWFlags *flag;
52803b705cfSriastradh
52903b705cfSriastradh	switch (op) {
53003b705cfSriastradh	case GET_REQUIRED_HW_INTERFACES:
53103b705cfSriastradh		flag = (CARD32*)ptr;
53203b705cfSriastradh		(*flag) = 0;
53342542f5fSchristos#if UMS
53403b705cfSriastradh		(*flag) = HW_IO | HW_MMIO;
53503b705cfSriastradh#endif
53603b705cfSriastradh#ifdef HW_SKIP_CONSOLE
53703b705cfSriastradh		if (hosted())
53803b705cfSriastradh			(*flag) = HW_SKIP_CONSOLE;
53903b705cfSriastradh#endif
54003b705cfSriastradh
54103b705cfSriastradh		return TRUE;
54242542f5fSchristos
54342542f5fSchristos#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,902,0)
54442542f5fSchristos	case SUPPORTS_SERVER_FDS:
54542542f5fSchristos		return TRUE;
54642542f5fSchristos#endif
54742542f5fSchristos
54803b705cfSriastradh	default:
54903b705cfSriastradh		/* Unknown or deprecated function */
55003b705cfSriastradh		return FALSE;
55103b705cfSriastradh	}
55203b705cfSriastradh}
55303b705cfSriastradh
55442542f5fSchristos#if KMS
55503b705cfSriastradhextern XF86ConfigPtr xf86configptr;
55603b705cfSriastradh
55703b705cfSriastradhstatic XF86ConfDevicePtr
55803b705cfSriastradh_xf86findDriver(const char *ident, XF86ConfDevicePtr p)
55903b705cfSriastradh{
56003b705cfSriastradh	while (p) {
56103b705cfSriastradh		if (p->dev_driver && xf86nameCompare(ident, p->dev_driver) == 0)
56203b705cfSriastradh			return p;
56303b705cfSriastradh
56403b705cfSriastradh		p = p->list.next;
56503b705cfSriastradh	}
56603b705cfSriastradh
56703b705cfSriastradh	return NULL;
56803b705cfSriastradh}
56903b705cfSriastradh
570d7a5c675Stsutsuistatic enum accel_method { NOACCEL, SNA, UXA } get_accel_method(enum accel_method accel_method)
57103b705cfSriastradh{
57203b705cfSriastradh	XF86ConfDevicePtr dev;
57303b705cfSriastradh
57403b705cfSriastradh	if (hosted())
57503b705cfSriastradh		return SNA;
57603b705cfSriastradh
577fe8aea9eSmrg	if (xf86configptr == NULL) /* X -configure */
578fe8aea9eSmrg		return SNA;
579fe8aea9eSmrg
58003b705cfSriastradh	dev = _xf86findDriver("intel", xf86configptr->conf_device_lst);
58103b705cfSriastradh	if (dev && dev->dev_option_lst) {
58203b705cfSriastradh		const char *s;
58303b705cfSriastradh
58403b705cfSriastradh		s = xf86FindOptionValue(dev->dev_option_lst, "AccelMethod");
58503b705cfSriastradh		if (s ) {
58642542f5fSchristos			if (strcasecmp(s, "none") == 0)
58742542f5fSchristos				accel_method = NOACCEL;
58842542f5fSchristos			else if (strcasecmp(s, "sna") == 0)
58903b705cfSriastradh				accel_method = SNA;
59003b705cfSriastradh			else if (strcasecmp(s, "uxa") == 0)
59103b705cfSriastradh				accel_method = UXA;
59203b705cfSriastradh		}
59303b705cfSriastradh	}
59403b705cfSriastradh
59503b705cfSriastradh	return accel_method;
59603b705cfSriastradh}
59703b705cfSriastradh#endif
59803b705cfSriastradh
59903b705cfSriastradhstatic Bool
60003b705cfSriastradhintel_scrn_create(DriverPtr		driver,
60103b705cfSriastradh		  int			entity_num,
60203b705cfSriastradh		  intptr_t		match_data,
60303b705cfSriastradh		  unsigned		flags)
60403b705cfSriastradh{
60503b705cfSriastradh	ScrnInfoPtr scrn;
60603b705cfSriastradh
60742542f5fSchristos	if (match_data == 0) {
60842542f5fSchristos		int devid = intel_entity_get_devid(entity_num), i;
60942542f5fSchristos		if (devid == 0)
61042542f5fSchristos			return FALSE;
61142542f5fSchristos
61242542f5fSchristos		for (i = 0; intel_device_match[i].device_id != 0; i++) {
61342542f5fSchristos			if (devid == intel_device_match[i].device_id) {
61442542f5fSchristos				match_data = (intptr_t)&intel_device_match[i];
61542542f5fSchristos				break;
61642542f5fSchristos			}
61742542f5fSchristos		}
61842542f5fSchristos
61942542f5fSchristos		if (match_data == 0)
62042542f5fSchristos			return FALSE;
62142542f5fSchristos	}
62242542f5fSchristos
62303b705cfSriastradh	scrn = xf86AllocateScreen(driver, flags);
62403b705cfSriastradh	if (scrn == NULL)
62503b705cfSriastradh		return FALSE;
62603b705cfSriastradh
62703b705cfSriastradh	scrn->driverVersion = INTEL_VERSION;
62803b705cfSriastradh	scrn->driverName = (char *)INTEL_DRIVER_NAME;
62903b705cfSriastradh	scrn->name = (char *)INTEL_NAME;
63042542f5fSchristos	scrn->driverPrivate = (void *)(match_data | (flags & XF86_ALLOCATE_GPU_SCREEN) | 2);
63103b705cfSriastradh	scrn->Probe = NULL;
63203b705cfSriastradh
63303b705cfSriastradh	if (xf86IsEntitySharable(entity_num))
63403b705cfSriastradh		xf86SetEntityShared(entity_num);
63503b705cfSriastradh	xf86AddEntityToScreen(scrn, entity_num);
63603b705cfSriastradh
63742542f5fSchristos#if UMS
63803b705cfSriastradh	if ((unsigned)((struct intel_device_info *)match_data)->gen < 020)
63903b705cfSriastradh		return lg_i810_init(scrn);
64003b705cfSriastradh#endif
64103b705cfSriastradh
64242542f5fSchristos#if KMS
643d7a5c675Stsutsui	enum accel_method default_accel_method = DEFAULT_ACCEL_METHOD;
644d7a5c675Stsutsui	/*
645d7a5c675Stsutsui	 * XXX
646d7a5c675Stsutsui	 * Use UXA by default for Gen3/4/5 chipsets (except 915) to avoid
647d7a5c675Stsutsui	 * screen corruption etc.  (PR/54995, PR/55198)
648d7a5c675Stsutsui	 */
649d7a5c675Stsutsui	if ((unsigned)((struct intel_device_info *)match_data)->gen > 030 &&
650d7a5c675Stsutsui	    (unsigned)((struct intel_device_info *)match_data)->gen < 060)
651d7a5c675Stsutsui		default_accel_method = UXA;
652d7a5c675Stsutsui
653d7a5c675Stsutsui	switch (get_accel_method(default_accel_method)) {
65403b705cfSriastradh#if USE_SNA
65542542f5fSchristos	case NOACCEL:
65642542f5fSchristos	case SNA:
65742542f5fSchristos		return sna_init_scrn(scrn, entity_num);
65803b705cfSriastradh#endif
65903b705cfSriastradh#if USE_UXA
66042542f5fSchristos#if !USE_SNA
66142542f5fSchristos	case NOACCEL:
66242542f5fSchristos#endif
66342542f5fSchristos	case UXA:
664fe8aea9eSmrg		return intel_init_scrn(scrn);
66503b705cfSriastradh#endif
66603b705cfSriastradh
667fe8aea9eSmrg	default:
668fe8aea9eSmrg#if USE_SNA
669fe8aea9eSmrg		return sna_init_scrn(scrn, entity_num);
670fe8aea9eSmrg#elif USE_UXA
671fe8aea9eSmrg		return intel_init_scrn(scrn);
672fe8aea9eSmrg#else
673fe8aea9eSmrg		break;
674fe8aea9eSmrg#endif
67503b705cfSriastradh	}
67603b705cfSriastradh#endif
67703b705cfSriastradh
67803b705cfSriastradh	return FALSE;
67903b705cfSriastradh}
68003b705cfSriastradh
68103b705cfSriastradh/*
68203b705cfSriastradh * intel_pci_probe --
68303b705cfSriastradh *
68403b705cfSriastradh * Look through the PCI bus to find cards that are intel boards.
68503b705cfSriastradh * Setup the dispatch table for the rest of the driver functions.
68603b705cfSriastradh *
68703b705cfSriastradh */
68803b705cfSriastradhstatic Bool intel_pci_probe(DriverPtr		driver,
68903b705cfSriastradh			    int			entity_num,
69003b705cfSriastradh			    struct pci_device	*pci,
69103b705cfSriastradh			    intptr_t		match_data)
69203b705cfSriastradh{
693fe8aea9eSmrg	Bool ret;
694fe8aea9eSmrg
69503b705cfSriastradh	if (intel_open_device(entity_num, pci, NULL) == -1) {
69642542f5fSchristos#if UMS
69703b705cfSriastradh		switch (pci->device_id) {
69803b705cfSriastradh		case PCI_CHIP_I810:
69903b705cfSriastradh		case PCI_CHIP_I810_DC100:
70003b705cfSriastradh		case PCI_CHIP_I810_E:
70103b705cfSriastradh		case PCI_CHIP_I815:
70203b705cfSriastradh			if (!hosted())
70303b705cfSriastradh				break;
70403b705cfSriastradh		default:
70503b705cfSriastradh			return FALSE;
70603b705cfSriastradh		}
70742542f5fSchristos#else
70842542f5fSchristos		return FALSE;
70903b705cfSriastradh#endif
71003b705cfSriastradh	}
71103b705cfSriastradh
712fe8aea9eSmrg	ret = intel_scrn_create(driver, entity_num, match_data, 0);
713fe8aea9eSmrg	if (!ret)
714fe8aea9eSmrg		intel_close_device(entity_num);
715fe8aea9eSmrg
716fe8aea9eSmrg	return ret;
71703b705cfSriastradh}
71803b705cfSriastradh
71903b705cfSriastradh#ifdef XSERVER_PLATFORM_BUS
72003b705cfSriastradhstatic Bool
72103b705cfSriastradhintel_platform_probe(DriverPtr driver,
72203b705cfSriastradh		     int entity_num, int flags,
72303b705cfSriastradh		     struct xf86_platform_device *dev,
72403b705cfSriastradh		     intptr_t match_data)
72503b705cfSriastradh{
72603b705cfSriastradh	unsigned scrn_flags = 0;
72703b705cfSriastradh
72842542f5fSchristos	if (intel_open_device(entity_num, dev->pdev, dev) == -1)
72903b705cfSriastradh		return FALSE;
73003b705cfSriastradh
73103b705cfSriastradh	/* Allow ourselves to act as a slaved output if not primary */
73203b705cfSriastradh	if (flags & PLATFORM_PROBE_GPU_SCREEN) {
73303b705cfSriastradh		flags &= ~PLATFORM_PROBE_GPU_SCREEN;
73403b705cfSriastradh		scrn_flags |= XF86_ALLOCATE_GPU_SCREEN;
73503b705cfSriastradh	}
73603b705cfSriastradh
73703b705cfSriastradh	/* if we get any flags we don't understand fail to probe for now */
73803b705cfSriastradh	if (flags)
739fe8aea9eSmrg		goto err;
74003b705cfSriastradh
741fe8aea9eSmrg	if (!intel_scrn_create(driver, entity_num, match_data, scrn_flags))
742fe8aea9eSmrg		goto err;
743fe8aea9eSmrg
744fe8aea9eSmrg	return TRUE;
745fe8aea9eSmrg
746fe8aea9eSmrgerr:
747fe8aea9eSmrg	intel_close_device(entity_num);
748fe8aea9eSmrg	return FALSE;
74903b705cfSriastradh}
75003b705cfSriastradh#endif
75103b705cfSriastradh
75203b705cfSriastradh#ifdef XFree86LOADER
75303b705cfSriastradh
75403b705cfSriastradhstatic MODULESETUPPROTO(intel_setup);
75503b705cfSriastradh
75603b705cfSriastradhstatic XF86ModuleVersionInfo intel_version = {
75703b705cfSriastradh	"intel",
75803b705cfSriastradh	MODULEVENDORSTRING,
75903b705cfSriastradh	MODINFOSTRING1,
76003b705cfSriastradh	MODINFOSTRING2,
76103b705cfSriastradh	XORG_VERSION_CURRENT,
76203b705cfSriastradh	INTEL_VERSION_MAJOR, INTEL_VERSION_MINOR, INTEL_VERSION_PATCH,
76303b705cfSriastradh	ABI_CLASS_VIDEODRV,
76403b705cfSriastradh	ABI_VIDEODRV_VERSION,
76503b705cfSriastradh	MOD_CLASS_VIDEODRV,
76603b705cfSriastradh	{0, 0, 0, 0}
76703b705cfSriastradh};
76803b705cfSriastradh
76903b705cfSriastradhstatic const OptionInfoRec *
77003b705cfSriastradhintel_available_options(int chipid, int busid)
77103b705cfSriastradh{
77203b705cfSriastradh	switch (chipid) {
77342542f5fSchristos#if UMS
77403b705cfSriastradh	case PCI_CHIP_I810:
77503b705cfSriastradh	case PCI_CHIP_I810_DC100:
77603b705cfSriastradh	case PCI_CHIP_I810_E:
77703b705cfSriastradh	case PCI_CHIP_I815:
77803b705cfSriastradh		return lg_i810_available_options(chipid, busid);
77903b705cfSriastradh#endif
78003b705cfSriastradh
78103b705cfSriastradh	default:
78203b705cfSriastradh		return intel_options;
78303b705cfSriastradh	}
78403b705cfSriastradh}
78503b705cfSriastradh
78603b705cfSriastradhstatic DriverRec intel = {
78703b705cfSriastradh	INTEL_VERSION,
78803b705cfSriastradh	(char *)INTEL_DRIVER_NAME,
78903b705cfSriastradh	intel_identify,
79003b705cfSriastradh	NULL,
79103b705cfSriastradh	intel_available_options,
79203b705cfSriastradh	NULL,
79303b705cfSriastradh	0,
79403b705cfSriastradh	intel_driver_func,
79503b705cfSriastradh	intel_device_match,
79603b705cfSriastradh	intel_pci_probe,
79703b705cfSriastradh#ifdef XSERVER_PLATFORM_BUS
79803b705cfSriastradh	intel_platform_probe
79903b705cfSriastradh#endif
80003b705cfSriastradh};
80103b705cfSriastradh
80203b705cfSriastradhstatic pointer intel_setup(pointer module,
80303b705cfSriastradh			   pointer opts,
80403b705cfSriastradh			   int *errmaj,
80503b705cfSriastradh			   int *errmin)
80603b705cfSriastradh{
80703b705cfSriastradh	static Bool setupDone = 0;
80803b705cfSriastradh
80903b705cfSriastradh	/* This module should be loaded only once, but check to be sure.
81003b705cfSriastradh	*/
81103b705cfSriastradh	if (!setupDone) {
81203b705cfSriastradh		setupDone = 1;
81303b705cfSriastradh		xf86AddDriver(&intel, module, HaveDriverFuncs);
81403b705cfSriastradh
81503b705cfSriastradh		/*
81603b705cfSriastradh		 * The return value must be non-NULL on success even though there
81703b705cfSriastradh		 * is no TearDownProc.
81803b705cfSriastradh		 */
81903b705cfSriastradh		return (pointer) 1;
82003b705cfSriastradh	} else {
82103b705cfSriastradh		if (errmaj)
82203b705cfSriastradh			*errmaj = LDR_ONCEONLY;
82303b705cfSriastradh		return NULL;
82403b705cfSriastradh	}
82503b705cfSriastradh}
82603b705cfSriastradh
82703b705cfSriastradh_X_EXPORT XF86ModuleData intelModuleData = { &intel_version, intel_setup, NULL };
82803b705cfSriastradh#endif
829