Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
elxu_device.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015, Emulex
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 #if !defined(__ELXU_DEVICE_H__)
34 #define __ELXU_DEVICE_H__
35 #include <stdint.h>
36 #include <ocs_ioctl.h>
37 
38 /* PCI Vendor IDs */
39 #define PCI_VENDOR_ID_EMULEX 0x10df
40 #define PCI_VENDOR_ID_ATTO 0x117c
41 
42 /* PCI Device IDs */
43 #define PCI_DEVICE_ID_LANCER_FC 0xe200
44 #define PCI_DEVICE_ID_LANCER_G6 0xe300
45 #define PCI_DEVICE_ID_PRISM 0xf400
46 #define PCI_DEVICE_ID_LANCER_G6_ATTO 0x0094
47 #define PCI_DEVICE_ID_LANCER_FCOE 0xe260
48 #define PCI_DEVICE_ID_LANCER_NIC 0xe220
49 #define PCI_DEVICE_ID_SKYHAWK_NIC 0x0720
50 #define PCI_DEVICE_ID_SKYHAWK_ISCSI_INI 0x0722
51 #define PCI_DEVICE_ID_SKYHAWK_ISCSI_TGT 0x0723
52 #define PCI_DEVICE_ID_SKYHAWK_FCOE 0x0724
53 
54 typedef enum {
60 
61 typedef enum {
68 
69 typedef enum {
73  DEVICE_DRIVER_BE2NET, /* Not Used */
77 
78 typedef struct elxu_device_struct {
79  struct elxu_device_struct *next;
80  char bus_addr[256];
81  uint16_t vendor;
82  uint16_t device;
83  uint16_t subsystem_vendor;
84  uint16_t subsystem_device;
85  uint32_t deviceIndex;
86  uint32_t sli_intf;
87  uint32_t asic_id;
91 
92  char fwrev[32];
93  char ipl[16];
94  char *modeldesc;
95  char *serialnum;
96  uint32_t phy_port_num;
97 
98  uint8_t wwnn[8];
99  uint8_t wwpn[8];
100  uint8_t mac_addr[6];
101 
102  char device_file_name[1024];
103  int fd; /*>> file descriptor; for sending IOCTLs */
104  void *desc; /*>> pointer to file descriptor (user space socket interface) */
105 } elxu_device_t;
106 
107 /**
108  * @brief device name specifier
109  * This structure is used to describe the type and name of the device
110  * ioctl connection.
111  */
112 
113 typedef struct {
114  int devidx; /*>> device index */
115  char *hostname; /*>> if non-null use a socket rather than device special file */
117 
118 /* Function Declarations */
119 extern void elxu_build_device_list(int argc, char *argv[]);
120 extern void elxu_delete_device_list();
121 extern elxu_device_t *elxu_device_by_index(int index);
122 extern elxu_device_t *elxu_device_from_args(int argc, char *argv[]);
124 extern void elxu_close_device(elxu_device_t *device);
125 extern int elxu_ioctl_device(elxu_device_t *device, int req, void *arg);
126 extern char *elxu_device_get_value(elxu_device_t *device, char *key);
127 extern int elxu_lancer_run_loopback(elxu_device_t *device_p, const char *fname, int type);
128 extern int elxu_lancer_set_loopback(elxu_device_t *device_p, const char *fname, int *type);
129 extern int elxu_lancer_get_link_state(elxu_device_t *device_p, uint32_t *status);
130 extern int elxu_lancer_set_link_state(elxu_device_t *device_p, uint32_t *status);
131 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);
132 extern char *elxu_get_modeldesc(elxu_device_t *device);
133 extern char *elxu_get_fwrev(elxu_device_t *device);
134 extern char *elxu_get_ipl(elxu_device_t *device);
135 extern char *elxu_get_serialnumber(elxu_device_t *device);
136 extern uint32_t elxu_get_phy_port_num(elxu_device_t *device);
137 extern uint32_t elxu_get_sliintf(elxu_device_t *device);
138 extern uint32_t elxu_get_asic_id(elxu_device_t *device);
139 extern char *elxu_decode_asic_id(uint32_t asic_id);
140 extern char *elxu_decode_family(uint32_t family);
141 extern const char *elxu_get_vendor_name(elxu_device_t *device);
142 extern const char *elxu_get_device_name(elxu_device_t *device);
143 extern const char *elxu_get_subsystem_vendor(elxu_device_t *device);
144 extern const char *elxu_get_subsystem_device(elxu_device_t *device);
145 extern void elxu_get_connection_info(elxu_device_t *device);
146 extern int is_iscsi(elxu_device_t *device_p);
147 extern int is_nic(elxu_device_t *device_p);
148 extern int is_fc(elxu_device_t *device_p);
149 extern int is_fcoe(elxu_device_t *device_p);
150 extern int is_skyhawk(elxu_device_t *device_p);
151 extern int is_lancer(elxu_device_t *device_p);
152 extern int is_lancer_g5(elxu_device_t *device_p);
153 extern int is_prism(elxu_device_t *device_p);
154 extern int is_calypso(elxu_device_t *device_p);
155 extern int is_uspace(elxu_device_t *device_p);
156 extern void set_protocol(elxu_device_t *device);
157 extern void fill_device_details(elxu_device_t *device);
158 
159 #endif // __ELXU_HOST_H__
uint16_t subsystem_device
Definition: elxu_device.h:84
const char * elxu_get_vendor_name(elxu_device_t *device)
Return the vendor name for a device.
Definition: elxu_device.c:576
char * modeldesc
Definition: elxu_device.h:94
char * elxu_get_modeldesc(elxu_device_t *device)
Return the model description for a device.
Definition: elxu_device.c:363
uint32_t elxu_get_asic_id(elxu_device_t *device)
Return the ASIC ID value for a device.
Definition: elxu_device.c:478
int is_fc(elxu_device_t *device_p)
Return true IFF the HBA is a FC HBA.
Definition: elxu_device.c:1185
int elxu_device_exec(elxu_device_t *device, char *name, void *arg_in, int arg_in_len, void *arg_out, int arg_out_len)
Execute a management function on a device.
Definition: elxu_device.c:952
elxu_device_t * elxu_device_from_args(int argc, char *argv[])
Return a pointer to a device based on command line args.
Definition: elxu_device.c:688
uint16_t device
Definition: elxu_device.h:82
uint32_t sli_intf
Definition: elxu_device.h:86
char * elxu_get_ipl(elxu_device_t *device)
Return the IPL version for a device.
Definition: elxu_device.c:404
int elxu_lancer_set_link_state(elxu_device_t *device_p, uint32_t *status)
Definition: elxu_device.c:868
uint16_t vendor
Definition: elxu_device.h:81
struct elxu_device_struct * next
Definition: elxu_device.h:79
elxu_device_type_e type
Definition: elxu_device.h:88
device name specifier This structure is used to describe the type and name of the device ioctl connec...
Definition: elxu_device.h:113
int is_lancer_g5(elxu_device_t *device_p)
Return true IFF the HBA is a Lancer G5.
Definition: elxu_device.c:1253
int elxu_lancer_set_loopback(elxu_device_t *device_p, const char *fname, int *type)
Definition: elxu_device.c:843
int is_uspace(elxu_device_t *device_p)
Return true IFF the device is managed by a user space driver.
Definition: elxu_device.c:1305
int elxu_ioctl_device(elxu_device_t *device, int req, void *arg)
Send an ioctl to a device.
Definition: elxu_device.c:322
int is_lancer(elxu_device_t *device_p)
Return true IFF the HBA is a Lancer.
Definition: elxu_device.c:1236
const char * elxu_get_subsystem_vendor(elxu_device_t *device)
Return the PCI subsystem vendor value for a device.
Definition: elxu_device.c:664
uint32_t asic_id
Definition: elxu_device.h:87
void fill_device_details(elxu_device_t *device)
Definition: elxu_device.c:225
uint32_t deviceIndex
Definition: elxu_device.h:85
char * elxu_get_serialnumber(elxu_device_t *device)
Return the serial number for a device.
Definition: elxu_device.c:425
const char * elxu_get_device_name(elxu_device_t *device)
Return the device name for a device.
Definition: elxu_device.c:602
char * serialnum
Definition: elxu_device.h:95
uint32_t elxu_get_phy_port_num(elxu_device_t *device)
Return the physical port number for a device.
Definition: elxu_device.c:446
int is_skyhawk(elxu_device_t *device_p)
Return true IFF the HBA is a Skyhawk.
Definition: elxu_device.c:1219
void elxu_get_connection_info(elxu_device_t *device)
Print iSCSI connection info for the given device.
Definition: elxu_bsd.c:230
uint32_t phy_port_num
Definition: elxu_device.h:96
int is_fcoe(elxu_device_t *device_p)
Return true IFF the HBA is a FCoE HBA.
Definition: elxu_device.c:1202
elxu_device_t * elxu_device_by_index(int index)
Return a pointer to a device given an index.
Definition: elxu_device.c:730
int is_nic(elxu_device_t *device_p)
Return true IFF the HBA is a NIC HBA.
Definition: elxu_device.c:1168
char * elxu_device_get_value(elxu_device_t *device, char *key)
Return a property value for a device.
Definition: elxu_device.c:765
elxu_device_protocol_e protocol
Definition: elxu_device.h:89
void elxu_build_device_list(int argc, char *argv[])
Create a list of devices.
Definition: elxu_device.c:131
elxu_device_protocol_e
Definition: elxu_device.h:61
elxu_device_t * elxu_open_device(elxu_device_name_t *devname)
Open a device file.
Definition: elxu_device.c:212
uint32_t elxu_get_sliintf(elxu_device_t *device)
Return the sli_intf value for a device.
Definition: elxu_device.c:462
int is_iscsi(elxu_device_t *device_p)
Return true IFF the HBA is an iSCSI HBA.
Definition: elxu_device.c:1151
void elxu_close_device(elxu_device_t *device)
Close a device.
Definition: elxu_device.c:340
void set_protocol(elxu_device_t *device)
Definition: elxu_device.c:1129
elxu_device_type_e
Definition: elxu_device.h:54
void elxu_delete_device_list()
Definition: elxu_device.c:164
elxu_device_driver_e
Definition: elxu_device.h:69
int is_prism(elxu_device_t *device_p)
Return true IFF the HBA is a Prism.
Definition: elxu_device.c:1270
char * elxu_get_fwrev(elxu_device_t *device)
Return the firmware revision for a device.
Definition: elxu_device.c:384
char * elxu_decode_family(uint32_t family)
Lookup a family name.
Definition: elxu_device.c:495
int elxu_lancer_run_loopback(elxu_device_t *device_p, const char *fname, int type)
Definition: elxu_device.c:785
int elxu_lancer_get_link_state(elxu_device_t *device_p, uint32_t *status)
Definition: elxu_device.c:857
elxu_device_driver_e driver
Definition: elxu_device.h:90
const char * elxu_get_subsystem_device(elxu_device_t *device)
Return the PCI subsystem device value for a device.
Definition: elxu_device.c:642
int is_calypso(elxu_device_t *device_p)
Return true IFF the HBA is a Calypso.
Definition: elxu_device.c:1287
char * elxu_decode_asic_id(uint32_t asic_id)
Lookup an ASIC ID name.
Definition: elxu_device.c:526
uint16_t subsystem_vendor
Definition: elxu_device.h:83