xref: /onnv-gate/usr/src/uts/intel/io/intel_nhm/mem_addr.h (revision 10650:5195e7d7a5f4)
1*10650SVuong.Nguyen@Sun.COM /*
2*10650SVuong.Nguyen@Sun.COM  * CDDL HEADER START
3*10650SVuong.Nguyen@Sun.COM  *
4*10650SVuong.Nguyen@Sun.COM  * The contents of this file are subject to the terms of the
5*10650SVuong.Nguyen@Sun.COM  * Common Development and Distribution License (the "License").
6*10650SVuong.Nguyen@Sun.COM  * You may not use this file except in compliance with the License.
7*10650SVuong.Nguyen@Sun.COM  *
8*10650SVuong.Nguyen@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*10650SVuong.Nguyen@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*10650SVuong.Nguyen@Sun.COM  * See the License for the specific language governing permissions
11*10650SVuong.Nguyen@Sun.COM  * and limitations under the License.
12*10650SVuong.Nguyen@Sun.COM  *
13*10650SVuong.Nguyen@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*10650SVuong.Nguyen@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*10650SVuong.Nguyen@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*10650SVuong.Nguyen@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*10650SVuong.Nguyen@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*10650SVuong.Nguyen@Sun.COM  *
19*10650SVuong.Nguyen@Sun.COM  * CDDL HEADER END
20*10650SVuong.Nguyen@Sun.COM  */
21*10650SVuong.Nguyen@Sun.COM 
22*10650SVuong.Nguyen@Sun.COM /*
23*10650SVuong.Nguyen@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*10650SVuong.Nguyen@Sun.COM  * Use is subject to license terms.
25*10650SVuong.Nguyen@Sun.COM  */
26*10650SVuong.Nguyen@Sun.COM 
27*10650SVuong.Nguyen@Sun.COM #ifndef _MEM_ADDR_H
28*10650SVuong.Nguyen@Sun.COM #define	_MEM_ADDR_H
29*10650SVuong.Nguyen@Sun.COM 
30*10650SVuong.Nguyen@Sun.COM #ifdef __cplusplus
31*10650SVuong.Nguyen@Sun.COM extern "C" {
32*10650SVuong.Nguyen@Sun.COM #endif
33*10650SVuong.Nguyen@Sun.COM 
34*10650SVuong.Nguyen@Sun.COM #include "intel_nhm.h"
35*10650SVuong.Nguyen@Sun.COM 
36*10650SVuong.Nguyen@Sun.COM #ifdef	_KERNEL
37*10650SVuong.Nguyen@Sun.COM 
38*10650SVuong.Nguyen@Sun.COM extern uint64_t rankaddr_to_dimm(uint64_t rankaddr, int node,
39*10650SVuong.Nguyen@Sun.COM     int channel, int dimm, int writing, uint64_t *bank,
40*10650SVuong.Nguyen@Sun.COM     uint64_t *row, uint64_t *column);
41*10650SVuong.Nguyen@Sun.COM extern uint64_t dimm_to_rankaddr(int node, int channel,
42*10650SVuong.Nguyen@Sun.COM     int dimm, uint64_t rowaddr, uint64_t bankaddr,
43*10650SVuong.Nguyen@Sun.COM     uint64_t coladr, int *log_chan);
44*10650SVuong.Nguyen@Sun.COM extern uint64_t rankaddr_to_phyaddr(int node, int log_chan,
45*10650SVuong.Nguyen@Sun.COM     int dimm, int rank, int rankaddr);
46*10650SVuong.Nguyen@Sun.COM extern uint64_t caddr_to_dimm(int node, int channel, uint64_t caddr,
47*10650SVuong.Nguyen@Sun.COM     int *rank_p, uint64_t *rank_addr_p);
48*10650SVuong.Nguyen@Sun.COM 
49*10650SVuong.Nguyen@Sun.COM #pragma weak caddr_to_dimm
50*10650SVuong.Nguyen@Sun.COM #pragma weak rankaddr_to_dimm
51*10650SVuong.Nguyen@Sun.COM #pragma weak dimm_to_rankaddr
52*10650SVuong.Nguyen@Sun.COM #pragma weak rankaddr_to_phyaddr
53*10650SVuong.Nguyen@Sun.COM 
54*10650SVuong.Nguyen@Sun.COM extern char closed_page;
55*10650SVuong.Nguyen@Sun.COM extern char ecc_enabled;
56*10650SVuong.Nguyen@Sun.COM extern char divby3_enabled;
57*10650SVuong.Nguyen@Sun.COM extern char lockstep[2];
58*10650SVuong.Nguyen@Sun.COM extern char mirror_mode[2];
59*10650SVuong.Nguyen@Sun.COM extern char spare_channel[2];
60*10650SVuong.Nguyen@Sun.COM extern sad_t sad[MAX_SAD_DRAM_RULE];
61*10650SVuong.Nguyen@Sun.COM extern tad_t tad[MAX_CPU_NODES][MAX_TAD_DRAM_RULE];
62*10650SVuong.Nguyen@Sun.COM extern sag_ch_t sag_ch[MAX_CPU_NODES][CHANNELS_PER_MEMORY_CONTROLLER]
63*10650SVuong.Nguyen@Sun.COM 	[MAX_TAD_DRAM_RULE];
64*10650SVuong.Nguyen@Sun.COM extern rir_t rir[MAX_CPU_NODES][CHANNELS_PER_MEMORY_CONTROLLER]
65*10650SVuong.Nguyen@Sun.COM 	[MAX_TAD_DRAM_RULE];
66*10650SVuong.Nguyen@Sun.COM extern dod_t dod_reg[MAX_CPU_NODES][CHANNELS_PER_MEMORY_CONTROLLER]
67*10650SVuong.Nguyen@Sun.COM 	[MAX_DIMMS_PER_CHANNEL];
68*10650SVuong.Nguyen@Sun.COM 
69*10650SVuong.Nguyen@Sun.COM #endif	/* _KERNEL */
70*10650SVuong.Nguyen@Sun.COM 
71*10650SVuong.Nguyen@Sun.COM #define	CAS_MASK	0xFFFFFF
72*10650SVuong.Nguyen@Sun.COM #define	BANK_MASK	0xFF
73*10650SVuong.Nguyen@Sun.COM #define	RAS_MASK	0xFFFFF
74*10650SVuong.Nguyen@Sun.COM #define	RANK_MASK	0x7FF
75*10650SVuong.Nguyen@Sun.COM 
76*10650SVuong.Nguyen@Sun.COM #ifdef __cplusplus
77*10650SVuong.Nguyen@Sun.COM }
78*10650SVuong.Nguyen@Sun.COM #endif
79*10650SVuong.Nguyen@Sun.COM 
80*10650SVuong.Nguyen@Sun.COM #endif /* _MEM_ADDR_H */
81