153 size_t *data_in_len );
166 size_t *data_out_len );
242 atadev_put ( atacmd->
atadev );
258 DBGC ( atadev,
"ATA %p tag %08x closed: %s\n",
323 *
data = atacmd_priv ( atacmd );
362 char text[
sizeof ( identity->
model ) + 1 ];
366 for ( i = 0 ; i < (
sizeof ( identity->
model ) / 2 ) ; i++ )
399 DBGC ( atadev,
"ATA %p is a %s\n", atadev,
ata_model ( identity ) );
400 DBGC ( atadev,
"ATA %p has %#llx blocks (%ld MB) and uses %s\n",
402 ( (
signed long ) ( capacity.
blocks >> 11 ) ),
403 ( atadev->
lba48 ?
"LBA48" :
"LBA" ) );
466 atacmd =
zalloc (
sizeof ( *atacmd ) +
type->priv_len );
475 atacmd->
atadev = atadev_get ( atadev );
481 DBGC ( atadev,
"ATA %p tag %08x buffer length mismatch (count "
482 "%d len %zd)\n", atadev, atacmd->
tag,
count,
len );
493 if ( ! atadev->
lba48 )
506 DBGC ( atadev,
"ATA %p tag %08x could not issue command: %s\n",
512 DBGC2 ( atadev,
"ATA %p tag %08x %s cmd %02x dev %02x LBA%s %08llx "
513 "count %04x\n", atadev, atacmd->
tag, atacmd->
type->
name,
515 (
command.cb.lba48 ?
"48" :
"" ),
516 (
unsigned long long )
command.cb.lba.native,
606 atacmd_get ( atacmd );
608 atacmd_put ( atacmd );
664 unsigned int device,
unsigned int max_count ) {
668 atadev =
zalloc (
sizeof ( *atadev ) );
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
unsigned long long uint64_t
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" retur dest)
#define assert(condition)
Assert a condition at run-time.
static void atacmd_free(struct refcnt *refcnt)
Free ATA command.
static int atadev_read_capacity(struct ata_device *atadev, struct interface *block)
Read ATA device capacity.
int ata_command(struct interface *control, struct interface *data, struct ata_cmd *command)
Issue ATA command.
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.
int ata_open(struct interface *block, struct interface *ata, unsigned int device, unsigned int max_count)
Open ATA device.
static struct interface_operation atadev_block_op[]
ATA device block interface operations.
static struct interface_descriptor atadev_ata_desc
ATA device ATA interface descriptor.
static int atadev_edd_describe(struct ata_device *atadev, struct edd_interface_type *type, union edd_device_path *path)
Describe ATA device using EDD.
static struct ata_command_type atacmd_write
ATA WRITE command type.
static struct interface_descriptor atadev_block_desc
ATA device block interface descriptor.
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.
static struct interface_descriptor atacmd_ata_desc
ATA command ATA interface descriptor.
static void atacmd_done(struct ata_command *atacmd, int rc)
Handle ATA command completion.
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.
static struct interface_operation atadev_ata_op[]
ATA device ATA interface operations.
static void atadev_close(struct ata_device *atadev, int rc)
Close ATA device.
static void atacmd_identify_done(struct ata_command *atacmd, int rc)
Handle ATA IDENTIFY command completion.
static const char * ata_model(struct ata_identity *identity)
Return ATA model string (for debugging)
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.
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.
static struct interface_operation atacmd_ata_op[]
ATA command ATA interface operations.
static struct interface_operation atacmd_block_op[]
ATA command block interface operations.
static struct interface_descriptor atacmd_block_desc
ATA command block interface descriptor.
static void atacmd_close(struct ata_command *atacmd, int rc)
Close ATA command.
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.
static struct ata_command_type atacmd_identify
ATA IDENTITY command type.
static struct ata_command_type atacmd_read
ATA READ command type.
#define ATA_CMD_IDENTIFY
"Identify" command
#define ATA_DEV_SLAVE
Slave ("device 1") flag in the ATA device register.
#define ATA_CMD_READ_EXT
"Read sectors (ext)" command
#define ATA_CMD_READ
"Read sectors" command
#define ATA_SECTOR_SIZE
ATA sector size.
#define ATA_CMD_WRITE
"Write sectors" command
#define ata_command_TYPE(object_type)
#define ATA_SUPPORTS_LBA48
Supports LBA48 flag.
#define ATA_DEV_OBSOLETE
Obsolete bits in the ATA device register.
#define ATA_CMD_WRITE_EXT
"Write sectors (ext)" command
#define ATA_DEV_LBA
LBA flag in the ATA device register.
int block_read_capacity(struct interface *control, struct interface *data)
Read block device capacity.
int block_write(struct interface *control, struct interface *data, uint64_t lba, unsigned int count, void *buffer, size_t len)
Write to block device.
int block_read(struct interface *control, struct interface *data, uint64_t lba, unsigned int count, void *buffer, size_t len)
Read from block device.
void block_capacity(struct interface *intf, struct block_device_capacity *capacity)
Report block device capacity.
int edd_describe(struct interface *intf, struct edd_interface_type *type, union edd_device_path *path)
Describe a disk device using EDD.
Enhanced Disk Drive specification.
uint64_t tag
Identity tag.
#define EDD_INTF_TYPE_ATA
EDD ATA interface type.
uint32_t type
Operating system type.
uint8_t data[48]
Additional event data.
#define __unused
Declare a variable or data structure as unused.
static unsigned int count
Number of entries.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
uint64_t lba
Starting block number.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define EINVAL
Invalid argument.
#define EOPNOTSUPP
Operation not supported on socket.
#define ENOMEM
Not enough space.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define cpu_to_le64(value)
#define le64_to_cpu(value)
#define le32_to_cpu(value)
#define cpu_to_le16(value)
void * memset(void *dest, int character, size_t len) __nonnull
void intf_close(struct interface *intf, int rc)
Close an object interface.
void * intf_object(struct interface *intf)
Get pointer to object containing object interface.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
void intf_put(struct interface *intf)
Decrement reference count on an object interface.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
#define intf_get_dest_op(intf, type, dest)
Get object interface destination and operation method.
#define INTF_DESC_PASSTHRU(object_type, intf, operations, passthru)
Define an object interface descriptor with pass-through interface.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
#define list_del(list)
Delete an entry from a list.
#define LIST_HEAD(list)
Declare a static list head.
#define list_add(new, head)
Add a new entry to the head of a list.
void * zalloc(size_t size)
Allocate cleared memory.
uint8_t block[3][8]
DES-encrypted blocks.
static uint16_t struct vmbus_xfer_pages_operations * op
static void(* free)(struct refcnt *refcnt))
#define ref_get(refcnt)
Get additional reference to object.
#define ref_put(refcnt)
Drop reference to object.
#define ref_init(refcnt, free)
Initialise a reference counter.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
An ATA command information unit.
size_t priv_len
Additional working space.
void(* data_in)(struct ata_command *atacmd, void *buffer, size_t len, void **data_in, size_t *data_in_len)
Calculate data-in buffer.
uint8_t cmd_lba
Command for non-LBA48-capable devices.
void(* done)(struct ata_command *atacmd, int rc)
Handle ATA command completion.
uint8_t cmd_lba48
Command for LBA48-capable devices.
void(* data_out)(struct ata_command *atacmd, void *buffer, size_t len, void **data_out, size_t *data_out_len)
Calculate data-out buffer.
struct ata_device * atadev
ATA device.
struct ata_command_type * type
Command type.
struct interface ata
ATA data interface.
struct list_head list
List of ATA commands.
uint8_t priv[0]
Private data.
struct interface block
Block data interface.
struct refcnt refcnt
Reference count.
int lba48
Device uses LBA48 extended addressing.
unsigned int device
Device number.
struct refcnt refcnt
Reference count.
unsigned int max_count
Maximum number of blocks per single transfer.
struct interface ata
ATA control interface.
struct interface block
Block control interface.
ATA IDENTIFY private data.
struct ata_identity identity
Identity data.
Structure returned by ATA IDENTIFY command.
uint64_t blocks
Total number of blocks.
unsigned int max_count
Maximum number of blocks per single transfer.
size_t blksize
Block size.
An object interface descriptor.
An object interface operation.
A doubly-linked list entry (or list head)
static struct tlan_private * priv
uint32_t data_len
Microcode data size (or 0 to indicate 2000 bytes)