xref: /openbsd/sys/dev/pci/vga_pcivar.h (revision 3cab2bb3)
1 /* $OpenBSD: vga_pcivar.h,v 1.20 2015/10/29 07:47:03 kettenis Exp $ */
2 /* $NetBSD: vga_pcivar.h,v 1.1 1998/03/22 15:16:19 drochner Exp $ */
3 
4 /*
5  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
6  * All rights reserved.
7  *
8  * Author: Chris G. Demetriou
9  *
10  * Permission to use, copy, modify and distribute this software and
11  * its documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  *
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * Carnegie Mellon requests users of this software to return to
21  *
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  *
27  * any improvements or extensions that they make and grant Carnegie the
28  * rights to redistribute these changes.
29  */
30 
31 #ifndef _PCI_VGA_PCIVAR_H_
32 #define _PCI_VGA_PCIVAR_H_
33 
34 #define	DEVICE_IS_VGA_PCI(class)					\
35 	    (((PCI_CLASS(class) == PCI_CLASS_DISPLAY &&			\
36 	      PCI_SUBCLASS(class) == PCI_SUBCLASS_DISPLAY_VGA) ||	\
37 	     (PCI_CLASS(class) == PCI_CLASS_PREHISTORIC &&		\
38 	      PCI_SUBCLASS(class) == PCI_SUBCLASS_PREHISTORIC_VGA)) ? 1 : 0)
39 
40 #define VGA_PCI_MAX_BARS 6
41 
42 struct vga_pci_bar {
43 	int		addr;
44 	u_int		mapped;
45 	pcireg_t	maptype;
46 	bus_addr_t	base;
47 	bus_size_t	size;
48 	bus_size_t	maxsize;
49 	bus_space_tag_t	bst;
50 	bus_space_handle_t bsh;
51 	int		flags;
52 	void		*vaddr;
53 };
54 
55 struct vga_pci_softc {
56 	struct device sc_dev;
57 	struct vga_config *sc_vc;
58 	int sc_type;
59 
60 	struct pci_attach_args pa;
61 #if NACPI > 0
62 	struct reg_vgats sc_save_ts;
63 	struct reg_mc6845 sc_save_crtc;
64 	struct reg_vgaattr sc_save_atc;
65 	struct reg_vgagdc sc_save_gdc;
66 #endif
67 #ifdef X86EMU
68 	struct vga_post *sc_posth;
69 #endif
70 #ifdef VESAFB
71 	int sc_width;
72 	int sc_height;
73 	int sc_depth;
74 	int sc_linebytes;
75 	u_int32_t sc_base;
76 	int sc_mode;			/* WSDISPLAY_MODE_EMUL or _DUMBFB */
77 	int sc_textmode;		/* original VESA text mode */
78 	int sc_gfxmode;			/* VESA graphics mode */
79 	u_char sc_cmap_red[256];	/* saved color map */
80 	u_char sc_cmap_green[256];
81 	u_char sc_cmap_blue[256];
82 #endif
83 };
84 
85 int	vga_pci_cnattach(bus_space_tag_t, bus_space_tag_t,
86 	    pci_chipset_tag_t, int, int, int);
87 int	vga_aperture_needed(struct pci_attach_args *);
88 
89 #endif /* _PCI_VGA_PCIVAR_H_ */
90