1 /*
2  * Definitions for memory preallocations
3  *
4  * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
22 #define _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
23 
24 #define KIBIBYTE(n) ((n) * 1024)    /* Number of kibibytes */
25 #define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */
26 
27 /* "struct resource" array element definition */
28 #define PREALLOC(NAME, START, END, FLAGS) {	\
29 		.name = (NAME),			\
30 		.start = (START),		\
31 		.end = (END),			\
32 		.flags = (FLAGS)		\
33 	},
34 
35 /* Individual resources in the preallocated resource arrays are defined using
36  *  macros.  These macros are conditionally defined based on their
37  *  corresponding kernel configuration flag:
38  *    - CONFIG_PREALLOC_NORMAL: preallocate resources for a normal settop box
39  *    - CONFIG_PREALLOC_TFTP: preallocate the TFTP download resource
40  *    - CONFIG_PREALLOC_DOCSIS: preallocate the DOCSIS resource
41  *    - CONFIG_PREALLOC_PMEM: reserve space for persistent memory
42  */
43 #ifdef CONFIG_PREALLOC_NORMAL
44 #define PREALLOC_NORMAL(name, start, end, flags) \
45    PREALLOC(name, start, end, flags)
46 #else
47 #define PREALLOC_NORMAL(name, start, end, flags)
48 #endif
49 
50 #ifdef CONFIG_PREALLOC_TFTP
51 #define PREALLOC_TFTP(name, start, end, flags) \
52    PREALLOC(name, start, end, flags)
53 #else
54 #define PREALLOC_TFTP(name, start, end, flags)
55 #endif
56 
57 #ifdef CONFIG_PREALLOC_DOCSIS
58 #define PREALLOC_DOCSIS(name, start, end, flags) \
59    PREALLOC(name, start, end, flags)
60 #else
61 #define PREALLOC_DOCSIS(name, start, end, flags)
62 #endif
63 
64 #ifdef CONFIG_PREALLOC_PMEM
65 #define PREALLOC_PMEM(name, start, end, flags) \
66    PREALLOC(name, start, end, flags)
67 #else
68 #define PREALLOC_PMEM(name, start, end, flags)
69 #endif
70 #endif
71