The Pedigree Project 0.1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
AhciDisk Class Referencefinal
+ Inheritance diagram for AhciDisk:
+ Collaboration diagram for AhciDisk:

Public Member Functions

 AhciDisk (AhciController *controller, size_t port)
 
bool initialise ()
 
void getName (String &name) override
 
size_t getSize () const override
 Gets the size of the disk.
 
size_t getBlockCount () const override
 
size_t getBlockSize () const override
 Gets the preferred I/O extent of the disk.
 
size_t getNativeBlockSize () const override
 
uint64_t doRead (uint64_t location) override
 
uint64_t doWrite (uint64_t location) override
 
uint64_t doWriteDirect (uint64_t location, uintptr_t page) override
 
uint64_t doSync (uint64_t location) override
 
AhciControllercontroller () const
 
size_t port () const
 
- Public Member Functions inherited from ScsiDisk
void shutdownCache ()
 
virtual void shutdownDeviceCache ()
 
bool hasNoCacheLoans ()
 
bool initialise (class ScsiController *pController, size_t nUnit)
 
virtual BufferView read (uint64_t location)
 
bool readInto (uint64_t location, void *buffer, size_t length) override
 
bool readIntoBatch (ReadBuffer *buffers, size_t count) override
 
bool writeFrom (uint64_t location, const void *buffer, size_t length) override
 
bool writeFromBatch (WriteBuffer *buffers, size_t count) override
 
bool syncData () override
 
virtual void write (uint64_t location)
 
virtual void flush (uint64_t location)
 Flush a cached page to disk.
 
virtual bool sync (uint64_t location, bool async)
 
virtual MUST_USE_RESULT bool syncAll ()
 
bool zero (uint64_t location, size_t length) override
 
bool syncPages (const uint64_t *locations, size_t count) override
 
virtual MUST_USE_RESULT bool retireCachePage (uint64_t location)
 
virtual void align (uint64_t location)
 Sets the page boundary alignment after a specific location on the disk.
 
virtual PagingStatus doPagingTransfer (PagingOperation operation, uint64_t offset, void *page)
 
virtual bool pin (uint64_t location)
 Pins a cache page.
 
virtual void unpin (uint64_t location)
 
- Public Member Functions inherited from Disk
 Disk (Device *p)
 
virtual DiskphysicalDisk ()
 
bool acquireUse (DiskUse &use)
 
uint32_t endpointId ()
 
virtual bool getPartitionUuid (String &uuid) const
 
virtual bool getPartitionLabel (String &label) const
 
virtual PagingStatus preparePagingTransport (PagingTransport *&transport)
 
void retireEndpoint ()
 
bool tryCloseEndpoint ()
 
void reopenEndpoint ()
 
virtual Type getType ()
 
virtual SubType getSubType ()
 
virtual void dump (String &str)
 
virtual DiskReadView readView (uint64_t location)
 
virtual DiskWriteView writeView (uint64_t location)
 
MUST_USE_RESULT bool readViews (uint64_t location, size_t length, BufferViewSequence &views)
 
void unpinViews (uint64_t location, BufferViewSequence &views)
 
virtual bool cacheIsCritical ()
 Whether or not the cache is critical and cannot be flushed or deleted.
 
- Public Member Functions inherited from Device
 Device (Device *p)
 
DevicegetParent () const
 
void setParent (Device *p)
 
virtual const StringgetSpecificType ()
 
virtual void setSpecificType (String str)
 
void setPciPosition (uint32_t bus, uint32_t device, uint32_t func)
 
void setPciIdentifiers (uint8_t classCode, uint8_t subclassCode, uint16_t vendorId, uint16_t deviceId, uint8_t progIf)
 
void setPciConfigHeader (const PciBus::ConfigSpace &space)
 
PciBus::ConfigSpace getPciConfigHeader () const
 
uint8_t getPciClassCode ()
 
uint8_t getPciSubclassCode ()
 
uint16_t getPciVendorId ()
 
uint16_t getPciDeviceId ()
 
uint8_t getPciProgInterface ()
 
uint32_t getPciBusPosition ()
 
uint32_t getPciDevicePosition ()
 
uint32_t getPciFunctionNumber ()
 
virtual Vector< Address * > & addresses ()
 
virtual uintptr_t getInterruptNumber ()
 
virtual void setInterruptNumber (uintptr_t n)
 
void addChild (Device *pDevice)
 
DevicegetChild (size_t n)
 
size_t getNumChildren ()
 
void removeChild (size_t n)
 
void removeChild (Device *d)
 
void replaceChild (Device *src, Device *dest)
 

Protected Member Functions

bool supportsBufferTransfers () const override
 
bool transferBuffer (uint64_t location, void *buffer, size_t length, bool writing) override
 
bool transferReadBuffers (Disk::ReadBuffer *buffers, size_t count) override
 
bool transferWriteBuffers (Disk::WriteBuffer *buffers, size_t count) override
 
- Protected Member Functions inherited from ScsiDisk
BufferView acquireView (uint64_t location, bool writable, uint64_t &token) override
 
void releaseView (uint64_t token, bool writable) override
 
ScsiControlleracquirePagingController (OperationBarrier::Lease &use)
 
PagingStatus preparePagingCache (PagingTransport &transport)
 
virtual size_t getCacheFillSize () const
 
size_t getCacheFillLength (uint64_t location) const
 
CachegetCache ()
 
InquirygetInquiry () const
 
- Protected Member Functions inherited from Disk
void reserveEndpoint ()
 
void publishEndpoint ()
 
- Protected Member Functions inherited from Device
 NOT_COPYABLE_OR_ASSIGNABLE (Device)
 

Private Member Functions

size_t validPageLength (uint64_t location) const
 

Private Attributes

AhciControllerm_Controller
 
const size_t m_Port
 
size_t m_Sectors
 
size_t m_SectorBytes
 
size_t m_Bytes
 
bool m_ExtendedFlush
 
bool m_Initialised
 
char m_Model [41]
 

Friends

class AhciController
 

Additional Inherited Members

- Public Types inherited from Disk
enum  SubType { ATA = 0 , ATAPI }
 
- Public Types inherited from Device
enum  Type {
  Generic , Root , Disk , Bus ,
  Display , Network , Sound , Console ,
  Mouse , Controller , UsbController , UsbGeneric ,
  UsbContainer
}
 
typedef Device *(* Callback) (Device *)
 
- Static Public Member Functions inherited from Device
static void foreach (Callback callback, Device *root=0)
 
template<class F , class... Args>
static void foreach (pedigree_std::Callable< F > &callback, Device *root, Args... args)
 
static void addToRoot (Device *device)
 
static void searchByVendorId (uint16_t vendorId, void(*callback)(Device *), Device *root=0)
 
static void searchByVendorIdAndDeviceId (uint16_t vendorId, uint16_t deviceId, void(*callback)(Device *), Device *root=0)
 
static void searchByClass (uint16_t classCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassAndSubclass (uint16_t classCode, uint16_t subclassCode, void(*callback)(Device *), Device *root=0)
 
static void searchByClassSubclassAndProgInterface (uint16_t classCode, uint16_t subclassCode, uint8_t progInterface, void(*callback)(Device *), Device *root=0)
 
- Public Attributes inherited from ScsiDisk
struct ScsiDisk::Sense PACKED
 
struct ScsiDisk::Inquiry PACKED
 
struct ScsiDisk::Capacity PACKED
 
- Static Public Attributes inherited from ScsiDisk
static constexpr uint64_t SyncWholeDevice = ~uint64_t{0}
 
- Static Public Attributes inherited from Disk
static constexpr size_t MaxReadBuffers = 32
 
static constexpr size_t MaxWriteBuffers = 32
 
static constexpr size_t MaxSyncPages = 64
 
- Static Protected Member Functions inherited from ScsiDisk
static bool syncCacheBatch (const Cache::WritebackPage *pages, size_t count, void *context)
 
- Static Protected Member Functions inherited from Device
static Deviceroot ()
 
- Protected Attributes inherited from Device
Vector< Address * > m_Addresses
 
Vector< Device * > m_Children
 
Devicem_pParent
 
uintptr_t m_InterruptNumber
 
String m_SpecificType
 
PciBus::ConfigSpace m_ConfigHeader
 
uint8_t m_ClassCode
 
uint8_t m_SubclassCode
 
uint16_t m_VendorId
 
uint16_t m_DeviceId
 
uint8_t m_ProgInterface
 
uint32_t m_PciBusPos
 
uint32_t m_PciDevicePos
 
uint32_t m_PciFunctionNum
 
- Static Protected Attributes inherited from Device
static Device m_Root
 
static Mutex m_TreeLock
 

Detailed Description

Definition at line 24 of file AhciDisk.h.

Constructor & Destructor Documentation

◆ AhciDisk()

AhciDisk::AhciDisk ( AhciController controller,
size_t  port 
)

Definition at line 24 of file AhciDisk.cc.

◆ ~AhciDisk()

AhciDisk::~AhciDisk ( )
override

Definition at line 38 of file AhciDisk.cc.

Member Function Documentation

◆ controller()

AhciController * AhciDisk::controller ( ) const
inline

Definition at line 42 of file AhciDisk.h.

◆ doRead()

uint64_t AhciDisk::doRead ( uint64_t  location)
overridevirtual

Reimplemented from ScsiDisk.

Definition at line 187 of file AhciDisk.cc.

◆ doSync()

uint64_t AhciDisk::doSync ( uint64_t  location)
overridevirtual

Reimplemented from ScsiDisk.

Definition at line 261 of file AhciDisk.cc.

◆ doWrite()

uint64_t AhciDisk::doWrite ( uint64_t  location)
overridevirtual

Reimplemented from ScsiDisk.

Definition at line 217 of file AhciDisk.cc.

◆ doWriteDirect()

uint64_t AhciDisk::doWriteDirect ( uint64_t  location,
uintptr_t  page 
)
overridevirtual

Writes one caller-borrowed page without acquiring cache ownership.

Reimplemented from ScsiDisk.

Definition at line 246 of file AhciDisk.cc.

◆ getBlockCount()

size_t AhciDisk::getBlockCount ( ) const
overridevirtual

Reimplemented from ScsiDisk.

Definition at line 141 of file AhciDisk.cc.

◆ getBlockSize()

size_t AhciDisk::getBlockSize ( ) const
overridevirtual

Gets the preferred I/O extent of the disk.

This may describe a native device block or a larger cache-fill/readahead extent, depending on the implementation. It is independent of the cache page boundary reported by BufferView::size().

Reimplemented from ScsiDisk.

Definition at line 145 of file AhciDisk.cc.

References TargetInfo::getPageSize().

◆ getName()

void AhciDisk::getName ( String str)
overridevirtual

Stores the device's name in str.

Reimplemented from ScsiDisk.

Definition at line 133 of file AhciDisk.cc.

◆ getNativeBlockSize()

size_t AhciDisk::getNativeBlockSize ( ) const
overridevirtual

Retrieves the native block size - that is, the logical block size. This differs from the preferred I/O/cache-fill extent.

Reimplemented from ScsiDisk.

Definition at line 149 of file AhciDisk.cc.

◆ getSize()

size_t AhciDisk::getSize ( ) const
overridevirtual

Gets the size of the disk.

This is the size in bytes of the disk. Reads or writes beyond this size will fail.

Reimplemented from ScsiDisk.

Definition at line 137 of file AhciDisk.cc.

◆ initialise()

bool AhciDisk::initialise ( )

Definition at line 44 of file AhciDisk.cc.

◆ port()

size_t AhciDisk::port ( ) const
inline

Definition at line 45 of file AhciDisk.h.

◆ supportsBufferTransfers()

bool AhciDisk::supportsBufferTransfers ( ) const
inlineoverrideprotectedvirtual

Reimplemented from ScsiDisk.

Definition at line 50 of file AhciDisk.h.

◆ transferBuffer()

bool AhciDisk::transferBuffer ( uint64_t  location,
void *  buffer,
size_t  length,
bool  writing 
)
overrideprotectedvirtual

Reimplemented from ScsiDisk.

Definition at line 232 of file AhciDisk.cc.

◆ transferReadBuffers()

bool AhciDisk::transferReadBuffers ( Disk::ReadBuffer buffers,
size_t  count 
)
overrideprotectedvirtual

Reimplemented from ScsiDisk.

Definition at line 161 of file AhciDisk.cc.

◆ transferWriteBuffers()

bool AhciDisk::transferWriteBuffers ( Disk::WriteBuffer buffers,
size_t  count 
)
overrideprotectedvirtual

Reimplemented from ScsiDisk.

Definition at line 179 of file AhciDisk.cc.

◆ validPageLength()

size_t AhciDisk::validPageLength ( uint64_t  location) const
private

Definition at line 153 of file AhciDisk.cc.

Friends And Related Symbol Documentation

◆ AhciController

friend class AhciController
friend

Definition at line 58 of file AhciDisk.h.

Member Data Documentation

◆ m_Bytes

size_t AhciDisk::m_Bytes
private

Definition at line 65 of file AhciDisk.h.

◆ m_Controller

AhciController* AhciDisk::m_Controller
private

Definition at line 61 of file AhciDisk.h.

◆ m_ExtendedFlush

bool AhciDisk::m_ExtendedFlush
private

Definition at line 66 of file AhciDisk.h.

◆ m_Initialised

bool AhciDisk::m_Initialised
private

Definition at line 67 of file AhciDisk.h.

◆ m_Model

char AhciDisk::m_Model[41]
private

Definition at line 68 of file AhciDisk.h.

◆ m_Port

const size_t AhciDisk::m_Port
private

Definition at line 62 of file AhciDisk.h.

◆ m_SectorBytes

size_t AhciDisk::m_SectorBytes
private

Definition at line 64 of file AhciDisk.h.

◆ m_Sectors

size_t AhciDisk::m_Sectors
private

Definition at line 63 of file AhciDisk.h.


The documentation for this class was generated from the following files: