17aec1d6eScindi /*
27aec1d6eScindi * CDDL HEADER START
37aec1d6eScindi *
47aec1d6eScindi * The contents of this file are subject to the terms of the
5*8a40a695Sgavinm * Common Development and Distribution License (the "License").
6*8a40a695Sgavinm * You may not use this file except in compliance with the License.
77aec1d6eScindi *
87aec1d6eScindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97aec1d6eScindi * or http://www.opensolaris.org/os/licensing.
107aec1d6eScindi * See the License for the specific language governing permissions
117aec1d6eScindi * and limitations under the License.
127aec1d6eScindi *
137aec1d6eScindi * When distributing Covered Code, include this CDDL HEADER in each
147aec1d6eScindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157aec1d6eScindi * If applicable, add the following below this CDDL HEADER, with the
167aec1d6eScindi * fields enclosed by brackets "[]" replaced with your own identifying
177aec1d6eScindi * information: Portions Copyright [yyyy] [name of copyright owner]
187aec1d6eScindi *
197aec1d6eScindi * CDDL HEADER END
207aec1d6eScindi *
217aec1d6eScindi * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
227aec1d6eScindi * Use is subject to license terms.
237aec1d6eScindi */
247aec1d6eScindi
257aec1d6eScindi #pragma ident "%Z%%M% %I% %E% SMI"
267aec1d6eScindi
277aec1d6eScindi #include <sys/types.h>
287aec1d6eScindi
297aec1d6eScindi #include <mcamd_api.h>
307aec1d6eScindi
31*8a40a695Sgavinm static struct mcproptostr {
32*8a40a695Sgavinm mcamd_propcode_t code;
33*8a40a695Sgavinm const char *name;
34*8a40a695Sgavinm } _propstrings[] = {
35*8a40a695Sgavinm /*
36*8a40a695Sgavinm * Common codes
37*8a40a695Sgavinm */
38*8a40a695Sgavinm { MCAMD_PROP_NUM, MCAMD_PROPSTR_NUM },
39*8a40a695Sgavinm { MCAMD_PROP_SIZE, MCAMD_PROPSTR_SIZE },
40*8a40a695Sgavinm { MCAMD_PROP_BASE_ADDR, MCAMD_PROPSTR_BASE_ADDR },
41*8a40a695Sgavinm /*
42*8a40a695Sgavinm * Memory controller properties
43*8a40a695Sgavinm */
44*8a40a695Sgavinm { MCAMD_PROP_REV, MCAMD_PROPSTR_REV },
45*8a40a695Sgavinm { MCAMD_PROP_LIM_ADDR, MCAMD_PROPSTR_LIM_ADDR },
46*8a40a695Sgavinm { MCAMD_PROP_ILEN, MCAMD_PROPSTR_ILEN },
47*8a40a695Sgavinm { MCAMD_PROP_ILSEL, MCAMD_PROPSTR_ILSEL },
48*8a40a695Sgavinm { MCAMD_PROP_CSINTLVFCTR, MCAMD_PROPSTR_CSINTLVFCTR },
49*8a40a695Sgavinm { MCAMD_PROP_ACCESS_WIDTH, MCAMD_PROPSTR_ACCESS_WIDTH },
50*8a40a695Sgavinm { MCAMD_PROP_CSBANKMAPREG, MCAMD_PROPSTR_CSBANKMAPREG },
51*8a40a695Sgavinm { MCAMD_PROP_BANKSWZL, MCAMD_PROPSTR_BANKSWZL },
52*8a40a695Sgavinm { MCAMD_PROP_DRAMHOLE_SIZE, MCAMD_PROPSTR_DRAMHOLE_SIZE },
53*8a40a695Sgavinm { MCAMD_PROP_MOD64MUX, MCAMD_PROPSTR_MOD64MUX },
54*8a40a695Sgavinm { MCAMD_PROP_SPARECS, MCAMD_PROPSTR_SPARECS },
55*8a40a695Sgavinm { MCAMD_PROP_BADCS, MCAMD_PROPSTR_BADCS },
56*8a40a695Sgavinm /*
57*8a40a695Sgavinm * Chip-select properties
58*8a40a695Sgavinm */
59*8a40a695Sgavinm { MCAMD_PROP_MASK, MCAMD_PROPSTR_MASK },
60*8a40a695Sgavinm { MCAMD_PROP_CSBE, MCAMD_PROPSTR_CSBE },
61*8a40a695Sgavinm { MCAMD_PROP_SPARE, MCAMD_PROPSTR_SPARE },
62*8a40a695Sgavinm { MCAMD_PROP_TESTFAIL, MCAMD_PROPSTR_TESTFAIL },
63*8a40a695Sgavinm { MCAMD_PROP_CSDIMM1, MCAMD_PROPSTR_CSDIMM1 },
64*8a40a695Sgavinm { MCAMD_PROP_CSDIMM2, MCAMD_PROPSTR_CSDIMM2 },
65*8a40a695Sgavinm { MCAMD_PROP_DIMMRANK, MCAMD_PROPSTR_DIMMRANK },
667aec1d6eScindi };
677aec1d6eScindi
68*8a40a695Sgavinm static const int _nprop = sizeof (_propstrings) /
69*8a40a695Sgavinm sizeof (struct mcproptostr);
707aec1d6eScindi
717aec1d6eScindi const char *
mcamd_get_propname(mcamd_propcode_t code)72*8a40a695Sgavinm mcamd_get_propname(mcamd_propcode_t code)
737aec1d6eScindi {
74*8a40a695Sgavinm int i;
75*8a40a695Sgavinm
76*8a40a695Sgavinm for (i = 0; i < _nprop; i++) {
77*8a40a695Sgavinm if (_propstrings[i].code == code)
78*8a40a695Sgavinm return (_propstrings[i].name);
79*8a40a695Sgavinm }
80*8a40a695Sgavinm
817aec1d6eScindi return (NULL);
827aec1d6eScindi }
83