mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
risc-v/mpfs: switch to NuttX types for opensbi
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Xiang Xiao
parent
0342272e5a
commit
1dccc374ab
@@ -38,9 +38,10 @@ INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)chip}
|
|||||||
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)common}
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)common}
|
||||||
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(ARCH_SUBDIR)}
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)$(ARCH_SUBDIR)}
|
||||||
INCLUDES += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)sched}
|
INCLUDES += ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)sched}
|
||||||
#ifeq ($(CONFIG_OPENSBI),y)
|
ifeq ($(CONFIG_OPENSBI),y)
|
||||||
|
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)opensbi)
|
||||||
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)opensbi$(DELIM)opensbi-3rdparty$(DELIM)include)
|
INCLUDES += $(shell $(INCDIR) "$(CC)" $(ARCH_SRCDIR)$(DELIM)opensbi$(DELIM)opensbi-3rdparty$(DELIM)include)
|
||||||
#endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS += $(INCLUDES)
|
CPPFLAGS += $(INCLUDES)
|
||||||
CFLAGS += $(INCLUDES)
|
CFLAGS += $(INCLUDES)
|
||||||
|
|||||||
@@ -23,24 +23,19 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <riscv_arch.h>
|
|
||||||
|
#include "riscv_internal.h"
|
||||||
|
#include "riscv_arch.h"
|
||||||
|
|
||||||
#include <hardware/mpfs_plic.h>
|
#include <hardware/mpfs_plic.h>
|
||||||
#include <hardware/mpfs_memorymap.h>
|
#include <hardware/mpfs_memorymap.h>
|
||||||
#include <hardware/mpfs_clint.h>
|
#include <hardware/mpfs_clint.h>
|
||||||
#include <hardware/mpfs_sysreg.h>
|
#include <hardware/mpfs_sysreg.h>
|
||||||
|
|
||||||
/* OpenSBI will also define NULL. Undefine NULL in order to avoid warning:
|
|
||||||
* 'warning: "NULL" redefined'
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef NULL
|
|
||||||
#undef NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sbi/sbi_types.h>
|
#include <sbi/sbi_types.h>
|
||||||
#include <sbi/riscv_atomic.h>
|
#include <sbi/riscv_atomic.h>
|
||||||
#include <sbi/riscv_asm.h>
|
#include <sbi/riscv_asm.h>
|
||||||
@@ -117,16 +112,6 @@ static int mpfs_irqchip_init(bool cold_boot);
|
|||||||
static int mpfs_ipi_init(bool cold_boot);
|
static int mpfs_ipi_init(bool cold_boot);
|
||||||
static int mpfs_timer_init(bool cold_boot);
|
static int mpfs_timer_init(bool cold_boot);
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Extern Function Declarations
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* riscv_internal.h cannot be included due to a number of redefinition
|
|
||||||
* conflicts. Thus, define the riscv_lowputc() with the extern definition.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void riscv_lowputc(char ch);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ config OPENSBI
|
|||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Enable or disable Open Source Supervisor Binary Interface (OpenSBI) features
|
Enable or disable Open Source Supervisor Binary Interface (OpenSBI) features
|
||||||
for RISC-V.
|
for RISC-V.
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ OPENSBI_URL = https://github.com/riscv-software-src/opensbi/tarball
|
|||||||
OPENSBI_TARBALL = opensbi.tar.gz
|
OPENSBI_TARBALL = opensbi.tar.gz
|
||||||
OPENSBI_DIR = riscv-software-src-opensbi-48f91ee
|
OPENSBI_DIR = riscv-software-src-opensbi-48f91ee
|
||||||
|
|
||||||
|
CFLAGS += -DOPENSBI_EXTERNAL_SBI_TYPES=nuttx_sbi_types.h
|
||||||
|
|
||||||
$(OPENSBI_TARBALL):
|
$(OPENSBI_TARBALL):
|
||||||
$(Q) echo "Downloading: OpenSBI"
|
$(Q) echo "Downloading: OpenSBI"
|
||||||
$(Q) curl -L $(OPENSBI_URL)/$(OPENSBI_COMMIT) -o opensbi/$(OPENSBI_TARBALL)
|
$(Q) curl -L $(OPENSBI_URL)/$(OPENSBI_COMMIT) -o opensbi/$(OPENSBI_TARBALL)
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/risc-v/src/opensbi/nuttx_sbi_types.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_RISCV_SRC_OPENSBI_NUTTX_SBI_TYPES_H
|
||||||
|
#define __ARCH_RISCV_SRC_OPENSBI_NUTTX_SBI_TYPES_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
#include <nuttx/nuttx.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "riscv_internal.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#define PRILX PRIxREG
|
||||||
|
|
||||||
|
#define __packed end_packed_struct
|
||||||
|
#define __noreturn noreturn_function
|
||||||
|
#define __aligned(x) aligned_data(x)
|
||||||
|
|
||||||
|
#define likely(x) __builtin_expect((x), 1)
|
||||||
|
#define unlikely(x) __builtin_expect((x), 0)
|
||||||
|
|
||||||
|
#define array_size(x) (sizeof(x) / sizeof((x)[0]))
|
||||||
|
|
||||||
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||||
|
#define CLAMP(a, lo, hi) MIN(MAX(a, lo), hi)
|
||||||
|
|
||||||
|
#define ROUNDUP(a, b) ((((a) - 1) / (b) + 1) * (b))
|
||||||
|
#define ROUNDDOWN(a, b) ((a) / (b) * (b))
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Type Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
typedef int8_t s8;
|
||||||
|
typedef uint8_t u8;
|
||||||
|
|
||||||
|
typedef int16_t s16;
|
||||||
|
typedef uint16_t u16;
|
||||||
|
|
||||||
|
typedef int32_t s32;
|
||||||
|
typedef uint32_t u32;
|
||||||
|
|
||||||
|
typedef int64_t s64;
|
||||||
|
typedef uint64_t u64;
|
||||||
|
|
||||||
|
typedef uintptr_t virtual_addr_t;
|
||||||
|
typedef uintptr_t virtual_size_t;
|
||||||
|
typedef uintptr_t physical_addr_t;
|
||||||
|
typedef uintptr_t physical_size_t;
|
||||||
|
|
||||||
|
#endif /* __ARCH_RISCV_SRC_OPENSBI_NUTTX_SBI_TYPES_H */
|
||||||
Reference in New Issue
Block a user