Pārlūkot izejas kodu

[romprefix] Allow BANNER_TIMEOUT to control banners in romprefix.S

In particular, allow BANNER_TIMEOUT=0 to inhibit the prompt banners
altogether.

Ironically, this request comes from the same OEM that originally
required the prompts to be present during POST.
tags/v0.9.4
Michael Brown 16 gadus atpakaļ
vecāks
revīzija
539f94b980
1 mainītis faili ar 26 papildinājumiem un 18 dzēšanām
  1. 26
    18
      src/arch/i386/prefix/romprefix.S

+ 26
- 18
src/arch/i386/prefix/romprefix.S Parādīt failu

@@ -6,6 +6,8 @@
6 6
  * table so using a noticeable amount of stack space is a no-no.
7 7
  */
8 8
 
9
+#include <config/general.h>
10
+
9 11
 #define PNP_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'n' << 16 ) + ( 'P' << 24 ) )
10 12
 #define PMM_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'M' << 16 ) + ( 'M' << 24 ) )
11 13
 #define PCI_SIGNATURE ( 'P' + ( 'C' << 8 ) + ( 'I' << 16 ) + ( ' ' << 24 ) )
@@ -13,6 +15,13 @@
13 15
 #define PNP_GET_BBS_VERSION 0x60
14 16
 #define PMM_ALLOCATE 0x0000
15 17
 
18
+/* ROM banner timeout.  Based on the configurable BANNER_TIMEOUT in
19
+ * config.h, but converted to a number of (18Hz) timer ticks, and
20
+ * doubled to allow for BIOSes that switch video modes immediately
21
+ * beforehand, so rendering the message almost invisible to the user.
22
+ */
23
+#define ROM_BANNER_TIMEOUT ( 2 * ( 18 * BANNER_TIMEOUT ) / 10 )
24
+
16 25
 	.text
17 26
 	.code16
18 27
 	.arch i386
@@ -318,6 +327,12 @@ no_pmm:
318 327
 	/* Wait for Ctrl-B */
319 328
 	movw	$0xff02, %bx
320 329
 	call	wait_for_key
330
+	/* Clear prompt */
331
+	pushf
332
+	movw	$clear_message, %si
333
+	xorw	%di, %di
334
+	call	print_message
335
+	popf
321 336
 	jnz	1f
322 337
 	/* Ctrl-B was pressed: invoke gPXE.  The keypress will be
323 338
 	 * picked up by the initial shell prompt, and we will drop
@@ -326,11 +341,6 @@ no_pmm:
326 341
 	pushw	%cs
327 342
 	call	exec
328 343
 1:
329
-	/* Print blank lines to terminate messages */
330
-	movw	$init_message_end, %si
331
-	xorw	%di, %di
332
-	call	print_message
333
-
334 344
 	/* Restore registers */
335 345
 	popw	%gs
336 346
 	popw	%fs
@@ -364,9 +374,9 @@ init_message_int19:
364 374
 init_message_prompt:
365 375
 	.asciz	"\nPress Ctrl-B to configure gPXE..."
366 376
 	.size	init_message_prompt, . - init_message_prompt
367
-init_message_end:
368
-	.asciz	"\n\n\n"
369
-	.size	init_message_end, . - init_message_end
377
+clear_message:
378
+	.asciz	"\r                                     \n\n"
379
+	.size	clear_message, . - clear_message
370 380
 
371 381
 /* ROM image location
372 382
  *
@@ -421,17 +431,18 @@ int19_entry:
421 431
 	call	print_message
422 432
 	movw	$0xdf42, %bx
423 433
 	call	wait_for_key
434
+	pushf
435
+	movw	$clear_message, %si
436
+	xorw	%di, %di
437
+	call	print_message
438
+	popf
424 439
 	jnz	1f
425 440
 	/* Leave keypress in buffer and start gPXE.  The keypress will
426 441
 	 * cause the usual initial Ctrl-B prompt to be skipped.
427 442
 	 */
428 443
 	pushw	%cs
429 444
 	call	exec
430
-1:	/* Print blank lines to terminate messages */
431
-	movw	$int19_message_end, %si
432
-	xorw	%di, %di
433
-	call	print_message
434
-	/* Try to call original INT 19 vector */
445
+1:	/* Try to call original INT 19 vector */
435 446
 	movl	%cs:orig_int19, %eax
436 447
 	testl	%eax, %eax
437 448
 	je	2f
@@ -449,9 +460,6 @@ int19_message_prompt:
449 460
 int19_message_dots:
450 461
 	.asciz	"..."
451 462
 	.size	int19_message_dots, . - int19_message_dots
452
-int19_message_end:
453
-	.asciz	"\n\n\n"
454
-	.size	int19_message_end, . - int19_message_end
455 463
 	
456 464
 /* Execute as a boot device
457 465
  *
@@ -578,8 +586,8 @@ wait_for_key:
578 586
 	xorw	%ax, %ax
579 587
 	int	$0x16
580 588
 	jmp	1b
581
-2:	/* Wait for up to 5s for a key press */
582
-	movw	$(18 * 5), %cx	/* Approx 5s worth of timer ticks */
589
+2:	/* Wait for a key press */
590
+	movw	$ROM_BANNER_TIMEOUT, %cx
583 591
 3:	decw	%cx
584 592
 	js	99f		/* Exit with ZF clear */
585 593
 	/* Wait for timer tick to be updated */

Notiek ielāde…
Atcelt
Saglabāt