prealloc.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #ifndef _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
  21. #define _ARCH_MIPS_POWERTV_ASIC_PREALLOC_H
  22. #define KIBIBYTE(n) ((n) * 1024) /* Number of kibibytes */
  23. #define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */
  24. /* "struct resource" array element definition */
  25. #define PREALLOC(NAME, START, END, FLAGS) { \
  26. .name = (NAME), \
  27. .start = (START), \
  28. .end = (END), \
  29. .flags = (FLAGS) \
  30. },
  31. /* Individual resources in the preallocated resource arrays are defined using
  32. * macros. These macros are conditionally defined based on their
  33. * corresponding kernel configuration flag:
  34. * - CONFIG_PREALLOC_NORMAL: preallocate resources for a normal settop box
  35. * - CONFIG_PREALLOC_TFTP: preallocate the TFTP download resource
  36. * - CONFIG_PREALLOC_DOCSIS: preallocate the DOCSIS resource
  37. * - CONFIG_PREALLOC_PMEM: reserve space for persistent memory
  38. */
  39. #ifdef CONFIG_PREALLOC_NORMAL
  40. #define PREALLOC_NORMAL(name, start, end, flags) \
  41. PREALLOC(name, start, end, flags)
  42. #else
  43. #define PREALLOC_NORMAL(name, start, end, flags)
  44. #endif
  45. #ifdef CONFIG_PREALLOC_TFTP
  46. #define PREALLOC_TFTP(name, start, end, flags) \
  47. PREALLOC(name, start, end, flags)
  48. #else
  49. #define PREALLOC_TFTP(name, start, end, flags)
  50. #endif
  51. #ifdef CONFIG_PREALLOC_DOCSIS
  52. #define PREALLOC_DOCSIS(name, start, end, flags) \
  53. PREALLOC(name, start, end, flags)
  54. #else
  55. #define PREALLOC_DOCSIS(name, start, end, flags)
  56. #endif
  57. #ifdef CONFIG_PREALLOC_PMEM
  58. #define PREALLOC_PMEM(name, start, end, flags) \
  59. PREALLOC(name, start, end, flags)
  60. #else
  61. #define PREALLOC_PMEM(name, start, end, flags)
  62. #endif
  63. #endif