1 /* Copyright 2013-2014 IBM Corp.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * 	http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include <stdlib.h>
17 #include <stdio.h>
18 #include <stdarg.h>
19 #include <string.h>
20 #include <stdint.h>
21 
22 #include <compiler.h>
23 #include "../../ccan/list/list.c"
24 
25 void _prlog(int log_level __attribute__((unused)), const char* fmt, ...) __attribute__((format (printf, 2, 3)));
26 
27 #ifndef pr_fmt
28 #define pr_fmt(fmt) fmt
29 #endif
30 #define prlog(l, f, ...) do { _prlog(l, pr_fmt(f), ##__VA_ARGS__); } while(0)
31 
_prlog(int log_level,const char * fmt,...)32 void _prlog(int log_level __attribute__((unused)), const char* fmt, ...)
33 {
34         va_list ap;
35 
36         va_start(ap, fmt);
37         vprintf(fmt, ap);
38         va_end(ap);
39 }
40 
41 /* Add any stub functions required for linking here. */
stub_function(void)42 static void stub_function(void)
43 {
44 	abort();
45 }
46 
47 struct cpu_thread;
48 
49 struct cpu_job *__cpu_queue_job(struct cpu_thread *cpu,
50 				const char *name,
51 				void (*func)(void *data), void *data,
52 				bool no_return);
53 
54 void cpu_wait_job(struct cpu_job *job, bool free_it);
55 void cpu_process_local_jobs(void);
56 struct cpu_job *cpu_queue_job_on_node(uint32_t chip_id,
57 				       const char *name,
58 				       void (*func)(void *data), void *data);
59 
cpu_queue_job_on_node(uint32_t chip_id,const char * name,void (* func)(void * data),void * data)60 struct cpu_job *cpu_queue_job_on_node(uint32_t chip_id,
61 				       const char *name,
62 				       void (*func)(void *data), void *data)
63 {
64 	(void)chip_id;
65 	return __cpu_queue_job(NULL, name, func, data, false);
66 }
67 
__cpu_queue_job(struct cpu_thread * cpu,const char * name,void (* func)(void * data),void * data,bool no_return)68 struct cpu_job *__cpu_queue_job(struct cpu_thread *cpu,
69 				const char *name,
70 				void (*func)(void *data), void *data,
71 				bool no_return)
72 {
73 	(void)cpu;
74 	(void)name;
75 	(func)(data);
76 	(void)no_return;
77 	return NULL;
78 }
79 
cpu_wait_job(struct cpu_job * job,bool free_it)80 void __attrconst cpu_wait_job(struct cpu_job *job, bool free_it)
81 {
82 	(void)job;
83 	(void)free_it;
84 	return;
85 }
86 
cpu_process_local_jobs(void)87 void __attrconst cpu_process_local_jobs(void)
88 {
89 }
90 
91 #define STUB(fnname) \
92 	void fnname(void) __attribute__((weak, alias ("stub_function")))
93 
94 STUB(fdt_begin_node);
95 STUB(fdt_property);
96 STUB(fdt_end_node);
97 STUB(fdt_create_with_flags);
98 STUB(fdt_add_reservemap_entry);
99 STUB(fdt_finish_reservemap);
100 STUB(fdt_strerror);
101 STUB(fdt_check_header);
102 STUB(fdt_check_node_offset_);
103 STUB(fdt_next_tag);
104 STUB(fdt_string);
105 STUB(fdt_get_name);
106 STUB(dt_first);
107 STUB(dt_next);
108 STUB(dt_has_node_property);
109 STUB(dt_get_address);
110 STUB(add_chip_dev_associativity);
111