From 140ceeeb089f605e29592697239a28bb4db1a7e2 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 19 May 2025 16:16:33 +0100 Subject: [PATCH] [riscv] Use generic external heap based on the system memory map Signed-off-by: Michael Brown --- src/arch/riscv/include/bits/umalloc.h | 14 ------ src/arch/riscv/include/ipxe/sbi_umalloc.h | 18 -------- src/arch/riscv/interface/sbi/sbi_umalloc.c | 51 ---------------------- src/config/defaults/sbi.h | 2 +- 4 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 src/arch/riscv/include/bits/umalloc.h delete mode 100644 src/arch/riscv/include/ipxe/sbi_umalloc.h delete mode 100644 src/arch/riscv/interface/sbi/sbi_umalloc.c 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 - -#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 . - * - * 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 -#include - -/** @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