|
iPXE
|
ATA block device. More...
#include <stddef.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <errno.h>#include <byteswap.h>#include <ipxe/list.h>#include <ipxe/interface.h>#include <ipxe/blockdev.h>#include <ipxe/edd.h>#include <ipxe/ata.h>Go to the source code of this file.
Data Structures | |
| struct | ata_device |
| An ATA device. More... | |
| struct | ata_command |
| An ATA command. More... | |
| struct | ata_command_type |
| An ATA command type. More... | |
| struct | ata_identify_private |
| ATA IDENTIFY private data. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| int | ata_command (struct interface *control, struct interface *data, struct ata_cmd *command) |
| Issue ATA command. | |
| static | LIST_HEAD (ata_commands) |
| List of all ATA commands. | |
| static | __attribute__ ((always_inline)) |
| Get reference to ATA device. | |
| static void | atacmd_free (struct refcnt *refcnt) |
| Free ATA command. | |
| static void | atacmd_close (struct ata_command *atacmd, int rc) |
| Close ATA command. | |
| static void | atacmd_done (struct ata_command *atacmd, int rc) |
| Handle ATA command completion. | |
| 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 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. | |
| 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 const char * | ata_model (struct ata_identity *identity) |
| Return ATA model string (for debugging) | |
| static void | atacmd_identify_done (struct ata_command *atacmd, int rc) |
| Handle ATA IDENTIFY command completion. | |
| 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 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 int | atadev_read_capacity (struct ata_device *atadev, struct interface *block) |
| Read ATA device capacity. | |
| static void | atadev_close (struct ata_device *atadev, int rc) |
| Close ATA device. | |
| static int | atadev_edd_describe (struct ata_device *atadev, struct edd_interface_type *type, union edd_device_path *path) |
| Describe ATA device using EDD. | |
| int | ata_open (struct interface *block, struct interface *ata, unsigned int device, unsigned int max_count) |
| Open ATA device. | |
Variables | |
| static struct ata_command_type | atacmd_read |
| ATA READ command type. | |
| static struct ata_command_type | atacmd_write |
| ATA WRITE command type. | |
| static struct ata_command_type | atacmd_identify |
| ATA IDENTITY command type. | |
| 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 struct interface_operation | atacmd_ata_op [] |
| ATA command ATA interface operations. | |
| static struct interface_descriptor | atacmd_ata_desc |
| ATA command ATA interface descriptor. | |
| static struct interface_operation | atadev_block_op [] |
| ATA device block interface operations. | |
| static struct interface_descriptor | atadev_block_desc |
| ATA device block interface descriptor. | |
| static struct interface_operation | atadev_ata_op [] |
| ATA device ATA interface operations. | |
| static struct interface_descriptor | atadev_ata_desc |
| ATA device ATA interface descriptor. | |
ATA block device.
Definition in file ata.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
Issue ATA command.
| control | ATA control interface |
| data | ATA data interface |
| command | ATA command |
| tag | Command tag, or negative error |
Definition at line 60 of file ata.c.
References ata_command_TYPE, control, data, dest, EOPNOTSUPP, intf_get_dest_op, intf_object(), intf_put(), op, and tag.
|
static |
List of all ATA commands.
|
inlinestatic |
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.
| atadev | ATA device |
| atadev | ATA device |
| atadev | ATA device |
| atacmd | ATA command |
| atacmd | ATA command |
| atacmd | ATA command |
| atacmd | ATA command |
| priv | Private data |
Definition at line 182 of file ata.c.
References ref_get, and ata_device::refcnt.
|
static |
Free ATA command.
| refcnt | Reference count |
Definition at line 236 of file ata.c.
References ata_command::atadev, container_of, free, ata_command::list, and list_del.
Referenced by atadev_command().
|
static |
Close ATA command.
| atacmd | ATA command |
| rc | Reason for close |
Definition at line 254 of file ata.c.
References ata_command::ata, ata_command::atadev, ata_command::block, DBGC, intf_shutdown(), rc, strerror(), and ata_command::tag.
Referenced by atacmd_identify_done(), atadev_close(), and atadev_command().
|
static |
Handle ATA command completion.
| atacmd | ATA command |
| rc | Reason for close |
Definition at line 273 of file ata.c.
References ata_command_type::done, rc, and ata_command::type.
|
static |
|
static |
Use private data buffer for ATA command.
| atacmd | ATA command |
| buffer | Available buffer |
| len | Available buffer length |
| data | Data buffer |
| data_len | Data buffer length |
Definition at line 320 of file ata.c.
References __unused, buffer, data, data_len, len, ata_command_type::priv_len, and ata_command::type.
|
static |
Return ATA model string (for debugging)
| identify | ATA identity data |
| model | Model string |
Definition at line 359 of file ata.c.
References bswap_16, and ata_identity::model.
Referenced by atacmd_identify_done().
|
static |
Handle ATA IDENTIFY command completion.
| atacmd | ATA command |
| rc | Reason for completion |
Definition at line 378 of file ata.c.
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, ata_device::max_count, block_device_capacity::max_count, priv, rc, and ata_identity::supports_lba48.
|
static |
Create ATA command.
| 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 |
| rc | Return status code |
Definition at line 455 of file ata.c.
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, ata_command::block, 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(), ata_command::tag, tag, ata_command::type, type, and zalloc().
Referenced by atadev_read(), atadev_read_capacity(), and atadev_write().
|
static |
Issue ATA block read.
| atadev | ATA device |
| block | Block data interface |
| lba | Starting logical block address |
| count | Number of blocks to transfer |
| buffer | Data buffer |
| len | Length of data buffer |
| rc | Return status code |
Definition at line 544 of file ata.c.
References atacmd_read, atadev_command(), block, buffer, count, lba, and len.
|
static |
Issue ATA block write.
| atadev | ATA device |
| block | Block data interface |
| lba | Starting logical block address |
| count | Number of blocks to transfer |
| buffer | Data buffer |
| len | Length of data buffer |
| rc | Return status code |
Definition at line 563 of file ata.c.
References atacmd_write, atadev_command(), block, buffer, count, lba, and len.
|
static |
Read ATA device capacity.
| atadev | ATA device |
| block | Block data interface |
| rc | Return status code |
Definition at line 578 of file ata.c.
References assert, ATA_SECTOR_SIZE, atacmd_identify, atadev_command(), block, and NULL.
|
static |
Close ATA device.
| atadev | ATA device |
| rc | Reason for close |
Definition at line 594 of file ata.c.
References ata_device::ata, atacmd_close(), ata_command::atadev, ata_device::block, intf_shutdown(), ata_command::list, list_for_each_entry_safe, rc, and tmp.
|
static |
Describe ATA device using EDD.
| atadev | ATA device |
| type | EDD interface type |
| path | EDD device path |
| rc | Return status code |
Definition at line 620 of file ata.c.
References ATA_DEV_SLAVE, ata_command::atadev, cpu_to_le64, ata_device::device, EDD_INTF_TYPE_ATA, edd_device_path::slave, and type.
| int ata_open | ( | struct interface * | block, |
| struct interface * | ata, | ||
| unsigned int | device, | ||
| unsigned int | max_count ) |
Open ATA device.
| block | Block control interface |
| ata | ATA control interface |
| device | ATA device number |
| max_count | Maximum number of blocks per single transfer |
| rc | Return status code |
Definition at line 663 of file ata.c.
References ata_device::ata, atadev_ata_desc, atadev_block_desc, ata_device::block, block, 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().
|
static |
ATA READ command type.
Definition at line 328 of file ata.c.
Referenced by atadev_read().
|
static |
ATA WRITE command type.
Definition at line 338 of file ata.c.
Referenced by atadev_write().
|
static |
ATA IDENTITY command type.
Definition at line 413 of file ata.c.
Referenced by atadev_read_capacity().
|
static |
ATA command block interface operations.
|
static |
ATA command block interface descriptor.
Definition at line 429 of file ata.c.
Referenced by atadev_command().
|
static |
ATA command ATA interface operations.
|
static |
ATA command ATA interface descriptor.
Definition at line 439 of file ata.c.
Referenced by atadev_command().
|
static |
ATA device block interface operations.
|
static |
ATA device block interface descriptor.
Definition at line 640 of file ata.c.
Referenced by ata_open().
|
static |
ATA device ATA interface operations.
|
static |
ATA device ATA interface descriptor.
Definition at line 650 of file ata.c.
Referenced by ata_open().