xref: /openbmc/u-boot/include/ram.h (revision fdbb740d)
1 /*
2  * Copyright (c) 2015 Google, Inc
3  * Written by Simon Glass <sjg@chromium.org>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 
8 #ifndef __RAM_H
9 #define __RAM_H
10 
11 struct ram_info {
12 	phys_addr_t base;
13 	size_t size;
14 };
15 
16 struct ram_ops {
17 	/**
18 	 * get_info() - Get basic memory info
19 	 *
20 	 * @dev:	Device to check (UCLASS_RAM)
21 	 * @info:	Place to put info
22 	 * @return 0 if OK, -ve on error
23 	 */
24 	int (*get_info)(struct udevice *dev, struct ram_info *info);
25 };
26 
27 #define ram_get_ops(dev)        ((struct ram_ops *)(dev)->driver->ops)
28 
29 /**
30  * ram_get_info() - Get information about a RAM device
31  *
32  * @dev:	Device to check (UCLASS_RAM)
33  * @info:	Returns RAM info
34  * @return 0 if OK, -ve on error
35  */
36 int ram_get_info(struct udevice *dev, struct ram_info *info);
37 
38 #endif
39