int ukplat_memregion_count(void)
{
- static int have_heap = 0;
- static int have_initrd = 0;
- int rc = 0;
+ static int init;
+ int rc;
- /*
- * NOTE: The heap size and initrd file can be changed by a
- * library parameter. We assume that those ones are processed
- * by the boot library shortly before memory regions are
- * scanned. This is why we initialize the heap here.
- */
- if (!have_heap) {
- rc = __linuxu_plat_heap_init();
- have_heap = (rc == 0) ? 1 : 0;
- }
+ if (init)
+ return init;
- if (!have_initrd) {
- rc = __linuxu_plat_initrd_init();
- have_initrd = (rc == 0) ? 1 : 0;
- }
+ rc = __linuxu_plat_heap_init();
+ init += (rc == 0) ? 1 : 0;
+
+ rc = __linuxu_plat_initrd_init();
+ init += (rc == 0) ? 1 : 0;
- return have_heap + have_initrd;
+ return init;
}
int ukplat_memregion_get(int i, struct ukplat_memregion_desc **m)