global.h (143039) | global.h (149871) |
---|---|
1/*- 2 * Copyright (c) 2003-2004 HighPoint Technologies, Inc. | 1/* 2 * Copyright (c) 2004-2005 HighPoint Technologies, Inc. |
3 * All rights reserved. 4 * 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 --- 7 unchanged lines hidden (view full) --- 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. 25 * | 3 * All rights reserved. 4 * 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 --- 7 unchanged lines hidden (view full) --- 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. 25 * |
26 * $FreeBSD: head/sys/dev/hptmv/global.h 143039 2005-03-02 15:13:37Z scottl $ | 26 * $FreeBSD: head/sys/dev/hptmv/global.h 149871 2005-09-07 23:33:26Z scottl $ |
27 */ 28#ifndef _GLOBAL_H_ 29#define _GLOBAL_H_ 30 31#include <dev/hptmv/mvOs.h> 32#include <dev/hptmv/mvSata.h> 33#include <dev/hptmv/mvStorageDev.h> 34 | 27 */ 28#ifndef _GLOBAL_H_ 29#define _GLOBAL_H_ 30 31#include <dev/hptmv/mvOs.h> 32#include <dev/hptmv/mvSata.h> 33#include <dev/hptmv/mvStorageDev.h> 34 |
35#define COMPANY "HighPoint Technologies, Inc." 36#define COPYRIGHT "(c) 2000-2004. HighPoint Technologies, Inc." | 35#define COMPANY "HighPoint Technologies, Inc." 36#define COPYRIGHT "(c) 2000-2004. HighPoint Technologies, Inc." |
37#define DRIVER_NAME "RocketRAID 182x SATA Controller driver" | 37#define DRIVER_NAME "RocketRAID 182x SATA Controller driver" |
38#define CONTROLLER_NAME "RocketRAID 182x SATA Controller" 39#define PROC_DIR_NAME hptmv | 38#define CONTROLLER_NAME "RocketRAID 182x SATA Controller" 39#define PROC_DIR_NAME hptmv |
40 41#define HPT_INTERFACE_VERSION 0x01000003 42#define SUPPORT_48BIT_LBA 43#define SUPPORT_ARRAY 44#define SUPPORT_RAID5 1 45#define _RAID5N_ 46#define MAX_QUEUE_COMM 32 47#define MAX_SG_DESCRIPTORS 17 | 40 41#define HPT_INTERFACE_VERSION 0x01000003 42#define SUPPORT_48BIT_LBA 43#define SUPPORT_ARRAY 44#define SUPPORT_RAID5 1 45#define _RAID5N_ 46#define MAX_QUEUE_COMM 32 47#define MAX_SG_DESCRIPTORS 17 |
48#define MAX_VBUS 2 /* 49 * One vbus per adapter in mv linux driver, 50 * MAX_VBUS is defined for share code and can not be 1 51 */ | 48#define MAX_VBUS 2 /*one vbus per adapter in mv linux driver, 49 MAX_VBUS is defined for share code and can not be 1*/ |
52 53#define SET_VBUS_FOR_EACH_CONTROLLER 54#define MAX_MEMBERS 8 55#define MAX_ARRAY_NAME 16 56#define MAX_VDEVICE_PER_VBUS 8 57#define MAX_ARRAY_DEVICE MAX_ARRAY_PER_VBUS 58#define MAX_CHIP_IN_VBUS 1 59 --- 10 unchanged lines hidden (view full) --- 70 71typedef struct _Device { 72 UCHAR df_on_line; 73 UCHAR df_atapi; 74 UCHAR df_removable_drive; 75 UCHAR busyCount; 76 77 UCHAR df_tcq_set: 1; | 50 51#define SET_VBUS_FOR_EACH_CONTROLLER 52#define MAX_MEMBERS 8 53#define MAX_ARRAY_NAME 16 54#define MAX_VDEVICE_PER_VBUS 8 55#define MAX_ARRAY_DEVICE MAX_ARRAY_PER_VBUS 56#define MAX_CHIP_IN_VBUS 1 57 --- 10 unchanged lines hidden (view full) --- 68 69typedef struct _Device { 70 UCHAR df_on_line; 71 UCHAR df_atapi; 72 UCHAR df_removable_drive; 73 UCHAR busyCount; 74 75 UCHAR df_tcq_set: 1; |
78 UCHAR df_tcq: 1; /* enable TCQ */ | 76 UCHAR df_tcq: 1; /* enable TCQ */ |
79 UCHAR df_ncq_set: 1; | 77 UCHAR df_ncq_set: 1; |
80 UCHAR df_ncq: 1; /* enable NCQ */ | 78 UCHAR df_ncq: 1; /* enable NCQ */ |
81 UCHAR df_write_cache_set: 1; | 79 UCHAR df_write_cache_set: 1; |
82 UCHAR df_write_cache: 1; /* enable write cache */ | 80 UCHAR df_write_cache: 1; /* enable write cache */ |
83 UCHAR df_read_ahead_set: 1; | 81 UCHAR df_read_ahead_set: 1; |
84 UCHAR df_read_ahead: 1; /* enable read ahead */ 85 | 82 UCHAR df_read_ahead: 1; /* enable read ahead */ 83 |
86 UCHAR retryCount; 87 UCHAR resetCount; 88 UCHAR pad1; | 84 UCHAR retryCount; 85 UCHAR resetCount; 86 UCHAR pad1; |
89 | 87 |
90 UCHAR df_user_mode_set; | 88 UCHAR df_user_mode_set; |
91 UCHAR bDeModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */ 92 UCHAR bDeUsable_Mode; /* actual maximum data transfer mode */ | 89 UCHAR bDeModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */ 90 UCHAR bDeUsable_Mode; /* actual maximum data transfer mode */ |
93 UCHAR bDeUserSelectMode; | 91 UCHAR bDeUserSelectMode; |
94 | 92 |
95 PVBus pVBus; 96 ULONG dDeRealCapacity; 97 ULONG dDeHiddenLba; 98 ULONG HeadPosition; 99 ULONG QueueLength; 100 MV_SATA_CHANNEL *mv; | 93 PVBus pVBus; 94 ULONG dDeRealCapacity; 95 ULONG dDeHiddenLba; 96 ULONG HeadPosition; 97 ULONG QueueLength; 98 MV_SATA_CHANNEL *mv; |
101} Device, *PDevice; | 99} 100Device, *PDevice; |
102 | 101 |
103typedef struct _SCAT_GATH { 104 ULONG_PTR dSgAddress; 105 USHORT wSgSize; 106 USHORT wSgFlag; | 102typedef struct _SCAT_GATH 103{ 104 ULONG_PTR dSgAddress; 105 USHORT wSgSize; 106 USHORT wSgFlag; |
107} SCAT_GATH, FAR *FPSCAT_GATH; 108 109#define OS_VDEV_EXT | 107} SCAT_GATH, FAR *FPSCAT_GATH; 108 109#define OS_VDEV_EXT |
110typedef struct _VDevice_Ext { 111#if defined(WIN95) && defined(SUPPORT_HOTSWAP) 112 DCB * pDcb; 113#endif | 110typedef struct _VDevice_Ext 111{ |
114 UCHAR gui_locked; /* the device is locked by GUI */ 115 UCHAR reserve[3]; 116} VDevice_Ext, *PVDevice_Ext; 117 118 119#define SG_FLAG_SKIP 0x4000 120#define SG_FLAG_EOT 0x8000 121 | 112 UCHAR gui_locked; /* the device is locked by GUI */ 113 UCHAR reserve[3]; 114} VDevice_Ext, *PVDevice_Ext; 115 116 117#define SG_FLAG_SKIP 0x4000 118#define SG_FLAG_EOT 0x8000 119 |
122#if 0 /* MAX_VBUS==1 */ 123#define _VBUS_ARG 124#define _VBUS_ARG0 void 125#define _VBUS_P 126#define _VBUS_P0 127#define _VBUS_INST(x) 128#define _vbus_(x) x 129#else | |
130#define _VBUS_ARG0 PVBus _vbus_p 131#define _VBUS_ARG PVBus _vbus_p, 132#define _VBUS_P _vbus_p, 133#define _VBUS_P0 _vbus_p 134#define _VBUS_INST(x) PVBus _vbus_p = x; 135#define _vbus_(x) (_vbus_p->x) | 120#define _VBUS_ARG0 PVBus _vbus_p 121#define _VBUS_ARG PVBus _vbus_p, 122#define _VBUS_P _vbus_p, 123#define _VBUS_P0 _vbus_p 124#define _VBUS_INST(x) PVBus _vbus_p = x; 125#define _vbus_(x) (_vbus_p->x) |
136#endif | |
137 138/************************************************************************* 139 * arithmetic functions 140 *************************************************************************/ 141#define LongRShift(x, y) (x >> y) 142#define LongLShift(x, y) (x << y) 143#define LongDiv(x, y) (x / (UINT)(y)) 144#define LongRem(x, y) (x % (UINT)(y)) --- 6 unchanged lines hidden (view full) --- 151 152/************************************************************************* 153 * C library 154 *************************************************************************/ 155int HPTLIBAPI os_memcmp(const void *cs, const void *ct, unsigned len); 156void HPTLIBAPI os_memcpy(void *to, const void *from, unsigned len); 157void HPTLIBAPI os_memset(void *s, char c, unsigned len); 158unsigned HPTLIBAPI os_strlen(const char *s); | 126 127/************************************************************************* 128 * arithmetic functions 129 *************************************************************************/ 130#define LongRShift(x, y) (x >> y) 131#define LongLShift(x, y) (x << y) 132#define LongDiv(x, y) (x / (UINT)(y)) 133#define LongRem(x, y) (x % (UINT)(y)) --- 6 unchanged lines hidden (view full) --- 140 141/************************************************************************* 142 * C library 143 *************************************************************************/ 144int HPTLIBAPI os_memcmp(const void *cs, const void *ct, unsigned len); 145void HPTLIBAPI os_memcpy(void *to, const void *from, unsigned len); 146void HPTLIBAPI os_memset(void *s, char c, unsigned len); 147unsigned HPTLIBAPI os_strlen(const char *s); |
148 |
|
159#ifdef NO_LIBC 160#define memcmp os_memcmp 161#define memcpy os_memcpy 162#define memset os_memset 163#define strlen os_strlen 164#elif (__FreeBSD_version <= 410000) | 149#ifdef NO_LIBC 150#define memcmp os_memcmp 151#define memcpy os_memcpy 152#define memset os_memset 153#define strlen os_strlen 154#elif (__FreeBSD_version <= 410000) |
165#define memcpy(d, s, len) bcopy((s),(d),(len)) 166#define memset(d, s, len) bzero((d),(len)) | 155#define memcpy(d, s, len) bcopy((s),(d),(len)) 156#define memset(d, s, len) bzero((d),(len)) |
167#endif 168#define ZeroMemory(a, b) memset((char *)a, 0, b) 169#define MemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (UINT)(c)) | 157#endif 158#define ZeroMemory(a, b) memset((char *)a, 0, b) 159#define MemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (UINT)(c)) |
170#define farMemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (UINT)c) | 160#define farMemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (UINT)c) |
171#define StrLen strlen 172 173/* 174 * we don't want whole hptintf.h in shared code... 175 * some constants must match that in hptintf.h! 176 */ | 161#define StrLen strlen 162 163/* 164 * we don't want whole hptintf.h in shared code... 165 * some constants must match that in hptintf.h! 166 */ |
177enum _driver_events_t { | 167enum _driver_events_t 168{ |
178 ET_DEVICE=0, | 169 ET_DEVICE=0, |
179 ET_DEVICE_REMOVED, 180 ET_DEVICE_PLUGGED, 181 ET_DEVICE_ERROR, 182 ET_REBUILD_STARTED, 183 ET_REBUILD_ABORTED, 184 ET_REBUILD_FINISHED, 185 ET_SPARE_TOOK_OVER, 186 ET_REBUILD_FAILED, | 170 ET_DEVICE_REMOVED, 171 ET_DEVICE_PLUGGED, 172 ET_DEVICE_ERROR, 173 ET_REBUILD_STARTED, 174 ET_REBUILD_ABORTED, 175 ET_REBUILD_FINISHED, 176 ET_SPARE_TOOK_OVER, 177 ET_REBUILD_FAILED, |
187 ET_VERIFY_STARTED, 188 ET_VERIFY_ABORTED, 189 ET_VERIFY_FAILED, 190 ET_VERIFY_FINISHED, 191 ET_INITIALIZE_STARTED, 192 ET_INITIALIZE_ABORTED, 193 ET_INITIALIZE_FAILED, 194 ET_INITIALIZE_FINISHED, 195 ET_VERIFY_DATA_ERROR, 196}; 197 | 178 ET_VERIFY_STARTED, 179 ET_VERIFY_ABORTED, 180 ET_VERIFY_FAILED, 181 ET_VERIFY_FINISHED, 182 ET_INITIALIZE_STARTED, 183 ET_INITIALIZE_ABORTED, 184 ET_INITIALIZE_FAILED, 185 ET_INITIALIZE_FINISHED, 186 ET_VERIFY_DATA_ERROR, 187}; 188 |
189#define StallExec(x) mvMicroSecondsDelay(x) |
|
198extern void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param); | 190extern void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param); |
199#define StallExec(x) mvMicroSecondsDelay(x) 200#define fNotifyGUI(WhatHappen, pVDevice) \ 201 ioctl_ReportEvent(WhatHappen, pVDevice) 202#define DECLARE_BUFFER(type, ptr) \ 203 UCHAR ptr##__buf[512]; \ 204 type ptr=(type)ptr##__buf | 191#define fNotifyGUI(WhatHappen, pVDevice) ioctl_ReportEvent(WhatHappen, pVDevice) 192#define DECLARE_BUFFER(type, ptr) UCHAR ptr##__buf[512]; type ptr=(type)ptr##__buf |
205 | 193 |
194int HPTLIBAPI fDeReadWrite(PDevice pDev, ULONG Lba, UCHAR Cmd, void *tmpBuffer); 195void HPTLIBAPI fDeSelectMode(PDevice pDev, UCHAR NewMode); 196 |
|
206#include <dev/hptmv/atapi.h> 207#include <dev/hptmv/command.h> 208#include <dev/hptmv/array.h> 209#include <dev/hptmv/raid5n.h> 210#include <dev/hptmv/vdevice.h> 211 | 197#include <dev/hptmv/atapi.h> 198#include <dev/hptmv/command.h> 199#include <dev/hptmv/array.h> 200#include <dev/hptmv/raid5n.h> 201#include <dev/hptmv/vdevice.h> 202 |
212int HPTLIBAPI fDeReadWrite(PDevice pDev, ULONG Lba, UCHAR Cmd, void *tmpBuffer); 213void HPTLIBAPI fDeSelectMode(PDevice pDev, UCHAR NewMode); | 203#if defined(__FreeBSD__) && defined(HPTLIBAPI) 204#undef HPTLIBAPI 205#define HPTLIBAPI 206#endif |
214 215#ifdef SUPPORT_ARRAY 216#define ArrayTables(i) ((PVDevice)&_vbus_(_ArrayTables)[i*ARRAY_VDEV_SIZE]) 217#endif 218 219#endif | 207 208#ifdef SUPPORT_ARRAY 209#define ArrayTables(i) ((PVDevice)&_vbus_(_ArrayTables)[i*ARRAY_VDEV_SIZE]) 210#endif 211 212#endif |