diff -upr linux/Documentation/Configure.help linux-agp/Documentation/Configure.help
--- linux/Documentation/Configure.help	Tue Mar 14 23:25:54 2000
+++ linux-agp/Documentation/Configure.help	Tue Mar 14 23:24:50 2000
@@ -9441,6 +9441,20 @@ CONFIG_RTC
   sampling), then say Y here, and read Documentation/rtc.txt for
   details.
 
+AGP/GART support
+CONFIG_AGP
+  This provides a kernel interface (/dev/agpgart) for programming AGP
+  transfers on motherboards that support them. Primarily, this is used
+  for hardware-accelerated 3d graphics, though any other AGP device
+  could take advantage of it.
+
+  If you have a 3d-capable AGP video card say 'M' or 'Y' here.
+  Otherwise, say 'N'.
+
+  You will also have to indicate support for your specific chipset.
+  Consult the output of lspci, your motherboard manual, or the inside
+  of your computer if unsure what to choose. Multiple selections are ok.
+
 Tadpole ANA H8 Support
 CONFIG_H8
   The Hitachi H8/337 is a microcontroller used to deal with the power
diff -upr linux/arch/i386/mm/ioremap.c linux-agp/arch/i386/mm/ioremap.c
--- linux/arch/i386/mm/ioremap.c	Tue Mar 14 23:25:54 2000
+++ linux-agp/arch/i386/mm/ioremap.c	Tue Mar 14 23:24:50 2000
@@ -110,7 +110,18 @@ void * __ioremap(unsigned long phys_addr
 	 * Don't allow anybody to remap normal RAM that we're using..
 	 */
 	if (phys_addr < virt_to_phys(high_memory))
-		return NULL;
+           {
+		char *temp_addr, *temp_end;
+		int i;
+
+		temp_addr = __va(phys_addr);
+		temp_end = temp_addr + (size - 1);
+	      
+		for(i = MAP_NR(temp_addr); i < MAP_NR(temp_end); i++) {
+			if(!PageReserved(mem_map + i))
+				return NULL;
+		}
+	   }
 
 	/*
 	 * Mappings have to be page-aligned
diff -upr linux/drivers/char/Config.in linux-agp/drivers/char/Config.in
--- linux/drivers/char/Config.in	Tue Mar 14 23:25:53 2000
+++ linux-agp/drivers/char/Config.in	Tue Mar 14 23:24:50 2000
@@ -62,7 +62,7 @@ if [ "$CONFIG_PARPORT" != "n" ]; then
     bool '  Support IEEE1284 status readback' CONFIG_PRINTER_READBACK
   fi
 fi
-
+     
 bool 'Mouse Support (not serial mice)' CONFIG_MOUSE
 if [ "$CONFIG_MOUSE" = "y" ]; then
 	mainmenu_option next_comment
@@ -118,6 +118,18 @@ if [ "$CONFIG_ALPHA_BOOK1" = "y" ]; then
   bool 'Tadpole ANA H8 Support'  CONFIG_H8
 fi
 
+if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+   tristate '/dev/agpgart (AGP Support) (EXPERIMENTAL)' CONFIG_AGP
+   if [ "$CONFIG_AGP" != "n" ]; then
+      bool '   Intel 440LX/BX/GX support' CONFIG_AGP_INTEL
+      bool '   Intel I810/I810 DC100/I810e support' CONFIG_AGP_I810
+      bool '   VIA VP3/MVP3/Apollo Pro support' CONFIG_AGP_VIA
+      bool '   AMD Irongate support' CONFIG_AGP_AMD
+      bool '   Generic SiS support' CONFIG_AGP_SIS
+      bool '   ALI M1541 support' CONFIG_AGP_ALI
+   fi
+fi
+      
 mainmenu_option next_comment
 comment 'Video For Linux'
 
diff -upr linux/drivers/char/Makefile linux-agp/drivers/char/Makefile
--- linux/drivers/char/Makefile	Tue Mar 14 23:25:54 2000
+++ linux-agp/drivers/char/Makefile	Tue Mar 14 23:24:50 2000
@@ -360,6 +360,17 @@ else
   endif
 endif
 
+ifeq ($(CONFIG_AGP),y)
+L_OBJS += agp/agp.o
+ALL_SUB_DIRS += agp
+SUB_DIRS += agp
+else
+  ifeq ($(CONFIG_AGP),m)
+  ALL_SUB_DIRS += agp
+  MOD_SUB_DIRS += agp
+  endif
+endif
+    
 ifeq ($(CONFIG_VIDEO_DEV),y)
 LX_OBJS += videodev.o
 else
diff -upr linux/init/main.c linux-agp/init/main.c
--- linux/init/main.c	Tue Mar 14 23:25:46 2000
+++ linux-agp/init/main.c	Tue Mar 14 23:24:50 2000
@@ -377,6 +377,11 @@ extern void dquot_init_hash(void);
 extern void md_setup(char *str,int *ints) __init;
 #endif
 
+#ifdef CONFIG_AGP
+extern int agp_initialize (void);
+extern void agp_setup(char *str, int *ints);
+#endif
+
 /*
  * Boot command-line arguments
  */
@@ -975,6 +980,9 @@ static struct kernel_param cooked_params
 #ifdef CONFIG_BLK_CPQ_DA
 	{ "smart2=", cpqarray_setup },
 #endif
+#ifdef CONFIG_AGP
+	{ "agp_try_unsupported=", agp_setup},
+#endif
 	{ 0, 0 }
 };
 
@@ -1409,6 +1417,9 @@ static void __init do_basic_setup(void)
 #endif
 #ifdef CONFIG_MAC
 	nubus_init();
+#endif
+#ifdef CONFIG_AGP
+	agp_initialize ();
 #endif
 
 	/* Networking initialization needs a process context */ 
--- linux/drivers/char/agp/agp.h.2.3	Tue Mar 14 11:13:10 2000
+++ linux/drivers/char/agp/agp.h	Tue Mar 14 11:23:53 2000
@@ -112,6 +112,15 @@ struct agp_bridge_data {
 	void (*free_by_type) (agp_memory *);
 };
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0)
+#define OUTREG32(mmap, addr, val)   *(volatile u32 *)(mmap + (addr)) = (val)
+#define OUTREG16(mmap, addr, val)   *(volatile u16 *)(mmap + (addr)) = (val)
+#define OUTREG8 (mmap, addr, val)   *(volatile u8 *) (mmap + (addr)) = (val)
+
+#define INREG32(mmap, addr)         *(volatile u32 *)(mmap + (addr))
+#define INREG16(mmap, addr)         *(volatile u16 *)(mmap + (addr))
+#define INREG8 (mmap, addr)         *(volatile u8 *) (mmap + (addr))
+#else
 #define OUTREG32(mmap, addr, val)   __raw_writel((val), (mmap)+(addr))
 #define OUTREG16(mmap, addr, val)   __raw_writew((val), (mmap)+(addr))
 #define OUTREG8 (mmap, addr, val)   __raw_writeb((val), (mmap)+(addr))
@@ -119,6 +128,7 @@ struct agp_bridge_data {
 #define INREG32(mmap, addr)         __raw_readl((mmap)+(addr))
 #define INREG16(mmap, addr)         __raw_readw((mmap)+(addr))
 #define INREG8 (mmap, addr)         __raw_readb((mmap)+(addr))
+#endif
 
 #define CACHE_FLUSH	agp_bridge.cache_flush
 #define A_SIZE_8(x)	((aper_size_info_8 *) x)
@@ -147,6 +157,9 @@ struct agp_bridge_data {
 #endif
 #ifndef PCI_DEVICE_ID_VIA_82C691_1
 #define PCI_DEVICE_ID_VIA_82C691_1      0x8691
+#endif
+#ifndef PCI_DEVICE_ID_VIA_8501_0
+#define PCI_DEVICE_ID_VIA_8501_0	0x0501
 #endif
 #ifndef PCI_DEVICE_ID_INTEL_810_0
 #define PCI_DEVICE_ID_INTEL_810_0       0x7120
--- linux/drivers/char/agp/agpgart_be.c.2.3	Tue Mar 14 11:23:57 2000
+++ linux/drivers/char/agp/agpgart_be.c	Tue Mar 14 11:36:35 2000
@@ -2102,7 +2102,7 @@ static void agp_backend_cleanup(void)
 extern int agp_frontend_initialize(void);
 extern void agp_frontend_cleanup(void);
 
-static int __init agp_init(void)
+int agp_initialize (void)
 {
 	int ret_val;
 
@@ -2122,11 +2122,40 @@ static int __init agp_init(void)
 	return 0;
 }
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION (2, 3, 0) \
+    || (LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0) && defined MODULE)
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0) && defined MODULE
+int init_module(void)
+#else
+static int __init agp_init(void)
+#endif
+{
+	return agp_initialize ();
+}
+#endif
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION (2, 3, 0) \
+    || (LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0) && defined MODULE)
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0) && defined MODULE
+void cleanup_module (void)
+#else
 static void __exit agp_cleanup(void)
+#endif
 {
 	agp_frontend_cleanup();
 	agp_backend_cleanup();
 }
+#endif
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION (2, 3, 0)
 module_init(agp_init);
 module_exit(agp_cleanup);
+#else
+#ifndef MODULE
+__initfunc(void agp_setup(char *str, int *ints))
+{
+	if (!strcmp(str,"agp_try_unsupported"))
+		agp_try_unsupported = ints[1];
+}
+#endif
+#endif
--- linux/drivers/char/agp/agpgart_fe.c.2.3	Tue Mar 14 11:24:01 2000
+++ linux/drivers/char/agp/agpgart_fe.c	Tue Mar 14 11:39:01 2000
@@ -300,7 +300,9 @@ static agp_memory *agp_allocate_memory_w
 	agp_memory *memory;
 
 	memory = agp_allocate_memory(pg_count, type);
+#if 0
    	printk(KERN_DEBUG "memory : %p\n", memory);
+#endif
 	if (memory == NULL) {
 		return NULL;
 	}
@@ -619,7 +621,11 @@ static int agp_mmap(struct file *file, s
 	size = vma->vm_end - vma->vm_start;
 	current_size = kerninfo.aper_size;
 	current_size = current_size * 0x100000;
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0)
+	offset = vma->vm_offset;
+#else
 	offset = vma->vm_pgoff << PAGE_SHIFT;
+#endif
 
 	if (test_bit(AGP_FF_IS_CLIENT, &priv->access_flags)) {
 		if ((size + offset) > current_size) {
@@ -1075,7 +1081,12 @@ static struct miscdevice agp_miscdev =
 	&agp_fops
 };
 
-int __init agp_frontend_initialize(void)
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0)
+int
+#else
+int __init
+#endif
+agp_frontend_initialize(void)
 {
 	memset(&agp_fe, 0, sizeof(struct agp_front_data));
 	AGP_LOCK_INIT();
@@ -1087,7 +1098,12 @@ int __init agp_frontend_initialize(void)
 	return 0;
 }
 
-void __exit agp_frontend_cleanup(void)
+#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 3, 0)
+void
+#else
+void __exit
+#endif
+agp_frontend_cleanup(void)
 {
 	misc_deregister(&agp_miscdev);
 }
