Huayang Duan | 7452a2f | 2020-06-22 17:44:01 +0800 | [diff] [blame] | 1 | /* 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 | |
| 9 | struct dramc_param *get_dramc_param_from_blob(void *blob) |
| 10 | { |
| 11 | return (struct dramc_param *)blob; |
| 12 | } |
| 13 | |
| 14 | void 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 Chen | e8c681c | 2021-03-03 17:58:07 +0800 | [diff] [blame] | 21 | header->version, DRAMC_PARAM_HEADER_VERSION); |
Huayang Duan | 7452a2f | 2020-06-22 17:44:01 +0800 | [diff] [blame] | 22 | print("header.size = %#x (expected: %#lx)\n", |
Xi Chen | e8c681c | 2021-03-03 17:58:07 +0800 | [diff] [blame] | 23 | header->size, sizeof(*dparam)); |
Huayang Duan | 7452a2f | 2020-06-22 17:44:01 +0800 | [diff] [blame] | 24 | print("header.flags = %#x\n", header->flags); |
Huayang Duan | 7452a2f | 2020-06-22 17:44:01 +0800 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | int initialize_dramc_param(void *blob) |
| 28 | { |
| 29 | struct dramc_param *param = blob; |
| 30 | struct dramc_param_header *hdr = ¶m->header; |
| 31 | |
| 32 | memset(hdr, 0, sizeof(*hdr)); |
| 33 | hdr->version = DRAMC_PARAM_HEADER_VERSION; |
| 34 | hdr->size = sizeof(*param); |
| 35 | return 0; |
| 36 | } |