1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_MC_US3_H
#define _SYS_MC_US3_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_KERNEL)
#define NBANKS 4
#define NDGRPS 2
#define NDIMMS 4
#define MAX_DEVLEN 8
#define TRANSFER_SIZE 64
#ifndef _ASM
struct mc_soft_state {
dev_info_t *dip; /* dev info of myself */
int portid;
int size;
void *memlayoutp;
volatile uchar_t *mc_base; /* Mapped base address of MC registers */
};
struct dimm_info {
char label[NDGRPS * NDIMMS][MAX_DEVLEN]; /* dimm label */
char sym_flag; /* 1: symmetric 0: asymmetric */
char data[1];
};
typedef char dimm_sid_t[DIMM_SERIAL_ID_LEN];
struct pin_info {
uchar_t dimmtable[144];
uchar_t pintable[576];
};
/* This struct is included at the following structs to set up list */
typedef struct mc_dlist {
struct mc_dlist *next;
struct mc_dlist *prev;
int id;
} mc_dlist_t;
/* unique segment id */
struct seg_info {
mc_dlist_t seg_node;
int nbanks; /* The number of banks at this segment */
uint32_t ifactor; /* Max interleave factor at this segment */
uint64_t base;
uint64_t size; /* memory size per segment */
struct bank_info *hb_inseg; /* first bank at this segment */
struct bank_info *tb_inseg; /* last bank at this segment */
};
/* id = mc_id * nbanks + bank_no */
struct bank_info {
mc_dlist_t bank_node;
int local_id; /* unique local bank id per segment */
int seg_id; /* unique segment id */
int devgrp_id; /* unique device group id */
ushort_t valid; /* valid flag per logic bank */
ushort_t uk; /* Upper Mask field to mask match 4 PA[37:26] */
uint_t um; /* Upper Match field to match PA[42:26] */
uchar_t lk; /* Lower Mask field to mask match 4 PA[9:6] */
uchar_t lm; /* Lower Match field to match PA[9:6] */
uchar_t pos; /* front=0, back=1 */
uint64_t size; /* memory size per logical bank */
struct bank_info *n_inseg; /* next bank at the same segment */
struct bank_info *p_inseg; /* previous bank at the same segment */
struct dimm_info *dimminfop;
dimm_sid_t *dimmsidp[NDIMMS];
};
/* id = mc_id * ndevgrps + devgrp_no */
struct dgrp_info {
mc_dlist_t dgrp_node;
int ndevices; /* The number of available devices on this dev group */
uint64_t size; /* memory size per physical dimm group */
int deviceids[NDIMMS]; /* 4 dimms per group on excalibur */
};
/* id = id of dgrp_info * ndevices + device_no */
struct device_info {
mc_dlist_t dev_node;
char label[MAX_DEVLEN];
uint64_t size; /* memory size per physical dimm */
};
/* id = portid */
struct mctrl_info {
mc_dlist_t mctrl_node;
int ndevgrps; /* The number of dimm groups */
int devgrpids[NDGRPS];
};
typedef struct dimm_sid_cache {
int mcid; /* mc portid */
int seg_id; /* segment these DIMMs are in */
int state; /* state of cache for this mc */
dimm_sid_t *sids; /* ptr to array of serial ids */
} dimm_sid_cache_t;
/* values for the state field of a dimm_sid_cache_t */
#define MC_DIMM_SIDS_INVALID 0
#define MC_DIMM_SIDS_REQUESTED 1
#define MC_DIMM_SIDS_AVAILABLE 2
extern int (*p2get_mem_unum)(int, uint64_t, char *, int, int *);
extern int (*p2get_mem_info)(int, uint64_t, uint64_t *, uint64_t *,
uint64_t *, int *, int *, int *);
extern int (*p2get_mem_offset)(uint64_t, uint64_t *);
extern int (*p2get_mem_addr)(int, char *, uint64_t, uint64_t *);
extern int (*p2get_mem_sid)(int, int, char *, int, int *);
extern int (*p2init_sid_cache)(void);
extern void plat_add_mem_unum_label(char *, int, int, int);
extern dimm_sid_cache_t *plat_alloc_sid_cache(int *);
extern int plat_populate_sid_cache(dimm_sid_cache_t *, int);
uint64_t get_mcr(int);
#ifdef DEBUG
#include <sys/promif.h>
/* useful debugging level of DPRINTF */
#define MC_ATTACH_DEBUG 0x00000001
#define MC_DETACH_DEBUG 0x00000002
#define MC_CMD_DEBUG 0x00000004
#define MC_REG_DEBUG 0x00000008
#define MC_GUNUM_DEBUG 0x00000010
#define MC_CNSTRC_DEBUG 0x00000020
#define MC_DESTRC_DEBUG 0x00000040
#define MC_LIST_DEBUG 0x00000080
static uint_t mc_debug = 0;
#define _PRINTF prom_printf
#define DPRINTF(flag, args) if (mc_debug & flag) _PRINTF args;
#else
#define DPRINTF(flag, args)
#endif /* DEBUG */
#endif /* !_ASM */
/* Memory Address Decoding Registers */
#define ASI_MCU_CTRL 0x72
#define REGOFFSET 8
#define MADR0OFFSET 0x10
/* Mask and shift constants for Memory Address Decoding */
#define MADR_UPA_MASK 0x7fffc000000LL /* 17 bits */
#define MADR_LPA_MASK 0x000000003c0LL /* 4 bits */
#define MADR_LK_MASK 0x0000003c000LL /* 4 bits */
#define MADR_UPA_SHIFT 26
#define MADR_LPA_SHIFT 6
#define MADR_LK_SHIFT 14
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MC_US3_H */
|