18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Intel AGPGART routines.
38c2ecf20Sopenharmony_ci */
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/module.h>
68c2ecf20Sopenharmony_ci#include <linux/pci.h>
78c2ecf20Sopenharmony_ci#include <linux/slab.h>
88c2ecf20Sopenharmony_ci#include <linux/init.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/pagemap.h>
118c2ecf20Sopenharmony_ci#include <linux/agp_backend.h>
128c2ecf20Sopenharmony_ci#include <asm/smp.h>
138c2ecf20Sopenharmony_ci#include "agp.h"
148c2ecf20Sopenharmony_ci#include "intel-agp.h"
158c2ecf20Sopenharmony_ci#include <drm/intel-gtt.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistatic int intel_fetch_size(void)
188c2ecf20Sopenharmony_ci{
198c2ecf20Sopenharmony_ci	int i;
208c2ecf20Sopenharmony_ci	u16 temp;
218c2ecf20Sopenharmony_ci	struct aper_size_info_16 *values;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_APSIZE, &temp);
248c2ecf20Sopenharmony_ci	values = A_SIZE_16(agp_bridge->driver->aperture_sizes);
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
278c2ecf20Sopenharmony_ci		if (temp == values[i].size_value) {
288c2ecf20Sopenharmony_ci			agp_bridge->previous_size = agp_bridge->current_size = (void *) (values + i);
298c2ecf20Sopenharmony_ci			agp_bridge->aperture_size_idx = i;
308c2ecf20Sopenharmony_ci			return values[i].size;
318c2ecf20Sopenharmony_ci		}
328c2ecf20Sopenharmony_ci	}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	return 0;
358c2ecf20Sopenharmony_ci}
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistatic int __intel_8xx_fetch_size(u8 temp)
388c2ecf20Sopenharmony_ci{
398c2ecf20Sopenharmony_ci	int i;
408c2ecf20Sopenharmony_ci	struct aper_size_info_8 *values;
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
458c2ecf20Sopenharmony_ci		if (temp == values[i].size_value) {
468c2ecf20Sopenharmony_ci			agp_bridge->previous_size =
478c2ecf20Sopenharmony_ci				agp_bridge->current_size = (void *) (values + i);
488c2ecf20Sopenharmony_ci			agp_bridge->aperture_size_idx = i;
498c2ecf20Sopenharmony_ci			return values[i].size;
508c2ecf20Sopenharmony_ci		}
518c2ecf20Sopenharmony_ci	}
528c2ecf20Sopenharmony_ci	return 0;
538c2ecf20Sopenharmony_ci}
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistatic int intel_8xx_fetch_size(void)
568c2ecf20Sopenharmony_ci{
578c2ecf20Sopenharmony_ci	u8 temp;
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp);
608c2ecf20Sopenharmony_ci	return __intel_8xx_fetch_size(temp);
618c2ecf20Sopenharmony_ci}
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cistatic int intel_815_fetch_size(void)
648c2ecf20Sopenharmony_ci{
658c2ecf20Sopenharmony_ci	u8 temp;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	/* Intel 815 chipsets have a _weird_ APSIZE register with only
688c2ecf20Sopenharmony_ci	 * one non-reserved bit, so mask the others out ... */
698c2ecf20Sopenharmony_ci	pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp);
708c2ecf20Sopenharmony_ci	temp &= (1 << 3);
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	return __intel_8xx_fetch_size(temp);
738c2ecf20Sopenharmony_ci}
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic void intel_tlbflush(struct agp_memory *mem)
768c2ecf20Sopenharmony_ci{
778c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2200);
788c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
798c2ecf20Sopenharmony_ci}
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistatic void intel_8xx_tlbflush(struct agp_memory *mem)
838c2ecf20Sopenharmony_ci{
848c2ecf20Sopenharmony_ci	u32 temp;
858c2ecf20Sopenharmony_ci	pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
868c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp & ~(1 << 7));
878c2ecf20Sopenharmony_ci	pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
888c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp | (1 << 7));
898c2ecf20Sopenharmony_ci}
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_cistatic void intel_cleanup(void)
938c2ecf20Sopenharmony_ci{
948c2ecf20Sopenharmony_ci	u16 temp;
958c2ecf20Sopenharmony_ci	struct aper_size_info_16 *previous_size;
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci	previous_size = A_SIZE_16(agp_bridge->previous_size);
988c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp);
998c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9));
1008c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value);
1018c2ecf20Sopenharmony_ci}
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_cistatic void intel_8xx_cleanup(void)
1058c2ecf20Sopenharmony_ci{
1068c2ecf20Sopenharmony_ci	u16 temp;
1078c2ecf20Sopenharmony_ci	struct aper_size_info_8 *previous_size;
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci	previous_size = A_SIZE_8(agp_bridge->previous_size);
1108c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp);
1118c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9));
1128c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value);
1138c2ecf20Sopenharmony_ci}
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_cistatic int intel_configure(void)
1178c2ecf20Sopenharmony_ci{
1188c2ecf20Sopenharmony_ci	u16 temp2;
1198c2ecf20Sopenharmony_ci	struct aper_size_info_16 *current_size;
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci	current_size = A_SIZE_16(agp_bridge->current_size);
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci	/* aperture size */
1248c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	/* address to map to */
1278c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
1288c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	/* attbase - aperture base */
1318c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci	/* agpctrl */
1348c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x2280);
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci	/* paccfg/nbxcfg */
1378c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
1388c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG,
1398c2ecf20Sopenharmony_ci			(temp2 & ~(1 << 10)) | (1 << 9));
1408c2ecf20Sopenharmony_ci	/* clear any possible error conditions */
1418c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_ERRSTS + 1, 7);
1428c2ecf20Sopenharmony_ci	return 0;
1438c2ecf20Sopenharmony_ci}
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_cistatic int intel_815_configure(void)
1468c2ecf20Sopenharmony_ci{
1478c2ecf20Sopenharmony_ci	u32 addr;
1488c2ecf20Sopenharmony_ci	u8 temp2;
1498c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci	/* attbase - aperture base */
1528c2ecf20Sopenharmony_ci	/* the Intel 815 chipset spec. says that bits 29-31 in the
1538c2ecf20Sopenharmony_ci	* ATTBASE register are reserved -> try not to write them */
1548c2ecf20Sopenharmony_ci	if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) {
1558c2ecf20Sopenharmony_ci		dev_emerg(&agp_bridge->dev->dev, "gatt bus addr too high");
1568c2ecf20Sopenharmony_ci		return -EINVAL;
1578c2ecf20Sopenharmony_ci	}
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	/* aperture size */
1628c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
1638c2ecf20Sopenharmony_ci			current_size->size_value);
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci	/* address to map to */
1668c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
1678c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci	pci_read_config_dword(agp_bridge->dev, INTEL_ATTBASE, &addr);
1708c2ecf20Sopenharmony_ci	addr &= INTEL_815_ATTBASE_MASK;
1718c2ecf20Sopenharmony_ci	addr |= agp_bridge->gatt_bus_addr;
1728c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, addr);
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci	/* agpctrl */
1758c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	/* apcont */
1788c2ecf20Sopenharmony_ci	pci_read_config_byte(agp_bridge->dev, INTEL_815_APCONT, &temp2);
1798c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_815_APCONT, temp2 | (1 << 1));
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci	/* clear any possible error conditions */
1828c2ecf20Sopenharmony_ci	/* Oddness : this chipset seems to have no ERRSTS register ! */
1838c2ecf20Sopenharmony_ci	return 0;
1848c2ecf20Sopenharmony_ci}
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_cistatic void intel_820_tlbflush(struct agp_memory *mem)
1878c2ecf20Sopenharmony_ci{
1888c2ecf20Sopenharmony_ci	return;
1898c2ecf20Sopenharmony_ci}
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_cistatic void intel_820_cleanup(void)
1928c2ecf20Sopenharmony_ci{
1938c2ecf20Sopenharmony_ci	u8 temp;
1948c2ecf20Sopenharmony_ci	struct aper_size_info_8 *previous_size;
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci	previous_size = A_SIZE_8(agp_bridge->previous_size);
1978c2ecf20Sopenharmony_ci	pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp);
1988c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR,
1998c2ecf20Sopenharmony_ci			temp & ~(1 << 1));
2008c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE,
2018c2ecf20Sopenharmony_ci			previous_size->size_value);
2028c2ecf20Sopenharmony_ci}
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_cistatic int intel_820_configure(void)
2068c2ecf20Sopenharmony_ci{
2078c2ecf20Sopenharmony_ci	u8 temp2;
2088c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci	/* aperture size */
2138c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	/* address to map to */
2168c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
2178c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci	/* attbase - aperture base */
2208c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	/* agpctrl */
2238c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	/* global enable aperture access */
2268c2ecf20Sopenharmony_ci	/* This flag is not accessed through MCHCFG register as in */
2278c2ecf20Sopenharmony_ci	/* i850 chipset. */
2288c2ecf20Sopenharmony_ci	pci_read_config_byte(agp_bridge->dev, INTEL_I820_RDCR, &temp2);
2298c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_I820_RDCR, temp2 | (1 << 1));
2308c2ecf20Sopenharmony_ci	/* clear any possible AGP-related error conditions */
2318c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I820_ERRSTS, 0x001c);
2328c2ecf20Sopenharmony_ci	return 0;
2338c2ecf20Sopenharmony_ci}
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_cistatic int intel_840_configure(void)
2368c2ecf20Sopenharmony_ci{
2378c2ecf20Sopenharmony_ci	u16 temp2;
2388c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci	/* aperture size */
2438c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	/* address to map to */
2468c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
2478c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	/* attbase - aperture base */
2508c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci	/* agpctrl */
2538c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci	/* mcgcfg */
2568c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, &temp2);
2578c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I840_MCHCFG, temp2 | (1 << 9));
2588c2ecf20Sopenharmony_ci	/* clear any possible error conditions */
2598c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I840_ERRSTS, 0xc000);
2608c2ecf20Sopenharmony_ci	return 0;
2618c2ecf20Sopenharmony_ci}
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistatic int intel_845_configure(void)
2648c2ecf20Sopenharmony_ci{
2658c2ecf20Sopenharmony_ci	u8 temp2;
2668c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci	/* aperture size */
2718c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci	if (agp_bridge->apbase_config != 0) {
2748c2ecf20Sopenharmony_ci		pci_write_config_dword(agp_bridge->dev, AGP_APBASE,
2758c2ecf20Sopenharmony_ci				       agp_bridge->apbase_config);
2768c2ecf20Sopenharmony_ci	} else {
2778c2ecf20Sopenharmony_ci		/* address to map to */
2788c2ecf20Sopenharmony_ci		agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
2798c2ecf20Sopenharmony_ci							    AGP_APERTURE_BAR);
2808c2ecf20Sopenharmony_ci		agp_bridge->apbase_config = agp_bridge->gart_bus_addr;
2818c2ecf20Sopenharmony_ci	}
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci	/* attbase - aperture base */
2848c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci	/* agpctrl */
2878c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	/* agpm */
2908c2ecf20Sopenharmony_ci	pci_read_config_byte(agp_bridge->dev, INTEL_I845_AGPM, &temp2);
2918c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1));
2928c2ecf20Sopenharmony_ci	/* clear any possible error conditions */
2938c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c);
2948c2ecf20Sopenharmony_ci	return 0;
2958c2ecf20Sopenharmony_ci}
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_cistatic int intel_850_configure(void)
2988c2ecf20Sopenharmony_ci{
2998c2ecf20Sopenharmony_ci	u16 temp2;
3008c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	/* aperture size */
3058c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	/* address to map to */
3088c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
3098c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	/* attbase - aperture base */
3128c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci	/* agpctrl */
3158c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci	/* mcgcfg */
3188c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, &temp2);
3198c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I850_MCHCFG, temp2 | (1 << 9));
3208c2ecf20Sopenharmony_ci	/* clear any possible AGP-related error conditions */
3218c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I850_ERRSTS, 0x001c);
3228c2ecf20Sopenharmony_ci	return 0;
3238c2ecf20Sopenharmony_ci}
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_cistatic int intel_860_configure(void)
3268c2ecf20Sopenharmony_ci{
3278c2ecf20Sopenharmony_ci	u16 temp2;
3288c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci	/* aperture size */
3338c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci	/* address to map to */
3368c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
3378c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	/* attbase - aperture base */
3408c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci	/* agpctrl */
3438c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci	/* mcgcfg */
3468c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, &temp2);
3478c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I860_MCHCFG, temp2 | (1 << 9));
3488c2ecf20Sopenharmony_ci	/* clear any possible AGP-related error conditions */
3498c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I860_ERRSTS, 0xf700);
3508c2ecf20Sopenharmony_ci	return 0;
3518c2ecf20Sopenharmony_ci}
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_cistatic int intel_830mp_configure(void)
3548c2ecf20Sopenharmony_ci{
3558c2ecf20Sopenharmony_ci	u16 temp2;
3568c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci	/* aperture size */
3618c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci	/* address to map to */
3648c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
3658c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	/* attbase - aperture base */
3688c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci	/* agpctrl */
3718c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci	/* gmch */
3748c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp2);
3758c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp2 | (1 << 9));
3768c2ecf20Sopenharmony_ci	/* clear any possible AGP-related error conditions */
3778c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I830_ERRSTS, 0x1c);
3788c2ecf20Sopenharmony_ci	return 0;
3798c2ecf20Sopenharmony_ci}
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_cistatic int intel_7505_configure(void)
3828c2ecf20Sopenharmony_ci{
3838c2ecf20Sopenharmony_ci	u16 temp2;
3848c2ecf20Sopenharmony_ci	struct aper_size_info_8 *current_size;
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci	current_size = A_SIZE_8(agp_bridge->current_size);
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci	/* aperture size */
3898c2ecf20Sopenharmony_ci	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value);
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci	/* address to map to */
3928c2ecf20Sopenharmony_ci	agp_bridge->gart_bus_addr = pci_bus_address(agp_bridge->dev,
3938c2ecf20Sopenharmony_ci						    AGP_APERTURE_BAR);
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ci	/* attbase - aperture base */
3968c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr);
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci	/* agpctrl */
3998c2ecf20Sopenharmony_ci	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000);
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci	/* mchcfg */
4028c2ecf20Sopenharmony_ci	pci_read_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, &temp2);
4038c2ecf20Sopenharmony_ci	pci_write_config_word(agp_bridge->dev, INTEL_I7505_MCHCFG, temp2 | (1 << 9));
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ci	return 0;
4068c2ecf20Sopenharmony_ci}
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci/* Setup function */
4098c2ecf20Sopenharmony_cistatic const struct gatt_mask intel_generic_masks[] =
4108c2ecf20Sopenharmony_ci{
4118c2ecf20Sopenharmony_ci	{.mask = 0x00000017, .type = 0}
4128c2ecf20Sopenharmony_ci};
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_cistatic const struct aper_size_info_8 intel_815_sizes[2] =
4158c2ecf20Sopenharmony_ci{
4168c2ecf20Sopenharmony_ci	{64, 16384, 4, 0},
4178c2ecf20Sopenharmony_ci	{32, 8192, 3, 8},
4188c2ecf20Sopenharmony_ci};
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_cistatic const struct aper_size_info_8 intel_8xx_sizes[7] =
4218c2ecf20Sopenharmony_ci{
4228c2ecf20Sopenharmony_ci	{256, 65536, 6, 0},
4238c2ecf20Sopenharmony_ci	{128, 32768, 5, 32},
4248c2ecf20Sopenharmony_ci	{64, 16384, 4, 48},
4258c2ecf20Sopenharmony_ci	{32, 8192, 3, 56},
4268c2ecf20Sopenharmony_ci	{16, 4096, 2, 60},
4278c2ecf20Sopenharmony_ci	{8, 2048, 1, 62},
4288c2ecf20Sopenharmony_ci	{4, 1024, 0, 63}
4298c2ecf20Sopenharmony_ci};
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_cistatic const struct aper_size_info_16 intel_generic_sizes[7] =
4328c2ecf20Sopenharmony_ci{
4338c2ecf20Sopenharmony_ci	{256, 65536, 6, 0},
4348c2ecf20Sopenharmony_ci	{128, 32768, 5, 32},
4358c2ecf20Sopenharmony_ci	{64, 16384, 4, 48},
4368c2ecf20Sopenharmony_ci	{32, 8192, 3, 56},
4378c2ecf20Sopenharmony_ci	{16, 4096, 2, 60},
4388c2ecf20Sopenharmony_ci	{8, 2048, 1, 62},
4398c2ecf20Sopenharmony_ci	{4, 1024, 0, 63}
4408c2ecf20Sopenharmony_ci};
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_cistatic const struct aper_size_info_8 intel_830mp_sizes[4] =
4438c2ecf20Sopenharmony_ci{
4448c2ecf20Sopenharmony_ci	{256, 65536, 6, 0},
4458c2ecf20Sopenharmony_ci	{128, 32768, 5, 32},
4468c2ecf20Sopenharmony_ci	{64, 16384, 4, 48},
4478c2ecf20Sopenharmony_ci	{32, 8192, 3, 56}
4488c2ecf20Sopenharmony_ci};
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_generic_driver = {
4518c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
4528c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_generic_sizes,
4538c2ecf20Sopenharmony_ci	.size_type		= U16_APER_SIZE,
4548c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 7,
4558c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
4568c2ecf20Sopenharmony_ci	.configure		= intel_configure,
4578c2ecf20Sopenharmony_ci	.fetch_size		= intel_fetch_size,
4588c2ecf20Sopenharmony_ci	.cleanup		= intel_cleanup,
4598c2ecf20Sopenharmony_ci	.tlb_flush		= intel_tlbflush,
4608c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
4618c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
4628c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
4638c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
4648c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
4658c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
4668c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
4678c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
4688c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
4698c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
4708c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
4718c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
4728c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
4738c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
4748c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
4758c2ecf20Sopenharmony_ci};
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_815_driver = {
4788c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
4798c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_815_sizes,
4808c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
4818c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 2,
4828c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
4838c2ecf20Sopenharmony_ci	.configure		= intel_815_configure,
4848c2ecf20Sopenharmony_ci	.fetch_size		= intel_815_fetch_size,
4858c2ecf20Sopenharmony_ci	.cleanup		= intel_8xx_cleanup,
4868c2ecf20Sopenharmony_ci	.tlb_flush		= intel_8xx_tlbflush,
4878c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
4888c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
4898c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
4908c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
4918c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
4928c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
4938c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
4948c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
4958c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
4968c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
4978c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
4988c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
4998c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
5008c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
5018c2ecf20Sopenharmony_ci	.agp_type_to_mask_type	= agp_generic_type_to_mask_type,
5028c2ecf20Sopenharmony_ci};
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_820_driver = {
5058c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
5068c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_8xx_sizes,
5078c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
5088c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 7,
5098c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
5108c2ecf20Sopenharmony_ci	.configure		= intel_820_configure,
5118c2ecf20Sopenharmony_ci	.fetch_size		= intel_8xx_fetch_size,
5128c2ecf20Sopenharmony_ci	.cleanup		= intel_820_cleanup,
5138c2ecf20Sopenharmony_ci	.tlb_flush		= intel_820_tlbflush,
5148c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
5158c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
5168c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
5178c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
5188c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
5198c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
5208c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
5218c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
5228c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
5238c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
5248c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
5258c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
5268c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
5278c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
5288c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
5298c2ecf20Sopenharmony_ci};
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_830mp_driver = {
5328c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
5338c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_830mp_sizes,
5348c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
5358c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 4,
5368c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
5378c2ecf20Sopenharmony_ci	.configure		= intel_830mp_configure,
5388c2ecf20Sopenharmony_ci	.fetch_size		= intel_8xx_fetch_size,
5398c2ecf20Sopenharmony_ci	.cleanup		= intel_8xx_cleanup,
5408c2ecf20Sopenharmony_ci	.tlb_flush		= intel_8xx_tlbflush,
5418c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
5428c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
5438c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
5448c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
5458c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
5468c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
5478c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
5488c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
5498c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
5508c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
5518c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
5528c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
5538c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
5548c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
5558c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
5568c2ecf20Sopenharmony_ci};
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_840_driver = {
5598c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
5608c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_8xx_sizes,
5618c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
5628c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 7,
5638c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
5648c2ecf20Sopenharmony_ci	.configure		= intel_840_configure,
5658c2ecf20Sopenharmony_ci	.fetch_size		= intel_8xx_fetch_size,
5668c2ecf20Sopenharmony_ci	.cleanup		= intel_8xx_cleanup,
5678c2ecf20Sopenharmony_ci	.tlb_flush		= intel_8xx_tlbflush,
5688c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
5698c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
5708c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
5718c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
5728c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
5738c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
5748c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
5758c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
5768c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
5778c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
5788c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
5798c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
5808c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
5818c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
5828c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
5838c2ecf20Sopenharmony_ci};
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_845_driver = {
5868c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
5878c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_8xx_sizes,
5888c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
5898c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 7,
5908c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
5918c2ecf20Sopenharmony_ci	.configure		= intel_845_configure,
5928c2ecf20Sopenharmony_ci	.fetch_size		= intel_8xx_fetch_size,
5938c2ecf20Sopenharmony_ci	.cleanup		= intel_8xx_cleanup,
5948c2ecf20Sopenharmony_ci	.tlb_flush		= intel_8xx_tlbflush,
5958c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
5968c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
5978c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
5988c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
5998c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
6008c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
6018c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
6028c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
6038c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
6048c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
6058c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
6068c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
6078c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
6088c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
6098c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
6108c2ecf20Sopenharmony_ci};
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_850_driver = {
6138c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
6148c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_8xx_sizes,
6158c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
6168c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 7,
6178c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
6188c2ecf20Sopenharmony_ci	.configure		= intel_850_configure,
6198c2ecf20Sopenharmony_ci	.fetch_size		= intel_8xx_fetch_size,
6208c2ecf20Sopenharmony_ci	.cleanup		= intel_8xx_cleanup,
6218c2ecf20Sopenharmony_ci	.tlb_flush		= intel_8xx_tlbflush,
6228c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
6238c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
6248c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
6258c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
6268c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
6278c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
6288c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
6298c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
6308c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
6318c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
6328c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
6338c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
6348c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
6358c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
6368c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
6378c2ecf20Sopenharmony_ci};
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_860_driver = {
6408c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
6418c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_8xx_sizes,
6428c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
6438c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 7,
6448c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
6458c2ecf20Sopenharmony_ci	.configure		= intel_860_configure,
6468c2ecf20Sopenharmony_ci	.fetch_size		= intel_8xx_fetch_size,
6478c2ecf20Sopenharmony_ci	.cleanup		= intel_8xx_cleanup,
6488c2ecf20Sopenharmony_ci	.tlb_flush		= intel_8xx_tlbflush,
6498c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
6508c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
6518c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
6528c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
6538c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
6548c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
6558c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
6568c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
6578c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
6588c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
6598c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
6608c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
6618c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
6628c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
6638c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
6648c2ecf20Sopenharmony_ci};
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_cistatic const struct agp_bridge_driver intel_7505_driver = {
6678c2ecf20Sopenharmony_ci	.owner			= THIS_MODULE,
6688c2ecf20Sopenharmony_ci	.aperture_sizes		= intel_8xx_sizes,
6698c2ecf20Sopenharmony_ci	.size_type		= U8_APER_SIZE,
6708c2ecf20Sopenharmony_ci	.num_aperture_sizes	= 7,
6718c2ecf20Sopenharmony_ci	.needs_scratch_page	= true,
6728c2ecf20Sopenharmony_ci	.configure		= intel_7505_configure,
6738c2ecf20Sopenharmony_ci	.fetch_size		= intel_8xx_fetch_size,
6748c2ecf20Sopenharmony_ci	.cleanup		= intel_8xx_cleanup,
6758c2ecf20Sopenharmony_ci	.tlb_flush		= intel_8xx_tlbflush,
6768c2ecf20Sopenharmony_ci	.mask_memory		= agp_generic_mask_memory,
6778c2ecf20Sopenharmony_ci	.masks			= intel_generic_masks,
6788c2ecf20Sopenharmony_ci	.agp_enable		= agp_generic_enable,
6798c2ecf20Sopenharmony_ci	.cache_flush		= global_cache_flush,
6808c2ecf20Sopenharmony_ci	.create_gatt_table	= agp_generic_create_gatt_table,
6818c2ecf20Sopenharmony_ci	.free_gatt_table	= agp_generic_free_gatt_table,
6828c2ecf20Sopenharmony_ci	.insert_memory		= agp_generic_insert_memory,
6838c2ecf20Sopenharmony_ci	.remove_memory		= agp_generic_remove_memory,
6848c2ecf20Sopenharmony_ci	.alloc_by_type		= agp_generic_alloc_by_type,
6858c2ecf20Sopenharmony_ci	.free_by_type		= agp_generic_free_by_type,
6868c2ecf20Sopenharmony_ci	.agp_alloc_page		= agp_generic_alloc_page,
6878c2ecf20Sopenharmony_ci	.agp_alloc_pages        = agp_generic_alloc_pages,
6888c2ecf20Sopenharmony_ci	.agp_destroy_page	= agp_generic_destroy_page,
6898c2ecf20Sopenharmony_ci	.agp_destroy_pages      = agp_generic_destroy_pages,
6908c2ecf20Sopenharmony_ci	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
6918c2ecf20Sopenharmony_ci};
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_ci/* Table to describe Intel GMCH and AGP/PCIE GART drivers.  At least one of
6948c2ecf20Sopenharmony_ci * driver and gmch_driver must be non-null, and find_gmch will determine
6958c2ecf20Sopenharmony_ci * which one should be used if a gmch_chip_id is present.
6968c2ecf20Sopenharmony_ci */
6978c2ecf20Sopenharmony_cistatic const struct intel_agp_driver_description {
6988c2ecf20Sopenharmony_ci	unsigned int chip_id;
6998c2ecf20Sopenharmony_ci	char *name;
7008c2ecf20Sopenharmony_ci	const struct agp_bridge_driver *driver;
7018c2ecf20Sopenharmony_ci} intel_agp_chipsets[] = {
7028c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82443LX_0, "440LX", &intel_generic_driver },
7038c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82443BX_0, "440BX", &intel_generic_driver },
7048c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82443GX_0, "440GX", &intel_generic_driver },
7058c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82815_MC, "i815", &intel_815_driver },
7068c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82820_HB, "i820", &intel_820_driver },
7078c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver },
7088c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver },
7098c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver },
7108c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82845_HB, "i845", &intel_845_driver },
7118c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82845G_HB, "845G", &intel_845_driver },
7128c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver },
7138c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver },
7148c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver },
7158c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82855GM_HB, "855GM", &intel_845_driver },
7168c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82860_HB, "i860", &intel_860_driver },
7178c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82865_HB, "865", &intel_845_driver },
7188c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_82875_HB, "i875", &intel_845_driver },
7198c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_7505_0, "E7505", &intel_7505_driver },
7208c2ecf20Sopenharmony_ci	{ PCI_DEVICE_ID_INTEL_7205_0, "E7205", &intel_7505_driver },
7218c2ecf20Sopenharmony_ci	{ 0, NULL, NULL }
7228c2ecf20Sopenharmony_ci};
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_cistatic int agp_intel_probe(struct pci_dev *pdev,
7258c2ecf20Sopenharmony_ci			   const struct pci_device_id *ent)
7268c2ecf20Sopenharmony_ci{
7278c2ecf20Sopenharmony_ci	struct agp_bridge_data *bridge;
7288c2ecf20Sopenharmony_ci	u8 cap_ptr = 0;
7298c2ecf20Sopenharmony_ci	struct resource *r;
7308c2ecf20Sopenharmony_ci	int i, err;
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ci	bridge = agp_alloc_bridge();
7358c2ecf20Sopenharmony_ci	if (!bridge)
7368c2ecf20Sopenharmony_ci		return -ENOMEM;
7378c2ecf20Sopenharmony_ci
7388c2ecf20Sopenharmony_ci	bridge->capndx = cap_ptr;
7398c2ecf20Sopenharmony_ci
7408c2ecf20Sopenharmony_ci	if (intel_gmch_probe(pdev, NULL, bridge))
7418c2ecf20Sopenharmony_ci		goto found_gmch;
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci	for (i = 0; intel_agp_chipsets[i].name != NULL; i++) {
7448c2ecf20Sopenharmony_ci		/* In case that multiple models of gfx chip may
7458c2ecf20Sopenharmony_ci		   stand on same host bridge type, this can be
7468c2ecf20Sopenharmony_ci		   sure we detect the right IGD. */
7478c2ecf20Sopenharmony_ci		if (pdev->device == intel_agp_chipsets[i].chip_id) {
7488c2ecf20Sopenharmony_ci			bridge->driver = intel_agp_chipsets[i].driver;
7498c2ecf20Sopenharmony_ci			break;
7508c2ecf20Sopenharmony_ci		}
7518c2ecf20Sopenharmony_ci	}
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_ci	if (!bridge->driver) {
7548c2ecf20Sopenharmony_ci		if (cap_ptr)
7558c2ecf20Sopenharmony_ci			dev_warn(&pdev->dev, "unsupported Intel chipset [%04x/%04x]\n",
7568c2ecf20Sopenharmony_ci				 pdev->vendor, pdev->device);
7578c2ecf20Sopenharmony_ci		agp_put_bridge(bridge);
7588c2ecf20Sopenharmony_ci		return -ENODEV;
7598c2ecf20Sopenharmony_ci	}
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ci	bridge->dev = pdev;
7628c2ecf20Sopenharmony_ci	bridge->dev_private_data = NULL;
7638c2ecf20Sopenharmony_ci
7648c2ecf20Sopenharmony_ci	dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name);
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci	/*
7678c2ecf20Sopenharmony_ci	* The following fixes the case where the BIOS has "forgotten" to
7688c2ecf20Sopenharmony_ci	* provide an address range for the GART.
7698c2ecf20Sopenharmony_ci	* 20030610 - hamish@zot.org
7708c2ecf20Sopenharmony_ci	* This happens before pci_enable_device() intentionally;
7718c2ecf20Sopenharmony_ci	* calling pci_enable_device() before assigning the resource
7728c2ecf20Sopenharmony_ci	* will result in the GART being disabled on machines with such
7738c2ecf20Sopenharmony_ci	* BIOSs (the GART ends up with a BAR starting at 0, which
7748c2ecf20Sopenharmony_ci	* conflicts a lot of other devices).
7758c2ecf20Sopenharmony_ci	*/
7768c2ecf20Sopenharmony_ci	r = &pdev->resource[0];
7778c2ecf20Sopenharmony_ci	if (!r->start && r->end) {
7788c2ecf20Sopenharmony_ci		if (pci_assign_resource(pdev, 0)) {
7798c2ecf20Sopenharmony_ci			dev_err(&pdev->dev, "can't assign resource 0\n");
7808c2ecf20Sopenharmony_ci			agp_put_bridge(bridge);
7818c2ecf20Sopenharmony_ci			return -ENODEV;
7828c2ecf20Sopenharmony_ci		}
7838c2ecf20Sopenharmony_ci	}
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci	/*
7868c2ecf20Sopenharmony_ci	* If the device has not been properly setup, the following will catch
7878c2ecf20Sopenharmony_ci	* the problem and should stop the system from crashing.
7888c2ecf20Sopenharmony_ci	* 20030610 - hamish@zot.org
7898c2ecf20Sopenharmony_ci	*/
7908c2ecf20Sopenharmony_ci	if (pci_enable_device(pdev)) {
7918c2ecf20Sopenharmony_ci		dev_err(&pdev->dev, "can't enable PCI device\n");
7928c2ecf20Sopenharmony_ci		agp_put_bridge(bridge);
7938c2ecf20Sopenharmony_ci		return -ENODEV;
7948c2ecf20Sopenharmony_ci	}
7958c2ecf20Sopenharmony_ci
7968c2ecf20Sopenharmony_ci	/* Fill in the mode register */
7978c2ecf20Sopenharmony_ci	if (cap_ptr) {
7988c2ecf20Sopenharmony_ci		pci_read_config_dword(pdev,
7998c2ecf20Sopenharmony_ci				bridge->capndx+PCI_AGP_STATUS,
8008c2ecf20Sopenharmony_ci				&bridge->mode);
8018c2ecf20Sopenharmony_ci	}
8028c2ecf20Sopenharmony_ci
8038c2ecf20Sopenharmony_cifound_gmch:
8048c2ecf20Sopenharmony_ci	pci_set_drvdata(pdev, bridge);
8058c2ecf20Sopenharmony_ci	err = agp_add_bridge(bridge);
8068c2ecf20Sopenharmony_ci	return err;
8078c2ecf20Sopenharmony_ci}
8088c2ecf20Sopenharmony_ci
8098c2ecf20Sopenharmony_cistatic void agp_intel_remove(struct pci_dev *pdev)
8108c2ecf20Sopenharmony_ci{
8118c2ecf20Sopenharmony_ci	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
8128c2ecf20Sopenharmony_ci
8138c2ecf20Sopenharmony_ci	agp_remove_bridge(bridge);
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ci	intel_gmch_remove();
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci	agp_put_bridge(bridge);
8188c2ecf20Sopenharmony_ci}
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
8218c2ecf20Sopenharmony_cistatic int agp_intel_resume(struct pci_dev *pdev)
8228c2ecf20Sopenharmony_ci{
8238c2ecf20Sopenharmony_ci	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
8248c2ecf20Sopenharmony_ci
8258c2ecf20Sopenharmony_ci	bridge->driver->configure();
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci	return 0;
8288c2ecf20Sopenharmony_ci}
8298c2ecf20Sopenharmony_ci#endif
8308c2ecf20Sopenharmony_ci
8318c2ecf20Sopenharmony_cistatic const struct pci_device_id agp_intel_pci_table[] = {
8328c2ecf20Sopenharmony_ci#define ID(x)						\
8338c2ecf20Sopenharmony_ci	{						\
8348c2ecf20Sopenharmony_ci	.class		= (PCI_CLASS_BRIDGE_HOST << 8),	\
8358c2ecf20Sopenharmony_ci	.class_mask	= ~0,				\
8368c2ecf20Sopenharmony_ci	.vendor		= PCI_VENDOR_ID_INTEL,		\
8378c2ecf20Sopenharmony_ci	.device		= x,				\
8388c2ecf20Sopenharmony_ci	.subvendor	= PCI_ANY_ID,			\
8398c2ecf20Sopenharmony_ci	.subdevice	= PCI_ANY_ID,			\
8408c2ecf20Sopenharmony_ci	}
8418c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82441), /* for HAS2 support */
8428c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82443LX_0),
8438c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82443BX_0),
8448c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82443GX_0),
8458c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82810_MC1),
8468c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82810_MC3),
8478c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82810E_MC),
8488c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82815_MC),
8498c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82820_HB),
8508c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82820_UP_HB),
8518c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82830_HB),
8528c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82840_HB),
8538c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82845_HB),
8548c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82845G_HB),
8558c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82850_HB),
8568c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82854_HB),
8578c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82855PM_HB),
8588c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82855GM_HB),
8598c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82860_HB),
8608c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82865_HB),
8618c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82875_HB),
8628c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_7505_0),
8638c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_7205_0),
8648c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_E7221_HB),
8658c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82915G_HB),
8668c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
8678c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82945G_HB),
8688c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
8698c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82945GME_HB),
8708c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB),
8718c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_PINEVIEW_HB),
8728c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82946GZ_HB),
8738c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82G35_HB),
8748c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
8758c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82965G_HB),
8768c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
8778c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_82965GME_HB),
8788c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_G33_HB),
8798c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_Q35_HB),
8808c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_Q33_HB),
8818c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_GM45_HB),
8828c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_EAGLELAKE_HB),
8838c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_Q45_HB),
8848c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_G45_HB),
8858c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_G41_HB),
8868c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_B43_HB),
8878c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_B43_1_HB),
8888c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB),
8898c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB),
8908c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB),
8918c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB),
8928c2ecf20Sopenharmony_ci	ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB),
8938c2ecf20Sopenharmony_ci	{ }
8948c2ecf20Sopenharmony_ci};
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(pci, agp_intel_pci_table);
8978c2ecf20Sopenharmony_ci
8988c2ecf20Sopenharmony_cistatic struct pci_driver agp_intel_pci_driver = {
8998c2ecf20Sopenharmony_ci	.name		= "agpgart-intel",
9008c2ecf20Sopenharmony_ci	.id_table	= agp_intel_pci_table,
9018c2ecf20Sopenharmony_ci	.probe		= agp_intel_probe,
9028c2ecf20Sopenharmony_ci	.remove		= agp_intel_remove,
9038c2ecf20Sopenharmony_ci#ifdef CONFIG_PM
9048c2ecf20Sopenharmony_ci	.resume		= agp_intel_resume,
9058c2ecf20Sopenharmony_ci#endif
9068c2ecf20Sopenharmony_ci};
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_cistatic int __init agp_intel_init(void)
9098c2ecf20Sopenharmony_ci{
9108c2ecf20Sopenharmony_ci	if (agp_off)
9118c2ecf20Sopenharmony_ci		return -EINVAL;
9128c2ecf20Sopenharmony_ci	return pci_register_driver(&agp_intel_pci_driver);
9138c2ecf20Sopenharmony_ci}
9148c2ecf20Sopenharmony_ci
9158c2ecf20Sopenharmony_cistatic void __exit agp_intel_cleanup(void)
9168c2ecf20Sopenharmony_ci{
9178c2ecf20Sopenharmony_ci	pci_unregister_driver(&agp_intel_pci_driver);
9188c2ecf20Sopenharmony_ci}
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_cimodule_init(agp_intel_init);
9218c2ecf20Sopenharmony_cimodule_exit(agp_intel_cleanup);
9228c2ecf20Sopenharmony_ci
9238c2ecf20Sopenharmony_ciMODULE_AUTHOR("Dave Jones, Various @Intel");
9248c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL and additional rights");
925