xref: /onnv-gate/usr/src/cmd/fm/modules/sun4v/generic-mem/gmem_page.h (revision 8346:ecea0dd9d4ce)
1*8346SScott.Davenport@Sun.COM /*
2*8346SScott.Davenport@Sun.COM  * CDDL HEADER START
3*8346SScott.Davenport@Sun.COM  *
4*8346SScott.Davenport@Sun.COM  * The contents of this file are subject to the terms of the
5*8346SScott.Davenport@Sun.COM  * Common Development and Distribution License (the "License").
6*8346SScott.Davenport@Sun.COM  * You may not use this file except in compliance with the License.
7*8346SScott.Davenport@Sun.COM  *
8*8346SScott.Davenport@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*8346SScott.Davenport@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*8346SScott.Davenport@Sun.COM  * See the License for the specific language governing permissions
11*8346SScott.Davenport@Sun.COM  * and limitations under the License.
12*8346SScott.Davenport@Sun.COM  *
13*8346SScott.Davenport@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*8346SScott.Davenport@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*8346SScott.Davenport@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*8346SScott.Davenport@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*8346SScott.Davenport@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*8346SScott.Davenport@Sun.COM  *
19*8346SScott.Davenport@Sun.COM  * CDDL HEADER END
20*8346SScott.Davenport@Sun.COM  */
21*8346SScott.Davenport@Sun.COM /*
22*8346SScott.Davenport@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*8346SScott.Davenport@Sun.COM  * Use is subject to license terms.
24*8346SScott.Davenport@Sun.COM  */
25*8346SScott.Davenport@Sun.COM 
26*8346SScott.Davenport@Sun.COM #ifndef _GMEM_PAGE_H
27*8346SScott.Davenport@Sun.COM #define	_GMEM_PAGE_H
28*8346SScott.Davenport@Sun.COM 
29*8346SScott.Davenport@Sun.COM 
30*8346SScott.Davenport@Sun.COM /*
31*8346SScott.Davenport@Sun.COM  * Routines for the creation of page retirement faults and for the management of
32*8346SScott.Davenport@Sun.COM  * page-related state.
33*8346SScott.Davenport@Sun.COM  */
34*8346SScott.Davenport@Sun.COM 
35*8346SScott.Davenport@Sun.COM #include <gmem_state.h>
36*8346SScott.Davenport@Sun.COM #include <gmem_fmri.h>
37*8346SScott.Davenport@Sun.COM 
38*8346SScott.Davenport@Sun.COM #include <fm/fmd_api.h>
39*8346SScott.Davenport@Sun.COM #include <sys/types.h>
40*8346SScott.Davenport@Sun.COM 
41*8346SScott.Davenport@Sun.COM #ifdef __cplusplus
42*8346SScott.Davenport@Sun.COM extern "C" {
43*8346SScott.Davenport@Sun.COM #endif
44*8346SScott.Davenport@Sun.COM 
45*8346SScott.Davenport@Sun.COM #define	PAGE_MKVERSION(version)	(version)
46*8346SScott.Davenport@Sun.COM 
47*8346SScott.Davenport@Sun.COM #define	CMD_PAGE_VERSION_0	PAGE_MKVERSION(0)
48*8346SScott.Davenport@Sun.COM #define	CMD_PAGE_VERSION	CMD_PAGE_VERSION_0
49*8346SScott.Davenport@Sun.COM 
50*8346SScott.Davenport@Sun.COM #define	CMD_PAGE_VERSIONED(page)	((page)->page_version)
51*8346SScott.Davenport@Sun.COM 
52*8346SScott.Davenport@Sun.COM typedef struct gmem_page_pers {
53*8346SScott.Davenport@Sun.COM 	gmem_header_t pagep_header;	/* Nodetype must be CMD_NT_PAGE */
54*8346SScott.Davenport@Sun.COM 	uint_t pagep_version;
55*8346SScott.Davenport@Sun.COM 	gmem_fmri_t pagep_asru;		/* ASRU for this DIMM */
56*8346SScott.Davenport@Sun.COM 	uint64_t pagep_physbase;	/* base phys addr for page */
57*8346SScott.Davenport@Sun.COM 	uint64_t pagep_offset;		/* page offset */
58*8346SScott.Davenport@Sun.COM 	uint_t pagep_flags;		/* CMD_MEM_F_* */
59*8346SScott.Davenport@Sun.COM } gmem_page_pers_t;
60*8346SScott.Davenport@Sun.COM 
61*8346SScott.Davenport@Sun.COM typedef struct gmem_page {
62*8346SScott.Davenport@Sun.COM 	gmem_page_pers_t page_pers;
63*8346SScott.Davenport@Sun.COM 	gmem_case_t page_case;		/* Open CE case against this page */
64*8346SScott.Davenport@Sun.COM } gmem_page_t;
65*8346SScott.Davenport@Sun.COM 
66*8346SScott.Davenport@Sun.COM #define	CMD_PAGE_MAXSIZE sizeof (gmem_page_pers_t)
67*8346SScott.Davenport@Sun.COM #define	CMD_PAGE_MINSIZE sizeof (gmem_page_pers_t)
68*8346SScott.Davenport@Sun.COM 
69*8346SScott.Davenport@Sun.COM #define	page_header		page_pers.pagep_header
70*8346SScott.Davenport@Sun.COM #define	page_nodetype		page_pers.pagep_header.hdr_nodetype
71*8346SScott.Davenport@Sun.COM #define	page_bufname		page_pers.pagep_header.hdr_bufname
72*8346SScott.Davenport@Sun.COM #define	page_version		page_pers.pagep_version
73*8346SScott.Davenport@Sun.COM #define	page_asru		page_pers.pagep_asru
74*8346SScott.Davenport@Sun.COM #define	page_asru_nvl		page_pers.pagep_asru.fmri_nvl
75*8346SScott.Davenport@Sun.COM #define	page_flags		page_pers.pagep_flags
76*8346SScott.Davenport@Sun.COM #define	page_physbase		page_pers.pagep_physbase
77*8346SScott.Davenport@Sun.COM #define	page_offset		page_pers.pagep_offset
78*8346SScott.Davenport@Sun.COM #define	page_list		page_header.hdr_list
79*8346SScott.Davenport@Sun.COM 
80*8346SScott.Davenport@Sun.COM /*
81*8346SScott.Davenport@Sun.COM  * Page retirement
82*8346SScott.Davenport@Sun.COM  *
83*8346SScott.Davenport@Sun.COM  * When a page is to be retired, these routines are called to generate and
84*8346SScott.Davenport@Sun.COM  * manage a fault.memory.page against the page.
85*8346SScott.Davenport@Sun.COM  */
86*8346SScott.Davenport@Sun.COM extern int gmem_page_fault(fmd_hdl_t *, nvlist_t *, nvlist_t *, fmd_event_t *,
87*8346SScott.Davenport@Sun.COM     uint64_t, uint64_t);
88*8346SScott.Davenport@Sun.COM extern void gmem_page_close(fmd_hdl_t *, void *);
89*8346SScott.Davenport@Sun.COM 
90*8346SScott.Davenport@Sun.COM extern gmem_page_t *gmem_page_create(fmd_hdl_t *, nvlist_t *, uint64_t,
91*8346SScott.Davenport@Sun.COM     uint64_t);
92*8346SScott.Davenport@Sun.COM extern gmem_page_t *gmem_page_lookup(uint64_t);
93*8346SScott.Davenport@Sun.COM 
94*8346SScott.Davenport@Sun.COM extern void gmem_page_dirty(fmd_hdl_t *, gmem_page_t *);
95*8346SScott.Davenport@Sun.COM extern void *gmem_page_restore(fmd_hdl_t *, fmd_case_t *, gmem_case_ptr_t *);
96*8346SScott.Davenport@Sun.COM extern void gmem_page_validate(fmd_hdl_t *);
97*8346SScott.Davenport@Sun.COM extern void gmem_page_destroy(fmd_hdl_t *, gmem_page_t *);
98*8346SScott.Davenport@Sun.COM extern void gmem_page_fini(fmd_hdl_t *);
99*8346SScott.Davenport@Sun.COM 
100*8346SScott.Davenport@Sun.COM #ifdef __cplusplus
101*8346SScott.Davenport@Sun.COM }
102*8346SScott.Davenport@Sun.COM #endif
103*8346SScott.Davenport@Sun.COM 
104*8346SScott.Davenport@Sun.COM #endif /* _GMEM_PAGE_H */
105