diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2006-02-03 19:24:43 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2006-02-03 19:24:43 +0000 |
commit | 5c0f78c7bcaa348fe3a9ce9ad6083dfccf790ca6 (patch) | |
tree | e6659f5a1f5c2d6db37f474e7dd47fc87559e27a /sys | |
parent | 600c7ff5380f80544f5b9fdd595d757303c013fe (diff) |
Back out i915 changes; they broke some i810-based machines.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/pci/agp_machdep.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/agp_i810.c | 104 | ||||
-rw-r--r-- | sys/dev/pci/agpreg.h | 19 |
3 files changed, 21 insertions, 106 deletions
diff --git a/sys/arch/i386/pci/agp_machdep.c b/sys/arch/i386/pci/agp_machdep.c index b355d2cfe1a..089fd53e23e 100644 --- a/sys/arch/i386/pci/agp_machdep.c +++ b/sys/arch/i386/pci/agp_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp_machdep.c,v 1.4 2006/01/13 22:58:59 deraadt Exp $ */ +/* $OpenBSD: agp_machdep.c,v 1.5 2006/02/03 19:24:42 millert Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -47,8 +47,6 @@ const struct agp_product agp_products[] = { { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82845G_IGD, agp_i810_attach }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82852GM_AGP, agp_i810_attach }, { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82865_IGD, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915G_IV, agp_i810_attach }, - { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82915GM_IGD, agp_i810_attach }, { PCI_VENDOR_INTEL, -1, agp_intel_attach }, { PCI_VENDOR_SIS, -1, agp_sis_attach }, { PCI_VENDOR_VIATECH, -1, agp_via_attach }, diff --git a/sys/dev/pci/agp_i810.c b/sys/dev/pci/agp_i810.c index 7c822d6248b..9c2a97a02e6 100644 --- a/sys/dev/pci/agp_i810.c +++ b/sys/dev/pci/agp_i810.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp_i810.c,v 1.9 2006/01/13 22:59:02 deraadt Exp $ */ +/* $OpenBSD: agp_i810.c,v 1.10 2006/02/03 19:24:42 millert Exp $ */ /* $NetBSD: agp_i810.c,v 1.15 2003/01/31 00:07:39 thorpej Exp $ */ /*- @@ -53,22 +53,10 @@ #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) bus_space_write_4(isc->gtt_bst, isc->gtt_bsh, off, v) #define CHIP_I810 0 /* i810/i815 */ #define CHIP_I830 1 /* i830/i845 */ #define CHIP_I855 2 /* i852GM/i855GM/i865G */ -#define CHIP_I915 3 /* i915G/i915GM */ - -#define WRITE_GATT(off,v) \ - do { \ - if (isc->chiptype == CHIP_I915) \ - WRITEGTT((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) struct agp_i810_softc { struct agp_gatt *gatt; @@ -78,8 +66,6 @@ struct agp_i810_softc { for stolen memory */ bus_space_tag_t bst; /* bus_space tag */ bus_space_handle_t bsh; /* bus_space handle */ - bus_space_tag_t gtt_bst; /* GATT bus_space tag */ - bus_space_handle_t gtt_bsh; /* GATT bus_space handle */ struct pci_attach_args bridge_pa; }; @@ -148,31 +134,15 @@ agp_i810_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa, case PCI_PRODUCT_INTEL_82865_IGD: isc->chiptype = CHIP_I855; break; - case PCI_PRODUCT_INTEL_82915G_IV: - case PCI_PRODUCT_INTEL_82915GM_IGD: - isc->chiptype = CHIP_I915; - break; } - error = pci_mapreg_map(pa, - (isc->chiptype == CHIP_I915) ? AGP_I915_MMADR : AGP_I810_MMADR, + error = pci_mapreg_map(pa, AGP_I810_MMADR, PCI_MAPREG_TYPE_MEM, 0, &isc->bst, &isc->bsh, NULL, NULL, 0); if (error != 0) { printf(": can't map mmadr registers\n"); - agp_generic_detach(sc); return (error); } - if (isc->chiptype == CHIP_I915) { - error = pci_mapreg_map(pa, AGP_I915_GTTADR, PCI_MAPREG_TYPE_MEM, - 0, &isc->gtt_bst, &isc->gtt_bsh, NULL, NULL, 0); - if (error != 0) { - printf(": can't map gatt registers\n"); - agp_generic_detach(sc); - return (error); - } - } - gatt = malloc(sizeof(struct agp_gatt), M_DEVBUF, M_NOWAIT); if (!gatt) { agp_generic_detach(sc); @@ -244,42 +214,30 @@ agp_i810_attach(struct vga_pci_softc *sc, struct pci_attach_args *pa, WRITE4(AGP_I810_PGTBL_CTL, pgtblctl); gatt->ag_physical = pgtblctl & ~1; - } else if (isc->chiptype == CHIP_I855 || isc->chiptype == CHIP_I915) { + } else { /* CHIP_I855 */ /* The 855GM automatically initializes the 128k gatt on boot. */ - u_int32_t stolen; pcireg_t reg; u_int32_t pgtblctl; u_int16_t gcc1; - if (isc->chiptype == CHIP_I855) - stolen = 132; - else - stolen = 260; - reg = pci_conf_read(isc->bridge_pa.pa_pc, isc->bridge_pa.pa_tag, AGP_I855_GCC1); gcc1 = (u_int16_t)(reg >> 16); switch (gcc1 & AGP_I855_GCC1_GMS) { case AGP_I855_GCC1_GMS_STOLEN_1M: - isc->stolen = (1024 - stolen) * 1024 / 4096; + isc->stolen = (1024 - 132) * 1024 / 4096; break; case AGP_I855_GCC1_GMS_STOLEN_4M: - isc->stolen = (4096 - stolen) * 1024 / 4096; + isc->stolen = (4096 - 132) * 1024 / 4096; break; case AGP_I855_GCC1_GMS_STOLEN_8M: - isc->stolen = (8192 - stolen) * 1024 / 4096; + isc->stolen = (8192 - 132) * 1024 / 4096; break; case AGP_I855_GCC1_GMS_STOLEN_16M: - isc->stolen = (16384 - stolen) * 1024 / 4096; + isc->stolen = (16384 - 132) * 1024 / 4096; break; case AGP_I855_GCC1_GMS_STOLEN_32M: - isc->stolen = (32768 - stolen) * 1024 / 4096; - break; - case AGP_I915_GCC1_GMS_STOLEN_48M: - isc->stolen = (49152 - stolen) * 1024 / 4096; - break; - case AGP_I915_GCC1_GMS_STOLEN_64M: - isc->stolen = (65536 - stolen) * 1024 / 4096; + isc->stolen = (32768 - 132) * 1024 / 4096; break; default: isc->stolen = 0; @@ -338,19 +296,9 @@ agp_i810_get_aperture(struct vga_pci_softc *sc) return (64 * 1024 * 1024); else return (128 * 1024 * 1024); - } else if (isc->chiptype == CHIP_I855) { + } else { /* CHIP_I855 */ return (128 * 1024 * 1024); - } else if (isc->chiptype == CHIP_I915) { - reg = pci_conf_read(isc->bridge_pa.pa_pc, - isc->bridge_pa.pa_tag, AGP_I915_MSAC); - if ((reg & AGP_I915_MSAC_GMASIZE) == AGP_I915_MSAC_GMASIZE_128) { - return (128 * 1024 * 1024); - } else { - return (256 * 1024 * 1024); - } } - - return 0; } int @@ -405,26 +353,11 @@ agp_i810_set_aperture(struct vga_pci_softc *sc, u_int32_t aperture) reg |= ((pcireg_t)gcc1) << 16; pci_conf_write(isc->bridge_pa.pa_pc, isc->bridge_pa.pa_tag, AGP_I830_GCC0, reg); - } else if (isc->chiptype == CHIP_I855) { + } else { /* CHIP_I855 */ if (aperture != (128 * 1024 * 1024)) { printf("agp: bad aperture size %d\n", aperture); return (EINVAL); } - } else if (isc->chiptype == CHIP_I915) { - if (aperture != (128 * 1024 * 1024) && - aperture != (256 * 1024 * 1024)) { - printf("agp: bad aperture size %d\n", aperture); - return (EINVAL); - } - reg = pci_conf_read(isc->bridge_pa.pa_pc, - isc->bridge_pa.pa_tag, AGP_I915_MSAC); - reg &= ~AGP_I915_MSAC_GMASIZE; - if (aperture == (128 * 1024 * 1024)) - reg |= AGP_I915_MSAC_GMASIZE_128; - else - reg |= AGP_I915_MSAC_GMASIZE_256; - pci_conf_write(isc->bridge_pa.pa_pc, - isc->bridge_pa.pa_tag, AGP_I915_MSAC, reg); } return (0); @@ -453,7 +386,8 @@ agp_i810_bind_page(struct vga_pci_softc *sc, off_t offset, bus_addr_t physical) } } - WRITE_GATT(offset, physical | 1); + WRITE4(AGP_I810_GTT + (u_int32_t)(offset >> AGP_PAGE_SHIFT) * 4, + physical | 1); return (0); } @@ -474,7 +408,7 @@ agp_i810_unbind_page(struct vga_pci_softc *sc, off_t offset) } } - WRITE_GATT(offset, 0); + WRITE4(AGP_I810_GTT + (u_int32_t)(offset >> AGP_PAGE_SHIFT) * 4, 0); return (0); } @@ -515,12 +449,10 @@ agp_i810_alloc_memory(struct vga_pci_softc *sc, int type, vsize_t size) return (NULL); } else if (type == 2) { /* - * Bogus mapping of 1 or 4 pages for the hardware cursor. + * Bogus mapping of a single page for the hardware cursor. */ - if (size != AGP_PAGE_SIZE && size != 4 * AGP_PAGE_SIZE) { - printf("agp: trying to map %lu for hw cursor\n", size); + if (size != AGP_PAGE_SIZE) return (NULL); - } } mem = malloc(sizeof *mem, M_DEVBUF, M_WAITOK); @@ -606,7 +538,8 @@ agp_i810_bind_memory(struct vga_pci_softc *sc, struct agp_memory *mem, } if (mem->am_type == 2) { - WRITE_GATT(offset, mem->am_physical | 1); + WRITE4(AGP_I810_GTT + (u_int32_t)(offset >> AGP_PAGE_SHIFT) * 4, + mem->am_physical | 1); mem->am_offset = offset; mem->am_is_bound = 1; return (0); @@ -633,7 +566,8 @@ agp_i810_unbind_memory(struct vga_pci_softc *sc, struct agp_memory *mem) u_int32_t i; if (mem->am_type == 2) { - WRITE_GATT(mem->am_offset, 0); + WRITE4(AGP_I810_GTT + + (u_int32_t)(mem->am_offset >> AGP_PAGE_SHIFT) * 4, 0); mem->am_offset = 0; mem->am_is_bound = 0; return (0); diff --git a/sys/dev/pci/agpreg.h b/sys/dev/pci/agpreg.h index b4eabdac653..e55bea1f3a6 100644 --- a/sys/dev/pci/agpreg.h +++ b/sys/dev/pci/agpreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: agpreg.h,v 1.4 2006/01/13 22:59:02 deraadt Exp $ */ +/* $OpenBSD: agpreg.h,v 1.5 2006/02/03 19:24:42 millert Exp $ */ /* $NetBSD: agpreg.h,v 1.1 2001/09/10 10:01:02 fvdl Exp $ */ /*- @@ -186,21 +186,4 @@ #define AGP_I855_GCC1_GMS_STOLEN_16M 0x40 #define AGP_I855_GCC1_GMS_STOLEN_32M 0x50 -/* - * 915G registers - */ -#define AGP_I915_GMADR 0x18 -#define AGP_I915_MMADR 0x10 -#define AGP_I915_GTTADR 0x1C -#define AGP_I915_GCC1_GMS_STOLEN_48M 0x60 -#define AGP_I915_GCC1_GMS_STOLEN_64M 0x70 -#define AGP_I915_DEVEN 0x54 -#define AGP_I915_DEVEN_D2F0 0x08 -#define AGP_I915_DEVEN_D2F0_ENABLED 0x08 -#define AGP_I915_DEVEN_D2F0_DISABLED 0x00 -#define AGP_I915_MSAC 0x62 -#define AGP_I915_MSAC_GMASIZE 0x02 -#define AGP_I915_MSAC_GMASIZE_128 0x02 -#define AGP_I915_MSAC_GMASIZE_256 0x00 - #endif /* !_PCI_AGPREG_H_ */ |