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