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.
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.
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]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <fcode/private.h>
33 #include <fcode/log.h>
35 #include <fcdriver/fcdriver.h>
38 * claim under /openprom/client-services is used by schizo and oberon Fcode, we
39 * call "claim-memory" service.
42 claim(fcode_env_t
*env
)
50 CHECK_DEPTH(env
, 3, "claim-memory");
51 hint
= (void *)POP(DS
);
54 error
= fc_run_priv(env
->private, "claim-memory", 3, 1,
55 fc_int2cell(align
), fc_size2cell(size
), fc_ptr2cell(hint
), &vaddr
);
57 throw_from_fclib(env
, 1, "client-services/claim failed\n");
58 vaddr
= mapping_to_mcookie(vaddr
, size
, NULL
, NULL
);
59 PUSH(DS
, (fstack_t
)vaddr
);
63 release(fcode_env_t
*env
)
69 CHECK_DEPTH(env
, 2, "release-memory");
70 addr
= (void *)POP(DS
);
72 error
= fc_run_priv(env
->private, "release-memory", 2, 0,
73 fc_size2cell(size
), fc_ptr2cell(addr
));
75 throw_from_fclib(env
, 1, "client-services/release failed\n");
76 delete_mapping((fstack_t
)addr
);
80 fc_vtop(fcode_env_t
*env
)
83 fc_cell_t physlo
, physhi
;
86 CHECK_DEPTH(env
, 1, "vtop");
87 vaddr
= (void *)POP(DS
);
88 error
= fc_run_priv(env
->private, "vtop", 1, 2,
89 fc_ptr2cell(vaddr
), &physlo
, &physhi
);
91 throw_from_fclib(env
, 1, "fc_vtop: '>physical' failed\n");
98 install_openprom_nodes(fcode_env_t
*env
)
100 MYSELF
= open_instance_chain(env
, env
->root_node
, 0);
101 if (MYSELF
!= NULL
) {
102 make_a_node(env
, "openprom", 0);
103 make_a_node(env
, "client-services", 0);
104 FORTH(0, "claim", claim
);
105 FORTH(0, "release", release
);
108 close_instance_chain(env
, MYSELF
, 0);
119 fcode_env_t
*env
= initial_env
;
124 FORTH(0, "install-openprom-nodes", install_openprom_nodes
);
125 FORTH(0, "claim", claim
);
126 FORTH(0, "release", release
);
127 P1275(0x106, 0, ">physical", fc_vtop
);