121255d1fSMarcus Overhagen /* 221255d1fSMarcus Overhagen * Copyright 2007, Marcus Overhagen. All rights reserved. 321255d1fSMarcus Overhagen * Distributed under the terms of the MIT License. 421255d1fSMarcus Overhagen */ 521255d1fSMarcus Overhagen #ifndef _AHCI_CONTROLLER_H 621255d1fSMarcus Overhagen #define _AHCI_CONTROLLER_H 721255d1fSMarcus Overhagen 821255d1fSMarcus Overhagen 921255d1fSMarcus Overhagen #include "ahci_defs.h" 1021255d1fSMarcus Overhagen 1121255d1fSMarcus Overhagen 124f6fa362SAxel Dörfler class AHCIController { 134f6fa362SAxel Dörfler public: 144f6fa362SAxel Dörfler AHCIController(device_node_handle node, 154f6fa362SAxel Dörfler pci_device_info *pciDevice); 164f6fa362SAxel Dörfler ~AHCIController(); 1721255d1fSMarcus Overhagen 18036a8857SMarcus Overhagen status_t Init(); 19036a8857SMarcus Overhagen void Uninit(); 20036a8857SMarcus Overhagen 2121255d1fSMarcus Overhagen void ExecuteRequest(scsi_ccb *request); 2221255d1fSMarcus Overhagen uchar AbortRequest(scsi_ccb *request); 2321255d1fSMarcus Overhagen uchar TerminateRequest(scsi_ccb *request); 2421255d1fSMarcus Overhagen uchar ResetDevice(uchar targetID, uchar targetLUN); 2521255d1fSMarcus Overhagen 264f6fa362SAxel Dörfler device_node_handle DeviceNode() { return fNode; } 2721255d1fSMarcus Overhagen 2821255d1fSMarcus Overhagen private: 2921255d1fSMarcus Overhagen bool IsDevicePresent(uint device); 3021255d1fSMarcus Overhagen 3121255d1fSMarcus Overhagen private: 3221255d1fSMarcus Overhagen device_node_handle fNode; 334f6fa362SAxel Dörfler pci_device_info* fPCIDevice; 3421255d1fSMarcus Overhagen uint32 fDevicePresentMask; 35036a8857SMarcus Overhagen 36*093a713dSMarcus Overhagen ahci_hba * fRegs; 37*093a713dSMarcus Overhagen area_id fRegsArea; 38*093a713dSMarcus Overhagen 39036a8857SMarcus Overhagen 40036a8857SMarcus Overhagen // --- Instance check workaround begin 41036a8857SMarcus Overhagen port_id fInstanceCheck; 42036a8857SMarcus Overhagen // --- Instance check workaround end 43036a8857SMarcus Overhagen 4421255d1fSMarcus Overhagen }; 4521255d1fSMarcus Overhagen 4621255d1fSMarcus Overhagen 4721255d1fSMarcus Overhagen inline bool 4821255d1fSMarcus Overhagen AHCIController::IsDevicePresent(uint device) 4921255d1fSMarcus Overhagen { 5021255d1fSMarcus Overhagen return fDevicePresentMask & (1 << device); 5121255d1fSMarcus Overhagen } 5221255d1fSMarcus Overhagen 5321255d1fSMarcus Overhagen 544f6fa362SAxel Dörfler #endif // _AHCI_CONTROLLER_H 55