xref: /titanic_41/usr/src/uts/common/sys/agp/agpmaster_io.h (revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82)
1 /*
2  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 #ifndef	_SYS_AGPMASTER_IO_H
7 #define	_SYS_AGPMASTER_IO_H
8 
9 #pragma ident	"%Z%%M%	%I%	%E% SMI"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #ifdef _KERNEL
16 
17 #define	AGPMASTER_NAME		"agpmaster"
18 #define	AGPMASTER_DEVLINK	"/dev/agp/agpmaster"
19 
20 /* macros for layered ioctls */
21 #define	AGPMASTERIOC_BASE		'M'
22 #define	DEVICE_DETECT		_IOR(AGPMASTERIOC_BASE, 10, int)
23 #define	I8XX_GET_INFO		_IOR(AGPMASTERIOC_BASE, 11, igd_info_t)
24 #define	I810_SET_GTT_BASE	_IOW(AGPMASTERIOC_BASE, 12, uint32_t)
25 #define	I8XX_ADD2GTT		_IOW(AGPMASTERIOC_BASE, 13, igd_gtt_seg_t)
26 #define	I8XX_REM_GTT		_IOW(AGPMASTERIOC_BASE, 14, igd_gtt_seg_t)
27 #define	I8XX_UNCONFIG		_IO(AGPMASTERIOC_BASE, 16)
28 #define	AGP_MASTER_GETINFO	_IOR(AGPMASTERIOC_BASE, 20, agp_info_t)
29 #define	AGP_MASTER_SETCMD	_IOW(AGPMASTERIOC_BASE, 21, uint32_t)
30 
31 /* used for IGD to bind/unbind gtt entries */
32 typedef struct igd_gtt_seg {
33 	uint32_t	igs_pgstart;
34 	uint32_t	igs_npage;
35 	uint32_t	*igs_phyaddr; /* pointer to address array */
36 	uint32_t	igs_type; /* reserved for other memory type */
37 } igd_gtt_seg_t;
38 
39 /* used for IGD to get info */
40 typedef struct igd_info {
41 	uint32_t	igd_devid;
42 	uint32_t	igd_aperbase;
43 	size_t		igd_apersize; /* in MB */
44 } igd_info_t;
45 
46 typedef struct gtt_impl {
47 	ddi_acc_handle_t	gtt_mmio_handle; /* mmaped graph registers */
48 	caddr_t			gtt_mmio_base; /* pointer to register base */
49 	caddr_t			gtt_addr; /* pointer to gtt */
50 	igd_info_t		gtt_info; /* for I8XX_GET_INFO ioctl */
51 } gtt_impl_t;
52 
53 typedef struct agp_master_softc {
54 	uint32_t		agpm_id; /* agp master device id */
55 	ddi_acc_handle_t	agpm_acc_hdl; /* agp master pci conf handle */
56 	int			agpm_dev_type; /* which agp device type */
57 	union {
58 		off_t		agpm_acaptr; /* AGP capability reg pointer */
59 		gtt_impl_t	agpm_gtt; /* for gtt table */
60 	} agpm_data;
61 } agp_master_softc_t;
62 
63 extern int agpmaster_attach(dev_info_t *, agp_master_softc_t **,
64     ddi_acc_handle_t, minor_t);
65 extern void agpmaster_detach(agp_master_softc_t **);
66 extern int agpmaster_ioctl(dev_t dev, int cmd, intptr_t data, int mode,
67     cred_t *cred, int *rval, agp_master_softc_t *softc);
68 
69 #endif /* _KERNEL */
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif /* _SYS_AGPMASTER_IO_H */
76