Overview   API Reference  

ata_drive Struct Reference

ATA drive. More...

#include <ata_drive.hpp>

Inheritance diagram for ata_drive:

Inheritance graph
[legend]
Collaboration diagram for ata_drive:

Collaboration graph
[legend]

List of all members.

Public Types

enum  state_flags_constants { REMOVABLE = 1 << (static_log2<block_driver::ALL_MASK>::value + 1), FAKE_IO = REMOVABLE << 1, ALL_MASK = block_driver::ALL_MASK | REMOVABLE | FAKE_IO }
typedef bitmask< uint_value_t
< ALL_MASK >::least > 
state_flags

Public Member Functions

 static_assert (integer_traits< state_flags::word_type >::const_max >=ALL_MASK,"state_flags's max value is too small")
 ata_drive (machine_base &machine, block_driver *driver=nullptr, state_flags flags=0)
int reset (void)
const char * name (void) const
void set_drive_name_index (const string &name, const uint8_t index)
bool is_ready (void) const
void set_irq (const l4_irq_t irq)
void assert_irq_if_enabled (void) const
uint32_t read_command_block (ata_command_block::offset_t offset, access_size access_size)
int write_command_block (ata_command_block::offset_t offset, uint32_t data, access_size access_size)
uint32_t read_control_block (ata_control_block::offset_t offset, access_size access_size)
int write_control_block (ata_control_block::offset_t offset, uint32_t data, access_size access_size)
int read_write_DMA (uint8_t read_write, l4_gpa_t PRD_base)

Static Public Attributes

static const uint8_t MAX_MULTIPLE_SECTORS = 128
 Maximum allowed sector number for multi sector transfer modes.
static const uint32_t BUFFER_SIZE = SECTOR_SIZE * 256
 Internal sector buffer's size.

Protected Member Functions

bool check_sector_range (l4_sector_t sector, l4_sector_t number)
void identify_device (void)
void execute_command (uint8_t command)
int read_from_media (uint8_t *dst, l4_sector_t sector, l4_sector_t number)
int read_buffer_from_media (l4_sector_t sector, l4_sector_t number, unsigned commit_blocks=0)
uint32_t read_from_buffer (access_size access_size)
int write_to_media (uint8_t *src, l4_sector_t sector, l4_sector_t number)
int write_buffer_to_media (void)
int write_to_buffer (uint32_t data, access_size access_size)
int read_write_media (uint8_t read_write, l4_hva_t base, l4_hva_t size)

Protected Attributes

string drive_name
 The drive's name returned by name().
machine_basemachine
 Reference to the machine object this drive belongs to.
l4_irq_t irq
 The IRQ number the channel is connected to.
ata_command_block command_block
 ATA command block.
ata_control_block control_block
 ATA control block.
block_driver *const driver
 The driver to get blocks from.
state_flags state
 Current active state/features merged with the ones provided by the driver.
uint8_t multiple_sectors
 Current multiple sector setting for multi sector transfer modes.
uint8_t last_command
 Last command executed (needed for DMA operation).
struct ata_drive::geometry geometry
 Struct/Attribute to store and compute the drive's physical geometry.
struct ata_drive::transaction transaction
 Struct/Attribute to store the current transaction state.

Classes

struct  geometry
 Struct/Attribute to store and compute the drive's physical geometry. More...
struct  transaction
 Struct/Attribute to store the current transaction state. More...


Detailed Description

ATA drive.

Member Enumeration Documentation

Enumerator:
REMOVABLE  The medium is removable.
FAKE_IO  Pretend success, but do not read/write anything.
ALL_MASK  Mask containing all used bits.

Reimplemented from block_driver_constants.


Member Data Documentation

const uint32_t ata_drive::BUFFER_SIZE = SECTOR_SIZE * 256 [static]

Internal sector buffer's size.

The LBA48 address feature requires SECTOR_SIZE * 65536 sectors.

Reference to the machine object this drive belongs to.

Used to request/free resources.


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

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008