Ensure all lines that should be omitted from public includes are marked
[AROS.git] / arch / all-pc / boot / grub2-aros / grub-core / mmap / mips / yeeloong / uppermem.c
blob723b6a88855c6a20eb8ee35b43570eb1c10277f4
1 /* Compute amount of lower and upper memory till the first hole. */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2009 Free Software Foundation, Inc.
6 * GRUB 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 3 of the License, or
9 * (at your option) any later version.
11 * GRUB 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.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #include <grub/memory.h>
21 #include <grub/mm.h>
22 #include <grub/misc.h>
23 #include <grub/machine/memory.h>
25 grub_uint64_t
26 grub_mmap_get_lower (void)
28 grub_uint64_t lower = 0;
30 auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
31 grub_memory_type_t);
32 int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
33 grub_memory_type_t type)
35 if (type != GRUB_MEMORY_AVAILABLE)
36 return 0;
37 if (addr == 0)
38 lower = size;
39 return 0;
42 grub_mmap_iterate (hook);
43 if (lower > GRUB_ARCH_LOWMEMMAXSIZE)
44 lower = GRUB_ARCH_LOWMEMMAXSIZE;
45 return lower;
48 grub_uint64_t
49 grub_mmap_get_upper (void)
51 grub_uint64_t upper = 0;
53 auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t,
54 grub_memory_type_t);
55 int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
56 grub_memory_type_t type)
58 if (type != GRUB_MEMORY_AVAILABLE)
59 return 0;
60 if (addr <= GRUB_ARCH_HIGHMEMPSTART && addr + size
61 > GRUB_ARCH_HIGHMEMPSTART)
62 upper = addr + size - GRUB_ARCH_HIGHMEMPSTART;
63 return 0;
66 grub_mmap_iterate (hook);
67 return upper;