1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Huawei HiNIC PCI Express Linux driver
4 * Copyright(c) 2017 Huawei Technologies Co., Ltd
5 */
6
7#ifndef HINIC_COMMON_H
8#define HINIC_COMMON_H
9
10#include <linux/types.h>
11
12#define UPPER_8_BITS(data)      (((data) >> 8) & 0xFF)
13#define LOWER_8_BITS(data)      ((data) & 0xFF)
14
15struct hinic_sge {
16	u32             hi_addr;
17	u32             lo_addr;
18	u32             len;
19};
20
21void hinic_cpu_to_be32(void *data, int len);
22
23void hinic_be32_to_cpu(void *data, int len);
24
25void hinic_set_sge(struct hinic_sge *sge, dma_addr_t addr, int len);
26
27dma_addr_t hinic_sge_to_dma(struct hinic_sge *sge);
28
29#endif
30