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 (c) 2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 
31 #include <fcode/private.h>
32 #include <fcode/log.h>
33 
34 void
create_prop(fcode_env_t * env,char * name)35 create_prop(fcode_env_t *env, char *name)
36 {
37 	push_a_string(env, name);
38 	property(env);
39 }
40 
41 void
create_int_prop(fcode_env_t * env,char * name,int val)42 create_int_prop(fcode_env_t *env, char *name, int val)
43 {
44 	PUSH(DS, val);
45 	encode_int(env);
46 	create_prop(env, name);
47 }
48 
49 void
create_string_prop(fcode_env_t * env,char * name,char * val)50 create_string_prop(fcode_env_t *env, char *name, char *val)
51 {
52 	push_a_string(env, val);
53 	encode_string(env);
54 	create_prop(env, name);
55 }
56 
57 static int
addr_cmp(void * a,void * b)58 addr_cmp(void *a, void *b)
59 {
60 	return ((uchar_t *)a == (uchar_t *)b);
61 }
62 
63 static void *
add_property_buffer(fcode_env_t * env,int len)64 add_property_buffer(fcode_env_t *env, int len)
65 {
66 	void *data = MALLOC(len+1);
67 	return (add_resource(&env->propbufs, data, addr_cmp));
68 }
69 
70 static void
free_property_buffer(fcode_env_t * env,void * buffer)71 free_property_buffer(fcode_env_t *env, void *buffer)
72 {
73 	free_resource(&env->propbufs, buffer, addr_cmp);
74 	FREE(buffer);
75 }
76 
77 /*
78  * Golden Rule:
79  * DO NOT cache the value of the head of the property list *before*
80  * looking up a property.
81  * This routine is also responsible for purging dead properties
82  * and that *can* affect the head pointer.
83  * you have been warned!
84  */
85 prop_t *
find_property(device_t * d,char * name)86 find_property(device_t *d, char *name)
87 {
88 	prop_t *p = d->properties, *prev;
89 	prop_t *found = NULL;
90 
91 	prev = NULL;
92 	while (p && !found) {
93 		if (p->name) {
94 			if (strcmp(name, p->name) == 0) {
95 				found = p;
96 			}
97 			prev = p;
98 			p = p->next;
99 		} else {
100 			prop_t *dead;
101 
102 			if (prev)
103 				prev->next = p->next;
104 			else {
105 				/* last prop in chain */
106 				d->properties = p->next;
107 			}
108 			dead = p;
109 			p = p->next;
110 			FREE(dead->name);
111 			FREE(dead->data);
112 			FREE(dead);
113 		}
114 	}
115 	return (found);
116 }
117 
118 static prop_t *
stack_find_property(fcode_env_t * env,device_t * d)119 stack_find_property(fcode_env_t *env, device_t *d)
120 {
121 	char *propname;
122 
123 	propname = pop_a_string(env, NULL);
124 	return (find_property(d, propname));
125 }
126 
127 void
property(fcode_env_t * env)128 property(fcode_env_t *env)
129 {
130 	int datalen;
131 	char *propname, *srcptr;
132 	prop_t *p;
133 	device_t *d;
134 
135 	CHECK_DEPTH(env, 4, "property");
136 	if (MYSELF) {
137 		d = MYSELF->device;
138 	} else {
139 		d = env->current_device;
140 		if (!d) {
141 			void *buffer;
142 
143 			two_drop(env);
144 			if ((buffer = pop_a_string(env, NULL)) != NULL)
145 				free_property_buffer(env, buffer);
146 			return;
147 		}
148 	}
149 	propname = pop_a_string(env, NULL);
150 	p = find_property(d, propname);
151 	if (p == NULL) {
152 		p = MALLOC(sizeof (prop_t));
153 		p->next = d->properties;
154 		d->properties = p;
155 		p->name = STRDUP(propname);
156 	} else if (p->data)
157 		FREE(p->data);	/* release old resources */
158 	srcptr = pop_a_string(env, &datalen);
159 	p->data = MALLOC(datalen+1);
160 	p->size = datalen;
161 	memcpy(p->data, srcptr, datalen);
162 	p->data[datalen] = 0;
163 	if (srcptr)
164 		free_property_buffer(env, srcptr);
165 }
166 
167 prop_t *
lookup_package_property(fcode_env_t * env,char * propname,device_t * d)168 lookup_package_property(fcode_env_t *env, char *propname, device_t *d)
169 {
170 	prop_t *p;
171 
172 	p = find_property(d, propname);
173 	if (p) {
174 		return (p);
175 	}
176 	if (d->vectors.get_package_prop) {
177 		static prop_t sp;
178 		fstack_t fail, n;
179 
180 		/* recreate the FORTH environment for the remote call */
181 		push_a_string(env, propname);
182 		REVERT_PHANDLE(env, n, d);
183 		PUSH(DS, n);
184 		d->vectors.get_package_prop(env);
185 		fail = POP(DS);
186 		if (fail)
187 			return (NULL);
188 		sp.size = POP(DS);
189 		sp.data = (uchar_t *)POP(DS);
190 		sp.name = propname;
191 		sp.next = NULL;
192 		return (&sp);
193 	}
194 	return (NULL);
195 }
196 
197 void
get_package_property(fcode_env_t * env)198 get_package_property(fcode_env_t *env)
199 {
200 	prop_t *p;
201 	device_t *d;
202 	char *propname;
203 
204 	CHECK_DEPTH(env, 3, "get-package-property");
205 	CONVERT_PHANDLE(env, d, POP(DS));
206 	propname = pop_a_string(env, NULL);
207 	p = lookup_package_property(env, propname, d);
208 	if (p) {
209 		PUSH(DS, (fstack_t)p->data);
210 		PUSH(DS, p->size);
211 		PUSH(DS, FALSE);
212 	} else
213 		PUSH(DS, TRUE);
214 }
215 
216 void
get_inherited_prop(fcode_env_t * env)217 get_inherited_prop(fcode_env_t *env)
218 {
219 	instance_t *ih;
220 	device_t *dev;
221 	prop_t *prop;
222 	char *pname;
223 	int plen;
224 
225 	/*
226 	 * First, we look thru the in-memory device tree for the property.
227 	 * If we don't find it, we call get_inherited_prop, which "knows" it's
228 	 * not going to find the property below the attachment point.
229 	 */
230 
231 	CHECK_DEPTH(env, 2, "get-inherited-property");
232 	pname = pop_a_string(env, &plen);
233 	ih = MYSELF;
234 	if (ih) {
235 		for (; ih; ih = ih->parent) {
236 			dev = ih->device;
237 			prop = find_property(dev, pname);
238 			if (prop) {
239 				PUSH(DS, (fstack_t)prop->data);
240 				PUSH(DS, (fstack_t)prop->size);
241 				PUSH(DS, FALSE);
242 				return;
243 			}
244 		}
245 		if (dev->vectors.get_inherited_prop) {
246 			push_a_string(env, pname);
247 			dev->vectors.get_inherited_prop(env);
248 			return;
249 		}
250 	}
251 	PUSH(DS, TRUE);
252 }
253 
254 void
delete_property(fcode_env_t * env)255 delete_property(fcode_env_t *env)
256 {
257 	CHECK_DEPTH(env, 2, "delete-property");
258 	if (MYSELF) {
259 		prop_t *p;
260 
261 		p = stack_find_property(env, MYSELF->device);
262 		if (p) {
263 			/*
264 			 * write the name as NULL; the space will be free'd
265 			 * the next time a property lookup passes this node
266 			 */
267 			p->name = NULL;
268 		}
269 	} else {
270 		two_drop(env);
271 	}
272 }
273 
274 void
get_my_property(fcode_env_t * env)275 get_my_property(fcode_env_t *env)
276 {
277 	CHECK_DEPTH(env, 2, "get-my-property");
278 	PUSH(DS, (fstack_t)MYSELF);
279 	ihandle_to_phandle(env);
280 	get_package_property(env);
281 }
282 
283 void
encode_string(fcode_env_t * env)284 encode_string(fcode_env_t *env)
285 {
286 	char *str;
287 	char *prop;
288 	int len;
289 
290 	CHECK_DEPTH(env, 2, "encode-string");
291 	str = pop_a_string(env, &len);
292 
293 	prop = add_property_buffer(env, len);
294 	memcpy(prop, str, len);
295 	prop[len] = 0;
296 	PUSH(DS, (fstack_t)prop);
297 	PUSH(DS, len + 1);
298 }
299 
300 void
encode_int(fcode_env_t * env)301 encode_int(fcode_env_t *env)
302 {
303 	uchar_t *ptr;
304 	uint32_t p;
305 
306 	CHECK_DEPTH(env, 1, "encode-int");
307 	p = POP(DS);
308 	ptr = add_property_buffer(env, sizeof (uint32_t));
309 
310 	memcpy(ptr, (char *)&p, sizeof (uint32_t));
311 	PUSH(DS, (fstack_t)ptr);
312 	PUSH(DS, sizeof (uint32_t));
313 }
314 
315 void
encode_phys(fcode_env_t * env)316 encode_phys(fcode_env_t *env)
317 {
318 	uint_t ncells;
319 
320 	ncells = get_number_of_parent_address_cells(env);
321 	CHECK_DEPTH(env, ncells, "encode-phys");
322 	encode_int(env);
323 	while (--ncells) {
324 		rot(env);
325 		encode_int(env);
326 		encode_plus(env);
327 	}
328 }
329 
330 static fstack_t
get_decoded_int(uchar_t * dp)331 get_decoded_int(uchar_t *dp)
332 {
333 	uint32_t d;
334 
335 	memcpy((char *)&d, dp, sizeof (uint32_t));
336 	return (d);
337 }
338 
339 int
get_default_intprop(fcode_env_t * env,char * name,device_t * d,int def)340 get_default_intprop(fcode_env_t *env, char *name, device_t *d, int def)
341 {
342 	prop_t *p;
343 
344 	if (!d)		/* Kludge for testing */
345 		return (def);
346 	p = lookup_package_property(env, name, d);
347 	if (p == NULL)
348 		return (def);
349 	return (get_decoded_int(p->data));
350 }
351 
352 int
get_num_addr_cells(fcode_env_t * env,device_t * d)353 get_num_addr_cells(fcode_env_t *env, device_t *d)
354 {
355 	return (get_default_intprop(env, "#address-cells", d, 2));
356 }
357 
358 int
get_num_size_cells(fcode_env_t * env,device_t * d)359 get_num_size_cells(fcode_env_t *env, device_t *d)
360 {
361 	return (get_default_intprop(env, "#size-cells", d, 1));
362 }
363 
364 void
decode_phys(fcode_env_t * env)365 decode_phys(fcode_env_t *env)
366 {
367 	char *ptr;
368 	int len;
369 	int adr_cells;
370 	int offset;
371 
372 	CHECK_DEPTH(env, 2, "decode-phys");
373 	ptr = pop_a_string(env, &len);
374 
375 	adr_cells = get_num_addr_cells(env, env->current_device->parent);
376 
377 	offset = sizeof (uint32_t) * adr_cells;
378 
379 	PUSH(DS, (fstack_t)(ptr + offset));
380 	PUSH(DS, len + offset);
381 
382 	while (adr_cells--) {
383 		fstack_t d;
384 		offset -= sizeof (uint32_t);
385 		d = get_decoded_int((uchar_t *)(ptr + offset));
386 		PUSH(DS, d);
387 	}
388 }
389 
390 /*
391  * 'reg' Fcode 0x116
392  */
393 void
reg_prop(fcode_env_t * env)394 reg_prop(fcode_env_t *env)
395 {
396 	fstack_t size;
397 
398 	CHECK_DEPTH(env, 1, "reg");
399 	size = POP(DS);
400 	encode_phys(env);
401 	PUSH(DS, size);
402 	encode_int(env);
403 	encode_plus(env);
404 	create_prop(env, "reg");
405 }
406 
407 void
encode_bytes(fcode_env_t * env)408 encode_bytes(fcode_env_t *env)
409 {
410 	char *str;
411 	char *prop;
412 	int len;
413 
414 	CHECK_DEPTH(env, 2, "encode-bytes");
415 	str = pop_a_string(env, &len);
416 	prop = add_property_buffer(env, len);
417 	memcpy(prop, str, len);
418 	prop[len] = 0;
419 	PUSH(DS, (fstack_t)prop);
420 	PUSH(DS, len);
421 }
422 
423 void
decode_int(fcode_env_t * env)424 decode_int(fcode_env_t *env)
425 {
426 	char *dp;
427 	fstack_t d;
428 	int len;
429 
430 	CHECK_DEPTH(env, 2, "decode-int");
431 	dp = pop_a_string(env, &len);
432 	PUSH(DS, (fstack_t)(dp + sizeof (uint32_t)));
433 	PUSH(DS, len - sizeof (uint32_t));
434 	d = get_decoded_int((uchar_t *)dp);
435 	PUSH(DS, d);
436 }
437 
438 void
decode_string(fcode_env_t * env)439 decode_string(fcode_env_t *env)
440 {
441 	int plen, len;
442 	char *dp;
443 
444 	CHECK_DEPTH(env, 2, "decode-string");
445 	dp = pop_a_string(env, &plen);
446 	len = strlen(dp) + 1;
447 	PUSH(DS, (fstack_t)(dp + len));
448 	PUSH(DS, plen - len);
449 	PUSH(DS, (fstack_t)dp);
450 	PUSH(DS, len - 1);
451 }
452 
453 void
encode_plus(fcode_env_t * env)454 encode_plus(fcode_env_t *env)
455 {
456 	int len1, len2;
457 	char *src1, *src2;
458 	uchar_t *new;
459 
460 	CHECK_DEPTH(env, 4, "encode+");
461 	src1 = pop_a_string(env, &len1);
462 	src2 = pop_a_string(env, &len2);
463 	new = add_property_buffer(env, len1 + len2);
464 	if (src2) {
465 		memcpy(new, src2, len2);
466 		free_property_buffer(env, src2);
467 	}
468 	if (src1) {
469 		memcpy(new + len2, src1, len1);
470 		free_property_buffer(env, src1);
471 	}
472 	PUSH(DS, (fstack_t)new);
473 	PUSH(DS, len1 + len2);
474 }
475 
476 static void
make_special_property(fcode_env_t * env,char * name)477 make_special_property(fcode_env_t *env, char *name)
478 {
479 	push_a_string(env, name);
480 	property(env);
481 }
482 
483 void
device_name(fcode_env_t * env)484 device_name(fcode_env_t *env)
485 {
486 	CHECK_DEPTH(env, 2, "device-name");
487 	encode_string(env);
488 	make_special_property(env, "name");
489 }
490 
491 void
model_prop(fcode_env_t * env)492 model_prop(fcode_env_t *env)
493 {
494 	CHECK_DEPTH(env, 2, "model");
495 	encode_string(env);
496 	make_special_property(env, "model");
497 }
498 
499 void
device_type(fcode_env_t * env)500 device_type(fcode_env_t *env)
501 {
502 	CHECK_DEPTH(env, 2, "device-type");
503 	encode_string(env);
504 	make_special_property(env, "device_type");
505 }
506 
507 /*
508  * 'next-property' Fcode implementation.
509  */
510 void
next_property(fcode_env_t * env)511 next_property(fcode_env_t *env)
512 {
513 	device_t *phandle;
514 	char *previous;
515 	prop_t *p;
516 
517 	CHECK_DEPTH(env, 3, "next-property");
518 	phandle = (device_t *)POP(DS);
519 	previous = pop_a_string(env, NULL);
520 	p = phandle->properties;
521 	if (previous == NULL)
522 		p = phandle->properties;
523 	else if (p = find_property(phandle, previous))
524 		p = p->next;
525 
526 	for (; p != NULL && p->name == NULL; p = p->next)
527 		;
528 
529 	if (p)
530 		push_a_string(env, p->name);
531 	else
532 		push_a_string(env, "");
533 	PUSH(DS, TRUE);
534 }
535 
536 void
get_property(fcode_env_t * env)537 get_property(fcode_env_t *env)
538 {
539 	if (MYSELF)
540 		get_my_property(env);
541 	else if (env->current_device) {
542 		fstack_t d;
543 
544 		REVERT_PHANDLE(env, d, env->current_device);
545 		PUSH(DS, d);
546 		get_package_property(env);
547 	} else {
548 		two_drop(env);
549 		log_message(MSG_WARN, "No device context\n");
550 	}
551 }
552 
553 #ifdef DEBUG
554 
555 static void
print_indented(char * name)556 print_indented(char *name)
557 {
558 	log_message(MSG_INFO, "%-28s", name);
559 }
560 
561 static void
print_string(fcode_env_t * env,uchar_t * data,int len)562 print_string(fcode_env_t *env, uchar_t *data, int len)
563 {
564 	while (len > 0) {
565 		int nlen = (strlen((char *)data)+1);
566 		log_message(MSG_INFO, "%s\n", data);
567 		len -= nlen;
568 		data += nlen;
569 		if (len > 0)
570 			print_indented("");
571 	}
572 }
573 
574 static void
print_ints(uchar_t * data,int len,int crlf)575 print_ints(uchar_t *data, int len, int crlf)
576 {
577 	uint32_t d;
578 
579 	while (len--) {
580 		d = get_decoded_int(data);
581 		log_message(MSG_INFO, "%8.8lx ", d);
582 		data += sizeof (uint32_t);
583 	}
584 	if (crlf)
585 		log_message(MSG_INFO, "\n");
586 }
587 
588 static void
print_integer(fcode_env_t * env,uchar_t * data,int len)589 print_integer(fcode_env_t *env, uchar_t *data, int len)
590 {
591 	print_ints(data, len/sizeof (uint32_t), 1);
592 }
593 
594 static void
print_bytes(fcode_env_t * env,uchar_t * data,int len)595 print_bytes(fcode_env_t *env, uchar_t *data, int len)
596 {
597 	while (len--) {
598 		log_message(MSG_INFO, "%2.2x ", *data++);
599 	}
600 	log_message(MSG_INFO, "\n");
601 }
602 
603 static void
print_bytes_indented(fcode_env_t * env,uchar_t * data,int len)604 print_bytes_indented(fcode_env_t *env, uchar_t *data, int len)
605 {
606 	int nbytes;
607 
608 	for (; ; ) {
609 		nbytes = min(len, 16);
610 		print_bytes(env, data, nbytes);
611 		len -= nbytes;
612 		data += nbytes;
613 		if (len == 0)
614 			break;
615 		print_indented("");
616 	}
617 }
618 
619 static void
print_reg(fcode_env_t * env,uchar_t * data,int len)620 print_reg(fcode_env_t *env, uchar_t *data, int len)
621 {
622 	int pcells, nlen;
623 
624 	if (env->current_device != NULL &&
625 	    env->current_device->parent != NULL) {
626 		pcells = get_num_size_cells(env, env->current_device->parent);
627 		pcells +=  get_num_addr_cells(env, env->current_device->parent);
628 		nlen = pcells*sizeof (uint32_t);
629 		while (len > 0) {
630 			print_ints(data, pcells, 1);
631 			len -= nlen;
632 			data += nlen;
633 			if (len > 0)
634 				print_indented("");
635 		}
636 	} else
637 		print_bytes_indented(env, data, len);
638 }
639 
640 static void
print_imap(fcode_env_t * env,uchar_t * dp,int len)641 print_imap(fcode_env_t *env, uchar_t *dp, int len)
642 {
643 	int n, icells;
644 
645 	if (env->current_device == NULL) {
646 		print_bytes_indented(env, dp, len);
647 		return;
648 	}
649 	n = get_num_addr_cells(env, env->current_device);
650 
651 	while (len) {
652 		int offset;
653 		fstack_t data;
654 		device_t *node;
655 
656 		offset = 0;
657 		data = get_decoded_int(dp+((n+1)*sizeof (uint32_t)));
658 		CONVERT_PHANDLE(env, node, data);
659 		offset += (n+2)*sizeof (uint32_t);
660 		print_ints(dp, (n+2), 0);
661 		icells = get_default_intprop(env, "#interrupt-cells", node, 1);
662 		print_ints(dp+offset, icells, 1);
663 		offset += icells*sizeof (uint32_t);
664 		dp += offset;
665 		len -= offset;
666 		if (len)
667 			print_indented("");
668 	}
669 }
670 
671 static void
print_ranges(fcode_env_t * env,uchar_t * data,int len)672 print_ranges(fcode_env_t *env, uchar_t *data, int len)
673 {
674 	int pcells, nlen;
675 
676 	if (env->current_device != NULL &&
677 	    env->current_device->parent != NULL) {
678 		pcells = get_num_addr_cells(env, env->current_device);
679 		pcells += get_num_addr_cells(env, env->current_device->parent);
680 		pcells += get_num_size_cells(env, env->current_device);
681 		nlen = pcells*sizeof (uint32_t);
682 		while (len > 0) {
683 			print_ints(data, pcells, 1);
684 			len -= nlen;
685 			data += nlen;
686 			if (len > 0)
687 				print_indented("");
688 		}
689 	} else
690 		print_bytes_indented(env, data, len);
691 }
692 
693 typedef struct MAGIC_PROP {
694 	char *name;
695 	void (*fn)(fcode_env_t *env, uchar_t *data, int len);
696 } magic_prop_t;
697 
698 static magic_prop_t magic_props[] = {
699 	{ "name",		print_string },
700 	{ "device_type",	print_string },
701 	{ "model",		print_string },
702 	{ "reg",		print_reg },
703 	{ "assigned-addresses",	print_reg },
704 	{ "interrupt-map",	print_imap },
705 	{ "#interrupt-cells",	print_integer },
706 	{ "interrupt-map-mask",	print_integer },
707 	{ "#size-cells",	print_integer },
708 	{ "#address-cells",	print_integer },
709 	{ "ranges",		print_ranges },
710 	{ "device-id",		print_integer },
711 	{ "vendor-id",		print_integer },
712 	{ "class-code",		print_integer },
713 	{ "compatible",		print_string },
714 	{ "version",		print_string },
715 	{ "manufacturer",	print_string },
716 	{ NULL, NULL }
717 };
718 
719 static void
print_content(fcode_env_t * env,char * prop,uchar_t * data,int len)720 print_content(fcode_env_t *env, char *prop, uchar_t *data, int len)
721 {
722 	magic_prop_t *p;
723 
724 	for (p = magic_props; p->name; p++)
725 		if (strcmp(prop, p->name) == 0) {
726 			(*p->fn)(env, data, len);
727 			return;
728 		}
729 	print_bytes_indented(env, data, len);
730 }
731 
732 void
print_property(fcode_env_t * env,prop_t * p,char * prepend)733 print_property(fcode_env_t *env, prop_t *p, char *prepend)
734 {
735 	char buf[40];
736 	char *name = (p->name ? p->name : "<noname>");
737 
738 	if (prepend) {
739 		(void) snprintf(buf, sizeof (buf), "%s %s", prepend, name);
740 		name = buf;
741 	}
742 	print_indented(name);
743 	if (p->name)
744 		print_content(env, p->name, p->data, p->size);
745 	else
746 		print_bytes_indented(env, p->data, p->size);
747 }
748 
749 void
dot_properties(fcode_env_t * env)750 dot_properties(fcode_env_t *env)
751 {
752 	prop_t *p;
753 	instance_t *omyself;
754 
755 	omyself = MYSELF;
756 	MYSELF = NULL;
757 
758 	if (env->current_device) {
759 		for (p = env->current_device->properties; p; p = p->next)
760 			print_property(env, p, NULL);
761 	} else {
762 		log_message(MSG_INFO, "No device context\n");
763 	}
764 	MYSELF = omyself;
765 }
766 
767 #endif
768 
769 #pragma init(_init)
770 
771 static void
_init(void)772 _init(void)
773 {
774 	fcode_env_t *env = initial_env;
775 
776 	ASSERT(env);
777 	NOTICE;
778 
779 	P1275(0x110, 0,		"property",		property);
780 	P1275(0x111, 0,		"encode-int",		encode_int);
781 	P1275(0x112, 0,		"encode+",		encode_plus);
782 	P1275(0x113, 0,		"encode-phys",		encode_phys);
783 	P1275(0x114, 0,		"encode-string",	encode_string);
784 	P1275(0x115, 0,		"encode-bytes",		encode_bytes);
785 	P1275(0x116, 0,		"reg",			reg_prop);
786 	FCODE(0x117, 0,		"intr",			fc_obsolete);
787 	FCODE(0x118, 0,		"driver",		fc_historical);
788 	P1275(0x119, 0,		"model",		model_prop);
789 	P1275(0x11a, 0,		"device-type",		device_type);
790 
791 	P1275(0x128, 0,		"decode-phys",		decode_phys);
792 
793 	P1275(0x201, 0,		"device-name",		device_name);
794 
795 	P1275(0x21a, 0,		"get-my-property",	get_my_property);
796 	P1275(0x21b, 0,		"decode-int",		decode_int);
797 	P1275(0x21c, 0,		"decode-string",	decode_string);
798 	P1275(0x21d, 0,		"get-inherited-property", get_inherited_prop);
799 	P1275(0x21e, 0,		"delete-property",	delete_property);
800 	P1275(0x21f, 0,		"get-package-property",	get_package_property);
801 
802 	P1275(0x23d, 0,		"next-property",	next_property);
803 
804 	FORTH(0,		"get-property",		get_property);
805 	FORTH(0,		".properties",		dot_properties);
806 }
807