agpgart.h revision 1450
1379N/A/*
1379N/A * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
1379N/A */
1379N/A
1379N/A/*
1379N/A * Copyright (c) 2000 Doug Rabson
1379N/A * Copyright (c) 2009, 2013, Intel Corporation.
1379N/A * All rights reserved.
1379N/A *
1379N/A * Redistribution and use in source and binary forms, with or without
1379N/A * modification, are permitted provided that the following conditions
1379N/A * are met:
1379N/A * 1. Redistributions of source code must retain the above copyright
1379N/A * notice, this list of conditions and the following disclaimer.
1379N/A * 2. Redistributions in binary form must reproduce the above copyright
1379N/A * notice, this list of conditions and the following disclaimer in the
1379N/A * documentation and/or other materials provided with the distribution.
1379N/A *
1379N/A * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1379N/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1379N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1379N/A * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1379N/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1379N/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1379N/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1379N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1379N/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1379N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1379N/A * SUCH DAMAGE.
1379N/A *
1379N/A */
1379N/A
1379N/A#ifndef _SYS_AGPGART_H
1379N/A#define _SYS_AGPGART_H
1379N/A
1379N/A#ifdef __cplusplus
1379N/Aextern "C" {
1379N/A#endif
1379N/A
1379N/A#define AGP_NORMAL 0 /* mapped to user land, no cache */
1379N/A
1379N/Atypedef struct _agp_version {
1379N/A uint16_t agpv_major;
1379N/A uint16_t agpv_minor;
1379N/A} agp_version_t;
1379N/A
1379N/A
1379N/Atypedef struct _agp_info {
1379N/A agp_version_t agpi_version;
1379N/A uint32_t agpi_devid; /* bridge vendor + device */
1379N/A uint32_t agpi_mode; /* mode of brdige */
1379N/A ulong_t agpi_aperbase; /* base of aperture */
1379N/A size_t agpi_apersize; /* aperture range size */
1379N/A uint32_t agpi_pgtotal; /* max number of pages in aperture */
1379N/A uint32_t agpi_pgsystem; /* same as pg_total */
1379N/A uint32_t agpi_pgused; /* NUMBER of currently used pages */
1379N/A} agp_info_t;
1379N/A
1379N/Atypedef struct _agp_setup {
1379N/A uint32_t agps_mode;
1379N/A} agp_setup_t;
1379N/A
1379N/Atypedef struct _agp_allocate {
1379N/A int32_t agpa_key;
1379N/A uint32_t agpa_pgcount;
1379N/A uint32_t agpa_type;
1379N/A uint32_t agpa_physical; /* for i810 only, private */
1379N/A} agp_allocate_t;
1379N/A
1379N/Atypedef struct _agp_bind_pages {
1379N/A uint32_t agpb_pgstart;
1379N/A pfn_t *agpb_pages;
1379N/A unsigned long agpb_pgcount;
1379N/A unsigned int agpb_flags;
1379N/A} agp_bind_pages_t;
1379N/A
1379N/Atypedef struct _agp_unbind_pages {
1379N/A uint32_t agpb_pgstart;
1379N/A unsigned long agpb_pgcount;
1379N/A uint32_t agpb_type;
pfn_t *agpb_pages;
pfn_t agpb_scratch;
} agp_unbind_pages_t;
typedef struct _agp_bind {
int32_t agpb_key;
uint32_t agpb_pgstart;
} agp_bind_t;
typedef struct _agp_unbind {
int32_t agpu_key;
uint32_t agpu_pri; /* no use in solaris */
} agp_unbind_t;
typedef struct _agp_rw_gtt {
uint32_t pgstart;
unsigned long pgcount;
void *addr;
uint32_t type;
} agp_rw_gtt_t;
typedef struct _agp_gtt_info {
uint32_t agp_pgstart;
unsigned long agp_npage;
pfn_t *agp_phyaddr; /* pointer to address array */
uint32_t agp_type; /* reserved for other memory type */
unsigned int agp_flags;
pfn_t agp_scratch;
} agp_gtt_info_t;
#define AGPIOC_BASE 'G'
#define AGPIOC_INFO _IOR(AGPIOC_BASE, 0, 100)
#define AGPIOC_ACQUIRE _IO(AGPIOC_BASE, 1)
#define AGPIOC_RELEASE _IO(AGPIOC_BASE, 2)
#define AGPIOC_SETUP _IOW(AGPIOC_BASE, 3, agp_setup_t)
#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 4, agp_allocate_t)
#define AGPIOC_DEALLOCATE _IOW(AGPIOC_BASE, 5, int)
#define AGPIOC_BIND _IOW(AGPIOC_BASE, 6, agp_bind_t)
#define AGPIOC_UNBIND _IOW(AGPIOC_BASE, 7, agp_unbind_t)
#define AGPIOC_IOREMAP _IO(AGPIOC_BASE, 8)
#define AGPIOC_IOREMAP_FREE _IO(AGPIOC_BASE, 9)
#define AGPIOC_READ _IO(AGPIOC_BASE, 10)
#define AGPIOC_WRITE _IO(AGPIOC_BASE, 11)
#define AGPIOC_FLUSHCHIPSET _IO(AGPIOC_BASE, 12)
#define AGPIOC_PAGES_BIND _IOW(AGPIOC_BASE, 13, agp_gtt_info_t)
#define AGPIOC_PAGES_UNBIND _IOW(AGPIOC_BASE, 14, agp_gtt_info_t)
#define AGPIOC_RW_GTT _IOW(AGPIOC_BASE, 15, agp_rw_gtt_t)
/* AGP status register bits definition */
#define AGPSTAT_RQ_MASK 0xff000000 /* target only */
#define AGPSTAT_SBA (0x1 << 9) /* always 1 for 3.0 */
#define AGPSTAT_OVER4G (0x1 << 5)
#define AGPSTAT_FW (0x1 << 4)
#define AGPSTAT_RATE_MASK 0x7
/* rate for 2.0 mode */
#define AGP2_RATE_1X 0x1
#define AGP2_RATE_2X 0x2
#define AGP2_RATE_4X 0x4
/* AGP 3.0 only bits */
#define AGPSTAT_ARQSZ_MASK (0x7 << 13) /* target only */
#define AGPSTAT_CAL_MASK (0x7 << 10)
#define AGPSTAT_GART64B (0x1 << 7) /* target only */
#define AGPSTAT_MODE3 (0x1 << 3)
/* Rate for 3.0 mode */
#define AGP3_RATE_4X 0x1
#define AGP3_RATE_8X 0x2
/* AGP command register bits definition */
#define AGPCMD_RQ_MASK 0xff000000 /* master only */
#define AGPCMD_SBAEN (0x1 << 9) /* must be 1 for 3.0 */
#define AGPCMD_AGPEN (0x1 << 8)
#define AGPCMD_OVER4GEN (0x1 << 5)
#define AGPCMD_FWEN (0x1 << 4)
#define AGPCMD_RATE_MASK 0x7
/* AGP 3.0 only bits */
#define AGP3_CMD_ARQSZ_MASK (0x7 << 13) /* master only */
#define AGP3_CMD_CAL_MASK (0x7 << 10) /* target only */
#define AGP3_CMD_GART64BEN (0x1 << 7) /* target only */
#define AGP_DEVICE "/dev/agpgart"
#ifdef __cplusplus
}
#endif
#endif /* _SYS_AGPGART_H */