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

Public Member Functions

 NvmeDisk (NvmeController *controller, uint32_t nsid)
 
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
 
NvmeControllercontroller () const
 
uint32_t namespaceId () 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)
 

Private Member Functions

size_t validPageLength (uint64_t location) const
 

Private Attributes

NvmeControllerm_Controller
 
const uint32_t m_Nsid
 
size_t m_Blocks
 
size_t m_Bytes
 
size_t m_BlockBytes
 

Friends

class NvmeController
 

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
 
- 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
 
virtual bool supportsBufferTransfers () const
 
virtual bool transferBuffer (uint64_t location, void *buffer, size_t length, bool writing)
 
virtual bool transferReadBuffers (ReadBuffer *buffers, size_t count)
 
virtual bool transferWriteBuffers (WriteBuffer *buffers, size_t count)
 
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)
 
- 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 6 of file NvmeDisk.h.

Constructor & Destructor Documentation

◆ NvmeDisk()

NvmeDisk::NvmeDisk ( NvmeController controller,
uint32_t  nsid 
)

Definition at line 9 of file NvmeDisk.cc.

◆ ~NvmeDisk()

NvmeDisk::~NvmeDisk ( )
override

Definition at line 14 of file NvmeDisk.cc.

Member Function Documentation

◆ controller()

NvmeController * NvmeDisk::controller ( ) const
inline

Definition at line 26 of file NvmeDisk.h.

◆ doRead()

uint64_t NvmeDisk::doRead ( uint64_t  location)
overridevirtual

Reimplemented from ScsiDisk.

Definition at line 61 of file NvmeDisk.cc.

◆ doSync()

uint64_t NvmeDisk::doSync ( uint64_t  location)
overridevirtual

Reimplemented from ScsiDisk.

Definition at line 112 of file NvmeDisk.cc.

◆ doWrite()

uint64_t NvmeDisk::doWrite ( uint64_t  location)
overridevirtual

Reimplemented from ScsiDisk.

Definition at line 86 of file NvmeDisk.cc.

◆ doWriteDirect()

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

Writes one caller-borrowed page without acquiring cache ownership.

Reimplemented from ScsiDisk.

Definition at line 99 of file NvmeDisk.cc.

◆ getBlockCount()

size_t NvmeDisk::getBlockCount ( ) const
inlineoverridevirtual

Reimplemented from ScsiDisk.

Definition at line 15 of file NvmeDisk.h.

◆ getBlockSize()

size_t NvmeDisk::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 52 of file NvmeDisk.cc.

References TargetInfo::getPageSize().

◆ getName()

void NvmeDisk::getName ( String str)
overridevirtual

Stores the device's name in str.

Reimplemented from ScsiDisk.

Definition at line 49 of file NvmeDisk.cc.

◆ getNativeBlockSize()

size_t NvmeDisk::getNativeBlockSize ( ) const
inlineoverridevirtual

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 19 of file NvmeDisk.h.

◆ getSize()

size_t NvmeDisk::getSize ( ) const
inlineoverridevirtual

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 12 of file NvmeDisk.h.

◆ initialise()

bool NvmeDisk::initialise ( )

Definition at line 18 of file NvmeDisk.cc.

◆ namespaceId()

uint32_t NvmeDisk::namespaceId ( ) const
inline

Definition at line 29 of file NvmeDisk.h.

◆ validPageLength()

size_t NvmeDisk::validPageLength ( uint64_t  location) const
private

Definition at line 55 of file NvmeDisk.cc.

Friends And Related Symbol Documentation

◆ NvmeController

friend class NvmeController
friend

Definition at line 34 of file NvmeDisk.h.

Member Data Documentation

◆ m_BlockBytes

size_t NvmeDisk::m_BlockBytes
private

Definition at line 40 of file NvmeDisk.h.

◆ m_Blocks

size_t NvmeDisk::m_Blocks
private

Definition at line 38 of file NvmeDisk.h.

◆ m_Bytes

size_t NvmeDisk::m_Bytes
private

Definition at line 39 of file NvmeDisk.h.

◆ m_Controller

NvmeController* NvmeDisk::m_Controller
private

Definition at line 36 of file NvmeDisk.h.

◆ m_Nsid

const uint32_t NvmeDisk::m_Nsid
private

Definition at line 37 of file NvmeDisk.h.


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