xref: /illumos-gate/usr/src/uts/sun4/sys/platform_module.h (revision a5f69788de7ac07553de47f7fec8c05a9a94c105)
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  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_PLATFORM_MODULE_H
27 #define	_SYS_PLATFORM_MODULE_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/async.h>
32 #include <sys/sunddi.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 
39 #ifdef _KERNEL
40 
41 /*
42  * The functions that are expected of the platform modules.
43  */
44 
45 #pragma	weak	startup_platform
46 #pragma	weak	set_platform_tsb_spares
47 #pragma	weak	set_platform_defaults
48 #pragma	weak	load_platform_drivers
49 #pragma	weak	plat_cpu_poweron
50 #pragma	weak	plat_cpu_poweroff
51 #pragma	weak	plat_freelist_process
52 #pragma	weak	plat_lpkmem_is_supported
53 
54 extern void startup_platform(void);
55 extern int set_platform_tsb_spares(void);
56 extern void set_platform_defaults(void);
57 extern void load_platform_drivers(void);
58 extern void load_platform_modules(void);
59 extern int plat_cpu_poweron(struct cpu *cp);	/* power on CPU */
60 extern int plat_cpu_poweroff(struct cpu *cp);	/* power off CPU */
61 extern void plat_freelist_process(int mnode);
62 extern void plat_build_mem_nodes(u_longlong_t *, size_t);
63 extern void plat_slice_add(pfn_t, pfn_t);
64 extern void plat_slice_del(pfn_t, pfn_t);
65 extern int plat_lpkmem_is_supported(void);
66 
67 /*
68  * Data structures expected of the platform modules.
69  */
70 extern char *platform_module_list[];
71 
72 #pragma	weak	plat_get_cpu_unum
73 #pragma	weak	plat_get_mem_unum
74 
75 extern int plat_get_cpu_unum(int cpuid, char *buf, int buflen, int *len);
76 extern int plat_get_mem_unum(int synd_code, uint64_t flt_addr, int flt_bus_id,
77     int flt_in_memory, ushort_t flt_status, char *buf, int buflen, int *len);
78 
79 #pragma	weak	plat_get_mem_sid
80 #pragma	weak	plat_get_mem_offset
81 #pragma	weak	plat_get_mem_addr
82 
83 extern int plat_get_mem_sid(char *unum, char *buf, int buflen, int *len);
84 extern int plat_get_mem_offset(uint64_t paddr, uint64_t *offp);
85 extern int plat_get_mem_addr(char *unum, char *sid, uint64_t offset,
86     uint64_t *paddr);
87 
88 #pragma weak	plat_log_fruid_error
89 
90 extern void plat_log_fruid_error(int synd_code, struct async_flt *ecc,
91     char *unum, uint64_t afsr_bit);
92 
93 #pragma	weak	plat_log_fruid_error2
94 
95 struct plat_ecc_ch_async_flt;
96 struct rmc_comm_msg;
97 
98 extern void plat_log_fruid_error2(int msg_type, char *unum,
99     struct async_flt *aflt, struct plat_ecc_ch_async_flt *plat_ecc_ch_flt);
100 
101 #pragma weak plat_ecc_capability_sc_get
102 
103 extern int plat_ecc_capability_sc_get(int type);
104 
105 #pragma weak	plat_blacklist
106 
107 extern int plat_blacklist(int cmd, const char *scheme, nvlist_t *fmri,
108     const char *class);
109 
110 extern caddr_t plat_startup_memlist(caddr_t alloc_base);
111 extern int starcat_dr_name(char *name);
112 
113 #pragma	weak	plat_setprop_enter
114 #pragma	weak	plat_setprop_exit
115 #pragma	weak	plat_shared_i2c_enter
116 #pragma	weak	plat_shared_i2c_exit
117 #pragma weak	plat_fan_blast
118 #pragma weak    plat_rmc_comm_req
119 
120 extern	void plat_setprop_enter(void);
121 extern	void plat_setprop_exit(void);
122 extern	void plat_shared_i2c_enter(dev_info_t *);
123 extern	void plat_shared_i2c_exit(dev_info_t *);
124 extern	void plat_fan_blast(void);
125 extern  void plat_rmc_comm_req(struct rmc_comm_msg *);
126 
127 /*
128  * Used to communicate DR updates to platform lgroup framework
129  */
130 typedef struct {
131 	int		u_board;
132 	uint64_t	u_base;
133 	uint64_t	u_len;
134 } update_membounds_t;
135 
136 #endif /* _KERNEL */
137 
138 #ifdef	__cplusplus
139 }
140 #endif
141 
142 #endif /* _SYS_PLATFORM_MODULE_H */
143