coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dramc_param.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <string.h>
4 #include "soc/dramc_param.h"
5 
7 {
8  return (struct dramc_param *)blob;
9 }
10 
11 int validate_dramc_param(const void *blob)
12 {
13  const struct dramc_param *param = blob;
14  const struct dramc_param_header *hdr = &param->header;
15 
16  if (hdr->magic != DRAMC_PARAM_HEADER_MAGIC)
18 
21 
22  if (hdr->size != sizeof(*param))
24 
25  return DRAMC_SUCCESS;
26 }
27 
28 int is_valid_dramc_param(const void *blob)
29 {
30  return validate_dramc_param(blob) == DRAMC_SUCCESS;
31 }
32 
34 {
35  struct dramc_param *param = blob;
36  struct dramc_param_header *hdr = &param->header;
37 
38  memset(blob, 0, sizeof(*param));
40  hdr->size = sizeof(*param);
42  hdr->config = config;
43  return 0;
44 }
void * memset(void *dstpp, int c, size_t len)
Definition: memset.c:12
int initialize_dramc_param(void *blob)
Definition: dramc_param.c:27
struct dramc_param * get_dramc_param_from_blob(void *blob)
Definition: dramc_param.c:9
@ DRAMC_ERR_INVALID_SIZE
@ DRAMC_ERR_INVALID_VERSION
@ DRAMC_SUCCESS
enum board_config config
Definition: memory.c:448
int is_valid_dramc_param(const void *blob)
Definition: dramc_param.c:28
int validate_dramc_param(const void *blob)
Definition: dramc_param.c:11
@ DRAMC_PARAM_HEADER_VERSION
Definition: dramc_param.h:13
@ DRAMC_PARAM_HEADER_MAGIC
Definition: dramc_param.h:12
@ DRAMC_ERR_INVALID_MAGIC
Definition: dramc_param.h:18
uint16_t u16
Definition: stdint.h:48
struct dramc_param_header header
Definition: dramc_param.h:61