/* * Copyright (c) 2011-2015, Emulex * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #if !defined(__ELXU_DEVICE_H__) #define __ELXU_DEVICE_H__ #include #include /* PCI Vendor IDs */ #define PCI_VENDOR_ID_EMULEX 0x10df #define PCI_VENDOR_ID_ATTO 0x117c /* PCI Device IDs */ #define PCI_DEVICE_ID_LANCER_FC 0xe200 #define PCI_DEVICE_ID_LANCER_G6 0xe300 #define PCI_DEVICE_ID_PRISM 0xf400 #define PCI_DEVICE_ID_LANCER_G6_ATTO 0x0094 #define PCI_DEVICE_ID_LANCER_FCOE 0xe260 #define PCI_DEVICE_ID_LANCER_NIC 0xe220 #define PCI_DEVICE_ID_SKYHAWK_NIC 0x0720 #define PCI_DEVICE_ID_SKYHAWK_ISCSI_INI 0x0722 #define PCI_DEVICE_ID_SKYHAWK_ISCSI_TGT 0x0723 #define PCI_DEVICE_ID_SKYHAWK_FCOE 0x0724 typedef enum { DEVICE_TYPE_LANCER, DEVICE_TYPE_SKYHAWK, DEVICE_TYPE_PRISM, DEVICE_TYPE_UNKNOWN, } elxu_device_type_e; typedef enum { DEVICE_PROTOCOL_FC, DEVICE_PROTOCOL_FCOE, DEVICE_PROTOCOL_ISCSI, DEVICE_PROTOCOL_NIC, DEVICE_PROTOCOL_UNKNOWN, } elxu_device_protocol_e; typedef enum { DEVICE_DRIVER_OCS, DEVICE_DRIVER_USPACE, DEVICE_DRIVER_PT, DEVICE_DRIVER_BE2NET, /* Not Used */ DEVICE_DRIVER_NONE, DEVICE_DRIVER_UNKNOWN, } elxu_device_driver_e; typedef struct elxu_device_struct { struct elxu_device_struct *next; char bus_addr[256]; uint16_t vendor; uint16_t device; uint16_t subsystem_vendor; uint16_t subsystem_device; uint32_t deviceIndex; uint32_t sli_intf; uint32_t asic_id; elxu_device_type_e type; elxu_device_protocol_e protocol; elxu_device_driver_e driver; char fwrev[32]; char ipl[16]; char *modeldesc; char *serialnum; uint32_t phy_port_num; uint8_t wwnn[8]; uint8_t wwpn[8]; uint8_t mac_addr[6]; char device_file_name[1024]; int fd; /*>> file descriptor; for sending IOCTLs */ void *desc; /*>> pointer to file descriptor (user space socket interface) */ } elxu_device_t; /** * @brief device name specifier * This structure is used to describe the type and name of the device * ioctl connection. */ typedef struct { int devidx; /*>> device index */ char *hostname; /*>> if non-null use a socket rather than device special file */ } elxu_device_name_t; /* Function Declarations */ extern void elxu_build_device_list(int argc, char *argv[]); extern void elxu_delete_device_list(); extern elxu_device_t *elxu_device_by_index(int index); extern elxu_device_t *elxu_device_from_args(int argc, char *argv[]); extern elxu_device_t *elxu_open_device (elxu_device_name_t *devname); extern void elxu_close_device(elxu_device_t *device); extern int elxu_ioctl_device(elxu_device_t *device, int req, void *arg); extern char *elxu_device_get_value(elxu_device_t *device, char *key); extern int elxu_lancer_run_loopback(elxu_device_t *device_p, const char *fname, int type); extern int elxu_lancer_set_loopback(elxu_device_t *device_p, const char *fname, int *type); extern int elxu_lancer_get_link_state(elxu_device_t *device_p, uint32_t *status); extern int elxu_lancer_set_link_state(elxu_device_t *device_p, uint32_t *status); extern int elxu_device_exec(elxu_device_t *device, char *name, void* arg_in, int arg_in_len, void* arg_out, int arg_out_len); extern char *elxu_get_modeldesc(elxu_device_t *device); extern char *elxu_get_fwrev(elxu_device_t *device); extern char *elxu_get_ipl(elxu_device_t *device); extern char *elxu_get_serialnumber(elxu_device_t *device); extern uint32_t elxu_get_phy_port_num(elxu_device_t *device); extern uint32_t elxu_get_sliintf(elxu_device_t *device); extern uint32_t elxu_get_asic_id(elxu_device_t *device); extern char *elxu_decode_asic_id(uint32_t asic_id); extern char *elxu_decode_family(uint32_t family); extern const char *elxu_get_vendor_name(elxu_device_t *device); extern const char *elxu_get_device_name(elxu_device_t *device); extern const char *elxu_get_subsystem_vendor(elxu_device_t *device); extern const char *elxu_get_subsystem_device(elxu_device_t *device); extern void elxu_get_connection_info(elxu_device_t *device); extern int is_iscsi(elxu_device_t *device_p); extern int is_nic(elxu_device_t *device_p); extern int is_fc(elxu_device_t *device_p); extern int is_fcoe(elxu_device_t *device_p); extern int is_skyhawk(elxu_device_t *device_p); extern int is_lancer(elxu_device_t *device_p); extern int is_lancer_g5(elxu_device_t *device_p); extern int is_prism(elxu_device_t *device_p); extern int is_calypso(elxu_device_t *device_p); extern int is_uspace(elxu_device_t *device_p); extern void set_protocol(elxu_device_t *device); extern void fill_device_details(elxu_device_t *device); #endif // __ELXU_HOST_H__