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