NOVA User-Level Environment  Version testbox/changed-memory-timing-317-g320d8b5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SataDrive Class Reference

A SATA drive. More...

Inheritance diagram for SataDrive:
FisReceiver StaticReceiver< SataDrive > Device

Public Member Functions

void comreset ()
void receive_fis (unsigned fislen, unsigned *fis)
 Receive a FIS from the controller.
bool receive (MessageDiskCommit &msg)
 SataDrive (DBus< MessageDisk > &bus_disk, DBus< MessageMemRegion > *bus_memregion, DBus< MessageMem > *bus_mem, unsigned hostdisk, DiskParameter params)
- Public Member Functions inherited from FisReceiver
 FisReceiver ()
void set_peer (FisReceiver *peer)
- Public Member Functions inherited from StaticReceiver< SataDrive >
 StaticReceiver ()
- Public Member Functions inherited from Device
void debug_dump ()
 Device (const char *debug_name)

Private Member Functions

void complete_command ()
 A command is completed.
void send_pio_setup_fis (unsigned short length, bool irq=false)
void send_dma_setup_fis (bool direction)
void build_identify_buffer (unsigned short *identify)
 We build the identify response in a buffer to allow to use push_data.
unsigned push_data (unsigned length, void *data, bool &irq)
 Push data to the user by doing DMA via the PRDs.
unsigned readwrite_sectors (bool read, bool lba48_ext)
 Read or write sectors from/to disk.
void execute_command ()
 Execute ATA commands.

Private Attributes

DBus< MessageDisk > & _bus_disk
unsigned _hostdisk
unsigned char _multiple
unsigned _regs [4]
unsigned char _ctrl
unsigned char _status
unsigned char _error
unsigned _dsf [7]
unsigned _splits [32]
DiskParameter _params
DmaDescriptor _dma [DMA_DESCRIPTORS]

Static Private Attributes

static unsigned const DMA_DESCRIPTORS = 64

Additional Inherited Members

- Static Public Member Functions inherited from StaticReceiver< SataDrive >
static bool receive_static (Device *o, M &msg)
- Protected Attributes inherited from FisReceiver
FisReceiver_peer

Detailed Description

A SATA drive.

It contains the register set of a SATA drive and speaks the SATA transport layer protocol with its FISes.

State: unstable Features: read,write,identify Missing: better error handling, many commands

Constructor & Destructor Documentation

SataDrive::SataDrive ( DBus< MessageDisk > &  bus_disk,
DBus< MessageMemRegion > *  bus_memregion,
DBus< MessageMem > *  bus_mem,
unsigned  hostdisk,
DiskParameter  params 
)
inline

Member Function Documentation

void SataDrive::build_identify_buffer ( unsigned short *  identify)
inlineprivate

We build the identify response in a buffer to allow to use push_data.

void SataDrive::complete_command ( )
inlineprivate

A command is completed.

We send a register d2h FIS to the host.

void SataDrive::comreset ( )
inline
void SataDrive::execute_command ( )
inlineprivate

Execute ATA commands.

unsigned SataDrive::push_data ( unsigned  length,
void *  data,
bool &  irq 
)
inlineprivate

Push data to the user by doing DMA via the PRDs.

Return the number of byte written.

unsigned SataDrive::readwrite_sectors ( bool  read,
bool  lba48_ext 
)
inlineprivate

Read or write sectors from/to disk.

The new entries do not fit into DMA_DESCRIPTORS, do a single sector transfer This means we have to do a read in our own buffer and than copy them out

bool SataDrive::receive ( MessageDiskCommit msg)
inline
void SataDrive::receive_fis ( unsigned  fislen,
unsigned *  fis 
)
inlinevirtual

Receive a FIS from the controller.

Implements FisReceiver.

void SataDrive::send_dma_setup_fis ( bool  direction)
inlineprivate
void SataDrive::send_pio_setup_fis ( unsigned short  length,
bool  irq = false 
)
inlineprivate

Member Data Documentation

DBus<MessageDisk>& SataDrive::_bus_disk
private
unsigned char SataDrive::_ctrl
private
DmaDescriptor SataDrive::_dma[DMA_DESCRIPTORS]
private
unsigned SataDrive::_dsf[7]
private
unsigned char SataDrive::_error
private
unsigned SataDrive::_hostdisk
private
unsigned char SataDrive::_multiple
private
DiskParameter SataDrive::_params
private
unsigned SataDrive::_regs[4]
private
unsigned SataDrive::_splits[32]
private
unsigned char SataDrive::_status
private
unsigned const SataDrive::DMA_DESCRIPTORS = 64
staticprivate

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