18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Huawei HiNIC PCI Express Linux driver 48c2ecf20Sopenharmony_ci * Copyright(c) 2017 Huawei Technologies Co., Ltd 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef HINIC_COMMON_H 88c2ecf20Sopenharmony_ci#define HINIC_COMMON_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define UPPER_8_BITS(data) (((data) >> 8) & 0xFF) 138c2ecf20Sopenharmony_ci#define LOWER_8_BITS(data) ((data) & 0xFF) 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct hinic_sge { 168c2ecf20Sopenharmony_ci u32 hi_addr; 178c2ecf20Sopenharmony_ci u32 lo_addr; 188c2ecf20Sopenharmony_ci u32 len; 198c2ecf20Sopenharmony_ci}; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_civoid hinic_cpu_to_be32(void *data, int len); 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_civoid hinic_be32_to_cpu(void *data, int len); 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_civoid hinic_set_sge(struct hinic_sge *sge, dma_addr_t addr, int len); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cidma_addr_t hinic_sge_to_dma(struct hinic_sge *sge); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#endif 30