2 // Copyright (c) 2010-2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
20 /* Simplified, from DPDK 1.8 */
24 /* Registers access */
26 #define PROX_PCI_REG_ADDR(hw, reg) \
27 ((volatile uint32_t *)((char *)(hw)->hw_addr + (reg)))
28 #define PROX_READ_REG(hw, reg) \
29 prox_read_addr(PROX_PCI_REG_ADDR((hw), (reg)))
30 #define PROX_PCI_REG(reg) (*((volatile uint32_t *)(reg)))
31 #define PROX_PCI_REG_WRITE(reg_addr, value) \
32 *((volatile uint32_t *) (reg_addr)) = (value)
33 #define PROX_WRITE_REG(hw,reg,value) \
34 PROX_PCI_REG_WRITE(PROX_PCI_REG_ADDR((hw), (reg)), (value))
36 static inline uint32_t prox_read_addr(volatile void* addr)
38 return rte_le_to_cpu_32(PROX_PCI_REG(addr));
41 int read_reg(uint8_t portid, uint32_t addr, uint32_t *reg);
42 int write_reg(uint8_t portid, uint32_t reg, uint32_t val);