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