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