Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_gendump.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(__OCS_GENDUMP_H__)
34 #define __OCS_GENDUMP_H__
35 
36 extern int ocs_gen_dump(ocs_t *ocs);
37 extern void ocs_fw_dump_init(ocs_t *ocs, int32_t fw_dump_type);
38 extern void ocs_fw_dump_state_set(ocs_t *ocs, uint32_t state);
39 extern int32_t ocs_fw_dump_state_check(ocs_t *ocs, uint32_t state);
40 extern int32_t ocs_adapter_reset(ocs_t *ocs);
41 extern int32_t ocs_port_reset(ocs_t *ocs);
42 extern int32_t ocs_fw_reset(ocs_t *ocs);
43 extern int32_t ocs_trigger_dump(ocs_t *ocs, uint8_t dump_level);
44 
45 #define OCS_MAX_HBA_PORTS 4
46 
47 /* FW dump status */
48 #define OCS_FW_DUMP_STATUS_SUCCESS 0
49 #define OCS_FW_DUMP_STATUS_IN_PROGRESS 1
50 #define OCS_FW_DUMP_STATUS_SKIP 2
51 #define OCS_FW_DUMP_STATUS_FAILED -1
52 
53 /* FW dump level flags */
54 #define FW_DUMP_LEVEL_NONE 0
55 #define FW_CHIP_LEVEL_DUMP 1
56 #define FW_FUNC_DESC_DUMP 2
57 
58 /* FW dump state flags; should maintain 1:1 mapping with FW dump level flags */
59 #define FW_DUMP_STATE_NONE 0
60 #define FW_CHIP_DUMP_STATE_VALID 1
61 #define FW_FUNC_DUMP_STATE_VALID 2
62 
63 /* FW dump type flags */
64 #define FW_DUMP_TYPE_DUMPTOHOST 1
65 #define FW_DUMP_TYPE_FLASH 2
66 
67 /* FW dump ready status flags */
68 #define FW_DUMP_READY_STATUS_NOT_READY 0
69 #define FW_DUMP_READY_STATUS_DD_PRESENT 1
70 #define FW_DUMP_READY_STATUS_FDB_PRESENT 2
71 #define FW_DUMP_READY_STATUS_SKIP_DUMP 3
72 #define FW_DUMP_READY_STATUS_FAILED -1
73 
74 struct ocs_fw_dump {
75  uint8_t *saved_buff;
76  uint32_t size;
77  int32_t type;
78 
81  ocs_dma_t *chip_dump_buffers;
82  ocs_dma_t *func_dump_buffers;
83 
84  /* lock is used around state */
85  ocs_lock_t lock;
86  uint32_t state;
87 };
88 
89 #endif // __OCS_GENDUMP_H__
ocs_lock_t lock
Definition: ocs_gendump.h:85
ocs_dma_t * chip_dump_buffers
Definition: ocs_gendump.h:81
uint32_t state
Definition: ocs_gendump.h:86
int32_t ocs_trigger_dump(ocs_t *ocs, uint8_t dump_level)
Definition: ocs_gendump.c:203
uint32_t num_func_dump_buffers
Definition: ocs_gendump.h:80
int32_t ocs_fw_dump_state_check(ocs_t *ocs, uint32_t state)
Check the fw dump state.
Definition: ocs_gendump.c:277
void ocs_fw_dump_init(ocs_t *ocs, int32_t fw_dump_type)
Initialize fw dump context.
Definition: ocs_recovery.c:762
int32_t ocs_adapter_reset(ocs_t *ocs)
Definition: ocs_gendump.c:63
uint8_t * saved_buff
Definition: ocs_gendump.h:75
int32_t type
Definition: ocs_gendump.h:77
int32_t ocs_fw_reset(ocs_t *ocs)
Definition: ocs_gendump.c:86
uint32_t size
Definition: ocs_gendump.h:76
void ocs_fw_dump_state_set(ocs_t *ocs, uint32_t state)
Set fW dump state.
Definition: ocs_recovery.c:231
ocs_dma_t * func_dump_buffers
Definition: ocs_gendump.h:82
uint32_t num_chip_dump_buffers
Definition: ocs_gendump.h:79
int32_t ocs_port_reset(ocs_t *ocs)
Definition: ocs_gendump.c:39
int ocs_gen_dump(ocs_t *ocs)
Definition: ocs_gendump.c:246