Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys PR/32550: Michael Eriksson: No agp(4) support for i915 i...



details:   https://anonhg.NetBSD.org/src/rev/fdc2931c328d
branches:  trunk
changeset: 587246:fdc2931c328d
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 16 22:59:36 2006 +0000

description:
PR/32550: Michael Eriksson: No agp(4) support for i915 integrated graphics

diffstat:

 sys/arch/i386/pci/pchb.c     |    6 +-
 sys/arch/i386/pci/pchb_rnd.c |    6 +-
 sys/dev/pci/agp.c            |   12 ++-
 sys/dev/pci/agp_ali.c        |    6 +-
 sys/dev/pci/agp_amd.c        |    6 +-
 sys/dev/pci/agp_i810.c       |  162 ++++++++++++++++++++++++++++++++----------
 sys/dev/pci/agp_intel.c      |    6 +-
 sys/dev/pci/agp_sis.c        |    6 +-
 sys/dev/pci/agp_via.c        |    6 +-
 sys/dev/pci/agpreg.h         |   16 +++-
 sys/dev/pci/agpvar.h         |    4 +-
 sys/dev/pci/pcidevs          |   14 ++-
 12 files changed, 181 insertions(+), 69 deletions(-)

diffs (truncated from 655 to 300 lines):

diff -r 8dbc3adc461f -r fdc2931c328d sys/arch/i386/pci/pchb.c
--- a/sys/arch/i386/pci/pchb.c  Mon Jan 16 22:49:23 2006 +0000
+++ b/sys/arch/i386/pci/pchb.c  Mon Jan 16 22:59:36 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pchb.c,v 1.56 2005/12/11 12:17:43 christos Exp $       */
+/*     $NetBSD: pchb.c,v 1.57 2006/01/16 22:59:36 christos Exp $       */
 
 /*-
  * Copyright (c) 1996, 1998, 2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.56 2005/12/11 12:17:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.57 2006/01/16 22:59:36 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -299,6 +299,8 @@
                case PCI_PRODUCT_INTEL_82845G_DRAM:
                case PCI_PRODUCT_INTEL_82855GM_MCH:
                case PCI_PRODUCT_INTEL_82865_HB:
+               case PCI_PRODUCT_INTEL_82915G_HB:
+               case PCI_PRODUCT_INTEL_82915GM_HB:
                        /*
                         * The host bridge is either in GFX mode (internal
                         * graphics) or in AGP mode. In GFX mode, we pretend
diff -r 8dbc3adc461f -r fdc2931c328d sys/arch/i386/pci/pchb_rnd.c
--- a/sys/arch/i386/pci/pchb_rnd.c      Mon Jan 16 22:49:23 2006 +0000
+++ b/sys/arch/i386/pci/pchb_rnd.c      Mon Jan 16 22:59:36 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pchb_rnd.c,v 1.15 2005/12/26 19:24:00 perry Exp $      */
+/*     $NetBSD: pchb_rnd.c,v 1.16 2006/01/16 22:59:36 christos Exp $   */
 
 /*
  * Copyright (c) 2000 Michael Shalayeff
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pchb_rnd.c,v 1.15 2005/12/26 19:24:00 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pchb_rnd.c,v 1.16 2006/01/16 22:59:36 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -75,6 +75,8 @@
                case PCI_PRODUCT_INTEL_82860_HB:
                case PCI_PRODUCT_INTEL_82865_HB:
                case PCI_PRODUCT_INTEL_82875P_HB:
+               case PCI_PRODUCT_INTEL_82915G_HB:
+               case PCI_PRODUCT_INTEL_82915GM_HB:
                        sc->sc_st = pa->pa_memt;
                        if (bus_space_map(sc->sc_st, I82802_IOBASE,
                            I82802_IOSIZE, 0, &sc->sc_sh) != 0) {
diff -r 8dbc3adc461f -r fdc2931c328d sys/dev/pci/agp.c
--- a/sys/dev/pci/agp.c Mon Jan 16 22:49:23 2006 +0000
+++ b/sys/dev/pci/agp.c Mon Jan 16 22:59:36 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp.c,v 1.36 2005/12/11 12:22:48 christos Exp $        */
+/*     $NetBSD: agp.c,v 1.37 2006/01/16 22:59:36 christos Exp $        */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -65,7 +65,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.36 2005/12/11 12:22:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.37 2006/01/16 22:59:36 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -145,6 +145,10 @@
          NULL,                 agp_i810_attach },
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_82865_HB,
          NULL,                 agp_i810_attach },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_82915G_HB,
+         NULL,                 agp_i810_attach },
+       { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_82915GM_HB,
+         NULL,                 agp_i810_attach },
 #endif
 
 #if NAGP_INTEL > 0
@@ -287,13 +291,13 @@
     agpmatch, agpattach, NULL, NULL);
 
 int
-agp_map_aperture(struct pci_attach_args *pa, struct agp_softc *sc)
+agp_map_aperture(struct pci_attach_args *pa, struct agp_softc *sc, int reg)
 {
        /*
         * Find the aperture. Don't map it (yet), this would
         * eat KVA.
         */
-       if (pci_mapreg_info(pa->pa_pc, pa->pa_tag, AGP_APBASE,
+       if (pci_mapreg_info(pa->pa_pc, pa->pa_tag, reg,
            PCI_MAPREG_TYPE_MEM, &sc->as_apaddr, &sc->as_apsize,
            &sc->as_apflags) != 0)
                return ENXIO;
diff -r 8dbc3adc461f -r fdc2931c328d sys/dev/pci/agp_ali.c
--- a/sys/dev/pci/agp_ali.c     Mon Jan 16 22:49:23 2006 +0000
+++ b/sys/dev/pci/agp_ali.c     Mon Jan 16 22:59:36 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_ali.c,v 1.8 2005/12/11 12:22:48 christos Exp $     */
+/*     $NetBSD: agp_ali.c,v 1.9 2006/01/16 22:59:36 christos Exp $     */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_ali.c,v 1.8 2005/12/11 12:22:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_ali.c,v 1.9 2006/01/16 22:59:36 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -93,7 +93,7 @@
        sc->as_chipc = asc;
        sc->as_methods = &agp_ali_methods;
 
-       if (agp_map_aperture(pa, sc) != 0) {
+       if (agp_map_aperture(pa, sc, AGP_APBASE) != 0) {
                aprint_error(": failed to map aperture\n");
                free(asc, M_AGP);
                return ENXIO;
diff -r 8dbc3adc461f -r fdc2931c328d sys/dev/pci/agp_amd.c
--- a/sys/dev/pci/agp_amd.c     Mon Jan 16 22:49:23 2006 +0000
+++ b/sys/dev/pci/agp_amd.c     Mon Jan 16 22:59:36 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_amd.c,v 1.13 2005/12/11 12:22:48 christos Exp $    */
+/*     $NetBSD: agp_amd.c,v 1.14 2006/01/16 22:59:36 christos Exp $    */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_amd.c,v 1.13 2005/12/11 12:22:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_amd.c,v 1.14 2006/01/16 22:59:36 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -193,7 +193,7 @@
                return error;
        }
 
-       if (agp_map_aperture(pa, sc) != 0) {
+       if (agp_map_aperture(pa, sc, AGP_APBASE) != 0) {
                aprint_error(": can't map aperture\n");
                agp_generic_detach(sc);
                free(asc, M_AGP);
diff -r 8dbc3adc461f -r fdc2931c328d sys/dev/pci/agp_i810.c
--- a/sys/dev/pci/agp_i810.c    Mon Jan 16 22:49:23 2006 +0000
+++ b/sys/dev/pci/agp_i810.c    Mon Jan 16 22:59:36 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: agp_i810.c,v 1.27 2005/12/11 12:22:48 christos Exp $   */
+/*     $NetBSD: agp_i810.c,v 1.28 2006/01/16 22:59:36 christos Exp $   */
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.27 2005/12/11 12:22:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.28 2006/01/16 22:59:36 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -58,10 +58,23 @@
 #define READ1(off)     bus_space_read_1(isc->bst, isc->bsh, off)
 #define READ4(off)     bus_space_read_4(isc->bst, isc->bsh, off)
 #define WRITE4(off,v)  bus_space_write_4(isc->bst, isc->bsh, off, v)
+#define WRITEGTT(off, v)                                               \
+       do {                                                            \
+               if (isc->chiptype == CHIP_I915) {                       \
+                       bus_space_write_4(isc->gtt_bst, isc->gtt_bsh,   \
+                           (u_int32_t)((off) >> AGP_PAGE_SHIFT) * 4,   \
+                           (v));                                       \
+               } else {                                                \
+                       WRITE4(AGP_I810_GTT +                           \
+                           (u_int32_t)((off) >> AGP_PAGE_SHIFT) * 4,   \
+                           (v));                                       \
+               }                                                       \
+       } while (0)
 
 #define CHIP_I810 0    /* i810/i815 */
 #define CHIP_I830 1    /* 830M/845G */
 #define CHIP_I855 2    /* 852GM/855GM/865G */
+#define CHIP_I915 3    /* 915G/915GM */
 
 struct agp_i810_softc {
        u_int32_t initial_aperture;     /* aperture size at startup */
@@ -70,8 +83,10 @@
        u_int32_t dcache_size;          /* i810 only */
        u_int32_t stolen;               /* number of i830/845 gtt entries
                                           for stolen memory */
-       bus_space_tag_t bst;            /* bus_space tag */
-       bus_space_handle_t bsh;         /* bus_space handle */
+       bus_space_tag_t bst;            /* register bus_space tag */
+       bus_space_handle_t bsh;         /* register bus_space handle */
+       bus_space_tag_t gtt_bst;        /* GTT bus_space tag */
+       bus_space_handle_t gtt_bsh;     /* GTT bus_space handle */
        struct pci_attach_args vga_pa;
 
        void *sc_powerhook;
@@ -122,6 +137,8 @@
        case PCI_PRODUCT_INTEL_82845G_IGD:
        case PCI_PRODUCT_INTEL_82855GM_IGD:
        case PCI_PRODUCT_INTEL_82865_IGD:
+       case PCI_PRODUCT_INTEL_82915G_IGD:
+       case PCI_PRODUCT_INTEL_82915GM_IGD:
                return (1);
        }
 
@@ -134,7 +151,7 @@
        struct agp_softc *sc = (void *)self;
        struct agp_i810_softc *isc;
        struct agp_gatt *gatt;
-       int error;
+       int error, apbase;
 
        isc = malloc(sizeof *isc, M_AGP, M_NOWAIT|M_ZERO);
        if (isc == NULL) {
@@ -164,13 +181,6 @@
        /* XXXfvdl */
        sc->as_dmat = isc->vga_pa.pa_dmat;
 
-       error = agp_map_aperture(&isc->vga_pa, sc);
-       if (error != 0) {
-               aprint_error(": can't map aperture\n");
-               free(isc, M_AGP);
-               return error;
-       }
-
        switch (PCI_PRODUCT(isc->vga_pa.pa_id)) {
        case PCI_PRODUCT_INTEL_82810_GC:
        case PCI_PRODUCT_INTEL_82810_DC100_GC:
@@ -186,13 +196,45 @@
        case PCI_PRODUCT_INTEL_82865_IGD:
                isc->chiptype = CHIP_I855;
                break;
+       case PCI_PRODUCT_INTEL_82915G_IGD:
+       case PCI_PRODUCT_INTEL_82915GM_IGD:
+               isc->chiptype = CHIP_I915;
+               break;
+       }
+
+       apbase = isc->chiptype == CHIP_I915 ? AGP_I915_GMADR : AGP_I810_GMADR;
+       error = agp_map_aperture(&isc->vga_pa, sc, apbase);
+       if (error != 0) {
+               aprint_error(": can't map aperture\n");
+               free(isc, M_AGP);
+               return error;
        }
 
-       error = pci_mapreg_map(&isc->vga_pa, AGP_I810_MMADR,
-           PCI_MAPREG_TYPE_MEM, 0, &isc->bst, &isc->bsh, NULL, NULL);
-       if (error != 0) {
-               aprint_error(": can't map mmadr registers\n");
-               return error;
+       if (isc->chiptype == CHIP_I915) {
+               error = pci_mapreg_map(&isc->vga_pa, AGP_I915_MMADR,
+                   PCI_MAPREG_TYPE_MEM, 0, &isc->bst, &isc->bsh, NULL, NULL);
+               if (error != 0) {
+                       aprint_error(": can't map mmadr registers\n");
+                       agp_generic_detach(sc);
+                       return error;
+               }
+               error = pci_mapreg_map(&isc->vga_pa, AGP_I915_GTTADR,
+                   PCI_MAPREG_TYPE_MEM, 0, &isc->gtt_bst, &isc->gtt_bsh,
+                   NULL, NULL);
+               if (error != 0) {
+                       aprint_error(": can't map gttadr registers\n");
+                       /* XXX we should release mmadr here */
+                       agp_generic_detach(sc);
+                       return error;
+               }
+       } else {
+               error = pci_mapreg_map(&isc->vga_pa, AGP_I810_MMADR,
+                   PCI_MAPREG_TYPE_MEM, 0, &isc->bst, &isc->bsh, NULL, NULL);
+               if (error != 0) {
+                       aprint_error(": can't map mmadr registers\n");
+                       agp_generic_detach(sc);
+                       return error;
+               }
        }
 
        isc->initial_aperture = AGP_GET_APERTURE(sc);
@@ -265,7 +307,7 @@
                WRITE4(AGP_I810_PGTBL_CTL, pgtblctl);
 
                gatt->ag_physical = pgtblctl & ~1;
-       } else {        /* CHIP_I855 */
+       } else if (isc->chiptype == CHIP_I855) {
                /* The 855GM automatically initializes the 128k gatt on boot. */
                pcireg_t reg;
                u_int32_t pgtblctl;



Home | Main Index | Thread Index | Old Index