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