Import new version of the HPTMV driver from Highpoint. The major change
here is the support for amd64, as well as possible support for PAE. Many thanks to Highpoint for continuing to support FreeBSD. Obtained from: Steve Chang @ Highpoint MFC After: 3 days.
This commit is contained in:
parent
8d5d6a36cd
commit
d2bd3ab995
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149871
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
1906
sys/dev/hptmv/amd64-elf.raid.o.uu
Normal file
1906
sys/dev/hptmv/amd64-elf.raid.o.uu
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -62,6 +62,7 @@ typedef struct _RaidArray
|
||||
UCHAR reserve1;
|
||||
|
||||
ULONG dArStamp; /* array ID. all disks in a array has same ID */
|
||||
ULONG failedStamp; /* stamp for failed member */
|
||||
USHORT bStripeWitch; /* = (1 << BlockSizeShift) */
|
||||
|
||||
USHORT rf_broken: 1;
|
||||
@ -83,7 +84,7 @@ typedef struct _RaidArray
|
||||
|
||||
USHORT CriticalMembers; /* tell which member is critial */
|
||||
UCHAR last_read; /* for RAID 1 load banlancing */
|
||||
UCHAR pad1;
|
||||
UCHAR PrivateFlag1;
|
||||
|
||||
LBA_T RebuildSectors; /* how many sectors is OK (LBA on member disk) */
|
||||
|
||||
@ -151,7 +152,9 @@ typedef struct _ArrayDescript
|
||||
#define ArrayDescript_3_1_size 512
|
||||
|
||||
UCHAR bCheckSum31; /* new check sum */
|
||||
UCHAR reserve2[2];
|
||||
UCHAR PrivateFlag1; /* private */
|
||||
UCHAR reserve1;
|
||||
|
||||
#ifdef __BIG_ENDIAN_BITFIELD
|
||||
UCHAR df_read_ahead: 1; /* enable read ahead */
|
||||
UCHAR df_read_ahead_set: 1;
|
||||
@ -178,8 +181,13 @@ typedef struct _ArrayDescript
|
||||
}
|
||||
levelex[2];
|
||||
|
||||
ULONG failedStamp; /* array stamp for failed memebr */
|
||||
|
||||
} ArrayDescript;
|
||||
|
||||
/* report an error if ArrayDescript size exceed 512 */
|
||||
typedef char ArrayDescript_size_should_not_exceed_512[512-sizeof(ArrayDescript)];
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* Signature */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -267,39 +267,66 @@ typedef struct _ATAPI_REGISTERS_1 {
|
||||
#define ATAPI_FORMAT_UNIT 0x24
|
||||
#define ATAPI_INQUIRY 0x12
|
||||
#define ATAPI_MODE_SELECT 0x15
|
||||
#define ATAPI_RELEASE6 0x17
|
||||
#define ATAPI_MODE_SENSE 0x1A
|
||||
#define ATAPI_START_STOP_UNIT 0x1B
|
||||
#define ATAPI_LOAD_UNLOAD 0x1B
|
||||
#define ATAPI_RECEIVE_DIAGNOSTIC 0x1C
|
||||
#define ATAPI_SEND_DIAGNOSTIC 0x1D
|
||||
#define ATAPI_MEDIUM_REMOVAL 0x1E
|
||||
#define ATAPI_READ_FORMAT_CAPACITY 0x23
|
||||
#define ATAPI_READ_CAPACITY 0x25
|
||||
#define ATAPI_READ 0x28
|
||||
#define ATAPI_WRITE 0x2A
|
||||
#define ATAPI_SEEK 0x2B
|
||||
#define ATAPI_ERASE 0x2C
|
||||
#define ATAPI_VERIFY 0x2F
|
||||
#define ATAPI_WRITE_VERIFY 0x2E
|
||||
#define ATAPI_SYNCHRONIZE_CACHE 0x35
|
||||
#define ATAPI_LOCK_CACHE 0x36
|
||||
#define ATAPI_COMPARE 0x39
|
||||
#define ATAPI_WRITE_BUFFER 0x3B
|
||||
#define ATAPI_READ_DATA_BUFF 0x3C
|
||||
#define ATAPI_READ_SUB_CHANNEL 0x42
|
||||
#define ATAPI_READ_TOC 0x43
|
||||
#define ATAPI_READ_HEADER 0x44
|
||||
#define ATAPI_PLAY_AUDIO10 0x45
|
||||
#define ATAPI_GET_CONFIGURATION 0x46
|
||||
#define ATAPI_PLAY_AUDIO_MSF 0x47
|
||||
#define ATAPI_GET_EVENT_STATUS_NOTIFICATION 0x4A
|
||||
#define ATAPI_PAUSE_RESUME 0x4B
|
||||
#define ATAPI_LOG_SELECT 0x4C
|
||||
#define ATAPI_LOG_SENSE 0x4D
|
||||
#define ATAPI_STOP_PLAY_SCAN 0x4E
|
||||
#define ATAPI_READ_DISK_INFORMATION 0x51
|
||||
#define ATAPI_READ_TRACK_INFORMATION 0x52
|
||||
#define ATAPI_RESERVE_TRACK_RZONE 0x53
|
||||
#define ATAPI_SEND_OPC_INFORMATION 0x54
|
||||
#define ATAPI_MODE_SELECT10 0x55
|
||||
#define ATAPI_RELEASE10 0x57
|
||||
#define ATAPI_REPAIR_ZONE 0x58
|
||||
#define ATAPI_MODE_SENSE10 0x5A
|
||||
#define ATAPI_CLOSE_TRACK_SESSION 0x5B
|
||||
#define ATAPI_READ_BUFFER_CAPACITY 0x5C
|
||||
#define ATAPI_SEND_CUE_SHEET 0x5D
|
||||
#define ATAPI_BLANK_COMMAND 0xA1 /*Provide the ability to erase any part of a CD-RW disc.*/
|
||||
#define ATAPI_SEND_EVENT 0xA2 /* add for DVD */
|
||||
#define ATAPI_SEND_KEY 0xA3 /* add for DVD */
|
||||
#define ATAPI_REPORT_KEY 0xA4
|
||||
#define ATAPI_PLAY_AUDIO 0xA5
|
||||
#define ATAPI_LOAD_UNLOAD_MEDIUM 0xA6
|
||||
#define ATAPI_SET_READ_AHEAD 0xA7
|
||||
#define ATAPI_READ12 0xA8
|
||||
#define ATAPI_READ_DVD_STRUCTURE 0xAD
|
||||
#define ATAPI_WRITE12 0xAA
|
||||
#define ATAPI_GET_PERFORM_NOTIFICATION 0xAC /* add for DVD-RW */
|
||||
#define ATAPI_SET_STREAM 0xB6 /* add for DVD-RW */
|
||||
#define ATAPI_READ_CD_MSF 0xB9
|
||||
#define ATAPI_SET_CD_SPEED 0xBB
|
||||
#define ATAPI_SCAN 0xBA
|
||||
#define ATAPI_SET_SPEED 0xBB /* no payload */
|
||||
#define ATAPI_MECHANISM_STATUS 0xBD
|
||||
#define ATAPI_READ_CD 0xBE
|
||||
#define ATAPI_SEND_DVD_STRUCTURE 0xBF
|
||||
#define ATAPI_SET_CDRW_SPEED 0xDA /*WindowsXP need*/
|
||||
|
||||
#define MODE_DSP_WRITE_PROTECT 0x80
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
/*
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -32,11 +32,11 @@
|
||||
#include <dev/hptmv/mvSata.h>
|
||||
#include <dev/hptmv/mvStorageDev.h>
|
||||
|
||||
#define COMPANY "HighPoint Technologies, Inc."
|
||||
#define COPYRIGHT "(c) 2000-2004. HighPoint Technologies, Inc."
|
||||
#define COMPANY "HighPoint Technologies, Inc."
|
||||
#define COPYRIGHT "(c) 2000-2004. HighPoint Technologies, Inc."
|
||||
#define DRIVER_NAME "RocketRAID 182x SATA Controller driver"
|
||||
#define CONTROLLER_NAME "RocketRAID 182x SATA Controller"
|
||||
#define PROC_DIR_NAME hptmv
|
||||
#define CONTROLLER_NAME "RocketRAID 182x SATA Controller"
|
||||
#define PROC_DIR_NAME hptmv
|
||||
|
||||
#define HPT_INTERFACE_VERSION 0x01000003
|
||||
#define SUPPORT_48BIT_LBA
|
||||
@ -45,10 +45,8 @@
|
||||
#define _RAID5N_
|
||||
#define MAX_QUEUE_COMM 32
|
||||
#define MAX_SG_DESCRIPTORS 17
|
||||
#define MAX_VBUS 2 /*
|
||||
* One vbus per adapter in mv linux driver,
|
||||
* MAX_VBUS is defined for share code and can not be 1
|
||||
*/
|
||||
#define MAX_VBUS 2 /*one vbus per adapter in mv linux driver,
|
||||
MAX_VBUS is defined for share code and can not be 1*/
|
||||
|
||||
#define SET_VBUS_FOR_EACH_CONTROLLER
|
||||
#define MAX_MEMBERS 8
|
||||
@ -75,42 +73,42 @@ typedef struct _Device {
|
||||
UCHAR busyCount;
|
||||
|
||||
UCHAR df_tcq_set: 1;
|
||||
UCHAR df_tcq: 1; /* enable TCQ */
|
||||
UCHAR df_tcq: 1; /* enable TCQ */
|
||||
UCHAR df_ncq_set: 1;
|
||||
UCHAR df_ncq: 1; /* enable NCQ */
|
||||
UCHAR df_ncq: 1; /* enable NCQ */
|
||||
UCHAR df_write_cache_set: 1;
|
||||
UCHAR df_write_cache: 1; /* enable write cache */
|
||||
UCHAR df_write_cache: 1; /* enable write cache */
|
||||
UCHAR df_read_ahead_set: 1;
|
||||
UCHAR df_read_ahead: 1; /* enable read ahead */
|
||||
|
||||
UCHAR df_read_ahead: 1; /* enable read ahead */
|
||||
|
||||
UCHAR retryCount;
|
||||
UCHAR resetCount;
|
||||
UCHAR pad1;
|
||||
|
||||
|
||||
UCHAR df_user_mode_set;
|
||||
UCHAR bDeModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */
|
||||
UCHAR bDeUsable_Mode; /* actual maximum data transfer mode */
|
||||
UCHAR bDeModeSetting; /* Current Data Transfer mode: 0-4 PIO 0-4 */
|
||||
UCHAR bDeUsable_Mode; /* actual maximum data transfer mode */
|
||||
UCHAR bDeUserSelectMode;
|
||||
|
||||
|
||||
PVBus pVBus;
|
||||
ULONG dDeRealCapacity;
|
||||
ULONG dDeHiddenLba;
|
||||
ULONG HeadPosition;
|
||||
ULONG QueueLength;
|
||||
MV_SATA_CHANNEL *mv;
|
||||
} Device, *PDevice;
|
||||
}
|
||||
Device, *PDevice;
|
||||
|
||||
typedef struct _SCAT_GATH {
|
||||
ULONG_PTR dSgAddress;
|
||||
USHORT wSgSize;
|
||||
USHORT wSgFlag;
|
||||
typedef struct _SCAT_GATH
|
||||
{
|
||||
ULONG_PTR dSgAddress;
|
||||
USHORT wSgSize;
|
||||
USHORT wSgFlag;
|
||||
} SCAT_GATH, FAR *FPSCAT_GATH;
|
||||
|
||||
#define OS_VDEV_EXT
|
||||
typedef struct _VDevice_Ext {
|
||||
#if defined(WIN95) && defined(SUPPORT_HOTSWAP)
|
||||
DCB * pDcb;
|
||||
#endif
|
||||
typedef struct _VDevice_Ext
|
||||
{
|
||||
UCHAR gui_locked; /* the device is locked by GUI */
|
||||
UCHAR reserve[3];
|
||||
} VDevice_Ext, *PVDevice_Ext;
|
||||
@ -119,21 +117,12 @@ typedef struct _VDevice_Ext {
|
||||
#define SG_FLAG_SKIP 0x4000
|
||||
#define SG_FLAG_EOT 0x8000
|
||||
|
||||
#if 0 /* MAX_VBUS==1 */
|
||||
#define _VBUS_ARG
|
||||
#define _VBUS_ARG0 void
|
||||
#define _VBUS_P
|
||||
#define _VBUS_P0
|
||||
#define _VBUS_INST(x)
|
||||
#define _vbus_(x) x
|
||||
#else
|
||||
#define _VBUS_ARG0 PVBus _vbus_p
|
||||
#define _VBUS_ARG PVBus _vbus_p,
|
||||
#define _VBUS_P _vbus_p,
|
||||
#define _VBUS_P0 _vbus_p
|
||||
#define _VBUS_INST(x) PVBus _vbus_p = x;
|
||||
#define _vbus_(x) (_vbus_p->x)
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
* arithmetic functions
|
||||
@ -156,34 +145,36 @@ int HPTLIBAPI os_memcmp(const void *cs, const void *ct, unsigned len);
|
||||
void HPTLIBAPI os_memcpy(void *to, const void *from, unsigned len);
|
||||
void HPTLIBAPI os_memset(void *s, char c, unsigned len);
|
||||
unsigned HPTLIBAPI os_strlen(const char *s);
|
||||
|
||||
#ifdef NO_LIBC
|
||||
#define memcmp os_memcmp
|
||||
#define memcpy os_memcpy
|
||||
#define memset os_memset
|
||||
#define strlen os_strlen
|
||||
#elif (__FreeBSD_version <= 410000)
|
||||
#define memcpy(d, s, len) bcopy((s),(d),(len))
|
||||
#define memset(d, s, len) bzero((d),(len))
|
||||
#define memcpy(d, s, len) bcopy((s),(d),(len))
|
||||
#define memset(d, s, len) bzero((d),(len))
|
||||
#endif
|
||||
#define ZeroMemory(a, b) memset((char *)a, 0, b)
|
||||
#define MemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (UINT)(c))
|
||||
#define farMemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (UINT)c)
|
||||
#define farMemoryCopy(a,b,c) memcpy((char *)(a), (char *)(b), (UINT)c)
|
||||
#define StrLen strlen
|
||||
|
||||
/*
|
||||
* we don't want whole hptintf.h in shared code...
|
||||
* some constants must match that in hptintf.h!
|
||||
*/
|
||||
enum _driver_events_t {
|
||||
enum _driver_events_t
|
||||
{
|
||||
ET_DEVICE=0,
|
||||
ET_DEVICE_REMOVED,
|
||||
ET_DEVICE_PLUGGED,
|
||||
ET_DEVICE_ERROR,
|
||||
ET_REBUILD_STARTED,
|
||||
ET_REBUILD_ABORTED,
|
||||
ET_REBUILD_FINISHED,
|
||||
ET_SPARE_TOOK_OVER,
|
||||
ET_REBUILD_FAILED,
|
||||
ET_DEVICE_REMOVED,
|
||||
ET_DEVICE_PLUGGED,
|
||||
ET_DEVICE_ERROR,
|
||||
ET_REBUILD_STARTED,
|
||||
ET_REBUILD_ABORTED,
|
||||
ET_REBUILD_FINISHED,
|
||||
ET_SPARE_TOOK_OVER,
|
||||
ET_REBUILD_FAILED,
|
||||
ET_VERIFY_STARTED,
|
||||
ET_VERIFY_ABORTED,
|
||||
ET_VERIFY_FAILED,
|
||||
@ -195,13 +186,13 @@ enum _driver_events_t {
|
||||
ET_VERIFY_DATA_ERROR,
|
||||
};
|
||||
|
||||
#define StallExec(x) mvMicroSecondsDelay(x)
|
||||
extern void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param);
|
||||
#define StallExec(x) mvMicroSecondsDelay(x)
|
||||
#define fNotifyGUI(WhatHappen, pVDevice) \
|
||||
ioctl_ReportEvent(WhatHappen, pVDevice)
|
||||
#define DECLARE_BUFFER(type, ptr) \
|
||||
UCHAR ptr##__buf[512]; \
|
||||
type ptr=(type)ptr##__buf
|
||||
#define fNotifyGUI(WhatHappen, pVDevice) ioctl_ReportEvent(WhatHappen, pVDevice)
|
||||
#define DECLARE_BUFFER(type, ptr) UCHAR ptr##__buf[512]; type ptr=(type)ptr##__buf
|
||||
|
||||
int HPTLIBAPI fDeReadWrite(PDevice pDev, ULONG Lba, UCHAR Cmd, void *tmpBuffer);
|
||||
void HPTLIBAPI fDeSelectMode(PDevice pDev, UCHAR NewMode);
|
||||
|
||||
#include <dev/hptmv/atapi.h>
|
||||
#include <dev/hptmv/command.h>
|
||||
@ -209,8 +200,10 @@ extern void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param);
|
||||
#include <dev/hptmv/raid5n.h>
|
||||
#include <dev/hptmv/vdevice.h>
|
||||
|
||||
int HPTLIBAPI fDeReadWrite(PDevice pDev, ULONG Lba, UCHAR Cmd, void *tmpBuffer);
|
||||
void HPTLIBAPI fDeSelectMode(PDevice pDev, UCHAR NewMode);
|
||||
#if defined(__FreeBSD__) && defined(HPTLIBAPI)
|
||||
#undef HPTLIBAPI
|
||||
#define HPTLIBAPI
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_ARRAY
|
||||
#define ArrayTables(i) ((PVDevice)&_vbus_(_ArrayTables)[i*ARRAY_VDEV_SIZE])
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -42,6 +42,10 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#define __KERNEL__
|
||||
#endif
|
||||
|
||||
#include <dev/hptmv/global.h>
|
||||
#include <dev/hptmv/hptintf.h>
|
||||
#include <dev/hptmv/osbsd.h>
|
||||
@ -59,7 +63,8 @@ static int hpt_remove_spare_disk(_VBUS_ARG DEVICEID idDisk);
|
||||
static int hpt_set_array_info(_VBUS_ARG DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo);
|
||||
static int hpt_set_device_info(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo);
|
||||
|
||||
int check_VDevice_valid(PVDevice p)
|
||||
int
|
||||
check_VDevice_valid(PVDevice p)
|
||||
{
|
||||
int i;
|
||||
PVDevice pVDevice;
|
||||
@ -228,7 +233,7 @@ static void get_array_info(PVDevice pVDevice, PLOGICAL_DEVICE_INFO pInfo)
|
||||
|
||||
for(i = 0; i < pVDevice->u.array.bArnMember; i++)
|
||||
{
|
||||
if(pVDevice->u.array.pMember[i] != NULL)
|
||||
if(pVDevice->u.array.pMember[i] != 0)
|
||||
{
|
||||
pInfo->u.array.Members[pInfo->u.array.nDisk] = VDEV_TO_ID(pVDevice->u.array.pMember[i]);
|
||||
pInfo->u.array.nDisk++;
|
||||
@ -318,7 +323,7 @@ static int get_disk_info(PVDevice pVDevice, PLOGICAL_DEVICE_INFO pInfo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap)
|
||||
int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap)
|
||||
{
|
||||
ZeroMemory(cap, sizeof(DRIVER_CAPABILITIES));
|
||||
cap->dwSize = sizeof(DRIVER_CAPABILITIES);
|
||||
@ -336,9 +341,6 @@ static int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap)
|
||||
cap->MaximumArrayNameLength = MAX_ARRAY_NAME - 1;
|
||||
cap->SupportDedicatedSpare = 0;
|
||||
|
||||
#ifdef SUPPORT_HOTSWAP
|
||||
cap->SupportHotSwap = 1;
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_ARRAY
|
||||
/* Stripe */
|
||||
@ -350,7 +352,7 @@ static int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap)
|
||||
/* Mirror + Stripe */
|
||||
#ifdef ARRAY_V2_ONLY
|
||||
cap->SupportedRAIDTypes[2] = (AT_RAID1<<4)|AT_RAID0; /* RAID0/1 */
|
||||
#else
|
||||
#else
|
||||
cap->SupportedRAIDTypes[2] = (AT_RAID0<<4)|AT_RAID1; /* RAID1/0 */
|
||||
#endif
|
||||
cap->MaximumArrayMembers[2] = MAX_MEMBERS;
|
||||
@ -362,16 +364,11 @@ static int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap)
|
||||
cap->SupportedRAIDTypes[4] = AT_RAID5;
|
||||
cap->MaximumArrayMembers[4] = MAX_MEMBERS;
|
||||
#endif
|
||||
#if 0 /* don't let GUI create RAID 0/1. */
|
||||
/* Stripe + Mirror */
|
||||
cap->SupportedRAIDTypes[5] = (AT_RAID1<<4)|AT_RAID0;
|
||||
cap->MaximumArrayMembers[5] = 4;
|
||||
#endif
|
||||
#endif /* SUPPORT_ARRAY */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_get_controller_count(void)
|
||||
int hpt_get_controller_count(void)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapTemp = gIal_Adapter;
|
||||
int iControllerCount = 0;
|
||||
@ -385,7 +382,7 @@ static int hpt_get_controller_count(void)
|
||||
return iControllerCount;
|
||||
}
|
||||
|
||||
static int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo)
|
||||
int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapTemp;
|
||||
int iControllerCount = 0;
|
||||
@ -403,7 +400,7 @@ static int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo)
|
||||
#endif
|
||||
strcpy(pInfo->szProductID, GUI_CONTROLLER_NAME);
|
||||
#define _set_product_id(x)
|
||||
#else
|
||||
#else
|
||||
#define _set_product_id(x) strcpy(pInfo->szProductID, x)
|
||||
#endif
|
||||
_set_product_id("RocketRAID 182x SATA Controller");
|
||||
@ -416,7 +413,7 @@ static int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo)
|
||||
}
|
||||
|
||||
|
||||
static int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo)
|
||||
int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapTemp = gIal_Adapter;
|
||||
int i,iControllerCount = 0;
|
||||
@ -449,7 +446,7 @@ static int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo)
|
||||
|
||||
}
|
||||
|
||||
static int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount)
|
||||
int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount)
|
||||
{
|
||||
int count = 0;
|
||||
int i,j;
|
||||
@ -482,11 +479,11 @@ static int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount)
|
||||
return count;
|
||||
}
|
||||
|
||||
static int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo)
|
||||
int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo)
|
||||
{
|
||||
PVDevice pVDevice = ID_TO_VDEV(id);
|
||||
|
||||
if((id == HPT_NULL_ID) || check_VDevice_valid(pVDevice))
|
||||
if((id == 0) || check_VDevice_valid(pVDevice))
|
||||
return -1;
|
||||
|
||||
#ifdef SUPPORT_ARRAY
|
||||
@ -500,15 +497,12 @@ static int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo)
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_ARRAY
|
||||
static DEVICEID hpt_create_array(_VBUS_ARG PCREATE_ARRAY_PARAMS pParam)
|
||||
DEVICEID hpt_create_array(_VBUS_ARG PCREATE_ARRAY_PARAMS pParam)
|
||||
{
|
||||
ULONG Stamp = GetStamp();
|
||||
int i,j;
|
||||
ULONG capacity = MAX_LBA_T;
|
||||
PVDevice pArray,pChild;
|
||||
#if MAX_VBUS==1
|
||||
PVBus _vbus_p = NULL;
|
||||
#endif
|
||||
int Loca = -1;
|
||||
|
||||
for(i = 0; i < pParam->nDisk; i++)
|
||||
@ -758,9 +752,7 @@ int old_add_disk_to_raid01(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
|
||||
int i;
|
||||
IAL_ADAPTER_T *pAdapter = gIal_Adapter;
|
||||
|
||||
#if MAX_VBUS>1
|
||||
if (pArray1->pVBus!=_vbus_p) { HPT_ASSERT(0); return -1;}
|
||||
#endif
|
||||
|
||||
if(pDisk->u.disk.dDeRealCapacity < (pArray1->VDeviceCapacity / 2))
|
||||
return -1;
|
||||
@ -834,7 +826,7 @@ int hpt_add_disk_to_array(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
|
||||
PVDevice pArray = ID_TO_VDEV(idArray);
|
||||
PVDevice pDisk = ID_TO_VDEV(idDisk);
|
||||
|
||||
if((idArray == HPT_NULL_ID) || (idDisk == HPT_NULL_ID)) return -1;
|
||||
if((idArray == 0) || (idDisk == 0)) return -1;
|
||||
if(check_VDevice_valid(pArray) || check_VDevice_valid(pDisk)) return -1;
|
||||
if(!pArray->u.array.rf_broken) return -1;
|
||||
|
||||
@ -864,9 +856,7 @@ int hpt_add_disk_to_array(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
|
||||
else
|
||||
if(pDisk->VDeviceCapacity < Capacity) return -1;
|
||||
|
||||
#if MAX_VBUS>1
|
||||
if (pArray->pVBus!=_vbus_p) { HPT_ASSERT(0); return -1;}
|
||||
#endif
|
||||
|
||||
for(i = 0; i < pArray->u.array.bArnMember; i++)
|
||||
if((pArray->u.array.pMember[i] == NULL) || !pArray->u.array.pMember[i]->vf_online)
|
||||
@ -907,19 +897,16 @@ int hpt_add_disk_to_array(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_add_spare_disk(_VBUS_ARG DEVICEID idDisk)
|
||||
int hpt_add_spare_disk(_VBUS_ARG DEVICEID idDisk)
|
||||
{
|
||||
PVDevice pVDevice = ID_TO_VDEV(idDisk);
|
||||
DECLARE_BUFFER(PUCHAR, pbuffer);
|
||||
|
||||
if(idDisk == HPT_NULL_ID || check_VDevice_valid(pVDevice))
|
||||
return -1;
|
||||
if(idDisk == 0 || check_VDevice_valid(pVDevice)) return -1;
|
||||
if (pVDevice->VDeviceType != VD_SINGLE_DISK || pVDevice->pParent)
|
||||
return -1;
|
||||
|
||||
#if MAX_VBUS>1
|
||||
if (pVDevice->u.disk.pVBus!=_vbus_p) return -1;
|
||||
#endif
|
||||
|
||||
UnregisterVDevice(pVDevice);
|
||||
pVDevice->VDeviceType = VD_SPARE;
|
||||
@ -931,15 +918,13 @@ static int hpt_add_spare_disk(_VBUS_ARG DEVICEID idDisk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_remove_spare_disk(_VBUS_ARG DEVICEID idDisk)
|
||||
int hpt_remove_spare_disk(_VBUS_ARG DEVICEID idDisk)
|
||||
{
|
||||
PVDevice pVDevice = ID_TO_VDEV(idDisk);
|
||||
|
||||
if(idDisk == 0 || check_VDevice_valid(pVDevice)) return -1;
|
||||
|
||||
#if MAX_VBUS>1
|
||||
if (pVDevice->u.disk.pVBus!=_vbus_p) return -1;
|
||||
#endif
|
||||
|
||||
pVDevice->VDeviceType = VD_SINGLE_DISK;
|
||||
|
||||
@ -948,19 +933,17 @@ static int hpt_remove_spare_disk(_VBUS_ARG DEVICEID idDisk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_set_array_info(_VBUS_ARG DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo)
|
||||
int hpt_set_array_info(_VBUS_ARG DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo)
|
||||
{
|
||||
PVDevice pVDevice = ID_TO_VDEV(idArray);
|
||||
|
||||
if(idArray == HPT_NULL_ID || check_VDevice_valid(pVDevice)) return -1;
|
||||
if(idArray == 0 || check_VDevice_valid(pVDevice)) return -1;
|
||||
if (!mIsArray(pVDevice)) return -1;
|
||||
|
||||
/* if the pVDevice isn't a top level, return -1; */
|
||||
if(pVDevice->pParent != NULL) return -1;
|
||||
|
||||
#if MAX_VBUS>1
|
||||
if (pVDevice->pVBus!=_vbus_p) { HPT_ASSERT(0); return -1;}
|
||||
#endif
|
||||
|
||||
if (pInfo->ValidFields & AAIF_NAME) {
|
||||
memset(pVDevice->u.array.ArrayName, 0, MAX_ARRAY_NAME);
|
||||
@ -978,12 +961,12 @@ static int hpt_set_array_info(_VBUS_ARG DEVICEID idArray, PALTERABLE_ARRAY_INFO
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_set_device_info(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo)
|
||||
int hpt_set_device_info(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo)
|
||||
{
|
||||
PVDevice pVDevice = ID_TO_VDEV(idDisk);
|
||||
|
||||
/* stop buzzer. */
|
||||
if(idDisk == HPT_NULL_ID) {
|
||||
if(idDisk == 0) {
|
||||
#ifndef FOR_DEMO
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
for (pAdapter=gIal_Adapter; pAdapter; pAdapter=pAdapter->next) {
|
||||
@ -1000,9 +983,7 @@ static int hpt_set_device_info(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO
|
||||
if (mIsArray(pVDevice))
|
||||
return -1;
|
||||
|
||||
#if MAX_VBUS>1
|
||||
if (pVDevice->u.disk.pVBus!=_vbus_p) return -1;
|
||||
#endif
|
||||
|
||||
/* if (pInfo->ValidFields & ADIF_MODE) {
|
||||
pVDevice->u.disk.bDeModeSetting = pInfo->DeviceModeSetting;
|
||||
@ -1013,7 +994,7 @@ static int hpt_set_device_info(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO
|
||||
}*/
|
||||
return 0;
|
||||
}
|
||||
#endif /* SUPPORT_ARRAY */
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_HPT601
|
||||
int hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo)
|
||||
@ -1257,12 +1238,10 @@ int hpt_default_ioctl(_VBUS_ARG
|
||||
while(pAdapter != 0)
|
||||
{
|
||||
pVBus = &pAdapter->VBus;
|
||||
for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++)
|
||||
for(i = 0; i < MAX_ARRAY_PER_VBUS; i++)
|
||||
{
|
||||
if(!(pTop = pVBus->pVDevice[i])) continue;
|
||||
#if MAX_VBUS>1
|
||||
if (pTop->pVBus!=_vbus_p) return -1;
|
||||
#endif
|
||||
while (pTop->pParent) pTop = pTop->pParent;
|
||||
if (id==0 && pTop->vf_bootmark)
|
||||
pTop->vf_bootmark = 0;
|
||||
@ -1277,10 +1256,9 @@ int hpt_default_ioctl(_VBUS_ARG
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* SUPPORT_ARRAY */
|
||||
#endif
|
||||
case HPT_IOCTL_RESCAN_DEVICES:
|
||||
{
|
||||
fRescanAllDevice(_VBUS_P0);
|
||||
if (nInBufferSize!=0) return -1;
|
||||
if (nOutBufferSize!=0) return -1;
|
||||
fRescanAllDevice(_VBUS_P0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
/*
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -162,7 +162,7 @@ typedef DWORD DEVICEID;
|
||||
* It would be better if ioctl code are the same on different platforms,
|
||||
* but we must not conflict with system defined ioctl code.
|
||||
************************************************************************/
|
||||
#if defined(LINUX) || defined(__FreeBSD_version)
|
||||
#if defined(LINUX) || defined(__FreeBSD_version) || defined(_MACOSX_)
|
||||
#define HPT_CTL_CODE(x) (x+0xFF00)
|
||||
#elif defined(_MS_WIN32_) || defined(WIN32)
|
||||
|
||||
@ -327,7 +327,6 @@ typedef struct _CHANNEL_INFO {
|
||||
* time represented in DWORD format
|
||||
*/
|
||||
#ifndef __KERNEL__
|
||||
#error "BAM"
|
||||
typedef struct _TIME_RECORD {
|
||||
UINT seconds:6; /* 0 - 59 */
|
||||
UINT minutes:6; /* 0 - 59 */
|
||||
@ -399,7 +398,6 @@ typedef struct _HPT_ARRAY_INFO_V2 {
|
||||
* ATA/ATAPI Device identify data without the Reserved4.
|
||||
*/
|
||||
#ifndef __KERNEL__
|
||||
#error "BAM"
|
||||
typedef struct _IDENTIFY_DATA2 {
|
||||
USHORT GeneralConfiguration; /* 00 00 */
|
||||
USHORT NumberOfCylinders; /* 02 1 */
|
||||
@ -781,7 +779,7 @@ HPT_IOCTL_PARAM32, *PHPT_IOCTL_PARAM32;
|
||||
* Returns:
|
||||
* interface version. 0 when fail.
|
||||
*/
|
||||
DWORD hpt_get_version(void);
|
||||
DWORD hpt_get_version();
|
||||
|
||||
/*-------------------------------------------------------------------------- */
|
||||
|
||||
@ -807,7 +805,7 @@ int hpt_get_driver_capabilities(PDRIVER_CAPABILITIES cap);
|
||||
* Returns:
|
||||
* number of controllers
|
||||
*/
|
||||
int hpt_get_controller_count(void);
|
||||
int hpt_get_controller_count();
|
||||
|
||||
/*-------------------------------------------------------------------------- */
|
||||
|
||||
@ -1049,7 +1047,7 @@ int hpt_set_device_info_v2(DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo);
|
||||
* Returns:
|
||||
* 0 Success
|
||||
*/
|
||||
int hpt_rescan_devices(void);
|
||||
int hpt_rescan_devices();
|
||||
/*-------------------------------------------------------------------------- */
|
||||
|
||||
/* hpt_get_601_info
|
||||
@ -1210,59 +1208,5 @@ int hpt_remove_devices(DWORD ndev, DEVICEID *pIds);
|
||||
|
||||
#endif
|
||||
|
||||
#if BITS_PER_LONG > 32
|
||||
#define VDEV_TO_ID(pVDev) (DEVICEID)(ULONG_PTR)(pVDev)
|
||||
#define ID_TO_VDEV(id) (PVDevice)(((ULONG_PTR)gIal_Adapter & 0xffffffff00000000) | (id))
|
||||
#else
|
||||
#define VDEV_TO_ID(pVDev) (DEVICEID)(pVDev)
|
||||
#define ID_TO_VDEV(id) (PVDevice)(id)
|
||||
#endif
|
||||
|
||||
#define INVALID_DEVICEID (-1)
|
||||
#define INVALID_STRIPSIZE (-1)
|
||||
|
||||
#define shortswap(w) ((WORD)((w)>>8 | ((w) & 0xFF)<<8))
|
||||
|
||||
#ifndef MinBlockSizeShift
|
||||
#define MinBlockSizeShift 5
|
||||
#define MaxBlockSizeShift 12
|
||||
#endif
|
||||
|
||||
typedef struct _HPT_IOCTL_TRANSFER_PARAM
|
||||
{
|
||||
ULONG nInBufferSize;
|
||||
ULONG nOutBufferSize;
|
||||
UCHAR buffer[0];
|
||||
}HPT_IOCTL_TRANSFER_PARAM, *PHPT_IOCTL_TRANSFER_PARAM;
|
||||
|
||||
typedef struct _HPT_SET_STATE_PARAM
|
||||
{
|
||||
DEVICEID idArray;
|
||||
DWORD state;
|
||||
} HPT_SET_STATE_PARAM, *PHPT_SET_STATE_PARAM;
|
||||
|
||||
typedef struct _HPT_SET_ARRAY_INFO
|
||||
{
|
||||
DEVICEID idArray;
|
||||
ALTERABLE_ARRAY_INFO Info;
|
||||
} HPT_SET_ARRAY_INFO, *PHPT_SET_ARRAY_INFO;
|
||||
|
||||
typedef struct _HPT_SET_DEVICE_INFO
|
||||
{
|
||||
DEVICEID idDisk;
|
||||
ALTERABLE_DEVICE_INFO Info;
|
||||
} HPT_SET_DEVICE_INFO, *PHPT_SET_DEVICE_INFO;
|
||||
|
||||
typedef struct _HPT_ADD_DISK_TO_ARRAY
|
||||
{
|
||||
DEVICEID idArray;
|
||||
DEVICEID idDisk;
|
||||
} HPT_ADD_DISK_TO_ARRAY, *PHPT_ADD_DISK_TO_ARRAY;
|
||||
|
||||
int check_VDevice_valid(PVDevice);
|
||||
int hpt_default_ioctl(_VBUS_ARG DWORD, PVOID, DWORD, PVOID, DWORD, PDWORD);
|
||||
|
||||
#define HPT_NULL_ID 0
|
||||
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -35,6 +35,10 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#define __KERNEL__
|
||||
#endif
|
||||
|
||||
#include <dev/hptmv/global.h>
|
||||
#include <dev/hptmv/hptintf.h>
|
||||
#include <dev/hptmv/osbsd.h>
|
||||
@ -45,13 +49,15 @@ int hpt_rescan_all(void);
|
||||
/***************************************************************************/
|
||||
|
||||
static char hptproc_buffer[256];
|
||||
extern char DRIVER_VERSION[];
|
||||
|
||||
#define FORMAL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
|
||||
struct sysctl_req *req
|
||||
#define REAL_HANDLER_ARGS oidp, arg1, arg2, req
|
||||
typedef struct sysctl_req HPT_GET_INFO;
|
||||
|
||||
static int hpt_set_asc_info(IAL_ADAPTER_T *pAdapter, char *buffer,int length)
|
||||
static int
|
||||
hpt_set_asc_info(IAL_ADAPTER_T *pAdapter, char *buffer,int length)
|
||||
{
|
||||
int orig_length = length+4;
|
||||
PVBus _vbus_p = &pAdapter->VBus;
|
||||
@ -118,7 +124,7 @@ static int hpt_set_asc_info(IAL_ADAPTER_T *pAdapter, char *buffer,int length)
|
||||
if(pVDev == _vbus_p->pVDevice[i])
|
||||
{
|
||||
periph = hpt_get_periph(pAdapter->mvSataAdapter.adapterId,i);
|
||||
if (periph != NULL && periph->refcount == 1)
|
||||
if (periph != NULL && periph->refcount >= 1)
|
||||
{
|
||||
hpt_printk(("Can not use disk used by OS!\n"));
|
||||
return -EINVAL;
|
||||
@ -138,9 +144,9 @@ static int hpt_set_asc_info(IAL_ADAPTER_T *pAdapter, char *buffer,int length)
|
||||
unlock_driver(oldspl);
|
||||
return -EINVAL;
|
||||
}
|
||||
pArray->u.array.rf_auto_rebuild = 0;
|
||||
pArray->u.array.rf_abort_rebuild = 0;
|
||||
hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pArray, DUPLICATE);
|
||||
pSubArray->u.array.rf_auto_rebuild = 0;
|
||||
pSubArray->u.array.rf_abort_rebuild = 0;
|
||||
hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, pSubArray, DUPLICATE);
|
||||
unlock_driver(oldspl);
|
||||
break;
|
||||
}
|
||||
@ -225,7 +231,7 @@ static int hpt_set_asc_info(IAL_ADAPTER_T *pAdapter, char *buffer,int length)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif /* SUPPORT_ARRAY */
|
||||
#endif
|
||||
if (0) {} /* just to compile */
|
||||
#if DBGUG
|
||||
else if (length>=9 && strncmp(buffer, "dbglevel ", 9)==0) {
|
||||
@ -239,7 +245,7 @@ static int hpt_set_asc_info(IAL_ADAPTER_T *pAdapter, char *buffer,int length)
|
||||
else if (length>=8 && strncmp(buffer, "disable ", 8)==0) {
|
||||
/* TO DO */
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -248,7 +254,8 @@ static int hpt_set_asc_info(IAL_ADAPTER_T *pAdapter, char *buffer,int length)
|
||||
* Since we have only one sysctl node, add adapter ID in the command
|
||||
* line string: e.g. "hpt 0 rebuild start"
|
||||
*/
|
||||
static int hpt_set_info(int length)
|
||||
static int
|
||||
hpt_set_info(int length)
|
||||
{
|
||||
int retval;
|
||||
|
||||
@ -256,7 +263,7 @@ static int hpt_set_info(int length)
|
||||
PUCHAR ke_area;
|
||||
int err;
|
||||
DWORD dwRet;
|
||||
PHPT_IOCTL_PARAM32 piop;
|
||||
PHPT_IOCTL_PARAM piop;
|
||||
#endif
|
||||
char *buffer = hptproc_buffer;
|
||||
if (length >= 6) {
|
||||
@ -270,14 +277,14 @@ static int hpt_set_info(int length)
|
||||
return -EINVAL;
|
||||
}
|
||||
#ifdef SUPPORT_IOCTL
|
||||
piop = (PHPT_IOCTL_PARAM32)buffer;
|
||||
piop = (PHPT_IOCTL_PARAM)buffer;
|
||||
if (piop->Magic == HPT_IOCTL_MAGIC) {
|
||||
KdPrintE(("ioctl=%d in=%x len=%d out=%x len=%ld\n",
|
||||
KdPrintE(("ioctl=%d in=%p len=%d out=%p len=%d\n",
|
||||
piop->dwIoControlCode,
|
||||
piop->lpInBuffer,
|
||||
piop->nInBufferSize,
|
||||
piop->lpOutBuffer,
|
||||
(u_long)piop->nOutBufferSize));
|
||||
piop->nOutBufferSize));
|
||||
|
||||
/*
|
||||
* map buffer to kernel.
|
||||
@ -293,28 +300,22 @@ static int hpt_set_info(int length)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = 0;
|
||||
if (piop->nInBufferSize)
|
||||
err = copyin((void*)(ULONG_PTR)piop->lpInBuffer, ke_area, piop->nInBufferSize);
|
||||
copyin((void*)(ULONG_PTR)piop->lpInBuffer, ke_area, piop->nInBufferSize);
|
||||
|
||||
/*
|
||||
* call kernel handler.
|
||||
*/
|
||||
if (err==0)
|
||||
err = Kernel_DeviceIoControl(&gIal_Adapter->VBus,
|
||||
piop->dwIoControlCode, ke_area, piop->nInBufferSize,
|
||||
ke_area + piop->nInBufferSize, piop->nOutBufferSize, &dwRet);
|
||||
err = Kernel_DeviceIoControl(&gIal_Adapter->VBus,
|
||||
piop->dwIoControlCode, ke_area, piop->nInBufferSize,
|
||||
ke_area + piop->nInBufferSize, piop->nOutBufferSize, &dwRet);
|
||||
|
||||
if (err==0) {
|
||||
if (piop->nOutBufferSize) {
|
||||
err = copyout(ke_area + piop->nInBufferSize, (void*)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize);
|
||||
if (err) KdPrintW(("Kernel_ioctl(): copyout (1) return %d\n", err));
|
||||
}
|
||||
if (piop->nOutBufferSize)
|
||||
copyout(ke_area + piop->nInBufferSize, (void*)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize);
|
||||
|
||||
if (piop->lpBytesReturned) {
|
||||
err = copyout(&dwRet, (void*)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD));
|
||||
if (err) KdPrintW(("Kernel_ioctl(): copyout (2) return %d\n", err));
|
||||
}
|
||||
if (piop->lpBytesReturned)
|
||||
copyout(&dwRet, (void*)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD));
|
||||
|
||||
free(ke_area, M_DEVBUF);
|
||||
return length;
|
||||
@ -335,7 +336,8 @@ static int hpt_set_info(int length)
|
||||
|
||||
#define shortswap(w) ((WORD)((w)>>8 | ((w) & 0xFF)<<8))
|
||||
|
||||
static void get_disk_name(char *name, PDevice pDev)
|
||||
static void
|
||||
get_disk_name(char *name, PDevice pDev)
|
||||
{
|
||||
int i;
|
||||
MV_SATA_CHANNEL *pMvSataChannel = pDev->mv;
|
||||
@ -346,7 +348,8 @@ static void get_disk_name(char *name, PDevice pDev)
|
||||
name[20] = '\0';
|
||||
}
|
||||
|
||||
static int hpt_copy_info(HPT_GET_INFO *pinfo, char *fmt, ...)
|
||||
static int
|
||||
hpt_copy_info(HPT_GET_INFO *pinfo, char *fmt, ...)
|
||||
{
|
||||
int printfretval;
|
||||
va_list ap;
|
||||
@ -364,28 +367,38 @@ static int hpt_copy_info(HPT_GET_INFO *pinfo, char *fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
static void hpt_copy_disk_info(HPT_GET_INFO *pinfo, PVDevice pVDev, UINT iChan)
|
||||
static void
|
||||
hpt_copy_disk_info(HPT_GET_INFO *pinfo, PVDevice pVDev, UINT iChan)
|
||||
{
|
||||
char name[32], arrayname[16];
|
||||
|
||||
get_disk_name(name, &pVDev->u.disk);
|
||||
char name[32], arrayname[16], *status;
|
||||
|
||||
#ifdef SUPPORT_ARRAY
|
||||
if(pVDev->pParent)
|
||||
get_disk_name(name, &pVDev->u.disk);
|
||||
|
||||
if (!pVDev->u.disk.df_on_line)
|
||||
status = "Disabled";
|
||||
else if (pVDev->VDeviceType==VD_SPARE)
|
||||
status = "Spare ";
|
||||
else
|
||||
status = "Normal ";
|
||||
|
||||
#ifdef SUPPORT_ARRAY
|
||||
if(pVDev->pParent) {
|
||||
memcpy(arrayname, pVDev->pParent->u.array.ArrayName, MAX_ARRAY_NAME);
|
||||
if (pVDev->pParent->u.array.CriticalMembers & (1<<pVDev->bSerialNumber))
|
||||
status = "Degraded";
|
||||
}
|
||||
else
|
||||
#endif
|
||||
arrayname[0]=0;
|
||||
arrayname[0]=0;
|
||||
|
||||
hpt_copy_info(pinfo, "Channel %d %s %5dMB %s %s\n",
|
||||
iChan+1,
|
||||
name, pVDev->VDeviceCapacity>>11,
|
||||
((!pVDev->u.disk.df_on_line)? "Disabled" :
|
||||
((pVDev->VDeviceType != VD_SPARE)?"Normal ":"Spare ")), arrayname);
|
||||
name, pVDev->VDeviceCapacity>>11, status, arrayname);
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_ARRAY
|
||||
static void hpt_copy_array_info(HPT_GET_INFO *pinfo, int nld, PVDevice pArray)
|
||||
static void
|
||||
hpt_copy_array_info(HPT_GET_INFO *pinfo, int nld, PVDevice pArray)
|
||||
{
|
||||
int i;
|
||||
char *sType=0, *sStatus=0;
|
||||
@ -438,7 +451,7 @@ static void hpt_copy_array_info(HPT_GET_INFO *pinfo, int nld, PVDevice pArray)
|
||||
if (pTmpArray->u.array.rf_rebuilding) {
|
||||
#ifdef DEBUG
|
||||
sprintf(buf, "Rebuilding %dMB", (pTmpArray->u.array.RebuildSectors>>11));
|
||||
#else
|
||||
#else
|
||||
sprintf(buf, "Rebuilding %d%%", (pTmpArray->u.array.RebuildSectors>>11)*100/((pTmpArray->VDeviceCapacity/(pTmpArray->u.array.bArnMember-1))>>11));
|
||||
#endif
|
||||
sStatus = buf;
|
||||
@ -463,7 +476,8 @@ static void hpt_copy_array_info(HPT_GET_INFO *pinfo, int nld, PVDevice pArray)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int hpt_get_info(IAL_ADAPTER_T *pAdapter, HPT_GET_INFO *pinfo)
|
||||
static int
|
||||
hpt_get_info(IAL_ADAPTER_T *pAdapter, HPT_GET_INFO *pinfo)
|
||||
{
|
||||
PVBus _vbus_p = &pAdapter->VBus;
|
||||
struct cam_periph *periph = NULL;
|
||||
@ -535,7 +549,8 @@ static int hpt_get_info(IAL_ADAPTER_T *pAdapter, HPT_GET_INFO *pinfo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int hpt_proc_in(FORMAL_HANDLER_ARGS, int *len)
|
||||
static __inline int
|
||||
hpt_proc_in(FORMAL_HANDLER_ARGS, int *len)
|
||||
{
|
||||
int i, error=0;
|
||||
|
||||
@ -552,7 +567,8 @@ static inline int hpt_proc_in(FORMAL_HANDLER_ARGS, int *len)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int hpt_status(FORMAL_HANDLER_ARGS)
|
||||
static int
|
||||
hpt_status(FORMAL_HANDLER_ARGS)
|
||||
{
|
||||
int length, error=0, retval=0;
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
@ -598,7 +614,7 @@ static int hpt_status(FORMAL_HANDLER_ARGS)
|
||||
SYSCTL_NODE(, OID_AUTO, name, CTLFLAG_RW, 0, "Get/Set " #name " state root node") \
|
||||
SYSCTL_OID(_ ## name, OID_AUTO, status, CTLTYPE_STRING|CTLFLAG_RW, \
|
||||
NULL, 0, hpt_status, "A", "Get/Set " #name " state")
|
||||
#else
|
||||
#else
|
||||
#define hptregister_node(name) \
|
||||
SYSCTL_NODE(, OID_AUTO, name, CTLFLAG_RW, 0, "Get/Set " #name " state root node"); \
|
||||
SYSCTL_OID(_ ## name, OID_AUTO, status, CTLTYPE_STRING|CTLFLAG_RW, \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -33,6 +33,17 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#if (__FreeBSD_version < 500000)
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/sysproto.h>
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#define __KERNEL__
|
||||
#endif
|
||||
|
||||
#include <dev/hptmv/global.h>
|
||||
#include <dev/hptmv/hptintf.h>
|
||||
#include <dev/hptmv/osbsd.h>
|
||||
@ -60,7 +71,8 @@ static void HPTLIBAPI thread_io_done(_VBUS_ARG PCommand pCmd);
|
||||
static int HPTLIBAPI R1ControlSgl(_VBUS_ARG PCommand pCmd,
|
||||
FPSCAT_GATH pSgTable, int logical);
|
||||
|
||||
static void get_disk_location(PDevice pDev, int *controller, int *channel)
|
||||
static void
|
||||
get_disk_location(PDevice pDev, int *controller, int *channel)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapTemp;
|
||||
int i, j;
|
||||
@ -75,7 +87,8 @@ static void get_disk_location(PDevice pDev, int *controller, int *channel)
|
||||
}
|
||||
}
|
||||
|
||||
static int event_queue_add(PHPT_EVENT pEvent)
|
||||
static int
|
||||
event_queue_add(PHPT_EVENT pEvent)
|
||||
{
|
||||
int p;
|
||||
p = (event_queue_tail + 1) % MAX_EVENTS;
|
||||
@ -88,7 +101,8 @@ static int event_queue_add(PHPT_EVENT pEvent)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int event_queue_remove(PHPT_EVENT pEvent)
|
||||
static int
|
||||
event_queue_remove(PHPT_EVENT pEvent)
|
||||
{
|
||||
if (event_queue_head != event_queue_tail)
|
||||
{
|
||||
@ -100,7 +114,8 @@ static int event_queue_remove(PHPT_EVENT pEvent)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param)
|
||||
void HPTLIBAPI
|
||||
ioctl_ReportEvent(UCHAR event, PVOID param)
|
||||
{
|
||||
HPT_EVENT e;
|
||||
ZeroMemory(&e, sizeof(e));
|
||||
@ -142,14 +157,15 @@ void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param)
|
||||
}
|
||||
}
|
||||
|
||||
static int hpt_delete_array(_VBUS_ARG DEVICEID id, DWORD options)
|
||||
static int
|
||||
hpt_delete_array(_VBUS_ARG DEVICEID id, DWORD options)
|
||||
{
|
||||
PVDevice pArray = ID_TO_VDEV(id);
|
||||
BOOLEAN del_block0 = (options & DAF_KEEP_DATA_IF_POSSIBLE)?0:1;
|
||||
int i;
|
||||
PVDevice pa;
|
||||
|
||||
if((id== HPT_NULL_ID) || check_VDevice_valid(pArray))
|
||||
if ((id==0) || check_VDevice_valid(pArray))
|
||||
return -1;
|
||||
|
||||
if(!mIsArray(pArray)) return -1;
|
||||
@ -176,7 +192,8 @@ static int hpt_delete_array(_VBUS_ARG DEVICEID id, DWORD options)
|
||||
/* just to prevent driver from sending more commands */
|
||||
static void HPTLIBAPI nothing(_VBUS_ARG void *notused){}
|
||||
|
||||
static intrmask_t lock_driver_idle(IAL_ADAPTER_T *pAdapter)
|
||||
intrmask_t
|
||||
lock_driver_idle(IAL_ADAPTER_T *pAdapter)
|
||||
{
|
||||
intrmask_t oldspl;
|
||||
_VBUS_INST(&pAdapter->VBus)
|
||||
@ -185,6 +202,12 @@ static intrmask_t lock_driver_idle(IAL_ADAPTER_T *pAdapter)
|
||||
KdPrint(("outstandingCommands is %d, wait..\n", pAdapter->outstandingCommands));
|
||||
if (!mWaitingForIdle(_VBUS_P0)) CallWhenIdle(_VBUS_P nothing, 0);
|
||||
unlock_driver(oldspl);
|
||||
/*Schedule out*/
|
||||
#if (__FreeBSD_version < 500000)
|
||||
YIELD_THREAD;
|
||||
#else
|
||||
tsleep(lock_driver_idle, PPAUSE, "switch", 1);
|
||||
#endif
|
||||
oldspl = lock_driver();
|
||||
}
|
||||
CheckIdleCall(_VBUS_P0);
|
||||
@ -218,7 +241,7 @@ int Kernel_DeviceIoControl(_VBUS_ARG
|
||||
|
||||
pArray = ID_TO_VDEV(idArray);
|
||||
|
||||
if((idArray == HPT_NULL_ID) || check_VDevice_valid(pArray))
|
||||
if((idArray == 0) || check_VDevice_valid(pArray))
|
||||
return -1;
|
||||
|
||||
if(!mIsArray(pArray))
|
||||
@ -231,7 +254,7 @@ int Kernel_DeviceIoControl(_VBUS_ARG
|
||||
if(pArray == _vbus_p->pVDevice[i])
|
||||
{
|
||||
periph = hpt_get_periph(pAdapter->mvSataAdapter.adapterId, i);
|
||||
if (periph != NULL && periph->refcount == 1)
|
||||
if (periph != NULL && periph->refcount >= 1)
|
||||
{
|
||||
hpt_printk(("Can not delete a mounted device.\n"));
|
||||
return -1;
|
||||
@ -388,7 +411,7 @@ int Kernel_DeviceIoControl(_VBUS_ARG
|
||||
{
|
||||
PVDevice pArray = ID_TO_VDEV(((PHPT_ADD_DISK_TO_ARRAY)lpInBuffer)->idArray);
|
||||
pAdapter=(IAL_ADAPTER_T *)pArray->pVBus->OsExt;
|
||||
if(pArray->u.array.rf_rebuilding == HPT_NULL_ID)
|
||||
if(pArray->u.array.rf_rebuilding == 0)
|
||||
{
|
||||
DWORD timeout = 0;
|
||||
oldspl = lock_driver();
|
||||
@ -417,7 +440,8 @@ int Kernel_DeviceIoControl(_VBUS_ARG
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hpt_get_event(PHPT_EVENT pEvent)
|
||||
static int
|
||||
hpt_get_event(PHPT_EVENT pEvent)
|
||||
{
|
||||
intrmask_t oldspl = lock_driver();
|
||||
int ret = event_queue_remove(pEvent);
|
||||
@ -425,7 +449,8 @@ static int hpt_get_event(PHPT_EVENT pEvent)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hpt_set_array_state(DEVICEID idArray, DWORD state)
|
||||
static int
|
||||
hpt_set_array_state(DEVICEID idArray, DWORD state)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
PVDevice pVDevice = ID_TO_VDEV(idArray);
|
||||
@ -433,8 +458,7 @@ static int hpt_set_array_state(DEVICEID idArray, DWORD state)
|
||||
DWORD timeout = 0;
|
||||
intrmask_t oldspl;
|
||||
|
||||
if(idArray == HPT_NULL_ID || check_VDevice_valid(pVDevice))
|
||||
return -1;
|
||||
if(idArray == 0 || check_VDevice_valid(pVDevice)) return -1;
|
||||
if(!mIsArray(pVDevice))
|
||||
return -1;
|
||||
if(!pVDevice->vf_online || pVDevice->u.array.rf_broken) return -1;
|
||||
@ -474,7 +498,7 @@ static int hpt_set_array_state(DEVICEID idArray, DWORD state)
|
||||
case MIRROR_REBUILD_ABORT:
|
||||
{
|
||||
for(i = 0; i < pVDevice->u.array.bArnMember; i++) {
|
||||
if(pVDevice->u.array.pMember[i] != NULL && pVDevice->u.array.pMember[i]->VDeviceType == VD_RAID_1)
|
||||
if(pVDevice->u.array.pMember[i] != 0 && pVDevice->u.array.pMember[i]->VDeviceType == VD_RAID_1)
|
||||
hpt_set_array_state(VDEV_TO_ID(pVDevice->u.array.pMember[i]), state);
|
||||
}
|
||||
|
||||
@ -585,7 +609,8 @@ static int hpt_set_array_state(DEVICEID idArray, DWORD state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int HPTLIBAPI R1ControlSgl(_VBUS_ARG PCommand pCmd, FPSCAT_GATH pSgTable, int logical)
|
||||
int HPTLIBAPI
|
||||
R1ControlSgl(_VBUS_ARG PCommand pCmd, FPSCAT_GATH pSgTable, int logical)
|
||||
{
|
||||
ULONG bufferSize = SECTOR_TO_BYTE(pCmd->uCmd.R1Control.nSectors);
|
||||
if (pCmd->uCmd.R1Control.Command==CTRL_CMD_VERIFY)
|
||||
@ -648,13 +673,15 @@ static int HPTLIBAPI R1ControlSgl(_VBUS_ARG PCommand pCmd, FPSCAT_GATH pSgTable,
|
||||
}
|
||||
|
||||
static int End_Job=0;
|
||||
static void HPTLIBAPI thread_io_done(_VBUS_ARG PCommand pCmd)
|
||||
void HPTLIBAPI
|
||||
thread_io_done(_VBUS_ARG PCommand pCmd)
|
||||
{
|
||||
End_Job = 1;
|
||||
wakeup((caddr_t)pCmd);
|
||||
}
|
||||
|
||||
void hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flags)
|
||||
void
|
||||
hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flags)
|
||||
{
|
||||
DWORD timeout = 0;
|
||||
ULONG capacity = pArray->VDeviceCapacity / (pArray->u.array.bArnMember-1);
|
||||
@ -714,7 +741,9 @@ void hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flag
|
||||
#define MAX_REBUILD_SECTORS 0x40
|
||||
|
||||
/* take care for discontinuous buffer in R1ControlSgl */
|
||||
unlock_driver(oldspl);
|
||||
buffer = malloc(SECTOR_TO_BYTE(MAX_REBUILD_SECTORS), M_DEVBUF, M_NOWAIT);
|
||||
oldspl = lock_driver();
|
||||
if(!buffer) {
|
||||
FreeCommand(_VBUS_P pCmd);
|
||||
hpt_printk(("can't allocate rebuild buffer\n"));
|
||||
@ -783,11 +812,9 @@ void hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flag
|
||||
|
||||
result = pCmd->Result;
|
||||
FreeCommand(_VBUS_P pCmd);
|
||||
if (buffer) {
|
||||
free(buffer, M_DEVBUF);
|
||||
/* beware of goto retry_cmd below */
|
||||
buffer = NULL;
|
||||
}
|
||||
unlock_driver(oldspl);
|
||||
if (buffer) free(buffer, M_DEVBUF);
|
||||
oldspl = lock_driver();
|
||||
KdPrintI(("cmd finished %d", result));
|
||||
|
||||
switch(result)
|
||||
@ -918,6 +945,12 @@ void hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flag
|
||||
/* put this to have driver stop processing system commands quickly */
|
||||
if (!mWaitingForIdle(_VBUS_P0)) CallWhenIdle(_VBUS_P nothing, 0);
|
||||
unlock_driver(oldspl);
|
||||
/*Schedule out*/
|
||||
#if (__FreeBSD_version < 500000)
|
||||
YIELD_THREAD;
|
||||
#else
|
||||
tsleep(hpt_rebuild_data_block, PPAUSE, "switch", 1);
|
||||
#endif
|
||||
oldspl = lock_driver();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
/*
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -27,51 +27,68 @@
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <vm/vm_extern.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#if __FreeBSD_version >= 500043
|
||||
#include <machine/pci_cfgreg.h>
|
||||
#endif
|
||||
|
||||
#if (__FreeBSD_version < 500043)
|
||||
#include <sys/bus_private.h>
|
||||
#endif
|
||||
|
||||
#if (__FreeBSD_version < 500000)
|
||||
#include <machine/clock.h>
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#define __KERNEL__
|
||||
#endif
|
||||
|
||||
#include <dev/hptmv/global.h>
|
||||
#include <dev/hptmv/hptintf.h>
|
||||
#include <dev/hptmv/mvOs.h>
|
||||
#include <dev/hptmv/osbsd.h>
|
||||
|
||||
|
||||
void HPTLIBAPI
|
||||
MV_REG_WRITE_BYTE(MV_BUS_ADDR_T base, MV_U32 offset, MV_U8 val)
|
||||
{
|
||||
mv_reg_write_byte(base, offset, val);
|
||||
{
|
||||
writeb((void *)((ULONG_PTR)base + offset), val);
|
||||
}
|
||||
|
||||
void HPTLIBAPI
|
||||
MV_REG_WRITE_WORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U16 val)
|
||||
{
|
||||
mv_reg_write_word(base, offset, val);
|
||||
{
|
||||
writew((void *)((ULONG_PTR)base + offset), val);
|
||||
}
|
||||
|
||||
void HPTLIBAPI
|
||||
MV_REG_WRITE_DWORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U32 val)
|
||||
{
|
||||
mv_reg_write_dword(base, offset, val);
|
||||
writel((void *)((ULONG_PTR)base + offset), val);
|
||||
}
|
||||
|
||||
MV_U8
|
||||
HPTLIBAPI MV_REG_READ_BYTE(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
MV_U8 HPTLIBAPI
|
||||
MV_REG_READ_BYTE(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
{
|
||||
return (mv_reg_read_byte(base, offset));
|
||||
return readb((void *)((ULONG_PTR)base + offset));
|
||||
}
|
||||
|
||||
MV_U16
|
||||
HPTLIBAPI MV_REG_READ_WORD(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
MV_U16 HPTLIBAPI
|
||||
MV_REG_READ_WORD(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
{
|
||||
return (mv_reg_read_word(base, offset));
|
||||
return readw((void *)((ULONG_PTR)base + offset));
|
||||
}
|
||||
|
||||
MV_U32
|
||||
HPTLIBAPI MV_REG_READ_DWORD(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
MV_U32 HPTLIBAPI
|
||||
MV_REG_READ_DWORD(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
{
|
||||
return (mv_reg_read_dword(base, offset));
|
||||
return readl((void *)((ULONG_PTR)base + offset));
|
||||
}
|
||||
|
||||
int HPTLIBAPI
|
||||
@ -86,29 +103,26 @@ os_memcpy(void *to, const void *from, unsigned len)
|
||||
memcpy(to, from, len);
|
||||
}
|
||||
|
||||
void
|
||||
HPTLIBAPI os_memset(void *s, char c, unsigned len)
|
||||
void HPTLIBAPI
|
||||
os_memset(void *s, char c, unsigned len)
|
||||
{
|
||||
memset(s, c, len);
|
||||
}
|
||||
|
||||
unsigned
|
||||
HPTLIBAPI os_strlen(const char *s)
|
||||
unsigned HPTLIBAPI
|
||||
os_strlen(const char *s)
|
||||
{
|
||||
return strlen(s);
|
||||
}
|
||||
|
||||
void HPTLIBAPI mvMicroSecondsDelay(MV_U32 msecs)
|
||||
void HPTLIBAPI
|
||||
mvMicroSecondsDelay(MV_U32 msecs)
|
||||
{
|
||||
DELAY(msecs);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX
|
||||
*
|
||||
* The binary raid.obj requires this function!
|
||||
*/
|
||||
ULONG_PTR HPTLIBAPI fOsPhysicalAddress(void *addr)
|
||||
ULONG_PTR HPTLIBAPI
|
||||
fOsPhysicalAddress(void *addr)
|
||||
{
|
||||
return (ULONG_PTR)(vtophys(addr));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
/*
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -28,19 +28,6 @@
|
||||
#ifndef __INCmvOsBsdh
|
||||
#define __INCmvOsBsdh
|
||||
|
||||
/* Taken out of the Makefile magic */
|
||||
#define __KERNEL__ 1
|
||||
#define KERNEL 1
|
||||
#define _KERNEL 1
|
||||
#define _FREEBSD_ 1
|
||||
|
||||
/*
|
||||
* This binary object core for this driver is only for x86, so this constant
|
||||
* will not change.
|
||||
*/
|
||||
#define BITS_PER_LONG 32
|
||||
#define DRIVER_VERSION "1.1"
|
||||
|
||||
#if DBG
|
||||
#define MV_DEBUG_LOG
|
||||
#endif
|
||||
@ -49,22 +36,24 @@
|
||||
#define ENABLE_WRITE_CACHE
|
||||
|
||||
/* Typedefs */
|
||||
#define HPTLIBAPI __attribute__((regparm(0)))
|
||||
/*#define HPTLIBAPI __attribute__((regparm(0))) */
|
||||
#define HPTLIBAPI
|
||||
#define FAR
|
||||
#define SS_SEG
|
||||
#ifdef FASTCALL
|
||||
#undef FASTCALL
|
||||
#endif
|
||||
#define FASTCALL HPTLIBAPI
|
||||
#define PASCAL HPTLIBAPI
|
||||
|
||||
typedef u_short USHORT;
|
||||
typedef u_char UCHAR;
|
||||
typedef u_char *PUCHAR;
|
||||
typedef u_short *PUSHORT;
|
||||
typedef u_char BOOLEAN;
|
||||
typedef u_short WORD;
|
||||
typedef u_int UINT, BOOL;
|
||||
typedef u_char BYTE;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned char *PUCHAR;
|
||||
typedef unsigned short *PUSHORT;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned int UINT, BOOL;
|
||||
typedef unsigned char BYTE;
|
||||
typedef void *PVOID, *LPVOID;
|
||||
typedef void *ADDRESS;
|
||||
|
||||
@ -72,23 +61,28 @@ typedef int LONG;
|
||||
typedef unsigned int ULONG, *PULONG, LBA_T;
|
||||
typedef unsigned int DWORD, *LPDWORD, *PDWORD;
|
||||
typedef unsigned long ULONG_PTR, UINT_PTR, BUS_ADDR;
|
||||
typedef unsigned long long HPT_U64;
|
||||
|
||||
typedef enum mvBoolean{MV_FALSE, MV_TRUE} MV_BOOLEAN;
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* System dependant typedefs */
|
||||
typedef void MV_VOID;
|
||||
typedef uint32_t MV_U32;
|
||||
typedef uint16_t MV_U16;
|
||||
typedef uint8_t MV_U8;
|
||||
typedef void *MV_VOID_PTR;
|
||||
typedef MV_U32 *MV_U32_PTR;
|
||||
typedef MV_U16 *MV_U16_PTR;
|
||||
typedef MV_U8 *MV_U8_PTR;
|
||||
typedef char *MV_CHAR_PTR;
|
||||
typedef void *MV_BUS_ADDR_T;
|
||||
typedef void MV_VOID;
|
||||
typedef unsigned int MV_U32;
|
||||
typedef unsigned short MV_U16;
|
||||
typedef unsigned char MV_U8;
|
||||
typedef void *MV_VOID_PTR;
|
||||
typedef MV_U32 *MV_U32_PTR;
|
||||
typedef MV_U16 *MV_U16_PTR;
|
||||
typedef MV_U8 *MV_U8_PTR;
|
||||
typedef char *MV_CHAR_PTR;
|
||||
typedef void *MV_BUS_ADDR_T;
|
||||
|
||||
/* System dependent macro for flushing CPU write cache */
|
||||
#define MV_CPU_WRITE_BUFFER_FLUSH()
|
||||
@ -101,12 +95,9 @@ typedef void *MV_BUS_ADDR_T;
|
||||
#define MV_LE32_TO_CPU(x) (x)
|
||||
|
||||
/* System dependent register read / write in byte/word/dword variants */
|
||||
extern void HPTLIBAPI MV_REG_WRITE_BYTE(MV_BUS_ADDR_T base, MV_U32 offset,
|
||||
MV_U8 val);
|
||||
extern void HPTLIBAPI MV_REG_WRITE_WORD(MV_BUS_ADDR_T base, MV_U32 offset,
|
||||
MV_U16 val);
|
||||
extern void HPTLIBAPI MV_REG_WRITE_DWORD(MV_BUS_ADDR_T base, MV_U32 offset,
|
||||
MV_U32 val);
|
||||
extern void HPTLIBAPI MV_REG_WRITE_BYTE(MV_BUS_ADDR_T base, MV_U32 offset, MV_U8 val);
|
||||
extern void HPTLIBAPI MV_REG_WRITE_WORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U16 val);
|
||||
extern void HPTLIBAPI MV_REG_WRITE_DWORD(MV_BUS_ADDR_T base, MV_U32 offset, MV_U32 val);
|
||||
extern MV_U8 HPTLIBAPI MV_REG_READ_BYTE(MV_BUS_ADDR_T base, MV_U32 offset);
|
||||
extern MV_U16 HPTLIBAPI MV_REG_READ_WORD(MV_BUS_ADDR_T base, MV_U32 offset);
|
||||
extern MV_U32 HPTLIBAPI MV_REG_READ_DWORD(MV_BUS_ADDR_T base, MV_U32 offset);
|
||||
@ -121,25 +112,9 @@ typedef struct mvOsSemaphore
|
||||
ULONG_PTR HPTLIBAPI fOsPhysicalAddress(void *addr);
|
||||
|
||||
/* Semaphore init, take and release */
|
||||
static __inline int
|
||||
mvOsSemInit(MV_OS_SEMAPHORE *p)
|
||||
{
|
||||
return (MV_TRUE);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
mvOsSemTake(MV_OS_SEMAPHORE *p)
|
||||
{
|
||||
return (MV_TRUE);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
mvOsSemRelease(MV_OS_SEMAPHORE *p)
|
||||
{
|
||||
return (MV_TRUE);
|
||||
}
|
||||
|
||||
#define MV_MAX_SEGMENTS 255
|
||||
#define mvOsSemInit(p) (MV_TRUE)
|
||||
#define mvOsSemTake(p) (MV_TRUE)
|
||||
#define mvOsSemRelease(p) (MV_TRUE)
|
||||
|
||||
/* Delay function in micro seconds resolution */
|
||||
void HPTLIBAPI mvMicroSecondsDelay(MV_U32);
|
||||
@ -148,7 +123,7 @@ void HPTLIBAPI mvMicroSecondsDelay(MV_U32);
|
||||
#ifdef MV_DEBUG_LOG
|
||||
int mvLogMsg(MV_U8, MV_CHAR_PTR, ...);
|
||||
#define _mvLogMsg(x) mvLogMsg x
|
||||
#else
|
||||
#else
|
||||
#define mvLogMsg(x...)
|
||||
#define _mvLogMsg(x)
|
||||
#endif
|
||||
@ -156,16 +131,17 @@ int mvLogMsg(MV_U8, MV_CHAR_PTR, ...);
|
||||
/*************************************************************************
|
||||
* Debug support
|
||||
*************************************************************************/
|
||||
#ifdef DEBUG
|
||||
#define HPT_ASSERT(x) \
|
||||
KASSERT((x), ("ASSERT fail at %s line %d", __FILE__, __LINE__))
|
||||
|
||||
#if DEBUG
|
||||
#define HPT_ASSERT(x) do { if (!(x)) { \
|
||||
printf("ASSERT fail at %s line %d", __FILE__, __LINE__); \
|
||||
while (1); \
|
||||
}} while (0)
|
||||
extern int hpt_dbg_level;
|
||||
#define KdPrintI(_x_) do{ if (hpt_dbg_level>2) printf _x_; }while(0)
|
||||
#define KdPrintW(_x_) do{ if (hpt_dbg_level>1) printf _x_; }while(0)
|
||||
#define KdPrintE(_x_) do{ if (hpt_dbg_level>0) printf _x_; }while(0)
|
||||
#define KdPrint(x) KdPrintI(x)
|
||||
#else
|
||||
#else
|
||||
#define HPT_ASSERT(x)
|
||||
#define KdPrint(x)
|
||||
#define KdPrintI(x)
|
||||
@ -173,4 +149,4 @@ extern int hpt_dbg_level;
|
||||
#define KdPrintE(x)
|
||||
#endif
|
||||
|
||||
#endif /* __INCmvOsBsdh */
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 MARVELL SEMICONDUCTOR ISRAEL, LTD.
|
||||
* Copyright (c) 2004-2005 MARVELL SEMICONDUCTOR ISRAEL, LTD.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 MARVELL SEMICONDUCTOR ISRAEL, LTD.
|
||||
* Copyright (c) 2004-2005 MARVELL SEMICONDUCTOR ISRAEL, LTD.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
/*
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -31,10 +31,24 @@
|
||||
#include <sys/bus.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/devicestat.h>
|
||||
|
||||
#if (__FreeBSD_version < 500043)
|
||||
#include <stddef.h>
|
||||
#include <sys/buf.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#if (__FreeBSD_version < 600030)
|
||||
#include <machine/bus_memio.h>
|
||||
#endif
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <cam/cam.h>
|
||||
@ -43,15 +57,19 @@
|
||||
#include <cam/cam_sim.h>
|
||||
#include <cam/cam_xpt_sim.h>
|
||||
#include <cam/cam_periph.h>
|
||||
#include <cam/cam_xpt_periph.h>
|
||||
|
||||
#include <cam/scsi/scsi_all.h>
|
||||
#include <cam/scsi/scsi_message.h>
|
||||
|
||||
|
||||
|
||||
extern intrmask_t lock_driver(void);
|
||||
extern void unlock_driver(intrmask_t spl);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UCHAR status; /* 0 nonbootable; 80h bootable */
|
||||
UCHAR status; /* 0 nonbootable; 80h bootable */
|
||||
UCHAR start_head;
|
||||
USHORT start_sector;
|
||||
UCHAR type;
|
||||
@ -98,8 +116,8 @@ typedef struct _READ_CAPACITY_DATA {
|
||||
/****************************************/
|
||||
|
||||
/* Bits for HD_ERROR */
|
||||
#define NM_ERR 0x02 /* media present */
|
||||
#define ABRT_ERR 0x04 /* Command aborted */
|
||||
#define NM_ERR 0x02 /* media present */
|
||||
#define ABRT_ERR 0x04 /* Command aborted */
|
||||
#define MCR_ERR 0x08 /* media change request */
|
||||
#define IDNF_ERR 0x10 /* ID field not found */
|
||||
#define MC_ERR 0x20 /* media changed */
|
||||
@ -107,213 +125,195 @@ typedef struct _READ_CAPACITY_DATA {
|
||||
#define WP_ERR 0x40 /* write protect */
|
||||
#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
|
||||
|
||||
#define REQUESTS_ARRAY_SIZE (9 * MV_EDMA_REQUEST_QUEUE_SIZE) /* 9 K bytes */
|
||||
#define RESPONSES_ARRAY_SIZE (12*MV_EDMA_RESPONSE_QUEUE_SIZE) /* 3 K bytes */
|
||||
#define REQUESTS_ARRAY_SIZE (9 * MV_EDMA_REQUEST_QUEUE_SIZE) /* 9 K bytes */
|
||||
#define RESPONSES_ARRAY_SIZE (12 * MV_EDMA_RESPONSE_QUEUE_SIZE) /* 3 K bytes */
|
||||
|
||||
#define PRD_ENTRIES_PER_CMD (MAX_SG_DESCRIPTORS+1)
|
||||
#define PRD_ENTRIES_SIZE (MV_EDMA_PRD_ENTRY_SIZE*PRD_ENTRIES_PER_CMD)
|
||||
#define PRD_TABLES_FOR_VBUS (MV_SATA_CHANNELS_NUM*MV_EDMA_QUEUE_LENGTH)
|
||||
#define PRD_ENTRIES_PER_CMD (MAX_SG_DESCRIPTORS+1)
|
||||
#define PRD_ENTRIES_SIZE (MV_EDMA_PRD_ENTRY_SIZE*PRD_ENTRIES_PER_CMD)
|
||||
#define PRD_TABLES_FOR_VBUS (MV_SATA_CHANNELS_NUM*MV_EDMA_QUEUE_LENGTH)
|
||||
|
||||
typedef enum _SataEvent {
|
||||
SATA_EVENT_NO_CHANGE = 0,
|
||||
typedef enum _SataEvent
|
||||
{
|
||||
SATA_EVENT_NO_CHANGE = 0,
|
||||
SATA_EVENT_CHANNEL_CONNECTED,
|
||||
SATA_EVENT_CHANNEL_DISCONNECTED
|
||||
} SATA_EVENT;
|
||||
|
||||
typedef ULONG_PTR dma_addr_t;
|
||||
|
||||
typedef struct _MV_CHANNEL {
|
||||
typedef struct _MV_CHANNEL
|
||||
{
|
||||
unsigned int maxUltraDmaModeSupported;
|
||||
unsigned int maxDmaModeSupported;
|
||||
unsigned int maxPioModeSupported;
|
||||
MV_BOOLEAN online;
|
||||
MV_BOOLEAN online;
|
||||
} MV_CHANNEL;
|
||||
|
||||
struct _privCommand;
|
||||
typedef struct _BUS_DMAMAP
|
||||
{ struct _BUS_DMAMAP *next;
|
||||
struct IALAdapter *pAdapter;
|
||||
bus_dmamap_t dma_map;
|
||||
SCAT_GATH psg[MAX_SG_DESCRIPTORS];
|
||||
} BUS_DMAMAP, *PBUS_DMAMAP;
|
||||
|
||||
typedef struct IALAdapter {
|
||||
typedef struct IALAdapter
|
||||
{
|
||||
struct cam_path *path;
|
||||
device_t hpt_dev; /* bus device */
|
||||
struct resource *hpt_irq; /* interrupt */
|
||||
void *hpt_intr; /* interrupt handle */
|
||||
struct resource *mem_res;
|
||||
bus_space_handle_t mem_bsh;
|
||||
bus_space_tag_t mem_btag;
|
||||
bus_dma_tag_t parent_dmat;
|
||||
bus_dma_tag_t req_dmat;
|
||||
bus_dmamap_t req_map;
|
||||
bus_dma_tag_t resp_dmat;
|
||||
bus_dmamap_t resp_map;
|
||||
bus_dma_tag_t prd_dmat;
|
||||
bus_dmamap_t prd_map;
|
||||
bus_dma_tag_t buf_dmat;
|
||||
|
||||
struct IALAdapter *next;
|
||||
|
||||
MV_SATA_ADAPTER mvSataAdapter;
|
||||
MV_CHANNEL mvChannel[MV_SATA_CHANNELS_NUM];
|
||||
MV_U8 *requestsArrayBaseAddr;
|
||||
MV_U8 *requestsArrayBaseAlignedAddr;
|
||||
dma_addr_t requestsArrayBaseDmaAddr;
|
||||
dma_addr_t requestsArrayBaseDmaAlignedAddr;
|
||||
MV_U8 *responsesArrayBaseAddr;
|
||||
MV_U8 *responsesArrayBaseAlignedAddr;
|
||||
dma_addr_t responsesArrayBaseDmaAddr;
|
||||
dma_addr_t responsesArrayBaseDmaAlignedAddr;
|
||||
SATA_EVENT sataEvents[MV_SATA_CHANNELS_NUM];
|
||||
bus_dma_tag_t io_dma_parent; /* I/O buffer DMA tag */
|
||||
PBUS_DMAMAP pbus_dmamap_list;
|
||||
PBUS_DMAMAP pbus_dmamap;
|
||||
|
||||
device_t hpt_dev; /* bus device */
|
||||
struct resource *hpt_irq; /* interrupt */
|
||||
struct resource *mem_res;
|
||||
void *hpt_intr; /* interrupt handle */
|
||||
struct IALAdapter *next;
|
||||
|
||||
MV_SATA_ADAPTER mvSataAdapter;
|
||||
MV_CHANNEL mvChannel[MV_SATA_CHANNELS_NUM];
|
||||
MV_U8 *requestsArrayBaseAddr;
|
||||
MV_U8 *requestsArrayBaseAlignedAddr;
|
||||
dma_addr_t requestsArrayBaseDmaAddr;
|
||||
dma_addr_t requestsArrayBaseDmaAlignedAddr;
|
||||
MV_U8 *responsesArrayBaseAddr;
|
||||
MV_U8 *responsesArrayBaseAlignedAddr;
|
||||
dma_addr_t responsesArrayBaseDmaAddr;
|
||||
dma_addr_t responsesArrayBaseDmaAlignedAddr;
|
||||
SATA_EVENT sataEvents[MV_SATA_CHANNELS_NUM];
|
||||
|
||||
struct callout_handle event_timer_connect;
|
||||
struct callout_handle event_timer_disconnect;
|
||||
|
||||
struct _VBus VBus;
|
||||
struct _VDevice VDevices[MV_SATA_CHANNELS_NUM];
|
||||
PCommand pCommandBlocks;
|
||||
struct _privCommand *pPrivateBlocks;
|
||||
TAILQ_HEAD(, _privCommand) PrivCmdTQH;
|
||||
PUCHAR prdTableAddr;
|
||||
ULONG prdTableDmaAddr;
|
||||
void* pFreePRDLink;
|
||||
struct _VBus VBus;
|
||||
struct _VDevice VDevices[MV_SATA_CHANNELS_NUM];
|
||||
PCommand pCommandBlocks;
|
||||
PUCHAR prdTableAddr;
|
||||
PUCHAR prdTableAlignedAddr;
|
||||
void* pFreePRDLink;
|
||||
|
||||
union ccb *pending_Q;
|
||||
union ccb *pending_Q;
|
||||
|
||||
MV_U8 outstandingCommands;
|
||||
MV_U8 outstandingCommands;
|
||||
|
||||
UCHAR status;
|
||||
UCHAR ver_601;
|
||||
UCHAR beeping;
|
||||
UCHAR status;
|
||||
UCHAR ver_601;
|
||||
UCHAR beeping;
|
||||
|
||||
eventhandler_tag eh;
|
||||
} IAL_ADAPTER_T;
|
||||
|
||||
typedef struct _privCommand {
|
||||
TAILQ_ENTRY(_privCommand) PrivEntry;
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
union ccb *ccb;
|
||||
bus_dmamap_t buf_map;
|
||||
} *pPrivCommand;
|
||||
}
|
||||
IAL_ADAPTER_T;
|
||||
|
||||
extern IAL_ADAPTER_T *gIal_Adapter;
|
||||
|
||||
/*entry.c*/
|
||||
typedef void (*HPT_DPC)(IAL_ADAPTER_T *,void*,UCHAR);
|
||||
|
||||
int hpt_queue_dpc(HPT_DPC dpc, IAL_ADAPTER_T *pAdapter, void *arg, UCHAR flags);
|
||||
void hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray,
|
||||
UCHAR flags);
|
||||
void hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flags);
|
||||
void Check_Idle_Call(IAL_ADAPTER_T *pAdapter);
|
||||
int Kernel_DeviceIoControl(_VBUS_ARG DWORD dwIoControlCode, PVOID lpInBuffer,
|
||||
DWORD nInBufferSize, PVOID lpOutBuffer, DWORD nOutBufferSize,
|
||||
PDWORD lpBytesReturned);
|
||||
void fRescanAllDevice(_VBUS_ARG0);
|
||||
int hpt_add_disk_to_array(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk);
|
||||
|
||||
int Kernel_DeviceIoControl(_VBUS_ARG
|
||||
DWORD dwIoControlCode, /* operation control code */
|
||||
PVOID lpInBuffer, /* input data buffer */
|
||||
DWORD nInBufferSize, /* size of input data buffer */
|
||||
PVOID lpOutBuffer, /* output data buffer */
|
||||
DWORD nOutBufferSize, /* size of output data buffer */
|
||||
PDWORD lpBytesReturned /* byte count */
|
||||
);
|
||||
|
||||
|
||||
#define __str_direct(x) #x
|
||||
#define __str(x) __str_direct(x)
|
||||
#define KMSG_LEADING __str(PROC_DIR_NAME) ": "
|
||||
#define hpt_printk(_x_) do { \
|
||||
printf(KMSG_LEADING); \
|
||||
printf _x_ ; \
|
||||
} while (0)
|
||||
#define hpt_printk(_x_) do { printf(KMSG_LEADING); printf _x_ ; } while (0)
|
||||
|
||||
#define DUPLICATE 0
|
||||
#define INITIALIZE 1
|
||||
#define REBUILD_PARITY 2
|
||||
#define VERIFY 3
|
||||
|
||||
/**********************************************************/
|
||||
/***********************************************************/
|
||||
|
||||
static __inline struct cam_periph *
|
||||
hpt_get_periph(int path_id,int target_id)
|
||||
{
|
||||
struct cam_periph *periph = NULL;
|
||||
struct cam_path *path;
|
||||
int status;
|
||||
struct cam_periph *periph = NULL;
|
||||
struct cam_path *path;
|
||||
int status;
|
||||
|
||||
status = xpt_create_path(&path, NULL, path_id, target_id, 0);
|
||||
if (status == CAM_REQ_CMP) {
|
||||
periph = cam_periph_find(path, NULL);
|
||||
status = xpt_create_path(&path, NULL, path_id, target_id, 0);
|
||||
if (status == CAM_REQ_CMP) {
|
||||
periph = cam_periph_find(path, "da");
|
||||
xpt_free_path(path);
|
||||
if (periph != NULL) {
|
||||
if (strncmp(periph->periph_name, "da", 2))
|
||||
periph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return periph;
|
||||
}
|
||||
|
||||
static __inline void
|
||||
FreePrivCommand(IAL_ADAPTER_T *pAdapter, pPrivCommand prvCmd)
|
||||
#if (__FreeBSD_version < 500000)
|
||||
#define YIELD_THREAD yield(curproc, 0)
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
#define BITS_PER_LONG 32
|
||||
#define VDEV_TO_ID(pVDev) (DEVICEID)(pVDev)
|
||||
#define ID_TO_VDEV(id) (PVDevice)(id)
|
||||
#else /*Only support x86_64(AMD64 and EM64T)*/
|
||||
#define BITS_PER_LONG 64
|
||||
#define VDEV_TO_ID(pVDev) (DEVICEID)(ULONG_PTR)(pVDev)
|
||||
#define ID_TO_VDEV(id) (PVDevice)(((ULONG_PTR)gIal_Adapter & 0xffffffff00000000) | (id))
|
||||
#endif
|
||||
|
||||
#define INVALID_DEVICEID (-1)
|
||||
#define INVALID_STRIPSIZE (-1)
|
||||
|
||||
#define shortswap(w) ((WORD)((w)>>8 | ((w) & 0xFF)<<8))
|
||||
|
||||
#ifndef MinBlockSizeShift
|
||||
#define MinBlockSizeShift 5
|
||||
#define MaxBlockSizeShift 12
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct _HPT_IOCTL_TRANSFER_PARAM
|
||||
{
|
||||
TAILQ_INSERT_TAIL(&pAdapter->PrivCmdTQH, prvCmd, PrivEntry);
|
||||
}
|
||||
ULONG nInBufferSize;
|
||||
ULONG nOutBufferSize;
|
||||
UCHAR buffer[0];
|
||||
}HPT_IOCTL_TRANSFER_PARAM, *PHPT_IOCTL_TRANSFER_PARAM;
|
||||
|
||||
static __inline pPrivCommand
|
||||
AllocPrivCommand(IAL_ADAPTER_T *pAdapter)
|
||||
typedef struct _HPT_SET_STATE_PARAM
|
||||
{
|
||||
pPrivCommand prvCmd;
|
||||
DEVICEID idArray;
|
||||
DWORD state;
|
||||
} HPT_SET_STATE_PARAM, *PHPT_SET_STATE_PARAM;
|
||||
|
||||
prvCmd = TAILQ_FIRST(&pAdapter->PrivCmdTQH);
|
||||
if (prvCmd == NULL)
|
||||
return NULL;
|
||||
|
||||
TAILQ_REMOVE(&pAdapter->PrivCmdTQH, prvCmd, PrivEntry);
|
||||
return (prvCmd);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
mv_reg_write_byte(MV_BUS_ADDR_T base, MV_U32 offset, MV_U8 val)
|
||||
typedef struct _HPT_SET_ARRAY_INFO
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
|
||||
pAdapter = base;
|
||||
bus_space_write_1(pAdapter->mem_btag, pAdapter->mem_bsh, offset, val);
|
||||
}
|
||||
DEVICEID idArray;
|
||||
ALTERABLE_ARRAY_INFO Info;
|
||||
} HPT_SET_ARRAY_INFO, *PHPT_SET_ARRAY_INFO;
|
||||
|
||||
static __inline void
|
||||
mv_reg_write_word(MV_BUS_ADDR_T base, MV_U32 offset, MV_U16 val)
|
||||
typedef struct _HPT_SET_DEVICE_INFO
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
|
||||
pAdapter = base;
|
||||
bus_space_write_2(pAdapter->mem_btag, pAdapter->mem_bsh, offset, val);
|
||||
}
|
||||
DEVICEID idDisk;
|
||||
ALTERABLE_DEVICE_INFO Info;
|
||||
} HPT_SET_DEVICE_INFO, *PHPT_SET_DEVICE_INFO;
|
||||
|
||||
static __inline void
|
||||
mv_reg_write_dword(MV_BUS_ADDR_T base, MV_U32 offset, MV_U32 val)
|
||||
typedef struct _HPT_ADD_DISK_TO_ARRAY
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
DEVICEID idArray;
|
||||
DEVICEID idDisk;
|
||||
} HPT_ADD_DISK_TO_ARRAY, *PHPT_ADD_DISK_TO_ARRAY;
|
||||
|
||||
pAdapter = base;
|
||||
bus_space_write_4(pAdapter->mem_btag, pAdapter->mem_bsh, offset, val);
|
||||
}
|
||||
int check_VDevice_valid(PVDevice);
|
||||
int hpt_default_ioctl(_VBUS_ARG DWORD, PVOID, DWORD, PVOID, DWORD, PDWORD);
|
||||
|
||||
static __inline MV_U8
|
||||
mv_reg_read_byte(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
|
||||
pAdapter = base;
|
||||
return (bus_space_read_1(pAdapter->mem_btag, pAdapter->mem_bsh,
|
||||
offset));
|
||||
}
|
||||
#define HPT_NULL_ID 0
|
||||
|
||||
static __inline MV_U16
|
||||
mv_reg_read_word(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
|
||||
pAdapter = base;
|
||||
return (bus_space_read_2(pAdapter->mem_btag, pAdapter->mem_bsh,
|
||||
offset));
|
||||
}
|
||||
|
||||
static __inline MV_U32
|
||||
mv_reg_read_dword(MV_BUS_ADDR_T base, MV_U32 offset)
|
||||
{
|
||||
IAL_ADAPTER_T *pAdapter;
|
||||
|
||||
pAdapter = base;
|
||||
return (bus_space_read_4(pAdapter->mem_btag, pAdapter->mem_bsh,
|
||||
offset));
|
||||
}
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -110,12 +110,15 @@ struct r5_global_data {
|
||||
PUCHAR page_base_virt;
|
||||
PUCHAR page_current;
|
||||
#endif
|
||||
struct free_heap_block *free_heap_slots[8];
|
||||
struct free_heap_block *free_heap_slots[10];
|
||||
struct free_page *free_pages;
|
||||
UINT num_free_pages;
|
||||
UINT active_stripes;
|
||||
UINT num_flushing;
|
||||
PCommand cache_wait_list;
|
||||
|
||||
LBA_T __start[MAX_MEMBERS];
|
||||
USHORT __sectors[MAX_MEMBERS];
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,10 +1,14 @@
|
||||
RocketRAID 182x Driver for FreeBSD
|
||||
Copyright (C) 2003-2004 HighPoint Technologies, Inc. All rights reserved.
|
||||
Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
|
||||
$FreeBSD$
|
||||
|
||||
#############################################################################
|
||||
Revision History:
|
||||
|
||||
v1.12 2005-6-10
|
||||
Fix over 4G memory support on amd64.
|
||||
Fix disk flush problem.
|
||||
|
||||
v1.1 2004-9-23
|
||||
Fix activity LED problem.
|
||||
Cleanup diagnostic code.
|
||||
@ -36,22 +40,124 @@ Revision History:
|
||||
PRODUCT, INCLUDING THE COSTS OF REPAIRING, REPLACING, OR RECOVERING
|
||||
SUCH HARDWARE, OR DATA.
|
||||
|
||||
2. Build the driver
|
||||
---------------------
|
||||
|
||||
2. Rebuild the kernel with RR182x support
|
||||
--------------------------------------------
|
||||
|
||||
1) Install kernel source package and building tools.
|
||||
|
||||
2) Extract the driver files to somewhere.
|
||||
2) Extract the driver files under the kernel source tree:
|
||||
|
||||
3) Run "make" to build the driver.
|
||||
# cd /usr/src/sys/
|
||||
# tar xvzf /your/path/to/rr182x-opensource-v1.12-bsd.tgz
|
||||
|
||||
3) Update the kernel configuration file to include the HighPoint source.
|
||||
Assume the configure file is GENERIC, and new kernel configure file is
|
||||
MYKERNEL:
|
||||
|
||||
# cd i386/conf (or amd64/conf for AMD64)
|
||||
# cp GENERIC MYKERNEL
|
||||
|
||||
4) Edit MYKERNEL, and add the following line under "RAID controllers
|
||||
interfaced to the SCSI subsystem":
|
||||
|
||||
device hptmv #HighPoint RocketRAID 182x
|
||||
|
||||
5) For i386 system, edit /usr/src/sys/conf/files.i386 and append the lines
|
||||
shown below:
|
||||
|
||||
hptmvraid.o optional hptmv \
|
||||
dependency "$S/dev/hptmv/i386-elf.raid.o.uu" \
|
||||
compile-with "uudecode < $S/dev/hptmv/i386-elf.raid.o.uu" \
|
||||
no-implicit-rule
|
||||
|
||||
dev/hptmv/gui_lib.c optional hptmv
|
||||
dev/hptmv/hptproc.c optional hptmv
|
||||
dev/hptmv/ioctl.c optional hptmv
|
||||
dev/hptmv/entry.c optional hptmv
|
||||
dev/hptmv/mv.c optional hptmv
|
||||
|
||||
For amd64 system, edit /usr/src/sys/conf/files.amd64 and append the lines
|
||||
shown below:
|
||||
|
||||
hptmvraid.o optional hptmv \
|
||||
dependency "$S/dev/hptmv/amd64-elf.raid.o.uu" \
|
||||
compile-with "uudecode < $S/dev/hptmv/amd64-elf.raid.o.uu" \
|
||||
no-implicit-rule
|
||||
|
||||
dev/hptmv/gui_lib.c optional hptmv
|
||||
dev/hptmv/hptproc.c optional hptmv
|
||||
dev/hptmv/ioctl.c optional hptmv
|
||||
dev/hptmv/entry.c optional hptmv
|
||||
dev/hptmv/mv.c optional hptmv
|
||||
|
||||
Note FreeBSD 5.3/5.4 i386 already have a built-in RR182x driver, you should
|
||||
replace the old configuration lines with the lines listed above.
|
||||
|
||||
|
||||
6) Rebuild and install the kernel:
|
||||
|
||||
a) for FreeBSD 5.x-i386:
|
||||
|
||||
3. Using the driver
|
||||
---------------------
|
||||
1) Copy the driver module to /modules/ (FreeBSD 4.x) or /boot/kernel/
|
||||
(FreeBSD 5.x).
|
||||
|
||||
2) The driver can't be loaded by kldload command on a running system.
|
||||
Please load the driver during system booting stage. e.g:
|
||||
# cd /usr/src/sys/i386/conf/
|
||||
# /usr/sbin/config MYKERNEL
|
||||
# cd ../compile/MYKERNEL/
|
||||
# make depend
|
||||
# make
|
||||
# make install
|
||||
|
||||
b) for FreeBSD 5.x-amd64:
|
||||
|
||||
# cd /usr/src/sys/amd64/conf/
|
||||
# /usr/sbin/config MYKERNEL
|
||||
# cd ../compile/MYKERNEL/
|
||||
# make depend
|
||||
# make
|
||||
# make install
|
||||
|
||||
c) for FreeBSD 4.x:
|
||||
|
||||
# cd /usr/src/sys/i386/conf/
|
||||
# /usr/sbin/config MYKERNEL
|
||||
# cd ../../compile/MYKERNEL/
|
||||
# make depend
|
||||
# make
|
||||
# make install
|
||||
|
||||
If the driver was previously configured as an auto-loaded module by
|
||||
/boot/defaults/loader.conf, please remove the entry hptmv_load="YES"
|
||||
from loader.conf to prevent the driver from being loaded twice.
|
||||
|
||||
7) Reboot from the new kernel.
|
||||
|
||||
|
||||
3. Build/Load the driver as a kernel module
|
||||
------------------------------------------------
|
||||
|
||||
1) Install kernel source package and building tools.
|
||||
|
||||
2) Extract the driver files under the kernel source tree:
|
||||
|
||||
# cd /usr/src/sys/
|
||||
# tar xvzf /your/path/to/rr182x-opensource-v1.12-bsd.tgz
|
||||
|
||||
|
||||
4) Build the driver module:
|
||||
|
||||
# cd modules/hptmv
|
||||
# make
|
||||
|
||||
5) Copy the driver module to the kernel module directory
|
||||
|
||||
For FreeBSD 4.x:
|
||||
|
||||
# cp hptmv.ko /modules/
|
||||
|
||||
For FreeBSD 5.x:
|
||||
|
||||
# cp hptmv.ko /boot/kernel/
|
||||
|
||||
6) Reboot and load the driver under loader prompt. e.g:
|
||||
|
||||
BTX loader 1.00 BTX version is 1.01
|
||||
Console: internal video/keyboard
|
||||
@ -71,11 +177,18 @@ Revision History:
|
||||
Type '?' for a list of commands, 'help' for more detailed help.
|
||||
ok load hptmv
|
||||
/modules/hptmv.ko text=0xf571 data=0x2c8+0x254
|
||||
ok autoboot
|
||||
ok boot
|
||||
|
||||
For FreeBSD 5.x, you can select 6 on the boot menu to get a loader prompt.
|
||||
|
||||
Please refer to the installation guide in HighPoint FreeBSD driver release
|
||||
package for more information.
|
||||
|
||||
7) You can add a below line into /boot/defaults/loader.conf to load the
|
||||
driver automatically:
|
||||
|
||||
hptmv_load="YES"
|
||||
|
||||
Please refer to the installation guide in HighPoint FreeBSD driver release
|
||||
package for more information.
|
||||
|
||||
|
||||
#############################################################################
|
||||
Technical support and service
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 HighPoint Technologies, Inc.
|
||||
* Copyright (c) 2004-2005 HighPoint Technologies, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -250,8 +250,8 @@ struct fdisk_partition_table
|
||||
UCHAR endhead; /* ending head number */
|
||||
UCHAR endsect; /* ending sector number */
|
||||
UCHAR endcyl; /* also a 10 bit nmbr, with same high 2 bit trick */
|
||||
UINT relsect; /* first sector relative to start of disk */
|
||||
UINT numsect; /* number of sectors in partition */
|
||||
ULONG relsect; /* first sector relative to start of disk */
|
||||
ULONG numsect; /* number of sectors in partition */
|
||||
};
|
||||
|
||||
typedef struct _Master_Boot_Record
|
||||
|
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Makefile for RR182x FreeBSD driver
|
||||
# Copyright (c) 2003-2004 HighPoint Technologies, Inc. All rights reserved
|
||||
# Copyright (c) 2004-2005 HighPoint Technologies, Inc. All rights reserved
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
@ -10,12 +10,17 @@ HPTMV= ${.CURDIR}/../../dev/hptmv
|
||||
KMOD= hptmv
|
||||
SRCS= opt_scsi.h opt_cam.h
|
||||
SRCS+= bus_if.h device_if.h pci_if.h
|
||||
SRCS+= mv.c entry.c
|
||||
SRCS+= ioctl.c hptproc.c gui_lib.c
|
||||
SRCS+= mv.c entry.c ioctl.c hptproc.c gui_lib.c
|
||||
OBJS+= hptmvraid.o
|
||||
|
||||
hptmvraid.o: ${HPTMV}/i386-elf.raid.o.uu
|
||||
uudecode -p < ${HPTMV}/i386-elf.raid.o.uu > ${.TARGET}
|
||||
.if $(MACHINE_ARCH) == "amd64"
|
||||
HPTMV_RAID_O = amd64-elf.raid.o.uu
|
||||
.else
|
||||
HPTMV_RAID_O = i386-elf.raid.o.uu
|
||||
.endif
|
||||
|
||||
hptmvraid.o: ${HPTMV}/$(HPTMV_RAID_O)
|
||||
uudecode -p < ${HPTMV}/$(HPTMV_RAID_O) > ${.TARGET}
|
||||
|
||||
#
|
||||
# Debug Options:
|
||||
@ -42,6 +47,6 @@ DEBUGOPT += -DDEBUG_LEVEL=1
|
||||
DEBUGOPT += -DFOR_DEMO
|
||||
.endif
|
||||
|
||||
CFLAGS+= ${DEBUGOPT}
|
||||
|
||||
CFLAGS = ${DEBUGOPT}
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user