From patchwork Sat Feb 7 00:17:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cory Fields X-Patchwork-Id: 5956 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n16NJVaR022182 for ; Fri, 6 Feb 2009 23:19:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752949AbZBFXT0 (ORCPT ); Fri, 6 Feb 2009 18:19:26 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753021AbZBFXT0 (ORCPT ); Fri, 6 Feb 2009 18:19:26 -0500 Received: from mout.perfora.net ([74.208.4.194]:62440 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752949AbZBFXTY (ORCPT ); Fri, 6 Feb 2009 18:19:24 -0500 Received: from localhost.localdomain (c-24-30-35-55.hsd1.ga.comcast.net [24.30.35.55]) by mrelay.perfora.net (node=mrus1) with ESMTP (Nemesis) id 0MKpCa-1LVZyk0eU6-0007TW; Fri, 06 Feb 2009 18:19:23 -0500 From: Cory Fields To: kvm@vger.kernel.org Subject: [PATCH 4/4] probe for quietboot and fastboot in rombios Date: Fri, 6 Feb 2009 19:17:05 -0500 Message-Id: <1233965825-17970-5-git-send-email-FOSS@AtlasTechnologiesInc.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1233965825-17970-1-git-send-email-FOSS@AtlasTechnologiesInc.com> References: <1233965825-17970-1-git-send-email-FOSS@AtlasTechnologiesInc.com> X-Provags-ID: V01U2FsdGVkX1/2Kt+BDV60/nqiafJiMUM85YI3x4V/UUfpzBt 65ivk4stpCu+0c2joaiXvqaSNTdRg7AFAP3Ky7mBbsghFfv/Hf eQwMnrs8bzT7eWskRak6mgfIbdzStqpGQ0RDYv75gY= Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If fastboot is set skip "Press f12 for boot menu" If quietboot is set silence all text output Errors should still be shown Probes are split into separate functions to make the asm easier. Signed-off-by: Cory Fields --- bios/rombios.c | 80 +++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 57 insertions(+), 23 deletions(-) diff --git a/bios/rombios.c b/bios/rombios.c index c4f6ccd..b5e3846 100644 --- a/bios/rombios.c +++ b/bios/rombios.c @@ -144,6 +144,11 @@ #define BX_PCIBIOS 1 #define BX_APM 1 +#define BX_CFG_CTL_PORT 0x510 +#define BX_CFG_DATA_PORT 0x511 +#define BX_CFG_FASTBOOT 0x07 +#define BX_CFG_QUIETBOOT 0x08 + #define BX_USE_ATADRV 1 #define BX_ELTORITO_BOOT 1 @@ -2014,6 +2019,20 @@ Bit16u i; ipl_entry_t *e; return 1; } +static int qemu_fastboot_probe() +{ + outw(BX_CFG_CTL_PORT, BX_CFG_FASTBOOT); + if (inb(BX_CFG_DATA_PORT)) return 1; + return 0; + } + +static int qemu_quietboot_probe() +{ + outw(BX_CFG_CTL_PORT, BX_CFG_QUIETBOOT); + if (inb(BX_CFG_DATA_PORT)) return 1; + return 0; + } + #if BX_ELTORITO_BOOT void interactive_bootkey() @@ -2481,6 +2500,9 @@ void ata_detect( ) Bit16u ebda_seg=read_word(0x0040,0x000E); Bit8u hdcount, cdcount, device, type; Bit8u buffer[0x0200]; + Bit8u quietboot; + + quietboot = qemu_quietboot_probe(); #if BX_MAX_ATA_INTERFACES > 0 write_byte(ebda_seg,&EbdaData->ata.channels[0].iface,ATA_IFACE_ISA); @@ -2739,36 +2761,38 @@ void ata_detect( ) break; } - switch (type) { - case ATA_TYPE_ATA: - printf("ata%d %s: ",channel,slave?" slave":"master"); - i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c); - if (sizeinmb < (1UL<<16)) - printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb); - else - printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10)); - break; - case ATA_TYPE_ATAPI: - printf("ata%d %s: ",channel,slave?" slave":"master"); - i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c); - if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM) - printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version); - else - printf(" ATAPI-%d Device\n",version); - break; - case ATA_TYPE_UNKNOWN: - printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master"); - break; + if (!quietboot){ + switch (type) { + case ATA_TYPE_ATA: + printf("ata%d %s: ",channel,slave?" slave":"master"); + i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c); + if (sizeinmb < (1UL<<16)) + printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb); + else + printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10)); + break; + case ATA_TYPE_ATAPI: + printf("ata%d %s: ",channel,slave?" slave":"master"); + i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c); + if(read_byte(ebda_seg,&EbdaData->ata.devices[device].device)==ATA_DEVICE_CDROM) + printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version); + else + printf(" ATAPI-%d Device\n",version); + break; + case ATA_TYPE_UNKNOWN: + printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master"); + break; + } } } } - + // Store the devices counts write_byte(ebda_seg,&EbdaData->ata.hdcount, hdcount); write_byte(ebda_seg,&EbdaData->ata.cdcount, cdcount); write_byte(0x40,0x75, hdcount); - printf("\n"); + if (!quietboot) printf("\n"); // FIXME : should use bios=cmos|auto|disable bits // FIXME : should know about translation bits @@ -10669,7 +10693,11 @@ post_default_ints: mov ax, #0xc780 call rom_scan + call _qemu_quietboot_probe + test al,al + jnz skip_bios_print call _print_bios_banner + skip_bios_print: #if BX_ROMBIOS32 call rombios32_init @@ -10716,7 +10744,13 @@ post_default_ints: call rom_scan #if BX_ELTORITO_BOOT - call _interactive_bootkey + + call _qemu_fastboot_probe + test al,al + jnz skip_timer + call _interactive_bootkey + +skip_timer: #endif // BX_ELTORITO_BOOT sti ;; enable interrupts