Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
elxu_mbox.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_MBOX_H__)
34 #define __ELXU_MBOX_H__
35 
36 #include <elxu.h>
37 #include <elxu_device.h>
38 #include <stdint.h>
39 #define min(x,y) (((x) < (y)) ? (x) : (y))
40 
41 /* A section of DMA-able memory */
42 typedef struct {
44  void *vaddr;
45  uintptr_t paddr;
46  size_t size;
47  int tag;
48 } memref_t;
49 
50 /**
51  * @brief CLP string used in the DMTF_CLP_CMD mailbox command.
52  */
53 #define CLP_LINKCFG_4X10G "ELX_4x10G"
54 #define CLP_LINKCFG_1X40G "ELX_1x40G"
55 #define CLP_LINKCFG_2X16G "ELX_2x16G"
56 #define CLP_LINKCFG_4X8G "ELX_4x8G"
57 #define CLP_LINKCFG_4X1G "ELX_4x1G"
58 #define CLP_LINKCFG_2X10G "ELX_2x10G"
59 #define CLP_LINKCFG_2X10G_2X8G "ELX_2x10G_2x8G"
60 
61 /**
62  * @brief mgmt link config string to CLP string mapping.
63  *
64  * This structure provides a mapping from the management string(exposed
65  * to set-linkcfg) to the CLP string that is used in the DMTF_CLP_CMD
66  * mailbox command.
67  */
68 typedef struct mbox_linkcfg_map_s {
69  char *mgmt_str;
70  char *clp_str;
72 
73 #define ENABLE 1
74 #define DISABLE 0
75 
76 #define INTERNAL_LOOPBACK 0x1
77 #define EXTERNAL_LOOPBACK 0x2
78 #define PCI_LOOPBACK 0x3
79 
80 #define LOOPBACK_BUF_SIZE 512
81 
82 // O/S specific
83 extern int mbox_common(elxu_device_t *device, mbox_command_t *mbxcmd, uint32_t mbxcmdLength,
84  void *inbuf, uint32_t inbufLength, void *outbuf, uint32_t outbufLength);
85 
86 // Common mailbox command API
87 extern int mbox_read_flashrom(elxu_device_t *device, uint32_t opcode, uint32_t optype,
88  uint32_t offset, void *outbuf, uint32_t outbufLength);
89 
90 extern int mbox_write_flashrom(elxu_device_t *device, uint32_t opcode, uint32_t optype,
91  uint32_t offset, void *outbuf, uint32_t outbufLength);
92 
93 extern int mbox_read_status(elxu_device_t *device, uint32_t clear_counter);
94 extern int mbox_read_link_status(elxu_device_t *device, int clof, int clrc);
95 extern int mbox_get_dport_stats(elxu_device_t *device);
97 extern int mbox_set_dynamic_dport(elxu_device_t *device, char *state);
98 extern int mbox_diag_loopback_tests(elxu_device_t *device, int loopback_type, int retry_count);
99 extern int mbox_read_rev(elxu_device_t *device);
100 extern int mbox_enable_nagle(elxu_device_t *device, int enable);
101 extern int mbox_tcp_parameters(elxu_device_t *device, uint32_t request_flags, uint32_t delayedAckValue,
102  uint32_t delayedAckTimerValue);
103 extern int mbox_connection_update(elxu_device_t *device, uint32_t request_flags,
104  uint16_t connectionId, uint32_t constrainWindowValue);
105 extern int mbox_get_connection_info(elxu_device_t *device, uint32_t connectionHandle);
106 
107 extern int mbox_soft_assign_mac(elxu_device_t *device, int *macaddr);
108 extern int mbox_manage_fat(elxu_device_t *device, uint32_t fat_operation, uint32_t read_log_offset, void *buffer,
109  uint32_t bufferLength);
110 extern int mbox_ext_fat(elxu_device_t *device, uint32_t opcode, void *mbox, uint32_t mboxLength);
111 extern int create_vport(elxu_device_t *device_p, uint64_t wwnn, uint64_t wwpn, int targetFlag, int initiatorFlag);
112 extern int remove_vport(elxu_device_t *device_p, uint64_t wwnn, uint64_t wwpn, int targetFlag, int initiatorFlag);
113 
114 extern memref_t *elx_pt_dma_alloc(elxu_device_t *device, int size);
115 extern void elx_pt_dma_free(memref_t* memref);
116 extern int mbox_fw_reset_pt(elxu_device_t *device, int dd);
117 extern int mbox_sli4_init_pt(elxu_device_t *device);
118 extern int mbox_set_nv_mac_pt(elxu_device_t *device, int *macaddr);
119 extern int mbox_get_serialnum_pt(elxu_device_t *device, char *serial_num, int serial_num_size);
120 extern int mbox_set_nv_wwn_pt(elxu_device_t *device, char *wwpn_p, char *wwnn_p);
121 extern void mbox_get_mac_pt(elxu_device_t *device, uint8_t *mac_addr);
122 extern void mbox_get_wwn_pt(int fd, uint8_t *wwnn, uint8_t *wwpn);
123 extern int mbox_get_profile_list_pt(elxu_device_t *device, char *result, int result_len);
124 extern int mbox_get_active_profile_pt(elxu_device_t *device, char *result, int result_len);
125 extern int mbox_set_active_profile_pt(elxu_device_t *device, char *new_profile_id);
126 extern char *mbox_get_linkcfg_pt(elxu_device_t *device);
127 extern int mbox_set_linkcfg_pt(elxu_device_t *device, char *config);
128 #endif // __ELXU_MBOX_H__
memref_t * elx_pt_dma_alloc(elxu_device_t *device, int size)
Request a DMA allocation through elx_pt.
Definition: elxu_mbox.c:2549
int mbox_connection_update(elxu_device_t *device, uint32_t request_flags, uint16_t connectionId, uint32_t constrainWindowValue)
Definition: elxu_mbox.c:1719
int mbox_set_nv_wwn_pt(elxu_device_t *device, char *wwpn_p, char *wwnn_p)
Issue a set non-volatile WWNN/WWPN.
Definition: elxu_mbox.c:1276
mgmt link config string to CLP string mapping.
Definition: elxu_mbox.h:68
int mbox_tcp_parameters(elxu_device_t *device, uint32_t request_flags, uint32_t ackFrequency, uint32_t delayedAckTimerValue)
Issue the Set TCP Parameters mbox command.
Definition: elxu_mbox.c:1663
int mbox_set_dynamic_dport(elxu_device_t *device, char *state_str)
Definition: elxu_mbox.c:385
int mbox_read_rev(elxu_device_t *device)
Issue read rev mailbox command.
Definition: elxu_mbox.c:194
int mbox_soft_assign_mac(elxu_device_t *device, int *macaddr)
Soft assign MAC.
Definition: elxu_mbox.c:939
int mbox_query_dynamic_dport_status(elxu_device_t *device)
Definition: elxu_mbox.c:369
int mbox_common(elxu_device_t *device, mbox_command_t *mboxcmd, uint32_t mboxcmdLength, void *inbuf, uint32_t inbufLength, void *outbuf, uint32_t outbufLength)
Send a mailbox command.
Definition: elxu_mbox.c:2418
int mbox_set_linkcfg_pt(elxu_device_t *device, char *config)
Set Link configuration.
Definition: elxu_mbox.c:2306
int remove_vport(elxu_device_t *device_p, uint64_t wwnn, uint64_t wwpn, int targetFlag, int initiatorFlag)
Definition: elxu_mbox.c:2339
int mbox_get_dport_stats(elxu_device_t *device)
Issue Get dport stats mailbox command Create a GET_DPORT_STAT mailbox command.
Definition: elxu_mbox.c:408
int mbox_set_nv_mac_pt(elxu_device_t *device, int *macaddr)
Definition: elxu_mbox.c:1098
int mbox_read_status(elxu_device_t *device, uint32_t clear_counter)
Issue read status mailbox command.
Definition: elxu_mbox.c:763
int mbox_ext_fat(elxu_device_t *device, uint32_t opcode, void *mbox, uint32_t mboxLength)
Issue EFD mailbox command.
Definition: elxu_mbox.c:1604
int mbox_set_active_profile_pt(elxu_device_t *device, char *new_profile_id)
Definition: elxu_mbox.c:2940
elxu_device_t * device
Definition: elxu_mbox.h:43
void mbox_get_wwn_pt(int fd, uint8_t *wwnn, uint8_t *wwpn)
Definition: elxu_mbox.c:1029
int mbox_enable_nagle(elxu_device_t *device, int enable)
int mbox_manage_fat(elxu_device_t *device, uint32_t fat_operation, uint32_t read_log_offset, void *buffer, uint32_t bufferLength)
Issue COMMON_MANAGE_FAT mailbox commands.
Definition: elxu_mbox.c:1510
int mbox_read_flashrom(elxu_device_t *device, uint32_t opcode, uint32_t optype, uint32_t offset, void *outbuf, uint32_t outbufLength)
Issue read flashrom mailbox command.
Definition: elxu_mbox.c:1339
int mbox_sli4_init_pt(elxu_device_t *device)
Definition: elxu_mbox.c:2738
int tag
Definition: elxu_mbox.h:47
int mbox_read_link_status(elxu_device_t *device, int clof, int clrc)
Issue read link status mailbox command.
Definition: elxu_mbox.c:666
char * mbox_get_linkcfg_pt(elxu_device_t *device)
Get Link configuration.
Definition: elxu_mbox.c:2086
int mbox_get_active_profile_pt(elxu_device_t *device, char *result, int result_len)
Definition: elxu_mbox.c:2844
uintptr_t paddr
Definition: elxu_mbox.h:45
int create_vport(elxu_device_t *device_p, uint64_t wwnn, uint64_t wwpn, int targetFlag, int initiatorFlag)
Definition: elxu_mbox.c:2319
int mbox_fw_reset_pt(elxu_device_t *device, int dd)
Definition: elxu_mbox.c:2625
int mbox_diag_loopback_tests(elxu_device_t *device, int loopback_type, int retry_count)
Issue set link diag loopback mailbox command.
Definition: elxu_mbox.c:543
void mbox_get_mac_pt(elxu_device_t *device, uint8_t *mac_addr)
Definition: elxu_mbox.c:950
int mbox_write_flashrom(elxu_device_t *device, uint32_t opcode, uint32_t optype, uint32_t offset, void *inbuf, uint32_t inbufLength)
Issue write flashrom mailbox command.
Definition: elxu_mbox.c:1421
void * vaddr
Definition: elxu_mbox.h:44
void elx_pt_dma_free(memref_t *memref)
Free a DMA allocation through elx_pt.
Definition: elxu_mbox.c:2602
size_t size
Definition: elxu_mbox.h:46
int mbox_get_profile_list_pt(elxu_device_t *device, char *result, int result_len)
Definition: elxu_mbox.c:2771
int mbox_get_connection_info(elxu_device_t *device, uint32_t connectionHandle)
Get connection info.
Definition: elxu_mbox.c:1776
int mbox_get_serialnum_pt(elxu_device_t *device, char *serial_num, int serial_num_size)
Definition: elxu_mbox.c:1053