drm/panel: panel-himax-hx83102: support for csot-pna957qt1-1 MIPI-DSI panel
[drm/drm-misc.git] / arch / microblaze / include / asm / flat.h
blobedff4306fa7093f1e0137115b92d74461860115e
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * uClinux flat-format executables
5 * Copyright (C) 2005 John Williams <jwilliams@itee.uq.edu.au>
6 */
8 #ifndef _ASM_MICROBLAZE_FLAT_H
9 #define _ASM_MICROBLAZE_FLAT_H
11 #include <linux/unaligned.h>
14 * Microblaze works a little differently from other arches, because
15 * of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
16 * over two instructions, an 'imm' instruction which provides the top
17 * 16 bits, then the instruction "proper" which provides the low 16
18 * bits.
22 * Crack open a symbol reference and extract the address to be
23 * relocated. rp is a potentially unaligned pointer to the
24 * reference
27 static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
28 u32 *addr)
30 u32 *p = (__force u32 *)rp;
32 /* Is it a split 64/32 reference? */
33 if (relval & 0x80000000) {
34 /* Grab the two halves of the reference */
35 u32 val_hi, val_lo;
37 val_hi = get_unaligned(p);
38 val_lo = get_unaligned(p+1);
40 /* Crack the address out */
41 *addr = ((val_hi & 0xffff) << 16) + (val_lo & 0xffff);
42 } else {
43 /* Get the address straight out */
44 *addr = get_unaligned(p);
47 return 0;
51 * Insert an address into the symbol reference at rp. rp is potentially
52 * unaligned.
55 static inline int
56 flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 relval)
58 u32 *p = (__force u32 *)rp;
59 /* Is this a split 64/32 reloc? */
60 if (relval & 0x80000000) {
61 /* Get the two "halves" */
62 unsigned long val_hi = get_unaligned(p);
63 unsigned long val_lo = get_unaligned(p + 1);
65 /* insert the address */
66 val_hi = (val_hi & 0xffff0000) | addr >> 16;
67 val_lo = (val_lo & 0xffff0000) | (addr & 0xffff);
69 /* store the two halves back into memory */
70 put_unaligned(val_hi, p);
71 put_unaligned(val_lo, p+1);
72 } else {
73 /* Put it straight in, no messing around */
74 put_unaligned(addr, p);
76 return 0;
79 #define flat_get_relocate_addr(rel) (rel & 0x7fffffff)
81 #endif /* _ASM_MICROBLAZE_FLAT_H */