mb/amb/birman*/gpio: remove configuration for VDD_MEM_VID[0,1]
[coreboot2.git] / payloads / external / tint / tint-0.07_libpayload.patch
blob6c9594a369be78326583eda9fa97929a5ee37e7d
1 diff -rupN tint-0.05/config.h tint/config.h
2 --- tint-0.05/config.h 2001-12-08 00:03:24.000000000 +0100
3 +++ tint/config.h 2021-02-09 08:00:00.000000000 +0200
4 @@ -29,7 +29,15 @@
5 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
6 */
8 +#include <libpayload.h>
9 +#include <curses.h>
11 +#define curs_set(x)
12 +#define USE_RAND
14 /* Score file */
15 +#if 0
16 const char scorefile[] = SCOREFILE;
17 +#endif
19 #endif /* #ifndef CONFIG_H */
20 diff -rupN tint-0.05/engine.c tint/engine.c
21 --- tint-0.05/engine.c 2005-07-17 13:26:22.000000000 +0200
22 +++ tint/engine.c 2021-02-09 08:00:00.000000000 +0200
23 @@ -27,10 +27,13 @@
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 +#include "config.h"
29 +#if 0
30 #include <stdlib.h>
31 #include <string.h>
32 +#endif
34 -#include "typedefs.h"
35 #include "utils.h"
36 #include "io.h"
37 #include "engine.h"
38 diff -rupN tint-0.05/engine.h tint/engine.h
39 --- tint-0.05/engine.h 2001-12-07 16:48:08.000000000 +0100
40 +++ tint/engine.h 2021-02-09 08:00:00.000000000 +0200
41 @@ -29,7 +29,7 @@
42 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 -#include "typedefs.h" /* bool */
46 +#include "curses.h" /* bool */
49 * Macros
50 diff -rupN tint-0.05/io.c tint/io.c
51 --- tint-0.05/io.c 2010-06-23 15:05:12.000000000 +0100
52 +++ tint/io.c 2021-02-09 08:00:00.000000000 +0200
53 @@ -27,9 +27,13 @@
54 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 +#include "config.h"
59 +#if 0
60 #include <stdarg.h> /* va_list(), va_start(), va_end() */
61 #include <sys/time.h> /* gettimeofday() */
62 #include <unistd.h> /* gettimeofday() */
63 +#endif
65 #include "io.h"
67 @@ -68,7 +72,11 @@ static int in_timeleft;
68 /* Initialize screen */
69 void io_init ()
71 + curses_enable_serial(0);
72 + curses_enable_vga(1);
73 initscr ();
74 + halfdelay(1);
75 + timeout(1);
76 start_color ();
77 curs_set (CURSOR_INVISIBLE);
78 out_attr = A_NORMAL;
79 @@ -177,11 +185,17 @@ void out_beep ()
80 /* Read a character. Please note that you MUST call in_timeout() before in_getch() */
81 int in_getch ()
83 +#if 0
84 struct timeval starttv,endtv;
85 +#endif
86 int ch;
87 +#if 0
88 timeout (in_timeleft / 1000);
89 gettimeofday (&starttv,NULL);
90 +#endif
91 ch = getch ();
92 + mdelay(150);
93 +#if 0
94 gettimeofday (&endtv,NULL);
95 /* Timeout? */
96 if (ch == ERR)
97 @@ -199,6 +213,7 @@ int in_getch ()
98 in_timeleft -= endtv.tv_usec;
99 if (in_timeleft <= 0) in_timeleft = in_timetotal;
101 +#endif
102 return ch;
105 diff -rupN tint-0.05/io.h tint/io.h
106 --- tint-0.05/io.h 2010-06-23 14:55:03.000000000 +0100
107 +++ tint/io.h 2021-02-09 08:00:00.000000000 +0200
108 @@ -30,7 +30,6 @@
111 #include <curses.h>
112 -#include <wchar.h>
115 * Colors
116 diff -rupN tint-0.05/Makefile tint/Makefile
117 --- tint-0.05/Makefile 2010-06-23 15:06:11.000000000 +0200
118 +++ tint/Makefile 2021-02-09 08:00:00.000000000 +0200
119 @@ -0,0 +1,106 @@
121 +# -*- sh -*-
123 +# Copyright (c) Abraham vd Merwe <abz@blio.net>
124 +# All rights reserved.
126 +# Redistribution and use in source and binary forms, with or without
127 +# modification, are permitted provided that the following conditions
128 +# are met:
129 +# 1. Redistributions of source code must retain the above copyright
130 +# notice, this list of conditions and the following disclaimer.
132 +# 2. Redistributions in binary form must reproduce the above copyright
133 +# notice, this list of conditions and the following disclaimer in the
134 +# documentation and/or other materials provided with the distribution.
135 +# 3. Neither the name of the author nor the names of other contributors
136 +# may be used to endorse or promote products derived from this software
137 +# without specific prior written permission.
139 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
140 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
141 +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
142 +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
143 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
144 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
145 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
146 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
147 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
148 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
150 +# in addition to the dependency below, create the file if it doesn't exist
151 +# to silence warnings about a file that would be generated anyway.
152 +$(if $(wildcard .xcompile),,$(eval $(shell ../../../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
153 +.xcompile: ../../../../util/xcompile/xcompile
155 +CONFIG_COMPILER_GCC := y
156 +ARCH-y := x86_32
158 +include .xcompile
160 +src := $(CURDIR)
161 +srctree := $(src)
162 +tint_obj := $(src)/build
164 +LIBCONFIG_PATH := $(realpath ../../../libpayload)
165 +LIBPAYLOAD_DIR := $(tint_obj)/libpayload
166 +HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/lib/libpayload.a)
167 +LIB_CONFIG ?= configs/defconfig-tinycurses
169 +# CFLAGS := -Wall -Werror -Os
170 +CFLAGS := -Wall -g -Os
171 +TARGET := tint
172 +OBJS := $(TARGET).o engine.o io.o utils.o
174 +ARCH-y := x86_32
176 +CC := $(CC_$(ARCH-y))
177 +AS := $(AS_$(ARCH-y))
178 +OBJCOPY := $(OBJCOPY_$(ARCH-y))
180 +LPCC := CC="$(CC)" $(LIBPAYLOAD_DIR)/bin/lpgcc
181 +LPAS := AS="$(AS)" $(LIBPAYLOAD_DIR)/bin/lpas
183 +# Make is silent per default, but 'make V=1' will show all compiler calls.
184 +ifneq ($(V),1)
185 +Q := @
186 +endif
188 +all: $(TARGET).elf
189 +# printf" CC $(CC)\n"
191 +$(TARGET).elf: $(OBJS) libpayload
192 + $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
193 + $(Q)$(LPCC) -o $@ $(OBJS)
194 + $(Q)$(OBJCOPY) --only-keep-debug $@ tint.debug
195 + $(Q)$(OBJCOPY) --strip-debug $@
196 + $(Q)$(OBJCOPY) --add-gnu-debuglink=tint.debug $@
198 +%.o: %.c libpayload
199 + $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n"
200 + $(Q)$(LPCC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
202 +%.S.o: %.S libpayload
203 + $(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n"
204 + $(Q)$(LPAS) $(ASFLAGS) --32 -o $@ $<
206 +ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
207 +libpayload:
208 + $(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
209 +else
210 +libpayload:
211 + $(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
212 + $(Q)make -C $(LIBCONFIG_PATH) distclean
213 + $(Q)make -C $(LIBCONFIG_PATH) defconfig KBUILD_DEFCONFIG=$(LIB_CONFIG)
214 + $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(tint_obj) install
215 +endif
217 +clean:
218 + $(Q)rm -f $(TARGET).elf $(TARGET).debug *.o
219 + $(Q)rm .xcompile
221 +distclean: clean
222 + $(Q)rm -rf $(tint_obj)
225 +.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
226 diff -rupN tint-0.05/tint.c tint/tint.c
227 --- tint-0.05/tint.c 2010-08-08 19:42:50.000000000 +0200
228 +++ tint/tint.c 2021-02-09 08:00:00.000000000 +0200
229 @@ -1,4 +1,3 @@
232 * Copyright (c) Abraham vd Merwe <abz@blio.net>
233 * All rights reserved.
234 @@ -27,6 +26,7 @@
235 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
238 +#if 0
239 #include <stdlib.h>
240 #include <stdio.h>
241 #include <string.h>
242 @@ -34,8 +34,8 @@
243 #include <pwd.h>
244 #include <sys/types.h>
245 #include <unistd.h>
246 +#endif
248 -#include "typedefs.h"
249 #include "utils.h"
250 #include "io.h"
251 #include "config.h"
252 @@ -304,7 +304,7 @@ static void showstatus (engine_t *engine
253 /***************************************************************************/
255 /* Header for scorefile */
256 -#define SCORE_HEADER "Tint 0.02b (c) Abraham vd Merwe - Scores"
257 +#define SCORE_HEADER "Tint 0.05 (c) Abraham vd Merwe - Scores"
259 /* Header for score title */
260 static const char scoretitle[] = "\n\t TINT HIGH SCORES\n\n\tRank Score Name\n\n";
261 @@ -322,6 +322,7 @@ typedef struct
262 time_t timestamp;
263 } score_t;
265 +#if 0
266 static void getname (char *name)
268 struct passwd *pw = getpwuid (geteuid ());
269 @@ -338,7 +339,9 @@ static void getname (char *name)
270 name[NAMELEN - 1] = '\0';
273 +#endif
275 +#if 0
276 static void err1 ()
278 fprintf (stderr,"Error creating %s\n",scorefile);
279 @@ -350,10 +353,11 @@ static void err2 ()
280 fprintf (stderr,"Error writing to %s\n",scorefile);
281 exit (EXIT_FAILURE);
283 +#endif
285 void showplayerstats (engine_t *engine)
287 - fprintf (stderr,
288 + printf (
289 "\n\t PLAYER STATISTICS\n\n\t"
290 "Score %11d\n\t"
291 "Efficiency %11d\n\t"
292 @@ -361,6 +365,7 @@ void showplayerstats (engine_t *engine)
293 GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
296 +#if 0
297 static void createscores (int score)
299 FILE *handle;
300 @@ -395,7 +400,9 @@ static void createscores (int score)
301 fprintf (stderr,"%s",scoretitle);
302 fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name);
304 +#endif
306 +#if 0
307 static int cmpscores (const void *a,const void *b)
309 int result;
310 @@ -413,7 +420,9 @@ static int cmpscores (const void *a,cons
311 /* timestamps is equal */
312 return 0;
314 +#endif
316 +#if 0
317 static void savescores (int score)
319 FILE *handle;
320 @@ -491,11 +500,13 @@ static void savescores (int score)
322 fprintf (stderr,"\n");
324 +#endif
326 /***************************************************************************/
327 /***************************************************************************/
328 /***************************************************************************/
330 +#if 0
331 static void showhelp ()
333 fprintf (stderr,"USAGE: tint [-h] [-l level] [-n] [-d] [-b char]\n");
334 @@ -506,9 +517,11 @@ static void showhelp ()
335 fprintf (stderr," -b <char> Use this character to draw blocks instead of spaces\n");
336 exit (EXIT_FAILURE);
338 +#endif
340 static void parse_options (int argc,char *argv[])
342 +#if 0
343 int i = 1;
344 while (i < argc)
346 @@ -544,10 +557,12 @@ static void parse_options (int argc,char
348 i++;
350 +#endif
353 static void choose_level ()
355 +#if 0
356 char buf[NAMELEN];
359 @@ -557,6 +572,8 @@ static void choose_level ()
360 buf[strlen (buf) - 1] = '\0';
362 while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
363 +#endif
364 + level = 1;
367 /***************************************************************************/
368 @@ -569,6 +586,8 @@ int main (int argc,char *argv[])
369 int ch;
370 engine_t engine;
371 /* Initialize */
372 + if (CONFIG(LP_USB))
373 + usb_initialize();
374 rand_init (); /* must be called before engine_init () */
375 engine_init (&engine,score_function); /* must be called before using engine.curshape */
376 finished = shownext = FALSE;
377 @@ -632,12 +651,14 @@ int main (int argc,char *argv[])
378 /* pause */
379 case 'p':
380 out_setcolor (COLOR_WHITE,COLOR_BLACK);
381 - out_gotoxy ((out_width () - 34) / 2,out_height () - 2);
382 + out_gotoxy ((out_width () - 34) / 2,out_height () / 2);
383 out_printf ("Paused - Press any key to continue");
384 + refresh ();
385 while ((ch = in_getch ()) == ERR) ; /* Wait for a key to be pressed */
386 in_flush (); /* Clear keyboard buffer */
387 - out_gotoxy ((out_width () - 34) / 2,out_height () - 2);
388 + out_gotoxy ((out_width () - 34) / 2,out_height () / 2);
389 out_printf (" ");
390 + refresh ();
391 break;
392 /* unknown keypress */
393 default:
394 @@ -672,12 +693,32 @@ int main (int argc,char *argv[])
395 while (!finished);
396 /* Restore console settings and exit */
397 io_close ();
398 +#if 0
399 /* Don't bother the player if he want's to quit */
400 if (ch != 'q')
402 +#endif
403 showplayerstats (&engine);
404 +#if 0
405 savescores (GETSCORE (engine.score));
407 +#endif
408 + printf("Press 'q' to reboot...\n");
409 + refresh();
410 + for (;;) {
411 + in_flush ();
412 + while ((ch = in_getch ()) == ERR) ; /* Wait for a key to be pressed */
413 + if (ch == 'q') { /* reboot */
414 + outb(0x6, 0xcf9);
415 + for(;;); //halt();
417 + else {
418 + in_flush ();
422 +#if 0
423 exit (EXIT_SUCCESS);
424 +#endif
427 diff -rupN tint-0.05/utils.c tint/utils.c
428 --- tint-0.05/utils.c 2001-12-07 16:49:19.000000000 +0100
429 +++ tint/utils.c 2021-02-09 08:00:00.000000000 +0200
430 @@ -27,11 +27,13 @@
431 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
434 +#include "config.h"
436 +#if 0
437 #include <stdlib.h>
438 #include <time.h>
439 #include <limits.h>
441 -#include "typedefs.h"
442 +#endif
445 * Initialize random number generator
446 @@ -61,6 +63,7 @@ int rand_value (int range)
447 * Convert an str to long. Returns TRUE if successful,
448 * FALSE otherwise.
450 +#if 0
451 bool str2int (int *i,const char *str)
453 char *endptr;
454 @@ -69,3 +72,4 @@ bool str2int (int *i,const char *str)
455 return TRUE;
458 +#endif
459 diff -rupN tint-0.05/utils.h tint/utils.h
460 --- tint-0.05/utils.h 2001-12-07 16:49:35.000000000 +0100
461 +++ tint/utils.h 2021-02-09 08:00:00.000000000 +0200
462 @@ -29,7 +29,7 @@
463 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
466 -#include "typedefs.h"
467 +#include <curses.h>
470 * Initialize random number generator