xref: /netbsd-src/sys/dev/raidframe/rf_dagfuncs.h (revision b67baf4ca06533687b702c15b38477e8856cf0d9)
1*b67baf4cSchristos /*	$NetBSD: rf_dagfuncs.h,v 1.11 2019/10/10 03:43:59 christos Exp $	*/
238a3987bSoster /*
338a3987bSoster  * Copyright (c) 1995 Carnegie-Mellon University.
438a3987bSoster  * All rights reserved.
538a3987bSoster  *
638a3987bSoster  * Author: Mark Holland, William V. Courtright II, Jim Zelenka
738a3987bSoster  *
838a3987bSoster  * Permission to use, copy, modify and distribute this software and
938a3987bSoster  * its documentation is hereby granted, provided that both the copyright
1038a3987bSoster  * notice and this permission notice appear in all copies of the
1138a3987bSoster  * software, derivative works or modified versions, and any portions
1238a3987bSoster  * thereof, and that both notices appear in supporting documentation.
1338a3987bSoster  *
1438a3987bSoster  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
1538a3987bSoster  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
1638a3987bSoster  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
1738a3987bSoster  *
1838a3987bSoster  * Carnegie Mellon requests users of this software to return to
1938a3987bSoster  *
2038a3987bSoster  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
2138a3987bSoster  *  School of Computer Science
2238a3987bSoster  *  Carnegie Mellon University
2338a3987bSoster  *  Pittsburgh PA 15213-3890
2438a3987bSoster  *
2538a3987bSoster  * any improvements or extensions that they make and grant Carnegie the
2638a3987bSoster  * rights to redistribute these changes.
2738a3987bSoster  */
2838a3987bSoster 
2938a3987bSoster /*****************************************************************************************
3038a3987bSoster  *
3138a3987bSoster  * dagfuncs.h -- header file for DAG node execution routines
3238a3987bSoster  *
3338a3987bSoster  ****************************************************************************************/
3438a3987bSoster 
3538a3987bSoster #ifndef _RF__RF_DAGFUNCS_H_
3638a3987bSoster #define _RF__RF_DAGFUNCS_H_
3738a3987bSoster 
3838a3987bSoster int     rf_ConfigureDAGFuncs(RF_ShutdownList_t ** listp);
39*b67baf4cSchristos void    rf_TerminateFunc(RF_DagNode_t * node);
40*b67baf4cSchristos void    rf_TerminateUndoFunc(RF_DagNode_t * node);
41*b67baf4cSchristos void    rf_DiskReadMirrorIdleFunc(RF_DagNode_t * node);
42*b67baf4cSchristos void    rf_DiskReadMirrorPartitionFunc(RF_DagNode_t * node);
43*b67baf4cSchristos void    rf_DiskReadMirrorUndoFunc(RF_DagNode_t * node);
44*b67baf4cSchristos void    rf_ParityLogUpdateFunc(RF_DagNode_t * node);
45*b67baf4cSchristos void    rf_ParityLogOverwriteFunc(RF_DagNode_t * node);
46*b67baf4cSchristos void    rf_ParityLogUpdateUndoFunc(RF_DagNode_t * node);
47*b67baf4cSchristos void    rf_ParityLogOverwriteUndoFunc(RF_DagNode_t * node);
48*b67baf4cSchristos void    rf_NullNodeFunc(RF_DagNode_t * node);
49*b67baf4cSchristos void    rf_NullNodeUndoFunc(RF_DagNode_t * node);
50*b67baf4cSchristos void    rf_DiskReadFuncForThreads(RF_DagNode_t * node);
51*b67baf4cSchristos void    rf_DiskWriteFuncForThreads(RF_DagNode_t * node);
52*b67baf4cSchristos void    rf_DiskUndoFunc(RF_DagNode_t * node);
53*b67baf4cSchristos void    rf_GenericWakeupFunc(void *, int);
54*b67baf4cSchristos void    rf_RegularXorFunc(RF_DagNode_t * node);
55*b67baf4cSchristos void    rf_SimpleXorFunc(RF_DagNode_t * node);
56*b67baf4cSchristos void    rf_RecoveryXorFunc(RF_DagNode_t * node);
5700145885Soster int
5800145885Soster rf_XorIntoBuffer(RF_Raid_t * raidPtr, RF_PhysDiskAddr_t * pda, char *srcbuf,
594635d077Soster 		 char *targbuf);
604635d077Soster int     rf_bxor(char *src, char *dest, int len);
6100145885Soster int
624635d077Soster rf_longword_bxor(unsigned long *src, unsigned long *dest, int len);
6300145885Soster int
648d702c4bSoster rf_longword_bxor3(unsigned long *dest, unsigned long *a, unsigned long *b,
658d702c4bSoster 		  unsigned long *c, int len, void *bp);
6600145885Soster int
6700145885Soster rf_bxor3(unsigned char *dst, unsigned char *a, unsigned char *b,
6838a3987bSoster     unsigned char *c, unsigned long len, void *bp);
6938a3987bSoster 
7038a3987bSoster /* function ptrs defined in ConfigureDAGFuncs() */
71*b67baf4cSchristos extern void (*rf_DiskReadFunc) (RF_DagNode_t *);
72*b67baf4cSchristos extern void (*rf_DiskWriteFunc) (RF_DagNode_t *);
73*b67baf4cSchristos extern void (*rf_DiskReadUndoFunc) (RF_DagNode_t *);
74*b67baf4cSchristos extern void (*rf_DiskWriteUndoFunc) (RF_DagNode_t *);
75*b67baf4cSchristos extern void (*rf_SimpleXorUndoFunc) (RF_DagNode_t *);
76*b67baf4cSchristos extern void (*rf_RegularXorUndoFunc) (RF_DagNode_t *);
77*b67baf4cSchristos extern void (*rf_RecoveryXorUndoFunc) (RF_DagNode_t *);
7838a3987bSoster 
7938a3987bSoster /* macros for manipulating the param[3] in a read or write node */
802e191866Soster #define RF_CREATE_PARAM3(pri, wru) (((RF_uint64)(((wru&0xFFFFFF)<<8)|((pri)&0xF)) ))
8138a3987bSoster #define RF_EXTRACT_PRIORITY(_x_)     ((((unsigned) ((unsigned long)(_x_))) >> 0) & 0x0F)
8238a3987bSoster #define RF_EXTRACT_RU(_x_)           ((((unsigned) ((unsigned long)(_x_))) >> 8) & 0xFFFFFF)
8338a3987bSoster 
8438a3987bSoster #endif				/* !_RF__RF_DAGFUNCS_H_ */
85