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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _CMD_PAGE_H 27 #define _CMD_PAGE_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 /* 32 * Routines for the creation of page retirement faults and for the management of 33 * page-related state. 34 */ 35 36 #include <cmd_state.h> 37 #include <cmd_fmri.h> 38 39 #include <fm/fmd_api.h> 40 #include <sys/types.h> 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 #define PAGE_MKVERSION(version) ((version) << 4 | 1) 47 48 #define CMD_PAGE_VERSION_1 PAGE_MKVERSION(1) /* 17 */ 49 #define CMD_PAGE_VERSION CMD_PAGE_VERSION_1 50 51 #define CMD_PAGE_VERSIONED(page) ((page)->page_version & 1) 52 53 typedef struct cmd_page_0 { 54 cmd_header_t page0_header; /* Nodetype must be CMD_NT_PAGE */ 55 fmd_case_t *page0_case; /* Open ret. case against this page */ 56 cmd_fmri_t page0_asru; /* ASRU for this page */ 57 uint64_t page0_physbase; /* Base phys addr for this page */ 58 } cmd_page_0_t; 59 60 typedef struct cmd_page_pers { 61 cmd_header_t pagep_header; /* Nodetype must be CMD_NT_PAGE */ 62 uint_t pagep_version; 63 cmd_fmri_t pagep_asru; /* ASRU for this DIMM */ 64 uint64_t pagep_physbase; /* base phys addr for page */ 65 uint_t pagep_flags; /* CMD_MEM_F_* */ 66 } cmd_page_pers_t; 67 68 typedef struct cmd_page { 69 cmd_page_pers_t page_pers; 70 cmd_case_t page_case; /* Open CE case against this page */ 71 } cmd_page_t; 72 73 #define CMD_PAGE_MAXSIZE \ 74 MAX(sizeof (cmd_page_0_t), sizeof (cmd_page_pers_t)) 75 #define CMD_PAGE_MINSIZE \ 76 MIN(sizeof (cmd_page_0_t), sizeof (cmd_page_pers_t)) 77 78 #define page_header page_pers.pagep_header 79 #define page_nodetype page_pers.pagep_header.hdr_nodetype 80 #define page_bufname page_pers.pagep_header.hdr_bufname 81 #define page_version page_pers.pagep_version 82 #define page_asru page_pers.pagep_asru 83 #define page_asru_nvl page_pers.pagep_asru.fmri_nvl 84 #define page_flags page_pers.pagep_flags 85 #define page_physbase page_pers.pagep_physbase 86 #define page_list page_header.hdr_list 87 88 /* 89 * Page retirement 90 * 91 * When a page is to be retired, these routines are called to generate and 92 * manage a fault.memory.page against the page. 93 */ 94 extern void cmd_page_fault(fmd_hdl_t *, nvlist_t *, nvlist_t *, fmd_event_t *, 95 uint64_t); 96 extern void cmd_page_close(fmd_hdl_t *, void *); 97 98 extern cmd_page_t *cmd_page_create(fmd_hdl_t *, nvlist_t *, uint64_t); 99 extern cmd_page_t *cmd_page_lookup(uint64_t); 100 101 extern void cmd_page_dirty(fmd_hdl_t *, cmd_page_t *); 102 extern void *cmd_page_restore(fmd_hdl_t *, fmd_case_t *, cmd_case_ptr_t *); 103 extern void cmd_page_validate(fmd_hdl_t *); 104 extern void cmd_page_destroy(fmd_hdl_t *, cmd_page_t *); 105 extern void cmd_page_fini(fmd_hdl_t *); 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 #endif /* _CMD_PAGE_H */ 112