1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ 2 /* 3 * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved. 4 */ 5 6 #ifndef _EFA_COMMON_H_ 7 #define _EFA_COMMON_H_ 8 9 #include <linux/bitfield.h> 10 11 #define EFA_COMMON_SPEC_VERSION_MAJOR 2 12 #define EFA_COMMON_SPEC_VERSION_MINOR 0 13 14 #define EFA_GET(ptr, mask) FIELD_GET(mask##_MASK, *(ptr)) 15 16 #define EFA_SET(ptr, mask, value) \ 17 ({ \ 18 typeof(ptr) _ptr = ptr; \ 19 *_ptr = (*_ptr & ~(mask##_MASK)) | \ 20 FIELD_PREP(mask##_MASK, value); \ 21 }) 22 23 struct efa_common_mem_addr { 24 u32 mem_addr_low; 25 26 u32 mem_addr_high; 27 }; 28 29 #endif /* _EFA_COMMON_H_ */ 30