/* * Internal Functions */ MV_BOOLEAN Core_MapHDId( IN PCore_Driver_Extension pCore, IN MV_U16 HDId, OUT MV_PU8 portId, OUT MV_PU8 deviceId ) { if ( portId ) *portId = PATA_MapPortId(HDId); if ( deviceId ) *deviceId = PATA_MapDeviceId(HDId); if ( ((portId)&&(*portId>=MAX_PORT_NUMBER)) || ((deviceId)&&(*deviceId>=MAX_DEVICE_PER_PORT)) ) return MV_FALSE; else return MV_TRUE; }
/* * Translate SCSI command to SATA FIS * The following SCSI command set is the minimum required. * Standard Inquiry * Read Capacity * Test Unit Ready * Start/Stop Unit * Read 10 * Write 10 * Request Sense * Mode Sense/Select */ MV_VOID SCSI_To_FIS(MV_PVOID This, PMV_Request pReq, MV_U8 tag, PATA_TaskFile pTaskFile) { PCore_Driver_Extension pCore = (PCore_Driver_Extension)This; PDomain_Port pPort = &pCore->Ports[PATA_MapPortId(pReq->Device_Id)]; PMV_Command_Table pCmdTable = Port_GetCommandTable(pPort, tag); PSATA_FIS_REG_H2D pFIS = (PSATA_FIS_REG_H2D)pCmdTable->FIS; #ifdef SUPPORT_PM PDomain_Device pDevice = &pPort->Device[PATA_MapDeviceId(pReq->Device_Id)]; #endif /* * 1. SoftReset is not supported yet. * 2. PM_Port */ pFIS->FIS_Type = SATA_FIS_TYPE_REG_H2D; #ifdef SUPPORT_PM pFIS->PM_Port = pDevice->PM_Number; #else pFIS->PM_Port = 0; #endif pFIS->C = 1; /* Update command register rather than devcie control register */ pFIS->Command = pTaskFile->Command; pFIS->Features = pTaskFile->Features; pFIS->Device = pTaskFile->Device; pFIS->Control = pTaskFile->Control; pFIS->LBA_Low = pTaskFile->LBA_Low; pFIS->LBA_Mid = pTaskFile->LBA_Mid; pFIS->LBA_High = pTaskFile->LBA_High; pFIS->Sector_Count = pTaskFile->Sector_Count; /* No matter it's 48bit or not, I've set the values. */ pFIS->LBA_Low_Exp = pTaskFile->LBA_Low_Exp; pFIS->LBA_Mid_Exp = pTaskFile->LBA_Mid_Exp; pFIS->LBA_High_Exp = pTaskFile->LBA_High_Exp; pFIS->Features_Exp = pTaskFile->Feature_Exp; pFIS->Sector_Count_Exp = pTaskFile->Sector_Count_Exp; }