1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
5 #include "opae_ifpga_hw_api.h"
8 int opae_manager_ifpga_get_prop(struct opae_manager *mgr,
9 struct feature_prop *prop)
11 struct ifpga_fme_hw *fme;
13 if (!mgr || !mgr->data)
18 return ifpga_get_prop(fme->parent, FEATURE_FIU_ID_FME, 0, prop);
21 int opae_manager_ifpga_set_prop(struct opae_manager *mgr,
22 struct feature_prop *prop)
24 struct ifpga_fme_hw *fme;
26 if (!mgr || !mgr->data)
31 return ifpga_set_prop(fme->parent, FEATURE_FIU_ID_FME, 0, prop);
34 int opae_manager_ifpga_get_info(struct opae_manager *mgr,
35 struct fpga_fme_info *fme_info)
37 struct ifpga_fme_hw *fme;
39 if (!mgr || !mgr->data || !fme_info)
44 spinlock_lock(&fme->lock);
45 fme_info->capability = fme->capability;
46 spinlock_unlock(&fme->lock);
51 int opae_manager_ifpga_set_err_irq(struct opae_manager *mgr,
52 struct fpga_fme_err_irq_set *err_irq_set)
54 struct ifpga_fme_hw *fme;
56 if (!mgr || !mgr->data)
61 return ifpga_set_irq(fme->parent, FEATURE_FIU_ID_FME, 0,
62 IFPGA_FME_FEATURE_ID_GLOBAL_ERR, err_irq_set);
65 int opae_bridge_ifpga_get_prop(struct opae_bridge *br,
66 struct feature_prop *prop)
68 struct ifpga_port_hw *port;
75 return ifpga_get_prop(port->parent, FEATURE_FIU_ID_PORT,
79 int opae_bridge_ifpga_set_prop(struct opae_bridge *br,
80 struct feature_prop *prop)
82 struct ifpga_port_hw *port;
89 return ifpga_set_prop(port->parent, FEATURE_FIU_ID_PORT,
93 int opae_bridge_ifpga_get_info(struct opae_bridge *br,
94 struct fpga_port_info *port_info)
96 struct ifpga_port_hw *port;
98 if (!br || !br->data || !port_info)
103 spinlock_lock(&port->lock);
104 port_info->capability = port->capability;
105 port_info->num_uafu_irqs = port->num_uafu_irqs;
106 spinlock_unlock(&port->lock);
111 int opae_bridge_ifpga_get_region_info(struct opae_bridge *br,
112 struct fpga_port_region_info *info)
114 struct ifpga_port_hw *port;
116 if (!br || !br->data || !info)
119 /* Only support STP region now */
120 if (info->index != PORT_REGION_INDEX_STP)
125 spinlock_lock(&port->lock);
126 info->addr = port->stp_addr;
127 info->size = port->stp_size;
128 spinlock_unlock(&port->lock);
133 int opae_bridge_ifpga_set_err_irq(struct opae_bridge *br,
134 struct fpga_port_err_irq_set *err_irq_set)
136 struct ifpga_port_hw *port;
138 if (!br || !br->data)
143 return ifpga_set_irq(port->parent, FEATURE_FIU_ID_PORT, port->port_id,
144 IFPGA_PORT_FEATURE_ID_ERROR, err_irq_set);