2 * Copyright (c) 1995, 1996 Carnegie-Mellon University.
5 * Author: Chris G. Demetriou
7 * Permission to use, copy, modify and distribute this software and
8 * its documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
13 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
14 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
15 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 * Carnegie Mellon requests users of this software to return to
19 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
20 * School of Computer Science
21 * Carnegie Mellon University
22 * Pittsburgh PA 15213-3890
24 * any improvements or extensions that they make and grant Carnegie the
25 * rights to redistribute these changes.
27 * Copyright (c) 2000 Andrew Miklic
35 #define GFB_MEM_BASE_RID 0x10
37 typedef u_int32_t gfb_reg_t;
39 /* GFB register access macros */
41 #define BUFADDR(adp, off) \
42 /* (adp)->va_buffer = (adp)->va_mem_base + \
43 (((adp)->va_buffer - \
44 (adp)->va_mem_base + \
45 (adp)->va_buffer_size) % \
46 (adp)->va_mem_size), \
47 (adp)->va_buffer_alias = ((adp)->va_buffer - \
48 (adp)->va_mem_base) / \
49 (adp)->va_buffer_size, \
50 (adp)->va_window = (adp)->va_buffer + \
51 (((adp)->va_window - \
52 (adp)->va_mem_base) / \
53 (adp)->va_buffer_alias), \
54 */ ((adp)->va_window + (adp)->va_window_orig + \
55 ((vm_offset_t)(off) << 2L))
57 #define REGADDR(adp, reg) \
58 /* (adp)->va_buffer = (adp)->va_mem_base + \
59 (((adp)->va_buffer - \
60 (adp)->va_mem_base + \
61 (adp)->va_buffer_size) % \
62 (adp)->va_mem_size), \
63 (adp)->va_buffer_alias = ((adp)->va_buffer - \
64 (adp)->va_mem_base) / \
65 (adp)->va_buffer_size, \
66 (adp)->va_registers = (adp)->va_buffer + \
67 (((adp)->va_registers - \
68 (adp)->va_mem_base) / \
69 (adp)->va_buffer_alias), \
70 */ ((adp)->va_registers + ((vm_offset_t)(reg) << 2L))
72 #define READ_GFB_REGISTER(adp, reg) \
73 (*(u_int32_t *)(REGADDR(adp, reg)))
74 #define WRITE_GFB_REGISTER(adp, reg, val) \
75 (*(u_int32_t*)(REGADDR(adp, reg)) = (val))
76 #define GFB_REGISTER_WRITE_BARRIER(sc, reg, nregs) \
77 bus_space_barrier((sc)->btag, (sc)->regs, ((reg) << 2), \
78 4 * (nregs), BUS_SPACE_BARRIER_WRITE)
79 #define GFB_REGISTER_READ_BARRIER(sc, reg, nregs) \
80 bus_space_barrier((sc)->btag, (sc)->regs, ((reg) << 2), \
81 4 * (nregs), BUS_SPACE_BARRIER_READ)
82 #define GFB_REGISTER_READWRITE_BARRIER(sc, reg, nregs) \
83 bus_space_barrier((sc)->btag, (sc)->regs, ((reg) << 2), \
85 BUS_SPACE_BARRIER_READ | \
86 BUS_SPACE_BARRIER_WRITE)
88 #define READ_GFB_BUFFER(adp, reg) \
89 (*(u_int32_t *)(BUFADDR(adp, reg)))
90 #define WRITE_GFB_BUFFER(adp, reg, val) \
91 (*(u_int32_t*)(BUFADDR(adp, reg)) = (val))
93 /*int pcigfb_probe(device_t);*/
94 int pcigfb_attach(device_t);
95 int pcigfb_detach(device_t);
97 #ifdef FB_INSTALL_CDEV
100 d_close_t pcigfb_close;
101 d_read_t pcigfb_read;
102 d_write_t pcigfb_write;
103 d_ioctl_t pcigfb_ioctl;
104 d_mmap_t pcigfb_mmap;
106 #endif /*FB_INSTALL_CDEV*/
108 typedef struct gfb_type {
114 #endif /* _PCI_GFB_H_ */