[BACK]Return to agpvar.h CVS log [TXT][DIR] Up to [local] / sys / dev / pci

Annotation of sys/dev/pci/agpvar.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: agpvar.h,v 1.6 2007/08/04 19:40:25 reyk Exp $ */
                      2: /*     $NetBSD: agpvar.h,v 1.4 2001/10/01 21:54:48 fvdl Exp $  */
                      3:
                      4: /*-
                      5:  * Copyright (c) 2000 Doug Rabson
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  *
                     17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
                     18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     20:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
                     21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     27:  * SUCH DAMAGE.
                     28:  *
                     29:  *     $FreeBSD: src/sys/pci/agppriv.h,v 1.3 2000/07/12 10:13:04 dfr Exp $
                     30:  */
                     31:
                     32: #ifndef _PCI_AGPVAR_H_
                     33: #define _PCI_AGPVAR_H_
                     34:
                     35: #include <sys/lock.h>
                     36: #include <dev/pci/vga_pcivar.h>
                     37:
                     38: /* #define     AGP_DEBUG */
                     39: #ifdef AGP_DEBUG
                     40: #define AGP_DPF(fmt, arg...) do { printf("agp: " fmt ,##arg); } while (0)
                     41: #else
                     42: #define AGP_DPF(fmt, arg...) do {} while (0)
                     43: #endif
                     44:
                     45: #define AGPUNIT(x)     minor(x)
                     46:
                     47: struct agp_methods {
                     48:        u_int32_t (*get_aperture)(struct vga_pci_softc *);
                     49:        int     (*set_aperture)(struct vga_pci_softc *, u_int32_t);
                     50:        int     (*bind_page)(struct vga_pci_softc *, off_t, bus_addr_t);
                     51:        int     (*unbind_page)(struct vga_pci_softc *, off_t);
                     52:        void    (*flush_tlb)(struct vga_pci_softc *);
                     53:        int     (*enable)(struct vga_pci_softc *, u_int32_t mode);
                     54:        struct agp_memory *
                     55:                (*alloc_memory)(struct vga_pci_softc *, int, vsize_t);
                     56:        int     (*free_memory)(struct vga_pci_softc *, struct agp_memory *);
                     57:        int     (*bind_memory)(struct vga_pci_softc *, struct agp_memory *,
                     58:                    off_t);
                     59:        int     (*unbind_memory)(struct vga_pci_softc *, struct agp_memory *);
                     60: };
                     61:
                     62: #define AGP_GET_APERTURE(sc)    ((sc)->sc_methods->get_aperture(sc))
                     63: #define AGP_SET_APERTURE(sc,a)  ((sc)->sc_methods->set_aperture((sc),(a)))
                     64: #define AGP_BIND_PAGE(sc,o,p)   ((sc)->sc_methods->bind_page((sc),(o),(p)))
                     65: #define AGP_UNBIND_PAGE(sc,o)   ((sc)->sc_methods->unbind_page((sc), (o)))
                     66: #define AGP_FLUSH_TLB(sc)       ((sc)->sc_methods->flush_tlb(sc))
                     67: #define AGP_ENABLE(sc,m)        ((sc)->sc_methods->enable((sc),(m)))
                     68: #define AGP_ALLOC_MEMORY(sc,t,s) ((sc)->sc_methods->alloc_memory((sc),(t),(s)))
                     69: #define AGP_FREE_MEMORY(sc,m)   ((sc)->sc_methods->free_memory((sc),(m)))
                     70: #define AGP_BIND_MEMORY(sc,m,o)         ((sc)->sc_methods->bind_memory((sc),(m),(o)))
                     71: #define AGP_UNBIND_MEMORY(sc,m)         ((sc)->sc_methods->unbind_memory((sc),(m)))
                     72:
                     73: /*
                     74:  * All chipset drivers must have this at the start of their softc.
                     75:  */
                     76:
                     77: struct agp_gatt {
                     78:        u_int32_t       ag_entries;
                     79:        u_int32_t       *ag_virtual;
                     80:        bus_addr_t      ag_physical;
                     81:        bus_dmamap_t    ag_dmamap;
                     82:        bus_dma_segment_t ag_dmaseg;
                     83:        size_t          ag_size;
                     84: };
                     85:
                     86:
                     87: /*
                     88:  * Functions private to the AGP code.
                     89:  */
                     90:
                     91: int    agp_find_caps(pci_chipset_tag_t, pcitag_t);
                     92: int    agp_map_aperture(struct vga_pci_softc *, u_int32_t, u_int32_t);
                     93: struct agp_gatt *
                     94:        agp_alloc_gatt(struct vga_pci_softc *);
                     95: void   agp_free_gatt(struct vga_pci_softc *, struct agp_gatt *);
                     96: void   agp_flush_cache(void);
                     97: int    agp_generic_attach(struct vga_pci_softc *);
                     98: int    agp_generic_detach(struct vga_pci_softc *);
                     99: int    agp_generic_enable(struct vga_pci_softc *, u_int32_t);
                    100: struct agp_memory *
                    101:        agp_generic_alloc_memory(struct vga_pci_softc *, int, vsize_t size);
                    102: int    agp_generic_free_memory(struct vga_pci_softc *, struct agp_memory *);
                    103: int    agp_generic_bind_memory(struct vga_pci_softc *, struct agp_memory *,
                    104:            off_t);
                    105: int    agp_generic_unbind_memory(struct vga_pci_softc *, struct agp_memory *);
                    106:
                    107: int    agp_ali_attach(struct vga_pci_softc *, struct pci_attach_args *,
                    108:            struct pci_attach_args *);
                    109: int    agp_amd_attach(struct vga_pci_softc *, struct pci_attach_args *,
                    110:            struct pci_attach_args *);
                    111: int    agp_i810_attach(struct vga_pci_softc *, struct pci_attach_args *,
                    112:            struct pci_attach_args *);
                    113: int    agp_intel_attach(struct vga_pci_softc *, struct pci_attach_args *,
                    114:            struct pci_attach_args *);
                    115: int    agp_via_attach(struct vga_pci_softc *, struct pci_attach_args *,
                    116:            struct pci_attach_args *);
                    117: int    agp_sis_attach(struct vga_pci_softc *, struct pci_attach_args *,
                    118:            struct pci_attach_args *);
                    119:
                    120: int    agp_alloc_dmamem(bus_dma_tag_t, size_t, int, bus_dmamap_t *,
                    121:            caddr_t *, bus_addr_t *, bus_dma_segment_t *, int, int *);
                    122: void   agp_free_dmamem(bus_dma_tag_t, size_t, bus_dmamap_t,
                    123:            caddr_t, bus_dma_segment_t *, int nseg) ;
                    124:
                    125: #endif /* !_PCI_AGPVAR_H_ */

CVSweb