Skip to content

Commit 6f2f153

Browse files
Stephen Cprekdcrowell77
authored andcommitted
Relocate ROM code after HBBL has been verified
Create Bootloader to hostboot data manager to control how the shared data is accessed and modified. Change-Id: I54cb543ed289810ab6afb07d333313f5662bce0e RTC: 166848 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35617 Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent 41cfdf7 commit 6f2f153

File tree

13 files changed

+695
-400
lines changed

13 files changed

+695
-400
lines changed

src/HBconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ config P9_PAGE_TABLE
2929
help
3030
Use the P9 version of the page table setup
3131

32-
config ROM_CODE_PRESENT
33-
default n
34-
help
35-
Indicates that ROM code is available to call
36-
3732
config INCLUDE_XML_OPPOWERVM
3833
default y
3934
help

src/include/bootloader/bootloaderif.H

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct BlToHbData
6969
branchtableOffset(0), secureRom(nullptr),
7070
secureRomSize(0), hwKeysHash(nullptr),
7171
hwKeysHashSize(0), hbbHeader(nullptr),
72-
hbbHeaderSize(0), totalSize(0) {}
72+
hbbHeaderSize(0) {}
7373

7474
// Simple way to tell if data is valid
7575
uint64_t eyeCatch;
@@ -89,8 +89,6 @@ struct BlToHbData
8989
const void* hbbHeader;
9090
// size of Hostboot base header
9191
size_t hbbHeaderSize;
92-
// Total size of data preserved by the Kernel
93-
size_t totalSize;
9492
} __attribute__((packed));
9593

9694
/**

src/include/kernel/bltohbdatamgr.H

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
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

src/include/kernel/vmmmgr.H

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2010,2016 */
8+
/* Contributors Listed Below - COPYRIGHT 2010,2017 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -60,6 +60,8 @@ class VmmManager
6060
FIRST_RESERVED_PAGE = INITIAL_PT_OFFSET,
6161
END_RESERVED_PAGE = INITIAL_PT_OFFSET + PTSIZE + MBOX_DMA_SIZE,
6262

63+
BLTOHB_DATA_START = END_RESERVED_PAGE,
64+
6365
// Tells processor to ignore HRMOR
6466
FORCE_PHYS_ADDR = 0x8000000000000000,
6567
};

src/include/usr/secureboot/service.H

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ namespace SECUREBOOT
186186
* @param[in] i_size Size of blob in bytes
187187
* @param[out] o_hash SHA512 hash
188188
*
189-
* @return errlHndl_t NULL on success
189+
* @return N/A
190190
*/
191-
errlHndl_t hashBlob(const void * i_blob, size_t i_size, SHA512_t o_buf);
191+
void hashBlob(const void * i_blob, size_t i_size, SHA512_t o_buf);
192192

193193
/**
194194
* @brief Retrieve the internal hardware keys' hash used to validate
@@ -208,9 +208,9 @@ namespace SECUREBOOT
208208
* of the blob to concatenate
209209
* @param[out] o_buf SHA512 hash
210210
*
211-
* @return errlHndl_t NULL on success
211+
* @return N/A
212212
*/
213-
errlHndl_t hashConcatBlobs(const blobPair_t &i_blobs, SHA512_t o_buf);
213+
void hashConcatBlobs(const blobPair_t &i_blobs, SHA512_t o_buf);
214214

215215
/**
216216
* @brief Common secureboot handler for secureboot failures.

0 commit comments

Comments
 (0)