1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate * CDDL HEADER START
3*0Sstevel@tonic-gate *
4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*0Sstevel@tonic-gate * with the License.
8*0Sstevel@tonic-gate *
9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate * and limitations under the License.
13*0Sstevel@tonic-gate *
14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate *
20*0Sstevel@tonic-gate * CDDL HEADER END
21*0Sstevel@tonic-gate */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate * Copyright (c) 2000-2001 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate * All rights reserved.
25*0Sstevel@tonic-gate */
26*0Sstevel@tonic-gate
27*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gate /*
30*0Sstevel@tonic-gate * This plugin creates memory configuration nodes and properties in the
31*0Sstevel@tonic-gate * PICL tree for Grover/Grover+ platform.
32*0Sstevel@tonic-gate *
33*0Sstevel@tonic-gate * Subtree of memory-controller in the physical aspect.
34*0Sstevel@tonic-gate * memory-controller --- memory-module
35*0Sstevel@tonic-gate * However, there is no memory controller node on Grover. Thus we need to
36*0Sstevel@tonic-gate * create it under platform.
37*0Sstevel@tonic-gate *
38*0Sstevel@tonic-gate * Subtree of memory in the logical aspect.
39*0Sstevel@tonic-gate * memory --- memory-segment
40*0Sstevel@tonic-gate * Add property _memory-module_ at memory-segment referring to the
41*0Sstevel@tonic-gate * memory-module since memory-segment equals to memory-module on Grover.
42*0Sstevel@tonic-gate *
43*0Sstevel@tonic-gate * Undo strategy:
44*0Sstevel@tonic-gate * Create all nodes and properties, or none if it fails in physical and
45*0Sstevel@tonic-gate * logical memory tree respectively. It keeps on creating logical
46*0Sstevel@tonic-gate * memory tree although it falis on physical logical tree, but no link to
47*0Sstevel@tonic-gate * memory module.
48*0Sstevel@tonic-gate *
49*0Sstevel@tonic-gate * NOTE:
50*0Sstevel@tonic-gate * It depends on PICL devtree plugin.
51*0Sstevel@tonic-gate */
52*0Sstevel@tonic-gate
53*0Sstevel@tonic-gate #include <stdio.h>
54*0Sstevel@tonic-gate #include <stdlib.h>
55*0Sstevel@tonic-gate #include <unistd.h>
56*0Sstevel@tonic-gate #include <alloca.h>
57*0Sstevel@tonic-gate #include <syslog.h>
58*0Sstevel@tonic-gate #include <string.h>
59*0Sstevel@tonic-gate #include <libintl.h>
60*0Sstevel@tonic-gate #include <picl.h>
61*0Sstevel@tonic-gate #include <picltree.h>
62*0Sstevel@tonic-gate #include <sys/types.h>
63*0Sstevel@tonic-gate #include <sys/obpdefs.h>
64*0Sstevel@tonic-gate #include "piclmemcfg.h"
65*0Sstevel@tonic-gate #include "memcfg_impl.h"
66*0Sstevel@tonic-gate
67*0Sstevel@tonic-gate static void piclmemcfg_register(void);
68*0Sstevel@tonic-gate static void piclmemcfg_init(void);
69*0Sstevel@tonic-gate static void piclmemcfg_fini(void);
70*0Sstevel@tonic-gate
71*0Sstevel@tonic-gate #pragma init(piclmemcfg_register)
72*0Sstevel@tonic-gate
73*0Sstevel@tonic-gate static picld_plugin_reg_t my_reg_info = {
74*0Sstevel@tonic-gate PICLD_PLUGIN_VERSION_1,
75*0Sstevel@tonic-gate PICLD_PLUGIN_NON_CRITICAL,
76*0Sstevel@tonic-gate "SUNW_piclmemcfg",
77*0Sstevel@tonic-gate piclmemcfg_init,
78*0Sstevel@tonic-gate piclmemcfg_fini
79*0Sstevel@tonic-gate };
80*0Sstevel@tonic-gate
81*0Sstevel@tonic-gate /*
82*0Sstevel@tonic-gate * Create logical memory tree
83*0Sstevel@tonic-gate * memory --- memory-segment
84*0Sstevel@tonic-gate */
85*0Sstevel@tonic-gate static int
create_logical_tree(picl_nodehdl_t memh,mmodinfo_t * mmodinfo)86*0Sstevel@tonic-gate create_logical_tree(picl_nodehdl_t memh, mmodinfo_t *mmodinfo)
87*0Sstevel@tonic-gate {
88*0Sstevel@tonic-gate picl_nodehdl_t msegh;
89*0Sstevel@tonic-gate picl_nodehdl_t *memsegh;
90*0Sstevel@tonic-gate ptree_propinfo_t propinfo;
91*0Sstevel@tonic-gate uint32_t ifactor = INTERLEAVEFACTOR;
92*0Sstevel@tonic-gate int i;
93*0Sstevel@tonic-gate int err = PICL_SUCCESS;
94*0Sstevel@tonic-gate
95*0Sstevel@tonic-gate if ((memsegh = alloca(sizeof (picl_nodehdl_t) * TOTAL_MEM_SLOTS)) ==
96*0Sstevel@tonic-gate NULL)
97*0Sstevel@tonic-gate return (PICL_FAILURE);
98*0Sstevel@tonic-gate
99*0Sstevel@tonic-gate for (i = 0; i < TOTAL_MEM_SLOTS; i++) {
100*0Sstevel@tonic-gate /*
101*0Sstevel@tonic-gate * It means no segment for the slot if size is zero
102*0Sstevel@tonic-gate */
103*0Sstevel@tonic-gate if (mmodinfo[i].size == 0) {
104*0Sstevel@tonic-gate memsegh[i] = NULL;
105*0Sstevel@tonic-gate continue;
106*0Sstevel@tonic-gate }
107*0Sstevel@tonic-gate
108*0Sstevel@tonic-gate /*
109*0Sstevel@tonic-gate * Create memory-segment node under memory
110*0Sstevel@tonic-gate */
111*0Sstevel@tonic-gate err = ptree_create_and_add_node(memh, PICL_NAME_MEMORY_SEGMENT,
112*0Sstevel@tonic-gate PICL_CLASS_MEMORY_SEGMENT, &msegh);
113*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
114*0Sstevel@tonic-gate break;
115*0Sstevel@tonic-gate
116*0Sstevel@tonic-gate /*
117*0Sstevel@tonic-gate * For undo easily later
118*0Sstevel@tonic-gate */
119*0Sstevel@tonic-gate memsegh[i] = msegh;
120*0Sstevel@tonic-gate
121*0Sstevel@tonic-gate /*
122*0Sstevel@tonic-gate * Add property, Size to memory-segment node
123*0Sstevel@tonic-gate */
124*0Sstevel@tonic-gate err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION,
125*0Sstevel@tonic-gate PICL_PTYPE_UNSIGNED_INT, PICL_READ,
126*0Sstevel@tonic-gate sizeof (mmodinfo[i].size), PICL_PROP_SIZE, NULL, NULL);
127*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
128*0Sstevel@tonic-gate break;
129*0Sstevel@tonic-gate
130*0Sstevel@tonic-gate err = ptree_create_and_add_prop(msegh, &propinfo,
131*0Sstevel@tonic-gate &mmodinfo[i].size, NULL);
132*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
133*0Sstevel@tonic-gate break;
134*0Sstevel@tonic-gate
135*0Sstevel@tonic-gate /*
136*0Sstevel@tonic-gate * Add property, BaseAddress to memory-segment node
137*0Sstevel@tonic-gate */
138*0Sstevel@tonic-gate err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION,
139*0Sstevel@tonic-gate PICL_PTYPE_UNSIGNED_INT, PICL_READ,
140*0Sstevel@tonic-gate sizeof (mmodinfo[i].base), PICL_PROP_BASEADDRESS, NULL,
141*0Sstevel@tonic-gate NULL);
142*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
143*0Sstevel@tonic-gate break;
144*0Sstevel@tonic-gate
145*0Sstevel@tonic-gate err = ptree_create_and_add_prop(msegh, &propinfo,
146*0Sstevel@tonic-gate &mmodinfo[i].base, NULL);
147*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
148*0Sstevel@tonic-gate break;
149*0Sstevel@tonic-gate
150*0Sstevel@tonic-gate /*
151*0Sstevel@tonic-gate * Add property, InterleaveFactor to memory-segment node
152*0Sstevel@tonic-gate */
153*0Sstevel@tonic-gate err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION,
154*0Sstevel@tonic-gate PICL_PTYPE_UNSIGNED_INT, PICL_READ, sizeof (ifactor),
155*0Sstevel@tonic-gate PICL_PROP_INTERLEAVE_FACTOR, NULL, NULL);
156*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
157*0Sstevel@tonic-gate break;
158*0Sstevel@tonic-gate
159*0Sstevel@tonic-gate err = ptree_create_and_add_prop(msegh, &propinfo, &ifactor,
160*0Sstevel@tonic-gate NULL);
161*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
162*0Sstevel@tonic-gate break;
163*0Sstevel@tonic-gate
164*0Sstevel@tonic-gate /*
165*0Sstevel@tonic-gate * Add reference property to the memory module if memory
166*0Sstevel@tonic-gate * module node handle is not NULL.
167*0Sstevel@tonic-gate */
168*0Sstevel@tonic-gate if (mmodinfo[i].memmodh == NULL)
169*0Sstevel@tonic-gate continue;
170*0Sstevel@tonic-gate
171*0Sstevel@tonic-gate err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION,
172*0Sstevel@tonic-gate PICL_PTYPE_REFERENCE, PICL_READ, sizeof (picl_nodehdl_t),
173*0Sstevel@tonic-gate PICL_REFPROP_MEMORY_MODULE, NULL, NULL);
174*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
175*0Sstevel@tonic-gate break;
176*0Sstevel@tonic-gate
177*0Sstevel@tonic-gate err = ptree_create_and_add_prop(msegh, &propinfo,
178*0Sstevel@tonic-gate &mmodinfo[i].memmodh, NULL);
179*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
180*0Sstevel@tonic-gate break;
181*0Sstevel@tonic-gate }
182*0Sstevel@tonic-gate
183*0Sstevel@tonic-gate if (err != PICL_SUCCESS) {
184*0Sstevel@tonic-gate /*
185*0Sstevel@tonic-gate * Undo in the logical memory tree
186*0Sstevel@tonic-gate */
187*0Sstevel@tonic-gate for (i = 0; i < TOTAL_MEM_SLOTS; i++) {
188*0Sstevel@tonic-gate if (memsegh[i] == NULL)
189*0Sstevel@tonic-gate continue;
190*0Sstevel@tonic-gate
191*0Sstevel@tonic-gate (void) ptree_delete_node(memsegh[i]);
192*0Sstevel@tonic-gate (void) ptree_destroy_node(memsegh[i]);
193*0Sstevel@tonic-gate }
194*0Sstevel@tonic-gate }
195*0Sstevel@tonic-gate
196*0Sstevel@tonic-gate return (err);
197*0Sstevel@tonic-gate }
198*0Sstevel@tonic-gate
199*0Sstevel@tonic-gate /*
200*0Sstevel@tonic-gate * Create physical memory tree
201*0Sstevel@tonic-gate * memory-controller --- memory-module
202*0Sstevel@tonic-gate */
203*0Sstevel@tonic-gate static int
create_physical_tree(picl_nodehdl_t plfh,mmodinfo_t * mmodinfo)204*0Sstevel@tonic-gate create_physical_tree(picl_nodehdl_t plfh, mmodinfo_t *mmodinfo)
205*0Sstevel@tonic-gate {
206*0Sstevel@tonic-gate picl_nodehdl_t mch, memmodh;
207*0Sstevel@tonic-gate ptree_propinfo_t propinfo;
208*0Sstevel@tonic-gate int i;
209*0Sstevel@tonic-gate int err = PICL_SUCCESS;
210*0Sstevel@tonic-gate uint32_t id;
211*0Sstevel@tonic-gate
212*0Sstevel@tonic-gate /*
213*0Sstevel@tonic-gate * Create memory-controller node under platform
214*0Sstevel@tonic-gate */
215*0Sstevel@tonic-gate err = ptree_create_and_add_node(plfh, PICL_NAME_MEMORY_CONTROLLER,
216*0Sstevel@tonic-gate PICL_CLASS_MEMORY_CONTROLLER, &mch);
217*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
218*0Sstevel@tonic-gate return (err);
219*0Sstevel@tonic-gate
220*0Sstevel@tonic-gate /*
221*0Sstevel@tonic-gate * Create memory-module nodes and properties
222*0Sstevel@tonic-gate * Get all memory modules with dimm
223*0Sstevel@tonic-gate */
224*0Sstevel@tonic-gate for (i = 0; i < TOTAL_MEM_SLOTS; i++) {
225*0Sstevel@tonic-gate /*
226*0Sstevel@tonic-gate * It means no dimm on the slot if size is zero
227*0Sstevel@tonic-gate */
228*0Sstevel@tonic-gate if (mmodinfo[i].size == 0)
229*0Sstevel@tonic-gate continue;
230*0Sstevel@tonic-gate
231*0Sstevel@tonic-gate /* Create memory-module node under memory-controller */
232*0Sstevel@tonic-gate err = ptree_create_and_add_node(mch, PICL_NAME_MEMORY_MODULE,
233*0Sstevel@tonic-gate PICL_CLASS_MEMORY_MODULE, &memmodh);
234*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
235*0Sstevel@tonic-gate break;
236*0Sstevel@tonic-gate
237*0Sstevel@tonic-gate /*
238*0Sstevel@tonic-gate * Update memory module node handle at mmodinfo
239*0Sstevel@tonic-gate */
240*0Sstevel@tonic-gate mmodinfo[i].memmodh = memmodh;
241*0Sstevel@tonic-gate
242*0Sstevel@tonic-gate /*
243*0Sstevel@tonic-gate * Add property, Size to memory-module node
244*0Sstevel@tonic-gate */
245*0Sstevel@tonic-gate err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION,
246*0Sstevel@tonic-gate PICL_PTYPE_UNSIGNED_INT, PICL_READ,
247*0Sstevel@tonic-gate sizeof (mmodinfo[i].size), PICL_PROP_SIZE, NULL, NULL);
248*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
249*0Sstevel@tonic-gate break;
250*0Sstevel@tonic-gate
251*0Sstevel@tonic-gate err = ptree_create_and_add_prop(memmodh, &propinfo,
252*0Sstevel@tonic-gate &mmodinfo[i].size, NULL);
253*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
254*0Sstevel@tonic-gate break;
255*0Sstevel@tonic-gate
256*0Sstevel@tonic-gate /*
257*0Sstevel@tonic-gate * Add property, ID to memory-module node
258*0Sstevel@tonic-gate */
259*0Sstevel@tonic-gate err = ptree_init_propinfo(&propinfo, PTREE_PROPINFO_VERSION,
260*0Sstevel@tonic-gate PICL_PTYPE_INT, PICL_READ, sizeof (id), PICL_PROP_ID,
261*0Sstevel@tonic-gate NULL, NULL);
262*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
263*0Sstevel@tonic-gate break;
264*0Sstevel@tonic-gate
265*0Sstevel@tonic-gate id = i;
266*0Sstevel@tonic-gate err = ptree_create_and_add_prop(memmodh, &propinfo, &id, NULL);
267*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
268*0Sstevel@tonic-gate break;
269*0Sstevel@tonic-gate }
270*0Sstevel@tonic-gate
271*0Sstevel@tonic-gate if (err != PICL_SUCCESS) {
272*0Sstevel@tonic-gate /*
273*0Sstevel@tonic-gate * Clear out the saved memory module node handle so that
274*0Sstevel@tonic-gate * logical memory tree won't link to memory module.
275*0Sstevel@tonic-gate */
276*0Sstevel@tonic-gate for (i = 0; i < TOTAL_MEM_SLOTS; i++)
277*0Sstevel@tonic-gate mmodinfo[i].memmodh = NULL;
278*0Sstevel@tonic-gate
279*0Sstevel@tonic-gate /*
280*0Sstevel@tonic-gate * Undo in the physical memory tree
281*0Sstevel@tonic-gate */
282*0Sstevel@tonic-gate (void) ptree_delete_node(mch);
283*0Sstevel@tonic-gate (void) ptree_destroy_node(mch);
284*0Sstevel@tonic-gate }
285*0Sstevel@tonic-gate
286*0Sstevel@tonic-gate return (err);
287*0Sstevel@tonic-gate }
288*0Sstevel@tonic-gate
289*0Sstevel@tonic-gate /*
290*0Sstevel@tonic-gate * Get the memory module and memory segment information from
291*0Sstevel@tonic-gate * property reg of memory node.
292*0Sstevel@tonic-gate *
293*0Sstevel@tonic-gate * mmodinfo will be updated. Also, the pointers to mseginfo and
294*0Sstevel@tonic-gate * the number of segments will be passed to the caller.
295*0Sstevel@tonic-gate */
296*0Sstevel@tonic-gate static int
get_reg_info(picl_nodehdl_t plfh,picl_nodehdl_t memh,mmodinfo_t * mmodinfo)297*0Sstevel@tonic-gate get_reg_info(picl_nodehdl_t plfh, picl_nodehdl_t memh,
298*0Sstevel@tonic-gate mmodinfo_t *mmodinfo)
299*0Sstevel@tonic-gate {
300*0Sstevel@tonic-gate picl_prophdl_t proph;
301*0Sstevel@tonic-gate ptree_propinfo_t pinfo;
302*0Sstevel@tonic-gate regspec_t *memspec;
303*0Sstevel@tonic-gate int i, err;
304*0Sstevel@tonic-gate int pval;
305*0Sstevel@tonic-gate int nregspec;
306*0Sstevel@tonic-gate
307*0Sstevel@tonic-gate
308*0Sstevel@tonic-gate /*
309*0Sstevel@tonic-gate * Check if the #size-cells of the platform node is 2
310*0Sstevel@tonic-gate */
311*0Sstevel@tonic-gate err = ptree_get_propval_by_name(plfh, OBP_PROP_SIZE_CELLS, &pval,
312*0Sstevel@tonic-gate sizeof (pval));
313*0Sstevel@tonic-gate
314*0Sstevel@tonic-gate if (err == PICL_PROPNOTFOUND)
315*0Sstevel@tonic-gate pval = SUPPORTED_NUM_CELL_SIZE;
316*0Sstevel@tonic-gate else if (err != PICL_SUCCESS)
317*0Sstevel@tonic-gate return (err);
318*0Sstevel@tonic-gate
319*0Sstevel@tonic-gate /*
320*0Sstevel@tonic-gate * don't know to handle other vals
321*0Sstevel@tonic-gate */
322*0Sstevel@tonic-gate if (pval != SUPPORTED_NUM_CELL_SIZE)
323*0Sstevel@tonic-gate return (PICL_FAILURE);
324*0Sstevel@tonic-gate
325*0Sstevel@tonic-gate /*
326*0Sstevel@tonic-gate * Get property reg of memory node
327*0Sstevel@tonic-gate */
328*0Sstevel@tonic-gate err = ptree_get_prop_by_name(memh, OBP_REG, &proph);
329*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
330*0Sstevel@tonic-gate return (err);
331*0Sstevel@tonic-gate
332*0Sstevel@tonic-gate err = ptree_get_propinfo(proph, &pinfo);
333*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
334*0Sstevel@tonic-gate return (err);
335*0Sstevel@tonic-gate
336*0Sstevel@tonic-gate if ((memspec = alloca(pinfo.piclinfo.size)) == NULL)
337*0Sstevel@tonic-gate return (PICL_FAILURE);
338*0Sstevel@tonic-gate
339*0Sstevel@tonic-gate nregspec = pinfo.piclinfo.size / sizeof (*memspec);
340*0Sstevel@tonic-gate
341*0Sstevel@tonic-gate if ((nregspec == 0) || (nregspec > TOTAL_MEM_SLOTS))
342*0Sstevel@tonic-gate return (PICL_FAILURE);
343*0Sstevel@tonic-gate
344*0Sstevel@tonic-gate err = ptree_get_propval(proph, memspec, pinfo.piclinfo.size);
345*0Sstevel@tonic-gate if (err != PICL_SUCCESS)
346*0Sstevel@tonic-gate return (err);
347*0Sstevel@tonic-gate
348*0Sstevel@tonic-gate
349*0Sstevel@tonic-gate for (i = 0; i < nregspec; i++) {
350*0Sstevel@tonic-gate
351*0Sstevel@tonic-gate mmodinfo[i].base = memspec[i].physaddr;
352*0Sstevel@tonic-gate mmodinfo[i].size = memspec[i].size;
353*0Sstevel@tonic-gate
354*0Sstevel@tonic-gate }
355*0Sstevel@tonic-gate
356*0Sstevel@tonic-gate return (PICL_SUCCESS);
357*0Sstevel@tonic-gate }
358*0Sstevel@tonic-gate
359*0Sstevel@tonic-gate /*
360*0Sstevel@tonic-gate * executed as part of .init when the plugin is dlopen()ed
361*0Sstevel@tonic-gate */
362*0Sstevel@tonic-gate static void
piclmemcfg_register(void)363*0Sstevel@tonic-gate piclmemcfg_register(void)
364*0Sstevel@tonic-gate {
365*0Sstevel@tonic-gate (void) picld_plugin_register(&my_reg_info);
366*0Sstevel@tonic-gate }
367*0Sstevel@tonic-gate
368*0Sstevel@tonic-gate /*
369*0Sstevel@tonic-gate * Init entry point of the plugin
370*0Sstevel@tonic-gate * Creates the PICL nodes and properties in the physical and logical aspects.
371*0Sstevel@tonic-gate */
372*0Sstevel@tonic-gate static void
piclmemcfg_init(void)373*0Sstevel@tonic-gate piclmemcfg_init(void)
374*0Sstevel@tonic-gate {
375*0Sstevel@tonic-gate picl_nodehdl_t plfh, memh;
376*0Sstevel@tonic-gate mmodinfo_t mmodinfo[TOTAL_MEM_SLOTS];
377*0Sstevel@tonic-gate
378*0Sstevel@tonic-gate /*
379*0Sstevel@tonic-gate * Get platform node
380*0Sstevel@tonic-gate */
381*0Sstevel@tonic-gate if ((ptree_get_node_by_path(PLATFORM_PATH, &plfh)) != PICL_SUCCESS) {
382*0Sstevel@tonic-gate syslog(LOG_ERR, EM_INIT_FAILED);
383*0Sstevel@tonic-gate return;
384*0Sstevel@tonic-gate }
385*0Sstevel@tonic-gate
386*0Sstevel@tonic-gate /*
387*0Sstevel@tonic-gate * Find the memory node
388*0Sstevel@tonic-gate */
389*0Sstevel@tonic-gate if ((ptree_get_node_by_path(MEMORY_PATH, &memh)) != PICL_SUCCESS) {
390*0Sstevel@tonic-gate syslog(LOG_ERR, EM_INIT_FAILED);
391*0Sstevel@tonic-gate return;
392*0Sstevel@tonic-gate }
393*0Sstevel@tonic-gate
394*0Sstevel@tonic-gate /*
395*0Sstevel@tonic-gate * Initialize the mmodinfo and get segment information from reg
396*0Sstevel@tonic-gate */
397*0Sstevel@tonic-gate (void) memset(mmodinfo, 0, sizeof (mmodinfo));
398*0Sstevel@tonic-gate
399*0Sstevel@tonic-gate if ((get_reg_info(plfh, memh, mmodinfo)) != PICL_SUCCESS) {
400*0Sstevel@tonic-gate syslog(LOG_ERR, EM_INIT_FAILED);
401*0Sstevel@tonic-gate return;
402*0Sstevel@tonic-gate }
403*0Sstevel@tonic-gate
404*0Sstevel@tonic-gate /*
405*0Sstevel@tonic-gate * Create subtree of memory-controller in the physical aspect.
406*0Sstevel@tonic-gate * memory-controller --- memory-module
407*0Sstevel@tonic-gate */
408*0Sstevel@tonic-gate if ((create_physical_tree(plfh, mmodinfo)) != PICL_SUCCESS)
409*0Sstevel@tonic-gate syslog(LOG_ERR, EM_PHYSIC_MEM_TREE_FAILED);
410*0Sstevel@tonic-gate
411*0Sstevel@tonic-gate /*
412*0Sstevel@tonic-gate * Create subtree of memory in the logical aspect.
413*0Sstevel@tonic-gate * memory --- memory-segment
414*0Sstevel@tonic-gate */
415*0Sstevel@tonic-gate if ((create_logical_tree(memh, mmodinfo)) != PICL_SUCCESS)
416*0Sstevel@tonic-gate syslog(LOG_ERR, EM_LOGIC_MEM_TREE_FAILED);
417*0Sstevel@tonic-gate }
418*0Sstevel@tonic-gate
419*0Sstevel@tonic-gate /*
420*0Sstevel@tonic-gate * fini entry point of the plugin
421*0Sstevel@tonic-gate */
422*0Sstevel@tonic-gate static void
piclmemcfg_fini(void)423*0Sstevel@tonic-gate piclmemcfg_fini(void)
424*0Sstevel@tonic-gate {
425*0Sstevel@tonic-gate }
426