xref: /titanic_52/usr/src/uts/sun4u/serengeti/sys/sgsbbc_iosram.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24*03831d35Sstevel  * Use is subject to license terms.
25*03831d35Sstevel  */
26*03831d35Sstevel 
27*03831d35Sstevel #ifndef	_SYS_SGSBBC_IOSRAM_H
28*03831d35Sstevel #define	_SYS_SGSBBC_IOSRAM_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 #include <sys/types.h>
37*03831d35Sstevel #include <sys/errno.h>
38*03831d35Sstevel #include <sys/sgsbbc.h>
39*03831d35Sstevel 
40*03831d35Sstevel /*
41*03831d35Sstevel  * IOSRAM TOC as laid out for the OS by the SC/POST
42*03831d35Sstevel  *
43*03831d35Sstevel  * NB Any changes in the way POST/SC lays out the SRAM
44*03831d35Sstevel  * must be reflected here.
45*03831d35Sstevel  */
46*03831d35Sstevel #define	SBBC_MAX_KEYS		32
47*03831d35Sstevel 
48*03831d35Sstevel #define	SBBC_CONSOLE_KEY	1	/* Solaris Console Buffer */
49*03831d35Sstevel #define	SBBC_TOD_KEY		2	/* Solaris TOD struct */
50*03831d35Sstevel #define	SBBC_INTR_SC_KEY	3	/* Solaris -> SC Interrupts reason */
51*03831d35Sstevel #define	SBBC_SC_INTR_KEY	4	/* SC -> Solaris Interrupts reason */
52*03831d35Sstevel #define	SBBC_DOMAIN_KEY		5	/* Domain state */
53*03831d35Sstevel #define	SBBC_KEYSWITCH_KEY	6	/* Keyswitch */
54*03831d35Sstevel #define	SBBC_MAILBOX_KEY	7	/* Solaris<->SC Mailbox */
55*03831d35Sstevel #define	SBBC_ENVCTRL_KEY	8	/* environmental data */
56*03831d35Sstevel #define	SBBC_SC_INTR_ENABLED_KEY	9	/* SC -> Solaris Interrupts */
57*03831d35Sstevel #define	SBBC_INTR_SC_ENABLED_KEY	10	/* Solaris -> SC  Interrupts */
58*03831d35Sstevel #define	SBBC_SIGBLCK_KEY	11	/* Signature block */
59*03831d35Sstevel 
60*03831d35Sstevel /*
61*03831d35Sstevel  * size of the IOSRAM key
62*03831d35Sstevel  */
63*03831d35Sstevel #define	KEY_SIZE	8
64*03831d35Sstevel #define	MAGIC_SIZE	8
65*03831d35Sstevel 
66*03831d35Sstevel typedef struct iosram_key {
67*03831d35Sstevel 	char		key[KEY_SIZE];	/* Key value as defined above */
68*03831d35Sstevel 	uint32_t	size;		/* length of this SRAM chunk */
69*03831d35Sstevel 	uint32_t	offset;		/* Offset from base of SRAM */
70*03831d35Sstevel } iosram_key_t;
71*03831d35Sstevel 
72*03831d35Sstevel struct iosram_toc {
73*03831d35Sstevel 	char		iosram_magic[MAGIC_SIZE];	/* magic: TOCSRAM */
74*03831d35Sstevel 	uint8_t		resvd;				/* reserved */
75*03831d35Sstevel 	/* sram type: cpu, local io, global io, etc */
76*03831d35Sstevel 	uint8_t		iosram_type;
77*03831d35Sstevel 	uint16_t	iosram_version;			/* structure version */
78*03831d35Sstevel 	uint32_t	iosram_tagno;			/* # of tags used */
79*03831d35Sstevel 	iosram_key_t	iosram_keys[SBBC_MAX_KEYS];
80*03831d35Sstevel };
81*03831d35Sstevel 
82*03831d35Sstevel 
83*03831d35Sstevel /*
84*03831d35Sstevel  * interrupt related routines
85*03831d35Sstevel  */
86*03831d35Sstevel extern int	iosram_reg_intr(uint32_t, sbbc_intrfunc_t, caddr_t,
87*03831d35Sstevel 			uint_t	*, kmutex_t *);
88*03831d35Sstevel extern int	iosram_unreg_intr(uint32_t);
89*03831d35Sstevel extern int	iosram_send_intr(uint32_t);
90*03831d35Sstevel 
91*03831d35Sstevel /*
92*03831d35Sstevel  * IOSRAM read write routines
93*03831d35Sstevel  */
94*03831d35Sstevel extern int	iosram_read(int, uint32_t, caddr_t, uint32_t);
95*03831d35Sstevel extern int	iosram_write(int, uint32_t, caddr_t, uint32_t);
96*03831d35Sstevel 
97*03831d35Sstevel /*
98*03831d35Sstevel  * Misc routines
99*03831d35Sstevel  */
100*03831d35Sstevel extern int	iosram_size(int);
101*03831d35Sstevel 
102*03831d35Sstevel /* cached chosen node_id */
103*03831d35Sstevel extern pnode_t chosen_nodeid;
104*03831d35Sstevel 
105*03831d35Sstevel #ifdef	__cplusplus
106*03831d35Sstevel }
107*03831d35Sstevel #endif
108*03831d35Sstevel 
109*03831d35Sstevel #endif	/* _SYS_SGSBBC_IOSRAM_H */
110