LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Intel 830 support for agpgart
@ 2001-10-02  1:32 Christof Efkemann
  2001-10-02  2:02 ` Robert Love
  2001-10-02 13:10 ` Christof Efkemann
  0 siblings, 2 replies; 10+ messages in thread
From: Christof Efkemann @ 2001-10-02  1:32 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

Hi,

this patch for 2.4.10 adds support for the Intel i830 chipset to the agpgart
module, thus eliminating the need for "agp_try_unsupported" with this chip.
It seems to work fine on my Siemens Fujitsu notebook which has an ATI Radeon
Mobility M6 graphics chip.
I guess it should work for others too, maybe someone could try.

-- 
Regards,
Christof Efkemann

[-- Attachment #2: i830-agp.patch --]
[-- Type: application/octet-stream, Size: 5144 bytes --]

diff -ur linux-2.4.10.orig/drivers/char/Config.in linux/drivers/char/Config.in
--- linux-2.4.10.orig/drivers/char/Config.in	Sun Sep 23 18:52:38 2001
+++ linux/drivers/char/Config.in	Tue Oct  2 01:00:37 2001
@@ -205,7 +205,7 @@
 
 dep_tristate '/dev/agpgart (AGP Support)' CONFIG_AGP $CONFIG_DRM_AGP
 if [ "$CONFIG_AGP" != "n" ]; then
-   bool '  Intel 440LX/BX/GX and I815/I840/I850 support' CONFIG_AGP_INTEL
+   bool '  Intel 440LX/BX/GX and I815/I830/I840/I850 support' CONFIG_AGP_INTEL
    bool '  Intel I810/I815 (on-board) support' CONFIG_AGP_I810
    bool '  VIA chipset support' CONFIG_AGP_VIA
    bool '  AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD
diff -ur linux-2.4.10.orig/drivers/char/agp/agp.h linux/drivers/char/agp/agp.h
--- linux-2.4.10.orig/drivers/char/agp/agp.h	Sun Sep 23 18:52:38 2001
+++ linux/drivers/char/agp/agp.h	Tue Oct  2 01:01:31 2001
@@ -166,6 +166,9 @@
 #ifndef PCI_DEVICE_ID_INTEL_810_0
 #define PCI_DEVICE_ID_INTEL_810_0       0x7120
 #endif
+#ifndef PCI_DEVICE_ID_INTEL_830_0
+#define PCI_DEVICE_ID_INTEL_830_0	0x3575
+#endif
 #ifndef PCI_DEVICE_ID_INTEL_840_0
 #define PCI_DEVICE_ID_INTEL_840_0		0x1a21
 #endif
@@ -240,6 +243,10 @@
 #define INTEL_AGPCTRL   0xb0
 #define INTEL_NBXCFG    0x50
 #define INTEL_ERRSTS    0x91
+
+/* intel i830 registers */
+#define INTEL_I830_GCC0     0x50
+#define INTEL_I830_ERRSTS   0x92
 
 /* intel i840 registers */
 #define INTEL_I840_MCHCFG   0x50
diff -ur linux-2.4.10.orig/drivers/char/agp/agpgart_be.c linux/drivers/char/agp/agpgart_be.c
--- linux-2.4.10.orig/drivers/char/agp/agpgart_be.c	Sun Sep 23 18:52:38 2001
+++ linux/drivers/char/agp/agpgart_be.c	Tue Oct  2 01:05:01 2001
@@ -387,7 +387,7 @@
 /* 
  * Driver routines - start
  * Currently this module supports the following chipsets:
- * i810, i815, 440lx, 440bx, 440gx, i840, i850, via vp3, via mvp3,
+ * i810, i815, 440lx, 440bx, 440gx, i830, i840, i850, via vp3, via mvp3,
  * via kx133, via kt133, amd irongate, amd 761, amd 762, ALi M1541,
  * and generic support for the SiS chipsets.
  */
@@ -1188,6 +1188,38 @@
 	return 0;
 }
 
+static int intel_830_configure(void)
+{
+	u32 temp;
+	u16 temp2;
+	aper_size_info_16 *current_size;
+
+	current_size = A_SIZE_16(agp_bridge.current_size);
+
+	/* aperture size */
+	pci_write_config_byte(agp_bridge.dev, INTEL_APSIZE,
+			      (char)current_size->size_value); 
+
+	/* address to map to */
+	pci_read_config_dword(agp_bridge.dev, INTEL_APBASE, &temp);
+	agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+
+	/* attbase - aperture base */
+	pci_write_config_dword(agp_bridge.dev, INTEL_ATTBASE,
+			       agp_bridge.gatt_bus_addr); 
+
+	/* agpctrl */
+	pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, 0x0000); 
+
+	/* mcgcfg */
+	pci_read_config_word(agp_bridge.dev, INTEL_I830_GCC0, &temp2);
+	pci_write_config_word(agp_bridge.dev, INTEL_I830_GCC0,
+			      temp2 | (1 << 9));
+	/* clear any possible AGP-related error conditions */
+	pci_write_config_word(agp_bridge.dev, INTEL_I830_ERRSTS, 0x001c); 
+	return 0;
+}
+
 static int intel_840_configure(void)
 {
 	u32 temp;
@@ -1314,6 +1346,39 @@
 	(void) pdev; /* unused */
 }
 
+static int __init intel_830_setup (struct pci_dev *pdev)
+{
+	agp_bridge.masks = intel_generic_masks;
+	agp_bridge.num_of_masks = 1;
+	agp_bridge.aperture_sizes = (void *) intel_generic_sizes;
+	agp_bridge.size_type = U16_APER_SIZE;
+	agp_bridge.num_aperture_sizes = 4;
+	agp_bridge.dev_private_data = NULL;
+	agp_bridge.needs_scratch_page = FALSE;
+	agp_bridge.configure = intel_830_configure;
+	agp_bridge.fetch_size = intel_fetch_size;
+	agp_bridge.cleanup = intel_cleanup;
+	agp_bridge.tlb_flush = intel_tlbflush;
+	agp_bridge.mask_memory = intel_mask_memory;
+	agp_bridge.agp_enable = agp_generic_agp_enable;
+	agp_bridge.cache_flush = global_cache_flush;
+	agp_bridge.create_gatt_table = agp_generic_create_gatt_table;
+	agp_bridge.free_gatt_table = agp_generic_free_gatt_table;
+	agp_bridge.insert_memory = agp_generic_insert_memory;
+	agp_bridge.remove_memory = agp_generic_remove_memory;
+	agp_bridge.alloc_by_type = agp_generic_alloc_by_type;
+	agp_bridge.free_by_type = agp_generic_free_by_type;
+	agp_bridge.agp_alloc_page = agp_generic_alloc_page;
+	agp_bridge.agp_destroy_page = agp_generic_destroy_page;
+	agp_bridge.suspend = agp_generic_suspend;
+	agp_bridge.resume = agp_generic_resume;
+	agp_bridge.cant_use_aperture = 0;
+
+	return 0;
+	
+	(void) pdev; /* unused */
+}
+
 static int __init intel_840_setup (struct pci_dev *pdev)
 {
 	agp_bridge.masks = intel_generic_masks;
@@ -2976,6 +3041,12 @@
 		"Intel",
 		"i815",
 		intel_generic_setup },
+	{ PCI_DEVICE_ID_INTEL_830_0,
+	  	PCI_VENDOR_ID_INTEL,
+	  	INTEL_I830,
+	  	"Intel",
+	  	"i830",
+	  	intel_830_setup },
 	{ PCI_DEVICE_ID_INTEL_840_0,
 		PCI_VENDOR_ID_INTEL,
 		INTEL_I840,
diff -ur linux-2.4.10.orig/include/linux/agp_backend.h linux/include/linux/agp_backend.h
--- linux-2.4.10.orig/include/linux/agp_backend.h	Sun Sep 23 18:52:38 2001
+++ linux/include/linux/agp_backend.h	Tue Oct  2 01:00:37 2001
@@ -46,6 +46,7 @@
 	INTEL_GX,
 	INTEL_I810,
 	INTEL_I815,
+	INTEL_I830,
 	INTEL_I840,
 	INTEL_I850,
 	VIA_GENERIC,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-02  1:32 [PATCH] Intel 830 support for agpgart Christof Efkemann
@ 2001-10-02  2:02 ` Robert Love
  2001-10-02 23:45   ` Robert Love
  2001-10-02 13:10 ` Christof Efkemann
  1 sibling, 1 reply; 10+ messages in thread
From: Robert Love @ 2001-10-02  2:02 UTC (permalink / raw)
  To: Christof Efkemann; +Cc: linux-kernel

On Mon, 2001-10-01 at 21:32, Christof Efkemann wrote:

> this patch for 2.4.10 adds support for the Intel i830 chipset to the agpgart
> module, thus eliminating the need for "agp_try_unsupported" with this chip.
> It seems to work fine on my Siemens Fujitsu notebook which has an ATI Radeon
> Mobility M6 graphics chip.
> I guess it should work for others too, maybe someone could try.

You don't need all that code.  If agp_try_unsupported works, then
intel_generic_setup works, so you don't need an intel_830_setup.

In other words, if agp_try_unsupported=1 makes everything OK, then you
just need to add the detection code.

Thus, the patch becomes the following.  Give that a try.


diff -ur linux-2.4.10.orig/drivers/char/Config.in linux/drivers/char/Config.in
--- linux-2.4.10.orig/drivers/char/Config.in    Sun Sep 23 18:52:38 2001
+++ linux/drivers/char/Config.in        Tue Oct  2 01:00:37 2001
@@ -205,7 +205,7 @@

dep_tristate '/dev/agpgart (AGP Support)' CONFIG_AGP $CONFIG_DRM_AGP
if [ "$CONFIG_AGP" != "n" ]; then
-   bool '  Intel 440LX/BX/GX and I815/I840/I850 support' CONFIG_AGP_INTEL
+   bool '  Intel 440LX/BX/GX and I815/I830/I840/I850 support' CONFIG_AGP_INTEL
    bool '  Intel I810/I815 (on-board) support' CONFIG_AGP_I810
    bool '  VIA chipset support' CONFIG_AGP_VIA
    bool '  AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD
diff -ur linux-2.4.10.orig/drivers/char/agp/agp.h linux/drivers/char/agp/agp.h
--- linux-2.4.10.orig/drivers/char/agp/agp.h    Sun Sep 23 18:52:38 2001
+++ linux/drivers/char/agp/agp.h        Tue Oct  2 01:01:31 2001
@@ -166,6 +166,9 @@
#ifndef PCI_DEVICE_ID_INTEL_810_0
#define PCI_DEVICE_ID_INTEL_810_0       0x7120
#endif
+#ifndef PCI_DEVICE_ID_INTEL_830_0
+#define PCI_DEVICE_ID_INTEL_830_0      0x3575
+#endif
#ifndef PCI_DEVICE_ID_INTEL_840_0
#define PCI_DEVICE_ID_INTEL_840_0              0x1a21
#endif
diff -ur linux-2.4.10.orig/drivers/char/agp/agpgart_be.c linux/drivers/char/agp/agpgart_be.c
--- linux-2.4.10.orig/drivers/char/agp/agpgart_be.c     Sun Sep 23 18:52:38 2001
+++ linux/drivers/char/agp/agpgart_be.c Tue Oct  2 01:05:01 2001
@@ -387,7 +387,7 @@
/* 
  * Driver routines - start
  * Currently this module supports the following chipsets:
- * i810, i815, 440lx, 440bx, 440gx, i840, i850, via vp3, via mvp3,
+ * i810, i815, 440lx, 440bx, 440gx, i830, i840, i850, via vp3, via mvp3,
  * via kx133, via kt133, amd irongate, amd 761, amd 762, ALi M1541,
  * and generic support for the SiS chipsets.
  */
@@ -2976,6 +3041,12 @@
                "Intel",
                "i815",
                intel_generic_setup },
+       { PCI_DEVICE_ID_INTEL_830_0,
+               PCI_VENDOR_ID_INTEL,
+               INTEL_I830,
+               "Intel",
+               "i830",
+               intel_generic_setup },
        { PCI_DEVICE_ID_INTEL_840_0,
                PCI_VENDOR_ID_INTEL,
                INTEL_I840,
diff -ur linux-2.4.10.orig/include/linux/agp_backend.h linux/include/linux/agp_backend.h
--- linux-2.4.10.orig/include/linux/agp_backend.h       Sun Sep 23 18:52:38 2001
+++ linux/include/linux/agp_backend.h   Tue Oct  2 01:00:37 2001
@@ -46,6 +46,7 @@
        INTEL_GX,
        INTEL_I810,
        INTEL_I815,
+       INTEL_I830,
        INTEL_I840,
        INTEL_I850,
        VIA_GENERIC,




-- 
Robert M. Love
rml at ufl.edu
rml at tech9.net


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-02  1:32 [PATCH] Intel 830 support for agpgart Christof Efkemann
  2001-10-02  2:02 ` Robert Love
@ 2001-10-02 13:10 ` Christof Efkemann
  1 sibling, 0 replies; 10+ messages in thread
From: Christof Efkemann @ 2001-10-02 13:10 UTC (permalink / raw)
  To: Robert Love; +Cc: linux-kernel

On 01 Oct 2001 22:02:08 -0400
Robert Love <rml@tech9.net> wrote:

> You don't need all that code.  If agp_try_unsupported works, then
> intel_generic_setup works, so you don't need an intel_830_setup.
> 
> In other words, if agp_try_unsupported=1 makes everything OK, then you
> just need to add the detection code.
> 
> Thus, the patch becomes the following.  Give that a try.

Yes, that seems to work as well.  Although there are two minor things I
noticed:
- First, intel_generic_setup sets num_aperture_sizes to 7, while the i830
  has only 4 valid values (32 to 256 MB).
- Second, when intel_generic_configure clears the error status register, it
  resets bits 8, 9 and 10.  With an i830 it should clear bits 2, 3 and 4.

So I'm not sure if this works in general, or could it cause errors on other
systems?

-- 
Regards,
Christof Efkemann

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-02  2:02 ` Robert Love
@ 2001-10-02 23:45   ` Robert Love
  2001-10-03  0:16     ` David Weinehall
  2001-10-03  2:20     ` Robert Love
  0 siblings, 2 replies; 10+ messages in thread
From: Robert Love @ 2001-10-02 23:45 UTC (permalink / raw)
  To: Christof Efkemann; +Cc: linux-kernel

On Tue, 2001-10-02 at 09:10, Christof Efkemann wrote:
> Yes, that seems to work as well.  Although there are two minor things I
> noticed:
> - First, intel_generic_setup sets num_aperture_sizes to 7, while the i830
>   has only 4 valid values (32 to 256 MB).
> - Second, when intel_generic_configure clears the error status register, it
>   resets bits 8, 9 and 10.  With an i830 it should clear bits 2, 3 and 4.
> 
> So I'm not sure if this works in general, or could it cause errors on other
> systems?

It will probably work fine on all systems, but its not the right way to
go IMO.  Your original implementation was better.

However, I am still disliking the multiple function idea.  Same thing
with the i840.  The only real difference is those defines.

A _very_ simple solution, IF we had separate CONFIG statements for each
i8xx (or at least one for i830, one for i840, and one for the rest)
would be:

/* all the normal defines here */
#ifdef CONFIG_AGP_I830
#undef whatever_define_i830_is_different_on
#define whatever xxx
/* etc */
#endif
#ifdef CONFIG_AGP_I840
#undef whatever
#define whatever xxx
/* etc */
#endif

and then, voila, we have but one setup function! we can remove all the
unique i830 and i840 muck...

Is seperate config statements a problem?  We already have multiple ones
for the i810/i815 on/off-board versions...Hmm.

-- 
Robert M. Love
rml at ufl.edu
rml at tech9.net


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-02 23:45   ` Robert Love
@ 2001-10-03  0:16     ` David Weinehall
  2001-10-03  2:20     ` Robert Love
  1 sibling, 0 replies; 10+ messages in thread
From: David Weinehall @ 2001-10-03  0:16 UTC (permalink / raw)
  To: Robert Love; +Cc: Christof Efkemann, linux-kernel

On Tue, Oct 02, 2001 at 07:45:42PM -0400, Robert Love wrote:
> On Tue, 2001-10-02 at 09:10, Christof Efkemann wrote:
> > Yes, that seems to work as well.  Although there are two minor things I
> > noticed:
> > - First, intel_generic_setup sets num_aperture_sizes to 7, while the i830
> >   has only 4 valid values (32 to 256 MB).
> > - Second, when intel_generic_configure clears the error status register, it
> >   resets bits 8, 9 and 10.  With an i830 it should clear bits 2, 3 and 4.
> > 
> > So I'm not sure if this works in general, or could it cause errors on other
> > systems?
> 
> It will probably work fine on all systems, but its not the right way to
> go IMO.  Your original implementation was better.
> 
> However, I am still disliking the multiple function idea.  Same thing
> with the i840.  The only real difference is those defines.
> 
> A _very_ simple solution, IF we had separate CONFIG statements for each
> i8xx (or at least one for i830, one for i840, and one for the rest)
> would be:
> 
> /* all the normal defines here */
> #ifdef CONFIG_AGP_I830
> #undef whatever_define_i830_is_different_on
> #define whatever xxx
> /* etc */
> #endif
> #ifdef CONFIG_AGP_I840
> #undef whatever
> #define whatever xxx
> /* etc */
> #endif
> 
> and then, voila, we have but one setup function! we can remove all the
> unique i830 and i840 muck...
> 
> Is seperate config statements a problem?  We already have multiple ones
> for the i810/i815 on/off-board versions...Hmm.

If the only differences between the different cards are the nr of
aperture-sizes and the status-register settings, why not have a struct
which contains all the valid cards, and use a scan-routine?!


/David Weinehall
  _                                                                 _
 // David Weinehall <tao@acc.umu.se> /> Northern lights wander      \\
//  Project MCA Linux hacker        //  Dance across the winter sky //
\>  http://www.acc.umu.se/~tao/    </   Full colour fire           </

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-02 23:45   ` Robert Love
  2001-10-03  0:16     ` David Weinehall
@ 2001-10-03  2:20     ` Robert Love
  2001-10-03  2:52       ` David Weinehall
                         ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Robert Love @ 2001-10-03  2:20 UTC (permalink / raw)
  To: David Weinehall; +Cc: Christof Efkemann, linux-kernel

On Tue, 2001-10-02 at 20:16, David Weinehall wrote:
> If the only differences between the different cards are the nr of
> aperture-sizes and the status-register settings, why not have a struct
> which contains all the valid cards, and use a scan-routine?!

I suppose we could, and this is a good idea -- although we'd be
reapproaching the size of the current implementation which would be
theoretically faster, too.

There are only 3 possibilities right now (i830, i840, and everything
else).

Hmm, maybe I will code this nonetheless...

-- 
Robert M. Love
rml at ufl.edu
rml at tech9.net


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-03  2:20     ` Robert Love
@ 2001-10-03  2:52       ` David Weinehall
  2001-10-03 11:55       ` Christof Efkemann
  2001-10-06 23:47       ` Paul Mundt
  2 siblings, 0 replies; 10+ messages in thread
From: David Weinehall @ 2001-10-03  2:52 UTC (permalink / raw)
  To: Robert Love; +Cc: Christof Efkemann, linux-kernel

On Tue, Oct 02, 2001 at 10:20:43PM -0400, Robert Love wrote:
> On Tue, 2001-10-02 at 20:16, David Weinehall wrote:
> > If the only differences between the different cards are the nr of
> > aperture-sizes and the status-register settings, why not have a struct
> > which contains all the valid cards, and use a scan-routine?!
> 
> I suppose we could, and this is a good idea -- although we'd be
> reapproaching the size of the current implementation which would be
> theoretically faster, too.

Afaik, speed is not really an issue (it's not like you're going to
notice a difference anyway, even if you had a struct with 100 different
adapters in it.) As for reapproaching the size of the current
implementation, the difference is that you get one single function that
you don't have to change. You just add one single line to the struct
for each adapter.

Clean design is a virtue ;-)

> There are only 3 possibilities right now (i830, i840, and everything
> else).
> 
> Hmm, maybe I will code this nonetheless...

It's your call.


/David
  _                                                                 _
 // David Weinehall <tao@acc.umu.se> /> Northern lights wander      \\
//  Project MCA Linux hacker        //  Dance across the winter sky //
\>  http://www.acc.umu.se/~tao/    </   Full colour fire           </

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-03  2:20     ` Robert Love
  2001-10-03  2:52       ` David Weinehall
@ 2001-10-03 11:55       ` Christof Efkemann
  2001-10-06 23:47       ` Paul Mundt
  2 siblings, 0 replies; 10+ messages in thread
From: Christof Efkemann @ 2001-10-03 11:55 UTC (permalink / raw)
  To: David Weinehall; +Cc: Robert Love, linux-kernel

On Wed, 3 Oct 2001 04:52:57 +0200
David Weinehall <tao@acc.umu.se> wrote:

> On Tue, Oct 02, 2001 at 10:20:43PM -0400, Robert Love wrote:
> > On Tue, 2001-10-02 at 20:16, David Weinehall wrote:
> > > If the only differences between the different cards are the nr of
> > > aperture-sizes and the status-register settings, why not have a struct
> > > which contains all the valid cards, and use a scan-routine?!

There is already such a struct, agp_bridge_info, and a scan-routine,
agp_lookup_host_bridge.  These values could probably be added easily.
Although it would then be necessary for the other chipsets, too.

> Afaik, speed is not really an issue (it's not like you're going to
> notice a difference anyway, even if you had a struct with 100 different
> adapters in it.) As for reapproaching the size of the current
> implementation, the difference is that you get one single function that
> you don't have to change. You just add one single line to the struct
> for each adapter.

Even if it was slower it wouldn't really matter, as this is executed only
once during initialization.

> > There are only 3 possibilities right now (i830, i840, and everything
> > else).

And don't forget the i850 ;-)

-- 
Regards,
Christof Efkemann

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-03  2:20     ` Robert Love
  2001-10-03  2:52       ` David Weinehall
  2001-10-03 11:55       ` Christof Efkemann
@ 2001-10-06 23:47       ` Paul Mundt
  2001-10-07  1:30         ` Wenzhuo Zhang
  2 siblings, 1 reply; 10+ messages in thread
From: Paul Mundt @ 2001-10-06 23:47 UTC (permalink / raw)
  To: Robert Love; +Cc: David Weinehall, Christof Efkemann, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 875 bytes --]

On Tue, Oct 02, 2001 at 10:20:43PM -0400, Robert Love wrote:
> I suppose we could, and this is a good idea -- although we'd be
> reapproaching the size of the current implementation which would be
> theoretically faster, too.
> 
> There are only 3 possibilities right now (i830, i840, and everything
> else).
> 
Make that i830, i840, i850, i860 and everything else. A better way for
dealing with specialized configure routines for these various chipsets
would definately seem to be in order. Between i840/i850/i860, there's
very little difference except for what bits to clear in the ERRSTS register.

It would be nice to be able to get the 840/850/860 down to just a few lines
of code a peice instead of this huge overlap of generic routines thats
happening currently.

Here's a patch for i860..

Regards,

-- 
Paul Mundt <lethal@chaoticdreams.org>


[-- Attachment #2: 2.4.10-i860-agpgart.diff --]
[-- Type: text/plain, Size: 5232 bytes --]

diff -urN linux.orig/drivers/char/Config.in linux/drivers/char/Config.in
--- linux.orig/drivers/char/Config.in	Sun Sep 23 12:52:38 2001
+++ linux/drivers/char/Config.in	Fri Oct  5 16:40:16 2001
@@ -205,7 +205,7 @@
 
 dep_tristate '/dev/agpgart (AGP Support)' CONFIG_AGP $CONFIG_DRM_AGP
 if [ "$CONFIG_AGP" != "n" ]; then
-   bool '  Intel 440LX/BX/GX and I815/I840/I850 support' CONFIG_AGP_INTEL
+   bool '  Intel 440LX/BX/GX and I815/I840/I850/I860 support' CONFIG_AGP_INTEL
    bool '  Intel I810/I815 (on-board) support' CONFIG_AGP_I810
    bool '  VIA chipset support' CONFIG_AGP_VIA
    bool '  AMD Irongate, 761, and 762 support' CONFIG_AGP_AMD
diff -urN linux.orig/drivers/char/agp/agp.h linux/drivers/char/agp/agp.h
--- linux.orig/drivers/char/agp/agp.h	Sun Sep 23 12:52:38 2001
+++ linux/drivers/char/agp/agp.h	Fri Oct  5 16:52:00 2001
@@ -172,6 +172,9 @@
 #ifndef PCI_DEVICE_ID_INTEL_850_0
 #define PCI_DEVICE_ID_INTEL_850_0     0x2530
 #endif
+#ifndef PCI_DEVICE_ID_INTEL_860_0
+#define PCI_DEVICE_ID_INTEL_860_0	0x2532
+#endif
 #ifndef PCI_DEVICE_ID_INTEL_810_DC100_0
 #define PCI_DEVICE_ID_INTEL_810_DC100_0 0x7122
 #endif
@@ -248,6 +251,10 @@
 /* intel i850 registers */
 #define INTEL_I850_MCHCFG   0x50
 #define INTEL_I850_ERRSTS   0xc8
+
+/* intel i860 registers */
+#define INTEL_I860_MCHCFG	0x50
+#define INTEL_I860_ERRSTS	0xc8
 
 /* intel i810 registers */
 #define I810_GMADDR 0x10
diff -urN linux.orig/drivers/char/agp/agpgart_be.c linux/drivers/char/agp/agpgart_be.c
--- linux.orig/drivers/char/agp/agpgart_be.c	Sun Sep 23 12:52:38 2001
+++ linux/drivers/char/agp/agpgart_be.c	Fri Oct  5 17:14:09 2001
@@ -387,7 +387,7 @@
 /* 
  * Driver routines - start
  * Currently this module supports the following chipsets:
- * i810, i815, 440lx, 440bx, 440gx, i840, i850, via vp3, via mvp3,
+ * i810, i815, 440lx, 440bx, 440gx, i840, i850, i860, via vp3, via mvp3,
  * via kx133, via kt133, amd irongate, amd 761, amd 762, ALi M1541,
  * and generic support for the SiS chipsets.
  */
@@ -1252,6 +1252,38 @@
 	return 0;
 }
 
+static int intel_860_configure(void)
+{
+	u32 temp;
+	u16 temp2;
+	aper_size_info_16 *current_size;
+
+	current_size = A_SIZE_16(agp_bridge.current_size);
+
+	/* aperture size */
+	pci_write_config_byte(agp_bridge.dev, INTEL_APSIZE,
+			      (char)current_size->size_value);
+
+	/* address to map to */
+	pci_read_config_dword(agp_bridge.dev, INTEL_APBASE, &temp);
+	agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+
+	/* attbase - aperture base */
+	pci_write_config_dword(agp_bridge.dev, INTEL_ATTBASE,
+			       agp_bridge.gatt_bus_addr);
+
+	/* agpctrl */
+	pci_write_config_dword(agp_bridge.dev, INTEL_AGPCTRL, 0x0000);
+
+	/* mcgcfg */
+	pci_read_config_word(agp_bridge.dev, INTEL_I860_MCHCFG, &temp2);
+	pci_write_config_word(agp_bridge.dev, INTEL_I860_MCHCFG,
+			      temp2 | (1 << 9));
+	/* clear any possible AGP-related error conditions */
+	pci_write_config_word(agp_bridge.dev, INTEL_I860_ERRSTS, 0xf700);
+	return 0;
+}
+
 static unsigned long intel_mask_memory(unsigned long addr, int type)
 {
 	/* Memory type is ignored */
@@ -1380,6 +1412,39 @@
 	(void) pdev; /* unused */
 }
 
+static int __init intel_860_setup (struct pci_dev *pdev)
+{
+	agp_bridge.masks = intel_generic_masks;
+	agp_bridge.num_of_masks = 1;
+	agp_bridge.aperture_sizes = (void *) intel_generic_sizes;
+	agp_bridge.size_type = U16_APER_SIZE;
+	agp_bridge.num_aperture_sizes = 7;
+	agp_bridge.dev_private_data = NULL;
+	agp_bridge.needs_scratch_page = FALSE;
+	agp_bridge.configure = intel_860_configure;
+	agp_bridge.fetch_size = intel_fetch_size;
+	agp_bridge.cleanup = intel_cleanup;
+	agp_bridge.tlb_flush = intel_tlbflush;
+	agp_bridge.mask_memory = intel_mask_memory;
+	agp_bridge.agp_enable = agp_generic_agp_enable;
+	agp_bridge.cache_flush = global_cache_flush;
+	agp_bridge.create_gatt_table = agp_generic_create_gatt_table;
+	agp_bridge.free_gatt_table = agp_generic_free_gatt_table;
+	agp_bridge.insert_memory = agp_generic_insert_memory;
+	agp_bridge.remove_memory = agp_generic_remove_memory;
+	agp_bridge.alloc_by_type = agp_generic_alloc_by_type;
+	agp_bridge.free_by_type = agp_generic_free_by_type;
+	agp_bridge.agp_alloc_page = agp_generic_alloc_page;
+	agp_bridge.agp_destroy_page = agp_generic_destroy_page;
+	agp_bridge.suspend = agp_generic_suspend;
+	agp_bridge.resume = agp_generic_resume;
+	agp_bridge.cant_use_aperture = 0;
+
+	return 0;
+
+	(void) pdev; /* unused */
+}
+
 #endif /* CONFIG_AGP_INTEL */
 
 #ifdef CONFIG_AGP_VIA
@@ -2988,6 +3053,12 @@
 	        "Intel",
 	        "i850",
 	        intel_850_setup },
+	{ PCI_DEVICE_ID_INTEL_860_0,
+		PCI_VENDOR_ID_INTEL,
+		INTEL_I860,
+		"Intel",
+		"i860",
+		intel_860_setup },
 	{ 0,
 		PCI_VENDOR_ID_INTEL,
 		INTEL_GENERIC,
diff -urN linux.orig/include/linux/agp_backend.h linux/include/linux/agp_backend.h
--- linux.orig/include/linux/agp_backend.h	Sun Sep 23 12:52:38 2001
+++ linux/include/linux/agp_backend.h	Fri Oct  5 16:44:22 2001
@@ -48,6 +48,7 @@
 	INTEL_I815,
 	INTEL_I840,
 	INTEL_I850,
+	INTEL_I860,
 	VIA_GENERIC,
 	VIA_VP3,
 	VIA_MVP3,

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Intel 830 support for agpgart
  2001-10-06 23:47       ` Paul Mundt
@ 2001-10-07  1:30         ` Wenzhuo Zhang
  0 siblings, 0 replies; 10+ messages in thread
From: Wenzhuo Zhang @ 2001-10-07  1:30 UTC (permalink / raw)
  To: linux-kernel

On Sat, Oct 06, 2001 at 04:47:34PM -0700, Paul Mundt wrote:
> On Tue, Oct 02, 2001 at 10:20:43PM -0400, Robert Love wrote:
> > I suppose we could, and this is a good idea -- although we'd be
> > reapproaching the size of the current implementation which would be
> > theoretically faster, too.
> > 
> > There are only 3 possibilities right now (i830, i840, and everything
> > else).
> > 
> Make that i830, i840, i850, i860 and everything else. A better way for
> dealing with specialized configure routines for these various chipsets
> would definately seem to be in order. Between i840/i850/i860, there's
> very little difference except for what bits to clear in the ERRSTS register.
> 
> It would be nice to be able to get the 840/850/860 down to just a few lines
> of code a peice instead of this huge overlap of generic routines thats
> happening currently.
> 
> Here's a patch for i860..
> 

May I ask how to implement agp_bridge.configure for i845? Dell Dimension
4300 uses this chipset.

# lspci
00:00.0 Host bridge: Intel Corporation: Unknown device 1a30 (rev 03)
00:01.0 PCI bridge: Intel Corporation: Unknown device 1a31 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82820 820 (Camino 2) Chipset PCI (rev 12)
00:1f.0 ISA bridge: Intel Corporation 82820 820 (Camino 2) Chipset ISA Bridge (ICH2) (rev 12)
00:1f.1 IDE interface: Intel Corporation 82820 820 (Camino 2) Chipset IDE U100 (rev 12)
00:1f.2 USB Controller: Intel Corporation 82820 820 (Camino 2) Chipset USB (Hub A) (rev 12)
00:1f.3 SMBus: Intel Corporation 82820 820 (Camino 2) Chipset SMBus (rev 12)
00:1f.4 USB Controller: Intel Corporation 82820 820 (Camino 2) Chipset USB (Hub B) (rev 12)
00:1f.5 Multimedia audio controller: Intel Corporation: Unknown device 2445 (rev 12)
01:00.0 VGA compatible controller: ATI Technologies Inc: Unknown device 5446
02:09.0 Ethernet controller: Davicom Semiconductor, Inc. Ethernet 100/10 MBit (rev 31)

# lspci -n
00:00.0 Class 0600: 8086:1a30 (rev 03)
00:01.0 Class 0604: 8086:1a31 (rev 03)
00:1e.0 Class 0604: 8086:244e (rev 12)
00:1f.0 Class 0601: 8086:2440 (rev 12)
00:1f.1 Class 0101: 8086:244b (rev 12)
00:1f.2 Class 0c03: 8086:2442 (rev 12)
00:1f.3 Class 0c05: 8086:2443 (rev 12)
00:1f.4 Class 0c03: 8086:2444 (rev 12)
00:1f.5 Class 0401: 8086:2445 (rev 12)
01:00.0 Class 0300: 1002:5446
02:09.0 Class 0200: 1282:9102 (rev 31)

-- 
Wenzhuo
  GnuPG Key ID 0xBA586A68
  Key fingerprint = 89C7 C6DE D956 F978 3F12  A8AF 5847 F840 BA58 6A68

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-10-07  1:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-02  1:32 [PATCH] Intel 830 support for agpgart Christof Efkemann
2001-10-02  2:02 ` Robert Love
2001-10-02 23:45   ` Robert Love
2001-10-03  0:16     ` David Weinehall
2001-10-03  2:20     ` Robert Love
2001-10-03  2:52       ` David Weinehall
2001-10-03 11:55       ` Christof Efkemann
2001-10-06 23:47       ` Paul Mundt
2001-10-07  1:30         ` Wenzhuo Zhang
2001-10-02 13:10 ` Christof Efkemann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).