1f1a8151dSFrançois Tigeot /*-
2f1a8151dSFrançois Tigeot * Copyright (c) 2010 Isilon Systems, Inc.
3f1a8151dSFrançois Tigeot * Copyright (c) 2010 iX Systems, Inc.
4f1a8151dSFrançois Tigeot * Copyright (c) 2010 Panasas, Inc.
5f1a8151dSFrançois Tigeot * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
63f122055SFrançois Tigeot * Copyright (c) 2020 François Tigeot <ftigeot@wolfpond.org>
7f1a8151dSFrançois Tigeot * All rights reserved.
8f1a8151dSFrançois Tigeot *
9f1a8151dSFrançois Tigeot * Redistribution and use in source and binary forms, with or without
10f1a8151dSFrançois Tigeot * modification, are permitted provided that the following conditions
11f1a8151dSFrançois Tigeot * are met:
12f1a8151dSFrançois Tigeot * 1. Redistributions of source code must retain the above copyright
13f1a8151dSFrançois Tigeot * notice unmodified, this list of conditions, and the following
14f1a8151dSFrançois Tigeot * disclaimer.
15f1a8151dSFrançois Tigeot * 2. Redistributions in binary form must reproduce the above copyright
16f1a8151dSFrançois Tigeot * notice, this list of conditions and the following disclaimer in the
17f1a8151dSFrançois Tigeot * documentation and/or other materials provided with the distribution.
18f1a8151dSFrançois Tigeot *
19f1a8151dSFrançois Tigeot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20f1a8151dSFrançois Tigeot * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21f1a8151dSFrançois Tigeot * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22f1a8151dSFrançois Tigeot * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23f1a8151dSFrançois Tigeot * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24f1a8151dSFrançois Tigeot * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25f1a8151dSFrançois Tigeot * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26f1a8151dSFrançois Tigeot * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27f1a8151dSFrançois Tigeot * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28f1a8151dSFrançois Tigeot * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29f1a8151dSFrançois Tigeot */
30f1a8151dSFrançois Tigeot
31f1a8151dSFrançois Tigeot #include <sys/param.h>
32f1a8151dSFrançois Tigeot #include <linux/rbtree.h>
33f1a8151dSFrançois Tigeot
34f1a8151dSFrançois Tigeot int
panic_cmp(struct rb_node * one,struct rb_node * two)35f1a8151dSFrançois Tigeot panic_cmp(struct rb_node *one, struct rb_node *two)
36f1a8151dSFrançois Tigeot {
37f1a8151dSFrançois Tigeot panic("no cmp");
38f1a8151dSFrançois Tigeot }
39f1a8151dSFrançois Tigeot
40f1a8151dSFrançois Tigeot RB_GENERATE(linux_root, rb_node, __entry, panic_cmp);
41d6aa1cc5SFrançois Tigeot
42d6aa1cc5SFrançois Tigeot #include <linux/string.h>
43d6aa1cc5SFrançois Tigeot #include <linux/slab.h>
44d6aa1cc5SFrançois Tigeot
45d6aa1cc5SFrançois Tigeot void *
kmemdup(const void * src,size_t len,gfp_t gfp)46d6aa1cc5SFrançois Tigeot kmemdup(const void *src, size_t len, gfp_t gfp)
47d6aa1cc5SFrançois Tigeot {
48d6aa1cc5SFrançois Tigeot void *dst;
49d6aa1cc5SFrançois Tigeot
50d6aa1cc5SFrançois Tigeot dst = kmalloc(len, M_DRM, gfp);
51d6aa1cc5SFrançois Tigeot if (dst)
52d6aa1cc5SFrançois Tigeot memcpy(dst, src, len);
53d6aa1cc5SFrançois Tigeot return (dst);
54d6aa1cc5SFrançois Tigeot }
553f122055SFrançois Tigeot
563f122055SFrançois Tigeot #include <linux/fb.h>
573f122055SFrançois Tigeot
583f122055SFrançois Tigeot struct fb_info *
framebuffer_alloc(size_t size,struct device * dev)593f122055SFrançois Tigeot framebuffer_alloc(size_t size, struct device *dev)
603f122055SFrançois Tigeot {
613f122055SFrançois Tigeot return kzalloc(sizeof(struct fb_info), GFP_KERNEL);
623f122055SFrançois Tigeot }
633f122055SFrançois Tigeot
643f122055SFrançois Tigeot void
framebuffer_release(struct fb_info * info)653f122055SFrançois Tigeot framebuffer_release(struct fb_info *info)
663f122055SFrançois Tigeot {
673f122055SFrançois Tigeot kfree(info);
683f122055SFrançois Tigeot }
69862a9d7eSFrançois Tigeot
70862a9d7eSFrançois Tigeot #include <asm/processor.h>
71862a9d7eSFrançois Tigeot
72862a9d7eSFrançois Tigeot struct cpuinfo_x86 boot_cpu_data;
73862a9d7eSFrançois Tigeot
74862a9d7eSFrançois Tigeot static int
init_boot_cpu_data(void * arg)75862a9d7eSFrançois Tigeot init_boot_cpu_data(void *arg)
76862a9d7eSFrançois Tigeot {
77862a9d7eSFrançois Tigeot boot_cpu_data.x86_clflush_size = cpu_clflush_line_size;
78862a9d7eSFrançois Tigeot
79862a9d7eSFrançois Tigeot return 0;
80862a9d7eSFrançois Tigeot }
81862a9d7eSFrançois Tigeot
82862a9d7eSFrançois Tigeot SYSINIT(boot_cpu_data_init, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, init_boot_cpu_data, NULL);
83ef59fcb6SFrançois Tigeot
84ef59fcb6SFrançois Tigeot #include <linux/sched.h>
85ef59fcb6SFrançois Tigeot
get_task_pid(struct task_struct * task,enum pid_type type)86ef59fcb6SFrançois Tigeot pid_t get_task_pid(struct task_struct *task, enum pid_type type)
87ef59fcb6SFrançois Tigeot {
88ef59fcb6SFrançois Tigeot if (task->dfly_td == NULL)
89ef59fcb6SFrançois Tigeot return -1;
90ef59fcb6SFrançois Tigeot
91ef59fcb6SFrançois Tigeot if (task->dfly_td->td_proc == NULL)
92ef59fcb6SFrançois Tigeot return -1;
93ef59fcb6SFrançois Tigeot
94ef59fcb6SFrançois Tigeot return task->dfly_td->td_proc->p_pid;
95ef59fcb6SFrançois Tigeot }
96*78973132SSergey Zigachev
97*78973132SSergey Zigachev #include <linux/mm.h>
98*78973132SSergey Zigachev
99*78973132SSergey Zigachev void
si_meminfo(struct sysinfo * si)100*78973132SSergey Zigachev si_meminfo(struct sysinfo *si)
101*78973132SSergey Zigachev {
102*78973132SSergey Zigachev si->totalram = physmem;
103*78973132SSergey Zigachev si->totalhigh = 0;
104*78973132SSergey Zigachev si->mem_unit = PAGE_SIZE;
105*78973132SSergey Zigachev }
106