1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2015-2018 Atomic Rules LLC
10 #include <rte_memory.h>
12 /* The MPU or Memory Prefetch Unit is an internal Arkville hardware
13 * module for moving data between host memory and the hardware FPGA.
14 * This module is *not* intended for end-user manipulation, hence
15 * there is minimal documentation.
18 #define ARK_MPU_MODID 0x2055504d
19 #define ARK_MPU_MODVER 0x37313232
21 * MPU hardware structures
22 * These are overlay structures to a memory mapped FPGA device. These
23 * structs will never be instantiated in ram memory
26 #define ARK_MPU_ID 0x00
40 #define ARK_MPU_HW 0x010
49 #define ARK_MPU_CFG 0x040
50 struct ark_mpu_cfg_t {
51 rte_iova_t ring_base; /* rte_iova_t is a uint64_t */
54 uint32_t min_host_move;
56 volatile uint32_t sw_prod_index;
57 volatile uint32_t hw_cons_index;
58 volatile uint32_t command;
60 enum ARK_MPU_COMMAND {
65 MPU_CMD_FORCE_RESET = 16,
66 MPU_COMMAND_LIMIT = 0xfFFFFFFF
69 /* Consolidated structure */
71 struct ark_mpu_id_t id;
72 uint8_t reserved0[(ARK_MPU_HW - ARK_MPU_ID)
73 - sizeof(struct ark_mpu_id_t)];
74 struct ark_mpu_hw_t hw;
75 uint8_t reserved1[(ARK_MPU_CFG - ARK_MPU_HW) -
76 sizeof(struct ark_mpu_hw_t)];
77 struct ark_mpu_cfg_t cfg;
80 uint16_t ark_api_num_queues(struct ark_mpu_t *mpu);
81 uint16_t ark_api_num_queues_per_port(struct ark_mpu_t *mpu,
83 int ark_mpu_verify(struct ark_mpu_t *mpu, uint32_t obj_size);
84 void ark_mpu_stop(struct ark_mpu_t *mpu);
85 void ark_mpu_start(struct ark_mpu_t *mpu);
86 int ark_mpu_reset(struct ark_mpu_t *mpu);
87 int ark_mpu_configure(struct ark_mpu_t *mpu, rte_iova_t ring,
88 uint32_t ring_size, int is_tx);
90 void ark_mpu_dump(struct ark_mpu_t *mpu, const char *msg, uint16_t idx);
91 void ark_mpu_dump_setup(struct ark_mpu_t *mpu, uint16_t qid);
93 /* this action is in a performance critical path */
95 ark_mpu_set_producer(struct ark_mpu_t *mpu, uint32_t idx)
97 mpu->cfg.sw_prod_index = idx;