blob: 6be414cb39ae76e348694de4f83cf7ee7d72220d (
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
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2016 Marvell, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <arch/io.h>
#include <console/console.h>
#include <soc/bdb.h>
void set_bdb_pointers(u8 *start_addr, struct bdb_pointer *bdb_in)
{
bdb_in->bdb_h
= (struct bdb_header *)start_addr;
bdb_in->bdb_k
= (struct bdb_key *)(start_addr
+ (bdb_in->bdb_h->struct_size));
bdb_in->bdb_oem_0
= (u8 *)((u32)(bdb_in->bdb_k)
+ (bdb_in->bdb_k->struct_size));
bdb_in->sub_k
= (struct bdb_key *)((u32)(bdb_in->bdb_oem_0)
+ (bdb_in->bdb_h->oem_area_0_size));
bdb_in->bdb_h_s
= (struct bdb_sig *)((u32)(bdb_in->bdb_oem_0)
+ (bdb_in->bdb_h->signed_size));
bdb_in->bdb_d
= (struct bdb_data *)((u32)(bdb_in->bdb_h_s)
+ (bdb_in->bdb_h_s->struct_size));
bdb_in->oem_1
= (u8 *)((u32)(bdb_in->bdb_d)
+ (bdb_in->bdb_d->struct_size));
bdb_in->bdb_hash
= (struct bdb_hash *)((u32)(bdb_in->oem_1)
+ (bdb_in->bdb_d->oem_area_1_size));
bdb_in->bdb_s
= (struct bdb_sig *)((u32)(bdb_in->bdb_d)
+ (bdb_in->bdb_d->signed_size));
}
struct bdb_hash *find_bdb_image(struct bdb_pointer *bdb_info, u32 image_type)
{
int i;
if (!bdb_info) {
printk(BIOS_DEBUG, "can't find BDB\n");
return NULL;
}
for (i = 0; i < bdb_info->bdb_d->num_hashes; i++) {
if (bdb_info->bdb_hash[i].type == image_type)
return &bdb_info->bdb_hash[i];
}
printk(BIOS_DEBUG, "can't find image with type %d in the BDB\n",
image_type);
return NULL;
}
|