kernel - Move vm_page spin locks from pool to vm_page structure
[dragonfly.git] / sys / dev / raid / hptmv / raid5n.h
blobceb59da90498d8e4a91b76fdd4e29076ee1b851c
1 /*
2 * Copyright (c) 2004-2005 HighPoint Technologies, Inc.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
26 * $FreeBSD: src/sys/dev/hptmv/raid5n.h,v 1.4 2009/04/07 16:38:25 delphij Exp $
28 #ifdef _RAID5N_
30 /* OS provided function, call only at initialization time */
31 extern void * HPTLIBAPI os_alloc_page(_VBUS_ARG0); /* may be cached memory */
32 extern void * HPTLIBAPI os_alloc_dma_page(_VBUS_ARG0); /* must be non-cached memory */
33 /* implement if the driver can be unloaded */
34 void HPTLIBAPI os_free_page(_VBUS_ARG void *p);
35 void HPTLIBAPI os_free_dma_page(_VBUS_ARG void *p);
37 typedef void (* HPTLIBAPI xfer_done_fn)(_VBUS_ARG void *tag, int result);
40 #define DATAXFER_STACK_VAR
41 #define DATAXFER_INIT_ARG 0
43 #define dataxfer_init(arg) 0
44 #define dataxfer_add_item(handle, host, cache, bytes, tocache) \
45 if (tocache) memcpy((PUCHAR)(cache), (PUCHAR)(host), bytes); \
46 else memcpy((PUCHAR)(host), (PUCHAR)(cache), bytes)
47 #define dataxfer_exec(handle, done, tag) done(_VBUS_P tag, 0)
48 #define dataxfer_poll()
51 typedef void (* HPTLIBAPI xor_done_fn)(_VBUS_ARG void *tag, int result);
54 #define XOR_STACK_VAR
55 #define XOR_INIT_ARG 0
57 /* DoXor1, DoXor2 provided by platform dependent code */
58 void HPTLIBAPI DoXor1(ULONG *p0, ULONG *p1, ULONG *p2, UINT nBytes);
59 void HPTLIBAPI DoXor2(ULONG *p0, ULONG *p2, UINT nBytes);
60 #define max_xor_way 2
61 #define xor_init(arg) 0
62 #define xor_add_item(handle, dest, src, nsrc, bytes) \
63 do {\
64 if (((void**)(src))[0]==dest)\
65 DoXor2((PULONG)(dest), ((PULONG *)(src))[1], bytes);\
66 else\
67 DoXor1((PULONG)(dest), ((PULONG *)(src))[0], ((PULONG *)(src))[1], bytes);\
68 } while(0)
69 #define xor_exec(handle, done, tag) done(_VBUS_P tag, 0)
70 #define xor_poll()
73 /* set before calling init_raid5_memory */
74 extern UINT num_raid5_pages;
76 /* called by init.c */
77 extern void HPTLIBAPI init_raid5_memory(_VBUS_ARG0);
78 extern void HPTLIBAPI free_raid5_memory(_VBUS_ARG0);
80 /* asynchronous flush, may be called periodly */
81 extern void HPTLIBAPI flush_stripe_cache(_VBUS_ARG0);
82 extern void HPTLIBAPI flush_raid5_async(PVDevice pArray, DPC_PROC done, void *arg);
84 /* synchronous function called at shutdown */
85 extern int HPTLIBAPI flush_raid5(PVDevice pArray);
87 extern void HPTLIBAPI raid5_free(_VBUS_ARG PVDevice pArray);
89 struct free_heap_block {
90 struct free_heap_block *next;
93 #ifndef LIST_H_INCLUDED
94 struct list_head {
95 struct list_head *next, *prev;
97 #endif
99 struct free_page {
100 struct free_page *link;
103 struct r5_global_data {
104 int enable_write_back;
105 struct list_head inactive_list;
106 struct list_head dirty_list;
107 struct list_head active_list;
108 #ifdef R5_CONTIG_CACHE
109 BUS_ADDR page_base_phys;
110 PUCHAR page_base_virt;
111 PUCHAR page_current;
112 #endif
113 struct free_heap_block *free_heap_slots[10];
114 struct free_page *free_pages;
115 UINT num_free_pages;
116 UINT active_stripes;
117 UINT num_flushing;
118 PCommand cache_wait_list;
120 LBA_T __start[MAX_MEMBERS];
121 USHORT __sectors[MAX_MEMBERS];
125 #endif