Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
Michael Brown committed Sep 25, 2008
1 parent aa8d972 commit 539f94b
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions src/arch/i386/prefix/romprefix.S
Expand Up @@ -6,13 +6,22 @@
* table so using a noticeable amount of stack space is a no-no.
*/

#include <config/general.h>

#define PNP_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'n' << 16 ) + ( 'P' << 24 ) )
#define PMM_SIGNATURE ( '$' + ( 'P' << 8 ) + ( 'M' << 16 ) + ( 'M' << 24 ) )
#define PCI_SIGNATURE ( 'P' + ( 'C' << 8 ) + ( 'I' << 16 ) + ( ' ' << 24 ) )
#define STACK_MAGIC ( 'L' + ( 'R' << 8 ) + ( 'E' << 16 ) + ( 'T' << 24 ) )
#define PNP_GET_BBS_VERSION 0x60
#define PMM_ALLOCATE 0x0000

/* ROM banner timeout. Based on the configurable BANNER_TIMEOUT in
* config.h, but converted to a number of (18Hz) timer ticks, and
* doubled to allow for BIOSes that switch video modes immediately
* beforehand, so rendering the message almost invisible to the user.
*/
#define ROM_BANNER_TIMEOUT ( 2 * ( 18 * BANNER_TIMEOUT ) / 10 )

.text
.code16
.arch i386
Expand Down Expand Up @@ -318,6 +327,12 @@ no_pmm:
/* Wait for Ctrl-B */
movw $0xff02, %bx
call wait_for_key
/* Clear prompt */
pushf
movw $clear_message, %si
xorw %di, %di
call print_message
popf
jnz 1f
/* Ctrl-B was pressed: invoke gPXE. The keypress will be
* picked up by the initial shell prompt, and we will drop
Expand All @@ -326,11 +341,6 @@ no_pmm:
pushw %cs
call exec
1:
/* Print blank lines to terminate messages */
movw $init_message_end, %si
xorw %di, %di
call print_message

/* Restore registers */
popw %gs
popw %fs
Expand Down Expand Up @@ -364,9 +374,9 @@ init_message_int19:
init_message_prompt:
.asciz "\nPress Ctrl-B to configure gPXE..."
.size init_message_prompt, . - init_message_prompt
init_message_end:
.asciz "\n\n\n"
.size init_message_end, . - init_message_end
clear_message:
.asciz "\r \n\n"
.size clear_message, . - clear_message

/* ROM image location
*
Expand Down Expand Up @@ -421,17 +431,18 @@ int19_entry:
call print_message
movw $0xdf42, %bx
call wait_for_key
pushf
movw $clear_message, %si
xorw %di, %di
call print_message
popf
jnz 1f
/* Leave keypress in buffer and start gPXE. The keypress will
* cause the usual initial Ctrl-B prompt to be skipped.
*/
pushw %cs
call exec
1: /* Print blank lines to terminate messages */
movw $int19_message_end, %si
xorw %di, %di
call print_message
/* Try to call original INT 19 vector */
1: /* Try to call original INT 19 vector */
movl %cs:orig_int19, %eax
testl %eax, %eax
je 2f
Expand All @@ -449,9 +460,6 @@ int19_message_prompt:
int19_message_dots:
.asciz "..."
.size int19_message_dots, . - int19_message_dots
int19_message_end:
.asciz "\n\n\n"
.size int19_message_end, . - int19_message_end

/* Execute as a boot device
*
Expand Down Expand Up @@ -578,8 +586,8 @@ wait_for_key:
xorw %ax, %ax
int $0x16
jmp 1b
2: /* Wait for up to 5s for a key press */
movw $(18 * 5), %cx /* Approx 5s worth of timer ticks */
2: /* Wait for a key press */
movw $ROM_BANNER_TIMEOUT, %cx
3: decw %cx
js 99f /* Exit with ZF clear */
/* Wait for timer tick to be updated */
Expand Down

0 comments on commit 539f94b

Please sign in to comment.