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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef	_SYS_FPRAS_H
28#define	_SYS_FPRAS_H
29
30#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32#ifdef	__cplusplus
33extern "C" {
34#endif
35
36/*
37 * The following identify copy operations using the fpras mechanism.
38 * They are used in array indexing so keep them sequential.
39 */
40#define	FPRAS_BCOPY	0
41#define	FPRAS_COPYIN	1
42#define	FPRAS_COPYOUT	2
43#define	FPRAS_PGCOPY	3
44#define	FPRAS_NCOPYOPS	(FPRAS_PGCOPY + 1)
45
46/*
47 * Identifying where fpras_failure was called from.
48 */
49#define	FPRAS_FROMCHKFN	0
50#define	FPRAS_FROMTRAP	1
51
52/*
53 * Return values from a check function.
54 */
55#define	FPRAS_OK	0
56#define	FPRAS_BADCALC	1
57#define	FPRAS_BADTRAP	2
58
59#if !defined(_ASM)
60
61/*
62 * Set if an architecture/cpu combination implements fpRAS.
63 */
64extern int fpras_implemented;
65
66/*
67 * Set in /etc/system to disable fpRAS mechanism at reboot.
68 * Changing this value on a live system may have no effect (eg, if an
69 * implementation checks only at startup).
70 */
71extern int fpras_disable;
72
73/*
74 * Set in /etc/system to disable checking of particular copy operations.  Set
75 * bit N to disable checking of the corresponding copy operation (eg, bit 2
76 * for copyout).  Changing this value on a live system may have no effect.
77 */
78extern int fpras_disableids;
79
80/*
81 * Function called from a check function to indicate an incorrect result
82 * was obtained and from trap handlers to determine if the trap was due to
83 * an fpRAS failure.  Symbol only appears for architecture/cpu combinations
84 * that implement fpRAS.
85 */
86#pragma	weak fpras_chktrap
87struct regs;
88extern int fpras_chktrap(struct regs *);
89extern int fpras_failure(int, int);
90
91#endif	/* !_ASM */
92
93#ifdef	__cplusplus
94}
95#endif
96
97#endif	/* _SYS_FPRAS_H */
98