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