// SPDX-License-Identifier: GPL-2.0-or-later /* * AMD Address Translation Library * * access.c : DF Indirect Access functions * * Copyright (c) 2023, Advanced Micro Devices, Inc. * All Rights Reserved. * * Author: Yazen Ghannam <[email protected]> */ #include "internal.h" /* Protect the PCI config register pairs used for DF indirect access. */ static DEFINE_MUTEX(df_indirect_mutex); /* * Data Fabric Indirect Access uses FICAA/FICAD. * * Fabric Indirect Configuration Access Address (FICAA): constructed based * on the device's Instance Id and the PCI function and register offset of * the desired register. * * Fabric Indirect Configuration Access Data (FICAD): there are FICAD * low and high registers but so far only the low register is needed. * * Use Instance Id 0xFF to indicate a broadcast read. */ #define DF_BROADCAST … #define DF_FICAA_INST_EN … #define DF_FICAA_REG_NUM … #define DF_FICAA_FUNC_NUM … #define DF_FICAA_INST_ID … #define DF_FICAA_REG_NUM_LEGACY … static u16 get_accessible_node(u16 node) { … } static int __df_indirect_read(u16 node, u8 func, u16 reg, u8 instance_id, u32 *lo) { … } int df_indirect_read_instance(u16 node, u8 func, u16 reg, u8 instance_id, u32 *lo) { … } int df_indirect_read_broadcast(u16 node, u8 func, u16 reg, u32 *lo) { … }