| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: agp_i810.c,v 1.63 2009/02/19 05:58:37 markd Exp $ */ | | 1 | /* $NetBSD: agp_i810.c,v 1.64 2009/05/04 11:05:45 markd Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2000 Doug Rabson | | 4 | * Copyright (c) 2000 Doug Rabson |
5 | * Copyright (c) 2000 Ruslan Ermilov | | 5 | * Copyright (c) 2000 Ruslan Ermilov |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 | * SUCH DAMAGE. | | 27 | * SUCH DAMAGE. |
28 | * | | 28 | * |
29 | * $FreeBSD: src/sys/pci/agp_i810.c,v 1.4 2001/07/05 21:28:47 jhb Exp $ | | 29 | * $FreeBSD: src/sys/pci/agp_i810.c,v 1.4 2001/07/05 21:28:47 jhb Exp $ |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.63 2009/02/19 05:58:37 markd Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.64 2009/05/04 11:05:45 markd Exp $"); |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/systm.h> | | 36 | #include <sys/systm.h> |
37 | #include <sys/malloc.h> | | 37 | #include <sys/malloc.h> |
38 | #include <sys/kernel.h> | | 38 | #include <sys/kernel.h> |
39 | #include <sys/proc.h> | | 39 | #include <sys/proc.h> |
40 | #include <sys/device.h> | | 40 | #include <sys/device.h> |
41 | #include <sys/conf.h> | | 41 | #include <sys/conf.h> |
42 | | | 42 | |
43 | #include <uvm/uvm_extern.h> | | 43 | #include <uvm/uvm_extern.h> |
44 | | | 44 | |
45 | #include <dev/pci/pcivar.h> | | 45 | #include <dev/pci/pcivar.h> |
46 | #include <dev/pci/pcireg.h> | | 46 | #include <dev/pci/pcireg.h> |
| @@ -696,46 +696,37 @@ agp_i810_get_aperture(struct agp_softc * | | | @@ -696,46 +696,37 @@ agp_i810_get_aperture(struct agp_softc * |
696 | case CHIP_I830: | | 696 | case CHIP_I830: |
697 | reg = pci_conf_read(sc->as_pc, sc->as_tag, AGP_I830_GCC0); | | 697 | reg = pci_conf_read(sc->as_pc, sc->as_tag, AGP_I830_GCC0); |
698 | gcc1 = (u_int16_t)(reg >> 16); | | 698 | gcc1 = (u_int16_t)(reg >> 16); |
699 | if ((gcc1 & AGP_I830_GCC1_GMASIZE) == AGP_I830_GCC1_GMASIZE_64) | | 699 | if ((gcc1 & AGP_I830_GCC1_GMASIZE) == AGP_I830_GCC1_GMASIZE_64) |
700 | size = 64 * 1024 * 1024; | | 700 | size = 64 * 1024 * 1024; |
701 | else | | 701 | else |
702 | size = 128 * 1024 * 1024; | | 702 | size = 128 * 1024 * 1024; |
703 | break; | | 703 | break; |
704 | case CHIP_I855: | | 704 | case CHIP_I855: |
705 | size = 128 * 1024 * 1024; | | 705 | size = 128 * 1024 * 1024; |
706 | break; | | 706 | break; |
707 | case CHIP_I915: | | 707 | case CHIP_I915: |
708 | case CHIP_G33: | | 708 | case CHIP_G33: |
| | | 709 | case CHIP_G4X: |
709 | reg = pci_conf_read(sc->as_pc, sc->as_tag, AGP_I915_MSAC); | | 710 | reg = pci_conf_read(sc->as_pc, sc->as_tag, AGP_I915_MSAC); |
710 | msac = (u_int16_t)(reg >> 16); | | 711 | msac = (u_int16_t)(reg >> 16); |
711 | if (msac & AGP_I915_MSAC_APER_128M) | | 712 | if (msac & AGP_I915_MSAC_APER_128M) |
712 | size = 128 * 1024 * 1024; | | 713 | size = 128 * 1024 * 1024; |
713 | else | | 714 | else |
714 | size = 256 * 1024 * 1024; | | 715 | size = 256 * 1024 * 1024; |
715 | break; | | 716 | break; |
716 | case CHIP_I965: | | 717 | case CHIP_I965: |
717 | size = 512 * 1024 * 1024; | | 718 | size = 512 * 1024 * 1024; |
718 | break; | | 719 | break; |
719 | case CHIP_G4X: | | | |
720 | reg = pci_conf_read(sc->as_pc, sc->as_tag, AGP_G4X_MSAC); | | | |
721 | msac = (u_int16_t)(reg >> 16); | | | |
722 | switch (msac & AGP_G4X_MSAC_MASK) { | | | |
723 | case AGP_G4X_MSAC_APER_256M: | | | |
724 | size = 256 * 1024 * 1024; | | | |
725 | case AGP_G4X_MSAC_APER_512M: | | | |
726 | size = 512 * 1024 * 1024; | | | |
727 | } | | | |
728 | break; | | | |
729 | default: | | 720 | default: |
730 | aprint_error(": Unknown chipset\n"); | | 721 | aprint_error(": Unknown chipset\n"); |
731 | } | | 722 | } |
732 | | | 723 | |
733 | return size; | | 724 | return size; |
734 | } | | 725 | } |
735 | | | 726 | |
736 | static int | | 727 | static int |
737 | agp_i810_set_aperture(struct agp_softc *sc, u_int32_t aperture) | | 728 | agp_i810_set_aperture(struct agp_softc *sc, u_int32_t aperture) |
738 | { | | 729 | { |
739 | struct agp_i810_softc *isc = sc->as_chipc; | | 730 | struct agp_i810_softc *isc = sc->as_chipc; |
740 | pcireg_t reg; | | 731 | pcireg_t reg; |
741 | u_int16_t miscc, gcc1; | | 732 | u_int16_t miscc, gcc1; |