1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #ifndef _PCI_VGA_PCIVAR_H_
32 #define _PCI_VGA_PCIVAR_H_
33
34 #define DEVICE_IS_VGA_PCI(class, id) \
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 enum agp_acquire_state {
41 AGP_ACQUIRE_FREE,
42 AGP_ACQUIRE_USER,
43 AGP_ACQUIRE_KERNEL
44 };
45
46
47
48
49 TAILQ_HEAD(agp_memory_list, agp_memory);
50 struct agp_memory {
51 TAILQ_ENTRY(agp_memory) am_link;
52 int am_id;
53 vsize_t am_size;
54 int am_type;
55 off_t am_offset;
56 int am_is_bound;
57 bus_addr_t am_physical;
58 caddr_t am_virtual;
59 bus_dmamap_t am_dmamap;
60 int am_nseg;
61 bus_dma_segment_t *am_dmaseg;
62 };
63
64 struct vga_pci_softc {
65 struct device sc_dev;
66
67 #if 0
68 struct vga_config *sc_vc;
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;
77 int sc_textmode;
78 int sc_gfxmode;
79 u_char sc_cmap_red[256];
80 u_char sc_cmap_green[256];
81 u_char sc_cmap_blue[256];
82
83 #endif
84 #ifdef PCIAGP
85
86 bus_space_tag_t sc_bt, sc_memt;
87 bus_space_handle_t sc_bh;
88 bus_addr_t sc_apaddr;
89 bus_size_t sc_apsize;
90 bus_dma_tag_t sc_dmat;
91 struct lock sc_lock;
92 pcitag_t sc_pcitag;
93 pcireg_t sc_id;
94 pci_chipset_tag_t sc_pc;
95
96 struct agp_methods *sc_methods;
97 void *sc_chipc;
98
99 int sc_opened;
100 int sc_capoff;
101 int sc_apflags;
102 int sc_nextid;
103
104 u_int32_t sc_maxmem;
105 u_int32_t sc_allocated;
106 enum agp_acquire_state sc_state;
107 struct agp_memory_list sc_memory;
108 #endif
109 };
110
111 #ifdef PCIAGP
112 struct agp_product {
113 int ap_vendor;
114 int ap_product;
115 int (*ap_attach)(struct vga_pci_softc *,
116 struct pci_attach_args *, struct pci_attach_args *);
117 };
118
119 extern const struct agp_product agp_products[];
120
121 void agp_attach(struct device *, struct device *, void *);
122 paddr_t agp_mmap(void *, off_t, int);
123 int agp_ioctl(void *, u_long, caddr_t, int, struct proc *);
124 #endif
125
126 int vga_pci_cnattach(bus_space_tag_t, bus_space_tag_t,
127 pci_chipset_tag_t, int, int, int);
128
129 #ifdef VESAFB
130 int vesafb_find_mode(struct vga_pci_softc *, int, int, int);
131 void vesafb_set_mode(struct vga_pci_softc *, int);
132 int vesafb_get_mode(struct vga_pci_softc *);
133 int vesafb_get_supported_depth(struct vga_pci_softc *);
134 #endif
135
136 #endif