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 #include <sys/types.h>
26
27 #include <mcamd_api.h>
28
29 static struct mcproptostr {
30 mcamd_propcode_t code;
31 const char *name;
32 } _propstrings[] = {
33 /*
34 * Common codes
35 */
36 { MCAMD_PROP_NUM, MCAMD_PROPSTR_NUM },
37 { MCAMD_PROP_SIZE, MCAMD_PROPSTR_SIZE },
38 { MCAMD_PROP_BASE_ADDR, MCAMD_PROPSTR_BASE_ADDR },
39 /*
40 * Memory controller properties
41 */
42 { MCAMD_PROP_REV, MCAMD_PROPSTR_REV },
43 { MCAMD_PROP_LIM_ADDR, MCAMD_PROPSTR_LIM_ADDR },
44 { MCAMD_PROP_ILEN, MCAMD_PROPSTR_ILEN },
45 { MCAMD_PROP_ILSEL, MCAMD_PROPSTR_ILSEL },
46 { MCAMD_PROP_CSINTLVFCTR, MCAMD_PROPSTR_CSINTLVFCTR },
47 { MCAMD_PROP_ACCESS_WIDTH, MCAMD_PROPSTR_ACCESS_WIDTH },
48 { MCAMD_PROP_CSBANKMAPREG, MCAMD_PROPSTR_CSBANKMAPREG },
49 { MCAMD_PROP_BANKSWZL, MCAMD_PROPSTR_BANKSWZL },
50 { MCAMD_PROP_DRAMHOLE_SIZE, MCAMD_PROPSTR_DRAMHOLE_SIZE },
51 { MCAMD_PROP_MOD64MUX, MCAMD_PROPSTR_MOD64MUX },
52 { MCAMD_PROP_SPARECS, MCAMD_PROPSTR_SPARECS },
53 { MCAMD_PROP_BADCS, MCAMD_PROPSTR_BADCS },
54 /*
55 * Chip-select properties
56 */
57 { MCAMD_PROP_MASK, MCAMD_PROPSTR_MASK },
58 { MCAMD_PROP_CSBE, MCAMD_PROPSTR_CSBE },
59 { MCAMD_PROP_SPARE, MCAMD_PROPSTR_SPARE },
60 { MCAMD_PROP_TESTFAIL, MCAMD_PROPSTR_TESTFAIL },
61 { MCAMD_PROP_CSDIMM1, MCAMD_PROPSTR_CSDIMM1 },
62 { MCAMD_PROP_CSDIMM2, MCAMD_PROPSTR_CSDIMM2 },
63 { MCAMD_PROP_DIMMRANK, MCAMD_PROPSTR_DIMMRANK },
64 };
65
66 static const int _nprop = sizeof (_propstrings) /
67 sizeof (struct mcproptostr);
68
69 const char *
mcamd_get_propname(mcamd_propcode_t code)70 mcamd_get_propname(mcamd_propcode_t code)
71 {
72 int i;
73
74 for (i = 0; i < _nprop; i++) {
75 if (_propstrings[i].code == code)
76 return (_propstrings[i].name);
77 }
78
79 return (NULL);
80 }
81