| 1 | /* $NetBSD: agp_i810var.h,v 1.6 2015/03/06 22:03:06 riastradh Exp $ */ |
| 2 | |
| 3 | /*- |
| 4 | * Copyright (c) 2000 Doug Rabson |
| 5 | * Copyright (c) 2000 Ruslan Ermilov |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 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 |
| 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 |
| 27 | * SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #include <sys/types.h> |
| 31 | #include <sys/bus.h> |
| 32 | |
| 33 | #include <dev/pci/pcivar.h> |
| 34 | |
| 35 | #include <dev/pci/agpvar.h> |
| 36 | |
| 37 | struct agp_i810_softc { |
| 38 | struct pci_attach_args vga_pa; /* integrated graphics device args */ |
| 39 | int chiptype; /* chipset family: i810, i830, &c. */ |
| 40 | uint32_t stolen; /* pages of stolen graphics memory */ |
| 41 | |
| 42 | /* Memory-mapped I/O for integrated graphics device registers. */ |
| 43 | bus_space_tag_t bst; |
| 44 | bus_space_handle_t bsh; |
| 45 | bus_size_t size; |
| 46 | |
| 47 | /* Graphics translation table. */ |
| 48 | bus_space_tag_t gtt_bst; |
| 49 | bus_space_handle_t gtt_bsh; |
| 50 | bus_size_t gtt_size; |
| 51 | |
| 52 | /* Chipset flush page. */ |
| 53 | bus_space_tag_t flush_bst; |
| 54 | bus_space_handle_t flush_bsh; |
| 55 | bus_addr_t flush_addr; |
| 56 | |
| 57 | /* i810-only fields. */ |
| 58 | struct agp_gatt *gatt; /* i810-only OS-allocated GTT */ |
| 59 | uint32_t dcache_size; /* i810-only on-chip memory size */ |
| 60 | |
| 61 | /* XXX Kludge to work around broken X servers. */ |
| 62 | pcireg_t pgtblctl; |
| 63 | |
| 64 | /* XXX Vestige of unfinished powerhook? */ |
| 65 | uint32_t pgtblctl_resume_hack; |
| 66 | }; |
| 67 | |
| 68 | extern struct agp_softc *agp_i810_sc; |
| 69 | |
| 70 | #define AGP_I810_GTT_VALID 0x01 |
| 71 | #define AGP_I810_GTT_I810_DCACHE 0x02 /* i810-only */ |
| 72 | #define AGP_I810_GTT_CACHED 0x06 /* >=i830 */ |
| 73 | |
| 74 | int agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t, bus_addr_t, |
| 75 | int); |
| 76 | void agp_i810_post_gtt_entry(struct agp_i810_softc *, off_t); |
| 77 | void agp_i810_chipset_flush(struct agp_i810_softc *); |
| 78 | |