17c478bd9Sstevel@tonic-gate /* 2c4f91784Skz151634 * CDDL HEADER START 3c4f91784Skz151634 * 4c4f91784Skz151634 * The contents of this file are subject to the terms of the 5c4f91784Skz151634 * Common Development and Distribution License (the "License"). 6c4f91784Skz151634 * You may not use this file except in compliance with the License. 7c4f91784Skz151634 * 8c4f91784Skz151634 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9c4f91784Skz151634 * or http://www.opensolaris.org/os/licensing. 10c4f91784Skz151634 * See the License for the specific language governing permissions 11c4f91784Skz151634 * and limitations under the License. 12c4f91784Skz151634 * 13c4f91784Skz151634 * When distributing Covered Code, include this CDDL HEADER in each 14c4f91784Skz151634 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15c4f91784Skz151634 * If applicable, add the following below this CDDL HEADER, with the 16c4f91784Skz151634 * fields enclosed by brackets "[]" replaced with your own identifying 17c4f91784Skz151634 * information: Portions Copyright [yyyy] [name of copyright owner] 18c4f91784Skz151634 * 19c4f91784Skz151634 * CDDL HEADER END 20c4f91784Skz151634 */ 21c4f91784Skz151634 22c4f91784Skz151634 /* 23*0035d21cSmiao chen - Sun Microsystems - Beijing China * Copyright (c) 2009, Intel Corporation. 24*0035d21cSmiao chen - Sun Microsystems - Beijing China * All Rights Reserved. 25*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 26*0035d21cSmiao chen - Sun Microsystems - Beijing China 27*0035d21cSmiao chen - Sun Microsystems - Beijing China /* 28*0035d21cSmiao chen - Sun Microsystems - Beijing China * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 297c478bd9Sstevel@tonic-gate * Use is subject to license terms. 307c478bd9Sstevel@tonic-gate */ 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifndef _SYS_AGPMASTER_IO_H 337c478bd9Sstevel@tonic-gate #define _SYS_AGPMASTER_IO_H 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 367c478bd9Sstevel@tonic-gate extern "C" { 377c478bd9Sstevel@tonic-gate #endif 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #ifdef _KERNEL 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #define AGPMASTER_NAME "agpmaster" 427c478bd9Sstevel@tonic-gate #define AGPMASTER_DEVLINK "/dev/agp/agpmaster" 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate /* macros for layered ioctls */ 457c478bd9Sstevel@tonic-gate #define AGPMASTERIOC_BASE 'M' 467c478bd9Sstevel@tonic-gate #define DEVICE_DETECT _IOR(AGPMASTERIOC_BASE, 10, int) 477c478bd9Sstevel@tonic-gate #define I8XX_GET_INFO _IOR(AGPMASTERIOC_BASE, 11, igd_info_t) 487c478bd9Sstevel@tonic-gate #define I810_SET_GTT_BASE _IOW(AGPMASTERIOC_BASE, 12, uint32_t) 497c478bd9Sstevel@tonic-gate #define I8XX_ADD2GTT _IOW(AGPMASTERIOC_BASE, 13, igd_gtt_seg_t) 507c478bd9Sstevel@tonic-gate #define I8XX_REM_GTT _IOW(AGPMASTERIOC_BASE, 14, igd_gtt_seg_t) 517c478bd9Sstevel@tonic-gate #define I8XX_UNCONFIG _IO(AGPMASTERIOC_BASE, 16) 527c478bd9Sstevel@tonic-gate #define AGP_MASTER_GETINFO _IOR(AGPMASTERIOC_BASE, 20, agp_info_t) 537c478bd9Sstevel@tonic-gate #define AGP_MASTER_SETCMD _IOW(AGPMASTERIOC_BASE, 21, uint32_t) 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* used for IGD to bind/unbind gtt entries */ 567c478bd9Sstevel@tonic-gate typedef struct igd_gtt_seg { 577c478bd9Sstevel@tonic-gate uint32_t igs_pgstart; 587c478bd9Sstevel@tonic-gate uint32_t igs_npage; 597c478bd9Sstevel@tonic-gate uint32_t *igs_phyaddr; /* pointer to address array */ 607c478bd9Sstevel@tonic-gate uint32_t igs_type; /* reserved for other memory type */ 617c478bd9Sstevel@tonic-gate } igd_gtt_seg_t; 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* used for IGD to get info */ 647c478bd9Sstevel@tonic-gate typedef struct igd_info { 657c478bd9Sstevel@tonic-gate uint32_t igd_devid; 667c478bd9Sstevel@tonic-gate uint32_t igd_aperbase; 677c478bd9Sstevel@tonic-gate size_t igd_apersize; /* in MB */ 687c478bd9Sstevel@tonic-gate } igd_info_t; 697c478bd9Sstevel@tonic-gate 7060405de4Skz151634 typedef struct gtt_impl { 7160405de4Skz151634 ddi_acc_handle_t gtt_mmio_handle; /* mmaped graph registers */ 7260405de4Skz151634 caddr_t gtt_mmio_base; /* pointer to register base */ 73c4f91784Skz151634 ddi_acc_handle_t gtt_handle; /* GTT table */ 7460405de4Skz151634 caddr_t gtt_addr; /* pointer to gtt */ 7560405de4Skz151634 igd_info_t gtt_info; /* for I8XX_GET_INFO ioctl */ 7660405de4Skz151634 } gtt_impl_t; 7760405de4Skz151634 7860405de4Skz151634 typedef struct agp_master_softc { 7960405de4Skz151634 uint32_t agpm_id; /* agp master device id */ 8060405de4Skz151634 ddi_acc_handle_t agpm_acc_hdl; /* agp master pci conf handle */ 8160405de4Skz151634 int agpm_dev_type; /* which agp device type */ 8260405de4Skz151634 union { 8360405de4Skz151634 off_t agpm_acaptr; /* AGP capability reg pointer */ 8460405de4Skz151634 gtt_impl_t agpm_gtt; /* for gtt table */ 8560405de4Skz151634 } agpm_data; 8660405de4Skz151634 } agp_master_softc_t; 8760405de4Skz151634 8860405de4Skz151634 extern int agpmaster_attach(dev_info_t *, agp_master_softc_t **, 8960405de4Skz151634 ddi_acc_handle_t, minor_t); 9060405de4Skz151634 extern void agpmaster_detach(agp_master_softc_t **); 9160405de4Skz151634 extern int agpmaster_ioctl(dev_t dev, int cmd, intptr_t data, int mode, 9260405de4Skz151634 cred_t *cred, int *rval, agp_master_softc_t *softc); 9360405de4Skz151634 947c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate #ifdef __cplusplus 977c478bd9Sstevel@tonic-gate } 987c478bd9Sstevel@tonic-gate #endif 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #endif /* _SYS_AGPMASTER_IO_H */ 101