xref: /netbsd-src/sys/dev/pci/agp_i810var.h (revision 6ff71a6f22cd26e4d2c72b3ce17525458d711f6f)
1 /*	$NetBSD: agp_i810var.h,v 1.7 2018/08/27 00:51:37 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 	/* Cached pgtblctl register for resume.  */
62 	pcireg_t pgtblctl;
63 };
64 
65 extern struct agp_softc	*agp_i810_sc;
66 
67 #define	AGP_I810_GTT_VALID		0x01
68 #define	AGP_I810_GTT_I810_DCACHE	0x02 /* i810-only */
69 #define	AGP_I810_GTT_CACHED		0x06 /* >=i830 */
70 
71 int	agp_i810_write_gtt_entry(struct agp_i810_softc *, off_t, bus_addr_t,
72 	    int);
73 void	agp_i810_post_gtt_entry(struct agp_i810_softc *, off_t);
74 void	agp_i810_chipset_flush(struct agp_i810_softc *);
75 void	agp_i810_reset(struct agp_i810_softc *);
76