Update driver to vendor's version 1.16 plus some local changes:

- override_kernel_driver() has been removed since this is an
   in-tree version of driver.
 - __DATE__ and __TIME__ removed from version string to make
   binary update builders happy.
 - Utilize pause(9) for __FreeBSDversion >= 700033 (redo 167086).
 - Utilize kproc_suspend_check() for __FreeBSDversion >= 800002.
   (redo 172836).
 - Don't read past end of pVDevice (redo 143787).
 - Make sure that controller and channel are initialized (redo 169823).
 - Don't include cam/cam_xpt_periph.h (redo 158177).

MFC After:	3 days
This commit is contained in:
delphij 2009-04-07 16:38:25 +00:00
parent 74bdada627
commit 5758952bad
18 changed files with 4192 additions and 3654 deletions

View File

@ -28,6 +28,8 @@
#ifndef _ACCESS601_H_
#define _ACCESS601_H_
#ifndef FOR_DEMO
void HPTLIBAPI BeepOn(MV_BUS_ADDR_T BaseAddr);
void HPTLIBAPI BeepOff(MV_BUS_ADDR_T BaseAddr);
UCHAR HPTLIBAPI check_protect_circuit(MV_BUS_ADDR_T BaseAddr);
@ -40,4 +42,21 @@ void HPTLIBAPI set_fail_leds(MV_SATA_ADAPTER *pAdapter, UCHAR mask);
#define set_fail_leds(pAdapter, mask)
#endif
int HPTLIBAPI sx508x_ioctl(MV_SATA_ADAPTER *pSataAdapter, UCHAR *indata, ULONG inlen,
UCHAR *outdata, ULONG maxoutlen, ULONG *poutlen);
MV_BOOLEAN HPTLIBAPI sx508x_flash_access(MV_SATA_ADAPTER *pSataAdapter,
MV_U32 offset, void *value, int size, int reading);
#else
#define BeepOn(addr)
#define BeepOff(addr)
#define check_protect_circuit(addr) 1
#define set_fail_led(pAdapter, channel, state)
#define set_fail_leds(pAdapter, mask)
#define sx508x_ioctl(pSataAdapter, indata, inlen, outdata, maxoutlen, poutlen) 0
#define sx508x_flash_access(pSataAdapter, offset, value, size, reading) 0
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +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 */
ULONG failedStamps[4]; /* stamp for failed members */
USHORT bStripeWitch; /* = (1 << BlockSizeShift) */
USHORT rf_broken: 1;
@ -84,7 +84,7 @@ typedef struct _RaidArray
USHORT CriticalMembers; /* tell which member is critial */
UCHAR last_read; /* for RAID 1 load banlancing */
UCHAR PrivateFlag1;
UCHAR alreadyBroken;
LBA_T RebuildSectors; /* how many sectors is OK (LBA on member disk) */
@ -152,8 +152,8 @@ typedef struct _ArrayDescript
#define ArrayDescript_3_1_size 512
UCHAR bCheckSum31; /* new check sum */
UCHAR PrivateFlag1; /* private */
UCHAR reserve1;
UCHAR PrivateFlag1; /* private */
UCHAR alreadyBroken; /* last stamp has been saved to failedStamps */
#ifdef __BIG_ENDIAN_BITFIELD
UCHAR df_read_ahead: 1; /* enable read ahead */
@ -181,7 +181,7 @@ typedef struct _ArrayDescript
}
levelex[2];
ULONG failedStamp; /* array stamp for failed memebr */
ULONG failedStamps[4]; /* failed memebrs's stamps */
} ArrayDescript;

View File

@ -42,9 +42,9 @@ typedef struct _AtaCommand
typedef struct _PassthroughCmd {
BYTE bFeaturesReg; /* feature register */
BYTE bSectorCountReg; /* IDE sector count register. */
BYTE bSectorNumberReg; /* IDE sector number register. */
BYTE bCylLowReg; /* IDE low order cylinder value. */
BYTE bCylHighReg; /* IDE high order cylinder value. */
BYTE bLbaLowReg; /* IDE sector number register. */
BYTE bLbaMidReg; /* IDE low order cylinder value. */
BYTE bLbaHighReg; /* IDE high order cylinder value. */
BYTE bDriveHeadReg; /* IDE drive/head register. */
BYTE bCommandReg; /* Actual IDE command. Checked for validity by driver. */
BYTE nSectors; /* data transfer */
@ -247,7 +247,7 @@ DPC_ROUTINE;
* IdleRoutines[] size:
* Each command may invoke CallWhenIdle once.
*/
#define MAX_COMMAND_BLOCKS_FOR_EACH_VBUS (MAX_QUEUE_COMM * (1+MAX_MEMBERS*2))
#define MAX_COMMAND_BLOCKS_FOR_EACH_VBUS (MAX_QUEUE_COMM * (1+MAX_MEMBERS*2) + 1)
#define MAX_PENDING_ROUTINES (MAX_COMMAND_BLOCKS_FOR_EACH_VBUS+1)
#define MAX_IDLE_ROUTINES (MAX_COMMAND_BLOCKS_FOR_EACH_VBUS+1)

View File

@ -158,7 +158,7 @@ static ST_HPT_DPC DpcQueue[MAX_DPC];
static int DpcQueue_First=0;
static int DpcQueue_Last = 0;
char DRIVER_VERSION[] = "v1.12";
char DRIVER_VERSION[] = "v1.16";
#if (__FreeBSD_version >= 500000)
static struct mtx driver_lock;
@ -204,7 +204,7 @@ void unlock_driver(intrmask_t spl)
*
* Description: free allocated queues for the given channel
*
* Parameters: pMvSataAdapter - pointer to the RR182x controler this
* Parameters: pMvSataAdapter - pointer to the RR18xx controler this
* channel connected to.
* channelNum - channel number.
*
@ -238,7 +238,6 @@ static void failDevice(PVDevice pVDev)
}
int MvSataResetChannel(MV_SATA_ADAPTER *pMvSataAdapter, MV_U8 channel);
/*void fDeviceSendCommand(_VBUS_ARG PCommand pCmd); */
static void
handleEdmaError(_VBUS_ARG PCommand pCmd)
@ -292,7 +291,7 @@ hptmv_init_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
if (channelNum >= MV_SATA_CHANNELS_NUM)
{
MV_ERROR("RR182x[%d]: Bad channelNum=%d",
MV_ERROR("RR18xx[%d]: Bad channelNum=%d",
pAdapter->mvSataAdapter.adapterId, channelNum);
return -1;
}
@ -313,14 +312,14 @@ hptmv_init_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
/* check the 1K alignment of the request queue*/
if (req_dma_addr & 0x3ff)
{
MV_ERROR("RR182x[%d]: request queue allocated isn't 1 K aligned,"
MV_ERROR("RR18xx[%d]: request queue allocated isn't 1 K aligned,"
" dma_addr=%llx channel=%d\n", pAdapter->mvSataAdapter.adapterId,
(HPT_U64)(ULONG_PTR)req_dma_addr, channelNum);
return -1;
}
pMvSataChannel->requestQueuePciLowAddress = req_dma_addr;
pMvSataChannel->requestQueuePciHiAddress = 0;
KdPrint(("RR182x[%d,%d]: request queue allocated: 0x%p",
KdPrint(("RR18xx[%d,%d]: request queue allocated: 0x%p",
pAdapter->mvSataAdapter.adapterId, channelNum,
pMvSataChannel->requestQueue));
pMvSataChannel->responseQueue = (struct mvDmaResponseQueueEntry *)
@ -330,14 +329,14 @@ hptmv_init_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
/* check the 256 alignment of the response queue*/
if (rsp_dma_addr & 0xff)
{
MV_ERROR("RR182x[%d,%d]: response queue allocated isn't 256 byte "
MV_ERROR("RR18xx[%d,%d]: response queue allocated isn't 256 byte "
"aligned, dma_addr=%llx\n",
pAdapter->mvSataAdapter.adapterId, channelNum, (HPT_U64)(ULONG_PTR)rsp_dma_addr);
return -1;
}
pMvSataChannel->responseQueuePciLowAddress = rsp_dma_addr;
pMvSataChannel->responseQueuePciHiAddress = 0;
KdPrint(("RR182x[%d,%d]: response queue allocated: 0x%p",
KdPrint(("RR18xx[%d,%d]: response queue allocated: 0x%p",
pAdapter->mvSataAdapter.adapterId, channelNum,
pMvSataChannel->responseQueue));
@ -349,7 +348,7 @@ hptmv_init_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
* Name: hptmv_parse_identify_results
*
* Description: this functions parses the identify command results, checks
* that the connected deives can be accesed by RR182x EDMA,
* that the connected deives can be accesed by RR18xx EDMA,
* and updates the channel stucture accordingly.
*
* Parameters: pMvSataChannel, pointer to the channel data structure.
@ -507,14 +506,14 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
MV_CHANNEL *pChannelInfo = &(pAdapter->mvChannel[channelNum]);
MV_U32 udmaMode,pioMode;
KdPrint(("RR182x [%d]: start channel (%d)", pMvSataAdapter->adapterId,
KdPrint(("RR18xx [%d]: start channel (%d)", pMvSataAdapter->adapterId,
channelNum));
/* Software reset channel */
if (mvStorageDevATASoftResetDevice(pMvSataAdapter, channelNum) == MV_FALSE)
{
MV_ERROR("RR182x [%d,%d]: failed to perform Software reset\n",
MV_ERROR("RR18xx [%d,%d]: failed to perform Software reset\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
@ -527,7 +526,7 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
StallExec(5000000); /* wait 5 sec before trying again */
if (mvSataChannelHardReset(pMvSataAdapter, channelNum) == MV_FALSE)
{
MV_ERROR("RR182x [%d,%d]: failed to perform Hard reset\n",
MV_ERROR("RR18xx [%d,%d]: failed to perform Hard reset\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
@ -536,13 +535,13 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
/* identify device*/
if (mvStorageDevATAIdentifyDevice(pMvSataAdapter, channelNum) == MV_FALSE)
{
MV_ERROR("RR182x [%d,%d]: failed to perform ATA Identify command\n"
MV_ERROR("RR18xx [%d,%d]: failed to perform ATA Identify command\n"
, pMvSataAdapter->adapterId, channelNum);
return -1;
}
if (hptmv_parse_identify_results(pMvSataChannel))
{
MV_ERROR("RR182x [%d,%d]: Error in parsing ATA Identify message\n"
MV_ERROR("RR18xx [%d,%d]: Error in parsing ATA Identify message\n"
, pMvSataAdapter->adapterId, channelNum);
return -1;
}
@ -551,13 +550,13 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
/* Disable 8 bit PIO in case CFA enabled */
if (pMvSataChannel->identifyDevice[86] & 4)
{
KdPrint(("RR182x [%d]: Disable 8 bit PIO (CFA enabled) \n",
KdPrint(("RR18xx [%d]: Disable 8 bit PIO (CFA enabled) \n",
pMvSataAdapter->adapterId));
if (mvStorageDevATASetFeatures(pMvSataAdapter, channelNum,
MV_ATA_SET_FEATURES_DISABLE_8_BIT_PIO, 0,
0, 0, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d]: channel %d: mvStorageDevATASetFeatures"
MV_ERROR("RR18xx [%d]: channel %d: mvStorageDevATASetFeatures"
" failed\n", pMvSataAdapter->adapterId, channelNum);
return -1;
}
@ -572,48 +571,48 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
MV_ATA_SET_FEATURES_ENABLE_WCACHE, 0,
0, 0, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d]: channel %d: mvStorageDevATASetFeatures failed\n",
MV_ERROR("RR18xx [%d]: channel %d: mvStorageDevATASetFeatures failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
}
KdPrint(("RR182x [%d]: channel %d, write cache enabled\n",
KdPrint(("RR18xx [%d]: channel %d, write cache enabled\n",
pMvSataAdapter->adapterId, channelNum));
}
else
{
KdPrint(("RR182x [%d]: channel %d, write cache not supported\n",
KdPrint(("RR18xx [%d]: channel %d, write cache not supported\n",
pMvSataAdapter->adapterId, channelNum));
}
#else /* disable write cache */
{
if (pMvSataChannel->identifyDevice[85] & 0x20)
{
KdPrint(("RR182x [%d]: channel =%d, disable write cache\n",
KdPrint(("RR18xx [%d]: channel =%d, disable write cache\n",
pMvSataAdapter->adapterId, channelNum));
if (mvStorageDevATASetFeatures(pMvSataAdapter, channelNum,
MV_ATA_SET_FEATURES_DISABLE_WCACHE, 0,
0, 0, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d]: channel %d: mvStorageDevATASetFeatures failed\n",
MV_ERROR("RR18xx [%d]: channel %d: mvStorageDevATASetFeatures failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
}
KdPrint(("RR182x [%d]: channel=%d, write cache disabled\n",
KdPrint(("RR18xx [%d]: channel=%d, write cache disabled\n",
pMvSataAdapter->adapterId, channelNum));
}
#endif
/* Set transfer mode */
KdPrint(("RR182x [%d] Set transfer mode XFER_PIO_SLOW\n",
KdPrint(("RR18xx [%d] Set transfer mode XFER_PIO_SLOW\n",
pMvSataAdapter->adapterId));
if (mvStorageDevATASetFeatures(pMvSataAdapter, channelNum,
MV_ATA_SET_FEATURES_TRANSFER,
MV_ATA_TRANSFER_PIO_SLOW, 0, 0, 0) ==
MV_FALSE)
{
MV_ERROR("RR182x [%d] channel %d: Set Features failed\n",
MV_ERROR("RR18xx [%d] channel %d: Set Features failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
@ -632,14 +631,14 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
pioMode = MV_ATA_TRANSFER_PIO_SLOW;
}
KdPrint(("RR182x [%d] Set transfer mode XFER_PIO_4\n",
KdPrint(("RR18xx [%d] Set transfer mode XFER_PIO_4\n",
pMvSataAdapter->adapterId));
pAdapter->mvChannel[channelNum].maxPioModeSupported = pioMode;
if (mvStorageDevATASetFeatures(pMvSataAdapter, channelNum,
MV_ATA_SET_FEATURES_TRANSFER,
pioMode, 0, 0, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d] channel %d: Set Features failed\n",
MV_ERROR("RR18xx [%d] channel %d: Set Features failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
@ -666,7 +665,7 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
udmaMode = MV_ATA_TRANSFER_UDMA_2;
}
KdPrint(("RR182x [%d] Set transfer mode XFER_UDMA_%d\n",
KdPrint(("RR18xx [%d] Set transfer mode XFER_UDMA_%d\n",
pMvSataAdapter->adapterId, udmaMode & 0xf));
pChannelInfo->maxUltraDmaModeSupported = udmaMode;
@ -674,7 +673,7 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
MV_ATA_SET_FEATURES_TRANSFER, udmaMode,
0, 0, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d] channel %d: Set Features failed\n",
MV_ERROR("RR18xx [%d] channel %d: Set Features failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}*/
@ -721,48 +720,48 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
MV_ATA_SET_FEATURES_ENABLE_RLA, 0, 0,
0, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d] channel %d: Set Features failed\n",
MV_ERROR("RR18xx [%d] channel %d: Set Features failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
}
KdPrint(("RR182x [%d]: channel=%d, read look ahead enabled\n",
KdPrint(("RR18xx [%d]: channel=%d, read look ahead enabled\n",
pMvSataAdapter->adapterId, channelNum));
}
else
{
KdPrint(("RR182x [%d]: channel %d, Read Look Ahead not supported\n",
KdPrint(("RR18xx [%d]: channel %d, Read Look Ahead not supported\n",
pMvSataAdapter->adapterId, channelNum));
}
#else
{
if (pMvSataChannel->identifyDevice[86] & 0x20)
{
KdPrint(("RR182x [%d]:channel %d, disable read look ahead\n",
KdPrint(("RR18xx [%d]:channel %d, disable read look ahead\n",
pMvSataAdapter->adapterId, channelNum));
if (mvStorageDevATASetFeatures(pMvSataAdapter, channelNum,
MV_ATA_SET_FEATURES_DISABLE_RLA, 0, 0,
0, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d]:channel %d: ATA Set Features failed\n",
MV_ERROR("RR18xx [%d]:channel %d: ATA Set Features failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
}
KdPrint(("RR182x [%d]:channel %d, read look ahead disabled\n",
KdPrint(("RR18xx [%d]:channel %d, read look ahead disabled\n",
pMvSataAdapter->adapterId, channelNum));
}
#endif
{
KdPrint(("RR182x [%d]: channel %d config EDMA, Non Queued Mode\n",
KdPrint(("RR18xx [%d]: channel %d config EDMA, Non Queued Mode\n",
pMvSataAdapter->adapterId,
channelNum));
if (mvSataConfigEdmaMode(pMvSataAdapter, channelNum,
MV_EDMA_MODE_NOT_QUEUED, 0) == MV_FALSE)
{
MV_ERROR("RR182x [%d] channel %d Error: mvSataConfigEdmaMode failed\n",
MV_ERROR("RR18xx [%d] channel %d Error: mvSataConfigEdmaMode failed\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
@ -770,11 +769,11 @@ start_channel(IAL_ADAPTER_T *pAdapter, MV_U8 channelNum)
/* Enable EDMA */
if (mvSataEnableChannelDma(pMvSataAdapter, channelNum) == MV_FALSE)
{
MV_ERROR("RR182x [%d] Failed to enable DMA, channel=%d\n",
MV_ERROR("RR18xx [%d] Failed to enable DMA, channel=%d\n",
pMvSataAdapter->adapterId, channelNum);
return -1;
}
MV_ERROR("RR182x [%d,%d]: channel started successfully\n",
MV_ERROR("RR18xx [%d,%d]: channel started successfully\n",
pMvSataAdapter->adapterId, channelNum);
#ifndef FOR_DEMO
@ -799,12 +798,12 @@ hptmv_handle_event(void * data, int flag)
/* Handle only connects */
if (flag == 1)
break;
KdPrint(("RR182x [%d,%d]: new device connected\n",
KdPrint(("RR18xx [%d,%d]: new device connected\n",
pMvSataAdapter->adapterId, channelIndex));
hptmv_init_channel(pAdapter, channelIndex);
if (mvSataConfigureChannel( pMvSataAdapter, channelIndex) == MV_FALSE)
{
MV_ERROR("RR182x [%d,%d] Failed to configure\n",
MV_ERROR("RR18xx [%d,%d] Failed to configure\n",
pMvSataAdapter->adapterId, channelIndex);
hptmv_free_channel(pAdapter, channelIndex);
}
@ -813,7 +812,7 @@ hptmv_handle_event(void * data, int flag)
/*mvSataChannelHardReset(pMvSataAdapter, channel);*/
if (start_channel( pAdapter, channelIndex))
{
MV_ERROR("RR182x [%d,%d]Failed to start channel\n",
MV_ERROR("RR18xx [%d,%d]Failed to start channel\n",
pMvSataAdapter->adapterId, channelIndex);
hptmv_free_channel(pAdapter, channelIndex);
}
@ -829,7 +828,7 @@ hptmv_handle_event(void * data, int flag)
/* Handle only disconnects */
if (flag == 0)
break;
KdPrint(("RR182x [%d,%d]: device disconnected\n",
KdPrint(("RR18xx [%d,%d]: device disconnected\n",
pMvSataAdapter->adapterId, channelIndex));
/* Flush pending commands */
if(pMvSataAdapter->sataChannel[channelIndex])
@ -841,14 +840,14 @@ hptmv_handle_event(void * data, int flag)
mvSataRemoveChannel(pMvSataAdapter,channelIndex);
hptmv_free_channel(pAdapter, channelIndex);
pMvSataAdapter->sataChannel[channelIndex] = NULL;
KdPrint(("RR182x [%d,%d]: channel removed\n",
KdPrint(("RR18xx [%d,%d]: channel removed\n",
pMvSataAdapter->adapterId, channelIndex));
if (pAdapter->outstandingCommands==0 && DPC_Request_Nums==0)
Check_Idle_Call(pAdapter);
}
else
{
KdPrint(("RR182x [%d,%d]: channel already removed!!\n",
KdPrint(("RR18xx [%d,%d]: channel already removed!!\n",
pMvSataAdapter->adapterId, channelIndex));
}
pAdapter->sataEvents[channelIndex] = SATA_EVENT_NO_CHANGE;
@ -894,7 +893,7 @@ hptmv_event_notify(MV_SATA_ADAPTER *pMvSataAdapter, MV_EVENT_TYPE eventType,
if (param1 == EVENT_CONNECT)
{
pAdapter->sataEvents[channel] = SATA_EVENT_CHANNEL_CONNECTED;
KdPrint(("RR182x [%d,%d]: device connected event received\n",
KdPrint(("RR18xx [%d,%d]: device connected event received\n",
pMvSataAdapter->adapterId, channel));
/* Delete previous timers (if multiple drives connected in the same time */
pAdapter->event_timer_connect = timeout(hptmv_handle_event_connect, pAdapter, 10*hz);
@ -902,7 +901,7 @@ hptmv_event_notify(MV_SATA_ADAPTER *pMvSataAdapter, MV_EVENT_TYPE eventType,
else if (param1 == EVENT_DISCONNECT)
{
pAdapter->sataEvents[channel] = SATA_EVENT_CHANNEL_DISCONNECTED;
KdPrint(("RR182x [%d,%d]: device disconnected event received \n",
KdPrint(("RR18xx [%d,%d]: device disconnected event received \n",
pMvSataAdapter->adapterId, channel));
device_change(pAdapter, channel, FALSE);
/* Delete previous timers (if multiple drives disconnected in the same time */
@ -913,7 +912,7 @@ hptmv_event_notify(MV_SATA_ADAPTER *pMvSataAdapter, MV_EVENT_TYPE eventType,
else
{
MV_ERROR("RR182x: illigal value for param1(%d) at "
MV_ERROR("RR18xx: illigal value for param1(%d) at "
"connect/disconect event, host=%d\n", param1,
pMvSataAdapter->adapterId );
@ -921,11 +920,11 @@ hptmv_event_notify(MV_SATA_ADAPTER *pMvSataAdapter, MV_EVENT_TYPE eventType,
}
break;
case MV_EVENT_TYPE_ADAPTER_ERROR:
KdPrint(("RR182x: DEVICE error event received, pci cause "
KdPrint(("RR18xx: DEVICE error event received, pci cause "
"reg=%x, don't how to handle this\n", param1));
return MV_TRUE;
default:
MV_ERROR("RR182x[%d]: unknown event type (%d)\n",
MV_ERROR("RR18xx[%d]: unknown event type (%d)\n",
pMvSataAdapter->adapterId, eventType);
return MV_FALSE;
}
@ -939,7 +938,7 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0ul);
if (pAdapter->requestsArrayBaseAddr == NULL)
{
MV_ERROR("RR182x[%d]: Failed to allocate memory for EDMA request"
MV_ERROR("RR18xx[%d]: Failed to allocate memory for EDMA request"
" queues\n", pAdapter->mvSataAdapter.adapterId);
return -1;
}
@ -955,7 +954,7 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
if ((pAdapter->requestsArrayBaseDmaAlignedAddr - pAdapter->requestsArrayBaseDmaAddr) !=
(pAdapter->requestsArrayBaseAlignedAddr - pAdapter->requestsArrayBaseAddr))
{
MV_ERROR("RR182x[%d]: Error in Request Quueues Alignment\n",
MV_ERROR("RR18xx[%d]: Error in Request Quueues Alignment\n",
pAdapter->mvSataAdapter.adapterId);
contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF);
return -1;
@ -965,7 +964,7 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
M_DEVBUF, M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0ul);
if (pAdapter->responsesArrayBaseAddr == NULL)
{
MV_ERROR("RR182x[%d]: Failed to allocate memory for EDMA response"
MV_ERROR("RR18xx[%d]: Failed to allocate memory for EDMA response"
" queues\n", pAdapter->mvSataAdapter.adapterId);
contigfree(pAdapter->requestsArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF);
return -1;
@ -982,7 +981,7 @@ hptmv_allocate_edma_queues(IAL_ADAPTER_T *pAdapter)
if ((pAdapter->responsesArrayBaseDmaAlignedAddr - pAdapter->responsesArrayBaseDmaAddr) !=
(pAdapter->responsesArrayBaseAlignedAddr - pAdapter->responsesArrayBaseAddr))
{
MV_ERROR("RR182x[%d]: Error in Response Quueues Alignment\n",
MV_ERROR("RR18xx[%d]: Error in Response Quueues Alignment\n",
pAdapter->mvSataAdapter.adapterId);
contigfree(pAdapter->requestsArrayBaseAddr, REQUESTS_ARRAY_SIZE, M_DEVBUF);
contigfree(pAdapter->responsesArrayBaseAddr, RESPONSES_ARRAY_SIZE, M_DEVBUF);
@ -1065,8 +1064,8 @@ PVDevice
GetSpareDisk(_VBUS_ARG PVDevice pArray)
{
IAL_ADAPTER_T *pAdapter = (IAL_ADAPTER_T *)pArray->pVBus->OsExt;
ULONG capacity = LongDiv(pArray->VDeviceCapacity, pArray->u.array.bArnMember-1);
ULONG thiscap, maxcap = MAX_LBA_T;
LBA_T capacity = LongDiv(pArray->VDeviceCapacity, pArray->u.array.bArnMember-1);
LBA_T thiscap, maxcap = MAX_LBA_T;
PVDevice pVDevice, pFind = NULL;
int i;
@ -1131,6 +1130,127 @@ void HPTLIBAPI fDeSelectMode(PDevice pDev, UCHAR NewMode)
KdPrint(("Failed to enable DMA, channel=%d", channelIndex));
}
int HPTLIBAPI fDeSetTCQ(PDevice pDev, int enable, int depth)
{
MV_SATA_CHANNEL *pSataChannel = pDev->mv;
MV_SATA_ADAPTER *pSataAdapter = pSataChannel->mvSataAdapter;
MV_U8 channelIndex = pSataChannel->channelNumber;
IAL_ADAPTER_T *pAdapter = pSataAdapter->IALData;
MV_CHANNEL *channelInfo = &(pAdapter->mvChannel[channelIndex]);
int dmaActive = pSataChannel->queueCommandsEnabled;
int ret = 0;
if (dmaActive) {
mvSataDisableChannelDma(pSataAdapter, channelIndex);
mvSataFlushDmaQueue(pSataAdapter,channelIndex,MV_FLUSH_TYPE_CALLBACK);
}
if (enable) {
if (pSataChannel->queuedDMA == MV_EDMA_MODE_NOT_QUEUED &&
(pSataChannel->identifyDevice[IDEN_SUPPORTED_COMMANDS2] & (0x2))) {
UCHAR depth = ((pSataChannel->identifyDevice[IDEN_QUEUE_DEPTH]) & 0x1f) + 1;
channelInfo->queueDepth = (depth==32)? 31 : depth;
mvSataConfigEdmaMode(pSataAdapter, channelIndex, MV_EDMA_MODE_QUEUED, depth);
ret = 1;
}
}
else
{
if (pSataChannel->queuedDMA != MV_EDMA_MODE_NOT_QUEUED) {
channelInfo->queueDepth = 2;
mvSataConfigEdmaMode(pSataAdapter, channelIndex, MV_EDMA_MODE_NOT_QUEUED, 0);
ret = 1;
}
}
if (dmaActive)
mvSataEnableChannelDma(pSataAdapter,channelIndex);
return ret;
}
int HPTLIBAPI fDeSetNCQ(PDevice pDev, int enable, int depth)
{
return 0;
}
int HPTLIBAPI fDeSetWriteCache(PDevice pDev, int enable)
{
MV_SATA_CHANNEL *pSataChannel = pDev->mv;
MV_SATA_ADAPTER *pSataAdapter = pSataChannel->mvSataAdapter;
MV_U8 channelIndex = pSataChannel->channelNumber;
IAL_ADAPTER_T *pAdapter = pSataAdapter->IALData;
MV_CHANNEL *channelInfo = &(pAdapter->mvChannel[channelIndex]);
int dmaActive = pSataChannel->queueCommandsEnabled;
int ret = 0;
if (dmaActive) {
mvSataDisableChannelDma(pSataAdapter, channelIndex);
mvSataFlushDmaQueue(pSataAdapter,channelIndex,MV_FLUSH_TYPE_CALLBACK);
}
if ((pSataChannel->identifyDevice[82] & (0x20))) {
if (enable) {
if (mvStorageDevATASetFeatures(pSataAdapter, channelIndex,
MV_ATA_SET_FEATURES_ENABLE_WCACHE, 0, 0, 0, 0))
{
channelInfo->writeCacheEnabled = MV_TRUE;
ret = 1;
}
}
else {
if (mvStorageDevATASetFeatures(pSataAdapter, channelIndex,
MV_ATA_SET_FEATURES_DISABLE_WCACHE, 0, 0, 0, 0))
{
channelInfo->writeCacheEnabled = MV_FALSE;
ret = 1;
}
}
}
if (dmaActive)
mvSataEnableChannelDma(pSataAdapter,channelIndex);
return ret;
}
int HPTLIBAPI fDeSetReadAhead(PDevice pDev, int enable)
{
MV_SATA_CHANNEL *pSataChannel = pDev->mv;
MV_SATA_ADAPTER *pSataAdapter = pSataChannel->mvSataAdapter;
MV_U8 channelIndex = pSataChannel->channelNumber;
IAL_ADAPTER_T *pAdapter = pSataAdapter->IALData;
MV_CHANNEL *channelInfo = &(pAdapter->mvChannel[channelIndex]);
int dmaActive = pSataChannel->queueCommandsEnabled;
int ret = 0;
if (dmaActive) {
mvSataDisableChannelDma(pSataAdapter, channelIndex);
mvSataFlushDmaQueue(pSataAdapter,channelIndex,MV_FLUSH_TYPE_CALLBACK);
}
if ((pSataChannel->identifyDevice[82] & (0x40))) {
if (enable) {
if (mvStorageDevATASetFeatures(pSataAdapter, channelIndex,
MV_ATA_SET_FEATURES_ENABLE_RLA, 0, 0, 0, 0))
{
channelInfo->readAheadEnabled = MV_TRUE;
ret = 1;
}
}
else {
if (mvStorageDevATASetFeatures(pSataAdapter, channelIndex,
MV_ATA_SET_FEATURES_DISABLE_RLA, 0, 0, 0, 0))
{
channelInfo->readAheadEnabled = MV_FALSE;
ret = 1;
}
}
}
if (dmaActive)
mvSataEnableChannelDma(pSataAdapter,channelIndex);
return ret;
}
#ifdef SUPPORT_ARRAY
#define IdeRegisterVDevice fCheckArray
#else
@ -1166,9 +1286,12 @@ dmamap_put(PBUS_DMAMAP p)
/*Since mtx not provide the initialize when declare, so we Final init here to initialize the global mtx*/
#if __FreeBSD_version >= 500000
#define override_kernel_driver()
static void hpt_init(void *dummy)
{
mtx_init(&driver_lock, "hptlock", NULL, MTX_DEF);
override_kernel_driver();
mtx_init(&driver_lock, "hptsleeplock", NULL, MTX_DEF);
}
SYSINIT(hptinit, SI_SUB_CONFIGURE, SI_ORDER_FIRST, hpt_init, NULL);
#endif
@ -1183,6 +1306,8 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
PVDevice pVDev;
intrmask_t oldspl = lock_driver();
pAdapter->next = 0;
if(gIal_Adapter == 0){
@ -1222,7 +1347,8 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
if (hptmv_allocate_edma_queues(pAdapter))
{
MV_ERROR("RR182x: Failed to allocate memory for EDMA queues\n");
MV_ERROR("RR18xx: Failed to allocate memory for EDMA queues\n");
unlock_driver(oldspl);
return ENOMEM;
}
@ -1233,13 +1359,14 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
||
!(pMvSataAdapter->adapterIoBaseAddress = rman_get_virtual(pAdapter->mem_res)))
{
MV_ERROR("RR182x: Failed to remap memory space\n");
MV_ERROR("RR18xx: Failed to remap memory space\n");
hptmv_free_edma_queues(pAdapter);
unlock_driver(oldspl);
return ENXIO;
}
else
{
KdPrint(("RR182x: io base address 0x%p\n", pMvSataAdapter->adapterIoBaseAddress));
KdPrint(("RR18xx: io base address 0x%p\n", pMvSataAdapter->adapterIoBaseAddress));
}
pMvSataAdapter->adapterId = num_adapters++;
@ -1247,7 +1374,7 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
pMvSataAdapter->pciConfigRevisionId = pci_read_config(pAdapter->hpt_dev, PCIR_REVID, 1);
pMvSataAdapter->pciConfigDeviceId = pci_get_device(pAdapter->hpt_dev);
/* init RR182x */
/* init RR18xx */
pMvSataAdapter->intCoalThre[0]= 1;
pMvSataAdapter->intCoalThre[1]= 1;
pMvSataAdapter->intTimeThre[0] = 1;
@ -1259,11 +1386,12 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
if (mvSataInitAdapter(pMvSataAdapter) == MV_FALSE)
{
MV_ERROR("RR182x[%d]: core failed to initialize the adapter\n",
MV_ERROR("RR18xx[%d]: core failed to initialize the adapter\n",
pMvSataAdapter->adapterId);
unregister:
bus_release_resource(pAdapter->hpt_dev, SYS_RES_MEMORY, rid, pAdapter->mem_res);
hptmv_free_edma_queues(pAdapter);
unlock_driver(oldspl);
return ENXIO;
}
pAdapter->ver_601 = pMvSataAdapter->pcbVersion;
@ -1341,14 +1469,14 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
if (mvSataIsStorageDeviceConnected(pMvSataAdapter, channel)
== MV_TRUE)
{
KdPrint(("RR182x[%d]: channel %d is connected\n",
KdPrint(("RR18xx[%d]: channel %d is connected\n",
pMvSataAdapter->adapterId, channel));
if (hptmv_init_channel(pAdapter, channel) == 0)
{
if (mvSataConfigureChannel(pMvSataAdapter, channel) == MV_FALSE)
{
MV_ERROR("RR182x[%d]: Failed to configure channel"
MV_ERROR("RR18xx[%d]: Failed to configure channel"
" %d\n",pMvSataAdapter->adapterId, channel);
hptmv_free_channel(pAdapter, channel);
}
@ -1356,7 +1484,7 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
{
if (start_channel(pAdapter, channel))
{
MV_ERROR("RR182x[%d]: Failed to start channel,"
MV_ERROR("RR18xx[%d]: Failed to start channel,"
" channel=%d\n",pMvSataAdapter->adapterId,
channel);
hptmv_free_channel(pAdapter, channel);
@ -1402,10 +1530,11 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
#if defined(SUPPORT_ARRAY) && defined(_RAID5N_)
init_raid5_memory(_VBUS_P0);
_vbus_(r5).enable_write_back = 1;
printf("RR182x: RAID5 write-back %s\n", _vbus_(r5).enable_write_back? "enabled" : "disabled");
printf("RR18xx: RAID5 write-back %s\n", _vbus_(r5).enable_write_back? "enabled" : "disabled");
#endif
mvSataUnmaskAdapterInterrupt(pMvSataAdapter);
unlock_driver(oldspl);
return 0;
}
@ -1421,7 +1550,7 @@ MvSataResetChannel(MV_SATA_ADAPTER *pMvSataAdapter, MV_U8 channel)
/* Software reset channel */
if (mvStorageDevATASoftResetDevice(pMvSataAdapter, channel) == MV_FALSE)
{
MV_ERROR("RR182x [%d,%d]: failed to perform Software reset\n",
MV_ERROR("RR18xx [%d,%d]: failed to perform Software reset\n",
pMvSataAdapter->adapterId, channel);
hptmv_free_channel(pAdapter, channel);
return -1;
@ -1430,7 +1559,7 @@ MvSataResetChannel(MV_SATA_ADAPTER *pMvSataAdapter, MV_U8 channel)
/* Hardware reset channel */
if (mvSataChannelHardReset(pMvSataAdapter, channel)== MV_FALSE)
{
MV_ERROR("RR182x [%d,%d] Failed to Hard reser the SATA channel\n",
MV_ERROR("RR18xx [%d,%d] Failed to Hard reser the SATA channel\n",
pMvSataAdapter->adapterId, channel);
hptmv_free_channel(pAdapter, channel);
return -1;
@ -1438,7 +1567,7 @@ MvSataResetChannel(MV_SATA_ADAPTER *pMvSataAdapter, MV_U8 channel)
if (mvSataIsStorageDeviceConnected(pMvSataAdapter, channel) == MV_FALSE)
{
MV_ERROR("RR182x [%d,%d] Failed to Connect Device\n",
MV_ERROR("RR18xx [%d,%d] Failed to Connect Device\n",
pMvSataAdapter->adapterId, channel);
hptmv_free_channel(pAdapter, channel);
return -1;
@ -1632,7 +1761,7 @@ fDeviceSendCommand(_VBUS_ARG PCommand pCmd)
MV_SATA_CHANNEL *pMvSataChannel;
PVDevice pVDevice = pCmd->pVDevice;
PDevice pDevice = &pVDevice->u.disk;
ULONG Lba = pCmd->uCmd.Ide.Lba;
LBA_T Lba = pCmd->uCmd.Ide.Lba;
USHORT nSector = pCmd->uCmd.Ide.nSectors;
MV_QUEUE_COMMAND_RESULT result;
@ -1640,7 +1769,7 @@ fDeviceSendCommand(_VBUS_ARG PCommand pCmd)
MV_UDMA_COMMAND_PARAMS *pUdmaParams = &commandInfo.commandParams.udmaCommand;
MV_NONE_UDMA_COMMAND_PARAMS *pNoUdmaParams = &commandInfo.commandParams.NoneUdmaCommand;
MV_BOOLEAN is48bit = MV_FALSE;
MV_BOOLEAN is48bit;
MV_U8 channel;
int i=0;
@ -1667,9 +1796,12 @@ fDeviceSendCommand(_VBUS_ARG PCommand pCmd)
return;
}
if(Lba & 0xF0000000){
is48bit = MV_TRUE;
}
/*
* always use 48bit LBA if drive supports it.
* Some Seagate drives report error if you use a 28-bit command
* to access sector 0xfffffff.
*/
is48bit = pMvSataChannel->lba48Address;
switch (pCmd->uCmd.Ide.Command)
{
@ -1929,7 +2061,13 @@ hpt_attach(device_t dev)
return(ENXIO);
}
if(bus_setup_intr(pAdapter->hpt_dev, pAdapter->hpt_irq, INTR_TYPE_CAM, NULL, hpt_intr, pAdapter, &pAdapter->hpt_intr))
#if __FreeBSD_version <700000
if (bus_setup_intr(pAdapter->hpt_dev, pAdapter->hpt_irq, INTR_TYPE_CAM,
hpt_intr, pAdapter, &pAdapter->hpt_intr))
#else
if (bus_setup_intr(pAdapter->hpt_dev, pAdapter->hpt_irq, INTR_TYPE_CAM,
NULL, hpt_intr, pAdapter, &pAdapter->hpt_intr))
#endif
{
hpt_printk(("can't set up interrupt\n"));
free(pAdapter, M_DEVBUF);
@ -1959,14 +2097,23 @@ hpt_attach(device_t dev)
/*
* Construct our SIM entry
*/
if ((hpt_vsim = cam_sim_alloc(hpt_action, hpt_poll, __str(PROC_DIR_NAME),
pAdapter, device_get_unit(pAdapter->hpt_dev),
&Giant, /*untagged*/1, /*tagged*/8, devq)) == NULL) {
#if __FreeBSD_version <700000
hpt_vsim = cam_sim_alloc(hpt_action, hpt_poll, __str(PROC_DIR_NAME),
pAdapter, device_get_unit(pAdapter->hpt_dev), 1, 8, devq);
#else
hpt_vsim = cam_sim_alloc(hpt_action, hpt_poll, __str(PROC_DIR_NAME),
pAdapter, device_get_unit(pAdapter->hpt_dev), &Giant, 1, 8, devq);
#endif
if (hpt_vsim == NULL) {
cam_simq_free(devq);
return ENOMEM;
}
if(xpt_bus_register(hpt_vsim, dev, 0) != CAM_SUCCESS)
#if __FreeBSD_version <700000
if (xpt_bus_register(hpt_vsim, 0) != CAM_SUCCESS)
#else
if (xpt_bus_register(hpt_vsim, dev, 0) != CAM_SUCCESS)
#endif
{
cam_sim_free(hpt_vsim, /*free devq*/ TRUE);
hpt_vsim = NULL;
@ -2358,7 +2505,11 @@ static void hpt_worker_thread(void)
#if (__FreeBSD_version < 500000)
YIELD_THREAD;
#else
#if (__FreeBSD_version > 700033)
pause("sched", 1);
#else
tsleep((caddr_t)hpt_worker_thread, PPAUSE, "sched", 1);
#endif
#endif
if (SIGISMEMBER(curproc->p_siglist, SIGSTOP)) {
/* abort rebuilding process. */
@ -2392,15 +2543,25 @@ static void hpt_worker_thread(void)
/*
#ifdef DEBUG
if (SIGISMEMBER(curproc->p_siglist, SIGSTOP))
#if (__FreeBSD_version > 700033)
pause("hptrdy", 2*hz);
#else
tsleep((caddr_t)hpt_worker_thread, PPAUSE, "hptrdy", 2*hz);
#endif
#endif
*/
#if (__FreeBSD_version >= 500043)
#if (__FreeBSD_version >= 800002)
kproc_suspend_check(curproc);
#elif (__FreeBSD_version >= 500043)
kthread_suspend_check(curproc);
#else
kproc_suspend_loop(curproc);
#endif
#if (__FreeBSD_version > 700033)
pause("hptrdy", 2*hz); /* wait for something to do */
#else
tsleep((caddr_t)hpt_worker_thread, PPAUSE, "hptrdy", 2*hz); /* wait for something to do */
#endif
}
}
@ -2537,7 +2698,7 @@ SetInquiryData(PINQUIRYDATA inquiryData, PVDevice pVDev)
}
break;
default:
memcpy(&inquiryData->VendorId, "RR182x ", 8);
memcpy(&inquiryData->VendorId, "RR18xx ", 8);
#ifdef SUPPORT_ARRAY
switch(pVDev->VDeviceType){
case VD_RAID_0:
@ -2659,20 +2820,57 @@ OsSendCommand(_VBUS_ARG union ccb *ccb)
case READ_CAPACITY:
{
UCHAR swip[4];
UCHAR *rbuf=csio->data_ptr;
unsigned int cap;
if (pVDev->VDeviceCapacity > 0xfffffffful) {
cap = 0xfffffffful;
} else {
cap = pVDev->VDeviceCapacity - 1;
}
rbuf[0] = (UCHAR)(cap>>24);
rbuf[1] = (UCHAR)(cap>>16);
rbuf[2] = (UCHAR)(cap>>8);
rbuf[3] = (UCHAR)cap;
/* Claim 512 byte blocks (big-endian). */
((PREAD_CAPACITY_DATA)csio->data_ptr)->BytesPerBlock = 0x20000;
*(ULONG*)swip = pVDev->VDeviceCapacity - 1;
((PREAD_CAPACITY_DATA)csio->data_ptr)->LogicalBlockAddress =
(swip[0] << 24) | (swip[1] << 16) | (swip[2] << 8) | swip[3];
rbuf[4] = 0;
rbuf[5] = 0;
rbuf[6] = 2;
rbuf[7] = 0;
ccb_h->status = CAM_REQ_CMP;
break;
}
case 0x9e: /*SERVICE_ACTION_IN*/
{
UCHAR *rbuf = csio->data_ptr;
LBA_T cap = pVDev->VDeviceCapacity - 1;
rbuf[0] = (UCHAR)(cap>>56);
rbuf[1] = (UCHAR)(cap>>48);
rbuf[2] = (UCHAR)(cap>>40);
rbuf[3] = (UCHAR)(cap>>32);
rbuf[4] = (UCHAR)(cap>>24);
rbuf[5] = (UCHAR)(cap>>16);
rbuf[6] = (UCHAR)(cap>>8);
rbuf[7] = (UCHAR)cap;
rbuf[8] = 0;
rbuf[9] = 0;
rbuf[10] = 2;
rbuf[11] = 0;
ccb_h->status = CAM_REQ_CMP;
break;
}
case READ_6:
case WRITE_6:
case READ_10:
case WRITE_10:
case 0x88: /* READ_16 */
case 0x8a: /* WRITE_16 */
case 0x13:
case 0x2f:
{
@ -2716,6 +2914,20 @@ OsSendCommand(_VBUS_ARG union ccb *ccb)
pCmd->uCmd.Ide.nSectors = (USHORT) Cdb[4];
break;
case 0x88: /* READ_16 */
case 0x8a: /* WRITE_16 */
pCmd->uCmd.Ide.Lba =
(HPT_U64)Cdb[2] << 56 |
(HPT_U64)Cdb[3] << 48 |
(HPT_U64)Cdb[4] << 40 |
(HPT_U64)Cdb[5] << 32 |
(HPT_U64)Cdb[6] << 24 |
(HPT_U64)Cdb[7] << 16 |
(HPT_U64)Cdb[8] << 8 |
(HPT_U64)Cdb[9];
pCmd->uCmd.Ide.nSectors = (USHORT)Cdb[12] << 8 | (USHORT)Cdb[13];
break;
default:
pCmd->uCmd.Ide.Lba = (ULONG)Cdb[5] | ((ULONG)Cdb[4] << 8) | ((ULONG)Cdb[3] << 16) | ((ULONG)Cdb[2] << 24);
pCmd->uCmd.Ide.nSectors = (USHORT) Cdb[8] | ((USHORT)Cdb[7]<<8);
@ -2726,12 +2938,14 @@ OsSendCommand(_VBUS_ARG union ccb *ccb)
{
case READ_6:
case READ_10:
case 0x88: /* READ_16 */
pCmd->uCmd.Ide.Command = IDE_COMMAND_READ;
pCmd->cf_data_in = 1;
break;
case WRITE_6:
case WRITE_10:
case 0x8a: /* WRITE_16 */
pCmd->uCmd.Ide.Command = IDE_COMMAND_WRITE;
pCmd->cf_data_out = 1;
break;

View File

@ -33,12 +33,12 @@
#include <dev/hptmv/mvStorageDev.h>
#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 COPYRIGHT "(c) 2000-2007. HighPoint Technologies, Inc."
#define DRIVER_NAME "RocketRAID 18xx SATA Controller driver"
#define CONTROLLER_NAME "RocketRAID 18xx SATA Controller"
#define PROC_DIR_NAME hptmv
#define HPT_INTERFACE_VERSION 0x01000003
#define HPT_INTERFACE_VERSION 0x01010000
#define SUPPORT_48BIT_LBA
#define SUPPORT_ARRAY
#define SUPPORT_RAID5 1
@ -193,6 +193,10 @@ extern void HPTLIBAPI ioctl_ReportEvent(UCHAR event, PVOID param);
int HPTLIBAPI fDeReadWrite(PDevice pDev, ULONG Lba, UCHAR Cmd, void *tmpBuffer);
void HPTLIBAPI fDeSelectMode(PDevice pDev, UCHAR NewMode);
int HPTLIBAPI fDeSetTCQ(PDevice pDev, int enable, int depth);
int HPTLIBAPI fDeSetNCQ(PDevice pDev, int enable, int depth);
int HPTLIBAPI fDeSetWriteCache(PDevice pDev, int enable);
int HPTLIBAPI fDeSetReadAhead(PDevice pDev, int enable);
#include <dev/hptmv/atapi.h>
#include <dev/hptmv/command.h>

View File

@ -57,11 +57,14 @@ static int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo);
static int hpt_get_channel_info(int id, int bus, PCHANNEL_INFO pInfo);
static int hpt_get_logical_devices(DEVICEID * pIds, int nMaxCount);
static int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo);
static int hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo);
static DEVICEID hpt_create_array(_VBUS_ARG PCREATE_ARRAY_PARAMS pParam);
static DEVICEID hpt_create_array_v2(_VBUS_ARG PCREATE_ARRAY_PARAMS_V2 pParam);
static int hpt_add_spare_disk(_VBUS_ARG DEVICEID idDisk);
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);
static int hpt_set_device_info_v2(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo);
int
check_VDevice_valid(PVDevice p)
@ -97,82 +100,65 @@ check_VDevice_valid(PVDevice p)
}
#ifdef SUPPORT_ARRAY
static void get_array_info(PVDevice pVDevice, PLOGICAL_DEVICE_INFO pInfo)
{
int i;
pInfo->Type = LDT_ARRAY;
pInfo->Capacity = pVDevice->VDeviceCapacity;
pInfo->ParentArray = VDEV_TO_ID(pVDevice->pParent);
memcpy(pInfo->u.array.Name, pVDevice->u.array.ArrayName, MAX_ARRAY_NAME);
switch( pVDevice->VDeviceType )
static UCHAR get_vdev_type(PVDevice pVDevice)
{
case VD_RAID_0:
pInfo->u.array.ArrayType = AT_RAID0;
break;
case VD_RAID_1:
pInfo->u.array.ArrayType = AT_RAID1;
break;
case VD_JBOD:
pInfo->u.array.ArrayType = AT_JBOD;
break;
case VD_RAID_5:
pInfo->u.array.ArrayType = AT_RAID5;
break;
default:
pInfo->u.array.ArrayType = AT_UNKNOWN;
switch (pVDevice->VDeviceType) {
case VD_RAID_0: return AT_RAID0;
case VD_RAID_1: return AT_RAID1;
case VD_JBOD: return AT_JBOD;
case VD_RAID_5: return AT_RAID5;
default: return AT_UNKNOWN;
}
}
pInfo->u.array.BlockSizeShift = pVDevice->u.array.bArBlockSizeShift;
pInfo->u.array.RebuiltSectors = pVDevice->u.array.RebuildSectors;
static DWORD get_array_flag(PVDevice pVDevice)
{
int i;
DWORD f = 0;
/* The array is disabled */
if(!pVDevice->vf_online) {
pInfo->u.array.Flags |= ARRAY_FLAG_DISABLED;
goto ignore_info;
f |= ARRAY_FLAG_DISABLED;
/* Ignore other info */
return f;
}
/* array need synchronizing */
if(pVDevice->u.array.rf_need_rebuild && !pVDevice->u.array.rf_duplicate_and_create)
pInfo->u.array.Flags |= ARRAY_FLAG_NEEDBUILDING;
pInfo->u.array.RebuildingProgress = ((pVDevice->u.array.RebuildSectors>>11)*1000 /
(pVDevice->VDeviceCapacity>>11) * (pVDevice->u.array.bArnMember-1)) * 10;
f |= ARRAY_FLAG_NEEDBUILDING;
/* array is in rebuilding process */
if(pVDevice->u.array.rf_rebuilding)
pInfo->u.array.Flags |= ARRAY_FLAG_REBUILDING;
f |= ARRAY_FLAG_REBUILDING;
/* array is being verified */
if(pVDevice->u.array.rf_verifying)
pInfo->u.array.Flags |= ARRAY_FLAG_VERIFYING;
f |= ARRAY_FLAG_VERIFYING;
/* array is being initialized */
if(pVDevice->u.array.rf_initializing)
pInfo->u.array.Flags |= ARRAY_FLAG_INITIALIZING;
f |= ARRAY_FLAG_INITIALIZING;
/* broken but may still working */
if(pVDevice->u.array.rf_broken)
pInfo->u.array.Flags |= ARRAY_FLAG_BROKEN;
f |= ARRAY_FLAG_BROKEN;
/* array has a active partition */
if(pVDevice->vf_bootable)
pInfo->u.array.Flags |= ARRAY_FLAG_BOOTDISK;
f |= ARRAY_FLAG_BOOTDISK;
/* a newly created array */
if(pVDevice->u.array.rf_newly_created)
pInfo->u.array.Flags |= ARRAY_FLAG_NEWLY_CREATED;
f |= ARRAY_FLAG_NEWLY_CREATED;
/* array has boot mark set */
if(pVDevice->vf_bootmark)
pInfo->u.array.Flags |= ARRAY_FLAG_BOOTMARK;
f |= ARRAY_FLAG_BOOTMARK;
/* auto-rebuild should start */
if(pVDevice->u.array.rf_auto_rebuild)
pInfo->u.array.Flags |= ARRAY_FLAG_NEED_AUTOREBUILD;
f |= ARRAY_FLAG_NEED_AUTOREBUILD;
for(i = 0; i < pVDevice->u.array.bArnMember; i++)
{
@ -183,94 +169,128 @@ static void get_array_info(PVDevice pVDevice, PLOGICAL_DEVICE_INFO pInfo)
/* array need synchronizing */
if(pMember->u.array.rf_need_rebuild &&
!pMember->u.array.rf_duplicate_and_create)
pInfo->u.array.Flags |= ARRAY_FLAG_NEEDBUILDING;
f |= ARRAY_FLAG_NEEDBUILDING;
/* array is in rebuilding process */
if(pMember->u.array.rf_rebuilding)
pInfo->u.array.Flags |= ARRAY_FLAG_REBUILDING;
f |= ARRAY_FLAG_REBUILDING;
/* array is being verified */
if(pMember->u.array.rf_verifying)
pInfo->u.array.Flags |= ARRAY_FLAG_VERIFYING;
f |= ARRAY_FLAG_VERIFYING;
/* array is being initialized */
if(pMember->u.array.rf_initializing)
pInfo->u.array.Flags |= ARRAY_FLAG_INITIALIZING;
f |= ARRAY_FLAG_INITIALIZING;
/* broken but may still working */
if(pMember->u.array.rf_broken)
pInfo->u.array.Flags |= ARRAY_FLAG_BROKEN;
f |= ARRAY_FLAG_BROKEN;
/* a newly created array */
if(pMember->u.array.rf_newly_created)
pInfo->u.array.Flags |= ARRAY_FLAG_NEWLY_CREATED;
f |= ARRAY_FLAG_NEWLY_CREATED;
/* auto-rebuild should start */
if(pMember->u.array.rf_auto_rebuild)
pInfo->u.array.Flags |= ARRAY_FLAG_NEED_AUTOREBUILD;
f |= ARRAY_FLAG_NEED_AUTOREBUILD;
}
return f;
}
static DWORD calc_rebuild_progress(PVDevice pVDevice)
{
int i;
DWORD result = ((ULONG)(pVDevice->u.array.RebuildSectors>>11)*1000 /
(ULONG)(pVDevice->VDeviceCapacity>>11) * (pVDevice->u.array.bArnMember-1)) * 10;
for(i = 0; i < pVDevice->u.array.bArnMember; i++)
{
PVDevice pMember = pVDevice->u.array.pMember[i];
if (!pMember || !pMember->vf_online || (pMember->VDeviceType==VD_SINGLE_DISK))
continue;
/* for RAID1/0 case */
if (pMember->u.array.rf_rebuilding ||
pMember->u.array.rf_verifying ||
pMember->u.array.rf_initializing)
{
DWORD percent = ((pMember->u.array.RebuildSectors>>11)*1000 /
(pMember->VDeviceCapacity>>11) * (pMember->u.array.bArnMember-1)) * 10;
if (pInfo->u.array.RebuildingProgress==0 ||
pInfo->u.array.RebuildingProgress>percent)
pInfo->u.array.RebuildingProgress = percent;
DWORD percent = ((ULONG)(pMember->u.array.RebuildSectors>>11)*1000 /
(ULONG)(pMember->VDeviceCapacity>>11) * (pMember->u.array.bArnMember-1)) * 10;
if (result==0 || result>percent)
result = percent;
}
}
if (result>10000) result = 10000;
return result;
}
if (pInfo->u.array.RebuildingProgress>10000)
pInfo->u.array.RebuildingProgress = 10000;
static void get_array_info(PVDevice pVDevice, PHPT_ARRAY_INFO pArrayInfo)
{
int i;
ignore_info:
memcpy(pArrayInfo->Name, pVDevice->u.array.ArrayName, MAX_ARRAY_NAME);
pArrayInfo->ArrayType = get_vdev_type(pVDevice);
pArrayInfo->BlockSizeShift = pVDevice->u.array.bArBlockSizeShift;
pArrayInfo->RebuiltSectors = pVDevice->u.array.RebuildSectors;
pArrayInfo->Flags = get_array_flag(pVDevice);
pArrayInfo->RebuildingProgress = calc_rebuild_progress(pVDevice);
pInfo->u.array.nDisk = 0;
for(i=0; i<MAX_ARRAY_MEMBERS; i++)
pInfo->u.array.Members[i] = INVALID_DEVICEID;
pArrayInfo->nDisk = 0;
for(i = 0; i < pVDevice->u.array.bArnMember; i++)
{
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++;
}
if(pVDevice->u.array.pMember[i] != NULL)
pArrayInfo->Members[pArrayInfo->nDisk++] = VDEV_TO_ID(pVDevice->u.array.pMember[i]);
for(i=pArrayInfo->nDisk; i<MAX_ARRAY_MEMBERS; i++)
pArrayInfo->Members[i] = INVALID_DEVICEID;
}
static void get_array_info_v2(PVDevice pVDevice, PHPT_ARRAY_INFO_V2 pArrayInfo)
{
int i;
memcpy(pArrayInfo->Name, pVDevice->u.array.ArrayName, MAX_ARRAYNAME_LEN);
pArrayInfo->ArrayType = get_vdev_type(pVDevice);
pArrayInfo->BlockSizeShift = pVDevice->u.array.bArBlockSizeShift;
pArrayInfo->RebuiltSectors.lo32 = pVDevice->u.array.RebuildSectors;
pArrayInfo->RebuiltSectors.hi32 = sizeof(LBA_T)>4? (pVDevice->u.array.RebuildSectors>>32) : 0;
pArrayInfo->Flags = get_array_flag(pVDevice);
pArrayInfo->RebuildingProgress = calc_rebuild_progress(pVDevice);
pArrayInfo->nDisk = 0;
for(i = 0; i < pVDevice->u.array.bArnMember; i++)
if(pVDevice->u.array.pMember[i] != NULL)
pArrayInfo->Members[pArrayInfo->nDisk++] = VDEV_TO_ID(pVDevice->u.array.pMember[i]);
for(i=pArrayInfo->nDisk; i<MAX_ARRAY_MEMBERS_V2; i++)
pArrayInfo->Members[i] = INVALID_DEVICEID;
}
#endif
static int get_disk_info(PVDevice pVDevice, PLOGICAL_DEVICE_INFO pInfo)
static int get_disk_info(PVDevice pVDevice, PDEVICE_INFO pDiskInfo)
{
MV_SATA_ADAPTER *pSataAdapter;
MV_SATA_CHANNEL *pSataChannel;
IAL_ADAPTER_T *pAdapter;
MV_CHANNEL *channelInfo;
char *p;
int i;
pInfo->Type = LDT_DEVICE;
if (pVDevice->pParent)
pInfo->ParentArray = VDEV_TO_ID(pVDevice->pParent);
else
pInfo->ParentArray = INVALID_DEVICEID;
/* report real capacity to be compatible with old arrays */
pInfo->Capacity = pVDevice->u.disk.dDeRealCapacity;
/* device location */
pSataChannel = pVDevice->u.disk.mv;
if(pSataChannel == NULL) return -1;
pInfo->u.device.TargetId = 0;
pDiskInfo->TargetId = 0;
pSataAdapter = pSataChannel->mvSataAdapter;
if(pSataAdapter == NULL) return -1;
pAdapter = pSataAdapter->IALData;
pInfo->u.device.PathId = pSataChannel->channelNumber;
pInfo->u.device.ControllerId = (UCHAR)pSataAdapter->adapterId;
pDiskInfo->PathId = pSataChannel->channelNumber;
pDiskInfo->ControllerId = (UCHAR)pSataAdapter->adapterId;
/*GUI uses DeviceModeSetting to display to users
(1) if users select a mode, GUI/BIOS should display that mode.
@ -278,48 +298,58 @@ static int get_disk_info(PVDevice pVDevice, PLOGICAL_DEVICE_INFO pInfo)
(3) display real mode if case (1)&&(2) not satisfied.
*/
if (pVDevice->u.disk.df_user_mode_set)
pInfo->u.device.DeviceModeSetting = pVDevice->u.disk.bDeUserSelectMode;
else if ((((PIDENTIFY_DATA)pVDevice->u.disk.mv->identifyDevice)->SataCapability & 3)==2)
pInfo->u.device.DeviceModeSetting = 15;
pDiskInfo->DeviceModeSetting = pVDevice->u.disk.bDeUserSelectMode;
else if (((((PIDENTIFY_DATA)pVDevice->u.disk.mv->identifyDevice)->SataCapability) & 3)==2)
pDiskInfo->DeviceModeSetting = 15;
else {
p = (char *)&((PIDENTIFY_DATA)pVDevice->u.disk.mv->identifyDevice)->ModelNumber;
if (*(WORD*)p==0x5354 /*'ST'*/ &&
(*(WORD*)(p+8)==0x4153/*'AS'*/ || (p[8]=='A' && p[11]=='S')))
pInfo->u.device.DeviceModeSetting = 15;
if (*(WORD*)p==(0x5354) /*'ST'*/ &&
(*(WORD*)(p+8)==(0x4153)/*'AS'*/ || (p[8]=='A' && p[11]=='S')))
pDiskInfo->DeviceModeSetting = 15;
else
pInfo->u.device.DeviceModeSetting = pVDevice->u.disk.bDeModeSetting;
pDiskInfo->DeviceModeSetting = pVDevice->u.disk.bDeModeSetting;
}
pInfo->u.device.UsableMode = pVDevice->u.disk.bDeUsable_Mode;
pDiskInfo->UsableMode = pVDevice->u.disk.bDeUsable_Mode;
pInfo->u.device.DeviceType = PDT_HARDDISK;
pDiskInfo->DeviceType = PDT_HARDDISK;
pInfo->u.device.Flags = 0x0;
pDiskInfo->Flags = 0x0;
/* device is disabled */
if(!pVDevice->u.disk.df_on_line)
pInfo->u.device.Flags |= DEVICE_FLAG_DISABLED;
pDiskInfo->Flags |= DEVICE_FLAG_DISABLED;
/* disk has a active partition */
if(pVDevice->vf_bootable)
pInfo->u.device.Flags |= DEVICE_FLAG_BOOTDISK;
pDiskInfo->Flags |= DEVICE_FLAG_BOOTDISK;
/* disk has boot mark set */
if(pVDevice->vf_bootmark)
pInfo->u.device.Flags |= DEVICE_FLAG_BOOTMARK;
pDiskInfo->Flags |= DEVICE_FLAG_BOOTMARK;
pInfo->u.device.Flags |= DEVICE_FLAG_SATA;
pDiskInfo->Flags |= DEVICE_FLAG_SATA;
/* is a spare disk */
if(pVDevice->VDeviceType == VD_SPARE)
pInfo->u.device.Flags |= DEVICE_FLAG_IS_SPARE;
pDiskInfo->Flags |= DEVICE_FLAG_IS_SPARE;
memcpy(&(pInfo->u.device.IdentifyData), (pSataChannel->identifyDevice), sizeof(IDENTIFY_DATA2));
p = (char *)&pInfo->u.device.IdentifyData.ModelNumber;
memcpy(&(pDiskInfo->IdentifyData), (pSataChannel->identifyDevice), sizeof(IDENTIFY_DATA2));
p = (char *)&pDiskInfo->IdentifyData.ModelNumber;
for (i = 0; i < 20; i++)
((WORD*)p)[i] = shortswap(pSataChannel->identifyDevice[IDEN_MODEL_OFFSET+i]);
p[39] = '\0';
channelInfo = &pAdapter->mvChannel[pSataChannel->channelNumber];
pDiskInfo->ReadAheadSupported = channelInfo->readAheadSupported;
pDiskInfo->ReadAheadEnabled = channelInfo->readAheadEnabled;
pDiskInfo->WriteCacheSupported = channelInfo->writeCacheSupported;
pDiskInfo->WriteCacheEnabled = channelInfo->writeCacheEnabled;
pDiskInfo->TCQSupported = (pSataChannel->identifyDevice[IDEN_SUPPORTED_COMMANDS2] & (0x2))!=0;
pDiskInfo->TCQEnabled = pSataChannel->queuedDMA==MV_EDMA_MODE_QUEUED;
pDiskInfo->NCQSupported = MV_SATA_GEN_2(pSataAdapter) &&
(pSataChannel->identifyDevice[IDEN_SATA_CAPABILITIES] & (0x0100));
pDiskInfo->NCQEnabled = pSataChannel->queuedDMA==MV_EDMA_MODE_NATIVE_QUEUING;
return 0;
}
@ -403,7 +433,7 @@ int hpt_get_controller_info(int id, PCONTROLLER_INFO pInfo)
#else
#define _set_product_id(x) strcpy(pInfo->szProductID, x)
#endif
_set_product_id("RocketRAID 182x SATA Controller");
_set_product_id("RocketRAID 18xx SATA Controller");
pInfo->NumBuses = 8;
pInfo->ChipFlags |= CHIP_SUPPORT_ULTRA_133|CHIP_SUPPORT_ULTRA_150;
return 0;
@ -487,24 +517,60 @@ int hpt_get_device_info(DEVICEID id, PLOGICAL_DEVICE_INFO pInfo)
return -1;
#ifdef SUPPORT_ARRAY
if (mIsArray(pVDevice))
get_array_info(pVDevice, pInfo);
else
if (mIsArray(pVDevice)) {
pInfo->Type = LDT_ARRAY;
pInfo->Capacity = pVDevice->VDeviceCapacity;
pInfo->ParentArray = VDEV_TO_ID(pVDevice->pParent);
get_array_info(pVDevice, &pInfo->u.array);
return 0;
}
#endif
return get_disk_info(pVDevice, pInfo);
pInfo->Type = LDT_DEVICE;
pInfo->ParentArray = pVDevice->pParent? VDEV_TO_ID(pVDevice->pParent) : INVALID_DEVICEID;
/* report real capacity to be compatible with old arrays */
pInfo->Capacity = pVDevice->u.disk.dDeRealCapacity;
return get_disk_info(pVDevice, &pInfo->u.device);
}
int hpt_get_device_info_v2(DEVICEID id, PLOGICAL_DEVICE_INFO_V2 pInfo)
{
PVDevice pVDevice = ID_TO_VDEV(id);
if((id == 0) || check_VDevice_valid(pVDevice))
return -1;
#ifdef SUPPORT_ARRAY
if (mIsArray(pVDevice)) {
pInfo->Type = LDT_ARRAY;
pInfo->Capacity.lo32 = pVDevice->VDeviceCapacity;
pInfo->Capacity.hi32 = sizeof(LBA_T)>4? (pVDevice->VDeviceCapacity>>32) : 0;
pInfo->ParentArray = VDEV_TO_ID(pVDevice->pParent);
get_array_info_v2(pVDevice, &pInfo->u.array);
return 0;
}
#endif
pInfo->Type = LDT_DEVICE;
pInfo->ParentArray = pVDevice->pParent? VDEV_TO_ID(pVDevice->pParent) : INVALID_DEVICEID;
/* report real capacity to be compatible with old arrays */
pInfo->Capacity.lo32 = pVDevice->u.disk.dDeRealCapacity;
pInfo->Capacity.hi32 = 0;
return get_disk_info(pVDevice, &pInfo->u.device);
}
#ifdef SUPPORT_ARRAY
DEVICEID hpt_create_array(_VBUS_ARG PCREATE_ARRAY_PARAMS pParam)
DEVICEID hpt_create_array_v2(_VBUS_ARG PCREATE_ARRAY_PARAMS_V2 pParam)
{
ULONG Stamp = GetStamp();
int i,j;
ULONG capacity = MAX_LBA_T;
LBA_T capacity = MAX_LBA_T;
PVDevice pArray,pChild;
int Loca = -1;
if (pParam->nDisk > MAX_MEMBERS)
return INVALID_DEVICEID;
/* check in verify_vd
for(i = 0; i < pParam->nDisk; i++)
{
PVDevice pVDev = ID_TO_VDEV(pParam->Members[i]);
@ -516,6 +582,8 @@ DEVICEID hpt_create_array(_VBUS_ARG PCREATE_ARRAY_PARAMS pParam)
else if (_vbus_p != pVDev->u.disk.pVBus)
return INVALID_DEVICEID;
}
*/
_vbus_p = (ID_TO_VDEV(pParam->Members[0]))->u.disk.pVBus;
if (!_vbus_p) return INVALID_DEVICEID;
mArGetArrayTable(pArray);
@ -742,6 +810,22 @@ DEVICEID hpt_create_array(_VBUS_ARG PCREATE_ARRAY_PARAMS pParam)
return INVALID_DEVICEID;
}
DEVICEID hpt_create_array(_VBUS_ARG PCREATE_ARRAY_PARAMS pParam)
{
CREATE_ARRAY_PARAMS_V2 param2;
param2.ArrayType = pParam->ArrayType;
param2.nDisk = pParam->nDisk;
param2.BlockSizeShift = pParam->BlockSizeShift;
param2.CreateFlags = pParam->CreateFlags;
param2.CreateTime = pParam->CreateTime;
memcpy(param2.ArrayName, pParam->ArrayName, sizeof(param2.ArrayName));
memcpy(param2.Description, pParam->Description, sizeof(param2.Description));
memcpy(param2.CreateManager, pParam->CreateManager, sizeof(param2.CreateManager));
param2.Capacity.lo32 = param2.Capacity.hi32 = 0;
memcpy(param2.Members, pParam->Members, sizeof(pParam->Members));
return hpt_create_array_v2(_VBUS_P &param2);
}
#ifdef SUPPORT_OLD_ARRAY
/* this is only for old RAID 0/1 */
int old_add_disk_to_raid01(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
@ -822,7 +906,7 @@ int hpt_add_disk_to_array(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
{
int i;
ULONG Capacity;
LBA_T Capacity;
PVDevice pArray = ID_TO_VDEV(idArray);
PVDevice pDisk = ID_TO_VDEV(idDisk);
@ -859,7 +943,7 @@ int hpt_add_disk_to_array(_VBUS_ARG DEVICEID idArray, DEVICEID idDisk)
if (pArray->pVBus!=_vbus_p) { HPT_ASSERT(0); return -1;}
for(i = 0; i < pArray->u.array.bArnMember; i++)
if((pArray->u.array.pMember[i] == NULL) || !pArray->u.array.pMember[i]->vf_online)
if((pArray->u.array.pMember[i] == 0) || !pArray->u.array.pMember[i]->vf_online)
{
if(pArray->u.array.pMember[i] != NULL)
pArray->u.array.pMember[i]->pParent = NULL;
@ -961,124 +1045,76 @@ int hpt_set_array_info(_VBUS_ARG DEVICEID idArray, PALTERABLE_ARRAY_INFO pInfo)
return 0;
}
int hpt_set_device_info(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo)
static int hpt_set_device_info(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO pInfo)
{
PVDevice pVDevice = ID_TO_VDEV(idDisk);
/* stop buzzer. */
if(idDisk == 0) {
#ifndef FOR_DEMO
IAL_ADAPTER_T *pAdapter;
for (pAdapter=gIal_Adapter; pAdapter; pAdapter=pAdapter->next) {
if (pAdapter->beeping) {
pAdapter->beeping = 0;
BeepOff(pAdapter->mvSataAdapter.adapterIoBaseAddress);
}
}
#endif
return 0;
}
if (check_VDevice_valid(pVDevice)) return -1;
if(idDisk == 0 || check_VDevice_valid(pVDevice)) return -1;
if (mIsArray(pVDevice))
return -1;
if (pVDevice->u.disk.pVBus!=_vbus_p) return -1;
/* if (pInfo->ValidFields & ADIF_MODE) {
/* TODO */
return 0;
}
static int hpt_set_device_info_v2(_VBUS_ARG DEVICEID idDisk, PALTERABLE_DEVICE_INFO_V2 pInfo)
{
PVDevice pVDevice = ID_TO_VDEV(idDisk);
int sync = 0;
if(idDisk==0 || check_VDevice_valid(pVDevice)) return -1;
if (mIsArray(pVDevice))
return -1;
if (pVDevice->u.disk.pVBus!=_vbus_p) return -1;
if (pInfo->ValidFields & ADIF_MODE) {
pVDevice->u.disk.bDeModeSetting = pInfo->DeviceModeSetting;
pVDevice->u.disk.bDeUserSelectMode = pInfo->DeviceModeSetting;
pVDevice->u.disk.df_user_mode_set = 1;
fDeSelectMode((PDevice)&(pVDevice->u.disk), (UCHAR)pInfo->DeviceModeSetting);
sync = 1;
}
if (pInfo->ValidFields & ADIF_TCQ) {
if (fDeSetTCQ(&pVDevice->u.disk, pInfo->TCQEnabled, 0)) {
pVDevice->u.disk.df_tcq_set = 1;
pVDevice->u.disk.df_tcq = pInfo->TCQEnabled!=0;
sync = 1;
}
}
if (pInfo->ValidFields & ADIF_NCQ) {
if (fDeSetNCQ(&pVDevice->u.disk, pInfo->NCQEnabled, 0)) {
pVDevice->u.disk.df_ncq_set = 1;
pVDevice->u.disk.df_ncq = pInfo->NCQEnabled!=0;
sync = 1;
}
}
if (pInfo->ValidFields & ADIF_WRITE_CACHE) {
if (fDeSetWriteCache(&pVDevice->u.disk, pInfo->WriteCacheEnabled)) {
pVDevice->u.disk.df_write_cache_set = 1;
pVDevice->u.disk.df_write_cache = pInfo->WriteCacheEnabled!=0;
sync = 1;
}
}
if (pInfo->ValidFields & ADIF_READ_AHEAD) {
if (fDeSetReadAhead(&pVDevice->u.disk, pInfo->ReadAheadEnabled)) {
pVDevice->u.disk.df_read_ahead_set = 1;
pVDevice->u.disk.df_read_ahead = pInfo->ReadAheadEnabled!=0;
sync = 1;
}
}
if (sync)
SyncArrayInfo(pVDevice);
}*/
return 0;
}
#endif
#ifdef SUPPORT_HPT601
int hpt_get_601_info(DEVICEID idDisk, PHPT601_INFO pInfo)
{
PVDevice pVDevice = ID_TO_VDEV(idDisk);
PChannel pChan = pVDevice->u.disk.pChannel;
PIDE_REGISTERS_1 IoPort = pChan->BaseIoAddress1;
if(!pVDevice->u.disk.df_with_601) return -1;
mSelectUnit(IoPort, pVDevice->u.disk.bDeUnitId);
pChan->pChipInstance->ftbl.pfnWaitOnBusy(pChan, pVDevice->u.disk.bDeUnitId, 1);
BeginAccess601(IoPort);
mSetBlockCount(IoPort, 0);
pInfo->DeviceId = InWord(&IoPort->Data);
mSetBlockCount(IoPort, 0x14);
pInfo->Temperature = InWord(&IoPort->Data);
mSetBlockCount(IoPort, 0xA);
pInfo->FanStatus = InWord(&IoPort->Data);
mSetBlockCount(IoPort, 7);
pInfo->BeeperControl = InWord(&IoPort->Data);
mSetBlockCount(IoPort, 3);
pInfo->LED1Control = InWord(&IoPort->Data);
mSetBlockCount(IoPort, 5);
pInfo->LED2Control = InWord(&IoPort->Data);
mSetBlockCount(IoPort, 0x18);
pInfo->PowerStatus = InWord(&IoPort->Data);
EndAccess601(IoPort);
pInfo->ValidFields = 0x7F;
/*DEVICEID|TEMPERATURE|FANSTATUS|BEEPERCONTROL|LED1CONTROL|LED2CONTROL|POWERSTATUS*/
return 0;
}
int hpt_set_601_info(DEVICEID idDisk, PHPT601_INFO pInfo)
{
PVDevice pVDevice = ID_TO_VDEV(idDisk);
PChannel pChan = pVDevice->u.disk.pChannel;
PIDE_REGISTERS_1 IoPort = pChan->BaseIoAddress1;
if(!pVDevice->u.disk.df_with_601) return -1;
mSelectUnit(IoPort, pVDevice->u.disk.bDeUnitId);
pChan->pChipInstance->ftbl.pfnWaitOnBusy(pChan, pVDevice->u.disk.bDeUnitId, 1);
BeginAccess601(IoPort);
if (pInfo->ValidFields & HPT601_INFO_TEMPERATURE) {
mSetBlockCount(IoPort, 1);
OutWord(&IoPort->Data, pInfo->Temperature);
}
if (pInfo->ValidFields & HPT601_INFO_FANSTATUS) {
mSetBlockCount(IoPort, 0xA);
OutWord(&IoPort->Data, pInfo->FanStatus);
}
if (pInfo->ValidFields & HPT601_INFO_BEEPERCONTROL) {
mSetBlockCount(IoPort, 7);
OutWord(&IoPort->Data, pInfo->BeeperControl);
}
if (pInfo->ValidFields & HPT601_INFO_LED1CONTROL) {
mSetBlockCount(IoPort, 3);
OutWord(&IoPort->Data, pInfo->LED1Control);
}
if (pInfo->ValidFields & HPT601_INFO_LED2CONTROL) {
mSetBlockCount(IoPort, 5);
OutWord(&IoPort->Data, pInfo->LED2Control);
}
EndAccess601(IoPort);
return 0;
}
#endif
/* hpt_default_ioctl()
@ -1175,21 +1211,46 @@ int hpt_default_ioctl(_VBUS_ARG
}
break;
case HPT_IOCTL_GET_DEVICE_INFO_V2:
{
DEVICEID id;
PLOGICAL_DEVICE_INFO_V2 pInfo;
if (nInBufferSize!=sizeof(DEVICEID)) return -1;
if (nOutBufferSize!=sizeof(LOGICAL_DEVICE_INFO_V2)) return -1;
id = *(DWORD *)lpInBuffer;
if (id == INVALID_DEVICEID) return -1;
pInfo = (PLOGICAL_DEVICE_INFO_V2)lpOutBuffer;
memset(pInfo, 0, sizeof(LOGICAL_DEVICE_INFO_V2));
if (hpt_get_device_info_v2(id, pInfo)!=0)
return -1;
}
break;
#ifdef SUPPORT_ARRAY
case HPT_IOCTL_CREATE_ARRAY:
{
CREATE_ARRAY_PARAMS *pParam;
DEVICEID id;
if (nInBufferSize!=sizeof(CREATE_ARRAY_PARAMS)) return -1;
if (nOutBufferSize!=sizeof(DEVICEID)) return -1;
pParam = (PCREATE_ARRAY_PARAMS)lpInBuffer;
*(DEVICEID *)lpOutBuffer = hpt_create_array(_VBUS_P (PCREATE_ARRAY_PARAMS)lpInBuffer);
id = hpt_create_array(_VBUS_P pParam);
*(DEVICEID *)lpOutBuffer = id;
if(*(DEVICEID *)lpOutBuffer == INVALID_DEVICEID)
return -1;
}
break;
if(id == (DEVICEID)INVALID_DEVICEID)
case HPT_IOCTL_CREATE_ARRAY_V2:
{
if (nInBufferSize!=sizeof(CREATE_ARRAY_PARAMS_V2)) return -1;
if (nOutBufferSize!=sizeof(DEVICEID)) return -1;
*(DEVICEID *)lpOutBuffer = hpt_create_array_v2(_VBUS_P (PCREATE_ARRAY_PARAMS_V2)lpInBuffer);
if (*(DEVICEID *)lpOutBuffer == INVALID_DEVICEID)
return -1;
}
break;
@ -1225,6 +1286,21 @@ int hpt_default_ioctl(_VBUS_ARG
}
break;
case HPT_IOCTL_SET_DEVICE_INFO_V2:
{
DEVICEID idDisk;
PALTERABLE_DEVICE_INFO_V2 pInfo;
if (nInBufferSize < sizeof(HPT_SET_DEVICE_INFO_V2)) return -1;
if (nOutBufferSize!=0) return -1;
idDisk = ((PHPT_SET_DEVICE_INFO_V2)lpInBuffer)->idDisk;
pInfo = &((PHPT_SET_DEVICE_INFO_V2)lpInBuffer)->Info;
if(hpt_set_device_info_v2(_VBUS_P idDisk, pInfo) != 0)
return -1;
}
break;
case HPT_IOCTL_SET_BOOT_MARK:
{
DEVICEID id;
@ -1238,7 +1314,7 @@ int hpt_default_ioctl(_VBUS_ARG
while(pAdapter != 0)
{
pVBus = &pAdapter->VBus;
for(i = 0; i < MAX_ARRAY_PER_VBUS; i++)
for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++)
{
if(!(pTop = pVBus->pVDevice[i])) continue;
if (pTop->pVBus!=_vbus_p) return -1;
@ -1256,16 +1332,7 @@ int hpt_default_ioctl(_VBUS_ARG
}
}
break;
#endif
case HPT_IOCTL_RESCAN_DEVICES:
{
if (nInBufferSize!=0) return -1;
if (nOutBufferSize!=0) return -1;
fRescanAllDevice(_VBUS_P0);
}
break;
#ifdef SUPPORT_ARRAY
case HPT_IOCTL_ADD_SPARE_DISK:
{
DEVICEID id;
@ -1319,41 +1386,57 @@ int hpt_default_ioctl(_VBUS_ARG
}
break;
#ifdef SUPPORT_HPT601
case HPT_IOCTL_GET_601_INFO:
case HPT_IOCTL_GET_CONTROLLER_VENID:
{
DEVICEID id;
PHPT601_INFO pInfo;
DWORD id = ((DWORD*)lpInBuffer)[0];
IAL_ADAPTER_T *pAdapTemp;
int iControllerCount = 0;
if (nInBufferSize!=sizeof(DEVICEID)) return -1;
if (nOutBufferSize!=sizeof(HPT601_INFO)) return -1;
id = *(DWORD *)lpInBuffer;
if (id == INVALID_DEVICEID) return -1;
pInfo = (PHPT601_INFO)lpOutBuffer;
memset(pInfo, 0, sizeof(HPT601_INFO));
if (hpt_get_601_info(id, pInfo)!=0)
for (pAdapTemp = gIal_Adapter; pAdapTemp; pAdapTemp = pAdapTemp->next)
if (iControllerCount++==id)
break;
if (!pAdapTemp)
return -1;
if (nOutBufferSize < 4)
return -1;
*(DWORD*)lpOutBuffer = ((DWORD)pAdapTemp->mvSataAdapter.pciConfigDeviceId << 16) | 0x11AB;
return 0;
}
case HPT_IOCTL_EPROM_IO:
{
DWORD id = ((DWORD*)lpInBuffer)[0];
DWORD offset = ((DWORD*)lpInBuffer)[1];
DWORD direction = ((DWORD*)lpInBuffer)[2];
DWORD length = ((DWORD*)lpInBuffer)[3];
IAL_ADAPTER_T *pAdapTemp;
int iControllerCount = 0;
for (pAdapTemp = gIal_Adapter; pAdapTemp; pAdapTemp = pAdapTemp->next)
if (iControllerCount++==id)
break;
if (!pAdapTemp)
return -1;
if (nInBufferSize < sizeof(DWORD) * 4 + (direction? length : 0) ||
nOutBufferSize < (direction? 0 : length))
return -1;
if (direction == 0) /* read */
sx508x_flash_access(&pAdapTemp->mvSataAdapter,
offset, lpOutBuffer, length, 1);
else
sx508x_flash_access(&pAdapTemp->mvSataAdapter,
offset, (char *)lpInBuffer + 16, length, 0);
return 0;
}
break;
case HPT_IOCTL_SET_601_INFO:
{
DEVICEID id;
PHPT601_INFO pInfo;
if (nInBufferSize!=sizeof(HPT_SET_601_INFO)) return -1;
if (nOutBufferSize!=0) return -1;
id = ((PHPT_SET_601_INFO)lpInBuffer)->idDisk;
pInfo = &((PHPT_SET_601_INFO)lpInBuffer)->Info;
if(hpt_set_601_info(id, pInfo) != 0)
return -1;
}
break;
#endif
default:
return -1;
}

View File

@ -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) || defined(_MACOSX_)
#if defined(LINUX) || defined(__FreeBSD_version)
#define HPT_CTL_CODE(x) (x+0xFF00)
#elif defined(_MS_WIN32_) || defined(WIN32)
@ -221,6 +221,11 @@ typedef DWORD DEVICEID;
#define HPT_IOCTL_DEVICE_IO_V2 HPT_CTL_CODE(39)
#define HPT_IOCTL_DEVICE_IO_EX_V2 HPT_CTL_CODE(40)
#define HPT_IOCTL_I2C_TRANSACTION HPT_CTL_CODE(48)
#define HPT_IOCTL_GET_PARAMETER_LIST HPT_CTL_CODE(49)
#define HPT_IOCTL_GET_PARAMETER HPT_CTL_CODE(50)
#define HPT_IOCTL_SET_PARAMETER HPT_CTL_CODE(51)
/* Windows only */
#define HPT_IOCTL_GET_CONTROLLER_IDS HPT_CTL_CODE(100)
#define HPT_IOCTL_GET_DCB HPT_CTL_CODE(101)
@ -368,8 +373,13 @@ typedef struct _HPT_ARRAY_INFO {
#if HPT_INTERFACE_VERSION>=0x01010000
typedef struct _LBA64 {
#ifdef __BIG_ENDIAN_BITFIELD
DWORD hi32;
DWORD lo32;
#else
DWORD lo32;
DWORD hi32;
#endif
}
LBA64;
typedef struct _HPT_ARRAY_INFO_V2 {
@ -687,16 +697,15 @@ typedef struct _IDE_PASS_THROUGH_HEADER {
DEVICEID idDisk; /* disk ID */
BYTE bFeaturesReg; /* feature register */
BYTE bSectorCountReg; /* IDE sector count register. */
BYTE bSectorNumberReg; /* IDE sector number register. */
BYTE bCylLowReg; /* IDE low order cylinder value. */
BYTE bCylHighReg; /* IDE high order cylinder value. */
BYTE bLbaLowReg; /* IDE sector number register. */
BYTE bLbaMidReg; /* IDE low order cylinder value. */
BYTE bLbaHighReg; /* IDE high order cylinder value. */
BYTE bDriveHeadReg; /* IDE drive/head register. */
BYTE bCommandReg; /* Actual IDE command. Checked for validity by driver. */
BYTE reserve1;
DWORD DataSize; /* data size in bytes, if the command has data transfer */
#ifdef _MSC_VER
BYTE DataBuffer[0]; /* data buffer */
#endif
BYTE nSectors; /* data sze in sectors, if the command has data transfer */
BYTE protocol; /* IO_COMMAND_(READ,WRITE) or zero for non-DATA */
BYTE reserve[3];
#define IDE_PASS_THROUGH_buffer(p) ((unsigned char *)(p) + sizeof(IDE_PASS_THROUGH_HEADER))
}
IDE_PASS_THROUGH_HEADER, *PIDE_PASS_THROUGH_HEADER;
@ -729,7 +738,8 @@ DEVICE_IO_EX_PARAMS, *PDEVICE_IO_EX_PARAMS;
/*
* ioctl structure
*/
#define HPT_IOCTL_MAGIC 0x1A2B3C4D
#define HPT_IOCTL_MAGIC32 0x1A2B3C4D
#define HPT_IOCTL_MAGIC 0xA1B2C3D4
typedef struct _HPT_IOCTL_PARAM {
DWORD Magic; /* used to check if it's a valid ioctl packet */
@ -742,7 +752,7 @@ typedef struct _HPT_IOCTL_PARAM {
}
HPT_IOCTL_PARAM, *PHPT_IOCTL_PARAM;
/* for 64-bit system */
/* for 32-bit app running on 64-bit system */
typedef struct _HPT_IOCTL_PARAM32 {
DWORD Magic;
DWORD dwIoControlCode;
@ -1206,6 +1216,18 @@ int hpt_query_remove(DWORD ndev, DEVICEID *pIds);
int hpt_remove_devices(DWORD ndev, DEVICEID *pIds);
/*-------------------------------------------------------------------------- */
/* hpt_ide_pass_through
* directly access controller's command and control registers.
* Can only call it on physical devices.
* Version compatibility: v1.0.0.3 or later
* Parameters:
* p - IDE_PASS_THROUGH header pointer
* Returns:
* 0 Success
*/
int hpt_ide_pass_through(PIDE_PASS_THROUGH_HEADER p);
/*-------------------------------------------------------------------------- */
#endif
#pragma pack()

View File

@ -278,7 +278,8 @@ hpt_set_info(int length)
}
#ifdef SUPPORT_IOCTL
piop = (PHPT_IOCTL_PARAM)buffer;
if (piop->Magic == HPT_IOCTL_MAGIC) {
if (piop->Magic == HPT_IOCTL_MAGIC ||
piop->Magic == HPT_IOCTL_MAGIC32) {
KdPrintE(("ioctl=%d in=%p len=%d out=%p len=%d\n",
piop->dwIoControlCode,
piop->lpInBuffer,
@ -450,14 +451,14 @@ 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));
sprintf(buf, "Rebuilding %lldMB", (pTmpArray->u.array.RebuildSectors>>11));
#else
sprintf(buf, "Rebuilding %d%%", (pTmpArray->u.array.RebuildSectors>>11)*100/((pTmpArray->VDeviceCapacity/(pTmpArray->u.array.bArnMember-1))>>11));
sprintf(buf, "Rebuilding %d%%", (UINT)((pTmpArray->u.array.RebuildSectors>>11)*100/((pTmpArray->VDeviceCapacity/(pTmpArray->u.array.bArnMember-1))>>11)));
#endif
sStatus = buf;
}
else if (pTmpArray->u.array.rf_verifying) {
sprintf(buf, "Verifying %d%%", (pTmpArray->u.array.RebuildSectors>>11)*100/((pTmpArray->VDeviceCapacity/(pTmpArray->u.array.bArnMember-1))>>11));
sprintf(buf, "Verifying %d%%", (UINT)((pTmpArray->u.array.RebuildSectors>>11)*100/((pTmpArray->VDeviceCapacity/(pTmpArray->u.array.bArnMember-1))>>11)));
sStatus = buf;
}
else if (pTmpArray->u.array.rf_need_rebuild)
@ -472,7 +473,7 @@ hpt_copy_array_info(HPT_GET_INFO *pinfo, int nld, PVDevice pArray)
}
out:
if (!sStatus) sStatus = "Normal";
hpt_copy_info(pinfo, "%2d %11s %-20s %5dMB %-16s", nld, sType, pArray->u.array.ArrayName, pArray->VDeviceCapacity>>11, sStatus);
hpt_copy_info(pinfo, "%2d %11s %-20s %5lldMB %-16s", nld, sType, pArray->u.array.ArrayName, pArray->VDeviceCapacity>>11, sStatus);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -209,7 +209,11 @@ lock_driver_idle(IAL_ADAPTER_T *pAdapter)
#if (__FreeBSD_version < 500000)
YIELD_THREAD;
#else
#if (__FreeBSD_version > 700033)
pause("switch", 1);
#else
tsleep(lock_driver_idle, PPAUSE, "switch", 1);
#endif
#endif
oldspl = lock_driver();
}
@ -337,6 +341,7 @@ int Kernel_DeviceIoControl(_VBUS_ARG
case HPT_IOCTL_GET_CHANNEL_INFO:
case HPT_IOCTL_GET_LOGICAL_DEVICES:
case HPT_IOCTL_GET_DEVICE_INFO:
case HPT_IOCTL_GET_DEVICE_INFO_V2:
case HPT_IOCTL_GET_EVENT:
case HPT_IOCTL_GET_DRIVER_CAPABILITIES:
if(hpt_default_ioctl(_VBUS_P dwIoControlCode, lpInBuffer, nInBufferSize,
@ -351,10 +356,14 @@ int Kernel_DeviceIoControl(_VBUS_ARG
switch(dwIoControlCode) {
case HPT_IOCTL_CREATE_ARRAY:
pVDev = ID_TO_VDEV(((PCREATE_ARRAY_PARAMS)lpInBuffer)->Members[0]); break;
case HPT_IOCTL_CREATE_ARRAY_V2:
pVDev = ID_TO_VDEV(((PCREATE_ARRAY_PARAMS_V2)lpInBuffer)->Members[0]); break;
case HPT_IOCTL_SET_ARRAY_INFO:
pVDev = ID_TO_VDEV(((PHPT_SET_ARRAY_INFO)lpInBuffer)->idArray); break;
case HPT_IOCTL_SET_DEVICE_INFO:
pVDev = ID_TO_VDEV(((PHPT_SET_DEVICE_INFO)lpInBuffer)->idDisk); break;
case HPT_IOCTL_SET_DEVICE_INFO_V2:
pVDev = ID_TO_VDEV(((PHPT_SET_DEVICE_INFO_V2)lpInBuffer)->idDisk); break;
case HPT_IOCTL_SET_BOOT_MARK:
case HPT_IOCTL_ADD_SPARE_DISK:
case HPT_IOCTL_REMOVE_SPARE_DISK:
@ -410,6 +419,22 @@ int Kernel_DeviceIoControl(_VBUS_ARG
break;
}
case HPT_IOCTL_CREATE_ARRAY_V2:
{
pAdapter=(IAL_ADAPTER_T *)(ID_TO_VDEV(*(DEVICEID *)lpOutBuffer))->pVBus->OsExt;
oldspl = lock_driver();
if(((PCREATE_ARRAY_PARAMS_V2)lpInBuffer)->CreateFlags & CAF_CREATE_AND_DUPLICATE) {
(ID_TO_VDEV(*(DEVICEID *)lpOutBuffer))->u.array.rf_auto_rebuild = 0;
hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, ID_TO_VDEV(*(DEVICEID *)lpOutBuffer), DUPLICATE);
} else if(((PCREATE_ARRAY_PARAMS_V2)lpInBuffer)->CreateFlags & CAF_CREATE_R5_ZERO_INIT) {
hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, ID_TO_VDEV(*(DEVICEID *)lpOutBuffer), INITIALIZE);
} else if(((PCREATE_ARRAY_PARAMS_V2)lpInBuffer)->CreateFlags & CAF_CREATE_R5_BUILD_PARITY) {
hpt_queue_dpc((HPT_DPC)hpt_rebuild_data_block, pAdapter, ID_TO_VDEV(*(DEVICEID *)lpOutBuffer), REBUILD_PARITY);
}
unlock_driver(oldspl);
break;
}
case HPT_IOCTL_ADD_DISK_TO_ARRAY:
{
PVDevice pArray = ID_TO_VDEV(((PHPT_ADD_DISK_TO_ARRAY)lpInBuffer)->idArray);
@ -424,7 +449,11 @@ int Kernel_DeviceIoControl(_VBUS_ARG
unlock_driver(oldspl);
while (!pArray->u.array.rf_rebuilding)
{
#if (__FreeBSD_version > 700033)
pause("pause", 1);
#else
tsleep((caddr_t)Kernel_DeviceIoControl, PPAUSE, "pause", 1);
#endif
if ( timeout >= hz*3)
break;
timeout ++;
@ -489,7 +518,11 @@ hpt_set_array_state(DEVICEID idArray, DWORD state)
while (!pVDevice->u.array.rf_rebuilding)
{
#if (__FreeBSD_version > 700033)
pause("pause", 1);
#else
tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
#endif
if ( timeout >= hz*20)
break;
timeout ++;
@ -514,7 +547,11 @@ hpt_set_array_state(DEVICEID idArray, DWORD state)
while (pVDevice->u.array.rf_abort_rebuild)
{
#if (__FreeBSD_version > 700033)
pause("pause", 1);
#else
tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
#endif
if ( timeout >= hz*20)
break;
timeout ++;
@ -538,7 +575,11 @@ hpt_set_array_state(DEVICEID idArray, DWORD state)
while (!pVDevice->u.array.rf_verifying)
{
#if (__FreeBSD_version > 700033)
pause("pause", 1);
#else
tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
#endif
if ( timeout >= hz*20)
break;
timeout ++;
@ -557,7 +598,11 @@ hpt_set_array_state(DEVICEID idArray, DWORD state)
while (pVDevice->u.array.rf_abort_rebuild)
{
#if (__FreeBSD_version > 700033)
pause("pause", 1);
#else
tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
#endif
if ( timeout >= hz*80)
break;
timeout ++;
@ -578,7 +623,11 @@ hpt_set_array_state(DEVICEID idArray, DWORD state)
while (!pVDevice->u.array.rf_initializing)
{
#if (__FreeBSD_version > 700033)
pause("pause", 1);
#else
tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
#endif
if ( timeout >= hz*80)
break;
timeout ++;
@ -597,7 +646,11 @@ hpt_set_array_state(DEVICEID idArray, DWORD state)
while (pVDevice->u.array.rf_abort_rebuild)
{
#if (__FreeBSD_version > 700033)
pause("pause", 1);
#else
tsleep((caddr_t)hpt_set_array_state, PPAUSE, "pause", 1);
#endif
if ( timeout >= hz*80)
break;
timeout ++;
@ -952,7 +1005,11 @@ hpt_rebuild_data_block(IAL_ADAPTER_T *pAdapter, PVDevice pArray, UCHAR flags)
#if (__FreeBSD_version < 500000)
YIELD_THREAD;
#else
#if (__FreeBSD_version > 700033)
pause("switch", 1);
#else
tsleep(hpt_rebuild_data_block, PPAUSE, "switch", 1);
#endif
#endif
oldspl = lock_driver();
}

View File

@ -28,7 +28,7 @@
#ifndef __INCmvOsBsdh
#define __INCmvOsBsdh
#ifdef DBG
#ifdef DEBUG
#define MV_DEBUG_LOG
#endif
@ -58,10 +58,10 @@ typedef void *PVOID, *LPVOID;
typedef void *ADDRESS;
typedef int LONG;
typedef unsigned int ULONG, *PULONG, LBA_T;
typedef unsigned int ULONG, *PULONG;
typedef unsigned int DWORD, *LPDWORD, *PDWORD;
typedef unsigned long ULONG_PTR, UINT_PTR, BUS_ADDR;
typedef unsigned long long HPT_U64;
typedef unsigned long long HPT_U64, LBA_T;
typedef enum mvBoolean{MV_FALSE, MV_TRUE} MV_BOOLEAN;

View File

@ -36,15 +36,34 @@
#define SUPPORT_MV_SATA_GEN_2 0
#endif
#if SUPPORT_MV_SATA_GEN_1==1 && SUPPORT_MV_SATA_GEN_2==1
#ifndef SUPPORT_MV_SATA_GEN_2E
#define SUPPORT_MV_SATA_GEN_2E 0
#endif
#if (SUPPORT_MV_SATA_GEN_1 + SUPPORT_MV_SATA_GEN_2 + SUPPORT_MV_SATA_GEN_2E) > 1
#define MV_SATA_GEN_1(x) ((x)->sataAdapterGeneration==1)
#define MV_SATA_GEN_2(x) ((x)->sataAdapterGeneration==2)
#define MV_SATA_GEN_2(x) ((x)->sataAdapterGeneration>=2)
#define MV_SATA_GEN_2E(x) ((x)->sataAdapterGeneration==3)
#elif SUPPORT_MV_SATA_GEN_1==1
#define MV_SATA_GEN_1(x) 1
#define MV_SATA_GEN_2(x) 0
#define MV_SATA_GEN_2E(x) 0
#elif SUPPORT_MV_SATA_GEN_2==1
#define MV_SATA_GEN_1(x) 0
#define MV_SATA_GEN_2(x) 1
#define MV_SATA_GEN_2E(x) 0
#elif SUPPORT_MV_SATA_GEN_2E==1
#define MV_SATA_GEN_1(x) 0
#define MV_SATA_GEN_2(x) 1 /* gen2E impiles gen2 */
#define MV_SATA_GEN_2E(x) 1
#else
#error "Which IC do you support?"
#endif
@ -56,8 +75,15 @@
#define MV_SATA_DEVICE_ID_5081 0x5081
#define MV_SATA_DEVICE_ID_6080 0x6080
#define MV_SATA_DEVICE_ID_6081 0x6081
#if defined(RR2310) || defined(RR1740) || defined(RR2210) || defined (RR2522)
#define MV_SATA_CHANNELS_NUM 4
#define MV_SATA_UNITS_NUM 1
#else
#define MV_SATA_CHANNELS_NUM 8
#define MV_SATA_UNITS_NUM 2
#endif
#define MV_SATA_PCI_BAR0_SPACE_SIZE (1<<18) /* 256 Kb*/
#define CHANNEL_QUEUE_LENGTH 32
@ -156,7 +182,7 @@ typedef MV_BOOLEAN (* HPTLIBAPI mvSataCommandCompletionCallBack_t)(struct mvSata
MV_COMPLETION_TYPE,
MV_VOID_PTR, MV_U16,
MV_U32,
struct mvStorageDevRegisters FAR*);
struct mvStorageDevRegisters SS_SEG*);
typedef enum mvQueuedCommandType
{
@ -222,8 +248,8 @@ typedef struct mvSataChannel
MV_BOOLEAN waitingForInterrupt;
MV_BOOLEAN lba48Address;
MV_BOOLEAN maxReadTransfer;
struct mvDmaRequestQueueEntry FAR *requestQueue;
struct mvDmaResponseQueueEntry FAR *responseQueue;
struct mvDmaRequestQueueEntry SS_SEG *requestQueue;
struct mvDmaResponseQueueEntry SS_SEG *responseQueue;
MV_U32 requestQueuePciHiAddress;
MV_U32 requestQueuePciLowAddress;
MV_U32 responseQueuePciHiAddress;
@ -243,7 +269,7 @@ typedef struct mvSataChannel
MV_BOOLEAN queueCommandsEnabled;
MV_U8 noneUdmaOutstandingCommands;
MV_U8 EdmaQueuedCommands;
MV_U32 freeIDsStack[MV_EDMA_QUEUE_LENGTH];
MV_U32 freeIDsStack[CHANNEL_QUEUE_LENGTH];
MV_U32 freeIDsNum;
MV_U32 reqInPtr;
MV_U32 rspOutPtr;
@ -279,7 +305,10 @@ typedef struct mvSataAdapter
MV_BOOLEAN implement60X1A0Workarounds;
MV_BOOLEAN implement60X1A1Workarounds;
MV_BOOLEAN implement60X1B0Workarounds;
MV_BOOLEAN implement7042A0Workarounds;
MV_BOOLEAN implement7042A1Workarounds;
MV_U8 sataAdapterGeneration;
MV_BOOLEAN isPEX;
MV_U8 failLEDMask;
MV_U8 signalAmps[MV_SATA_CHANNELS_NUM];
MV_U8 pre[MV_SATA_CHANNELS_NUM];
@ -394,21 +423,9 @@ MV_BOOLEAN HPTLIBAPI mvSataChannelSetEdmaLoopBackMode(MV_SATA_ADAPTER *pAdapter,
MV_BOOLEAN HPTLIBAPI mvSataGetChannelStatus(MV_SATA_ADAPTER *pAdapter, MV_U8 channelIndex,
MV_SATA_CHANNEL_STATUS *pChannelStatus);
/* Execute UDMA ATA commands */
MV_EDMA_QUEUE_RESULT HPTLIBAPI mvSataQueueUDmaCommand(MV_SATA_ADAPTER *pAdapter,
MV_U8 channelIndex,
MV_UDMA_TYPE readWrite,
MV_U32 lowLBAAddr,
MV_U16 highLBAAddr,
MV_U16 sectorCount,
MV_U32 prdLowAddr,
MV_U32 prdHighAddr,
mvSataCommandCompletionCallBack_t callBack,
MV_VOID_PTR commandId);
MV_QUEUE_COMMAND_RESULT HPTLIBAPI mvSataQueueCommand(MV_SATA_ADAPTER *pAdapter,
MV_U8 channelIndex,
MV_QUEUE_COMMAND_INFO FAR *pCommandParams);
MV_QUEUE_COMMAND_INFO SS_SEG *pCommandParams);
/* Interrupt Service Routine */
MV_BOOLEAN HPTLIBAPI mvSataInterruptServiceRoutine(MV_SATA_ADAPTER *pAdapter);

View File

@ -207,6 +207,9 @@ MV_BOOLEAN HPTLIBAPI mvStorageDevATAFlushWriteCache(MV_SATA_ADAPTER *pAdapter,
MV_BOOLEAN HPTLIBAPI mvStorageDevATASoftResetDevice(MV_SATA_ADAPTER *pAdapter,
MV_U8 channelIndex);
MV_BOOLEAN HPTLIBAPI mvStorageDevWaitStat(MV_SATA_CHANNEL *pSataChannel,
MV_U8 good, MV_U8 bad, MV_U32 loops, MV_U32 delay);
MV_BOOLEAN HPTLIBAPI mvReadWrite(MV_SATA_CHANNEL *pSataChannel, LBA_T Lba, UCHAR Cmd, void *tmpBuffer);
#endif

View File

@ -42,7 +42,7 @@
#include <vm/pmap.h>
#include <vm/vm_extern.h>
#if (__FreeBSD_version < 600030)
#if (__FreeBSD_version < 600000)
#include <machine/bus_memio.h>
#endif
#include <machine/bus.h>
@ -102,11 +102,6 @@ typedef struct _INQUIRYDATA {
UCHAR Reserved3[40];
} INQUIRYDATA, *PINQUIRYDATA;
typedef struct _READ_CAPACITY_DATA {
ULONG LogicalBlockAddress;
ULONG BytesPerBlock;
} READ_CAPACITY_DATA, *PREAD_CAPACITY_DATA;
#define MV_IAL_HT_SACOALT_DEFAULT 1
#define MV_IAL_HT_SAITMTH_DEFAULT 1
@ -145,7 +140,13 @@ typedef struct _MV_CHANNEL
unsigned int maxUltraDmaModeSupported;
unsigned int maxDmaModeSupported;
unsigned int maxPioModeSupported;
MV_BOOLEAN online;
MV_BOOLEAN online;
MV_BOOLEAN writeCacheSupported;
MV_BOOLEAN writeCacheEnabled;
MV_BOOLEAN readAheadSupported;
MV_BOOLEAN readAheadEnabled;
MV_U8 queueDepth;
} MV_CHANNEL;
typedef struct _BUS_DMAMAP
@ -302,12 +303,27 @@ typedef struct _HPT_SET_DEVICE_INFO
ALTERABLE_DEVICE_INFO Info;
} HPT_SET_DEVICE_INFO, *PHPT_SET_DEVICE_INFO;
typedef struct _HPT_SET_DEVICE_INFO_V2
{
DEVICEID idDisk;
ALTERABLE_DEVICE_INFO_V2 Info;
} HPT_SET_DEVICE_INFO_V2, *PHPT_SET_DEVICE_INFO_V2;
typedef struct _HPT_ADD_DISK_TO_ARRAY
{
DEVICEID idArray;
DEVICEID idDisk;
} HPT_ADD_DISK_TO_ARRAY, *PHPT_ADD_DISK_TO_ARRAY;
typedef struct _HPT_DEVICE_IO
{
DEVICEID id;
int cmd;
ULONG lba;
DWORD nSector;
UCHAR buffer[0];
} HPT_DEVICE_IO, *PHPT_DEVICE_IO;
int check_VDevice_valid(PVDevice);
int hpt_default_ioctl(_VBUS_ARG DWORD, PVOID, DWORD, PVOID, DWORD, PDWORD);

View File

@ -61,10 +61,10 @@ void HPTLIBAPI DoXor2(ULONG *p0, ULONG *p2, UINT nBytes);
#define xor_init(arg) 0
#define xor_add_item(handle, dest, src, nsrc, bytes) \
do {\
if (((void**)src)[0]==dest)\
DoXor2((PULONG)(dest), ((PULONG *)src)[1], bytes);\
if (((void**)(src))[0]==dest)\
DoXor2((PULONG)(dest), ((PULONG *)(src))[1], bytes);\
else\
DoXor1((PULONG)(dest), ((PULONG *)src)[0], ((PULONG *)src)[1], bytes);\
DoXor1((PULONG)(dest), ((PULONG *)(src))[0], ((PULONG *)(src))[1], bytes);\
} while(0)
#define xor_exec(handle, done, tag) done(_VBUS_P tag, 0)
#define xor_poll()

View File

@ -1,9 +1,22 @@
RocketRAID 182x Driver for FreeBSD
Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved.
RocketRAID 18xx Driver for FreeBSD
Copyright (C) 2007-2008 HighPoint Technologies, Inc. All rights reserved.
$FreeBSD$
#############################################################################
Revision History:
v1.16 2008-2-29
Fix 7.0 compile error.
v1.15 2007-8-6
Override kernel driver(built-in) to support over 2T RAID array.
v1.14 2006-3-21
Fix 48-bit LBA compatibility for Seagate drives.
Fix 16 bytes CDB support.
v1.13 2006-2-13
Fix fail LED/beeper control.
Add 16 bytes CDB support.
v1.12 2005-6-10
Fix over 4G memory support on amd64.
@ -21,7 +34,7 @@ Revision History:
1. Overview
---------------------
This package contains FreeBSD driver source code for HighPoint RocketRAID
182x SATA controller.
18xx SATA controller.
NO WARRANTY
@ -41,7 +54,7 @@ Revision History:
SUCH HARDWARE, OR DATA.
2. Rebuild the kernel with RR182x support
2. Rebuild the kernel with RR18xx support
--------------------------------------------
1) Install kernel source package and building tools.
@ -49,7 +62,7 @@ Revision History:
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
# tar xvzf /your/path/to/rr18xx-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
@ -61,7 +74,7 @@ Revision History:
4) Edit MYKERNEL, and add the following line under "RAID controllers
interfaced to the SCSI subsystem":
device hptmv #HighPoint RocketRAID 182x
device hptmv #HighPoint RocketRAID 18xx
5) For i386 system, edit /usr/src/sys/conf/files.i386 and append the lines
shown below:
@ -91,13 +104,13 @@ Revision History:
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.
Note FreeBSD 5.3/5.4/6.x/7.x i386 already have a built-in RR18xx 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:
a) for FreeBSD 5.x/6.x/7.x i386:
# cd /usr/src/sys/i386/conf/
# /usr/sbin/config MYKERNEL
@ -106,7 +119,7 @@ Revision History:
# make
# make install
b) for FreeBSD 5.x-amd64:
b) for FreeBSD 5.x/6.x/7.x amd64:
# cd /usr/src/sys/amd64/conf/
# /usr/sbin/config MYKERNEL
@ -139,7 +152,7 @@ Revision History:
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
# tar xvzf /your/path/to/rr18xx-opensource-v1.12-bsd.tgz
4) Build the driver module:
@ -153,7 +166,7 @@ Revision History:
# cp hptmv.ko /modules/
For FreeBSD 5.x:
For FreeBSD 5.x/6.x/7.x:
# cp hptmv.ko /boot/kernel/
@ -179,7 +192,7 @@ Revision History:
/modules/hptmv.ko text=0xf571 data=0x2c8+0x254
ok boot
For FreeBSD 5.x, you can select 6 on the boot menu to get a loader prompt.
For FreeBSD 5.x/6.x/7.x, you can select 6 on the boot menu to get a loader prompt.
7) You can add a below line into /boot/defaults/loader.conf to load the
driver automatically:

View File

@ -35,20 +35,20 @@
typedef struct _VDevice
{
UCHAR VDeviceType;
UCHAR vf_bootmark: 1; /* is boot device? */
UCHAR vf_bootable: 1; /* has active partition */
UCHAR vf_online: 1; /* is usable? */
UCHAR vf_cache_disk: 1; /* Cache enabled */
UCHAR VDeviceType;
UCHAR vf_bootmark: 1; /* is boot device? */
UCHAR vf_bootable: 1; /* has active partition */
UCHAR vf_online: 1; /* is usable? */
UCHAR vf_cache_disk: 1; /* Cache enabled */
UCHAR vf_format_v2: 1; /* old array block */
UCHAR vf_freed: 1; /* memory free */
UCHAR reserve1;
UCHAR bSerialNumber; /* valid if pParent!=0 */
UCHAR reserve1;
UCHAR bSerialNumber; /* valid if pParent!=0 */
PVDevice pParent; /* parent array */
PVDevice pParent; /* parent array */
PVBus pVBus; /* vbus this device located. Must not be NULL. */
LBA_T VDeviceCapacity; /* number of blocks */
LBA_T VDeviceCapacity; /* number of blocks */
LBA_T LockedLba;
USHORT LockedSectors;
@ -58,16 +58,16 @@ typedef struct _VDevice
void *QuiesceArg;
void (* HPTLIBAPI flush_callback)(_VBUS_ARG void *arg);
void *flush_callback_arg;
#if defined(_RAID5N_)
struct stripe **CacheEntry;
struct range_lock *range_lock;
#endif
void (* HPTLIBAPI pfnSendCommand)(_VBUS_ARG PCommand pCmd); /* call this to send a command to a VDevice */
void (* HPTLIBAPI pfnDeviceFailed)(_VBUS_ARG PVDevice pVDev); /* call this when a VDevice failed */
void (* HPTLIBAPI pfnSendCommand)(_VBUS_ARG PCommand pCmd); /* call this to send a command to a VDevice */
void (* HPTLIBAPI pfnDeviceFailed)(_VBUS_ARG PVDevice pVDev); /* call this when a VDevice failed */
union {
#ifdef SUPPORT_ARRAY
RaidArray array;
@ -85,10 +85,10 @@ typedef struct _VDevice
/*
* bUserDeviceMode
*/
#define MEMBER_NOT_SET_MODE 0x5F
#define MEMBER_NOT_SET_MODE 0x5F
/*
* arrayType
/*
* arrayType
*/
#define VD_SPARE 0
#define VD_REMOVABLE 1
@ -120,10 +120,10 @@ void HPTLIBAPI fSingleDiskFailed(_VBUS_ARG PVDevice pVDev);
typedef struct _VBus {
/* pVDevice[] may be non-continuous */
PVDevice pVDevice[MAX_VDEVICE_PER_VBUS];
PVDevice pVDevice[MAX_VDEVICE_PER_VBUS];
UINT nInstances;
PChipInstance pChipInstance[MAX_CHIP_IN_VBUS];
UINT nInstances;
PChipInstance pChipInstance[MAX_CHIP_IN_VBUS];
void * OsExt; /* for OS private use */
@ -176,16 +176,20 @@ typedef struct _VBus {
for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++) \
if ((pVDev=pVBus->pVDevice[i])==0) continue; else
#define FOR_EACH_DEV_ON_ALL_VBUS(pVBus, pVDev, i) \
#define FOR_EACH_VBUS(pVBus) \
for(pVBus = gVBus; pVBus < &gVBus[MAX_VBUS]; pVBus++) \
for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++) \
if ((pVDev=pVBus->pVDevice[i])==0) continue; else
#define FOR_EACH_ARRAY_ON_ALL_VBUS(pVBus, pArray, i) \
for(pVBus = gVBus; pVBus < &gVBus[MAX_VBUS]; pVBus++) \
for(i = 0; i < MAX_ARRAY_PER_VBUS; i++) \
if ((pArray=((PVDevice)&pVBus->_ArrayTables[i*ARRAY_VDEV_SIZE]))->u.array.dArStamp==0) continue; else
#define FOR_EACH_DEV_ON_ALL_VBUS(pVBus, pVDev, i) \
FOR_EACH_VBUS(pVBus) \
for(i = 0; i < MAX_VDEVICE_PER_VBUS; i++) \
if ((pVDev=pVBus->pVDevice[i])==0) continue; else
/***************************************************************************
* Description: the functions called by IDE layer
***************************************************************************/
@ -196,10 +200,10 @@ void HPTLIBAPI IdeRegisterDevice(PDevice pDev);
#endif
/***************************************************************************
* Description: the functions OS must provided
* Description: the functions OS must provided
***************************************************************************/
void OsSetDeviceTable(PDevice pDevice, PIDENTIFY_DATA pIdentify);
void HPTLIBAPI OsSetDeviceTable(PDevice pDevice, PIDENTIFY_DATA pIdentify);
/*
* allocate and free data structure
@ -240,12 +244,12 @@ void VBus_Config(PVBus pVBus, char *str);
#endif
#pragma pack(1)
struct fdisk_partition_table
struct fdisk_partition_table
{
UCHAR bootid; /* bootable? 0=no, 128=yes */
UCHAR beghead; /* beginning head number */
UCHAR begsect; /* beginning sector number */
UCHAR begcyl; /* 10 bit nmbr, with high 2 bits put in begsect */
UCHAR begcyl; /* 10 bit nmbr, with high 2 bits put in begsect */
UCHAR systid; /* Operating System type indicator code */
UCHAR endhead; /* ending head number */
UCHAR endsect; /* ending sector number */
@ -254,7 +258,7 @@ struct fdisk_partition_table
ULONG numsect; /* number of sectors in partition */
};
typedef struct _Master_Boot_Record
typedef struct _Master_Boot_Record
{
UCHAR bootinst[446]; /* space to hold actual boot code */
struct fdisk_partition_table parts[4];
@ -278,5 +282,5 @@ typedef struct _TIME_RECORD {
#endif
#endif
#pragma pack()
#pragma pack()
#endif