Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20191022' into staging
[qemu/ar7.git] / pc-bios / s390-ccw / helper.h
blob78d5bc74421b4173f5e9de6d80d7a974a1be75e3
1 /*
2 * Helper Functions
4 * Copyright (c) 2019 IBM Corp.
6 * Author(s): Jason J. Herne <jjherne@us.ibm.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
10 * directory.
13 #ifndef S390_CCW_HELPER_H
14 #define S390_CCW_HELPER_H
16 #include "s390-ccw.h"
18 /* Avoids compiler warnings when casting a pointer to a u32 */
19 static inline uint32_t ptr2u32(void *ptr)
21 IPL_assert((uint64_t)ptr <= 0xffffffff, "ptr2u32: ptr too large");
22 return (uint32_t)(uint64_t)ptr;
25 /* Avoids compiler warnings when casting a u32 to a pointer */
26 static inline void *u32toptr(uint32_t n)
28 return (void *)(uint64_t)n;
31 #endif