xref: /netbsd/sys/dev/raidframe/rf_dagfuncs.h (revision 6550d01e)
1 /*	$NetBSD: rf_dagfuncs.h,v 1.10 2006/01/09 01:33:27 oster Exp $	*/
2 /*
3  * Copyright (c) 1995 Carnegie-Mellon University.
4  * All rights reserved.
5  *
6  * Author: Mark Holland, William V. Courtright II, Jim Zelenka
7  *
8  * Permission to use, copy, modify and distribute this software and
9  * its documentation is hereby granted, provided that both the copyright
10  * notice and this permission notice appear in all copies of the
11  * software, derivative works or modified versions, and any portions
12  * thereof, and that both notices appear in supporting documentation.
13  *
14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17  *
18  * Carnegie Mellon requests users of this software to return to
19  *
20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
21  *  School of Computer Science
22  *  Carnegie Mellon University
23  *  Pittsburgh PA 15213-3890
24  *
25  * any improvements or extensions that they make and grant Carnegie the
26  * rights to redistribute these changes.
27  */
28 
29 /*****************************************************************************************
30  *
31  * dagfuncs.h -- header file for DAG node execution routines
32  *
33  ****************************************************************************************/
34 
35 #ifndef _RF__RF_DAGFUNCS_H_
36 #define _RF__RF_DAGFUNCS_H_
37 
38 int     rf_ConfigureDAGFuncs(RF_ShutdownList_t ** listp);
39 int     rf_TerminateFunc(RF_DagNode_t * node);
40 int     rf_TerminateUndoFunc(RF_DagNode_t * node);
41 int     rf_DiskReadMirrorIdleFunc(RF_DagNode_t * node);
42 int     rf_DiskReadMirrorPartitionFunc(RF_DagNode_t * node);
43 int     rf_DiskReadMirrorUndoFunc(RF_DagNode_t * node);
44 int     rf_ParityLogUpdateFunc(RF_DagNode_t * node);
45 int     rf_ParityLogOverwriteFunc(RF_DagNode_t * node);
46 int     rf_ParityLogUpdateUndoFunc(RF_DagNode_t * node);
47 int     rf_ParityLogOverwriteUndoFunc(RF_DagNode_t * node);
48 int     rf_NullNodeFunc(RF_DagNode_t * node);
49 int     rf_NullNodeUndoFunc(RF_DagNode_t * node);
50 int     rf_DiskReadFuncForThreads(RF_DagNode_t * node);
51 int     rf_DiskWriteFuncForThreads(RF_DagNode_t * node);
52 int     rf_DiskUndoFunc(RF_DagNode_t * node);
53 int     rf_GenericWakeupFunc(RF_DagNode_t * node, int status);
54 int     rf_RegularXorFunc(RF_DagNode_t * node);
55 int     rf_SimpleXorFunc(RF_DagNode_t * node);
56 int     rf_RecoveryXorFunc(RF_DagNode_t * node);
57 int
58 rf_XorIntoBuffer(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda, char *srcbuf,
59 		 char *targbuf);
60 int     rf_bxor(char *src, char *dest, int len);
61 int
62 rf_longword_bxor(unsigned long *src, unsigned long *dest, int len);
63 int
64 rf_longword_bxor3(unsigned long *dest, unsigned long *a, unsigned long *b,
65 		  unsigned long *c, int len, void *bp);
66 int
67 rf_bxor3(unsigned char *dst, unsigned char *a, unsigned char *b,
68     unsigned char *c, unsigned long len, void *bp);
69 
70 /* function ptrs defined in ConfigureDAGFuncs() */
71 extern int (*rf_DiskReadFunc) (RF_DagNode_t *);
72 extern int (*rf_DiskWriteFunc) (RF_DagNode_t *);
73 extern int (*rf_DiskReadUndoFunc) (RF_DagNode_t *);
74 extern int (*rf_DiskWriteUndoFunc) (RF_DagNode_t *);
75 extern int (*rf_SimpleXorUndoFunc) (RF_DagNode_t *);
76 extern int (*rf_RegularXorUndoFunc) (RF_DagNode_t *);
77 extern int (*rf_RecoveryXorUndoFunc) (RF_DagNode_t *);
78 
79 /* macros for manipulating the param[3] in a read or write node */
80 #define RF_CREATE_PARAM3(pri, wru) (((RF_uint64)(((wru&0xFFFFFF)<<8)|((pri)&0xF)) ))
81 #define RF_EXTRACT_PRIORITY(_x_)     ((((unsigned) ((unsigned long)(_x_))) >> 0) & 0x0F)
82 #define RF_EXTRACT_RU(_x_)           ((((unsigned) ((unsigned long)(_x_))) >> 8) & 0xFFFFFF)
83 
84 #endif				/* !_RF__RF_DAGFUNCS_H_ */
85