cmd_state.h revision d00f0155af9a9a671eb08a0dc30f5ea0a379c36c
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CMD_STATE_H
#define _CMD_STATE_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Case management and saved state restoration
*/
#include <cmd_list.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Our maximum persistent buffer name length, used to allocate fixed-size
* arrays for name storage.
*/
#define CMD_BUFNMLEN 48
/* cmd_evdisp_t, cmd_evdisp_stat_t, and cmd_evdisp_names must be in sync */
typedef enum cmd_evdisp {
} cmd_evdisp_t;
/*
* Each handled ereport type has four statistics, designed to indicate the
* eventual disposition of the ereport.
*/
typedef struct cmd_evdisp_stat {
/* Must be in sync with cmd_case_restorers */
typedef enum cmd_nodetype {
CMD_NT_CPU = 1,
/*
* Must be in sync with cmd_case_closers. Additional types must be
* appended to this enum otherwise interpretation of existing logs
* and checkpoints will be confused.
*/
typedef enum cmd_ptrsubtype {
CMD_PTR_CPU_ICACHE = 1,
CMD_PTR_CPU_L2DATA_UERETRY, /* no longer used */
CMD_PTR_CPU_L3DATA_UERETRY, /* no longer used */
/*
* A change was made to the above enum that violated the ordering requirement
* described in the comment. As such, there exist development machines in
* the wild that have pre-violation pointer buffers. Attempts to run the DE
* on those machines will cause the state-restoration code to fail, as it
* won't know what to do with the old pointer types. Unfortunately, the old
* and new values overlapped for the CPU pointers, so there's not much we
* can do there. The memory pointers, on the other hand, changed from 6-8 to
* 12-14, thus allowing us to make the dimm, bank, and page restoration code
* check for both values.
*
* This should go away soon into the next release.
*/
typedef enum cmd_BUG_ptrsubtype {
BUG_PTR_DIMM_CASE = 6,
BUG_PTR_BANK_CASE = 7,
#define CMD_TIMERTYPE_CPU_UEC_FLUSH 1
#define CMD_TIMERTYPE_CPU_XR_WAITER 2
#define CMD_TIMERTYPE_MEM 3
#define CMD_TIMERTYPE_DP 4
(timer) != CMD_TIMERTYPE_DP)
/*
* There are three types of general-purpose buffers, used to track CPUs, DIMMs,
* and pages. Created on-demand as ereports arrive, one buffer is created for
* each thing tracked. The general-purpose buffers are used to track common
* state, and are used to support case-specific buffers. Each open case has
* a case-specific pointer buffer, used to aid in the rediscovery of the
* associated general-purpose buffer. When restoration begins, we iterate
* through each of the open cases, restoring the case-specific pointer buffers
* for each. The pointer buffers are then used to restore the general-purpose
* buffers.
*/
typedef struct cmd_case_ptr {
/*
* All general-purpose buffers begin with a common header. This header contains
* identification information used in the construction of new cases.
*
* Note that versioned structs (currently cmd_cpu_t) depend upon the size of
* this struct remaining fixed.
*/
typedef struct cmd_header {
} cmd_header_t;
/*
* Per-case-subtype case closing routines. Stored in per-case state when the
* case is generated, and regenerated from saved state upon restore.
*/
typedef void cmd_case_closer_f(fmd_hdl_t *, void *);
typedef struct cmd_case_closer {
void *cl_arg;
typedef struct cmd_case {
char *cc_serdnm;
} cmd_case_t;
/*
* Utility functions which ease the management of cases.
*/
cmd_ptrsubtype_t, const char **);
extern int cmd_state_restore(fmd_hdl_t *);
#ifdef __cplusplus
}
#endif
#endif /* _CMD_STATE_H */