lmb.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _LINUX_LMB_H
  2. #define _LINUX_LMB_H
  3. #ifdef __KERNEL__
  4. #include <asm/types.h>
  5. /*
  6. * Logical memory blocks.
  7. *
  8. * Copyright (C) 2001 Peter Bergner, IBM Corp.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version
  13. * 2 of the License, or (at your option) any later version.
  14. */
  15. #define MAX_LMB_REGIONS 8
  16. struct lmb_property {
  17. ulong base;
  18. ulong size;
  19. };
  20. struct lmb_region {
  21. unsigned long cnt;
  22. ulong size;
  23. struct lmb_property region[MAX_LMB_REGIONS+1];
  24. };
  25. struct lmb {
  26. struct lmb_region memory;
  27. struct lmb_region reserved;
  28. };
  29. extern struct lmb lmb;
  30. extern void lmb_init(struct lmb *lmb);
  31. extern long lmb_add(struct lmb *lmb, ulong base, ulong size);
  32. extern long lmb_reserve(struct lmb *lmb, ulong base, ulong size);
  33. extern ulong lmb_alloc(struct lmb *lmb, ulong size, ulong align);
  34. extern ulong lmb_alloc_base(struct lmb *lmb, ulong size, ulong align, ulong max_addr);
  35. extern ulong __lmb_alloc_base(struct lmb *lmb, ulong size, ulong align, ulong max_addr);
  36. extern int lmb_is_reserved(struct lmb *lmb, ulong addr);
  37. extern void lmb_dump_all(struct lmb *lmb);
  38. static inline ulong
  39. lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
  40. {
  41. return type->region[region_nr].size;
  42. }
  43. #endif /* __KERNEL__ */
  44. #endif /* _LINUX_LMB_H */