1
+ /* IBM_PROLOG_BEGIN_TAG */
2
+ /* This is an automatically generated prolog. */
3
+ /* */
4
+ /* $Source: src/include/kernel/bltohbdatamgr.H $ */
5
+ /* */
6
+ /* OpenPOWER HostBoot Project */
7
+ /* */
8
+ /* Contributors Listed Below - COPYRIGHT 2017 */
9
+ /* [+] International Business Machines Corp. */
10
+ /* */
11
+ /* */
12
+ /* Licensed under the Apache License, Version 2.0 (the "License"); */
13
+ /* you may not use this file except in compliance with the License. */
14
+ /* You may obtain a copy of the License at */
15
+ /* */
16
+ /* http://www.apache.org/licenses/LICENSE-2.0 */
17
+ /* */
18
+ /* Unless required by applicable law or agreed to in writing, software */
19
+ /* distributed under the License is distributed on an "AS IS" BASIS, */
20
+ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21
+ /* implied. See the License for the specific language governing */
22
+ /* permissions and limitations under the License. */
23
+ /* */
24
+ /* IBM_PROLOG_END_TAG */
25
+
26
+ #ifndef __BLTOHBDATAMANAGER_H
27
+ #define __BLTOHBDATAMANAGER_H
28
+
29
+ #include < stdint.h>
30
+ #include < sys/mm.h>
31
+ #include < bootloader/bootloaderif.H>
32
+
33
+ // BlToHbDataManager class
34
+ class BlToHbDataManager
35
+ {
36
+ private:
37
+
38
+ /* *
39
+ * @brief Performs a printk along with a kassert to be more verbose if
40
+ * Data is not valid.
41
+ *
42
+ * @return N/A
43
+ */
44
+ void validAssert () const ;
45
+
46
+ /*
47
+ * @brief Prints, via printkd, important parts of the structure
48
+ *
49
+ * @return N/A
50
+ */
51
+ void print () const ;
52
+
53
+ // Data received from the bootloader
54
+ static Bootloader::BlToHbData iv_data;
55
+ // Indicates if the class has been instantiated or not
56
+ static bool iv_instantiated;
57
+ // Indicates if the class has been initialized or not
58
+ static bool iv_initialized;
59
+ // Indicates if data received from the bootloader is valid
60
+ static bool iv_dataValid;
61
+ // Size of data that needs to be preserved and pinned.
62
+ static size_t iv_preservedSize;
63
+ // Converts secureROM pointer to a 64-bit address
64
+ const uint64_t getSecureRomAddr () const ;
65
+ // Converts hw keys hash pointer to a 64-bit address
66
+ const uint64_t getHwKeysHashAddr () const ;
67
+ // Converts HBB header pointer to a 64-bit address
68
+ const uint64_t getHbbHeaderAddr () const ;
69
+
70
+ public:
71
+
72
+ /* *
73
+ * @brief Default Constructor
74
+ */
75
+ BlToHbDataManager ();
76
+
77
+ /* *
78
+ * @brief Initializes all internal data. At the time this class is
79
+ * instantiated the data is not known, so created this function
80
+ * as a type of "pseudo" constructor for the class.
81
+ *
82
+ * @param[in] i_data Bootloader to Hostboot Data to initialize the
83
+ * internal data with.
84
+ *
85
+ * @return N/A
86
+ */
87
+ void initValid (const Bootloader::BlToHbData& i_data);
88
+
89
+ /* *
90
+ * @brief Sets internal members to indicate that the class has been
91
+ * initialized, but is invalid
92
+ *
93
+ * @return N/A
94
+ */
95
+ void initInvalid ();
96
+
97
+ /*
98
+ * @brief Returns internal branchtable offset
99
+ *
100
+ * @return uint64_t branchtable offset
101
+ */
102
+ const uint64_t getBranchtableOffset () const ;
103
+
104
+ /*
105
+ * @brief Returns internal pointer to secureROM
106
+ *
107
+ * @return void* pointer to secureROM
108
+ */
109
+ const void * getSecureRom () const ;
110
+
111
+ /*
112
+ * @brief Returns internal secureRomSize
113
+ *
114
+ * @return size_t secureRomSize
115
+ */
116
+ const size_t getSecureRomSize () const ;
117
+
118
+ /*
119
+ * @brief Returns internal pointer to hwKeysHash
120
+ *
121
+ * @return void* pointer to hwKeysHash
122
+ */
123
+ const void * getHwKeysHash () const ;
124
+
125
+ /*
126
+ * @brief Returns internal hwKeysHashSize
127
+ *
128
+ * @return size_t hwKeysHashSize
129
+ */
130
+ const size_t getHwKeysHashSize () const ;
131
+
132
+ /*
133
+ * @brief Returns internal pointer to hbbHeader
134
+ *
135
+ * @return void* pointer to hbbHeader
136
+ */
137
+ const void * getHbbHeader () const ;
138
+
139
+ /*
140
+ * @brief Returns internal hbbHeaderSize
141
+ *
142
+ * @return size_t hbbHeaderSize
143
+ */
144
+ const size_t getHbbHeaderSize () const ;
145
+
146
+ /*
147
+ * @brief Returns internal preserved size
148
+ *
149
+ * @return size_t preserved size
150
+ */
151
+ const size_t getPreservedSize () const ;
152
+
153
+ /*
154
+ * @brief Indicates if internal data is valid or not
155
+ *
156
+ * @return bool true if valid; false otherwise
157
+ */
158
+ const bool isValid () const ;
159
+ };
160
+
161
+ // Extern global instance of the class
162
+ extern BlToHbDataManager g_BlToHbDataManager;
163
+
164
+ #endif
0 commit comments