From: "Sebastian Herbszt" <herbszt@gmx.de>
To: "Laurent Vivier" <Laurent.Vivier@bull.net>,
<bochs-developers@lists.sourceforge.net>
Cc: "Laurent Vivier" <Laurent.Vivier@bull.net>, <kvm@vger.kernel.org>
Subject: Re: [Bochs-developers] [PATCH][BIOS] Fill IPL table accordingdiscovered ATA drives
Date: Sun, 7 Dec 2008 19:11:03 +0100 [thread overview]
Message-ID: <4A58ABD7D38C471D9D5865C3E634515E@FSCPC> (raw)
In-Reply-To: <1228494009-20270-1-git-send-email-Laurent.Vivier@bull.net>
Laurent Vivier wrote:
> This patch shows in boot menu only available devices.
>
> This patch has been tested with Bochs BIOS version from the KVM source tree.
>
> Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
> ---
> bios/rombios.c | 54 +++++++++++++++++++++++++++++++++++++-----------------
> 1 files changed, 37 insertions(+), 17 deletions(-)
>
> diff --git a/bios/rombios.c b/bios/rombios.c
> index 70b3584..d2a7c09 100644
> --- a/bios/rombios.c
> +++ b/bios/rombios.c
> @@ -1981,18 +1981,6 @@ init_boot_vectors()
> memcpyb(IPL_SEG, IPL_TABLE_OFFSET + count * sizeof (e), ss, &e, sizeof (e));
> count++;
>
> - /* First HDD */
> - e.type = IPL_TYPE_HARDDISK; e.flags = 0; e.vector = 0; e.description = 0; e.reserved = 0;
> - memcpyb(IPL_SEG, IPL_TABLE_OFFSET + count * sizeof (e), ss, &e, sizeof (e));
> - count++;
We need this bit for the !BX_USE_ATADRV case. Please "#if !BX_USE_ATADRV ... #endif" it
instead of removing.
> -#if BX_ELTORITO_BOOT
> - /* CDROM */
> - e.type = IPL_TYPE_CDROM; e.flags = 0; e.vector = 0; e.description = 0; e.reserved = 0;
> - memcpyb(IPL_SEG, IPL_TABLE_OFFSET + count * sizeof (e), ss, &e, sizeof (e));
> - count++;
> -#endif
This is ok since BX_ELTORITO_BOOT depends on BX_USE_ATADRV.
> /* Remember how many devices we have */
> write_word(IPL_SEG, IPL_COUNT_OFFSET, count);
> /* Not tried booting anything yet */
> @@ -2027,15 +2015,19 @@ Bit16u i;
> if (i >= count) return 0;
> type = read_word(IPL_SEG, IPL_TABLE_OFFSET + i * sizeof (ipl_entry_t),
> sizeof(Bit16u));
> - if (type != IPL_TYPE_HARDDISK)
> + if (type == IPL_TYPE_HARDDISK)
> + drv = 0x80;
> + else if(type == IPL_TYPE_CDROM)
Please put a space between "if" and "(".
> + drv = 0xe0;
> + else
> return 0;
> - for (curr = 0, drv = 0; curr < i; curr++) {
> + for (curr = 0; curr < i; curr++) {
> curr_type = read_word(IPL_SEG,
> IPL_TABLE_OFFSET + curr * sizeof (ipl_entry_t),
> sizeof(Bit16u));
> if (type == curr_type) drv++;
> }
> - return 0x80 + drv;
> + return drv;
> }
>
> #if BX_ELTORITO_BOOT
> @@ -2082,6 +2074,9 @@ interactive_bootkey()
> memcpyb(ss, &description, (Bit16u)(e.description >> 16), (Bit16u)(e.description & 0xffff), 32);
> description[32] = 0;
> printf(" [%S]", ss, description);
> + } else {
> + Bit16u drive = get_bootdrv(i);
> + if (drive) printf(" (0x%02x)", drive);
get_bootdrv() returns Bit8u.
> }
> printf("\n");
> break;
> @@ -2484,6 +2479,9 @@ void ata_detect( )
> Bit16u ebda_seg=read_word(0x0040,0x000E);
> Bit8u hdcount, cdcount, device, type;
> Bit8u buffer[0x0200];
> + Bit16u ss = get_SS();
> + ipl_entry_t e;
> + Bit16u count;
>
> #if BX_MAX_ATA_INTERFACES > 0
> write_byte(ebda_seg,&EbdaData->ata.channels[0].iface,ATA_IFACE_ISA);
> @@ -2750,6 +2748,16 @@ void ata_detect( )
> printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
> else
> printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, (Bit16u)(sizeinmb>>10));
> + /* add to IPL list */
> + count = read_word(IPL_SEG, IPL_COUNT_OFFSET);
> + e.type = IPL_TYPE_HARDDISK;
> + e.flags = 0;
> + e.vector = 0;
> + e.description = 0;
> + e.reserved = 0;
> + memcpyb(IPL_SEG, IPL_TABLE_OFFSET + count * sizeof (e),
> + ss, &e, sizeof (e));
> + write_word(IPL_SEG, IPL_COUNT_OFFSET, count + 1);
> break;
> case ATA_TYPE_ATAPI:
> printf("ata%d %s: ",channel,slave?" slave":"master");
> @@ -2758,6 +2766,18 @@ void ata_detect( )
> printf(" ATAPI-%d CD-Rom/DVD-Rom\n",version);
> else
> printf(" ATAPI-%d Device\n",version);
> + /* add to IPL list */
> +#if BX_ELTORITO_BOOT
> + count = read_word(IPL_SEG, IPL_COUNT_OFFSET);
> + e.type = IPL_TYPE_CDROM;
> + e.flags = 0;
> + e.vector = 0;
> + e.description = 0;
> + e.reserved = 0;
> + memcpyb(IPL_SEG, IPL_TABLE_OFFSET + count * sizeof (e),
> + ss, &e, sizeof (e));
> + write_word(IPL_SEG, IPL_COUNT_OFFSET, count + 1);
> +#endif
> break;
> case ATA_TYPE_UNKNOWN:
> printf("ata%d %s: Unknown device\n",channel,slave?" slave":"master");
> @@ -10663,6 +10683,8 @@ post_default_ints:
> ;;
> call hard_drive_post
>
> + call _init_boot_vectors
> +
> #if BX_USE_ATADRV
>
> ;;
> @@ -10682,8 +10704,6 @@ post_default_ints:
> ;;
> #endif // BX_ELTORITO_BOOT
>
> - call _init_boot_vectors
> -
> mov cx, #0xc800 ;; init option roms
> mov ax, #0xe000
> call rom_scan
> --
- Sebastian
next prev parent reply other threads:[~2008-12-07 18:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-05 16:20 [PATCH][BIOS] Fill IPL table according discovered ATA drives Laurent Vivier
2008-12-07 18:11 ` Sebastian Herbszt [this message]
2008-12-08 10:05 ` [Bochs-developers] [PATCH][BIOS] Fill IPL table accordingdiscovered " Laurent Vivier
2008-12-09 22:50 ` [Bochs-developers] [PATCH][BIOS] Fill IPL tableaccordingdiscovered " Sebastian Herbszt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A58ABD7D38C471D9D5865C3E634515E@FSCPC \
--to=herbszt@gmx.de \
--cc=Laurent.Vivier@bull.net \
--cc=bochs-developers@lists.sourceforge.net \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox