xref: /netbsd-src/sys/dev/pci/igmavar.h (revision 8c1acc4017484a1e6637880ff94cd52ba542cb33)
1 /*	$NetBSD: igmavar.h,v 1.1 2014/01/21 14:52:07 mlelstv Exp $	*/
2 
3 /*
4  * Copyright (c) 2014 Michael van Elst
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef IGMAVAR_H
20 #define IGMAVAR_H
21 
22 #include <dev/pci/pcivar.h>
23 #include <dev/pci/pcireg.h>
24 
25 struct igma_chip;
26 struct igma_chip_ops {
27 	void (*barrier)(const struct igma_chip *, int);
28 	u_int32_t (*read_reg)(const struct igma_chip *, int);
29 	void (*write_reg)(const struct igma_chip *, int, u_int32_t);
30 	u_int8_t (*read_vga)(const struct igma_chip *, int);
31 	void (*write_vga)(const struct igma_chip *, int, u_int8_t);
32 #if 0
33 	u_int8_t (*read_crtc)(const struct igma_chip *, int);
34 	void (*write_crtc)(const struct igma_chip *, int, u_int8_t);
35 #endif
36 };
37 
38 struct igma_chip {
39 	const struct igma_chip_ops	*ops;
40 
41 	bus_space_tag_t         gttt;
42 	bus_space_handle_t      gtth;
43 
44 	bus_space_tag_t         mmiot;
45 	bus_space_handle_t      mmioh;
46 
47 	bus_space_tag_t         vgat;
48 	bus_space_handle_t      vgah;
49 
50 	bus_space_tag_t         gmt;
51 	bus_space_handle_t      gmh;
52 	bus_addr_t		gmb;
53 
54 	int num_gmbus;
55 	int gpio_offset;
56 	int vga_cntrl;
57 	int num_pipes;
58 	int use_pipe;
59 	u_int32_t pri_cntrl;
60 	int backlight_cntrl;
61 	int backlight_cntrl2;
62 	int backlight_factor;
63 
64 	unsigned quirks;
65 };
66 #define IGMA_PLANESTART_QUIRK   (1L << 0)
67 #define IGMA_PFITDISABLE_QUIRK  (1L << 1)
68 
69 struct igma_attach_args {
70 	const struct igma_chip_ops	*iaa_chip_ops;
71 	struct igma_chip   	iaa_chip;
72 	bool				iaa_console;
73 	char				iaa_name[32];
74 };
75 
76 #endif
77