arch/arm/imx9: rptun/rsctable: move addresses and MU instance to headers.

Extract chip-specific constants from imx9_rptun.c and imx9_rsctable.c
into new dispatch headers:

- hardware/imx9_rsctable.h: VDEV0_VRING_BASE and RESOURCE_TABLE_BASE,
  selected per ARCH_CHIP define
- hardware/imx9_rptun.h: MU_INSTANCE, selected per ARCH_CHIP define

Rename the misnamed VRING_SHMEM constant in imx9_rptun.c to
RESOURCE_TABLE_BASE, which correctly reflects that this address points
to the resource table, not the vring shared memory region.

No functional change for i.MX95-M7 builds.

Signed-off-by: Maarten Zanders <maarten@zanders.be>
This commit is contained in:
Maarten Zanders
2026-02-24 10:30:22 +01:00
committed by Xiang Xiao
parent 3631256219
commit 7ee57f42bb
4 changed files with 69 additions and 6 deletions
+32
View File
@@ -0,0 +1,32 @@
/****************************************************************************
* arch/arm/src/imx9/hardware/imx9_rptun.h
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2024 NXP
*
* 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_ARM_SRC_IMX9_HARDWARE_IMX9_RPTUN_H
#define __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RPTUN_H
#if defined(CONFIG_ARCH_CHIP_IMX95_M7)
# define MU_INSTANCE 7
#else
# error Unrecognized i.MX9 architecture
#endif
#endif /* __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RPTUN_H */
@@ -0,0 +1,33 @@
/****************************************************************************
* arch/arm/src/imx9/hardware/imx9_rsctable.h
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2024 NXP
*
* 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_ARM_SRC_IMX9_HARDWARE_IMX9_RSCTALBE_H
#define __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RSCTALBE_H
#if defined(CONFIG_ARCH_CHIP_IMX95_M7)
# define VDEV0_VRING_BASE 0x88000000
# define RESOURCE_TABLE_BASE 0x88220000
#else
# error Unrecognized i.MX9 architecture
#endif
#endif /* __ARCH_ARM_SRC_IMX9_HARDWARE_IMX9_RSCTALBE_H */
+3 -4
View File
@@ -29,6 +29,8 @@
#include "arm_internal.h"
#include "imx9_mu.h"
#include "imx9_rsctable.h"
#include "hardware/imx9_rptun.h"
#include "hardware/imx9_rsctable.h"
#include <debug.h>
#include <nuttx/config.h>
#include <nuttx/kthread.h>
@@ -41,10 +43,7 @@
* Pre-processor Definitions
****************************************************************************/
#define VRING_SHMEM 0x88220000 /* Vring shared memory start */
#define RPMSG_MU_CHANNEL 1
#define MU_INSTANCE 7
#define MU_MSG_VQID_BITOFFSET 16
@@ -161,7 +160,7 @@ imx9_rptun_get_resource(struct rptun_dev_s *dev)
return &priv->shmem->rsc.rsc_tbl_hdr;
}
priv->shmem = (struct imx9_rptun_shmem_s *)VRING_SHMEM;
priv->shmem = (struct imx9_rptun_shmem_s *)RESOURCE_TABLE_BASE;
if (priv->shmem->rsc.rsc_tbl_hdr.offset
!= g_imx9_rsc_table.rsc_tbl_hdr.offset)
{
+1 -2
View File
@@ -26,6 +26,7 @@
****************************************************************************/
#include "imx9_rsctable.h"
#include "hardware/imx9_rsctable.h"
#include <string.h>
#include <nuttx/rptun/rptun.h>
@@ -37,8 +38,6 @@
#define RL_BUFFER_COUNT 0x100
#define VRING_ALIGN 0x1000
#define VRING_SIZE 0x8000
#define VDEV0_VRING_BASE 0x88000000
#define RESOURCE_TABLE_BASE 0x88220000
#define NO_RESOURCE_ENTRIES (1)
#define RSC_VDEV_FEATURE (1 << VIRTIO_RPMSG_F_NS | \