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