cmd_bank.h revision 822fb41d6f36e90a1ec836b32f869e1235e7da40
/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CMD_BANK_H
#define _CMD_BANK_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Collections of memory modules are known as banks, and are described by
* the cmd_bank general-purpose state structure. The bank structure --
* cmd_bank_t -- is itself comprised of a persistent (cmd_bank_pers_t) and
* dynamic (the rest of cmd_bank_t) portions. While we'd prefer to associate
* errors with individual modules, some errors (UEs) may only be attributed to
* a bank of modules. This structure is used to track the UEs. Links are made
* (via bank_dimms) to the known memory modules that comprise the bank. Note
* that memory modules are discovered lazily - as ereports naming them are
* processed. As such, the bank_dimms list may be empty, or may only list a
* subset of the modules in the bank.
*
* Data structures:
*
* ,--------. ,--------.
* |bank | <---- |case_ptr| (CMD_PTR_BANK_CASE)
* | | `--------'
* |,-------| ,-------------.
* ,->||asru_t | ----> |packed nvlist|
* | |`-------| `-------------'
* `--| unum | ,---------. ,---------.
* | dimms | ----> |bank_memb| ----> |bank_memb| ----> ...
* `--------' `---------' `---------'
* | |
* V V
* dimm buffer dimm buffer
*
* Data structure P? Case? Notes
* ---------------- --- ----- -------------------------------------
* cmd_bank_pers_t Yes No Name is unum-derived ("bank_%s")
* cmd_case_ptr_t Yes Yes Name is case's UUID
* bank_asru Yes No Name is unum-derived ("bank_asru_%d")
* bank_unum No No Pointer into ASRU - relinked during restore
* bank_dimms No No Recreated during restore
*/
#include <cmd_mem.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Tracks the discovered DIMMs that make up a given bank. Only DIMMs that have
* experienced errors independently of the bank will be included in this list.
*/
typedef struct cmd_bank_memb {
/*
* The bank structure started life without a version number. Making things more
* complicated, the version number in the new struct occupies the space used for
* the case pointer in the non-versioned struct. We therefore have to use
* somewhat unorthodox version numbers so as to allow us to easily tell the
* difference between a version number and a case pointer. Case pointers will
* be zero or (this being SPARC), a value with the bottom two bits clear. Our
* version numbers will begin with 0x11, and will increase by 0x10 each time.
*/
#define CMD_BANK_VERSION CMD_DIMM_VERSION_1
typedef struct cmd_bank_0 {
const char *bank0_unum; /* This bank's name (ptr into ASRU) */
} cmd_bank_0_t;
/* Portion of the bank structure which must be persisted */
typedef struct cmd_bank_pers {
/* Persistent and dynamic bank data */
struct cmd_bank {
const char *bank_unum; /* This bank's name (ptr into ASRU) */
};
#define CMD_BANK_MAXSIZE \
#define CMD_BANK_MINSIZE \
uint_t);
extern void cmd_bank_validate(fmd_hdl_t *);
extern void cmd_bank_gc(fmd_hdl_t *);
extern void cmd_bank_fini(fmd_hdl_t *);
#ifdef __cplusplus
}
#endif
#endif /* _CMD_BANK_H */