xref: /titanic_52/usr/src/uts/sparc/v9/sys/prom_isa.h (revision 06e46062ef4f5f4b687cbafb4518fb123fe23920)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_PROM_ISA_H
28 #define	_SYS_PROM_ISA_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/feature_tests.h>
33 #include <sys/obpdefs.h>
34 
35 /*
36  * This file contains external ISA-specific promif interface definitions.
37  * There may be none.  This file is included by reference in <sys/promif.h>
38  *
39  * This version of the file contains definitions for a 64-bit client program
40  * calling the 64-bit cell-sized SPARC v9 firmware client interface handler.
41  *
42  */
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 #if !defined(_LONGLONG_TYPE)
49 #error "This header won't work without long long support"
50 #endif
51 
52 typedef	unsigned long long cell_t;
53 
54 #define	p1275_ptr2cell(p)	((cell_t)((uintptr_t)((void *)(p))))
55 #define	p1275_int2cell(i)	((cell_t)((int)(i)))
56 #define	p1275_uint2cell(u)	((cell_t)((unsigned int)(u)))
57 #define	p1275_size2cell(u)	((cell_t)((size_t)(u)))
58 #define	p1275_phandle2cell(ph)	((cell_t)((unsigned int)((phandle_t)(ph))))
59 #define	p1275_dnode2cell(d)	((cell_t)((unsigned int)((pnode_t)(d))))
60 #define	p1275_ihandle2cell(ih)	((cell_t)((unsigned int)((ihandle_t)(ih))))
61 #define	p1275_ull2cell_high(ll)	(0LL)
62 #define	p1275_ull2cell_low(ll)	((cell_t)(ll))
63 #define	p1275_uintptr2cell(i)	((cell_t)((uintptr_t)(i)))
64 
65 #define	p1275_cell2ptr(p)	((void *)((cell_t)(p)))
66 #define	p1275_cell2int(i)	((int)((cell_t)(i)))
67 #define	p1275_cell2uint(u)	((unsigned int)((cell_t)(u)))
68 #define	p1275_cell2size(u)	((size_t)((cell_t)(u)))
69 #define	p1275_cell2phandle(ph)	((phandle_t)((cell_t)(ph)))
70 #define	p1275_cell2dnode(d)	((pnode_t)((cell_t)(d)))
71 #define	p1275_cell2ihandle(ih)	((ihandle_t)((cell_t)(ih)))
72 #define	p1275_cells2ull(h, l)	((unsigned long long)(cell_t)(l))
73 #define	p1275_cell2uintptr(i)	((uintptr_t)((cell_t)(i)))
74 
75 /*
76  * Define default cif handlers:  This port uses SPARC V8 32 bit semantics
77  * on the calling side and the prom side.
78  */
79 #define	p1275_cif_init			p1275_sparc_cif_init
80 #define	p1275_cif_handler		p1275_sparc_cif_handler
81 
82 extern void	*p1275_sparc_cif_init(void *);
83 extern int	p1275_cif_handler(void *);
84 
85 #ifdef	__cplusplus
86 }
87 #endif
88 
89 #endif /* _SYS_PROM_ISA_H */
90