122 size_t len,
const void *ll_source );
268 DBGC ( aoedev,
"AoE %s/%08x could not transmit: %s\n",
286 const void *ll_source ) {
293 DBGC ( aoedev,
"AoE %s/%08x received underlength response " 301 DBGC ( aoedev,
"AoE %s/%08x received response for incorrect " 310 DBGC ( aoedev,
"AoE %s/%08x terminated in error\n",
358 return (
sizeof (
struct aoehdr ) +
sizeof (
struct aoeata ) +
397 DBGC2 ( aoedev,
"AoE %s/%08x ATA cmd %02x:%02x:%02x:%02x:%08llx",
405 DBGC2 ( aoedev,
"\n" );
427 DBGC ( aoedev,
"AoE %s/%08x received underlength ATA response " 432 data_len = (
len - (
sizeof ( *aoehdr ) +
sizeof ( *aoeata ) ) );
433 DBGC2 ( aoedev,
"AoE %s/%08x ATA rsp %02x in %04zx\n",
439 DBGC ( aoedev,
"AoE %s/%08x status %02x\n",
447 if ( data_len < command->data_in_len ) {
448 DBGC ( aoedev,
"AoE %s/%08x data-in underrun (received %zd, " 475 return (
sizeof (
struct aoehdr ) +
sizeof (
struct aoecfg ) );
498 DBGC ( aoedev,
"AoE %s/%08x CONFIG cmd\n",
512 size_t len,
const void *ll_source ) {
520 DBGC ( aoedev,
"AoE %s/%08x received underlength " 521 "configuration response (%zd bytes)\n",
525 DBGC ( aoedev,
"AoE %s/%08x CONFIG rsp buf %04x fw %04x scnt %02x\n",
531 DBGC ( aoedev,
"AoE %s has MAC address %s\n",
578 for ( i = 0 ; i < 65536 ; i++ ) {
638 DBGC (
aoedev,
"AoE %s cannot issue command while net device " 775 return &aoedev->
desc;
817 aoedev =
zalloc (
sizeof ( *aoedev ) );
834 DBGC ( aoedev,
"AoE %s could not initiate configuration: %s\n",
842 DBGC ( aoedev,
"AoE %s could not create ATA device: %s\n",
879 const void *ll_source,
887 DBG (
"AoE received underlength packet (%zd bytes)\n",
893 DBG (
"AoE received packet for unsupported protocol version " 899 DBG (
"AoE received request packet\n" );
907 DBG (
"AoE received packet for unused tag %08x\n",
952 unsigned int *
minor ) {
999 DBG (
"AoE cannot identify network device\n" );
1005 DBG (
"AoE cannot parse URI\n" );
1053 memset ( &abft, 0,
sizeof ( abft ) );
1060 sizeof ( abft.
mac ) );
1063 if ( (
rc = install ( &abft.
acpi ) ) != 0 ) {
1064 DBGC ( aoedev,
"AoE %s could not install aBFT: %s\n",
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define EINVAL
Invalid argument.
An object interface operation.
struct aoecfg cfg
Config command.
union aoeata::@499 lba
Logical block address, in little-endian order.
struct arbelprm_rc_send_wqe rc
void xfer_window_changed(struct interface *intf)
Report change of flow control window.
void intf_close(struct interface *intf, int rc)
Close an object interface.
static struct aoe_command * aoecmd_find_tag(uint32_t tag)
Identify AoE command by tag.
const char * name
Protocol name.
struct acpi_header acpi
ACPI header.
#define iob_put(iobuf, len)
#define AOE_TAG_MAGIC
AoE tag magic marker.
static struct aoe_device * aoedev_get(struct aoe_device *aoedev)
Get reference to AoE device.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
static size_t aoecmd_ata_cmd_len(struct aoe_command *aoecmd)
Calculate length of AoE ATA command IU.
static struct interface_operation aoedev_ata_op[]
AoE device ATA interface operations.
uint8_t ll_addr_len
Link-layer address length.
static int aoe_parse_uri(struct uri *uri, unsigned int *major, unsigned int *minor)
Parse AoE URI.
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
static int abft_complete(struct acpi_descriptor *desc __unused)
Check if AoE boot firmware table descriptor is complete.
uint8_t err_feat
ATA error/feature register.
struct acpi_model abft_model __acpi_model
aBFT model
int(* rsp)(struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source)
Handle AoE response IU.
#define FEATURE_PROTOCOL
Network protocols.
static struct interface_descriptor aoedev_config_desc
AoE device configuration interface descriptor.
static int aoe_open(struct interface *parent, struct uri *uri)
Open AoE URI.
#define list_add(new, head)
Add a new entry to the head of a list.
#define AOE_MAX_COUNT
Maximum number of sectors per packet.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct list_head descs
List of descriptors.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
static struct interface_descriptor aoecmd_ata_desc
AoE command ATA interface descriptor.
uint32_t type
Operating system type.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
#define EADDRINUSE
Address already in use.
uint16_t major
Major number.
uint64_t desc
Microcode descriptor list physical address.
uint8_t data[0]
Data payload.
union aoecmd payload[0]
Payload.
static size_t aoedev_window(struct aoe_device *aoedev)
Check AoE device flow-control window.
#define AOE_VERSION_MASK
Version part of ver_flags field.
static struct aoe_command_type aoecmd_cfg
AoE configuration command.
static int aoecmd_new_tag(void)
Choose an AoE command tag.
#define ENOENT
No such file or directory.
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
const uint8_t * ll_broadcast
Link-layer broadcast address.
uint16_t major
Major device number, in network byte order.
static int aoedev_ata_command(struct aoe_device *aoedev, struct interface *parent, struct ata_cmd *command)
Issue AoE ATA command.
static int aoecmd_tx(struct aoe_command *aoecmd)
Transmit AoE command request.
uint16_t fwver
ATA target firmware version.
static int abft_install(int(*install)(struct acpi_header *acpi))
Install AoE boot firmware table(s)
#define cpu_to_le64(value)
uint32_t data_len
Microcode data size (or 0 to indicate 2000 bytes)
static int aoe_rx(struct io_buffer *iobuf, struct net_device *netdev __unused, const void *ll_dest __unused, const void *ll_source, unsigned int flags __unused)
Process incoming AoE packets.
#define static_assert(x)
Assert a condition at build time.
Uniform Resource Identifiers.
struct list_head list
List of active commands.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
unsigned long timeout
Saved timeout value.
Access to external ("user") memory.
uint8_t cmd_stat
ATA command/status register.
size_t xfer_window(struct interface *intf)
Check flow control window.
FEATURE(FEATURE_PROTOCOL, "AoE", DHCP_EB_FEATURE_AOE, 1)
A doubly-linked list entry (or list head)
uint8_t command
Command number.
Data transfer interfaces.
struct net_protocol aoe_protocol __net_protocol
AoE protocol.
#define list_empty(list)
Test whether a list is empty.
uint8_t mac[ETH_ALEN]
MAC address.
static void aoecmd_ata_cmd(struct aoe_command *aoecmd, void *data, size_t len)
Build AoE ATA command IU.
#define list_del(list)
Delete an entry from a list.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static void aoecmd_cfg_cmd(struct aoe_command *aoecmd, void *data, size_t len)
Build AoE configuration command IU.
uint32_t major
Major version.
uint32_t minor
Minor version.
#define __unused
Declare a variable or data structure as unused.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
#define AOE_FL_WRITE
Write command.
#define ATA_DEV_MASTER
Master ("device 0") flag in the ATA device register.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define container_of(ptr, type, field)
Get containing structure.
#define EWOULDBLOCK
Operation would block.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
size_t(* cmd_len)(struct aoe_command *aoecmd)
Calculate length of AoE command IU.
void(* cmd)(struct aoe_command *aoecmd, void *data, size_t len)
Build AoE command IU.
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
struct aoe_device * aoedev
AOE device.
#define AOE_VERSION
Version 1.
static struct net_device * netdev
const char * scheme
URI protocol name.
struct net_device * last_opened_netdev(void)
Get most recently opened network device.
An ATA command information unit.
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
struct acpi_descriptor desc
ACPI descriptor.
uint8_t minor
Minor device number.
static int aoedev_cfg_command(struct aoe_device *aoedev, struct interface *parent)
Issue AoE configuration command.
struct interface ata
ATA command issuing interface.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
#define cpu_to_le32(value)
struct aoe_command_type * type
Command type.
static struct aoe_command * aoecmd_create(struct aoe_device *aoedev, struct aoe_command_type *type)
Create AoE command.
#define DHCP_EB_FEATURE_AOE
AoE protocol.
An object interface descriptor.
uint8_t target[MAX_LL_ADDR_LEN]
Target MAC address.
#define ERANGE
Result too large.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
static void aoedev_close(struct aoe_device *aoedev, int rc)
Close AoE device.
void * zalloc(size_t size)
Allocate cleared memory.
static struct interface_operation aoecmd_ata_op[]
AoE command ATA interface operations.
#define ref_get(refcnt)
Get additional reference to object.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
uint32_t tag
Tag, in network byte order.
uint16_t bufcnt
AoE queue depth.
#define EOPNOTSUPP
Operation not supported on socket.
struct refcnt refcnt
Reference counter.
struct interface config
Configuration command interface.
#define ENODEV
No such device.
Data transfer interface opening.
uint8_t aflags
AoE command flags.
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
AoE Boot Firmware Table (aBFT)
static int aoecmd_rx(struct aoe_command *aoecmd, struct io_buffer *iobuf, const void *ll_source)
Receive AoE command response.
struct acpi_descriptor * acpi_describe(struct interface *intf)
Get object's ACPI descriptor.
#define ATA_STAT_ERR
Command completed in error.
struct uri_opener aoe_uri_opener __uri_opener
AoE URI opener.
#define AOE_CMD_CONFIG
Query Config Information.
struct device * dev
Underlying hardware device.
void start_timer(struct retry_timer *timer)
Start timer.
A network-layer protocol.
Network device management.
#define iob_reserve(iobuf, len)
#define INIT_LIST_HEAD(list)
Initialise a list head.
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
An ACPI descriptor (used to construct ACPI tables)
static void aoedev_config_done(struct aoe_device *aoedev, int rc)
Handle AoE device configuration completion.
void stop_timer(struct retry_timer *timer)
Stop timer.
static int aoecmd_cfg_rsp(struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source)
Handle AoE configuration response IU.
#define ABFT_SIG
AoE boot firmware table signature.
static struct device * aoedev_identify_device(struct aoe_device *aoedev)
Identify device underlying AoE device.
EFI_DEVICE_PATH_PROTOCOL * efi_describe(struct interface *intf)
Describe object as an EFI device path.
char name[NETDEV_NAME_LEN]
Name of this network device.
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
const char * opaque
Opaque part.
#define EPROTONOSUPPORT
Protocol not supported.
static void aoecmd_expired(struct retry_timer *timer, int fail)
Handle AoE retry timer expiry.
EFI_DEVICE_PATH_PROTOCOL * efi_aoe_path(struct aoe_device *aoedev)
Construct EFI device path for AoE device.
int configured
Device is configued.
void * data
Start of data.
uint8_t count
ATA sector count register.
static void aoecmd_put(struct aoe_command *aoecmd)
Drop reference to AoE command.
#define EIO
Input/output error.
static void aoecmd_free(struct refcnt *refcnt)
Free AoE command.
static struct aoe_command_type aoecmd_ata
AoE ATA command.
static size_t aoecmd_cfg_cmd_len(struct aoe_command *aoecmd __unused)
Calculate length of AoE configuration command IU.
static int aoecmd_ata_rsp(struct aoe_command *aoecmd, const void *data, size_t len, const void *ll_source __unused)
Handle AoE ATA response IU.
#define cpu_to_le16(value)
uint8_t minor
Minor number.
uint32_t end
Ending offset.
struct net_device * netdev
Network device.
uint8_t data[48]
Additional event data.
uint8_t ver_flags
Protocol version number and flags.
static void aoedev_free(struct refcnt *refcnt)
Free AoE device.
#define AOE_FL_ERROR
Command generated an error.
const char *(* ntoa)(const void *ll_addr)
Transcribe link-layer address.
static int aoedev_open(struct interface *parent, struct net_device *netdev, unsigned int major, unsigned int minor)
Open AoE device.
int ata_open(struct interface *block, struct interface *ata, unsigned int device, unsigned int max_count)
Open ATA device.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
A Uniform Resource Identifier.
uint8_t scnt
ATA target sector count.
struct aoeata ata
ATA command.
#define AOE_CMD_ATA
Issue ATA command.
struct device * identify_device(struct interface *intf)
Identify a device behind an interface.
static void aoecmd_close(struct aoe_command *aoecmd, int rc)
Close AoE command.
static void aoedev_put(struct aoe_device *aoedev)
Drop reference to AoE device.
static LIST_HEAD(aoe_devices)
List of all AoE devices.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define AOE_FL_RESPONSE
Message is a response.
#define AOE_FL_EXTENDED
LBA48 extended addressing.
#define DBG(...)
Print a debugging message.
static struct interface_descriptor aoedev_ata_desc
AoE device ATA interface descriptor.
#define LIST_HEAD_INIT(list)
Initialise a static list head.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
uint64_t tag
Identity tag.
static struct aoe_command * aoecmd_get(struct aoe_command *aoecmd)
Get reference to AoE command.
#define ATA_DEV_SLAVE
Slave ("device 1") flag in the ATA device register.
#define ATA_DEV_MASK
Mask of non-LBA portion of device register.
#define NULL
NULL pointer (VOID *)
#define AOE_FL_DEV_HEAD
Device/head flag.
#define ETIMEDOUT
Connection timed out.
static struct acpi_descriptor * aoedev_describe(struct aoe_device *aoedev)
Get AoE ACPI descriptor.
struct bofm_section_header done
struct ll_protocol * ll_protocol
Link-layer protocol.
#define ref_put(refcnt)
Drop reference to object.
static void acpi_init(struct acpi_descriptor *desc, struct acpi_model *model, struct refcnt *refcnt)
Initialise ACPI descriptor.
struct interface ata
ATA command interface.
void * memset(void *dest, int character, size_t len) __nonnull
static const char * aoedev_name(struct aoe_device *aoedev)
Name AoE device.
static struct interface_operation aoedev_config_op[]
AoE device configuration interface operations.