summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2025-05-19 17:16:33 +0200
committerMichael Brown2025-05-19 20:36:25 +0200
commit140ceeeb089f605e29592697239a28bb4db1a7e2 (patch)
tree1f265902b0ef8a0b0611f1a2f67ec7cf68fca74b
parent[uheap] Add a generic external heap based on the system memory map (diff)
downloadipxe-140ceeeb089f605e29592697239a28bb4db1a7e2.tar.gz
ipxe-140ceeeb089f605e29592697239a28bb4db1a7e2.tar.xz
ipxe-140ceeeb089f605e29592697239a28bb4db1a7e2.zip
[riscv] Use generic external heap based on the system memory map
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/arch/riscv/include/bits/umalloc.h14
-rw-r--r--src/arch/riscv/include/ipxe/sbi_umalloc.h18
-rw-r--r--src/arch/riscv/interface/sbi/sbi_umalloc.c51
-rw-r--r--src/config/defaults/sbi.h2
4 files changed, 1 insertions, 84 deletions
diff --git a/src/arch/riscv/include/bits/umalloc.h b/src/arch/riscv/include/bits/umalloc.h
deleted file mode 100644
index a7171ca2c..000000000
--- a/src/arch/riscv/include/bits/umalloc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BITS_UMALLOC_H
-#define _BITS_UMALLOC_H
-
-/** @file
- *
- * RISCV-specific user memory allocation API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <ipxe/sbi_umalloc.h>
-
-#endif /* _BITS_UMALLOC_H */
diff --git a/src/arch/riscv/include/ipxe/sbi_umalloc.h b/src/arch/riscv/include/ipxe/sbi_umalloc.h
deleted file mode 100644
index 5763239fb..000000000
--- a/src/arch/riscv/include/ipxe/sbi_umalloc.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _IPXE_SBI_UMALLOC_H
-#define _IPXE_SBI_UMALLOC_H
-
-/** @file
- *
- * External memory allocation
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#ifdef UMALLOC_SBI
-#define UMALLOC_PREFIX_sbi
-#else
-#define UMALLOC_PREFIX_sbi __sbi_
-#endif
-
-#endif /* _IPXE_SBI_UMALLOC_H */
diff --git a/src/arch/riscv/interface/sbi/sbi_umalloc.c b/src/arch/riscv/interface/sbi/sbi_umalloc.c
deleted file mode 100644
index 0e351748b..000000000
--- a/src/arch/riscv/interface/sbi/sbi_umalloc.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2024 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdlib.h>
-#include <ipxe/umalloc.h>
-
-/** @file
- *
- * iPXE user memory allocation API for SBI
- *
- */
-
-/**
- * Reallocate external memory
- *
- * @v old_ptr Memory previously allocated by umalloc(), or NULL
- * @v new_size Requested size
- * @ret new_ptr Allocated memory, or NULL
- *
- * Calling realloc() with a new size of zero is a valid way to free a
- * memory block.
- */
-static void * sbi_urealloc ( void * old_ptr, size_t new_size ) {
-
- /* External allocation not yet implemented: allocate from heap */
- return ( realloc ( old_ptr, new_size ) );
-}
-
-PROVIDE_UMALLOC ( sbi, urealloc, sbi_urealloc );
diff --git a/src/config/defaults/sbi.h b/src/config/defaults/sbi.h
index 8e02bc3d1..4edc0ab01 100644
--- a/src/config/defaults/sbi.h
+++ b/src/config/defaults/sbi.h
@@ -18,7 +18,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define CONSOLE_SBI
#define REBOOT_SBI
-#define UMALLOC_SBI
+#define UMALLOC_UHEAP
#define MEMMAP_FDT
#define ACPI_NULL