1 /* $OpenBSD: vga_pcivar.h,v 1.11 2008/06/12 00:54:38 oga 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 58 struct pci_attach_args pa; 59 struct vga_pci_bar *bars[VGA_PCI_MAX_BARS]; 60 #ifdef VESAFB 61 int sc_width; 62 int sc_height; 63 int sc_depth; 64 int sc_linebytes; 65 u_int32_t sc_base; 66 int sc_mode; /* WSDISPLAY_MODE_EMUL or _DUMBFB */ 67 int sc_textmode; /* original VESA text mode */ 68 int sc_gfxmode; /* VESA graphics mode */ 69 u_char sc_cmap_red[256]; /* saved color map */ 70 u_char sc_cmap_green[256]; 71 u_char sc_cmap_blue[256]; 72 73 #endif 74 }; 75 76 int vga_pci_cnattach(bus_space_tag_t, bus_space_tag_t, 77 pci_chipset_tag_t, int, int, int); 78 struct vga_pci_bar *vga_pci_bar_info(struct vga_pci_softc *, int); 79 struct vga_pci_bar *vga_pci_bar_map(struct vga_pci_softc *, int, 80 bus_size_t, int); 81 void vga_pci_bar_unmap(struct vga_pci_bar*); 82 83 #ifdef VESAFB 84 int vesafb_find_mode(struct vga_pci_softc *, int, int, int); 85 void vesafb_set_mode(struct vga_pci_softc *, int); 86 int vesafb_get_mode(struct vga_pci_softc *); 87 int vesafb_get_supported_depth(struct vga_pci_softc *); 88 #endif 89 90 #endif /* _PCI_VGA_PCIVAR_H_ */ 91