Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
neoverse-rd/apremap: use address remapper interface
Browse files Browse the repository at this point in the history
Address remapper interface defines the APIs for address translated
read/write operations that producers can implement and consumers can
consume. As the RD-N2 apremap module is intended to provide such a
address translated read/write operations, migrate the implementation
of the apremap module over to the implementation of address remapper
interface definition.

Signed-off-by: Nishant Sharma <nishant.sharma@arm.com>
Change-Id: Ie91a9f63b4cbe3669ea5a525bb7537575258c9e9
  • Loading branch information
nissha03 committed Apr 10, 2024
1 parent b75ce19 commit 29bf765
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 86 deletions.
5 changes: 3 additions & 2 deletions product/neoverse-rd/rdn2/module/apremap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#
# Arm SCP/MCP Software
# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
# Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#

add_library(${SCP_MODULE_TARGET} SCP_MODULE)

target_include_directories(${SCP_MODULE_TARGET}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
PUBLIC "${CMAKE_SOURCE_DIR}/product/neoverse-rd/interface/address_remapper/")

target_sources(${SCP_MODULE_TARGET}
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_apremap.c")
77 changes: 3 additions & 74 deletions product/neoverse-rd/rdn2/module/apremap/include/mod_apremap.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
Expand All @@ -11,6 +11,8 @@
#ifndef MOD_APREMAP_H
#define MOD_APREMAP_H

#include <interface_address_remapper.h>

#include <fwk_macros.h>

#include <stdint.h>
Expand Down Expand Up @@ -50,79 +52,6 @@ struct mod_apremap_config {
uintptr_t base;
};

/*!
* \brief API to read/write the AP memory space.
*/
struct mod_apremap_rw_api {
/*!
* \brief Read a byte from Application Processor's address
*
* \param addr Address of the AP address space
*
* \return Byte value from the AP address
*/
uint8_t (*mmio_ap_mem_read_8)(uint64_t addr);

/*!
* \brief Read a halfword from Application Processor's address
*
* \param addr Address of the AP address space
*
* \return Halfword value from the AP address
*/
uint16_t (*mmio_ap_mem_read_16)(uint64_t addr);

/*!
* \brief Read a word from Application Processor's address
*
* \param addr Address of the AP address space
*
* \return Word value from the AP address
*/
uint32_t (*mmio_ap_mem_read_32)(uint64_t addr);

/*!
* \brief Read doubleword from Application Processor's address
*
* \param addr Address of the AP address space
*
* \return Doubleword value from the AP address
*/
uint64_t (*mmio_ap_mem_read_64)(uint64_t addr);

/*!
* \brief Write a byte to Application Processor's address
*
* \param addr Address of the AP address space
* \param value Byte value to be written
*/
void (*mmio_ap_mem_write_8)(uint64_t addr, uint8_t value);

/*!
* \brief Write a halfword to Application Processor's address
*
* \param addr Address of the AP address space
* \param value Halfword value to be written
*/
void (*mmio_ap_mem_write_16)(uint64_t addr, uint16_t value);

/*!
* \brief Write a word to Application Processor's address
*
* \param addr Address of the AP address space
* \param value Word value to be written
*/
void (*mmio_ap_mem_write_32)(uint64_t addr, uint32_t value);

/*!
* \brief Write doubleword to Application Processor's address
*
* \param addr Address of the AP address space
* \param value Doubleword value to be written
*/
void (*mmio_ap_mem_write_64)(uint64_t addr, uint64_t value);
};

/*!
* \brief API to enable/disable the CMN address translation.
*/
Expand Down
20 changes: 10 additions & 10 deletions product/neoverse-rd/rdn2/module/apremap/src/mod_apremap.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
Expand Down Expand Up @@ -419,15 +419,15 @@ static void mmio_ap_mem_write_64(uint64_t addr, uint64_t value)
/*
* API to be used by a module that needs to read/write AP memory region.
*/
static struct mod_apremap_rw_api apremap_mem_api = {
.mmio_ap_mem_read_8 = mmio_ap_mem_read_8,
.mmio_ap_mem_read_16 = mmio_ap_mem_read_16,
.mmio_ap_mem_read_32 = mmio_ap_mem_read_32,
.mmio_ap_mem_read_64 = mmio_ap_mem_read_64,
.mmio_ap_mem_write_8 = mmio_ap_mem_write_8,
.mmio_ap_mem_write_16 = mmio_ap_mem_write_16,
.mmio_ap_mem_write_32 = mmio_ap_mem_write_32,
.mmio_ap_mem_write_64 = mmio_ap_mem_write_64,
static struct interface_address_remapper_rw_api apremap_mem_api = {
.read8 = mmio_ap_mem_read_8,
.read16 = mmio_ap_mem_read_16,
.read32 = mmio_ap_mem_read_32,
.read64 = mmio_ap_mem_read_64,
.write8 = mmio_ap_mem_write_8,
.write16 = mmio_ap_mem_write_16,
.write32 = mmio_ap_mem_write_32,
.write64 = mmio_ap_mem_write_64,
};

/* API to enable/disable CMN Address Translation */
Expand Down

0 comments on commit 29bf765

Please sign in to comment.