xref: /titanic_50/usr/src/psm/stand/lib/names/sparc/common/mfgname.c (revision fa9e4066f08beec538e775443c5be79dd423fcab)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <sys/param.h>
30 #include <sys/promif.h>
31 
32 #include <sys/platnames.h>
33 
34 #define	MAXNMLEN	80		/* # of chars in an impl-arch name */
35 
36 /*
37  * Return the manufacturer name for this platform.
38  *
39  * This is exported (solely) as the rootnode name property in
40  * the kernel's devinfo tree via the 'mfg-name' boot property.
41  * So it's only used by boot, not the boot blocks.
42  */
43 char *
get_mfg_name(void)44 get_mfg_name(void)
45 {
46 	pnode_t n;
47 	int len;
48 
49 	static char mfgname[MAXNMLEN];
50 
51 	if ((n = prom_rootnode()) != OBP_NONODE &&
52 	    (len = prom_getproplen(n, OBP_NAME)) > 0 && len < MAXNMLEN) {
53 		(void) prom_getprop(n, OBP_NAME, mfgname);
54 		mfgname[len] = '\0'; /* broken clones don't terminate name */
55 		return (mfgname);
56 	}
57 
58 	return ("Unknown");
59 }
60