1*1708Sstevel /* 2*1708Sstevel * CDDL HEADER START 3*1708Sstevel * 4*1708Sstevel * The contents of this file are subject to the terms of the 5*1708Sstevel * Common Development and Distribution License (the "License"). 6*1708Sstevel * You may not use this file except in compliance with the License. 7*1708Sstevel * 8*1708Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1708Sstevel * or http://www.opensolaris.org/os/licensing. 10*1708Sstevel * See the License for the specific language governing permissions 11*1708Sstevel * and limitations under the License. 12*1708Sstevel * 13*1708Sstevel * When distributing Covered Code, include this CDDL HEADER in each 14*1708Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1708Sstevel * If applicable, add the following below this CDDL HEADER, with the 16*1708Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 17*1708Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 18*1708Sstevel * 19*1708Sstevel * CDDL HEADER END 20*1708Sstevel */ 21*1708Sstevel 22*1708Sstevel /* 23*1708Sstevel * Copyright 2000 Sun Microsystems, Inc. All rights reserved. 24*1708Sstevel * Use is subject to license terms. 25*1708Sstevel */ 26*1708Sstevel 27*1708Sstevel #ifndef _SYS_IOSRAMIO_H 28*1708Sstevel #define _SYS_IOSRAMIO_H 29*1708Sstevel 30*1708Sstevel #pragma ident "%Z%%M% %I% %E% SMI" 31*1708Sstevel 32*1708Sstevel #ifdef __cplusplus 33*1708Sstevel extern "C" { 34*1708Sstevel #endif 35*1708Sstevel 36*1708Sstevel 37*1708Sstevel /* 38*1708Sstevel * data_valid flag values 39*1708Sstevel */ 40*1708Sstevel #define IOSRAM_DATA_INVALID 0 41*1708Sstevel #define IOSRAM_DATA_VALID 1 42*1708Sstevel 43*1708Sstevel /* 44*1708Sstevel * int_pending flag values 45*1708Sstevel */ 46*1708Sstevel #define IOSRAM_INT_NONE 0 47*1708Sstevel #define IOSRAM_INT_TO_SSC 1 48*1708Sstevel #define IOSRAM_INT_TO_DOM 2 49*1708Sstevel 50*1708Sstevel /* 51*1708Sstevel * IOSRAM control commands, for use in iosram_ctrl(). 52*1708Sstevel */ 53*1708Sstevel #define IOSRAM_CMD_CHUNKLEN 1 54*1708Sstevel 55*1708Sstevel /* 56*1708Sstevel * IOSRAM header control commands, for use in iosram_hdr_ctrl _only_ by the 57*1708Sstevel * Mailbox Protocol implementation 58*1708Sstevel */ 59*1708Sstevel #define IOSRAM_HDRCMD_GET_SMS_MBOX_VER 1 60*1708Sstevel #define IOSRAM_HDRCMD_SET_OS_MBOX_VER 2 61*1708Sstevel #define IOSRAM_HDRCMD_REG_CALLBACK 3 62*1708Sstevel 63*1708Sstevel /* 64*1708Sstevel * Extern prototypes for kernel drivers/modules 65*1708Sstevel */ 66*1708Sstevel extern int iosram_rd(uint32_t key, uint32_t off, uint32_t len, caddr_t dptr); 67*1708Sstevel extern int iosram_wr(uint32_t key, uint32_t off, uint32_t len, caddr_t dptr); 68*1708Sstevel extern int iosram_force_write(uint32_t key, uint32_t off, uint32_t len, 69*1708Sstevel caddr_t dptr); 70*1708Sstevel extern int iosram_get_flag(uint32_t key, uint8_t *data_valid, 71*1708Sstevel uint8_t *int_pending); 72*1708Sstevel extern int iosram_set_flag(uint32_t key, uint8_t data_valid, 73*1708Sstevel uint8_t int_pending); 74*1708Sstevel extern int iosram_send_intr(); 75*1708Sstevel extern int iosram_register(uint32_t key, void (*handler)(), void *arg); 76*1708Sstevel extern int iosram_unregister(uint32_t key); 77*1708Sstevel extern int iosram_ctrl(uint32_t key, uint32_t cmd, void *arg); 78*1708Sstevel 79*1708Sstevel /* 80*1708Sstevel * This function is only intended to be called by DR. 81*1708Sstevel */ 82*1708Sstevel extern int iosram_switchfrom(int instance); 83*1708Sstevel 84*1708Sstevel /* 85*1708Sstevel * The following functions are only to be used by the Mailbox Protocol 86*1708Sstevel * implementation. 87*1708Sstevel */ 88*1708Sstevel extern int iosram_sema_acquire(uint32_t *); 89*1708Sstevel extern int iosram_sema_release(void); 90*1708Sstevel extern int iosram_hdr_ctrl(uint32_t cmd, void *arg); 91*1708Sstevel 92*1708Sstevel 93*1708Sstevel #if defined(DEBUG) 94*1708Sstevel 95*1708Sstevel /* 96*1708Sstevel * ioctls for testing purposes only 97*1708Sstevel */ 98*1708Sstevel 99*1708Sstevel #define IOSRAM_IOC ('i' << 8) 100*1708Sstevel 101*1708Sstevel #define IOSRAM_RD (int)(IOSRAM_IOC|1) 102*1708Sstevel #define IOSRAM_WR (int)(IOSRAM_IOC|2) 103*1708Sstevel #define IOSRAM_GET_FLAG (int)(IOSRAM_IOC|3) 104*1708Sstevel #define IOSRAM_SET_FLAG (int)(IOSRAM_IOC|4) 105*1708Sstevel #define IOSRAM_TOC (int)(IOSRAM_IOC|5) 106*1708Sstevel #define IOSRAM_SEND_INTR (int)(IOSRAM_IOC|6) 107*1708Sstevel #define IOSRAM_REG_CBACK (int)(IOSRAM_IOC|7) 108*1708Sstevel #define IOSRAM_UNREG_CBACK (int)(IOSRAM_IOC|8) 109*1708Sstevel #define IOSRAM_PRINT_CBACK (int)(IOSRAM_IOC|9) 110*1708Sstevel #define IOSRAM_PRINT_STATE (int)(IOSRAM_IOC|10) 111*1708Sstevel #define IOSRAM_PRINT_LOG (int)(IOSRAM_IOC|11) 112*1708Sstevel #define IOSRAM_PRINT_FLAGS (int)(IOSRAM_IOC|12) 113*1708Sstevel #define IOSRAM_TUNNEL_SWITCH (int)(IOSRAM_IOC|13) 114*1708Sstevel #define IOSRAM_PRINT_STATS (int)(IOSRAM_IOC|14) 115*1708Sstevel #define IOSRAM_SEMA_ACQUIRE (int)(IOSRAM_IOC|15) 116*1708Sstevel #define IOSRAM_SEMA_RELEASE (int)(IOSRAM_IOC|16) 117*1708Sstevel 118*1708Sstevel 119*1708Sstevel /* 120*1708Sstevel * struct iosram_io: 121*1708Sstevel * Used for testing purposes to invoke IOSRAM internal 122*1708Sstevel * interface from user level via ioctl() interface. 123*1708Sstevel */ 124*1708Sstevel typedef struct iosram_io { 125*1708Sstevel uint32_t cmd; /* read or write */ 126*1708Sstevel uint32_t key; /* IOSRAM chunk key */ 127*1708Sstevel uint32_t off; /* offset within IOSRAM chunk */ 128*1708Sstevel uint32_t len; /* size of read or write */ 129*1708Sstevel uint32_t bufp; /* buffer pointer */ 130*1708Sstevel uint32_t retval; /* provided by driver */ 131*1708Sstevel uint32_t data_valid; /* flag being get/set */ 132*1708Sstevel uint32_t int_pending; /* flag being get/set */ 133*1708Sstevel } iosram_io_t; 134*1708Sstevel 135*1708Sstevel #endif /* DEBUG */ 136*1708Sstevel 137*1708Sstevel #ifdef __cplusplus 138*1708Sstevel } 139*1708Sstevel #endif 140*1708Sstevel 141*1708Sstevel #endif /* _SYS_IOSRAMIO_H */ 142