xref: /openbmc/u-boot/drivers/smem/sandbox_smem.c (revision dae73c4c)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (c) 2018 Ramon Fried <ramon.fried@gmail.com>
4  */
5 
6 #include <common.h>
7 #include <dm.h>
8 #include <errno.h>
9 #include <smem.h>
10 #include <asm/test.h>
11 
12 static int sandbox_smem_alloc(unsigned int host,
13 		unsigned int item, size_t size)
14 {
15 	return 0;
16 }
17 
18 static void *sandbox_smem_get(unsigned int host,
19 		unsigned int item, size_t *size)
20 {
21 	return NULL;
22 }
23 
24 static int sandbox_smem_get_free_space(unsigned int host)
25 {
26 	return 0;
27 }
28 
29 static const struct smem_ops sandbox_smem_ops = {
30 	.alloc	= sandbox_smem_alloc,
31 	.get	= sandbox_smem_get,
32 	.get_free_space	= sandbox_smem_get_free_space,
33 };
34 
35 static const struct udevice_id sandbox_smem_ids[] = {
36 	{ .compatible = "sandbox,smem" },
37 	{ }
38 };
39 
40 U_BOOT_DRIVER(smem_sandbox) = {
41 	.name		= "smem_sandbox",
42 	.id		= UCLASS_SMEM,
43 	.of_match	= sandbox_smem_ids,
44 	.ops		= &sandbox_smem_ops,
45 };
46