[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 08/10] RISC-V: Add auxiliary files
From: |
Bin Meng |
Subject: |
Re: [PATCH v2 08/10] RISC-V: Add auxiliary files |
Date: |
Wed, 14 Nov 2018 23:12:46 +0800 |
Hi Alex,
On Wed, Nov 14, 2018 at 9:11 PM Alexander Graf <address@hidden> wrote:
>
> To support a new architecture we need to provide a few helper functions
> for memory, cache, timer, etc support.
>
> This patch adds the remainders of those. Some bits are still disabled,
> as I couldn't guarantee that we're always running on models / in modes
> where the respective hardware is available.
>
> Signed-off-by: Alexander Graf <address@hidden>
> ---
> grub-core/kern/riscv/cache.c | 64 +++++++++++++++++++++++++++++
> grub-core/kern/riscv/cache_flush.S | 40 +++++++++++++++++++
> grub-core/kern/riscv/efi/init.c | 82
> ++++++++++++++++++++++++++++++++++++++
> include/grub/riscv32/efi/memory.h | 6 +++
> include/grub/riscv32/time.h | 28 +++++++++++++
> include/grub/riscv32/types.h | 34 ++++++++++++++++
> include/grub/riscv64/efi/memory.h | 6 +++
> include/grub/riscv64/time.h | 28 +++++++++++++
> include/grub/riscv64/types.h | 34 ++++++++++++++++
> 9 files changed, 322 insertions(+)
> create mode 100644 grub-core/kern/riscv/cache.c
> create mode 100644 grub-core/kern/riscv/cache_flush.S
> create mode 100644 grub-core/kern/riscv/efi/init.c
> create mode 100644 include/grub/riscv32/efi/memory.h
> create mode 100644 include/grub/riscv32/time.h
> create mode 100644 include/grub/riscv32/types.h
> create mode 100644 include/grub/riscv64/efi/memory.h
> create mode 100644 include/grub/riscv64/time.h
> create mode 100644 include/grub/riscv64/types.h
>
> diff --git a/grub-core/kern/riscv/cache.c b/grub-core/kern/riscv/cache.c
> new file mode 100644
> index 000000000..5157fef10
> --- /dev/null
> +++ b/grub-core/kern/riscv/cache.c
> @@ -0,0 +1,64 @@
> +/*
> + * GRUB -- GRand Unified Bootloader
> + * Copyright (C) 2013 Free Software Foundation, Inc.
> + *
> + * GRUB 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 3 of the License, or
> + * (at your option) any later version.
> + *
> + * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <grub/cache.h>
> +#include <grub/misc.h>
> +
> +static grub_int64_t dlinesz;
> +static grub_int64_t ilinesz;
> +
> +/* Prototypes for asm functions. */
> +void grub_arch_clean_dcache_range (grub_addr_t beg, grub_addr_t end,
> + grub_uint64_t line_size);
> +void grub_arch_invalidate_icache_range (grub_addr_t beg, grub_addr_t end,
> + grub_uint64_t line_size);
> +
> +static void
> +probe_caches (void)
> +{
> + /* TODO */
> + dlinesz = 32;
> + ilinesz = 32;
> +}
> +
> +void
> +grub_arch_sync_caches (void *address, grub_size_t len)
> +{
> + grub_uint64_t start, end, max_align;
> +
> + if (dlinesz == 0)
> + probe_caches();
> + if (dlinesz == 0)
> + grub_fatal ("Unknown cache line size!");
> +
> + max_align = dlinesz > ilinesz ? dlinesz : ilinesz;
> +
> + start = ALIGN_DOWN ((grub_uint64_t) address, max_align);
This does not build for 32-bit, due to
kern/riscv/cache.c: In function 'grub_arch_sync_caches':
kern/riscv/cache.c:51:23: error: cast from pointer to integer of
different size [-Werror=pointer-to-int-cast]
start = ALIGN_DOWN ((grub_uint64_t) address, max_align);
^
> + end = ALIGN_UP ((grub_uint64_t) address + len, max_align);
Ditto.
> +
> + grub_arch_clean_dcache_range (start, end, dlinesz);
> + grub_arch_invalidate_icache_range (start, end, ilinesz);
> +}
> +
> +void
> +grub_arch_sync_dma_caches (volatile void *address, grub_size_t len)
> +{
> + /* DMA incoherent devices not supported yet */
> + if (address || len || 1)
> + return;
> +}
[snip]
Regards,
Bin
- Re: [PATCH v2 03/10] elf.h: Add RISC-V definitions, (continued)
- [PATCH v2 05/10] RISC-V: Add early startup code, Alexander Graf, 2018/11/14
- [PATCH v2 02/10] PE: Add RISC-V definitions, Alexander Graf, 2018/11/14
- [PATCH v2 01/10] efi: Rename armxx to arch, Alexander Graf, 2018/11/14
- [PATCH v2 04/10] RISC-V: Add setjmp implementation, Alexander Graf, 2018/11/14
- [PATCH v2 08/10] RISC-V: Add auxiliary files, Alexander Graf, 2018/11/14
- Re: [PATCH v2 08/10] RISC-V: Add auxiliary files,
Bin Meng <=
- [PATCH v2 09/10] RISC-V: Add to build system, Alexander Graf, 2018/11/14
- Re: [PATCH v2 09/10] RISC-V: Add to build system, Bin Meng, 2018/11/14
- Re: [PATCH v2 09/10] RISC-V: Add to build system, Andreas Schwab, 2018/11/14
- Re: [PATCH v2 09/10] RISC-V: Add to build system, Bin Meng, 2018/11/14
- Re: [PATCH v2 09/10] RISC-V: Add to build system, Alexander Graf, 2018/11/14
- Re: [PATCH v2 09/10] RISC-V: Add to build system, Bin Meng, 2018/11/14
- Re: [PATCH v2 09/10] RISC-V: Add to build system, Alexander Graf, 2018/11/15
- Re: [PATCH v2 09/10] RISC-V: Add to build system, Bin Meng, 2018/11/15
[PATCH v2 07/10] RISC-V: Add awareness for RISC-V reloations, Alexander Graf, 2018/11/14