
From: "Antonino A. Daplas" <adaplas@gawab.com>

Add (partial) support for 915G
  No HW cursor at the moment
  Screen is blanked but signal/sync is not switched off
Mostly derived from XFree86/Xorg driver
Pass "vesa_modes" and VESA_MODEDB_SIZE in call to "fb_find_mode()"
  to allow loading as module. Makes "vesa_modes" also the default
  "modedb" when linking statically into the kernel.
Change PREFERRED_MODE to more reasonable value "1024x768-32@70"

Signed-off-by: Axel Buttchereit <XL@XLsigned.net>
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/video/intelfb/intelfb.h    |    8 ++++---
 25-akpm/drivers/video/intelfb/intelfbdrv.c |   30 ++++++++++++++++++++---------
 25-akpm/drivers/video/intelfb/intelfbdrv.h |    2 -
 25-akpm/drivers/video/intelfb/intelfbhw.c  |   11 ++++++++++
 25-akpm/drivers/video/intelfb/intelfbhw.h  |    3 ++
 5 files changed, 41 insertions(+), 13 deletions(-)

diff -puN drivers/video/intelfb/intelfbdrv.c~intelfb-add-partial-support-915g-chipset drivers/video/intelfb/intelfbdrv.c
--- 25/drivers/video/intelfb/intelfbdrv.c~intelfb-add-partial-support-915g-chipset	Wed Feb  9 14:05:16 2005
+++ 25-akpm/drivers/video/intelfb/intelfbdrv.c	Wed Feb  9 14:05:16 2005
@@ -1,7 +1,7 @@
 /*
  * intelfb
  *
- * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G
+ * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G
  * integrated graphics chips.
  *
  * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org>
@@ -153,6 +153,7 @@ static struct pci_device_id intelfb_pci_
 	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_845G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_845G },
 	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_85XGM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_85XGM },
 	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_865G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_865G },
+	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_915G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_915G },
 	{ 0, }
 };
 
@@ -471,6 +472,8 @@ intelfb_pci_register(struct pci_dev *pde
 	int agp_memtype;
 	const char *s;
 	struct agp_bridge_data *bridge;
+ 	int aperture_bar = 0;
+ 	int mmio_bar = 1;
 
 	DBG_MSG("intelfb_pci_register\n");
 
@@ -517,13 +520,20 @@ intelfb_pci_register(struct pci_dev *pde
 	}
 
 	/* Set base addresses. */
-	dinfo->aperture.physical = pci_resource_start(pdev, 0);
-	dinfo->aperture.size     = pci_resource_len(pdev, 0);
-	dinfo->mmio_base_phys    = pci_resource_start(pdev, 1);
-
+	if (ent->device == PCI_DEVICE_ID_INTEL_915G) {
+		aperture_bar = 2;
+		mmio_bar = 0;
+		/* Disable HW cursor on 915G (not implemented yet) */
+		hwcursor = 0;
+	}
+	dinfo->aperture.physical = pci_resource_start(pdev, aperture_bar);
+	dinfo->aperture.size     = pci_resource_len(pdev, aperture_bar);
+	dinfo->mmio_base_phys    = pci_resource_start(pdev, mmio_bar);
 	DBG_MSG("fb aperture: 0x%lx/0x%lx, MMIO region: 0x%lx/0x%lx\n",
-		pci_resource_start(pdev, 0), pci_resource_len(pdev, 0),
-		pci_resource_start(pdev, 1), pci_resource_len(pdev, 1));
+		pci_resource_start(pdev, aperture_bar),
+		pci_resource_len(pdev, aperture_bar),
+		pci_resource_start(pdev, mmio_bar),
+		pci_resource_len(pdev, mmio_bar));
 
 	/* Reserve the fb and MMIO regions */
 	if (!request_mem_region(dinfo->aperture.physical, dinfo->aperture.size,
@@ -990,13 +1000,15 @@ intelfb_init_var(struct intelfb_info *di
 	} else {
 		if (mode) {
 			msrc = fb_find_mode(var, dinfo->info, mode,
-					    NULL, 0, NULL, 0);
+					    vesa_modes, VESA_MODEDB_SIZE,
+					    NULL, 0);
 			if (msrc)
 				msrc |= 8;
 		}
 		if (!msrc) {
 			msrc = fb_find_mode(var, dinfo->info, PREFERRED_MODE,
-					    NULL, 0, NULL, 0);
+					    vesa_modes, VESA_MODEDB_SIZE,
+					    NULL, 0);
 		}
 	}
 
diff -puN drivers/video/intelfb/intelfbdrv.h~intelfb-add-partial-support-915g-chipset drivers/video/intelfb/intelfbdrv.h
--- 25/drivers/video/intelfb/intelfbdrv.h~intelfb-add-partial-support-915g-chipset	Wed Feb  9 14:05:16 2005
+++ 25-akpm/drivers/video/intelfb/intelfbdrv.h	Wed Feb  9 14:05:16 2005
@@ -5,7 +5,7 @@
  ******************************************************************************
  * intelfb
  *
- * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G
+ * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G
  * integrated graphics chips.
  *
  * Copyright © 2004 Sylvain Meyer
diff -puN drivers/video/intelfb/intelfb.h~intelfb-add-partial-support-915g-chipset drivers/video/intelfb/intelfb.h
--- 25/drivers/video/intelfb/intelfb.h~intelfb-add-partial-support-915g-chipset	Wed Feb  9 14:05:16 2005
+++ 25-akpm/drivers/video/intelfb/intelfb.h	Wed Feb  9 14:05:16 2005
@@ -10,7 +10,7 @@
 /*** Version/name ***/
 #define INTELFB_VERSION			"0.9.2"
 #define INTELFB_MODULE_NAME		"intelfb"
-#define SUPPORTED_CHIPSETS		"830M/845G/852GM/855GM/865G"
+#define SUPPORTED_CHIPSETS		"830M/845G/852GM/855GM/865G/915G"
 
 
 /*** Debug/feature defines ***/
@@ -36,7 +36,7 @@
 #endif
 
 #ifndef PREFERRED_MODE
-#define PREFERRED_MODE			"1024x768-16@60"
+#define PREFERRED_MODE			"1024x768-32@70"
 #endif
 
 /*** hw-related values ***/
@@ -46,6 +46,7 @@
 #define PCI_DEVICE_ID_INTEL_845G	0x2562
 #define PCI_DEVICE_ID_INTEL_85XGM	0x3582
 #define PCI_DEVICE_ID_INTEL_865G	0x2572
+#define PCI_DEVICE_ID_INTEL_915G	0x2582
 
 /* Size of MMIO region */
 #define INTEL_REG_SIZE			0x80000
@@ -117,7 +118,8 @@ enum intel_chips {
 	INTEL_852GME,
 	INTEL_855GM,
 	INTEL_855GME,
-	INTEL_865G
+	INTEL_865G,
+	INTEL_915G
 };
 
 struct intelfb_hwstate {
diff -puN drivers/video/intelfb/intelfbhw.c~intelfb-add-partial-support-915g-chipset drivers/video/intelfb/intelfbhw.c
--- 25/drivers/video/intelfb/intelfbhw.c~intelfb-add-partial-support-915g-chipset	Wed Feb  9 14:05:16 2005
+++ 25-akpm/drivers/video/intelfb/intelfbhw.c	Wed Feb  9 14:05:16 2005
@@ -98,6 +98,11 @@ intelfbhw_get_chipset(struct pci_dev *pd
 		*chipset = INTEL_865G;
 		*mobile = 0;
 		return 0;
+	case PCI_DEVICE_ID_INTEL_915G:
+		*name = "Intel(R) 915G";
+		*chipset = INTEL_915G;
+		*mobile = 0;
+		return 0;
 	default:
 		return 1;
 	}
@@ -169,6 +174,12 @@ intelfbhw_get_memory(struct pci_dev *pde
 		case INTEL_855_GMCH_GMS_STOLEN_32M:
 			*stolen_size = MB(32) - KB(132);
 			return 0;
+		case INTEL_915G_GMCH_GMS_STOLEN_48M:
+			*stolen_size = MB(48) - KB(132);
+			return 0;
+		case INTEL_915G_GMCH_GMS_STOLEN_64M:
+			*stolen_size = MB(64) - KB(132);
+			return 0;
 		case INTEL_855_GMCH_GMS_DISABLED:
 			ERR_MSG("video memory is disabled\n");
 			return 0;
diff -puN drivers/video/intelfb/intelfbhw.h~intelfb-add-partial-support-915g-chipset drivers/video/intelfb/intelfbhw.h
--- 25/drivers/video/intelfb/intelfbhw.h~intelfb-add-partial-support-915g-chipset	Wed Feb  9 14:05:16 2005
+++ 25-akpm/drivers/video/intelfb/intelfbhw.h	Wed Feb  9 14:05:16 2005
@@ -46,6 +46,9 @@
 #define INTEL_855_GMCH_GMS_STOLEN_16M	(0x4 << 4)
 #define INTEL_855_GMCH_GMS_STOLEN_32M	(0x5 << 4)
 
+#define INTEL_915G_GMCH_GMS_STOLEN_48M	(0x6 << 4)
+#define INTEL_915G_GMCH_GMS_STOLEN_64M	(0x7 << 4)
+
 /* HW registers */
 
 /* Fence registers */
_
