Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ecd_api.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(__ECD_API_H__)
34 #define __ECD_API_H__
35 
36 typedef enum {
37  ECD_FW_STATE_RUNNING, /* FW operational */
38  ECD_FW_STATE_UE, /* FW in a UE state */
39  ECD_FW_STATE_FAILED, /* FW not in a UA state but not responding */
41 
42 #define ECD_MIN_BUFFER_SIZE (32*1024*1024)
43 
44 /*
45  * This structure is used to pass informational parameters to the
46  * ELX coreDump library. This is information is saved in the
47  * coreDump image.
48  */
49 
50 typedef struct {
51  /* Information required for creating file header */
52  uint32_t instance; /* device instance */
53  uint32_t os_major; /* OS major version */
54  uint32_t os_minor; /* OS minor version */
55  char os_name[128]; /* OS name */
56  char system_name[128]; /* System name */
57  uint32_t ioctl_low_version; /* IOCTL low version */
58  uint32_t ioctl_high_version;/* IOCTL high version */
59  uint32_t sli_intf; /* SLI_INTF register value */
60  uint32_t asic_id; /* ASIC_ID register value */
62 
63 /**
64  * @brief Fetch coreDump data
65  *
66  * This function is invoked by a user application to retrieve coreDump date.
67  *
68  * @param dumpCtx The user supplied context pointer that is passed to the user supplied helper functions
69  * @param fwState The state of firmware
70  * @param params Informational parameters used to populate the coreDump image
71  * @param dumpBuffer coreDump data buffer populated by ecd_GetCoreDumpData()
72  * @param dumpBufferLength Length in bytes of the dumpBuffer (must be at least ECD_MIN_BUFFER_SIZE)
73  * @param argc Command line control parameter count
74  * @param argv Command line control parameters
75  *
76  * argc/argv implement command line style arguments that control the library. Currently the following
77  * commands are supported:
78  *
79  * "dead" Retrieve using a dead dump
80  * "live" Retrieve using a live dump
81  * "testtemplate" Retrieve using the test template
82  * "be3template" Retrieve using the BE3 template (default)
83  *
84  * @return This function returns the size in bytes of the coreDump image data placed in dumpBuffer,
85  * or a negative error code.
86  *
87  */
88 
89 extern int ecd_GetCoreDumpData(void *dumpCtx, ecd_fwState_t fwState, ecd_get_params_t *params,
90  void *dumpBuffer, int dumpBufferSize, int argc, char *argv[]);
91 
92 /* Error codes */
93 #define ECD_SUCCESS 0
94 #define ECD_ERR_INVALID_ARGUMENT -1
95 #define ECD_ERR_BUFFER_OVERRUN -2
96 #define ECD_ERR_ALLOCATION -3
97 
98 /*
99  * helper functions; these are functions that must be written by the customer
100  * application to provide logging, and access to PCI config and BAR memory.
101  */
102 
103 extern void os_cfg_read8 (void *ctx, uint32_t offset, uint32_t *pdata);
104 extern void os_cfg_read16(void *ctx, uint32_t offset, uint32_t *pdata);
105 extern void os_cfg_read32(void *ctx, uint32_t offset, uint32_t *pdata);
106 extern void os_cfg_write8 (void *ctx, uint32_t offset, uint32_t data);
107 extern void os_cfg_write16(void *ctx, uint32_t offset, uint32_t data);
108 extern void os_cfg_write32(void *ctx, uint32_t offset, uint32_t data);
109 extern void os_bar_read8 (void *ctx, uint32_t bar, uint32_t offset, uint32_t *pdata);
110 extern void os_bar_read16(void *ctx, uint32_t bar, uint32_t offset, uint32_t *pdata);
111 extern void os_bar_read32(void *ctx, uint32_t bar, uint32_t offset, uint32_t *pdata);
112 extern void os_bar_write8 (void *ctx, uint32_t bar, uint32_t offset, uint32_t data);
113 extern void os_bar_write16(void *ctx, uint32_t bar, uint32_t offset, uint32_t data);
114 extern void os_bar_write32(void *ctx, uint32_t bar, uint32_t offset, uint32_t data);
115 extern void *os_malloc(void *ctx, uint32_t size);
116 extern void os_free(void *ctx, void *ptr);
117 
118 extern void ecd_log(char *fmt, ...);
119 
120 #endif // __ECD_API_H__
void os_bar_write8(void *ctx, uint32_t bar, uint32_t offset, uint32_t data)
Definition: elxu_dump.c:1271
void os_cfg_read16(void *ctx, uint32_t offset, uint32_t *pdata)
Definition: elxu_dump.c:1019
void os_bar_read16(void *ctx, uint32_t bar, uint32_t offset, uint32_t *pdata)
Definition: elxu_dump.c:1203
void os_bar_read8(void *ctx, uint32_t bar, uint32_t offset, uint32_t *pdata)
Definition: elxu_dump.c:1169
void os_cfg_write16(void *ctx, uint32_t offset, uint32_t data)
Definition: elxu_dump.c:1112
void os_bar_read32(void *ctx, uint32_t bar, uint32_t offset, uint32_t *pdata)
Definition: elxu_dump.c:1237
uint32_t ioctl_high_version
Definition: ecd_api.h:58
void os_cfg_read32(void *ctx, uint32_t offset, uint32_t *pdata)
Definition: elxu_dump.c:1050
ecd_fwState_t
Definition: ecd_api.h:36
uint32_t ioctl_low_version
Definition: ecd_api.h:57
void os_bar_write16(void *ctx, uint32_t bar, uint32_t offset, uint32_t data)
Definition: elxu_dump.c:1302
void os_cfg_write32(void *ctx, uint32_t offset, uint32_t data)
Definition: elxu_dump.c:1140
uint32_t sli_intf
Definition: ecd_api.h:59
void os_free(void *ctx, void *ptr)
Definition: elxu_dump.c:1369
uint32_t os_minor
Definition: ecd_api.h:54
void os_bar_write32(void *ctx, uint32_t bar, uint32_t offset, uint32_t data)
Definition: elxu_dump.c:1333
uint32_t instance
Definition: ecd_api.h:52
uint32_t asic_id
Definition: ecd_api.h:60
int ecd_GetCoreDumpData(void *dumpCtx, ecd_fwState_t fwState, ecd_get_params_t *params, void *dumpBuffer, int dumpBufferSize, int argc, char *argv[])
Fetch coreDump data.
void ecd_log(char *fmt,...)
Definition: elxu_dump.c:969
void * os_malloc(void *ctx, uint32_t size)
Definition: elxu_dump.c:1365
void os_cfg_read8(void *ctx, uint32_t offset, uint32_t *pdata)
Definition: elxu_dump.c:989
uint32_t os_major
Definition: ecd_api.h:53
void os_cfg_write8(void *ctx, uint32_t offset, uint32_t data)
Definition: elxu_dump.c:1083