summaryrefslogtreecommitdiffstats
path: root/sbe/image/base_loader.c
blob: b5ea02355da25dd835dab2d098c6b328d27783a9 (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
#include "sbeXipUtils.H"

// Load section to destination address
int32_t loadSection( P9XipSection * i_section, uint64_t *i_destAddr )
{
    uint32_t idx = 0;
    uint64_t *seepromAddr = (uint64_t *)( g_headerAddr + i_section->iv_offset);
    uint32_t sectionSize  = i_section->iv_size;
    for( idx = 0; idx < sectionSize; idx += 8 )
    {
        *i_destAddr = *seepromAddr;
        i_destAddr++; seepromAddr++;

    }
    return 0;
}

// Function to load base image into PIBMEM
int32_t base_loader()
{
    int32_t rc  = 0;
    P9XipHeader *hdr = getXipHdr();

    uint64_t *pibMemAddr  = (uint64_t *)g_pibMemAddr;
    loadSection(&(hdr->iv_section[P9_XIP_SECTION_SBE_BASE]), pibMemAddr);
    // Set the IVPR register. This is required so that interrupt vector table
    // points to pk interfaces.
    uint64_t data = (uint64_t)(SBE_BASE_ORIGIN) << 32;
    PPE_STVD(g_ivprLoc, data);
    // Jump to pk boot function
    uint32_t addr = hdr->iv_kernelAddr;
    JUMP_TO_ADDR(addr);

    return rc;
}
OpenPOWER on IntegriCloud