firmware-map.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * include/linux/firmware-map.h:
  3. * Copyright (C) 2008 SUSE LINUX Products GmbH
  4. * by Bernhard Walle <bwalle@suse.de>
  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 v2.0 as published by
  8. * the Free Software Foundation
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef _LINUX_FIRMWARE_MAP_H
  17. #define _LINUX_FIRMWARE_MAP_H
  18. #include <linux/list.h>
  19. #include <linux/kobject.h>
  20. /*
  21. * provide a dummy interface if CONFIG_FIRMWARE_MEMMAP is disabled
  22. */
  23. #ifdef CONFIG_FIRMWARE_MEMMAP
  24. /**
  25. * Adds a firmware mapping entry. This function uses kmalloc() for memory
  26. * allocation. Use firmware_map_add_early() if you want to use the bootmem
  27. * allocator.
  28. *
  29. * That function must be called before late_initcall.
  30. *
  31. * @start: Start of the memory range.
  32. * @end: End of the memory range (inclusive).
  33. * @type: Type of the memory range.
  34. *
  35. * Returns 0 on success, or -ENOMEM if no memory could be allocated.
  36. */
  37. int firmware_map_add(resource_size_t start, resource_size_t end,
  38. const char *type);
  39. /**
  40. * Adds a firmware mapping entry. This function uses the bootmem allocator
  41. * for memory allocation. Use firmware_map_add() if you want to use kmalloc().
  42. *
  43. * That function must be called before late_initcall.
  44. *
  45. * @start: Start of the memory range.
  46. * @end: End of the memory range (inclusive).
  47. * @type: Type of the memory range.
  48. *
  49. * Returns 0 on success, or -ENOMEM if no memory could be allocated.
  50. */
  51. int firmware_map_add_early(resource_size_t start, resource_size_t end,
  52. const char *type);
  53. #else /* CONFIG_FIRMWARE_MEMMAP */
  54. static inline int firmware_map_add(resource_size_t start, resource_size_t end,
  55. const char *type)
  56. {
  57. return 0;
  58. }
  59. static inline int firmware_map_add_early(resource_size_t start,
  60. resource_size_t end, const char *type)
  61. {
  62. return 0;
  63. }
  64. #endif /* CONFIG_FIRMWARE_MEMMAP */
  65. #endif /* _LINUX_FIRMWARE_MAP_H */