1*2025cf9eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2b15a9f37SAviad Krawczyk /* 3b15a9f37SAviad Krawczyk * Huawei HiNIC PCI Express Linux driver 4b15a9f37SAviad Krawczyk * Copyright(c) 2017 Huawei Technologies Co., Ltd 5b15a9f37SAviad Krawczyk */ 6b15a9f37SAviad Krawczyk 7b15a9f37SAviad Krawczyk #ifndef HINIC_COMMON_H 8b15a9f37SAviad Krawczyk #define HINIC_COMMON_H 9b15a9f37SAviad Krawczyk 1076baca2eSAviad Krawczyk #include <linux/types.h> 1176baca2eSAviad Krawczyk 1276baca2eSAviad Krawczyk #define UPPER_8_BITS(data) (((data) >> 8) & 0xFF) 1376baca2eSAviad Krawczyk #define LOWER_8_BITS(data) ((data) & 0xFF) 1476baca2eSAviad Krawczyk 15b15a9f37SAviad Krawczyk struct hinic_sge { 16b15a9f37SAviad Krawczyk u32 hi_addr; 17b15a9f37SAviad Krawczyk u32 lo_addr; 18b15a9f37SAviad Krawczyk u32 len; 19b15a9f37SAviad Krawczyk }; 20b15a9f37SAviad Krawczyk 2153e7d6feSAviad Krawczyk void hinic_cpu_to_be32(void *data, int len); 2253e7d6feSAviad Krawczyk 2353e7d6feSAviad Krawczyk void hinic_be32_to_cpu(void *data, int len); 2453e7d6feSAviad Krawczyk 2576baca2eSAviad Krawczyk void hinic_set_sge(struct hinic_sge *sge, dma_addr_t addr, int len); 2676baca2eSAviad Krawczyk 2776baca2eSAviad Krawczyk dma_addr_t hinic_sge_to_dma(struct hinic_sge *sge); 2876baca2eSAviad Krawczyk 29b15a9f37SAviad Krawczyk #endif 30