xref: /openbmc/linux/drivers/infiniband/hw/efa/efa_common_defs.h (revision ead5d1f4d877e92c051e1a1ade623d0d30e71619)
101edac3aSGal Pressman /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
201edac3aSGal Pressman /*
3*88d03307SGal Pressman  * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
401edac3aSGal Pressman  */
501edac3aSGal Pressman 
601edac3aSGal Pressman #ifndef _EFA_COMMON_H_
701edac3aSGal Pressman #define _EFA_COMMON_H_
801edac3aSGal Pressman 
9*88d03307SGal Pressman #include <linux/bitfield.h>
10*88d03307SGal Pressman 
1101edac3aSGal Pressman #define EFA_COMMON_SPEC_VERSION_MAJOR        2
1201edac3aSGal Pressman #define EFA_COMMON_SPEC_VERSION_MINOR        0
1301edac3aSGal Pressman 
14*88d03307SGal Pressman #define EFA_GET(ptr, mask) FIELD_GET(mask##_MASK, *(ptr))
15*88d03307SGal Pressman 
16*88d03307SGal Pressman #define EFA_SET(ptr, mask, value)                                              \
17*88d03307SGal Pressman 	({                                                                     \
18*88d03307SGal Pressman 		typeof(ptr) _ptr = ptr;                                        \
19*88d03307SGal Pressman 		*_ptr = (*_ptr & ~(mask##_MASK)) |                             \
20*88d03307SGal Pressman 			FIELD_PREP(mask##_MASK, value);                        \
21*88d03307SGal Pressman 	})
22*88d03307SGal Pressman 
2301edac3aSGal Pressman struct efa_common_mem_addr {
2401edac3aSGal Pressman 	u32 mem_addr_low;
2501edac3aSGal Pressman 
2601edac3aSGal Pressman 	u32 mem_addr_high;
2701edac3aSGal Pressman };
2801edac3aSGal Pressman 
2901edac3aSGal Pressman #endif /* _EFA_COMMON_H_ */
30