/*
* 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 _SYS_ASYNC_H
#define _SYS_ASYNC_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/privregs.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ASM
/*
* The async_flt structure is used to record all pertinent information about
* an asynchronous CPU or bus-related memory error. Typically, the structure
* is initialized by a high-level interrupt or trap handler, and then enqueued
* for later processing. Separate queues are maintained for correctable and
* uncorrectable errors. The current CPU module determines the size of the
* queue elements, so that it may declare a CPU-specific fault structure
* which contains a struct async_flt as its first member. Each async_flt also
* contains a callback function (flt_func) that is invoked by the processing
* code in order to actually log messages when the event is dequeued. This
* function may be called from a softint, from trap() as part of AST handling
* before the victim thread returns to userland, or as part of panic(). As
* such, the flt_func should basically only be calling cmn_err (but NOT with
* the CE_PANIC flag). It must not call panic(), acquire locks, or block.
* The owner of the event is responsible for determining whether the event is
* fatal; if so, the owner should set flt_panic and panic() after enqueuing
* the event. The event will then be dequeued and logged as part of panic
* processing. If flt_panic is not set, the queue function will schedule a
* soft interrupt to process the event.
*/
struct async_flt;
struct async_flt {
};
/*
* Bus nexus drivers can use the bus_func_register() interface to register
* callback functions for error handling and panic handling. The handler
* functions should be registered and unregistered from driver attach and
* detach context, where it is safe to perform a sleeping allocation. The
* callbacks themselves can be invoked from panic, or from the CPU module's
* asynchronous trap handler at high PIL. As such, these routines may only
* test for errors and enqueue async_flt events. They may not grab adaptive
* locks, call panic(), or invoke bus_func_register() or bus_func_unregister().
* Each callback function should return one of the BF_* return status values
* below. The bus_func_invoke() function calls all the registered handlers of
* the specified type, and returns the maximum of their return values (e.g.
* BF_FATAL if any callback returned BF_FATAL). If any callback returns
* BF_FATAL, the system will panic at the end of callback processing.
*/
typedef struct bus_func_desc {
extern void bus_func_register(int, busfunc_t, void *);
extern void bus_func_unregister(int, busfunc_t, void *);
extern void bus_async_log_err(struct async_flt *);
extern uint_t bus_func_invoke(int);
extern void ecc_cpu_call(struct async_flt *, char *, int);
extern void ecc_page_zero(void *);
extern void error_init(void);
extern int ce_verbose_memory;
extern int ce_verbose_other;
extern int ce_show_data;
extern int ce_debug;
extern int ue_debug;
extern int aft_verbose;
extern int aft_panic;
extern int aft_testfatal;
extern struct async_flt panic_aflt;
#endif /* !_ASM */
/*
* ECC or parity error status for async_flt.flt_status.
*/
/*
* Trap type numbers corresponding to the fault types defined above.
*/
#define TRAP_TYPE_UNKNOWN 0
/*
* Fault classes for async_flt.flt_class.
*/
/*
* Invalid or unknown physical address for async_flt.flt_addr.
*/
/*
* Fault protection values for async_flt.flt_prot. The async error handling
* code may be able to recover from errors when kernel code has explicitly
* protected itself using one of the mechanisms specified here.
*/
/*
* These flags are used to indicate the validity of certain data based on
* AFAR, ESYND and MSYND, each of which have different overwrite priorities.
*
* Given a specific afsr error bit and the entire afsr, there are three cases:
* INVALID: The specified bit is lower overwrite priority than some other
* VALID: The specified bit is higher priority than all other error bits
* which are on in the afsr.
* AMBIGUOUS: Another error bit (or bits) of equal priority to the specified
* bit is on in the afsr.
*
* NB: The domain-to-SC communications depend on these values. If they are
* changed, plat_ecc_unum.[ch] must be updated to match.
*/
/*
* Maximum length of unum string.
*/
/*
* Maximum length of a DIMM serial id string + null
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ASYNC_H */