10Sstevel@tonic-gate /* 2*5036Skz151634 * CDDL HEADER START 3*5036Skz151634 * 4*5036Skz151634 * The contents of this file are subject to the terms of the 5*5036Skz151634 * Common Development and Distribution License (the "License"). 6*5036Skz151634 * You may not use this file except in compliance with the License. 7*5036Skz151634 * 8*5036Skz151634 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*5036Skz151634 * or http://www.opensolaris.org/os/licensing. 10*5036Skz151634 * See the License for the specific language governing permissions 11*5036Skz151634 * and limitations under the License. 12*5036Skz151634 * 13*5036Skz151634 * When distributing Covered Code, include this CDDL HEADER in each 14*5036Skz151634 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*5036Skz151634 * If applicable, add the following below this CDDL HEADER, with the 16*5036Skz151634 * fields enclosed by brackets "[]" replaced with your own identifying 17*5036Skz151634 * information: Portions Copyright [yyyy] [name of copyright owner] 18*5036Skz151634 * 19*5036Skz151634 * CDDL HEADER END 20*5036Skz151634 */ 21*5036Skz151634 22*5036Skz151634 /* 23*5036Skz151634 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_AGPMASTER_IO_H 280Sstevel@tonic-gate #define _SYS_AGPMASTER_IO_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef _KERNEL 370Sstevel@tonic-gate 380Sstevel@tonic-gate #define AGPMASTER_NAME "agpmaster" 390Sstevel@tonic-gate #define AGPMASTER_DEVLINK "/dev/agp/agpmaster" 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* macros for layered ioctls */ 420Sstevel@tonic-gate #define AGPMASTERIOC_BASE 'M' 430Sstevel@tonic-gate #define DEVICE_DETECT _IOR(AGPMASTERIOC_BASE, 10, int) 440Sstevel@tonic-gate #define I8XX_GET_INFO _IOR(AGPMASTERIOC_BASE, 11, igd_info_t) 450Sstevel@tonic-gate #define I810_SET_GTT_BASE _IOW(AGPMASTERIOC_BASE, 12, uint32_t) 460Sstevel@tonic-gate #define I8XX_ADD2GTT _IOW(AGPMASTERIOC_BASE, 13, igd_gtt_seg_t) 470Sstevel@tonic-gate #define I8XX_REM_GTT _IOW(AGPMASTERIOC_BASE, 14, igd_gtt_seg_t) 480Sstevel@tonic-gate #define I8XX_UNCONFIG _IO(AGPMASTERIOC_BASE, 16) 490Sstevel@tonic-gate #define AGP_MASTER_GETINFO _IOR(AGPMASTERIOC_BASE, 20, agp_info_t) 500Sstevel@tonic-gate #define AGP_MASTER_SETCMD _IOW(AGPMASTERIOC_BASE, 21, uint32_t) 510Sstevel@tonic-gate 520Sstevel@tonic-gate /* used for IGD to bind/unbind gtt entries */ 530Sstevel@tonic-gate typedef struct igd_gtt_seg { 540Sstevel@tonic-gate uint32_t igs_pgstart; 550Sstevel@tonic-gate uint32_t igs_npage; 560Sstevel@tonic-gate uint32_t *igs_phyaddr; /* pointer to address array */ 570Sstevel@tonic-gate uint32_t igs_type; /* reserved for other memory type */ 580Sstevel@tonic-gate } igd_gtt_seg_t; 590Sstevel@tonic-gate 600Sstevel@tonic-gate /* used for IGD to get info */ 610Sstevel@tonic-gate typedef struct igd_info { 620Sstevel@tonic-gate uint32_t igd_devid; 630Sstevel@tonic-gate uint32_t igd_aperbase; 640Sstevel@tonic-gate size_t igd_apersize; /* in MB */ 650Sstevel@tonic-gate } igd_info_t; 660Sstevel@tonic-gate 672820Skz151634 typedef struct gtt_impl { 682820Skz151634 ddi_acc_handle_t gtt_mmio_handle; /* mmaped graph registers */ 692820Skz151634 caddr_t gtt_mmio_base; /* pointer to register base */ 70*5036Skz151634 ddi_acc_handle_t gtt_handle; /* GTT table */ 712820Skz151634 caddr_t gtt_addr; /* pointer to gtt */ 722820Skz151634 igd_info_t gtt_info; /* for I8XX_GET_INFO ioctl */ 732820Skz151634 } gtt_impl_t; 742820Skz151634 752820Skz151634 typedef struct agp_master_softc { 762820Skz151634 uint32_t agpm_id; /* agp master device id */ 772820Skz151634 ddi_acc_handle_t agpm_acc_hdl; /* agp master pci conf handle */ 782820Skz151634 int agpm_dev_type; /* which agp device type */ 792820Skz151634 union { 802820Skz151634 off_t agpm_acaptr; /* AGP capability reg pointer */ 812820Skz151634 gtt_impl_t agpm_gtt; /* for gtt table */ 822820Skz151634 } agpm_data; 832820Skz151634 } agp_master_softc_t; 842820Skz151634 852820Skz151634 extern int agpmaster_attach(dev_info_t *, agp_master_softc_t **, 862820Skz151634 ddi_acc_handle_t, minor_t); 872820Skz151634 extern void agpmaster_detach(agp_master_softc_t **); 882820Skz151634 extern int agpmaster_ioctl(dev_t dev, int cmd, intptr_t data, int mode, 892820Skz151634 cred_t *cred, int *rval, agp_master_softc_t *softc); 902820Skz151634 910Sstevel@tonic-gate #endif /* _KERNEL */ 920Sstevel@tonic-gate 930Sstevel@tonic-gate #ifdef __cplusplus 940Sstevel@tonic-gate } 950Sstevel@tonic-gate #endif 960Sstevel@tonic-gate 970Sstevel@tonic-gate #endif /* _SYS_AGPMASTER_IO_H */ 98