blob: c596adb20805fab8d6aef5adbebda3817c58db7f [file] [log] [blame]
Huayang Duan7452a2f2020-06-22 17:44:01 +08001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <console/console.h>
4#include <string.h>
5#include <soc/dramc_param.h>
6
7#define print(_x_...) printk(BIOS_INFO, _x_)
8
9struct dramc_param *get_dramc_param_from_blob(void *blob)
10{
11 return (struct dramc_param *)blob;
12}
13
14void dump_param_header(const void *blob)
15{
16 const struct dramc_param *dparam = blob;
17 const struct dramc_param_header *header = &dparam->header;
18
19 print("header.status = %#x\n", header->status);
20 print("header.version = %#x (expected: %#x)\n",
Xi Chene8c681c2021-03-03 17:58:07 +080021 header->version, DRAMC_PARAM_HEADER_VERSION);
Huayang Duan7452a2f2020-06-22 17:44:01 +080022 print("header.size = %#x (expected: %#lx)\n",
Xi Chene8c681c2021-03-03 17:58:07 +080023 header->size, sizeof(*dparam));
Huayang Duan7452a2f2020-06-22 17:44:01 +080024 print("header.flags = %#x\n", header->flags);
Huayang Duan7452a2f2020-06-22 17:44:01 +080025}
26
27int initialize_dramc_param(void *blob)
28{
29 struct dramc_param *param = blob;
30 struct dramc_param_header *hdr = &param->header;
31
32 memset(hdr, 0, sizeof(*hdr));
33 hdr->version = DRAMC_PARAM_HEADER_VERSION;
34 hdr->size = sizeof(*param);
35 return 0;
36}