10Sstevel@tonic-gate /* 25036Skz151634 * CDDL HEADER START 35036Skz151634 * 45036Skz151634 * The contents of this file are subject to the terms of the 55036Skz151634 * Common Development and Distribution License (the "License"). 65036Skz151634 * You may not use this file except in compliance with the License. 75036Skz151634 * 85036Skz151634 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 95036Skz151634 * or http://www.opensolaris.org/os/licensing. 105036Skz151634 * See the License for the specific language governing permissions 115036Skz151634 * and limitations under the License. 125036Skz151634 * 135036Skz151634 * When distributing Covered Code, include this CDDL HEADER in each 145036Skz151634 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 155036Skz151634 * If applicable, add the following below this CDDL HEADER, with the 165036Skz151634 * fields enclosed by brackets "[]" replaced with your own identifying 175036Skz151634 * information: Portions Copyright [yyyy] [name of copyright owner] 185036Skz151634 * 195036Skz151634 * CDDL HEADER END 205036Skz151634 */ 215036Skz151634 225036Skz151634 /* 23*11260SMiao.Chen@Sun.COM * Copyright (c) 2009, Intel Corporation. 24*11260SMiao.Chen@Sun.COM * All Rights Reserved. 25*11260SMiao.Chen@Sun.COM */ 26*11260SMiao.Chen@Sun.COM 27*11260SMiao.Chen@Sun.COM /* 28*11260SMiao.Chen@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 290Sstevel@tonic-gate * Use is subject to license terms. 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifndef _SYS_AGPMASTER_IO_H 330Sstevel@tonic-gate #define _SYS_AGPMASTER_IO_H 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate #ifdef _KERNEL 400Sstevel@tonic-gate 410Sstevel@tonic-gate #define AGPMASTER_NAME "agpmaster" 420Sstevel@tonic-gate #define AGPMASTER_DEVLINK "/dev/agp/agpmaster" 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* macros for layered ioctls */ 450Sstevel@tonic-gate #define AGPMASTERIOC_BASE 'M' 460Sstevel@tonic-gate #define DEVICE_DETECT _IOR(AGPMASTERIOC_BASE, 10, int) 470Sstevel@tonic-gate #define I8XX_GET_INFO _IOR(AGPMASTERIOC_BASE, 11, igd_info_t) 480Sstevel@tonic-gate #define I810_SET_GTT_BASE _IOW(AGPMASTERIOC_BASE, 12, uint32_t) 490Sstevel@tonic-gate #define I8XX_ADD2GTT _IOW(AGPMASTERIOC_BASE, 13, igd_gtt_seg_t) 500Sstevel@tonic-gate #define I8XX_REM_GTT _IOW(AGPMASTERIOC_BASE, 14, igd_gtt_seg_t) 510Sstevel@tonic-gate #define I8XX_UNCONFIG _IO(AGPMASTERIOC_BASE, 16) 520Sstevel@tonic-gate #define AGP_MASTER_GETINFO _IOR(AGPMASTERIOC_BASE, 20, agp_info_t) 530Sstevel@tonic-gate #define AGP_MASTER_SETCMD _IOW(AGPMASTERIOC_BASE, 21, uint32_t) 540Sstevel@tonic-gate 550Sstevel@tonic-gate /* used for IGD to bind/unbind gtt entries */ 560Sstevel@tonic-gate typedef struct igd_gtt_seg { 570Sstevel@tonic-gate uint32_t igs_pgstart; 580Sstevel@tonic-gate uint32_t igs_npage; 590Sstevel@tonic-gate uint32_t *igs_phyaddr; /* pointer to address array */ 600Sstevel@tonic-gate uint32_t igs_type; /* reserved for other memory type */ 610Sstevel@tonic-gate } igd_gtt_seg_t; 620Sstevel@tonic-gate 630Sstevel@tonic-gate /* used for IGD to get info */ 640Sstevel@tonic-gate typedef struct igd_info { 650Sstevel@tonic-gate uint32_t igd_devid; 660Sstevel@tonic-gate uint32_t igd_aperbase; 670Sstevel@tonic-gate size_t igd_apersize; /* in MB */ 680Sstevel@tonic-gate } igd_info_t; 690Sstevel@tonic-gate 702820Skz151634 typedef struct gtt_impl { 712820Skz151634 ddi_acc_handle_t gtt_mmio_handle; /* mmaped graph registers */ 722820Skz151634 caddr_t gtt_mmio_base; /* pointer to register base */ 735036Skz151634 ddi_acc_handle_t gtt_handle; /* GTT table */ 742820Skz151634 caddr_t gtt_addr; /* pointer to gtt */ 752820Skz151634 igd_info_t gtt_info; /* for I8XX_GET_INFO ioctl */ 762820Skz151634 } gtt_impl_t; 772820Skz151634 782820Skz151634 typedef struct agp_master_softc { 792820Skz151634 uint32_t agpm_id; /* agp master device id */ 802820Skz151634 ddi_acc_handle_t agpm_acc_hdl; /* agp master pci conf handle */ 812820Skz151634 int agpm_dev_type; /* which agp device type */ 822820Skz151634 union { 832820Skz151634 off_t agpm_acaptr; /* AGP capability reg pointer */ 842820Skz151634 gtt_impl_t agpm_gtt; /* for gtt table */ 852820Skz151634 } agpm_data; 862820Skz151634 } agp_master_softc_t; 872820Skz151634 882820Skz151634 extern int agpmaster_attach(dev_info_t *, agp_master_softc_t **, 892820Skz151634 ddi_acc_handle_t, minor_t); 902820Skz151634 extern void agpmaster_detach(agp_master_softc_t **); 912820Skz151634 extern int agpmaster_ioctl(dev_t dev, int cmd, intptr_t data, int mode, 922820Skz151634 cred_t *cred, int *rval, agp_master_softc_t *softc); 932820Skz151634 940Sstevel@tonic-gate #endif /* _KERNEL */ 950Sstevel@tonic-gate 960Sstevel@tonic-gate #ifdef __cplusplus 970Sstevel@tonic-gate } 980Sstevel@tonic-gate #endif 990Sstevel@tonic-gate 1000Sstevel@tonic-gate #endif /* _SYS_AGPMASTER_IO_H */ 101