mcamd_misc.c (7aec1d6e) mcamd_misc.c (8a40a695)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
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.
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance 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.

--- 8 unchanged lines hidden (view full) ---

24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28#include <sys/types.h>
29
30#include <mcamd_api.h>
31
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.

--- 8 unchanged lines hidden (view full) ---

23 */
24
25#pragma ident "%Z%%M% %I% %E% SMI"
26
27#include <sys/types.h>
28
29#include <mcamd_api.h>
30
32static const char *const _mcamd_proplist[] = {
33 MCAMD_PROPSTR_NUM,
34 MCAMD_PROPSTR_BASE_ADDR,
35 MCAMD_PROPSTR_LIM_ADDR,
36 MCAMD_PROPSTR_MASK,
37 MCAMD_PROPSTR_DRAM_ILEN,
38 MCAMD_PROPSTR_DRAM_ILSEL,
39 MCAMD_PROPSTR_DRAM_HOLE,
40 MCAMD_PROPSTR_DRAM_CONFIG,
41 MCAMD_PROPSTR_ACCESS_WIDTH,
42 MCAMD_PROPSTR_LODIMM,
43 MCAMD_PROPSTR_UPDIMM,
44 MCAMD_PROPSTR_CSBANKMAP,
45 MCAMD_PROPSTR_SIZE,
46 MCAMD_PROPSTR_CSBANK_INTLV,
47 MCAMD_PROPSTR_CS0,
48 MCAMD_PROPSTR_CS1,
49 MCAMD_PROPSTR_CS2,
50 MCAMD_PROPSTR_CS3,
51 MCAMD_PROPSTR_REV,
52 MCAMD_PROPSTR_DISABLED_CS,
31static 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 },
53};
54
66};
67
55static const int _mcamd_nprop = sizeof (_mcamd_proplist) /
56 sizeof (_mcamd_proplist[0]);
68static const int _nprop = sizeof (_propstrings) /
69 sizeof (struct mcproptostr);
57
58const char *
70
71const char *
59mcamd_get_propname(uint_t code)
72mcamd_get_propname(mcamd_propcode_t code)
60{
73{
61 if (code < _mcamd_nprop)
62 return (_mcamd_proplist[code]);
63 else
64 return (NULL);
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);
65}
82}