2 * Copyright (c) 2004-2005 HighPoint Technologies, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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
26 * $FreeBSD: src/sys/dev/hptmv/raid5n.h,v 1.4 2009/04/07 16:38:25 delphij Exp $
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
);
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
);
61 #define xor_init(arg) 0
62 #define xor_add_item(handle, dest, src, nsrc, bytes) \
64 if (((void**)(src))[0]==dest)\
65 DoXor2((PULONG)(dest), ((PULONG *)(src))[1], bytes);\
67 DoXor1((PULONG)(dest), ((PULONG *)(src))[0], ((PULONG *)(src))[1], bytes);\
69 #define xor_exec(handle, done, tag) done(_VBUS_P tag, 0)
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
95 struct list_head
*next
, *prev
;
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
;
113 struct free_heap_block
*free_heap_slots
[10];
114 struct free_page
*free_pages
;
118 PCommand cache_wait_list
;
120 LBA_T __start
[MAX_MEMBERS
];
121 USHORT __sectors
[MAX_MEMBERS
];