2 * Copyright 2007-2008, Marcus Overhagen. All rights reserved.
3 * Distributed under the terms of the MIT License.
9 #include <ATAInfoBlock.h>
11 #include "ahci_defs.h"
19 AHCIPort(AHCIController
*controller
, int index
);
27 void InterruptErrorHandler(uint32 is
);
30 void ScsiExecuteRequest(scsi_ccb
*request
);
31 uchar
ScsiAbortRequest(scsi_ccb
*request
);
32 uchar
ScsiTerminateRequest(scsi_ccb
*request
);
33 uchar
ScsiResetDevice();
34 void ScsiGetRestrictions(bool *isATAPI
, bool *noAutoSense
, uint32
*maxBlocks
);
37 void ScsiTestUnitReady(scsi_ccb
*request
);
38 void ScsiInquiry(scsi_ccb
*request
);
39 void ScsiVPDInquiry(scsi_ccb
* request
, ata_device_infoblock
* ataData
);
41 void ScsiReadCapacity(scsi_ccb
*request
);
42 void ScsiReadCapacity16(scsi_ccb
*request
);
43 void ScsiReadWrite(scsi_ccb
*request
, uint64 lba
, size_t sectorCount
, bool isWrite
);
44 void ScsiSynchronizeCache(scsi_ccb
*request
);
45 void ScsiUnmap(scsi_ccb
* request
,
46 struct scsi_unmap_parameter_list
* unmapBlocks
);
48 void ExecuteSataRequest(sata_request
*request
, bool isWrite
= false);
57 void FlushPostedWrites();
62 status_t
WaitForTransfer(int *tfd
, bigtime_t timeout
);
63 void FinishTransfer();
65 inline void _ClearErrorRegister();
67 // uint8 * SetCommandFis(volatile command_list_entry *cmd, volatile fis *fis, const void *data, size_t dataSize);
68 status_t
FillPrdTable(volatile prd
*prdTable
, int *prdCount
, int prdMax
, const void *data
, size_t dataSize
);
69 status_t
FillPrdTable(volatile prd
*prdTable
, int *prdCount
, int prdMax
, const physical_entry
*sgTable
, int sgCount
, size_t dataSize
);
72 AHCIController
* fController
;
74 volatile ahci_port
* fRegs
;
77 volatile uint32 fCommandsActive
;
81 bool fUse48BitCommands
;
85 bool fTestUnitReadyActive
;
89 uint32 fMaxTrimRangeBlocks
;
92 volatile command_list_entry
* fCommandList
;
93 volatile command_table
* fCommandTable
;
94 volatile prd
* fPRDTable
;
99 AHCIPort::FlushPostedWrites()
101 volatile uint32 dummy
= fRegs
->cmd
;
106 #endif // _AHCI_PORT_H