summaryrefslogtreecommitdiffstats
path: root/src/include/usr/dump/dumpif.H
blob: 352229ef31fb3d164de145055a06b2e91d3be2ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/dump/dumpif.H $                               */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2014              */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __DUMPIF_H
#define __DUMPIF_H

/** @file  dumpif.H
 *  @brief Provides the external interfaces for dump.
 *            - copy dump data from src to destination
 *            - Send Mbox Msg for dump status
 */

namespace DUMP
{


    /**
     * @brief DUMP Message Types 
     */

    enum DUMP_MSG_TYPE
    {
        DUMP_MSG_START_MSG_TYPE = 0x000000B1,
        DUMP_MSG_END_MSG_TYPE = 0x000000B2,
        DUMP_MSG_ERROR_MSG_TYPE = 0x000000B3,

    };

    // The following are #defines  needed for Dump Testing.. These are the
    // default memory locations for MDST, MDDT, MDRT when running withoutPHYPab
    // The data range is defined in vmmconst.h so this test space is saved.

    /* Chunk of physical memory used for Dump Source Table */
    #define DUMP_TEST_SRC_MEM_ADDR  DUMP_TEST_MEMORY_ADDR
    #define DUMP_TEST_SRC_MEM_SIZE  MEGABYTE

    /* Chunk of physical memory used for Dump Destination Table */
    #define DUMP_TEST_DST_MEM_ADDR (DUMP_TEST_SRC_MEM_ADDR +  \
    DUMP_TEST_SRC_MEM_SIZE)


    #define DUMP_TEST_DST_MEM_SIZE  MEGABYTE

    /* Chunk of physical memory used for Dump Results Table */
    #define DUMP_TEST_RESULTS_MEM_ADDR (DUMP_TEST_DST_MEM_ADDR + \
    DUMP_TEST_DST_MEM_SIZE)


    #define DUMP_TEST_RESULTS_MEM_SIZE   MEGABYTE

    // Data location where the src, destination tables point to. (The actual
    // data)
    #define DUMP_TEST_SRC_DATA_AREA (DUMP_TEST_RESULTS_MEM_ADDR +   \
    DUMP_TEST_RESULTS_MEM_SIZE)


    #define DUMP_TEST_DST_DATA_AREA (DUMP_TEST_SRC_DATA_AREA + \
    DUMP_TEST_DATA_SIZE)

    #define DUMP_TEST_DATA_SIZE           MEGABYTE

    // default enums to point out the start and end of the DUMP Tables in memory
    #define DUMP_TEST_TABLE_START DUMP_TEST_SRC_MEM_ADDR
    #define DUMP_TEST_TABLE_SIZE (DUMP_TEST_SRC_MEM_SIZE +   \
    DUMP_TEST_DST_MEM_SIZE + DUMP_TEST_RESULTS_MEM_SIZE)

       
    #define DUMP_TEST_TABLE_END (DUMP_TEST_TABLE_START + DUMP_TEST_TABLE_SIZE)

    // In addition to the dump table locations we have scratch data area that is
    // used to put the SRC data that the MDST will point to.

    // This is the size of all the Data used for Dump testing
    #define DUMP_TEST_ALL_SIZE  (DUMP_TEST_TABLE_SIZE + (2*MEGABYTE))

    // This is the ending address of test Data area
    #define DUMP_TEST_ALL_END  (DUMP_TEST_TABLE_START + DUMP_TEST_ALL_SIZE)


    //These structures are defined in the HDAT spec
    //The MDST and MDDT have this format.
    struct dumpEntry
    {
        uint64_t dataAddr;
        uint32_t reserved;
        uint32_t dataSize;
    } PACKED;

    //The MDRT has this format.
    struct resultsEntry
    {
        uint64_t srcAddr;
        uint64_t destAddr;
        uint64_t dataSize;
        uint64_t reserved;
    } PACKED;


    /**
     * @brief This function is a wrapper function that calls
     *   getHostDataPtrs to get the MDDT, MDST, MDRT pointers
     *   and then passes those values to the copySrcToDest
     *   routine that performs the copy
     *
     * @param[in]   void
     *
     * @return  errlHndl_t
     */
     errlHndl_t doDumpCollect(void);

     /**
      * @brief This function copies the data and sizes retrieved from the
      * MDST(source table) to the addresses indicated by the MDDT(destination
      * table).   Each write is then logged in the MDRT (results table) with
      * source addr, destination addr and size
      *
      * @param[in]   srcTableEntry     Ptr to the first MDST entry
      * @param[in]   srcTableSize      Size of the entire MDST
      *
      * @param[in]   destTableAddr     Ptr to the first MDDT entry
      * @param[in]   destTableSize     Size of the entire MDDT
      *
      * @param[in]   resultsTableAddr  Ptr to the first MDRT entry
      * @param[in]   resultsTableSize  Size of the entire MDRT
      *
      * @return  errlHndl_t
      */
     errlHndl_t copySrcToDest(dumpEntry *srcTableEntry, uint64_t srcTableSize,
                              dumpEntry *destTableEntry, uint64_t destTableSize,
                              resultsEntry *resultsTableEntry,
                              uint64_t resultsTableSize);

    /**
     * @brief This function handles sending the mailbox message to the Fsp to
     *      notify of Dump Status.  Start, error or complete.  If Error or
     *      complete types are requested, the dump results table is passed
     *      to the FSP.
     *
     * @param[in] i_type - The type of DUMP msg being written.
     *
     * @return errlHndl_t - NULL if successful, otherwise a pointer to the error
     *      log.
     */
    errlHndl_t sendMboxMsg (DUMP_MSG_TYPE i_type);



} // end of namespace


#endif
OpenPOWER on IntegriCloud