xref: /titanic_44/usr/src/uts/sun4u/sys/plat_ecc_dimm.h (revision d00f0155af9a9a671eb08a0dc30f5ea0a379c36c)
1*d00f0155Sayznaga /*
2*d00f0155Sayznaga  * CDDL HEADER START
3*d00f0155Sayznaga  *
4*d00f0155Sayznaga  * The contents of this file are subject to the terms of the
5*d00f0155Sayznaga  * Common Development and Distribution License, Version 1.0 only
6*d00f0155Sayznaga  * (the "License").  You may not use this file except in compliance
7*d00f0155Sayznaga  * with the License.
8*d00f0155Sayznaga  *
9*d00f0155Sayznaga  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*d00f0155Sayznaga  * or http://www.opensolaris.org/os/licensing.
11*d00f0155Sayznaga  * See the License for the specific language governing permissions
12*d00f0155Sayznaga  * and limitations under the License.
13*d00f0155Sayznaga  *
14*d00f0155Sayznaga  * When distributing Covered Code, include this CDDL HEADER in each
15*d00f0155Sayznaga  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*d00f0155Sayznaga  * If applicable, add the following below this CDDL HEADER, with the
17*d00f0155Sayznaga  * fields enclosed by brackets "[]" replaced with your own identifying
18*d00f0155Sayznaga  * information: Portions Copyright [yyyy] [name of copyright owner]
19*d00f0155Sayznaga  *
20*d00f0155Sayznaga  * CDDL HEADER END
21*d00f0155Sayznaga  */
22*d00f0155Sayznaga /*
23*d00f0155Sayznaga  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*d00f0155Sayznaga  * Use is subject to license terms.
25*d00f0155Sayznaga  */
26*d00f0155Sayznaga 
27*d00f0155Sayznaga #ifndef	_SYS_PLAT_ECC_DIMM_H
28*d00f0155Sayznaga #define	_SYS_PLAT_ECC_DIMM_H
29*d00f0155Sayznaga 
30*d00f0155Sayznaga #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*d00f0155Sayznaga 
32*d00f0155Sayznaga #ifdef	__cplusplus
33*d00f0155Sayznaga extern "C" {
34*d00f0155Sayznaga #endif
35*d00f0155Sayznaga 
36*d00f0155Sayznaga #include <sys/int_types.h>
37*d00f0155Sayznaga #include <sys/cheetahregs.h>
38*d00f0155Sayznaga #include <sys/cpuvar.h>
39*d00f0155Sayznaga #include <sys/dditypes.h>
40*d00f0155Sayznaga #include <sys/ddipropdefs.h>
41*d00f0155Sayznaga #include <sys/ddi_impldefs.h>
42*d00f0155Sayznaga #include <sys/sunddi.h>
43*d00f0155Sayznaga #include <sys/platform_module.h>
44*d00f0155Sayznaga #include <sys/errno.h>
45*d00f0155Sayznaga #include <sys/conf.h>
46*d00f0155Sayznaga #include <sys/cmn_err.h>
47*d00f0155Sayznaga #include <sys/sysmacros.h>
48*d00f0155Sayznaga #include <sys/mc-us3.h>
49*d00f0155Sayznaga #include <sys/plat_ecc_unum.h>
50*d00f0155Sayznaga 
51*d00f0155Sayznaga /*
52*d00f0155Sayznaga  * DIMM Serial Ids support for Starcat and Serengeti platforms
53*d00f0155Sayznaga  */
54*d00f0155Sayznaga 
55*d00f0155Sayznaga #define	PLAT_MAX_DIMM_SID_LEN		16
56*d00f0155Sayznaga #define	PLAT_MAX_DIMMS_PER_BOARD	32
57*d00f0155Sayznaga 
58*d00f0155Sayznaga typedef char plat_dimm_sid_t[PLAT_MAX_DIMM_SID_LEN];
59*d00f0155Sayznaga 
60*d00f0155Sayznaga typedef struct plat_dimm_sid_request_data {
61*d00f0155Sayznaga 	plat_ecc_msg_hdr_t	pdsrd_header;
62*d00f0155Sayznaga 	uint8_t			pdsrd_board_num;  /* bd# of SIDs requested */
63*d00f0155Sayznaga } plat_dimm_sid_request_data_t;
64*d00f0155Sayznaga 
65*d00f0155Sayznaga #define	pdsrd_major_version	pdsrd_header.emh_major_ver
66*d00f0155Sayznaga #define	pdsrd_minor_version	pdsrd_header.emh_minor_ver
67*d00f0155Sayznaga #define	pdsrd_msg_type		pdsrd_header.emh_msg_type
68*d00f0155Sayznaga #define	pdsrd_msg_length	pdsrd_header.emh_msg_length
69*d00f0155Sayznaga 
70*d00f0155Sayznaga typedef struct plat_dimm_sid_board_data {
71*d00f0155Sayznaga 	plat_ecc_msg_hdr_t	pdsbd_header;
72*d00f0155Sayznaga 	uint32_t		pdsbd_errno;	/* set if SC failed request */
73*d00f0155Sayznaga 	uint8_t			pdsbd_board_num; /* bd where SIDs are located */
74*d00f0155Sayznaga 	uint8_t			pdsbd_pad1;
75*d00f0155Sayznaga 	uint16_t		pdsbd_pad2;
76*d00f0155Sayznaga 	uint32_t		pdsbd_valid_bitmap; /* map of SIDs returned */
77*d00f0155Sayznaga 	plat_dimm_sid_t		pdsbd_dimm_sids[PLAT_MAX_DIMMS_PER_BOARD];
78*d00f0155Sayznaga } plat_dimm_sid_board_data_t;
79*d00f0155Sayznaga 
80*d00f0155Sayznaga #define	pdsbd_major_version	pdsbd_header.emh_major_ver
81*d00f0155Sayznaga #define	pdsbd_minor_version	pdsbd_header.emh_minor_ver
82*d00f0155Sayznaga #define	pdsbd_msg_type		pdsbd_header.emh_msg_type
83*d00f0155Sayznaga #define	pdsbd_msg_length	pdsbd_header.emh_msg_length
84*d00f0155Sayznaga 
85*d00f0155Sayznaga #define	PLAT_ECC_DIMM_SID_VERSION_MAJOR	1
86*d00f0155Sayznaga #define	PLAT_ECC_DIMM_SID_VERSION_MINOR	1
87*d00f0155Sayznaga 
88*d00f0155Sayznaga #define	PDSB_STATE_INVALID		0x0
89*d00f0155Sayznaga #define	PDSB_STATE_STORE_IN_PROGRESS	0x1
90*d00f0155Sayznaga #define	PDSB_STATE_STORED		0x2
91*d00f0155Sayznaga #define	PDSB_STATE_FAILED_TO_STORE	0x3
92*d00f0155Sayznaga 
93*d00f0155Sayznaga /* DIMM serial id data for one board */
94*d00f0155Sayznaga typedef struct plat_dimm_sid_board {
95*d00f0155Sayznaga 	kmutex_t	pdsb_lock;		/* protect data for this bd */
96*d00f0155Sayznaga 	uint8_t		pdsb_state;		/* current state of data */
97*d00f0155Sayznaga 	uint32_t	pdsb_valid_bitmap;	/* map of valid SIDs */
98*d00f0155Sayznaga 	plat_dimm_sid_t	pdsb_dimm_sids[PLAT_MAX_DIMMS_PER_BOARD]; /* SIDs */
99*d00f0155Sayznaga } plat_dimm_sid_board_t;
100*d00f0155Sayznaga 
101*d00f0155Sayznaga extern int plat_request_mem_sids(int boardnum);
102*d00f0155Sayznaga extern int plat_store_mem_sids(plat_dimm_sid_board_data_t *data);
103*d00f0155Sayznaga extern int plat_discard_mem_sids(int boardnum);
104*d00f0155Sayznaga 
105*d00f0155Sayznaga extern plat_dimm_sid_board_t	domain_dimm_sids[];
106*d00f0155Sayznaga 
107*d00f0155Sayznaga #ifdef	__cplusplus
108*d00f0155Sayznaga }
109*d00f0155Sayznaga #endif
110*d00f0155Sayznaga 
111*d00f0155Sayznaga #endif	/* _SYS_PLAT_ECC_DIMM_H */
112