xref: /titanic_51/usr/src/common/mc/mc-amd/mcamd_misc.c (revision 1e49577a7fcde812700ded04431b49d67cc57d6d)
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  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
22  * Use is subject to license terms.
23  */
24 
25 #pragma ident	"%Z%%M%	%I%	%E% SMI"
26 
27 #include <sys/types.h>
28 
29 #include <mcamd_api.h>
30 
31 static struct mcproptostr {
32 	mcamd_propcode_t code;
33 	const char *name;
34 } _propstrings[] = {
35 	/*
36 	 * Common codes
37 	 */
38 	{ MCAMD_PROP_NUM, MCAMD_PROPSTR_NUM },
39 	{ MCAMD_PROP_SIZE, MCAMD_PROPSTR_SIZE },
40 	{ MCAMD_PROP_BASE_ADDR, MCAMD_PROPSTR_BASE_ADDR },
41 	/*
42 	 * Memory controller properties
43 	 */
44 	{ MCAMD_PROP_REV, MCAMD_PROPSTR_REV },
45 	{ MCAMD_PROP_LIM_ADDR, MCAMD_PROPSTR_LIM_ADDR },
46 	{ MCAMD_PROP_ILEN, MCAMD_PROPSTR_ILEN },
47 	{ MCAMD_PROP_ILSEL, MCAMD_PROPSTR_ILSEL },
48 	{ MCAMD_PROP_CSINTLVFCTR, MCAMD_PROPSTR_CSINTLVFCTR },
49 	{ MCAMD_PROP_ACCESS_WIDTH, MCAMD_PROPSTR_ACCESS_WIDTH },
50 	{ MCAMD_PROP_CSBANKMAPREG, MCAMD_PROPSTR_CSBANKMAPREG },
51 	{ MCAMD_PROP_BANKSWZL, MCAMD_PROPSTR_BANKSWZL },
52 	{ MCAMD_PROP_DRAMHOLE_SIZE, MCAMD_PROPSTR_DRAMHOLE_SIZE },
53 	{ MCAMD_PROP_MOD64MUX, MCAMD_PROPSTR_MOD64MUX },
54 	{ MCAMD_PROP_SPARECS, MCAMD_PROPSTR_SPARECS },
55 	{ MCAMD_PROP_BADCS, MCAMD_PROPSTR_BADCS },
56 	/*
57 	 * Chip-select properties
58 	 */
59 	{ MCAMD_PROP_MASK, MCAMD_PROPSTR_MASK },
60 	{ MCAMD_PROP_CSBE, MCAMD_PROPSTR_CSBE },
61 	{ MCAMD_PROP_SPARE, MCAMD_PROPSTR_SPARE },
62 	{ MCAMD_PROP_TESTFAIL, MCAMD_PROPSTR_TESTFAIL },
63 	{ MCAMD_PROP_CSDIMM1, MCAMD_PROPSTR_CSDIMM1 },
64 	{ MCAMD_PROP_CSDIMM2, MCAMD_PROPSTR_CSDIMM2 },
65 	{ MCAMD_PROP_DIMMRANK, MCAMD_PROPSTR_DIMMRANK },
66 };
67 
68 static const int _nprop = sizeof (_propstrings) /
69     sizeof (struct mcproptostr);
70 
71 const char *
72 mcamd_get_propname(mcamd_propcode_t code)
73 {
74 	int i;
75 
76 	for (i = 0; i < _nprop; i++) {
77 		if (_propstrings[i].code == code)
78 			return (_propstrings[i].name);
79 	}
80 
81 	return (NULL);
82 }
83