|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| |
| int | ata_command (struct interface *control, struct interface *data, struct ata_cmd *command) |
| | Issue ATA command. More...
|
| |
| static | LIST_HEAD (ata_commands) |
| | List of all ATA commands. More...
|
| |
| static | __attribute__ ((always_inline)) |
| | Get reference to ATA device. More...
|
| |
| static void | atacmd_free (struct refcnt *refcnt) |
| | Free ATA command. More...
|
| |
| static void | atacmd_close (struct ata_command *atacmd, int rc) |
| | Close ATA command. More...
|
| |
| static void | atacmd_done (struct ata_command *atacmd, int rc) |
| | Handle ATA command completion. More...
|
| |
| static void | atacmd_data_buffer (struct ata_command *atacmd __unused, void *buffer, size_t len, void **data, size_t *data_len) |
| | Use provided data buffer for ATA command. More...
|
| |
| static void | atacmd_data_none (struct ata_command *atacmd __unused, void *buffer __unused, size_t len __unused, void **data __unused, size_t *data_len __unused) |
| | Use no data buffer for ATA command. More...
|
| |
| static void | atacmd_data_priv (struct ata_command *atacmd, void *buffer __unused, size_t len __unused, void **data, size_t *data_len) |
| | Use private data buffer for ATA command. More...
|
| |
| static const char * | ata_model (struct ata_identity *identity) |
| | Return ATA model string (for debugging) More...
|
| |
| static void | atacmd_identify_done (struct ata_command *atacmd, int rc) |
| | Handle ATA IDENTIFY command completion. More...
|
| |
| static int | atadev_command (struct ata_device *atadev, struct interface *block, struct ata_command_type *type, uint64_t lba, unsigned int count, void *buffer, size_t len) |
| | Create ATA command. More...
|
| |
| static int | atadev_read (struct ata_device *atadev, struct interface *block, uint64_t lba, unsigned int count, void *buffer, size_t len) |
| | Issue ATA block read. More...
|
| |
| static int | atadev_write (struct ata_device *atadev, struct interface *block, uint64_t lba, unsigned int count, void *buffer, size_t len) |
| | Issue ATA block write. More...
|
| |
| static int | atadev_read_capacity (struct ata_device *atadev, struct interface *block) |
| | Read ATA device capacity. More...
|
| |
| static void | atadev_close (struct ata_device *atadev, int rc) |
| | Close ATA device. More...
|
| |
| static int | atadev_edd_describe (struct ata_device *atadev, struct edd_interface_type *type, union edd_device_path *path) |
| | Describe ATA device using EDD. More...
|
| |
| int | ata_open (struct interface *block, struct interface *ata, unsigned int device, unsigned int max_count) |
| | Open ATA device. More...
|
| |
ATA block device.
Definition in file ata.c.
Get reference to ATA device.
Get ATA command private data.
Drop reference to ATA command.
Get reference to ATA command.
Drop reference to ATA device.
- Parameters
-
- Return values
-
- Parameters
-
| atadev | ATA device |
| atacmd | ATA command |
- Return values
-
- Parameters
-
| atacmd | ATA command |
| atacmd | ATA command |
- Return values
-
Definition at line 181 of file ata.c.
#define ref_get(refcnt)
Get additional reference to object.
References ref_get, and ata_device::refcnt.
| static void atacmd_identify_done |
( |
struct ata_command * |
atacmd, |
|
|
int |
rc |
|
) |
| |
|
static |
Handle ATA IDENTIFY command completion.
- Parameters
-
| atacmd | ATA command |
| rc | Reason for completion |
Definition at line 377 of file ata.c.
398 DBGC ( atadev,
"ATA %p is a %s\n", atadev,
ata_model ( identity ) );
399 DBGC ( atadev,
"ATA %p has %#llx blocks (%ld MB) and uses %s\n",
400 atadev, capacity.blocks,
401 ( (
signed long ) ( capacity.blocks >> 11 ) ),
402 ( atadev->
lba48 ?
"LBA48" :
"LBA" ) );
struct arbelprm_rc_send_wqe rc
#define le32_to_cpu(value)
struct ata_device * atadev
ATA device.
void block_capacity(struct interface *intf, struct block_device_capacity *capacity)
Report block device capacity.
static void atacmd_close(struct ata_command *atacmd, int rc)
Close ATA command.
Structure returned by ATA IDENTIFY command.
ATA IDENTIFY private data.
unsigned int max_count
Maximum number of blocks per single transfer.
int lba48
Device uses LBA48 extended addressing.
static const char * ata_model(struct ata_identity *identity)
Return ATA model string (for debugging)
static struct tlan_private * priv
#define cpu_to_le16(value)
#define le64_to_cpu(value)
#define ATA_SUPPORTS_LBA48
Supports LBA48 flag.
struct interface block
Block data interface.
#define ATA_SECTOR_SIZE
ATA sector size.
References ata_model(), ATA_SECTOR_SIZE, ATA_SUPPORTS_LBA48, atacmd_close(), ata_command::atadev, block_device_capacity::blksize, ata_command::block, block_capacity(), block_device_capacity::blocks, cpu_to_le16, DBGC, ata_device::lba48, ata_identity::lba48_sectors, ata_identity::lba_sectors, le32_to_cpu, le64_to_cpu, block_device_capacity::max_count, ata_device::max_count, priv, rc, and ata_identity::supports_lba48.
Create ATA command.
- Parameters
-
| atadev | ATA device |
| block | Block data interface |
| type | ATA command type |
| lba | Starting logical block address |
| count | Number of blocks to transfer |
| buffer | Data buffer |
| len | Length of data buffer |
- Return values
-
Definition at line 454 of file ata.c.
465 atacmd =
zalloc (
sizeof ( *atacmd ) +
type->priv_len );
474 atacmd->
atadev = atadev_get ( atadev );
480 DBGC ( atadev,
"ATA %p tag %08x buffer length mismatch (count " 481 "%d len %zd)\n", atadev, atacmd->
tag,
count,
len );
492 if ( ! atadev->
lba48 )
505 DBGC ( atadev,
"ATA %p tag %08x could not issue command: %s\n",
511 DBGC2 ( atadev,
"ATA %p tag %08x %s cmd %02x dev %02x LBA%s %08llx " 512 "count %04x\n", atadev, atacmd->
tag, atacmd->
type->
name,
514 (
command.cb.lba48 ?
"48" :
"" ),
515 (
unsigned long long )
command.cb.lba.native,
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
static void atacmd_free(struct refcnt *refcnt)
Free ATA command.
struct ata_device * atadev
ATA device.
#define list_add(new, head)
Add a new entry to the head of a list.
#define ref_init(refcnt, free)
Initialise a reference counter.
uint32_t type
Operating system type.
static void atacmd_close(struct ata_command *atacmd, int rc)
Close ATA command.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
unsigned int device
Device number.
static struct interface_descriptor atacmd_ata_desc
ATA command ATA interface descriptor.
struct refcnt refcnt
Reference count.
#define ENOMEM
Not enough space.
An ATA command information unit.
static unsigned int count
Number of entries.
#define ATA_DEV_OBSOLETE
Obsolete bits in the ATA device register.
struct list_head list
List of ATA commands.
char * strerror(int errno)
Retrieve string representation of error number.
void * zalloc(size_t size)
Allocate cleared memory.
struct interface ata
ATA data interface.
int lba48
Device uses LBA48 extended addressing.
uint64_t lba
Starting block number.
#define ATA_DEV_LBA
LBA flag in the ATA device register.
struct interface ata
ATA control interface.
uint8_t block[3][8]
DES-encrypted blocks.
struct ata_command_type * type
Command type.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
uint64_t tag
Identity tag.
struct interface block
Block data interface.
static struct interface_descriptor atacmd_block_desc
ATA command block interface descriptor.
#define ref_put(refcnt)
Drop reference to object.
void * memset(void *dest, int character, size_t len) __nonnull
#define ATA_SECTOR_SIZE
ATA sector size.
References ata_command::ata, ata_device::ata, ATA_DEV_LBA, ATA_DEV_OBSOLETE, ATA_SECTOR_SIZE, atacmd_ata_desc, atacmd_block_desc, atacmd_close(), atacmd_free(), ata_command::atadev, block, ata_command::block, buffer, count, DBGC, DBGC2, ata_device::device, EINVAL, ENOMEM, intf_init(), intf_plug_plug(), lba, ata_device::lba48, len, ata_command::list, list_add, memset(), ata_command_type::name, rc, ref_init, ref_put, ata_command::refcnt, strerror(), tag, ata_command::tag, type, ata_command::type, and zalloc().
Referenced by atadev_read(), atadev_read_capacity(), and atadev_write().
| int ata_open |
( |
struct interface * |
block, |
|
|
struct interface * |
ata, |
|
|
unsigned int |
device, |
|
|
unsigned int |
max_count |
|
) |
| |
Open ATA device.
- Parameters
-
| block | Block control interface |
| ata | ATA control interface |
| device | ATA device number |
| max_count | Maximum number of blocks per single transfer |
- Return values
-
Definition at line 662 of file ata.c.
667 atadev =
zalloc (
sizeof ( *atadev ) );
#define ref_init(refcnt, free)
Initialise a reference counter.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
unsigned int device
Device number.
uint16_t device
Device ID.
static struct interface_descriptor atadev_block_desc
ATA device block interface descriptor.
#define ENOMEM
Not enough space.
struct interface block
Block control interface.
struct refcnt refcnt
Reference count.
void * zalloc(size_t size)
Allocate cleared memory.
unsigned int max_count
Maximum number of blocks per single transfer.
struct interface ata
ATA control interface.
uint8_t block[3][8]
DES-encrypted blocks.
static struct interface_descriptor atadev_ata_desc
ATA device ATA interface descriptor.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define NULL
NULL pointer (VOID *)
#define ref_put(refcnt)
Drop reference to object.
References ata_device::ata, atadev_ata_desc, atadev_block_desc, block, ata_device::block, device, ata_device::device, ENOMEM, intf_init(), intf_plug_plug(), ata_device::max_count, NULL, ref_init, ref_put, ata_device::refcnt, and zalloc().
Referenced by aoedev_open().