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